@jlongo78/agent-spaces 0.7.5 → 0.7.7

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 (634) hide show
  1. package/.next/standalone/.claude/settings.local.json +55 -0
  2. package/.next/standalone/.claude/spaces-env.json +1 -0
  3. package/.next/standalone/.next/BUILD_ID +1 -1
  4. package/.next/standalone/.next/app-path-routes-manifest.json +2 -1
  5. package/.next/standalone/.next/build-manifest.json +5 -5
  6. package/.next/standalone/.next/prerender-manifest.json +27 -3
  7. package/.next/standalone/.next/required-server-files.json +19 -19
  8. package/.next/standalone/.next/routes-manifest.json +6 -0
  9. package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page/build-manifest.json +3 -3
  10. package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/(desktop)/admin/users/page/build-manifest.json +3 -3
  12. package/.next/standalone/.next/server/app/(desktop)/admin/users/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/(desktop)/analytics/page/build-manifest.json +3 -3
  14. package/.next/standalone/.next/server/app/(desktop)/analytics/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/(desktop)/cortex/page/build-manifest.json +3 -3
  16. package/.next/standalone/.next/server/app/(desktop)/cortex/page/react-loadable-manifest.json +3 -3
  17. package/.next/standalone/.next/server/app/(desktop)/cortex/page.js.nft.json +1 -1
  18. package/.next/standalone/.next/server/app/(desktop)/cortex/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/(desktop)/network/page/build-manifest.json +3 -3
  20. package/.next/standalone/.next/server/app/(desktop)/network/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/.next/server/app/(desktop)/page/build-manifest.json +3 -3
  22. package/.next/standalone/.next/server/app/(desktop)/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/(desktop)/projects/page/build-manifest.json +3 -3
  24. package/.next/standalone/.next/server/app/(desktop)/projects/page_client-reference-manifest.js +1 -1
  25. package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page/build-manifest.json +3 -3
  26. package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page_client-reference-manifest.js +1 -1
  27. package/.next/standalone/.next/server/app/(desktop)/sessions/page/build-manifest.json +3 -3
  28. package/.next/standalone/.next/server/app/(desktop)/sessions/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/(desktop)/settings/page/build-manifest.json +3 -3
  30. package/.next/standalone/.next/server/app/(desktop)/settings/page_client-reference-manifest.js +1 -1
  31. package/.next/standalone/.next/server/app/(desktop)/terminal/page/build-manifest.json +3 -3
  32. package/.next/standalone/.next/server/app/(desktop)/terminal/page.js.nft.json +1 -1
  33. package/.next/standalone/.next/server/app/(desktop)/terminal/page_client-reference-manifest.js +1 -1
  34. package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page/build-manifest.json +3 -3
  35. package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page.js.nft.json +1 -1
  36. package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page_client-reference-manifest.js +1 -1
  37. package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page/build-manifest.json +3 -3
  38. package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page.js.nft.json +1 -1
  39. package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page_client-reference-manifest.js +1 -1
  40. package/.next/standalone/.next/server/app/(desktop)/workspaces/page/build-manifest.json +3 -3
  41. package/.next/standalone/.next/server/app/(desktop)/workspaces/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +3 -3
  43. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  44. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  45. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  46. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  47. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  48. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  49. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  50. package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +3 -3
  51. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  52. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  53. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  54. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  55. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  56. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  57. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  58. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  59. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  60. package/.next/standalone/.next/server/app/admin/analytics.html +1 -1
  61. package/.next/standalone/.next/server/app/admin/analytics.rsc +7 -6
  62. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics/__PAGE__.segment.rsc +2 -2
  63. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics.segment.rsc +1 -1
  64. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  65. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  66. package/.next/standalone/.next/server/app/admin/analytics.segments/_full.segment.rsc +7 -6
  67. package/.next/standalone/.next/server/app/admin/analytics.segments/_head.segment.rsc +1 -1
  68. package/.next/standalone/.next/server/app/admin/analytics.segments/_index.segment.rsc +2 -2
  69. package/.next/standalone/.next/server/app/admin/analytics.segments/_tree.segment.rsc +2 -2
  70. package/.next/standalone/.next/server/app/admin/users.html +1 -1
  71. package/.next/standalone/.next/server/app/admin/users.rsc +2 -2
  72. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users/__PAGE__.segment.rsc +1 -1
  73. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users.segment.rsc +1 -1
  74. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  75. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  76. package/.next/standalone/.next/server/app/admin/users.segments/_full.segment.rsc +2 -2
  77. package/.next/standalone/.next/server/app/admin/users.segments/_head.segment.rsc +1 -1
  78. package/.next/standalone/.next/server/app/admin/users.segments/_index.segment.rsc +2 -2
  79. package/.next/standalone/.next/server/app/admin/users.segments/_tree.segment.rsc +2 -2
  80. package/.next/standalone/.next/server/app/analytics.html +1 -1
  81. package/.next/standalone/.next/server/app/analytics.rsc +3 -3
  82. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics/__PAGE__.segment.rsc +2 -2
  83. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics.segment.rsc +1 -1
  84. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  85. package/.next/standalone/.next/server/app/analytics.segments/_full.segment.rsc +3 -3
  86. package/.next/standalone/.next/server/app/analytics.segments/_head.segment.rsc +1 -1
  87. package/.next/standalone/.next/server/app/analytics.segments/_index.segment.rsc +2 -2
  88. package/.next/standalone/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
  89. package/.next/standalone/.next/server/app/api/analytics/overview/route.js.nft.json +1 -1
  90. package/.next/standalone/.next/server/app/api/bulk/route.js.nft.json +1 -1
  91. package/.next/standalone/.next/server/app/api/config/route.js.nft.json +1 -1
  92. package/.next/standalone/.next/server/app/api/cortex/context/route.js.nft.json +1 -1
  93. package/.next/standalone/.next/server/app/api/cortex/curation/assess/route.js.nft.json +1 -1
  94. package/.next/standalone/.next/server/app/api/cortex/curation/publish/route.js.nft.json +1 -1
  95. package/.next/standalone/.next/server/app/api/cortex/curation/refine/route.js.nft.json +1 -1
  96. package/.next/standalone/.next/server/app/api/cortex/curation/review/route.js.nft.json +1 -1
  97. package/.next/standalone/.next/server/app/api/cortex/curation/seed/route.js.nft.json +1 -1
  98. package/.next/standalone/.next/server/app/api/cortex/export/route.js.nft.json +1 -1
  99. package/.next/standalone/.next/server/app/api/cortex/federation/pending/route.js.nft.json +1 -1
  100. package/.next/standalone/.next/server/app/api/cortex/federation/resolve/route.js.nft.json +1 -1
  101. package/.next/standalone/.next/server/app/api/cortex/federation/search/route.js.nft.json +1 -1
  102. package/.next/standalone/.next/server/app/api/cortex/federation/teach/route.js.nft.json +1 -1
  103. package/.next/standalone/.next/server/app/api/cortex/graph/edges/route.js.nft.json +1 -1
  104. package/.next/standalone/.next/server/app/api/cortex/graph/entities/[id]/route.js.nft.json +1 -1
  105. package/.next/standalone/.next/server/app/api/cortex/graph/entities/route.js.nft.json +1 -1
  106. package/.next/standalone/.next/server/app/api/cortex/graph/populate/route.js.nft.json +1 -1
  107. package/.next/standalone/.next/server/app/api/cortex/import/route.js.nft.json +1 -1
  108. package/.next/standalone/.next/server/app/api/cortex/import/status/route.js.nft.json +1 -1
  109. package/.next/standalone/.next/server/app/api/cortex/ingest/bootstrap/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/api/cortex/ingest/status/route.js.nft.json +1 -1
  111. package/.next/standalone/.next/server/app/api/cortex/knowledge/[id]/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/cortex/knowledge/route.js.nft.json +1 -1
  113. package/.next/standalone/.next/server/app/api/cortex/lobes/[id]/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/cortex/lobes/route.js.nft.json +1 -1
  115. package/.next/standalone/.next/server/app/api/cortex/lobes/share/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/cortex/marketplace/browse/route.js.nft.json +1 -1
  117. package/.next/standalone/.next/server/app/api/cortex/marketplace/preview/route.js.nft.json +1 -1
  118. package/.next/standalone/.next/server/app/api/cortex/mcp/call/route.js.nft.json +1 -1
  119. package/.next/standalone/.next/server/app/api/cortex/mcp/tools/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/api/cortex/search/route.js.nft.json +1 -1
  121. package/.next/standalone/.next/server/app/api/cortex/settings/route.js.nft.json +1 -1
  122. package/.next/standalone/.next/server/app/api/cortex/status/route.js.nft.json +1 -1
  123. package/.next/standalone/.next/server/app/api/cortex/timeline/route.js.nft.json +1 -1
  124. package/.next/standalone/.next/server/app/api/cortex/usage/route.js.nft.json +1 -1
  125. package/.next/standalone/.next/server/app/api/cortex/workspace/[id]/context/route.js.nft.json +1 -1
  126. package/.next/standalone/.next/server/app/api/events/route.js.nft.json +1 -1
  127. package/.next/standalone/.next/server/app/api/folders/route.js.nft.json +1 -1
  128. package/.next/standalone/.next/server/app/api/network/handshake/route.js.nft.json +1 -1
  129. package/.next/standalone/.next/server/app/api/network/projects/route.js.nft.json +1 -1
  130. package/.next/standalone/.next/server/app/api/network/search/route.js.nft.json +1 -1
  131. package/.next/standalone/.next/server/app/api/network/sessions/[id]/messages/route.js.nft.json +1 -1
  132. package/.next/standalone/.next/server/app/api/network/sessions/[id]/route.js.nft.json +1 -1
  133. package/.next/standalone/.next/server/app/api/network/sessions/route.js.nft.json +1 -1
  134. package/.next/standalone/.next/server/app/api/network/workspaces/[id]/route.js.nft.json +1 -1
  135. package/.next/standalone/.next/server/app/api/network/workspaces/route.js.nft.json +1 -1
  136. package/.next/standalone/.next/server/app/api/panes/[id]/route.js.nft.json +1 -1
  137. package/.next/standalone/.next/server/app/api/panes/route.js.nft.json +1 -1
  138. package/.next/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  139. package/.next/standalone/.next/server/app/api/search/route.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js.nft.json +1 -1
  141. package/.next/standalone/.next/server/app/api/sessions/[id]/messages/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  143. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/sync/route.js.nft.json +1 -1
  145. package/.next/standalone/.next/server/app/api/tags/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/tier/route.js.nft.json +1 -1
  147. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/[key]/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/route.js.nft.json +1 -1
  149. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/[msgId]/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/route.js.nft.json +1 -1
  151. package/.next/standalone/.next/server/app/api/workspaces/[id]/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/workspaces/[id]/sessions/route.js.nft.json +1 -1
  153. package/.next/standalone/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/cortex.html +1 -1
  155. package/.next/standalone/.next/server/app/cortex.rsc +3 -3
  156. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex/__PAGE__.segment.rsc +2 -2
  157. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex.segment.rsc +1 -1
  158. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  159. package/.next/standalone/.next/server/app/cortex.segments/_full.segment.rsc +3 -3
  160. package/.next/standalone/.next/server/app/cortex.segments/_head.segment.rsc +1 -1
  161. package/.next/standalone/.next/server/app/cortex.segments/_index.segment.rsc +2 -2
  162. package/.next/standalone/.next/server/app/cortex.segments/_tree.segment.rsc +2 -2
  163. package/.next/standalone/.next/server/app/login/page/build-manifest.json +3 -3
  164. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  165. package/.next/standalone/.next/server/app/login.html +1 -1
  166. package/.next/standalone/.next/server/app/login.rsc +2 -2
  167. package/.next/standalone/.next/server/app/login.segments/_full.segment.rsc +2 -2
  168. package/.next/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
  169. package/.next/standalone/.next/server/app/login.segments/_index.segment.rsc +2 -2
  170. package/.next/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  171. package/.next/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  172. package/.next/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
  173. package/.next/standalone/.next/server/app/m/page/build-manifest.json +3 -3
  174. package/.next/standalone/.next/server/app/m/page_client-reference-manifest.js +1 -1
  175. package/.next/standalone/.next/server/app/m/projects/page/build-manifest.json +3 -3
  176. package/.next/standalone/.next/server/app/m/projects/page_client-reference-manifest.js +1 -1
  177. package/.next/standalone/.next/server/app/m/projects.html +1 -1
  178. package/.next/standalone/.next/server/app/m/projects.rsc +2 -2
  179. package/.next/standalone/.next/server/app/m/projects.segments/_full.segment.rsc +2 -2
  180. package/.next/standalone/.next/server/app/m/projects.segments/_head.segment.rsc +1 -1
  181. package/.next/standalone/.next/server/app/m/projects.segments/_index.segment.rsc +2 -2
  182. package/.next/standalone/.next/server/app/m/projects.segments/_tree.segment.rsc +2 -2
  183. package/.next/standalone/.next/server/app/m/projects.segments/m/projects/__PAGE__.segment.rsc +1 -1
  184. package/.next/standalone/.next/server/app/m/projects.segments/m/projects.segment.rsc +1 -1
  185. package/.next/standalone/.next/server/app/m/projects.segments/m.segment.rsc +1 -1
  186. package/.next/standalone/.next/server/app/m/sessions/[id]/page/build-manifest.json +3 -3
  187. package/.next/standalone/.next/server/app/m/sessions/[id]/page_client-reference-manifest.js +1 -1
  188. package/.next/standalone/.next/server/app/m/sessions/page/build-manifest.json +3 -3
  189. package/.next/standalone/.next/server/app/m/sessions/page_client-reference-manifest.js +1 -1
  190. package/.next/standalone/.next/server/app/m/sessions.html +1 -1
  191. package/.next/standalone/.next/server/app/m/sessions.rsc +2 -2
  192. package/.next/standalone/.next/server/app/m/sessions.segments/_full.segment.rsc +2 -2
  193. package/.next/standalone/.next/server/app/m/sessions.segments/_head.segment.rsc +1 -1
  194. package/.next/standalone/.next/server/app/m/sessions.segments/_index.segment.rsc +2 -2
  195. package/.next/standalone/.next/server/app/m/sessions.segments/_tree.segment.rsc +2 -2
  196. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions/__PAGE__.segment.rsc +1 -1
  197. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions.segment.rsc +1 -1
  198. package/.next/standalone/.next/server/app/m/sessions.segments/m.segment.rsc +1 -1
  199. package/.next/standalone/.next/server/app/m/settings/page/build-manifest.json +3 -3
  200. package/.next/standalone/.next/server/app/m/settings/page_client-reference-manifest.js +1 -1
  201. package/.next/standalone/.next/server/app/m/settings.html +1 -1
  202. package/.next/standalone/.next/server/app/m/settings.rsc +2 -2
  203. package/.next/standalone/.next/server/app/m/settings.segments/_full.segment.rsc +2 -2
  204. package/.next/standalone/.next/server/app/m/settings.segments/_head.segment.rsc +1 -1
  205. package/.next/standalone/.next/server/app/m/settings.segments/_index.segment.rsc +2 -2
  206. package/.next/standalone/.next/server/app/m/settings.segments/_tree.segment.rsc +2 -2
  207. package/.next/standalone/.next/server/app/m/settings.segments/m/settings/__PAGE__.segment.rsc +1 -1
  208. package/.next/standalone/.next/server/app/m/settings.segments/m/settings.segment.rsc +1 -1
  209. package/.next/standalone/.next/server/app/m/settings.segments/m.segment.rsc +1 -1
  210. package/.next/standalone/.next/server/app/m/terminal/page/build-manifest.json +3 -3
  211. package/.next/standalone/.next/server/app/m/terminal/page_client-reference-manifest.js +1 -1
  212. package/.next/standalone/.next/server/app/m/terminal.html +1 -1
  213. package/.next/standalone/.next/server/app/m/terminal.rsc +3 -3
  214. package/.next/standalone/.next/server/app/m/terminal.segments/_full.segment.rsc +3 -3
  215. package/.next/standalone/.next/server/app/m/terminal.segments/_head.segment.rsc +1 -1
  216. package/.next/standalone/.next/server/app/m/terminal.segments/_index.segment.rsc +2 -2
  217. package/.next/standalone/.next/server/app/m/terminal.segments/_tree.segment.rsc +2 -2
  218. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal/__PAGE__.segment.rsc +2 -2
  219. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal.segment.rsc +1 -1
  220. package/.next/standalone/.next/server/app/m/terminal.segments/m.segment.rsc +1 -1
  221. package/.next/standalone/.next/server/app/m.html +1 -1
  222. package/.next/standalone/.next/server/app/m.rsc +2 -2
  223. package/.next/standalone/.next/server/app/m.segments/_full.segment.rsc +2 -2
  224. package/.next/standalone/.next/server/app/m.segments/_head.segment.rsc +1 -1
  225. package/.next/standalone/.next/server/app/m.segments/_index.segment.rsc +2 -2
  226. package/.next/standalone/.next/server/app/m.segments/_tree.segment.rsc +2 -2
  227. package/.next/standalone/.next/server/app/m.segments/m/__PAGE__.segment.rsc +1 -1
  228. package/.next/standalone/.next/server/app/m.segments/m.segment.rsc +1 -1
  229. package/.next/standalone/.next/server/app/network.html +1 -1
  230. package/.next/standalone/.next/server/app/network.rsc +2 -2
  231. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network/__PAGE__.segment.rsc +1 -1
  232. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network.segment.rsc +1 -1
  233. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  234. package/.next/standalone/.next/server/app/network.segments/_full.segment.rsc +2 -2
  235. package/.next/standalone/.next/server/app/network.segments/_head.segment.rsc +1 -1
  236. package/.next/standalone/.next/server/app/network.segments/_index.segment.rsc +2 -2
  237. package/.next/standalone/.next/server/app/network.segments/_tree.segment.rsc +2 -2
  238. package/.next/standalone/.next/server/app/projects.html +1 -1
  239. package/.next/standalone/.next/server/app/projects.rsc +2 -2
  240. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects/__PAGE__.segment.rsc +1 -1
  241. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects.segment.rsc +1 -1
  242. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  243. package/.next/standalone/.next/server/app/projects.segments/_full.segment.rsc +2 -2
  244. package/.next/standalone/.next/server/app/projects.segments/_head.segment.rsc +1 -1
  245. package/.next/standalone/.next/server/app/projects.segments/_index.segment.rsc +2 -2
  246. package/.next/standalone/.next/server/app/projects.segments/_tree.segment.rsc +2 -2
  247. package/.next/standalone/.next/server/app/sessions.html +1 -1
  248. package/.next/standalone/.next/server/app/sessions.rsc +2 -2
  249. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions/__PAGE__.segment.rsc +1 -1
  250. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions.segment.rsc +1 -1
  251. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  252. package/.next/standalone/.next/server/app/sessions.segments/_full.segment.rsc +2 -2
  253. package/.next/standalone/.next/server/app/sessions.segments/_head.segment.rsc +1 -1
  254. package/.next/standalone/.next/server/app/sessions.segments/_index.segment.rsc +2 -2
  255. package/.next/standalone/.next/server/app/sessions.segments/_tree.segment.rsc +2 -2
  256. package/.next/standalone/.next/server/app/settings.html +1 -1
  257. package/.next/standalone/.next/server/app/settings.rsc +2 -2
  258. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings/__PAGE__.segment.rsc +1 -1
  259. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings.segment.rsc +1 -1
  260. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  261. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  262. package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  263. package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  264. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  265. package/.next/standalone/.next/server/app/terminal.html +1 -1
  266. package/.next/standalone/.next/server/app/terminal.rsc +3 -3
  267. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal/__PAGE__.segment.rsc +2 -2
  268. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal.segment.rsc +1 -1
  269. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  270. package/.next/standalone/.next/server/app/terminal.segments/_full.segment.rsc +3 -3
  271. package/.next/standalone/.next/server/app/terminal.segments/_head.segment.rsc +1 -1
  272. package/.next/standalone/.next/server/app/terminal.segments/_index.segment.rsc +2 -2
  273. package/.next/standalone/.next/server/app/terminal.segments/_tree.segment.rsc +2 -2
  274. package/.next/standalone/.next/server/app/vr/page/app-paths-manifest.json +3 -0
  275. package/.next/standalone/.next/server/app/vr/page/build-manifest.json +18 -0
  276. package/.next/standalone/.next/server/app/vr/page/next-font-manifest.json +11 -0
  277. package/.next/standalone/.next/server/app/vr/page/react-loadable-manifest.json +11 -0
  278. package/.next/standalone/.next/server/app/vr/page/server-reference-manifest.json +4 -0
  279. package/.next/standalone/.next/server/app/vr/page.js +17 -0
  280. package/.next/standalone/.next/server/app/vr/page.js.map +5 -0
  281. package/.next/standalone/.next/server/app/vr/page.js.nft.json +1 -0
  282. package/.next/standalone/.next/server/app/vr/page_client-reference-manifest.js +2 -0
  283. package/.next/standalone/.next/server/app/vr.html +1 -0
  284. package/.next/standalone/.next/server/app/vr.meta +15 -0
  285. package/.next/standalone/.next/server/app/vr.rsc +21 -0
  286. package/.next/standalone/.next/server/app/vr.segments/_full.segment.rsc +21 -0
  287. package/.next/standalone/.next/server/app/vr.segments/_head.segment.rsc +6 -0
  288. package/.next/standalone/.next/server/app/vr.segments/_index.segment.rsc +6 -0
  289. package/.next/standalone/.next/server/app/vr.segments/_tree.segment.rsc +4 -0
  290. package/.next/standalone/.next/server/app/vr.segments/vr/__PAGE__.segment.rsc +9 -0
  291. package/.next/standalone/.next/server/app/vr.segments/vr.segment.rsc +4 -0
  292. package/.next/standalone/.next/server/app/workspaces.html +1 -1
  293. package/.next/standalone/.next/server/app/workspaces.rsc +2 -2
  294. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces/__PAGE__.segment.rsc +1 -1
  295. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces.segment.rsc +1 -1
  296. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  297. package/.next/standalone/.next/server/app/workspaces.segments/_full.segment.rsc +2 -2
  298. package/.next/standalone/.next/server/app/workspaces.segments/_head.segment.rsc +1 -1
  299. package/.next/standalone/.next/server/app/workspaces.segments/_index.segment.rsc +2 -2
  300. package/.next/standalone/.next/server/app/workspaces.segments/_tree.segment.rsc +2 -2
  301. package/.next/standalone/.next/server/app-paths-manifest.json +2 -1
  302. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0041efe4._.js +2 -2
  303. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00bf0ace._.js +2 -2
  304. package/.next/standalone/.next/server/chunks/[root-of-the-server]__08a68343._.js +1 -1
  305. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0add852f._.js +1 -1
  306. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0c113ed0._.js +1 -1
  307. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e1a27e0._.js +1 -1
  308. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e71d908._.js +3 -3
  309. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0e9142f3._.js +2 -2
  310. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10e47926._.js +2 -2
  311. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1194f2c1._.js +1 -1
  312. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1665dc78._.js +2 -2
  313. package/.next/standalone/.next/server/chunks/[root-of-the-server]__175cbabf._.js +2 -2
  314. package/.next/standalone/.next/server/chunks/[root-of-the-server]__19c2d094._.js +1 -1
  315. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1adae357._.js +2 -2
  316. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1d359752._.js +2 -2
  317. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1e8fabeb._.js +3 -3
  318. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1f8deca0._.js +8 -8
  319. package/.next/standalone/.next/server/chunks/[root-of-the-server]__253fdda1._.js +2 -2
  320. package/.next/standalone/.next/server/chunks/[root-of-the-server]__28e6434f._.js +2 -2
  321. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2a386564._.js +3 -3
  322. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2acbd703._.js +1 -1
  323. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2acefabb._.js +1 -1
  324. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2c20fb38._.js +2 -2
  325. package/.next/standalone/.next/server/chunks/[root-of-the-server]__309132cd._.js +1 -1
  326. package/.next/standalone/.next/server/chunks/[root-of-the-server]__33fec964._.js +3 -3
  327. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3786d8ae._.js +2 -2
  328. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3ae92407._.js +2 -2
  329. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3beda9fe._.js +2 -2
  330. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3e3f25a1._.js +1 -1
  331. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4619e9bd._.js +1 -1
  332. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4a051043._.js +2 -2
  333. package/.next/standalone/.next/server/chunks/[root-of-the-server]__50208a5f._.js +1 -1
  334. package/.next/standalone/.next/server/chunks/[root-of-the-server]__508002e4._.js +2 -2
  335. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5086c373._.js +2 -2
  336. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5913e097._.js +2 -2
  337. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5b5f68d2._.js +2 -2
  338. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5c1f2459._.js +2 -2
  339. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5ec8c977._.js +2 -2
  340. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5f8c694a._.js +1 -1
  341. package/.next/standalone/.next/server/chunks/[root-of-the-server]__63cebc6c._.js +2 -2
  342. package/.next/standalone/.next/server/chunks/[root-of-the-server]__64d30d4d._.js +2 -2
  343. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c54fc2e._.js +2 -2
  344. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6dc1fb7e._.js +2 -2
  345. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6e568102._.js +2 -2
  346. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6faa04c0._.js +2 -2
  347. package/.next/standalone/.next/server/chunks/[root-of-the-server]__727d05f1._.js +1 -1
  348. package/.next/standalone/.next/server/chunks/[root-of-the-server]__74a34dc3._.js +2 -2
  349. package/.next/standalone/.next/server/chunks/[root-of-the-server]__75d12b32._.js +1 -1
  350. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7e7250a4._.js +2 -2
  351. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8309e0a4._.js +2 -2
  352. package/.next/standalone/.next/server/chunks/[root-of-the-server]__86cc0e2b._.js +6 -6
  353. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8915603e._.js +1 -1
  354. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89c2565a._.js +2 -2
  355. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8d178ad9._.js +2 -2
  356. package/.next/standalone/.next/server/chunks/[root-of-the-server]__93ee06f3._.js +3 -3
  357. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9e4c154a._.js +2 -2
  358. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a1fbc199._.js +1 -1
  359. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a9d2e1d3._.js +2 -2
  360. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ae53d343._.js +2 -2
  361. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b3a04cef._.js +2 -2
  362. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b4270b77._.js +1 -1
  363. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b6b6ce60._.js +1 -1
  364. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b9545dd9._.js +1 -1
  365. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c200e21a._.js +1 -1
  366. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c3c74ca4._.js +1 -1
  367. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c88b63f7._.js +2 -2
  368. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cba5f007._.js +1 -1
  369. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cbf4ceb0._.js +2 -2
  370. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cefdba2f._.js +2 -2
  371. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cf9e82bb._.js +2 -2
  372. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d15515e3._.js +1 -1
  373. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d2897392._.js +2 -2
  374. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d3b2d856._.js +2 -2
  375. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d73273ca._.js +2 -2
  376. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d8417eb6._.js +2 -2
  377. package/.next/standalone/.next/server/chunks/[root-of-the-server]__db4726bc._.js +1 -1
  378. package/.next/standalone/.next/server/chunks/[root-of-the-server]__dc2a55de._.js +2 -2
  379. package/.next/standalone/.next/server/chunks/[root-of-the-server]__dc6e2e5f._.js +1 -1
  380. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e0d4690b._.js +3 -3
  381. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e3ecfd17._.js +3 -3
  382. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e678dd53._.js +1 -1
  383. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e9223f55._.js +2 -2
  384. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ea630076._.js +3 -3
  385. package/.next/standalone/.next/server/chunks/[root-of-the-server]__eb8acb65._.js +1 -1
  386. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f26ca49d._.js +1 -1
  387. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f33e1101._.js +2 -2
  388. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f3a4c668._.js +1 -1
  389. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f515f865._.js +2 -2
  390. package/.next/standalone/.next/server/chunks/[root-of-the-server]__fceb5d60._.js +2 -2
  391. package/.next/standalone/.next/server/chunks/[root-of-the-server]__fed41403._.js +2 -2
  392. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ff2e98c2._.js +2 -2
  393. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_339169c8.js +1 -1
  394. package/.next/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_97dac613.js +1 -1
  395. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0d8d81ca._.js +1 -1
  396. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1425c64f._.js +1 -1
  397. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__1d2ce8f1._.js +1 -1
  398. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__31137509._.js +1 -1
  399. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__3633a587._.js +1 -1
  400. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__3c79441b._.js +1 -1
  401. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__4ca0f26b._.js +1 -1
  402. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__5b90d3ad._.js +3 -0
  403. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__62a0b363._.js +1 -1
  404. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__66aca5d4._.js +1 -1
  405. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__68205a46._.js +1 -1
  406. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__69fd2efa._.js +1 -1
  407. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__85dcf0f7._.js +1 -1
  408. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__8c53a5da._.js +1 -1
  409. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__aecb1873._.js +1 -1
  410. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__b02cd143._.js +1 -1
  411. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__b9bcde11._.js +3 -0
  412. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__cac90169._.js +1 -1
  413. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__d25de2f0._.js +1 -1
  414. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__e2f86be8._.js +1 -1
  415. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__ee626b5b._.js +1 -1
  416. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__f39a9e98._.js +1 -1
  417. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__f3c566cd._.js +1 -1
  418. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__f76aa221._.js +1 -1
  419. package/.next/standalone/.next/server/chunks/ssr/_149d7fd4._.js +1 -1
  420. package/.next/standalone/.next/server/chunks/ssr/_2230ad2d._.js +1 -1
  421. package/.next/standalone/.next/server/chunks/ssr/_2e0dd6a7._.js +1 -1
  422. package/.next/standalone/.next/server/chunks/ssr/_3cd2355c._.js +1 -1
  423. package/.next/standalone/.next/server/chunks/ssr/_3d206597._.js +4 -0
  424. package/.next/standalone/.next/server/chunks/ssr/_47cc9af0._.js +1 -1
  425. package/.next/standalone/.next/server/chunks/ssr/_5cf334fd._.js +3 -0
  426. package/.next/standalone/.next/server/chunks/ssr/_7082788b._.js +1 -1
  427. package/.next/standalone/.next/server/chunks/ssr/_7154d8ae._.js +1 -1
  428. package/.next/standalone/.next/server/chunks/ssr/_75bb1b9a._.js +1 -1
  429. package/.next/standalone/.next/server/chunks/ssr/{_aeeff784._.js → _81abf587._.js} +2 -2
  430. package/.next/standalone/.next/server/chunks/ssr/_8acf81e2._.js +1 -1
  431. package/.next/standalone/.next/server/chunks/ssr/_8c36feb8._.js +1 -1
  432. package/.next/standalone/.next/server/chunks/ssr/_91e9bb86._.js +1 -1
  433. package/.next/standalone/.next/server/chunks/ssr/_ac4c1838._.js +1 -1
  434. package/.next/standalone/.next/server/chunks/ssr/_ad8515fc._.js +1 -1
  435. package/.next/standalone/.next/server/chunks/ssr/_b1f49e81._.js +1 -1
  436. package/.next/standalone/.next/server/chunks/ssr/_c0fe7614._.js +1 -1
  437. package/.next/standalone/.next/server/chunks/ssr/_d4825f5a._.js +1 -1
  438. package/.next/standalone/.next/server/chunks/ssr/_da10a9f4._.js +1 -1
  439. package/.next/standalone/.next/server/chunks/ssr/_db0abd0a._.js +3 -0
  440. package/.next/standalone/.next/server/chunks/ssr/_db2fec84._.js +1 -1
  441. package/.next/standalone/.next/server/chunks/ssr/_dee5d4a1._.js +1 -1
  442. package/.next/standalone/.next/server/chunks/ssr/_ef482c0c._.js +1 -1
  443. package/.next/standalone/.next/server/chunks/ssr/_efe43d2f._.js +1 -1
  444. package/.next/standalone/.next/server/chunks/ssr/_f4a4e116._.js +1 -1
  445. package/.next/standalone/.next/server/chunks/ssr/_f4d525d2._.js +1 -1
  446. package/.next/standalone/.next/server/chunks/ssr/_f4e57187._.js +3 -0
  447. package/.next/standalone/.next/server/chunks/ssr/_next-internal_server_app_vr_page_actions_3fb70d92.js +3 -0
  448. package/.next/standalone/.next/server/chunks/ssr/node_modules_32f9d62f._.js +1 -1
  449. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_02f39477.js +1 -1
  450. package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_eedfc1fd._.js +1 -1
  451. package/.next/standalone/.next/server/chunks/ssr/src_40fa36ce._.js +7 -0
  452. package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_cortex_page_tsx_0f33d8b3._.js +3 -0
  453. package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__32a0045c._.js +1 -1
  454. package/.next/standalone/.next/server/edge/chunks/_d73df637._.js +1 -1
  455. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  456. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  457. package/.next/standalone/.next/server/next-font-manifest.js +1 -1
  458. package/.next/standalone/.next/server/next-font-manifest.json +4 -0
  459. package/.next/standalone/.next/server/pages/404.html +1 -1
  460. package/.next/standalone/.next/server/pages/500.html +2 -2
  461. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  462. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  463. package/.next/standalone/.next/static/chunks/045c83caa4d15373.js +1 -0
  464. package/.next/standalone/.next/static/chunks/07ea09e6024a523b.js +1 -0
  465. package/.next/standalone/.next/static/chunks/{aae9e0fa485bd835.js → 158b52b84e647ac1.js} +2 -2
  466. package/.next/standalone/.next/static/chunks/232d8aae4fefab70.js +1 -0
  467. package/.next/standalone/.next/static/chunks/2ad22562bb37ecad.js +1011 -0
  468. package/.next/standalone/.next/static/chunks/{a4e5c700421eaa46.js → 412140a02893327a.js} +1 -1
  469. package/.next/standalone/.next/static/chunks/481cc11ae80b08b1.js +1 -0
  470. package/.next/standalone/.next/static/chunks/5325351ef49cb65f.js +1 -0
  471. package/.next/standalone/.next/static/chunks/559735e598ca3cbb.js +1 -0
  472. package/.next/standalone/.next/static/chunks/59c63d5af5cf3daf.js +1 -0
  473. package/.next/standalone/.next/static/chunks/5d5d7b0095dd52ae.js +1 -0
  474. package/.next/standalone/.next/static/chunks/69606d281c39f9b2.js +1 -0
  475. package/.next/standalone/.next/static/chunks/6ae575967d091df4.js +1 -0
  476. package/.next/standalone/.next/static/chunks/7f8455bb855a6c84.js +1 -0
  477. package/.next/standalone/.next/static/chunks/84fe8d44deeeb74f.js +757 -0
  478. package/.next/standalone/.next/static/chunks/898f380eba90427a.js +1 -0
  479. package/.next/standalone/.next/static/chunks/95339e55722bb4ca.js +5 -0
  480. package/.next/standalone/.next/static/chunks/9cd594813c539df9.js +1 -0
  481. package/.next/standalone/.next/static/chunks/{7424664c6ffa94bd.js → 9cfa0291d55d8d2a.js} +1 -1
  482. package/.next/standalone/.next/static/chunks/ad1423eed05d129b.js +1 -0
  483. package/.next/standalone/.next/static/chunks/ae7b146884c67d2a.js +1 -0
  484. package/.next/standalone/.next/static/chunks/b84072d72aa86417.js +1 -0
  485. package/.next/standalone/.next/static/chunks/c1a95aebf6725f64.css +3 -0
  486. package/.next/standalone/.next/static/chunks/c515eb77d9410aa0.js +5 -0
  487. package/.next/standalone/.next/static/chunks/{9899cf4c2bdbe61d.js → d9ae203a7f123546.js} +2 -2
  488. package/.next/standalone/.next/static/chunks/e116953dc83d4eec.js +1 -0
  489. package/.next/standalone/.next/static/chunks/fdc09bd135846960.js +1 -0
  490. package/.next/standalone/.next/static/chunks/ff0196911449e745.js +1 -0
  491. package/.next/standalone/.next/static/chunks/{turbopack-4c21186b79fb4c10.js → turbopack-e1a0994ed4af988c.js} +1 -1
  492. package/.next/standalone/.spaces/cortex-context.md +70 -0
  493. package/.next/standalone/bin/cortex-hook.sh +62 -62
  494. package/.next/standalone/bin/cortex-mcp.js +60 -60
  495. package/.next/standalone/docs/superpowers/plans/2026-03-13-cortex-wiring.md +1387 -1387
  496. package/.next/standalone/docs/superpowers/plans/2026-03-14-cortex-v2-entity-graph.md +1923 -1923
  497. package/.next/standalone/docs/superpowers/plans/2026-03-14-cortex-v2-knowledge-evolution.md +1113 -1113
  498. package/.next/standalone/docs/superpowers/plans/2026-03-15-cortex-v2-boundary-engine.md +853 -853
  499. package/.next/standalone/docs/superpowers/plans/2026-03-15-cortex-v2-context-engine.md +1274 -1274
  500. package/.next/standalone/docs/superpowers/plans/2026-03-15-cortex-v2-signal-ingestion.md +933 -933
  501. package/.next/standalone/docs/superpowers/plans/2026-03-16-cortex-lobes.md +1080 -1080
  502. package/.next/standalone/docs/superpowers/plans/2026-03-16-cortex-v2-gravity-system.md +768 -768
  503. package/.next/standalone/docs/superpowers/plans/2026-03-16-cortex-v2-ui.md +1108 -1108
  504. package/.next/standalone/docs/superpowers/plans/2026-03-18-cortex-ui-integration.md +1846 -1846
  505. package/.next/standalone/docs/superpowers/specs/2026-03-13-cortex-wiring-design.md +268 -268
  506. package/.next/standalone/docs/superpowers/specs/2026-03-14-cortex-v2-design.md +623 -623
  507. package/.next/standalone/docs/superpowers/specs/2026-03-16-cortex-lobes-design.md +263 -263
  508. package/.next/standalone/docs/superpowers/specs/2026-03-16-cortex-v2-ui-design.md +240 -240
  509. package/.next/standalone/docs/superpowers/specs/2026-03-18-cortex-ui-integration-design.md +341 -341
  510. package/.next/standalone/node_modules/@img/sharp-win32-x64/lib/sharp-win32-x64.node +0 -0
  511. package/.next/standalone/node_modules/@img/{sharp-linux-x64 → sharp-win32-x64}/package.json +39 -46
  512. package/.next/standalone/package.json +104 -102
  513. package/.next/standalone/server.js +1 -1
  514. package/.next/standalone/src/app/(desktop)/cortex/page.tsx +78 -78
  515. package/.next/standalone/src/app/api/cortex/context/route.ts +78 -78
  516. package/.next/standalone/src/app/api/cortex/curation/assess/route.ts +27 -27
  517. package/.next/standalone/src/app/api/cortex/curation/publish/route.ts +23 -23
  518. package/.next/standalone/src/app/api/cortex/curation/refine/route.ts +23 -23
  519. package/.next/standalone/src/app/api/cortex/curation/review/route.ts +29 -29
  520. package/.next/standalone/src/app/api/cortex/curation/seed/route.ts +23 -23
  521. package/.next/standalone/src/app/api/cortex/export/route.ts +40 -40
  522. package/.next/standalone/src/app/api/cortex/federation/pending/route.ts +20 -20
  523. package/.next/standalone/src/app/api/cortex/federation/resolve/route.ts +43 -43
  524. package/.next/standalone/src/app/api/cortex/federation/search/route.ts +35 -35
  525. package/.next/standalone/src/app/api/cortex/federation/teach/route.ts +76 -76
  526. package/.next/standalone/src/app/api/cortex/graph/edges/route.ts +112 -112
  527. package/.next/standalone/src/app/api/cortex/graph/entities/[id]/route.ts +73 -73
  528. package/.next/standalone/src/app/api/cortex/graph/entities/route.ts +75 -75
  529. package/.next/standalone/src/app/api/cortex/graph/populate/route.ts +203 -203
  530. package/.next/standalone/src/app/api/cortex/import/route.ts +75 -75
  531. package/.next/standalone/src/app/api/cortex/import/status/route.ts +15 -15
  532. package/.next/standalone/src/app/api/cortex/ingest/bootstrap/route.ts +29 -29
  533. package/.next/standalone/src/app/api/cortex/ingest/status/route.ts +15 -15
  534. package/.next/standalone/src/app/api/cortex/knowledge/[id]/route.ts +91 -91
  535. package/.next/standalone/src/app/api/cortex/knowledge/route.ts +93 -93
  536. package/.next/standalone/src/app/api/cortex/lobes/[id]/route.ts +67 -67
  537. package/.next/standalone/src/app/api/cortex/lobes/route.ts +22 -22
  538. package/.next/standalone/src/app/api/cortex/lobes/share/route.ts +80 -80
  539. package/.next/standalone/src/app/api/cortex/marketplace/browse/route.ts +43 -43
  540. package/.next/standalone/src/app/api/cortex/marketplace/preview/route.ts +46 -46
  541. package/.next/standalone/src/app/api/cortex/mcp/call/route.ts +11 -11
  542. package/.next/standalone/src/app/api/cortex/mcp/tools/route.ts +6 -6
  543. package/.next/standalone/src/app/api/cortex/search/route.ts +43 -43
  544. package/.next/standalone/src/app/api/cortex/settings/route.ts +33 -33
  545. package/.next/standalone/src/app/api/cortex/status/route.ts +169 -169
  546. package/.next/standalone/src/app/api/cortex/timeline/route.ts +42 -42
  547. package/.next/standalone/src/app/api/cortex/usage/route.ts +31 -31
  548. package/.next/standalone/src/app/api/cortex/workspace/[id]/context/route.ts +41 -41
  549. package/.next/standalone/src/components/cortex/constants.ts +29 -29
  550. package/.next/standalone/src/components/cortex/cortex-dashboard.tsx +304 -304
  551. package/.next/standalone/src/components/cortex/cortex-indicator.tsx +44 -44
  552. package/.next/standalone/src/components/cortex/cortex-panel.tsx +140 -140
  553. package/.next/standalone/src/components/cortex/cortex-settings.tsx +221 -221
  554. package/.next/standalone/src/components/cortex/curation-tab.tsx +810 -810
  555. package/.next/standalone/src/components/cortex/entity-detail.tsx +101 -101
  556. package/.next/standalone/src/components/cortex/entity-graph.tsx +382 -382
  557. package/.next/standalone/src/components/cortex/import-dialog.tsx +212 -212
  558. package/.next/standalone/src/components/cortex/injection-badge.tsx +72 -72
  559. package/.next/standalone/src/components/cortex/knowledge-card.tsx +109 -109
  560. package/.next/standalone/src/components/cortex/knowledge-tab.tsx +158 -158
  561. package/.next/standalone/src/components/cortex/lobe-settings.tsx +215 -215
  562. package/.next/standalone/src/components/cortex/marketplace-card.tsx +126 -126
  563. package/.next/standalone/src/components/cortex/marketplace-tab.tsx +113 -113
  564. package/.next/standalone/src/lib/cortex/config.ts +40 -40
  565. package/.next/standalone/src/lib/cortex/debug.ts +10 -10
  566. package/.next/standalone/src/lib/cortex/distillation/usage-store.ts +18 -18
  567. package/.next/standalone/src/lib/cortex/graph/resolver.ts +10 -10
  568. package/.next/standalone/src/lib/cortex/graph/types.ts +22 -22
  569. package/.next/standalone/src/lib/cortex/index.ts +56 -56
  570. package/.next/standalone/src/lib/cortex/ingestion/bootstrap.ts +14 -14
  571. package/.next/standalone/src/lib/cortex/knowledge/compat.ts +14 -14
  572. package/.next/standalone/src/lib/cortex/knowledge/contradiction.ts +10 -10
  573. package/.next/standalone/src/lib/cortex/knowledge/types.ts +67 -67
  574. package/.next/standalone/src/lib/cortex/lobes/config.ts +16 -16
  575. package/.next/standalone/src/lib/cortex/lobes/resolver.ts +8 -8
  576. package/.next/standalone/src/lib/cortex/lobes/shares.ts +14 -14
  577. package/.next/standalone/src/lib/cortex/mcp/server.ts +8 -8
  578. package/.next/standalone/src/lib/cortex/portability/exporter.ts +6 -6
  579. package/.next/standalone/src/lib/cortex/portability/importer.ts +10 -10
  580. package/.next/standalone/src/lib/cortex/retrieval/context-engine.ts +10 -10
  581. package/.next/standalone/src/lib/cortex/types.ts +39 -39
  582. package/.next/standalone/tsconfig.json +34 -34
  583. package/LICENSE +661 -661
  584. package/README.md +131 -131
  585. package/bin/cortex-hook.sh +62 -62
  586. package/bin/cortex-mcp.js +60 -60
  587. package/bin/fix-standalone-externals.js +79 -79
  588. package/bin/lib/auto-setup.js +110 -110
  589. package/bin/mdns-service.js +171 -171
  590. package/bin/postinstall.js +35 -35
  591. package/bin/setup-admin.js +195 -195
  592. package/bin/spaces-dev.js +208 -208
  593. package/bin/spaces-install.js +599 -599
  594. package/bin/spaces-reset-totp.js +50 -50
  595. package/bin/spaces-service.js +1020 -1020
  596. package/bin/spaces-setup.js +253 -253
  597. package/bin/spaces.js +776 -776
  598. package/bin/ssh-auth-keys.sh +68 -68
  599. package/bin/terminal-server.js +1683 -1649
  600. package/package.json +104 -102
  601. package/.next/standalone/.next/server/chunks/ssr/_078dd64d._.js +0 -3
  602. package/.next/standalone/.next/server/chunks/ssr/_701606d5._.js +0 -3
  603. package/.next/standalone/.next/server/chunks/ssr/_72b1de37._.js +0 -3
  604. package/.next/standalone/.next/server/chunks/ssr/_950142a4._.js +0 -3
  605. package/.next/standalone/.next/server/chunks/ssr/src_components_terminal_terminal-pane_tsx_803c5e2c._.js +0 -7
  606. package/.next/standalone/.next/static/chunks/18f168665aef1aab.js +0 -1
  607. package/.next/standalone/.next/static/chunks/25b7a243a404a1a7.js +0 -1
  608. package/.next/standalone/.next/static/chunks/4a50d2a3e9bc9b41.js +0 -1
  609. package/.next/standalone/.next/static/chunks/6c78a1dfa7ec2959.css +0 -3
  610. package/.next/standalone/.next/static/chunks/7e0091ab6c5ee8bd.js +0 -1
  611. package/.next/standalone/.next/static/chunks/869f562dc32e55f4.js +0 -1
  612. package/.next/standalone/.next/static/chunks/8b3f4572fec83caa.js +0 -5
  613. package/.next/standalone/.next/static/chunks/8d5419afc4b9116b.js +0 -1
  614. package/.next/standalone/.next/static/chunks/9b2c5451f0b67975.js +0 -1
  615. package/.next/standalone/.next/static/chunks/ac339e970df82fa5.js +0 -5
  616. package/.next/standalone/.next/static/chunks/e7772d64463868eb.js +0 -1
  617. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
  618. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  619. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
  620. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  621. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -42
  622. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
  623. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  624. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
  625. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  626. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -42
  627. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
  628. package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  629. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
  630. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -46
  631. /package/.next/standalone/.next/static/{77VYbwIoyxFNr5xevTrCu → BEY-sql3lQLouidpurSQf}/_buildManifest.js +0 -0
  632. /package/.next/standalone/.next/static/{77VYbwIoyxFNr5xevTrCu → BEY-sql3lQLouidpurSQf}/_clientMiddlewareManifest.json +0 -0
  633. /package/.next/standalone/.next/static/{77VYbwIoyxFNr5xevTrCu → BEY-sql3lQLouidpurSQf}/_ssgManifest.js +0 -0
  634. /package/.next/standalone/node_modules/@img/{sharp-libvips-linux-x64 → sharp-win32-x64}/versions.json +0 -0
@@ -0,0 +1,1011 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,32189,(e,t,i)=>{"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},65156,(e,t,i)=>{"use strict";var n=e.r(32189);function r(){}function a(){}a.resetWarningCache=r,t.exports=function(){function e(e,t,i,r,a,s){if(s!==n){var o=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var i={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:r};return i.PropTypes=i,i}},45009,(e,t,i)=>{t.exports=e.r(65156)()},32504,e=>{"use strict";let t,i;var n,r,a,s,o,l,c,h,u,d,p,f,m,g,v,_,x,y,M,S,b,E,T,w,A,R,C,P,L,I,N,D,U,O,F,B,z,k,V,H,G,W,j,X,q,Y=e.i(18050),K=e.i(47167);let Z=()=>{},$={},J={},Q=null,ee={mark:Z,measure:Z};try{"u">typeof window&&($=window),"u">typeof document&&(J=document),"u">typeof MutationObserver&&(Q=MutationObserver),"u">typeof performance&&(ee=performance)}catch(e){}let{userAgent:et=""}=$.navigator||{},ei=$,en=J,er=Q,ea=ee;ei.document;let es=!!en.documentElement&&!!en.head&&"function"==typeof en.addEventListener&&"function"==typeof en.createElement,eo=~et.indexOf("MSIE")||~et.indexOf("Trident/");var el="classic",ec="duotone",eh="sharp",eu="sharp-duotone",ed=[el,ec,eh,eu],ep={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fad:"duotone","fa-duotone":"duotone",fab:"brands","fa-brands":"brands"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid"}},ef=[1,2,3,4,5,6,7,8,9,10],em=ef.concat([11,12,13,14,15,16,17,18,19,20]),eg="duotone-group",ev="swap-opacity",e_="primary",ex="secondary",ey=["classic","sharp","sharp-duotone","solid","regular","light","thin","duotone","brands","2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","fw","inverse","layers-counter","layers-text","layers","li","pull-left","pull-right","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul",eg,ev,e_,ex].concat(ef.map(e=>"".concat(e,"x"))).concat(em.map(e=>"w-".concat(e)));let eM="___FONT_AWESOME___",eS="svg-inline--fa",eb="data-fa-i2svg",eE="data-fa-pseudo-element",eT="data-prefix",ew="data-icon",eA="fontawesome-i2svg",eR=["HTML","HEAD","STYLE","SCRIPT"],eC=(()=>{try{return!0}catch(e){return!1}})(),eP=[el,eh,eu];function eL(e){return new Proxy(e,{get:(e,t)=>t in e?e[t]:e[el]})}let eI={...ep};eI[el]={...ep[el],fak:"kit","fa-kit":"kit",fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"};let eN=eL(eI),eD={classic:{solid:"fas",regular:"far",light:"fal",thin:"fat",duotone:"fad",brands:"fab"},sharp:{solid:"fass",regular:"fasr",light:"fasl",thin:"fast"},"sharp-duotone":{solid:"fasds"}};eD[el]={...eD[el],kit:"fak","kit-duotone":"fakd"};let eU=eL(eD),eO={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid"}};eO[el]={...eO[el],fak:"fa-kit"};let eF=eL(eO),eB={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds"}};eB[el]={...eB[el],"fa-kit":"fak"};let ez=eL(eB),ek=/fa(s|r|l|t|d|b|k|kd|ss|sr|sl|st|sds)?[\-\ ]/,eV="fa-layers-text",eH=/Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit)?.*/i;eL({classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds"}});let eG=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],eW=new Set;Object.keys(eU[el]).map(eW.add.bind(eW)),Object.keys(eU[eh]).map(eW.add.bind(eW)),Object.keys(eU[eu]).map(eW.add.bind(eW));let ej=["kit",...ey],eX=ei.FontAwesomeConfig||{};en&&"function"==typeof en.querySelector&&[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-auto-a11y","autoA11y"],["data-search-pseudo-elements","searchPseudoElements"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]].forEach(e=>{var t;let[i,n]=e,r=""===(t=function(e){var t=en.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}(i))||"false"!==t&&("true"===t||t);null!=r&&(eX[n]=r)});let eq={styleDefault:"solid",familyDefault:"classic",cssPrefix:"fa",replacementClass:eS,autoReplaceSvg:!0,autoAddCss:!0,autoA11y:!0,searchPseudoElements:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};eX.familyPrefix&&(eX.cssPrefix=eX.familyPrefix);let eY={...eq,...eX};eY.autoReplaceSvg||(eY.observeMutations=!1);let eK={};Object.keys(eq).forEach(e=>{Object.defineProperty(eK,e,{enumerable:!0,set:function(t){eY[e]=t,eZ.forEach(e=>e(eK))},get:function(){return eY[e]}})}),Object.defineProperty(eK,"familyPrefix",{enumerable:!0,set:function(e){eY.cssPrefix=e,eZ.forEach(e=>e(eK))},get:function(){return eY.cssPrefix}}),ei.FontAwesomeConfig=eK;let eZ=[],e$={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function eJ(){let e=12,t="";for(;e-- >0;)t+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[62*Math.random()|0];return t}function eQ(e){let t=[];for(let i=(e||[]).length>>>0;i--;)t[i]=e[i];return t}function e0(e){return e.classList?eQ(e.classList):(e.getAttribute("class")||"").split(" ").filter(e=>e)}function e1(e){return"".concat(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e2(e){return Object.keys(e||{}).reduce((t,i)=>t+"".concat(i,": ").concat(e[i].trim(),";"),"")}function e3(e){return e.size!==e$.size||e.x!==e$.x||e.y!==e$.y||e.rotate!==e$.rotate||e.flipX||e.flipY}function e5(){let e=eK.cssPrefix,t=eK.replacementClass,i=':root, :host {\n --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free";\n --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Free";\n --fa-font-light: normal 300 1em/1 "Font Awesome 6 Pro";\n --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Pro";\n --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";\n --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";\n --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 6 Sharp Duotone";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-width, 1.25em);\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-counter-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n transform: scale(var(--fa-layers-scale, 0.25));\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(-1 * var(--fa-li-width, 2em));\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n animation-name: fa-beat;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n animation-name: fa-bounce;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n animation-name: fa-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n animation-name: fa-beat-fade;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n animation-name: fa-flip;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n animation-name: fa-shake;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n animation-name: fa-spin;\n animation-delay: var(--fa-animation-delay, 0s);\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 2s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n animation-name: fa-spin;\n animation-direction: var(--fa-animation-direction, normal);\n animation-duration: var(--fa-animation-duration, 1s);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n animation-delay: -1ms;\n animation-duration: 1ms;\n animation-iteration-count: 1;\n transition-delay: 0s;\n transition-duration: 0s;\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n transform: scale(1);\n }\n 45% {\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-bounce {\n 0% {\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-flip {\n 50% {\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-shake {\n 0% {\n transform: rotate(-15deg);\n }\n 4% {\n transform: rotate(15deg);\n }\n 8%, 24% {\n transform: rotate(-18deg);\n }\n 12%, 28% {\n transform: rotate(18deg);\n }\n 16% {\n transform: rotate(-22deg);\n }\n 20% {\n transform: rotate(22deg);\n }\n 32% {\n transform: rotate(-12deg);\n }\n 36% {\n transform: rotate(12deg);\n }\n 40%, 100% {\n transform: rotate(0deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: var(--fa-stack-z-index, auto);\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}\n\n.fad.fa-inverse,\n.fa-duotone.fa-inverse {\n color: var(--fa-inverse, #fff);\n}';if("fa"!==e||t!==eS){let n=RegExp("\\.".concat("fa","\\-"),"g"),r=RegExp("\\--".concat("fa","\\-"),"g"),a=RegExp("\\.".concat(eS),"g");i=i.replace(n,".".concat(e,"-")).replace(r,"--".concat(e,"-")).replace(a,".".concat(t))}return i}let e4=!1;function e6(){eK.autoAddCss&&!e4&&(!function(e){if(!e||!es)return;let t=en.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;let i=en.head.childNodes,n=null;for(let e=i.length-1;e>-1;e--){let t=i[e];["STYLE","LINK"].indexOf((t.tagName||"").toUpperCase())>-1&&(n=t)}en.head.insertBefore(t,n)}(e5()),e4=!0)}let e8=ei||{};e8[eM]||(e8[eM]={}),e8[eM].styles||(e8[eM].styles={}),e8[eM].hooks||(e8[eM].hooks={}),e8[eM].shims||(e8[eM].shims=[]);var e7=e8[eM];let e9=[],te=function(){en.removeEventListener("DOMContentLoaded",te),tt=1,e9.map(e=>e())},tt=!1;function ti(e){let{tag:t,attributes:i={},children:n=[]}=e;return"string"==typeof e?e1(e):"<".concat(t," ").concat(Object.keys(i||{}).reduce((e,t)=>e+"".concat(t,'="').concat(e1(i[t]),'" '),"").trim(),">").concat(n.map(ti).join(""),"</").concat(t,">")}function tn(e,t,i){if(e&&e[t]&&e[t][i])return{prefix:t,iconName:i,icon:e[t][i]}}es&&((tt=(en.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(en.readyState))||en.addEventListener("DOMContentLoaded",te));var tr=function(e,t,i,n){var r,a,s,o=Object.keys(e),l=o.length,c=void 0!==n?function(e,i,r,a){return t.call(n,e,i,r,a)}:t;for(void 0===i?(r=1,s=e[o[0]]):(r=0,s=i);r<l;r++)s=c(s,e[a=o[r]],a,e);return s};function ta(e){let t=function(e){let t=[],i=0,n=e.length;for(;i<n;){let r=e.charCodeAt(i++);if(r>=55296&&r<=56319&&i<n){let n=e.charCodeAt(i++);(64512&n)==56320?t.push(((1023&r)<<10)+(1023&n)+65536):(t.push(r),i--)}else t.push(r)}return t}(e);return 1===t.length?t[0].toString(16):null}function ts(e){return Object.keys(e).reduce((t,i)=>{let n=e[i];return n.icon?t[n.iconName]=n.icon:t[i]=n,t},{})}function to(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{skipHooks:n=!1}=i,r=ts(t);"function"!=typeof e7.hooks.addPack||n?e7.styles[e]={...e7.styles[e]||{},...r}:e7.hooks.addPack(e,ts(t)),"fas"===e&&to("fa",t)}let{styles:tl,shims:tc}=e7,th={[el]:Object.values(eF[el]),[eh]:Object.values(eF[eh]),[eu]:Object.values(eF[eu])},tu=null,td={},tp={},tf={},tm={},tg={},tv={[el]:Object.keys(eN[el]),[eh]:Object.keys(eN[eh]),[eu]:Object.keys(eN[eu])},t_=()=>{let e=e=>tr(tl,(t,i,n)=>(t[n]=tr(i,e,{}),t),{});td=e((e,t,i)=>(t[3]&&(e[t[3]]=i),t[2]&&t[2].filter(e=>"number"==typeof e).forEach(t=>{e[t.toString(16)]=i}),e)),tp=e((e,t,i)=>(e[i]=i,t[2]&&t[2].filter(e=>"string"==typeof e).forEach(t=>{e[t]=i}),e)),tg=e((e,t,i)=>{let n=t[2];return e[i]=i,n.forEach(t=>{e[t]=i}),e});let t="far"in tl||eK.autoFetchSvg,i=tr(tc,(e,i)=>{let n=i[0],r=i[1],a=i[2];return"far"!==r||t||(r="fas"),"string"==typeof n&&(e.names[n]={prefix:r,iconName:a}),"number"==typeof n&&(e.unicodes[n.toString(16)]={prefix:r,iconName:a}),e},{names:{},unicodes:{}});tf=i.names,tm=i.unicodes,tu=tb(eK.styleDefault,{family:eK.familyDefault})};function tx(e,t){return(td[e]||{})[t]}function ty(e,t){return(tg[e]||{})[t]}function tM(e){return tf[e]||{prefix:null,iconName:null}}eZ.push(e=>{tu=tb(e.styleDefault,{family:eK.familyDefault})}),t_();let tS=()=>({prefix:null,iconName:null,rest:[]});function tb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{family:i=el}=t,n=eN[i][e],r=eU[i][e]||eU[i][n],a=e in e7.styles?e:null;return r||a||null}let tE={[el]:Object.keys(eF[el]),[eh]:Object.keys(eF[eh]),[eu]:Object.keys(eF[eu])};function tT(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{skipLookups:i=!1}=t,n={[el]:"".concat(eK.cssPrefix,"-").concat(el),[eh]:"".concat(eK.cssPrefix,"-").concat(eh),[eu]:"".concat(eK.cssPrefix,"-").concat(eu)},r=null,a=el,s=ed.filter(e=>e!==ec);s.forEach(t=>{(e.includes(n[t])||e.some(e=>tE[t].includes(e)))&&(a=t)});let o=e.reduce((e,t)=>{var o;let l,c,h,u=(o=eK.cssPrefix,c=(l=t.split("-"))[0],h=l.slice(1).join("-"),c!==o||""===h||~ej.indexOf(h)?null:h);if(tl[t]?(r=t=th[a].includes(t)?ez[a][t]:t,e.prefix=t):tv[a].indexOf(t)>-1?(r=t,e.prefix=tb(t,{family:a})):u?e.iconName=u:t===eK.replacementClass||s.some(e=>t===n[e])||e.rest.push(t),!i&&e.prefix&&e.iconName){let t="fa"===r?tM(e.iconName):{},i=ty(e.prefix,e.iconName);t.prefix&&(r=null),e.iconName=t.iconName||i||e.iconName,e.prefix=t.prefix||e.prefix,"far"!==e.prefix||tl.far||!tl.fas||eK.autoFetchSvg||(e.prefix="fas")}return e},tS());return(e.includes("fa-brands")||e.includes("fab"))&&(o.prefix="fab"),(e.includes("fa-duotone")||e.includes("fad"))&&(o.prefix="fad"),!o.prefix&&a===eh&&(tl.fass||eK.autoFetchSvg)&&(o.prefix="fass",o.iconName=ty(o.prefix,o.iconName)||o.iconName),!o.prefix&&a===eu&&(tl.fasds||eK.autoFetchSvg)&&(o.prefix="fasds",o.iconName=ty(o.prefix,o.iconName)||o.iconName),("fa"===o.prefix||"fa"===r)&&(o.prefix=tu||"fas"),o}let tw=[],tA={},tR={},tC=Object.keys(tR);function tP(e,t){for(var i=arguments.length,n=Array(i>2?i-2:0),r=2;r<i;r++)n[r-2]=arguments[r];return(tA[e]||[]).forEach(e=>{t=e.apply(null,[t,...n])}),t}function tL(e){for(var t=arguments.length,i=Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];(tA[e]||[]).forEach(e=>{e.apply(null,i)})}function tI(){let e=arguments[0],t=Array.prototype.slice.call(arguments,1);return tR[e]?tR[e].apply(null,t):void 0}function tN(e){"fa"===e.prefix&&(e.prefix="fas");let{iconName:t}=e,i=e.prefix||tu;if(t)return t=ty(i,t)||t,tn(tD.definitions,i,t)||tn(e7.styles,i,t)}let tD=new class{constructor(){this.definitions={}}add(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];let n=t.reduce(this._pullDefinitions,{});Object.keys(n).forEach(e=>{this.definitions[e]={...this.definitions[e]||{},...n[e]},to(e,n[e]);let t=eF[el][e];t&&to(t,n[e]),t_()})}reset(){this.definitions={}}_pullDefinitions(e,t){let i=t.prefix&&t.iconName&&t.icon?{0:t}:t;return Object.keys(i).map(t=>{let{prefix:n,iconName:r,icon:a}=i[t],s=a[2];e[n]||(e[n]={}),s.length>0&&s.forEach(t=>{"string"==typeof t&&(e[n][t]=a)}),e[n][r]=a}),e}},tU={noAuto:()=>{eK.autoReplaceSvg=!1,eK.observeMutations=!1,tL("noAuto")},config:eK,dom:{i2svg:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return es?(tL("beforeI2svg",e),tI("pseudoElements2svg",e),tI("i2svg",e)):Promise.reject(Error("Operation requires a DOM of some kind."))},watch:function(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{autoReplaceSvgRoot:i}=t;!1===eK.autoReplaceSvg&&(eK.autoReplaceSvg=!0),eK.observeMutations=!0,e=()=>{tO({autoReplaceSvgRoot:i}),tL("watch",t)},es&&(tt?setTimeout(e,0):e9.push(e))}},parse:{icon:e=>{if(null===e)return null;if("object"==typeof e&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:ty(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&2===e.length){let t=0===e[1].indexOf("fa-")?e[1].slice(3):e[1],i=tb(e[0]);return{prefix:i,iconName:ty(i,t)||t}}if("string"==typeof e&&(e.indexOf("".concat(eK.cssPrefix,"-"))>-1||e.match(ek))){let t=tT(e.split(" "),{skipLookups:!0});return{prefix:t.prefix||tu,iconName:ty(t.prefix,t.iconName)||t.iconName}}if("string"==typeof e){let t=tu;return{prefix:t,iconName:ty(t,e)||e}}}},library:tD,findIconDefinition:tN,toHtml:ti},tO=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{autoReplaceSvgRoot:t=en}=e;(Object.keys(e7.styles).length>0||eK.autoFetchSvg)&&es&&eK.autoReplaceSvg&&tU.dom.i2svg({node:t})};function tF(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(e=>ti(e))}}),Object.defineProperty(e,"node",{get:function(){if(!es)return;let t=en.createElement("div");return t.innerHTML=e.html,t.children}}),e}function tB(e){let{icons:{main:t,mask:i},prefix:n,iconName:r,transform:a,symbol:s,title:o,maskId:l,titleId:c,extra:h,watchable:u=!1}=e,{width:d,height:p}=i.found?i:t,f="fak"===n,m=[eK.replacementClass,r?"".concat(eK.cssPrefix,"-").concat(r):""].filter(e=>-1===h.classes.indexOf(e)).filter(e=>""!==e||!!e).concat(h.classes).join(" "),g={children:[],attributes:{...h.attributes,"data-prefix":n,"data-icon":r,class:m,role:h.attributes.role||"img",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 ".concat(d," ").concat(p)}},v=f&&!~h.classes.indexOf("fa-fw")?{width:"".concat(d/p*1,"em")}:{};u&&(g.attributes[eb]=""),o&&(g.children.push({tag:"title",attributes:{id:g.attributes["aria-labelledby"]||"title-".concat(c||eJ())},children:[o]}),delete g.attributes.title);let _={...g,prefix:n,iconName:r,main:t,mask:i,maskId:l,transform:a,symbol:s,styles:{...v,...h.styles}},{children:x,attributes:y}=i.found&&t.found?tI("generateAbstractMask",_)||{children:[],attributes:{}}:tI("generateAbstractIcon",_)||{children:[],attributes:{}};return(_.children=x,_.attributes=y,s)?function(e){let{prefix:t,iconName:i,children:n,attributes:r,symbol:a}=e,s=!0===a?"".concat(t,"-").concat(eK.cssPrefix,"-").concat(i):a;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:{...r,id:s},children:n}]}]}(_):function(e){let{children:t,main:i,mask:n,attributes:r,styles:a,transform:s}=e;if(e3(s)&&i.found&&!n.found){let{width:e,height:t}=i,n={x:e/t/2,y:.5};r.style=e2({...a,"transform-origin":"".concat(n.x+s.x/16,"em ").concat(n.y+s.y/16,"em")})}return[{tag:"svg",attributes:r,children:t}]}(_)}function tz(e){let{content:t,width:i,height:n,transform:r,title:a,extra:s,watchable:o=!1}=e,l={...s.attributes,...a?{title:a}:{},class:s.classes.join(" ")};o&&(l[eb]="");let c={...s.styles};e3(r)&&(c.transform=function(e){let{transform:t,width:i=16,height:n=16,startCentered:r=!1}=e,a="";return r&&eo?a+="translate(".concat(t.x/16-i/2,"em, ").concat(t.y/16-n/2,"em) "):r?a+="translate(calc(-50% + ".concat(t.x/16,"em), calc(-50% + ").concat(t.y/16,"em)) "):a+="translate(".concat(t.x/16,"em, ").concat(t.y/16,"em) "),a+="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),a+="rotate(".concat(t.rotate,"deg) ")}({transform:r,startCentered:!0,width:i,height:n}),c["-webkit-transform"]=c.transform);let h=e2(c);h.length>0&&(l.style=h);let u=[];return u.push({tag:"span",attributes:l,children:[t]}),a&&u.push({tag:"span",attributes:{class:"sr-only"},children:[a]}),u}let{styles:tk}=e7;function tV(e){let t=e[0],i=e[1],[n]=e.slice(4);return{found:!0,width:t,height:i,icon:Array.isArray(n)?{tag:"g",attributes:{class:"".concat(eK.cssPrefix,"-").concat(eg)},children:[{tag:"path",attributes:{class:"".concat(eK.cssPrefix,"-").concat(ex),fill:"currentColor",d:n[0]}},{tag:"path",attributes:{class:"".concat(eK.cssPrefix,"-").concat(e_),fill:"currentColor",d:n[1]}}]}:{tag:"path",attributes:{fill:"currentColor",d:n}}}}let tH={found:!1,width:512,height:512};function tG(e,t){let i=t;return"fa"===t&&null!==eK.styleDefault&&(t=tu),new Promise((n,r)=>{var a,s;if("fa"===i){let i=tM(e)||{};e=i.iconName||e,t=i.prefix||t}if(e&&t&&tk[t]&&tk[t][e])return n(tV(tk[t][e]));a=e,s=t,eC||eK.showMissingIcons||!a||console.error('Icon with name "'.concat(a,'" and prefix "').concat(s,'" is missing.')),n({...tH,icon:eK.showMissingIcons&&e&&tI("missingIconAbstract")||{}})})}let tW=()=>{},tj=eK.measurePerformance&&ea&&ea.mark&&ea.measure?ea:{mark:tW,measure:tW},tX='FA "6.6.0"';var tq=e=>(tj.mark("".concat(tX," ").concat(e," begins")),()=>{var t;return t=e,void(tj.mark("".concat(tX," ").concat(t," ends")),tj.measure("".concat(tX," ").concat(t),"".concat(tX," ").concat(t," begins"),"".concat(tX," ").concat(t," ends")))});let tY=()=>{};function tK(e){return"string"==typeof(e.getAttribute?e.getAttribute(eb):null)}function tZ(e){return en.createElementNS("http://www.w3.org/2000/svg",e)}function t$(e){return en.createElement(e)}let tJ={replace:function(e){let t=e[0];if(t.parentNode)if(e[1].forEach(e=>{t.parentNode.insertBefore(function e(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{ceFn:n="svg"===t.tag?tZ:t$}=i;if("string"==typeof t)return en.createTextNode(t);let r=n(t.tag);return Object.keys(t.attributes||[]).forEach(function(e){r.setAttribute(e,t.attributes[e])}),(t.children||[]).forEach(function(t){r.appendChild(e(t,{ceFn:n}))}),r}(e),t)}),null===t.getAttribute(eb)&&eK.keepOriginalSource){let e,i=en.createComment((e=" ".concat(t.outerHTML," "),e="".concat(e,"Font Awesome fontawesome.com ")));t.parentNode.replaceChild(i,t)}else t.remove()},nest:function(e){let t=e[0],i=e[1];if(~e0(t).indexOf(eK.replacementClass))return tJ.replace(e);let n=new RegExp("".concat(eK.cssPrefix,"-.*"));if(delete i[0].attributes.id,i[0].attributes.class){let e=i[0].attributes.class.split(" ").reduce((e,t)=>(t===eK.replacementClass||t.match(n)?e.toSvg.push(t):e.toNode.push(t),e),{toNode:[],toSvg:[]});i[0].attributes.class=e.toSvg.join(" "),0===e.toNode.length?t.removeAttribute("class"):t.setAttribute("class",e.toNode.join(" "))}let r=i.map(e=>ti(e)).join("\n");t.setAttribute(eb,""),t.innerHTML=r}};function tQ(e){e()}function t0(e,t){let i="function"==typeof t?t:tY;if(0===e.length)i();else{let t=tQ;"async"===eK.mutateApproach&&(t=ei.requestAnimationFrame||tQ),t(()=>{let t=!0===eK.autoReplaceSvg?tJ.replace:tJ[eK.autoReplaceSvg]||tJ.replace,n=tq("mutate");e.map(t),n(),i()})}}let t1=!1,t2=null;function t3(e){if(!er||!eK.observeMutations)return;let{treeCallback:t=tY,nodeCallback:i=tY,pseudoElementsCallback:n=tY,observeMutationsRoot:r=en}=e;t2=new er(e=>{if(t1)return;let r=tu;eQ(e).forEach(e=>{if("childList"===e.type&&e.addedNodes.length>0&&!tK(e.addedNodes[0])&&(eK.searchPseudoElements&&n(e.target),t(e.target)),"attributes"===e.type&&e.target.parentNode&&eK.searchPseudoElements&&n(e.target.parentNode),"attributes"===e.type&&tK(e.target)&&~eG.indexOf(e.attributeName)){var a,s;let t,n;if("class"===e.attributeName&&(t=(a=e.target).getAttribute?a.getAttribute(eT):null,n=a.getAttribute?a.getAttribute(ew):null,t&&n)){let{prefix:t,iconName:i}=tT(e0(e.target));e.target.setAttribute(eT,t||r),i&&e.target.setAttribute(ew,i)}else(s=e.target)&&s.classList&&s.classList.contains&&s.classList.contains(eK.replacementClass)&&i(e.target)}})}),es&&t2.observe(r,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}function t5(e){var t,i,n;let r,a,s,o,l,c,h,u,d,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{styleParser:!0},{iconName:f,prefix:m,rest:g}=(r=(t=e).getAttribute("data-prefix"),a=t.getAttribute("data-icon"),s=void 0!==t.innerText?t.innerText.trim():"",((o=tT(e0(t))).prefix||(o.prefix=tu),r&&a&&(o.prefix=r,o.iconName=a),o.iconName&&o.prefix)?o:(o.prefix&&s.length>0&&(i=o.prefix,n=t.innerText,o.iconName=(tp[i]||{})[n]||tx(o.prefix,ta(t.innerText))),!o.iconName&&eK.autoFetchSvg&&t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&(o.iconName=t.firstChild.data),o)),v=(l=eQ(e.attributes).reduce((e,t)=>("class"!==e.name&&"style"!==e.name&&(e[t.name]=t.value),e),{}),c=e.getAttribute("title"),h=e.getAttribute("data-fa-title-id"),eK.autoA11y&&(c?l["aria-labelledby"]="".concat(eK.replacementClass,"-title-").concat(h||eJ()):(l["aria-hidden"]="true",l.focusable="false")),l),_=tP("parseNodeAttributes",{},e),x=p.styleParser?(u=e.getAttribute("style"),d=[],u&&(d=u.split(";").reduce((e,t)=>{let i=t.split(":"),n=i[0],r=i.slice(1);return n&&r.length>0&&(e[n]=r.join(":").trim()),e},{})),d):[];return{iconName:f,title:e.getAttribute("title"),titleId:e.getAttribute("data-fa-title-id"),prefix:m,transform:e$,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:g,styles:x,attributes:v},..._}}let{styles:t4}=e7;function t6(e){let t="nest"===eK.autoReplaceSvg?t5(e,{styleParser:!1}):t5(e);return~t.extra.classes.indexOf(eV)?tI("generateLayersText",e,t):tI("generateSvgReplacementMutation",e,t)}let t8=new Set;function t7(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!es)return Promise.resolve();let i=en.documentElement.classList,n=e=>i.add("".concat(eA,"-").concat(e)),r=e=>i.remove("".concat(eA,"-").concat(e)),a=eK.autoFetchSvg?t8:eP.map(e=>"fa-".concat(e)).concat(Object.keys(t4));a.includes("fa")||a.push("fa");let s=[".".concat(eV,":not([").concat(eb,"])")].concat(a.map(e=>".".concat(e,":not([").concat(eb,"])"))).join(", ");if(0===s.length)return Promise.resolve();let o=[];try{o=eQ(e.querySelectorAll(s))}catch(e){}if(!(o.length>0))return Promise.resolve();n("pending"),r("complete");let l=tq("onTree"),c=o.reduce((e,t)=>{try{let i=t6(t);i&&e.push(i)}catch(e){eC||"MissingIcon"!==e.name||console.error(e)}return e},[]);return new Promise((e,i)=>{Promise.all(c).then(i=>{t0(i,()=>{n("active"),n("complete"),r("pending"),"function"==typeof t&&t(),l(),e()})}).catch(e=>{l(),i(e)})})}function t9(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;t6(e).then(e=>{e&&t0([e],t)})}eP.map(e=>{t8.add("fa-".concat(e))}),Object.keys(eN[el]).map(t8.add.bind(t8)),Object.keys(eN[eh]).map(t8.add.bind(t8)),Object.keys(eN[eu]).map(t8.add.bind(t8)),t8=[...t8];let ie=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{transform:i=e$,symbol:n=!1,mask:r=null,maskId:a=null,title:s=null,titleId:o=null,classes:l=[],attributes:c={},styles:h={}}=t;if(!e)return;let{prefix:u,iconName:d,icon:p}=e;return tF({type:"icon",...e},()=>(tL("beforeDOMElementCreation",{iconDefinition:e,params:t}),eK.autoA11y&&(s?c["aria-labelledby"]="".concat(eK.replacementClass,"-title-").concat(o||eJ()):(c["aria-hidden"]="true",c.focusable="false")),tB({icons:{main:tV(p),mask:r?tV(r.icon):{found:!1,width:null,height:null,icon:{}}},prefix:u,iconName:d,transform:{...e$,...i},symbol:n,title:s,maskId:a,titleId:o,extra:{attributes:c,styles:h,classes:l}})))},it=RegExp('"',"ug"),ii={FontAwesome:{normal:"fas",400:"fas"},"Font Awesome 6 Free":{900:"fas",400:"far"},"Font Awesome 6 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 6 Brands":{400:"fab",normal:"fab"},"Font Awesome 6 Duotone":{900:"fad"},"Font Awesome 6 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 6 Sharp Duotone":{900:"fasds"},"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"},"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},ir=Object.keys(ii).reduce((e,t)=>(e[t.toLowerCase()]=ii[t],e),{}),ia=Object.keys(ir).reduce((e,t)=>{let i=ir[t];return e[t]=i[900]||[...Object.entries(i)][0][1],e},{});function is(e,t){let i="".concat("data-fa-pseudo-element-pending").concat(t.replace(":","-"));return new Promise((n,r)=>{if(null!==e.getAttribute(i))return n();let a=eQ(e.children).filter(e=>e.getAttribute(eE)===t)[0],s=ei.getComputedStyle(e,t),o=s.getPropertyValue("font-family"),l=o.match(eH),c=s.getPropertyValue("font-weight"),h=s.getPropertyValue("content");if(a&&!l)return e.removeChild(a),n();if(l&&"none"!==h&&""!==h){var u;let h,d,p,f,m,g,v,_,x,y,M=s.getPropertyValue("content"),S=(f=o.replace(/^['"]|['"]$/g,"").toLowerCase(),g=isNaN(m=parseInt(c))?"normal":m,(ir[f]||{})[g]||ia[f]),{value:b,isSecondary:E}=(v=M.replace(it,""),d=(u=v).length,x=(_=(p=u.charCodeAt(0))>=55296&&p<=56319&&d>1&&(h=u.charCodeAt(1))>=56320&&h<=57343?(p-55296)*1024+h-56320+65536:p)>=1105920&&_<=1112319,{value:(y=2===v.length&&v[0]===v[1])?ta(v[0]):ta(v),isSecondary:x||y}),T=l[0].startsWith("FontAwesome"),w=tx(S,b),A=w;if(T){let e,t,i=(e=tm[b],t=tx("fas",b),e||(t?{prefix:"fas",iconName:t}:null)||{prefix:null,iconName:null});i.iconName&&i.prefix&&(w=i.iconName,S=i.prefix)}if(!w||E||a&&a.getAttribute(eT)===S&&a.getAttribute(ew)===A)n();else{e.setAttribute(i,A),a&&e.removeChild(a);let s={iconName:null,title:null,titleId:null,prefix:null,transform:e$,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}},{extra:o}=s;o.attributes[eE]=t,tG(w,S).then(r=>{let a=tB({...s,icons:{main:r,mask:tS()},prefix:S,iconName:A,extra:o,watchable:!0}),l=en.createElementNS("http://www.w3.org/2000/svg","svg");"::before"===t?e.insertBefore(l,e.firstChild):e.appendChild(l),l.outerHTML=a.map(e=>ti(e)).join("\n"),e.removeAttribute(i),n()}).catch(r)}}else n()})}function io(e){return Promise.all([is(e,"::before"),is(e,"::after")])}function il(e){return e.parentNode!==document.head&&!~eR.indexOf(e.tagName.toUpperCase())&&!e.getAttribute(eE)&&(!e.parentNode||"svg"!==e.parentNode.tagName)}function ic(e){if(es)return new Promise((t,i)=>{let n=eQ(e.querySelectorAll("*")).filter(il).map(io),r=tq("searchPseudoElements");t1=!0,Promise.all(n).then(()=>{r(),t1=!1,t()}).catch(()=>{r(),t1=!1,i()})})}let ih=!1,iu=e=>e.toLowerCase().split(" ").reduce((e,t)=>{let i=t.toLowerCase().split("-"),n=i[0],r=i.slice(1).join("-");if(n&&"h"===r)return e.flipX=!0,e;if(n&&"v"===r)return e.flipY=!0,e;if(isNaN(r=parseFloat(r)))return e;switch(n){case"grow":e.size=e.size+r;break;case"shrink":e.size=e.size-r;break;case"left":e.x=e.x-r;break;case"right":e.x=e.x+r;break;case"up":e.y=e.y-r;break;case"down":e.y=e.y+r;break;case"rotate":e.rotate=e.rotate+r}return e},{size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0}),id={x:0,y:0,width:"100%",height:"100%"};function ip(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}!function(e,t){let{mixoutsTo:i}=t;tw=e,tA={},Object.keys(tR).forEach(e=>{-1===tC.indexOf(e)&&delete tR[e]}),tw.forEach(e=>{let t=e.mixout?e.mixout():{};if(Object.keys(t).forEach(e=>{"function"==typeof t[e]&&(i[e]=t[e]),"object"==typeof t[e]&&Object.keys(t[e]).forEach(n=>{i[e]||(i[e]={}),i[e][n]=t[e][n]})}),e.hooks){let t=e.hooks();Object.keys(t).forEach(e=>{tA[e]||(tA[e]=[]),tA[e].push(t[e])})}e.provides&&e.provides(tR)})}([{mixout:()=>({dom:{css:e5,insertCss:e6}}),hooks:()=>({beforeDOMElementCreation(){e6()},beforeI2svg(){e6()}})},{mixout:()=>({icon:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(e||{}).icon?e:tN(e||{}),{mask:n}=t;return n&&(n=(n||{}).icon?n:tN(n||{})),ie(i,{...t,mask:n})}}),hooks:()=>({mutationObserverCallbacks:e=>(e.treeCallback=t7,e.nodeCallback=t9,e)}),provides(e){e.i2svg=function(e){let{node:t=en,callback:i=()=>{}}=e;return t7(t,i)},e.generateSvgReplacementMutation=function(e,t){let{iconName:i,title:n,titleId:r,prefix:a,transform:s,symbol:o,mask:l,maskId:c,extra:h}=t;return new Promise((t,u)=>{Promise.all([tG(i,a),l.iconName?tG(l.iconName,l.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(l=>{let[u,d]=l;t([e,tB({icons:{main:u,mask:d},prefix:a,iconName:i,transform:s,symbol:o,maskId:c,title:n,titleId:r,extra:h,watchable:!0})])}).catch(u)})},e.generateAbstractIcon=function(e){let t,{children:i,attributes:n,main:r,transform:a,styles:s}=e,o=e2(s);return o.length>0&&(n.style=o),e3(a)&&(t=tI("generateAbstractTransformGrouping",{main:r,transform:a,containerWidth:r.width,iconWidth:r.width})),i.push(t||r.icon),{children:i,attributes:n}}}},{mixout:()=>({layer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{classes:i=[]}=t;return tF({type:"layer"},()=>{tL("beforeDOMElementCreation",{assembler:e,params:t});let n=[];return e(e=>{Array.isArray(e)?e.map(e=>{n=n.concat(e.abstract)}):n=n.concat(e.abstract)}),[{tag:"span",attributes:{class:["".concat(eK.cssPrefix,"-layers"),...i].join(" ")},children:n}]})}})},{mixout:()=>({counter(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{title:i=null,classes:n=[],attributes:r={},styles:a={}}=t;return tF({type:"counter",content:e},()=>(tL("beforeDOMElementCreation",{content:e,params:t}),function(e){let{content:t,title:i,extra:n}=e,r={...n.attributes,...i?{title:i}:{},class:n.classes.join(" ")},a=e2(n.styles);a.length>0&&(r.style=a);let s=[];return s.push({tag:"span",attributes:r,children:[t]}),i&&s.push({tag:"span",attributes:{class:"sr-only"},children:[i]}),s}({content:e.toString(),title:i,extra:{attributes:r,styles:a,classes:["".concat(eK.cssPrefix,"-layers-counter"),...n]}})))}})},{mixout:()=>({text(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{transform:i=e$,title:n=null,classes:r=[],attributes:a={},styles:s={}}=t;return tF({type:"text",content:e},()=>(tL("beforeDOMElementCreation",{content:e,params:t}),tz({content:e,transform:{...e$,...i},title:n,extra:{attributes:a,styles:s,classes:["".concat(eK.cssPrefix,"-layers-text"),...r]}})))}}),provides(e){e.generateLayersText=function(e,t){let{title:i,transform:n,extra:r}=t,a=null,s=null;if(eo){let t=parseInt(getComputedStyle(e).fontSize,10),i=e.getBoundingClientRect();a=i.width/t,s=i.height/t}return eK.autoA11y&&!i&&(r.attributes["aria-hidden"]="true"),Promise.resolve([e,tz({content:e.innerHTML,width:a,height:s,transform:n,title:i,extra:r,watchable:!0})])}}},{hooks:()=>({mutationObserverCallbacks:e=>(e.pseudoElementsCallback=ic,e)}),provides(e){e.pseudoElements2svg=function(e){let{node:t=en}=e;eK.searchPseudoElements&&ic(t)}}},{mixout:()=>({dom:{unwatch(){t1=!0,ih=!0}}}),hooks:()=>({bootstrap(){t3(tP("mutationObserverCallbacks",{}))},noAuto(){t2&&t2.disconnect()},watch(e){let{observeMutationsRoot:t}=e;ih?t1=!1:t3(tP("mutationObserverCallbacks",{observeMutationsRoot:t}))}})},{mixout:()=>({parse:{transform:e=>iu(e)}}),hooks:()=>({parseNodeAttributes(e,t){let i=t.getAttribute("data-fa-transform");return i&&(e.transform=iu(i)),e}}),provides(e){e.generateAbstractTransformGrouping=function(e){let{main:t,transform:i,containerWidth:n,iconWidth:r}=e,a="translate(".concat(32*i.x,", ").concat(32*i.y,") "),s="scale(".concat(i.size/16*(i.flipX?-1:1),", ").concat(i.size/16*(i.flipY?-1:1),") "),o="rotate(".concat(i.rotate," 0 0)"),l={transform:"".concat(a," ").concat(s," ").concat(o)};return{tag:"g",attributes:{transform:"translate(".concat(n/2," 256)")},children:[{tag:"g",attributes:{...l},children:[{tag:t.icon.tag,children:t.icon.children,attributes:{...t.icon.attributes,transform:"translate(".concat(-(r/2*1)," -256)")}}]}]}}}},{hooks:()=>({parseNodeAttributes(e,t){let i=t.getAttribute("data-fa-mask"),n=i?tT(i.split(" ").map(e=>e.trim())):tS();return n.prefix||(n.prefix=tu),e.mask=n,e.maskId=t.getAttribute("data-fa-mask-id"),e}}),provides(e){e.generateAbstractMask=function(e){let{children:t,attributes:i,main:n,mask:r,maskId:a,transform:s}=e,{width:o,icon:l}=n,{width:c,icon:h}=r,u=function(e){let{transform:t,containerWidth:i,iconWidth:n}=e,r="translate(".concat(32*t.x,", ").concat(32*t.y,") "),a="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),s="rotate(".concat(t.rotate," 0 0)"),o={transform:"".concat(r," ").concat(a," ").concat(s)};return{outer:{transform:"translate(".concat(i/2," 256)")},inner:o,path:{transform:"translate(".concat(-(n/2*1)," -256)")}}}({transform:s,containerWidth:c,iconWidth:o}),d={tag:"rect",attributes:{...id,fill:"white"}},p=l.children?{children:l.children.map(ip)}:{},f={tag:"g",attributes:{...u.inner},children:[ip({tag:l.tag,attributes:{...l.attributes,...u.path},...p})]},m={tag:"g",attributes:{...u.outer},children:[f]},g="mask-".concat(a||eJ()),v="clip-".concat(a||eJ()),_={tag:"mask",attributes:{...id,id:g,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"},children:[d,m]},x={tag:"defs",children:[{tag:"clipPath",attributes:{id:v},children:"g"===h.tag?h.children:[h]},_]};return t.push(x,{tag:"rect",attributes:{fill:"currentColor","clip-path":"url(#".concat(v,")"),mask:"url(#".concat(g,")"),...id}}),{children:t,attributes:i}}}},{provides(e){let t=!1;ei.matchMedia&&(t=ei.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){let e=[],i={fill:"currentColor"},n={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};e.push({tag:"path",attributes:{...i,d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"}});let r={...n,attributeName:"opacity"},a={tag:"circle",attributes:{...i,cx:"256",cy:"364",r:"28"},children:[]};return t||a.children.push({tag:"animate",attributes:{...n,attributeName:"r",values:"28;14;28;28;14;28;"}},{tag:"animate",attributes:{...r,values:"1;0;1;1;0;1;"}}),e.push(a),e.push({tag:"path",attributes:{...i,opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"},children:t?[]:[{tag:"animate",attributes:{...r,values:"1;0;0;0;0;1;"}}]}),t||e.push({tag:"path",attributes:{...i,opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"},children:[{tag:"animate",attributes:{...r,values:"0;0;1;1;0;0;"}}]}),{tag:"g",attributes:{class:"missing"},children:e}}}},{hooks:()=>({parseNodeAttributes(e,t){let i=t.getAttribute("data-fa-symbol");return e.symbol=null!==i&&(""===i||i),e}})}],{mixoutsTo:tU}),tU.noAuto,tU.config,tU.library,tU.dom;let im=tU.parse;tU.findIconDefinition,tU.toHtml;let ig=tU.icon;tU.layer,tU.text,tU.counter;var iv=e.i(45009),i_=e.i(71645);function ix(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function iy(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ix(Object(i),!0).forEach(function(t){iS(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ix(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function iM(e){return(iM="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function iS(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function ib(e){return function(e){if(Array.isArray(e))return iE(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return iE(e,void 0);var i=Object.prototype.toString.call(e).slice(8,-1);if("Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return iE(e,void 0)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iE(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=Array(t);i<t;i++)n[i]=e[i];return n}function iT(e){var t;return(t=e-0)==t?e:(e=e.replace(/[\-_\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""})).substr(0,1).toLowerCase()+e.substr(1)}var iw=["style"],iA=!1;try{iA=!0}catch(e){}function iR(e){return e&&"object"===iM(e)&&e.prefix&&e.iconName&&e.icon?e:im.icon?im.icon(e):null===e?null:e&&"object"===iM(e)&&e.prefix&&e.iconName?e:Array.isArray(e)&&2===e.length?{prefix:e[0],iconName:e[1]}:"string"==typeof e?{prefix:"fas",iconName:e}:void 0}function iC(e,t){return Array.isArray(t)&&t.length>0||!Array.isArray(t)&&t?iS({},e,t):{}}var iP={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1},iL=i_.default.forwardRef(function(e,t){var i,n,r,a,s,o,l,c,h,u,d,p,f,m,g,v,_,x,y,M,S=iy(iy({},iP),e),b=S.icon,E=S.mask,T=S.symbol,w=S.className,A=S.title,R=S.titleId,C=S.maskId,P=iR(b),L=iC("classes",[].concat(ib((n=S.beat,r=S.fade,a=S.beatFade,s=S.bounce,o=S.shake,l=S.flash,c=S.spin,h=S.spinPulse,u=S.spinReverse,d=S.pulse,p=S.fixedWidth,f=S.inverse,m=S.border,g=S.listItem,v=S.flip,_=S.size,x=S.rotation,y=S.pull,Object.keys((iS(i={"fa-beat":n,"fa-fade":r,"fa-beat-fade":a,"fa-bounce":s,"fa-shake":o,"fa-flash":l,"fa-spin":c,"fa-spin-reverse":u,"fa-spin-pulse":h,"fa-pulse":d,"fa-fw":p,"fa-inverse":f,"fa-border":m,"fa-li":g,"fa-flip":!0===v,"fa-flip-horizontal":"horizontal"===v||"both"===v,"fa-flip-vertical":"vertical"===v||"both"===v},"fa-".concat(_),null!=_),iS(i,"fa-rotate-".concat(x),null!=x&&0!==x),iS(i,"fa-pull-".concat(y),null!=y),iS(i,"fa-swap-opacity",S.swapOpacity),M=i)).map(function(e){return M[e]?e:null}).filter(function(e){return e}))),ib((w||"").split(" ")))),I=iC("transform","string"==typeof S.transform?im.transform(S.transform):S.transform),N=iC("mask",iR(E)),D=ig(P,iy(iy(iy(iy({},L),I),N),{},{symbol:T,title:A,titleId:R,maskId:C}));if(!D)return!function(){if(!iA&&console&&"function"==typeof console.error){var e;(e=console).error.apply(e,arguments)}}("Could not find icon",P),null;var U=D.abstract,O={ref:t};return Object.keys(S).forEach(function(e){iP.hasOwnProperty(e)||(O[e]=S[e])}),iI(U[0],O)});iL.displayName="FontAwesomeIcon",iL.propTypes={beat:iv.default.bool,border:iv.default.bool,beatFade:iv.default.bool,bounce:iv.default.bool,className:iv.default.string,fade:iv.default.bool,flash:iv.default.bool,mask:iv.default.oneOfType([iv.default.object,iv.default.array,iv.default.string]),maskId:iv.default.string,fixedWidth:iv.default.bool,inverse:iv.default.bool,flip:iv.default.oneOf([!0,!1,"horizontal","vertical","both"]),icon:iv.default.oneOfType([iv.default.object,iv.default.array,iv.default.string]),listItem:iv.default.bool,pull:iv.default.oneOf(["right","left"]),pulse:iv.default.bool,rotation:iv.default.oneOf([0,90,180,270]),shake:iv.default.bool,size:iv.default.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:iv.default.bool,spinPulse:iv.default.bool,spinReverse:iv.default.bool,symbol:iv.default.oneOfType([iv.default.bool,iv.default.string]),title:iv.default.string,titleId:iv.default.string,transform:iv.default.oneOfType([iv.default.string,iv.default.object]),swapOpacity:iv.default.bool};var iI=(function e(t,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("string"==typeof i)return i;var r=(i.children||[]).map(function(i){return e(t,i)}),a=Object.keys(i.attributes||{}).reduce(function(e,t){var n=i.attributes[t];switch(t){case"class":e.attrs.className=n,delete i.attributes.class;break;case"style":e.attrs.style=n.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,t){var i=t.indexOf(":"),n=iT(t.slice(0,i)),r=t.slice(i+1).trim();return n.startsWith("webkit")?e[n.charAt(0).toUpperCase()+n.slice(1)]=r:e[n]=r,e},{});break;default:0===t.indexOf("aria-")||0===t.indexOf("data-")?e.attrs[t.toLowerCase()]=n:e.attrs[iT(t)]=n}return e},{attrs:{}}),s=n.style,o=function(e,t){if(null==e)return{};var i,n,r=function(e,t){if(null==e)return{};var i,n,r={},a=Object.keys(e);for(n=0;n<a.length;n++)i=a[n],t.indexOf(i)>=0||(r[i]=e[i]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)i=a[n],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}(n,iw);return a.attrs.style=iy(iy({},a.attrs.style),void 0===s?{}:s),t.apply(void 0,[i.tag,iy(iy({},a.attrs),o)].concat(ib(r)))}).bind(null,i_.default.createElement),iN=function(){return(iN=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function iD(e,t,i){if(i||2==arguments.length)for(var n,r=0,a=t.length;r<a;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;Object.create(null);var iU={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},iO="-ms-",iF="-moz-",iB="-webkit-",iz="comm",ik="rule",iV="decl",iH="@keyframes",iG=Math.abs,iW=String.fromCharCode,ij=Object.assign;function iX(e,t){return(e=t.exec(e))?e[0]:e}function iq(e,t,i){return e.replace(t,i)}function iY(e,t,i){return e.indexOf(t,i)}function iK(e,t){return 0|e.charCodeAt(t)}function iZ(e,t,i){return e.slice(t,i)}function i$(e){return e.length}function iJ(e,t){return t.push(e),e}function iQ(e,t){return e.filter(function(e){return!iX(e,t)})}var i0=1,i1=1,i2=0,i3=0,i5=0,i4="";function i6(e,t,i,n,r,a,s,o){return{value:e,root:t,parent:i,type:n,props:r,children:a,line:i0,column:i1,length:s,return:"",siblings:o}}function i8(e,t){return ij(i6("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function i7(e){for(;e.root;)e=i8(e.root,{children:[e]});iJ(e,e.siblings)}function i9(){return i5=i3<i2?iK(i4,i3++):0,i1++,10===i5&&(i1=1,i0++),i5}function ne(){return iK(i4,i3)}function nt(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function ni(e){var t,i;return(t=i3-1,i=function e(t){for(;i9();)switch(i5){case t:return i3;case 34:case 39:34!==t&&39!==t&&e(i5);break;case 40:41===t&&e(t);break;case 92:i9()}return i3}(91===e?e+2:40===e?e+1:e),iZ(i4,t,i)).trim()}function nn(e,t){for(var i="",n=0;n<e.length;n++)i+=t(e[n],n,e,t)||"";return i}function nr(e,t,i,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case"@namespace":case iV:return e.return=e.return||e.value;case iz:return"";case iH:return e.return=e.value+"{"+nn(e.children,n)+"}";case ik:if(!i$(e.value=e.props.join(",")))return""}return i$(i=nn(e.children,n))?e.return=e.value+"{"+i+"}":""}function na(e,t,i,n){if(e.length>-1&&!e.return)switch(e.type){case iV:e.return=function e(t,i,n){var r;switch(r=i,45^iK(t,0)?(((r<<2^iK(t,0))<<2^iK(t,1))<<2^iK(t,2))<<2^iK(t,3):0){case 5103:return iB+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:case 6391:case 5879:case 5623:case 6135:case 4599:return iB+t+t;case 4855:return iB+t.replace("add","source-over").replace("substract","source-out").replace("intersect","source-in").replace("exclude","xor")+t;case 4789:return iF+t+t;case 5349:case 4246:case 4810:case 6968:case 2756:return iB+t+iF+t+iO+t+t;case 5936:switch(iK(t,i+11)){case 114:return iB+t+iO+iq(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return iB+t+iO+iq(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return iB+t+iO+iq(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return iB+t+iO+t+t;case 6165:return iB+t+iO+"flex-"+t+t;case 5187:return iB+t+iq(t,/(\w+).+(:[^]+)/,iB+"box-$1$2"+iO+"flex-$1$2")+t;case 5443:return iB+t+iO+"flex-item-"+iq(t,/flex-|-self/g,"")+(iX(t,/flex-|baseline/)?"":iO+"grid-row-"+iq(t,/flex-|-self/g,""))+t;case 4675:return iB+t+iO+"flex-line-pack"+iq(t,/align-content|flex-|-self/g,"")+t;case 5548:return iB+t+iO+iq(t,"shrink","negative")+t;case 5292:return iB+t+iO+iq(t,"basis","preferred-size")+t;case 6060:return iB+"box-"+iq(t,"-grow","")+iB+t+iO+iq(t,"grow","positive")+t;case 4554:return iB+iq(t,/([^-])(transform)/g,"$1"+iB+"$2")+t;case 6187:return iq(iq(iq(t,/(zoom-|grab)/,iB+"$1"),/(image-set)/,iB+"$1"),t,"")+t;case 5495:case 3959:return iq(t,/(image-set\([^]*)/,iB+"$1$`$1");case 4968:return iq(iq(t,/(.+:)(flex-)?(.*)/,iB+"box-pack:$3"+iO+"flex-pack:$3"),/space-between/,"justify")+iB+t+t;case 4200:if(!iX(t,/flex-|baseline/))return iO+"grid-column-align"+iZ(t,i)+t;break;case 2592:case 3360:return iO+iq(t,"template-","")+t;case 4384:case 3616:if(n&&n.some(function(e,t){return i=t,iX(e.props,/grid-\w+-end/)}))return~iY(t+(n=n[i].value),"span",0)?t:iO+iq(t,"-start","")+t+iO+"grid-row-span:"+(~iY(n,"span",0)?iX(n,/\d+/):iX(n,/\d+/)-iX(t,/\d+/))+";";return iO+iq(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(e){return iX(e.props,/grid-\w+-start/)})?t:iO+iq(iq(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return iq(t,/(.+)-inline(.+)/,iB+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(i$(t)-1-i>6)switch(iK(t,i+1)){case 109:if(45!==iK(t,i+4))break;case 102:return iq(t,/(.+:)(.+)-([^]+)/,"$1"+iB+"$2-$3$1"+iF+(108==iK(t,i+3)?"$3":"$2-$3"))+t;case 115:return~iY(t,"stretch",0)?e(iq(t,"stretch","fill-available"),i,n)+t:t}break;case 5152:case 5920:return iq(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(e,i,n,r,a,s,o){return iO+i+":"+n+o+(r?iO+i+"-span:"+(a?s:s-n)+o:"")+t});case 4949:if(121===iK(t,i+6))return iq(t,":",":"+iB)+t;break;case 6444:switch(iK(t,45===iK(t,14)?18:11)){case 120:return iq(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+iB+(45===iK(t,14)?"inline-":"")+"box$3$1"+iB+"$2$3$1"+iO+"$2box$3")+t;case 100:return iq(t,":",":"+iO)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return iq(t,"scroll-","scroll-snap-")+t}return t}(e.value,e.length,i);return;case iH:return nn([i8(e,{value:iq(e.value,"@","@"+iB)})],n);case ik:if(e.length){var r,a;return r=i=e.props,a=function(t){switch(iX(t,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":i7(i8(e,{props:[iq(t,/:(read-\w+)/,":"+iF+"$1")]})),i7(i8(e,{props:[t]})),ij(e,{props:iQ(i,n)});break;case"::placeholder":i7(i8(e,{props:[iq(t,/:(plac\w+)/,":"+iB+"input-$1")]})),i7(i8(e,{props:[iq(t,/:(plac\w+)/,":"+iF+"$1")]})),i7(i8(e,{props:[iq(t,/:(plac\w+)/,iO+"input-$1")]})),i7(i8(e,{props:[t]})),ij(e,{props:iQ(i,n)})}return""},r.map(a).join("")}}}function ns(e,t,i,n,r,a,s,o,l,c,h,u){for(var d=r-1,p=0===r?a:[""],f=p.length,m=0,g=0,v=0;m<n;++m)for(var _=0,x=iZ(e,d+1,d=iG(g=s[m])),y=e;_<f;++_)(y=(g>0?p[_]+" "+x:iq(x,/&\f/g,p[_])).trim())&&(l[v++]=y);return i6(e,t,i,0===r?ik:o,l,c,h,u)}function no(e,t,i,n,r){return i6(e,t,i,iV,iZ(e,0,n),iZ(e,n+1,-1),n,r)}var nl=void 0!==K.default&&void 0!==K.default.env&&(K.default.env.REACT_APP_SC_ATTR||K.default.env.SC_ATTR)||"data-styled",nc="active",nh="data-styled-version",nu="6.3.12",nd="/*!sc*/\n",np="u">typeof window&&"u">typeof document,nf=!!("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:void 0!==K.default&&void 0!==K.default.env&&void 0!==K.default.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==K.default.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==K.default.env.REACT_APP_SC_DISABLE_SPEEDY&&K.default.env.REACT_APP_SC_DISABLE_SPEEDY:void 0!==K.default&&void 0!==K.default.env&&void 0!==K.default.env.SC_DISABLE_SPEEDY&&""!==K.default.env.SC_DISABLE_SPEEDY&&"false"!==K.default.env.SC_DISABLE_SPEEDY&&K.default.env.SC_DISABLE_SPEEDY);function nm(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var ng=new Map,nv=new Map,n_=1,nx=function(e){if(ng.has(e))return ng.get(e);for(;nv.has(n_);)n_++;var t=n_++;return ng.set(e,t),nv.set(t,e),t},ny=function(e,t){n_=t+1,ng.set(e,t),nv.set(t,e)},nM=Object.freeze([]),nS=Object.freeze({}),nb=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]),nE=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,nT=/(^-|-$)/g;function nw(e){return e.replace(nE,"-").replace(nT,"")}var nA=/(a)(d)/gi,nR=function(e){return String.fromCharCode(e+(e>25?39:97))};function nC(e){var t,i="";for(t=Math.abs(e);t>52;t=t/52|0)i=nR(t%52)+i;return(nR(t%52)+i).replace(nA,"$1-$2")}var nP,nL=function(e,t){for(var i=t.length;i;)e=33*e^t.charCodeAt(--i);return e},nI=function(e){return nL(5381,e)};function nN(e){return"string"==typeof e}var nD="function"==typeof Symbol&&Symbol.for,nU=nD?Symbol.for("react.memo"):60115,nO=nD?Symbol.for("react.forward_ref"):60112,nF={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},nB={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},nz={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},nk=((nP={})[nO]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},nP[nU]=nz,nP);function nV(e){return("type"in e&&e.type.$$typeof)===nU?nz:"$$typeof"in e?nk[e.$$typeof]:nF}var nH=Object.defineProperty,nG=Object.getOwnPropertyNames,nW=Object.getOwnPropertySymbols,nj=Object.getOwnPropertyDescriptor,nX=Object.getPrototypeOf,nq=Object.prototype;function nY(e){return"function"==typeof e}function nK(e){return"object"==typeof e&&"styledComponentId"in e}function nZ(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function n$(e,t){return e.join(t||"")}function nJ(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function nQ(e,t){Object.defineProperty(e,"toString",{value:t})}var n0=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e,this._cGroup=0,this._cIndex=0}return e.prototype.indexOfGroup=function(e){if(e===this._cGroup)return this._cIndex;var t=this._cIndex;if(e>this._cGroup)for(var i=this._cGroup;i<e;i++)t+=this.groupSizes[i];else for(i=this._cGroup-1;i>=e;i--)t-=this.groupSizes[i];return this._cGroup=e,this._cIndex=t,t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var i=this.groupSizes,n=i.length,r=n;e>=r;)if((r<<=1)<0)throw nm(16,"".concat(e));this.groupSizes=new Uint32Array(r),this.groupSizes.set(i),this.length=r;for(var a=n;a<r;a++)this.groupSizes[a]=0}for(var s=this.indexOfGroup(e+1),o=0,l=(a=0,t.length);a<l;a++)this.tag.insertRule(s,t[a])&&(this.groupSizes[e]++,s++,o++);o>0&&this._cGroup>e&&(this._cIndex+=o)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],i=this.indexOfGroup(e),n=i+t;this.groupSizes[e]=0;for(var r=i;r<n;r++)this.tag.deleteRule(i);t>0&&this._cGroup>e&&(this._cIndex-=t)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var i=this.groupSizes[e],n=this.indexOfGroup(e),r=n+i,a=n;a<r;a++)t+=this.tag.getRule(a)+nd;return t},e}(),n1="style[".concat(nl,"][").concat(nh,'="').concat(nu,'"]'),n2=new RegExp("^".concat(nl,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),n3=function(e){return"u">typeof ShadowRoot&&e instanceof ShadowRoot||"host"in e&&11===e.nodeType},n5=function(e){if(!e)return document;if(n3(e))return e;if("getRootNode"in e){var t=e.getRootNode();if(n3(t))return t}return document},n4=function(e,t,i){for(var n,r=i.split(","),a=0,s=r.length;a<s;a++)(n=r[a])&&e.registerName(t,n)},n6=function(e,t){for(var i,n=(null!=(i=t.textContent)?i:"").split(nd),r=[],a=0,s=n.length;a<s;a++){var o=n[a].trim();if(o){var l=o.match(n2);if(l){var c=0|parseInt(l[1],10),h=l[2];0!==c&&(ny(h,c),n4(e,h,l[3]),e.getTag().insertRules(c,r)),r.length=0}else r.push(o)}}},n8=function(e){for(var t=n5(e.options.target).querySelectorAll(n1),i=0,n=t.length;i<n;i++){var r=t[i];r&&r.getAttribute(nl)!==nc&&(n6(e,r),r.parentNode&&r.parentNode.removeChild(r))}};function n7(){return"u">typeof __webpack_nonce__?__webpack_nonce__:null}var n9=function(e){var t,i=document.head,n=e||i,r=document.createElement("style"),a=(t=Array.from(n.querySelectorAll("style[".concat(nl,"]"))))[t.length-1],s=void 0!==a?a.nextSibling:null;r.setAttribute(nl,nc),r.setAttribute(nh,nu);var o=n7();return o&&r.setAttribute("nonce",o),n.insertBefore(r,s),r},re=function(){function e(e){this.element=n9(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){var t;if(e.sheet)return e.sheet;for(var i=null!=(t=e.getRootNode().styleSheets)?t:document.styleSheets,n=0,r=i.length;n<r;n++){var a=i[n];if(a.ownerNode===e)return a}throw nm(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),rt=function(){function e(e){this.element=n9(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var i=document.createTextNode(t);return this.element.insertBefore(i,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),ri=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(e===this.length?this.rules.push(t):this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),rn=np,rr={isServer:!np,useCSSOMInjection:!nf},ra=function(){function e(e,t,i){void 0===e&&(e=nS),void 0===t&&(t={});var n=this;this.options=iN(iN({},rr),e),this.gs=t,this.names=new Map(i),this.server=!!e.isServer,!this.server&&np&&rn&&(rn=!1,n8(this)),nQ(this,function(){for(var e=n.getTag(),t=e.length,i="",r=0;r<t;r++)!function(t){var r=nv.get(t);if(void 0===r)return;var a=n.names.get(r);if(void 0===a||!a.size)return;var s=e.getGroup(t);if(0!==s.length){var o=nl+".g"+t+'[id="'+r+'"]',l="";a.forEach(function(e){e.length>0&&(l+=e+",")}),i+=s+o+'{content:"'+l+'"}'+nd}}(r);return i})}return e.registerId=function(e){return nx(e)},e.prototype.rehydrate=function(){!this.server&&np&&n8(this)},e.prototype.reconstructWithOptions=function(t,i){void 0===i&&(i=!0);var n=new e(iN(iN({},this.options),t),this.gs,i&&this.names||void 0);return!this.server&&np&&t.target!==this.options.target&&n5(this.options.target)!==n5(t.target)&&n8(n),n},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){var e,t,i;return this.tag||(this.tag=(t=(e=this.options).useCSSOMInjection,i=e.target,new n0(e.isServer?new ri(i):t?new re(i):new rt(i))))},e.prototype.hasNameForId=function(e,t){var i,n;return null!=(n=null==(i=this.names.get(e))?void 0:i.has(t))&&n},e.prototype.registerName=function(e,t){nx(e);var i=this.names.get(e);i?i.add(t):this.names.set(e,new Set([t]))},e.prototype.insertRules=function(e,t,i){this.registerName(e,t),this.getTag().insertRules(nx(e),i)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(nx(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}();function rs(e){for(var t="",i=0;i<e.length;i++){var n=e[i];if(1===i&&"-"===n&&"-"===e[0])return e;n>="A"&&n<="Z"?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var ro=Symbol.for("sc-keyframes"),rl=function(e){return null==e||!1===e||""===e},rc=function(e){var t=[];for(var i in e){var n=e[i];e.hasOwnProperty(i)&&!rl(n)&&(Array.isArray(n)&&n.isCss||nY(n)?t.push("".concat(rs(i),":"),n,";"):nJ(n)?t.push.apply(t,iD(iD(["".concat(i," {")],rc(n),!1),["}"],!1)):t.push("".concat(rs(i),": ").concat(null==n||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||i in iU||i.startsWith("--")?String(n).trim():"".concat(n,"px"),";")))}return t};function rh(e,t,i,n,r){if(void 0===r&&(r=[]),"string"==typeof e)return e&&r.push(e),r;if(rl(e))return r;if(nK(e))return r.push(".".concat(e.styledComponentId)),r;if(nY(e))return!nY(e)||e.prototype&&e.prototype.isReactComponent||!t?(r.push(e),r):rh(e(t),t,i,n,r);if("object"==typeof e&&null!==e&&ro in e)return i?(e.inject(i,n),r.push(e.getName(n))):r.push(e),r;if(nJ(e)){for(var a=rc(e),s=0;s<a.length;s++)r.push(a[s]);return r}if(!Array.isArray(e))return r.push(e.toString()),r;for(s=0;s<e.length;s++)rh(e[s],t,i,n,r);return r}function ru(e){for(var t=0;t<e.length;t+=1){var i=e[t];if(nY(i)&&!nK(i))return!1}return!0}var rd=nI(nu),rp=function(){function e(e,t,i){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===i||i.isStatic)&&ru(e),this.componentId=t,this.baseHash=nL(rd,t),this.baseStyle=i,ra.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,i){var n=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,i).className:"";if(this.isStatic&&!i.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))n=nZ(n,this.staticRulesId);else{var r=n$(rh(this.rules,e,t,i)),a=nC(nL(this.baseHash,r)>>>0);if(!t.hasNameForId(this.componentId,a)){var s=i(r,".".concat(a),void 0,this.componentId);t.insertRules(this.componentId,a,s)}n=nZ(n,a),this.staticRulesId=a}else{for(var o=nL(this.baseHash,i.hash),l="",c=0;c<this.rules.length;c++){var h=this.rules[c];if("string"==typeof h)l+=h;else if(h){var u=n$(rh(h,e,t,i));o=nL(nL(o,String(c)),u),l+=u}}if(l){var d=nC(o>>>0);if(!t.hasNameForId(this.componentId,d)){var p=i(l,".".concat(d),void 0,this.componentId);t.insertRules(this.componentId,d,p)}n=nZ(n,d)}}return{className:n,css:"u"<typeof window?t.getTag().getGroup(nx(this.componentId)):""}},e}(),rf=/&/g;function rm(e){if(-1===e.indexOf("}"))return!1;for(var t=e.length,i=0,n=0,r=!1,a=0;a<t;a++){var s=e.charCodeAt(a);if(0!==n||r||47!==s||42!==e.charCodeAt(a+1))if(r)42===s&&47===e.charCodeAt(a+1)&&(r=!1,a++);else if(34!==s&&39!==s||0!==a&&92===e.charCodeAt(a-1)){if(0===n){if(123===s)i++;else if(125===s&&--i<0)return!0}}else 0===n?n=s:n===s&&(n=0);else r=!0,a++}return 0!==i||0!==n}function rg(e){var t,i,n,r,a,s,o=void 0===e?nS:e,l=o.options,c=void 0===l?nS:l,h=o.plugins,u=void 0===h?nM:h,d=function(e,t,i){return i.startsWith(a)&&i.endsWith(a)&&i.replaceAll(a,"").length>0?".".concat(r):e},p=u.slice();p.push(function(e){e.type===ik&&e.value.includes("&")&&(s||(s=RegExp("\\".concat(a,"\\b"),"g")),e.props[0]=e.props[0].replace(rf,a).replace(s,d))}),c.prefix&&p.push(na),p.push(nr);var f=[],m=(i=(t=p.concat((n=function(e){return f.push(e)},function(e){!e.root&&(e=e.return)&&n(e)}))).length,function(e,n,r,a){for(var s="",o=0;o<i;o++)s+=t[o](e,n,r,a)||"";return s}),g=function(e,t,i,n){void 0===t&&(t=""),void 0===i&&(i=""),void 0===n&&(n="&"),r=n,a=t,s=void 0;var o,l,h,u=function(e){if(!rm(e))return e;for(var t=e.length,i="",n=0,r=0,a=0,s=!1,o=0;o<t;o++){var l=e.charCodeAt(o);if(0!==a||s||47!==l||42!==e.charCodeAt(o+1))if(s)42===l&&47===e.charCodeAt(o+1)&&(s=!1,o++);else if(34!==l&&39!==l||0!==o&&92===e.charCodeAt(o-1)){if(0===a)if(123===l)r++;else if(125===l){if(--r<0){for(var c=o+1;c<t;){var h=e.charCodeAt(c);if(59===h||10===h)break;c++}c<t&&59===e.charCodeAt(c)&&c++,r=0,o=c-1,n=c;continue}0===r&&(i+=e.substring(n,o+1),n=o+1)}else 59===l&&0===r&&(i+=e.substring(n,o+1),n=o+1)}else 0===a?a=l:a===l&&(a=0);else s=!0,o++}if(n<t){var u=e.substring(n);rm(u)||(i+=u)}return i}(function(e){if(-1===e.indexOf("//"))return e;for(var t=e.length,i=[],n=0,r=0,a=0,s=0;r<t;){var o=e.charCodeAt(r);if(34!==o&&39!==o||0!==r&&92===e.charCodeAt(r-1))if(0===a)if(47===o&&r+1<t&&42===e.charCodeAt(r+1)){for(r+=2;r+1<t&&(42!==e.charCodeAt(r)||47!==e.charCodeAt(r+1));)r++;r+=2}else if(40===o&&r>=3&&108==(32|e.charCodeAt(r-1))&&114==(32|e.charCodeAt(r-2))&&117==(32|e.charCodeAt(r-3)))s=1,r++;else if(s>0)41===o?s--:40===o&&s++,r++;else if(42===o&&r+1<t&&47===e.charCodeAt(r+1))r>n&&i.push(e.substring(n,r)),n=r+=2;else if(47===o&&r+1<t&&47===e.charCodeAt(r+1)){for(r>n&&i.push(e.substring(n,r));r<t&&10!==e.charCodeAt(r);)r++;n=r}else r++;else r++;else 0===a?a=o:a===o&&(a=0),r++}return 0===n?e:(n<t&&i.push(e.substring(n)),i.join(""))}(e)),d=(h=function e(t,i,n,r,a,s,o,l,c){for(var h,u,d,p,f=0,m=0,g=o,v=0,_=0,x=0,y=1,M=1,S=1,b=0,E="",T=a,w=s,A=r,R=E;M;)switch(x=b,b=i9()){case 40:if(108!=x&&58==iK(R,g-1)){-1!=iY(R+=iq(ni(b),"&","&\f"),"&\f",iG(f?l[f-1]:0))&&(S=-1);break}case 34:case 39:case 91:R+=ni(b);break;case 9:case 10:case 13:case 32:R+=function(e){for(;i5=ne();)if(i5<33)i9();else break;return nt(e)>2||nt(i5)>3?"":" "}(x);break;case 92:R+=function(e,t){for(var i;--t&&i9()&&!(i5<48)&&!(i5>102)&&(!(i5>57)||!(i5<65))&&(!(i5>70)||!(i5<97)););return i=i3+(t<6&&32==ne()&&32==i9()),iZ(i4,e,i)}(i3-1,7);continue;case 47:switch(ne()){case 42:case 47:iJ((h=function(e,t){for(;i9();)if(e+i5===57)break;else if(e+i5===84&&47===ne())break;return"/*"+iZ(i4,t,i3-1)+"*"+iW(47===e?e:i9())}(i9(),i3),u=i,d=n,p=c,i6(h,u,d,iz,iW(i5),iZ(h,2,-2),0,p)),c),(5==nt(x||1)||5==nt(ne()||1))&&i$(R)&&" "!==iZ(R,-1,void 0)&&(R+=" ");break;default:R+="/"}break;case 123*y:l[f++]=i$(R)*S;case 125*y:case 59:case 0:switch(b){case 0:case 125:M=0;case 59+m:-1==S&&(R=iq(R,/\f/g,"")),_>0&&(i$(R)-g||0===y&&47===x)&&iJ(_>32?no(R+";",r,n,g-1,c):no(iq(R," ","")+";",r,n,g-2,c),c);break;case 59:R+=";";default:if(iJ(A=ns(R,i,n,f,m,a,l,E,T=[],w=[],g,s),s),123===b)if(0===m)e(R,i,A,A,T,s,g,l,w);else{switch(v){case 99:if(110===iK(R,3))break;case 108:if(97===iK(R,2))break;default:m=0;case 100:case 109:case 115:}m?e(t,A,A,r&&iJ(ns(t,A,A,0,0,a,l,E,a,T=[],g,w),w),a,w,g,l,r?T:w):e(R,A,A,A,[""],w,0,l,w)}}f=m=_=0,y=S=1,E=R="",g=o;break;case 58:g=1+i$(R),_=x;default:if(y<1){if(123==b)--y;else if(125==b&&0==y++&&125==(i5=i3>0?iK(i4,--i3):0,i1--,10===i5&&(i1=1,i0--),i5))continue}switch(R+=iW(b),b*y){case 38:S=m>0?1:(R+="\f",-1);break;case 44:l[f++]=(i$(R)-1)*S,S=1;break;case 64:45===ne()&&(R+=ni(i9())),v=ne(),m=g=i$(E=R+=function(e){for(;!nt(ne());)i9();return iZ(i4,e,i3)}(i3)),b++;break;case 45:45===x&&2==i$(R)&&(y=0)}}return s}("",null,null,null,[""],(l=o=i||t?"".concat(i," ").concat(t," { ").concat(u," }"):u,i0=i1=1,i2=i$(i4=l),i3=0,o=[]),0,[0],o),i4="",h);return c.namespace&&(d=function e(t,i){return t.map(function(t){return"rule"===t.type&&(t.value="".concat(i," ").concat(t.value),t.value=t.value.replaceAll(",",",".concat(i," ")),t.props=t.props.map(function(e){return"".concat(i," ").concat(e)})),Array.isArray(t.children)&&"@keyframes"!==t.type&&(t.children=e(t.children,i)),t})}(d,c.namespace)),f=[],nn(d,m),f};return g.hash=u.length?u.reduce(function(e,t){return t.name||nm(15),nL(e,t.name)},5381).toString():"",g}var rv=new ra,r_=rg(),rx=i_.default.createContext({shouldForwardProp:void 0,styleSheet:rv,stylis:r_}),ry=(rx.Consumer,i_.default.createContext(void 0));function rM(){return i_.default.useContext(rx)}function rS(e){if(!i_.default.useMemo)return e.children;var t=rM().styleSheet,i=i_.default.useMemo(function(){var i=t;return e.sheet?i=e.sheet:e.target&&(i=i.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(i=i.reconstructWithOptions({useCSSOMInjection:!1})),i},[e.disableCSSOMInjection,e.sheet,e.target,t]),n=i_.default.useMemo(function(){return rg({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:e.stylisPlugins})},[e.enableVendorPrefixes,e.namespace,e.stylisPlugins]),r=i_.default.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:i,stylis:n}},[e.shouldForwardProp,i,n]);return i_.default.createElement(rx.Provider,{value:r},i_.default.createElement(ry.Provider,{value:n},e.children))}var rb=i_.default.createContext(void 0);rb.Consumer;var rE={};function rT(e,t,i){var n,r,a,s,o=nK(e),l=!nN(e),c=t.attrs,h=void 0===c?nM:c,u=t.componentId,d=void 0===u?(n=t.displayName,r=t.parentComponentId,rE[a="string"!=typeof n?"sc":nw(n)]=(rE[a]||0)+1,s="".concat(a,"-").concat(nC(nI(nu+a+rE[a])>>>0)),r?"".concat(r,"-").concat(s):s):u,p=t.displayName,f=void 0===p?nN(e)?"styled.".concat(e):"Styled(".concat(e.displayName||e.name||"Component",")"):p,m=t.displayName&&t.componentId?"".concat(nw(t.displayName),"-").concat(t.componentId):t.componentId||d,g=o&&e.attrs?e.attrs.concat(h).filter(Boolean):h,v=t.shouldForwardProp;if(o&&e.shouldForwardProp){var _=e.shouldForwardProp;if(t.shouldForwardProp){var x=t.shouldForwardProp;v=function(e,t){return _(e,t)&&x(e,t)}}else v=_}var y=new rp(i,m,o?e.componentStyle:void 0);function M(e,t){return function(e,t,i){var n,r,a=e.attrs,s=e.componentStyle,o=e.defaultProps,l=e.foldedComponentIds,c=e.styledComponentId,h=e.target,u=i_.default.useContext(rb),d=rM(),p=e.shouldForwardProp||d.shouldForwardProp,f=(void 0===(n=o)&&(n=nS),t.theme!==n.theme&&t.theme||u||n.theme||nS),m=function(e,t,i){for(var n,r=iN(iN({},t),{className:void 0,theme:i}),a=0;a<e.length;a+=1){var s=nY(n=e[a])?n(r):n;for(var o in s)"className"===o?r.className=nZ(r.className,s[o]):"style"===o?r.style=iN(iN({},r.style),s[o]):o in t&&void 0===t[o]||(r[o]=s[o])}return"className"in t&&"string"==typeof t.className&&(r.className=nZ(r.className,t.className)),r}(a,t,f),g=m.as||h,v={};for(var _ in m)void 0===m[_]||"$"===_[0]||"as"===_||"theme"===_&&m.theme===f||("forwardedAs"===_?v.as=m.forwardedAs:p&&!p(_,g)||(v[_]=m[_]));var x=(r=rM(),s.generateAndInjectStyles(m,r.styleSheet,r.stylis)).className,y=nZ(l,c);return x&&(y+=" "+x),m.className&&(y+=" "+m.className),v[nN(g)&&!nb.has(g)?"class":"className"]=y,i&&(v.ref=i),(0,i_.createElement)(g,v)}(S,e,t)}M.displayName=f;var S=i_.default.forwardRef(M);return S.attrs=g,S.componentStyle=y,S.displayName=f,S.shouldForwardProp=v,S.foldedComponentIds=o?nZ(e.foldedComponentIds,e.styledComponentId):"",S.styledComponentId=m,S.target=o?e.target:e,Object.defineProperty(S,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=o?function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=0;n<t.length;n++)!function e(t,i,n){if(void 0===n&&(n=!1),!n&&!nJ(t)&&!Array.isArray(t))return i;if(Array.isArray(i))for(var r=0;r<i.length;r++)t[r]=e(t[r],i[r]);else if(nJ(i))for(var r in i)t[r]=e(t[r],i[r]);return t}(e,t[n],!0);return e}({},e.defaultProps,t):t}}),nQ(S,function(){return".".concat(S.styledComponentId)}),l&&function e(t,i,n){if("string"!=typeof i){if(nq){var r=nX(i);r&&r!==nq&&e(t,r,n)}var a=nG(i);nW&&(a=a.concat(nW(i)));for(var s=nV(t),o=nV(i),l=0;l<a.length;++l){var c=a[l];if(!(c in nB||n&&n[c]||o&&c in o||s&&c in s)){var h=nj(i,c);try{nH(t,c,h)}catch(e){}}}}return t}(S,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),S}function rw(e,t){for(var i=[e[0]],n=0,r=t.length;n<r;n+=1)i.push(t[n],e[n+1]);return i}var rA=function(e){return Object.assign(e,{isCss:!0})};function rR(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return nY(e)||nJ(e)?rA(rh(rw(nM,iD([e],t,!0)))):0===t.length&&1===e.length&&"string"==typeof e[0]?rh(e):rA(rh(rw(e,t)))}var rC=function(e){return function e(t,i,n){if(void 0===n&&(n=nS),!i)throw nm(1,i);var r=function(e){for(var r=[],a=1;a<arguments.length;a++)r[a-1]=arguments[a];return t(i,n,rR.apply(void 0,iD([e],r,!1)))};return r.attrs=function(r){return e(t,i,iN(iN({},n),{attrs:Array.prototype.concat(n.attrs,r).filter(Boolean)}))},r.withConfig=function(r){return e(t,i,iN(iN({},n),r))},r}(rT,e)};function rP(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString();if(!t)return"";var i=n7(),n=n$([i&&'nonce="'.concat(i,'"'),"".concat(nl,'="true"'),"".concat(nh,'="').concat(nu,'"')].filter(Boolean)," ");return"<style ".concat(n,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw nm(2);return e._emitSheetCSS()},this.getStyleElement=function(){if(e.sealed)throw nm(2);var t,i=e.instance.toString();if(!i)return[];var n=((t={})[nl]="",t[nh]=nu,t.dangerouslySetInnerHTML={__html:i},t),r=n7();return r&&(n.nonce=r),[i_.default.createElement("style",iN({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new ra({isServer:!0}),this.sealed=!1}nb.forEach(function(e){rC[e]=rC(e)}),function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=ru(e),ra.registerId(this.componentId+1)}e.prototype.createStyles=function(e,t,i,n){var r=n(n$(rh(this.rules,t,i,n)),""),a=this.componentId+e;i.insertRules(a,a,r)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,i,n){e>2&&ra.registerId(this.componentId+e);var r=this.componentId+e;this.isStatic?i.hasNameForId(r,r)||this.createStyles(e,t,i,n):(this.removeStyles(e,i),this.createStyles(e,t,i,n))}}(),(function(e,t){var i=this;this[n]=!0,this.inject=function(e,t){void 0===t&&(t=r_);var n=i.name+t.hash;e.hasNameForId(i.id,n)||e.insertRules(i.id,n,t(i.rules,n,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,nQ(this,function(){throw nm(12,String(i.name))})}).prototype.getName=function(e){return void 0===e&&(e=r_),this.name+e.hash},n=ro,rP.prototype.collectStyles=function(e){if(this.sealed)throw nm(2);return i_.default.createElement(rS,{sheet:this.instance},e)},rP.prototype.interleaveWithNodeStream=function(e){throw nm(3)};let rL="rgba(223, 223, 223, 1)",rI="rgba(156, 156, 156, 1)",rN="rgba(243, 151, 143, 1)",rD="rgba(240, 97, 84,1)",rU="rgba(38, 38, 38, 0.7)",rO="rgba(61, 61, 63, 0.7)",rF="rgba(61, 61, 63, 1)",rB="linear-gradient(to bottom, #343434, #393939)",rz="linear-gradient(to bottom, rgba(52, 52, 52, 0.75), rgba(57, 57, 57, 0.75))",rk="linear-gradient(to bottom, rgba(75, 75, 75, 0.75), rgba(80, 80, 80, 0.75))",rV="30px",rH="14px",rG="10px",rW="10px 3px 3px 10px",rj="3px 10px 10px 3px",rX="70px",rq="30px",rY=rC.button`
2
+ background: ${rz};
3
+ border: none;
4
+ display: flex;
5
+ align-items: center;
6
+ justify-content: center;
7
+ cursor: pointer;
8
+ color: ${rL};
9
+ border: 1px solid transparent;
10
+ border-radius: ${"3px"};
11
+ font-size: ${rH};
12
+ height: ${rV};
13
+ min-width: ${"30px"};
14
+ transition: all 0.2s ease-in-out;
15
+ text-transform: none;
16
+ box-shadow: none;
17
+ font-family: Arial, sans-serif;
18
+
19
+ &:first-child {
20
+ border-radius: ${({$reverse:e})=>e?rj:rW};
21
+ }
22
+
23
+ &:last-child {
24
+ border-radius: ${({$reverse:e})=>e?rW:rj};
25
+ }
26
+
27
+ &:first-child:last-child {
28
+ border-radius: ${rG};
29
+ }
30
+ `,rK=rC.div`
31
+ padding: 2px;
32
+ display: flex;
33
+ background-color: ${rU};
34
+ border: 1px solid ${rO};
35
+ backdrop-filter: blur(40px);
36
+ -webkit-backdrop-filter: blur(40px);
37
+ justify-content: center;
38
+ pointer-events: all;
39
+ border-radius: 14px;
40
+ align-items: center;
41
+ height: 24px;
42
+ `,rZ=rC.button`
43
+ background-color: transparent;
44
+ border: none;
45
+ display: flex;
46
+ align-items: center;
47
+ justify-content: center;
48
+ cursor: pointer;
49
+ color: ${rL};
50
+ border-radius: 4px;
51
+ font-size: 16px;
52
+ height: 24px;
53
+ min-width: 24px;
54
+ transition: all 0.2s ease-in-out;
55
+ text-transform: none;
56
+ box-shadow: none;
57
+ padding: 1px 5px;
58
+ font-family: Arial, sans-serif;
59
+
60
+ &:hover {
61
+ background-color: ${rF};
62
+ }
63
+
64
+ &:active {
65
+ background-color: ${rF};
66
+ }
67
+
68
+ &:focus {
69
+ outline: none;
70
+ }
71
+
72
+ &:first-child {
73
+ border-radius: 12px 4px 4px 12px;
74
+ }
75
+
76
+ &:last-child {
77
+ border-radius: 4px 12px 12px 4px;
78
+ }
79
+
80
+ &:first-child:last-child {
81
+ border-radius: 12px;
82
+ }
83
+ `,r$=rC.div`
84
+ background-color: ${({$pressed:e})=>e?rF:"rgba(61, 61, 63, 0.6)"};
85
+ border: none;
86
+ display: flex;
87
+ align-items: center;
88
+ justify-content: center;
89
+ color: ${rL};
90
+ border-radius: 8px;
91
+ font-size: 14px;
92
+ font-family: Arial, sans-serif;
93
+ height: 30px;
94
+ width: 30px;
95
+ transition: all 0.2s ease-in-out;
96
+ `,rJ=rC.div`
97
+ display: flex;
98
+ align-items: center;
99
+ height: 30px;
100
+ margin-bottom: 3px;
101
+ justify-content: flex-start;
102
+ flex-direction: ${({$reverse:e})=>e?"row-reverse":"row"};
103
+
104
+ &:last-child {
105
+ margin-bottom: 0;
106
+ }
107
+ `,rQ=rC.div`
108
+ display: flex;
109
+ flex-direction: ${({$reverse:e})=>e?"row-reverse":"row"};
110
+ height: 100%;
111
+ justify-content: space-between;
112
+ align-items: center;
113
+ margin: ${({$reverse:e})=>e?"0 5px 0 0":"0 0 0 5px"};
114
+ gap: 3px;
115
+ `;rC.button`
116
+ background-color: rgba(255, 255, 255, 0.3);
117
+ border: none;
118
+ display: flex;
119
+ justify-content: center;
120
+ align-items: center;
121
+ padding: 0;
122
+ pointer-events: none;
123
+ width: 50px;
124
+ height: 50px;
125
+ border-radius: 50%;
126
+ position: relative;
127
+ margin: 0 5px;
128
+ backdrop-filter: blur(10px);
129
+ -webkit-backdrop-filter: blur(10px);
130
+ `,rC.div`
131
+ position: absolute;
132
+ background-color: ${rL};
133
+ border-radius: 50%;
134
+ width: 36px;
135
+ height: 36px;
136
+ cursor: pointer;
137
+ pointer-events: auto;
138
+ `;let r0=rC.input.attrs({type:"range"})`
139
+ -webkit-appearance: none;
140
+ appearance: none;
141
+ background: ${rz};
142
+ border: none;
143
+ height: 100%;
144
+ width: ${rX};
145
+ cursor: pointer;
146
+ margin: 0;
147
+ transition: all 0.2s ease-in-out;
148
+ border-radius: ${({$reverse:e})=>e?rW:rj};
149
+
150
+ &::-webkit-slider-thumb {
151
+ -webkit-appearance: none;
152
+ appearance: none;
153
+ width: 8px;
154
+ height: 30px;
155
+ background-color: ${rL};
156
+ border-radius: ${"3px"};
157
+ }
158
+
159
+ &::-moz-range-thumb {
160
+ width: 10px;
161
+ height: 30px;
162
+ background-color: ${rL};
163
+ border-radius: ${"3px"};
164
+ }
165
+
166
+ &::-ms-thumb {
167
+ width: 8px;
168
+ height: 24px;
169
+ background-color: ${rL};
170
+ border-radius: ${"3px"};
171
+ }
172
+ `;rC.div`
173
+ display: flex;
174
+ flex-direction: column;
175
+ align-items: ${({$reverse:e})=>e?"flex-start":"flex-end"};
176
+ justify-content: center;
177
+ margin: ${({$reverse:e})=>e?"2px -26px 0 0":"2px 0 0 -26px"};
178
+ `,rC.div`
179
+ display: flex;
180
+ flex-direction: ${({$reverse:e})=>e?"row-reverse":"row"};
181
+ align-items: center;
182
+ justify-content: center;
183
+ `;let r1=rC(iL)`
184
+ height: ${({$size:e=14})=>`${e}px`};
185
+ min-height: ${({$size:e=14})=>`${e}px`};
186
+ max-height: ${({$size:e=14})=>`${e}px`};
187
+ width: ${({$size:e=14})=>`${e}px`};
188
+ min-width: ${({$size:e=14})=>`${e}px`};
189
+ max-width: ${({$size:e=14})=>`${e}px`};
190
+ transform: ${({$reverse:e})=>e?"scaleX(-1)":"unset"};
191
+ `,r2=rC(iL)`
192
+ height: 18px;
193
+ min-height: 18px;
194
+ max-height: 18px;
195
+ width: 18px;
196
+ min-width: 18px;
197
+ max-width: 18px;
198
+ margin: 6px;
199
+ transform: ${({$reverse:e})=>e?"scaleX(-1)":"unset"};
200
+ `,r3=rC.div`
201
+ position: fixed;
202
+ padding: 5px;
203
+ font-family: Arial, sans-serif;
204
+ color: ${rL};
205
+ pointer-events: all;
206
+ background-color: ${rU};
207
+ border: 1px solid ${rO};
208
+ backdrop-filter: blur(40px);
209
+ -webkit-backdrop-filter: blur(40px);
210
+ border-radius: 12px;
211
+ box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
212
+ overflow: hidden;
213
+ display: flex;
214
+ flex-direction: column;
215
+ `,r5=rC.hr`
216
+ width: ${({$horizontal:e=!0})=>e?"unset":"1px"};
217
+ height: ${({$horizontal:e=!0})=>e?"1px":"unset"};
218
+ background-color: ${rO};
219
+ margin: 5px 3px;
220
+ border: none;
221
+ `,r4=rC.button`
222
+ background-color: transparent;
223
+ border: none;
224
+ display: flex;
225
+ align-items: center;
226
+ justify-content: center;
227
+ cursor: pointer;
228
+ color: ${({$isRed:e})=>e?rN:rL};
229
+ font-size: 12px;
230
+ padding: 3px;
231
+ text-transform: none;
232
+ box-shadow: none;
233
+
234
+ &:hover {
235
+ color: ${({$isRed:e})=>e?rD:"#ffffff"};
236
+ }
237
+
238
+ &:active {
239
+ color: ${({$isRed:e})=>e?rD:"#ffffff"};
240
+ }
241
+
242
+ &:focus {
243
+ outline: none;
244
+ }
245
+ `,r6=rC.div`
246
+ display: flex;
247
+ flex-direction: row;
248
+ gap: ${"3px"};
249
+ height: 25px;
250
+ `,r8=rC.input.attrs({type:"text"})`
251
+ width: 50px;
252
+ outline: none;
253
+ background: ${rB};
254
+ border: 1px solid transparent;
255
+ border-radius: 5px;
256
+ height: 25px;
257
+ color: ${rL};
258
+ padding: 0 10px 0 5px;
259
+ box-sizing: border-box;
260
+ font-size: 10px;
261
+
262
+ &:read-only {
263
+ background: ${rz};
264
+ }
265
+
266
+ &:invalid {
267
+ background-color: ${rN};
268
+ }
269
+ `,r7=rC.span`
270
+ position: absolute;
271
+ right: 5px;
272
+ top: 50%;
273
+ transform: translateY(-50%);
274
+ pointer-events: none;
275
+ color: ${rI};
276
+ font-size: 10px;
277
+ `,r9={prefix:"fas",iconName:"right-from-bracket",icon:[512,512,["sign-out-alt"],"f2f5","M377.9 105.9L500.7 228.7c7.2 7.2 11.3 17.1 11.3 27.3s-4.1 20.1-11.3 27.3L377.9 406.1c-6.4 6.4-15 9.9-24 9.9c-18.7 0-33.9-15.2-33.9-33.9l0-62.1-128 0c-17.7 0-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32l128 0 0-62.1c0-18.7 15.2-33.9 33.9-33.9c9 0 17.6 3.6 24 9.9zM160 96L96 96c-17.7 0-32 14.3-32 32l0 256c0 17.7 14.3 32 32 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c-53 0-96-43-96-96L0 128C0 75 43 32 96 32l64 0c17.7 0 32 14.3 32 32s-14.3 32-32 32z"]},ae={prefix:"fas",iconName:"fingerprint",icon:[512,512,[],"f577","M48 256C48 141.1 141.1 48 256 48c63.1 0 119.6 28.1 157.8 72.5c8.6 10.1 23.8 11.2 33.8 2.6s11.2-23.8 2.6-33.8C403.3 34.6 333.7 0 256 0C114.6 0 0 114.6 0 256l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40zm458.5-52.9c-2.7-13-15.5-21.3-28.4-18.5s-21.3 15.5-18.5 28.4c2.9 13.9 4.5 28.3 4.5 43.1l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40c0-18.1-1.9-35.8-5.5-52.9zM256 80c-19 0-37.4 3-54.5 8.6c-15.2 5-18.7 23.7-8.3 35.9c7.1 8.3 18.8 10.8 29.4 7.9c10.6-2.9 21.8-4.4 33.4-4.4c70.7 0 128 57.3 128 128l0 24.9c0 25.2-1.5 50.3-4.4 75.3c-1.7 14.6 9.4 27.8 24.2 27.8c11.8 0 21.9-8.6 23.3-20.3c3.3-27.4 5-55 5-82.7l0-24.9c0-97.2-78.8-176-176-176zM150.7 148.7c-9.1-10.6-25.3-11.4-33.9-.4C93.7 178 80 215.4 80 256l0 24.9c0 24.2-2.6 48.4-7.8 71.9C68.8 368.4 80.1 384 96.1 384c10.5 0 19.9-7 22.2-17.3c6.4-28.1 9.7-56.8 9.7-85.8l0-24.9c0-27.2 8.5-52.4 22.9-73.1c7.2-10.4 8-24.6-.2-34.2zM256 160c-53 0-96 43-96 96l0 24.9c0 35.9-4.6 71.5-13.8 106.1c-3.8 14.3 6.7 29 21.5 29c9.5 0 17.9-6.2 20.4-15.4c10.5-39 15.9-79.2 15.9-119.7l0-24.9c0-28.7 23.3-52 52-52s52 23.3 52 52l0 24.9c0 36.3-3.5 72.4-10.4 107.9c-2.7 13.9 7.7 27.2 21.8 27.2c10.2 0 19-7 21-17c7.7-38.8 11.6-78.3 11.6-118.1l0-24.9c0-53-43-96-96-96zm24 96c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 24.9c0 59.9-11 119.3-32.5 175.2l-5.9 15.3c-4.8 12.4 1.4 26.3 13.8 31s26.3-1.4 31-13.8l5.9-15.3C267.9 411.9 280 346.7 280 280.9l0-24.9z"]},at={prefix:"fas",iconName:"gamepad",icon:[640,512,[],"f11b","M192 64C86 64 0 150 0 256S86 448 192 448l256 0c106 0 192-86 192-192s-86-192-192-192L192 64zM496 168a40 40 0 1 1 0 80 40 40 0 1 1 0-80zM392 304a40 40 0 1 1 80 0 40 40 0 1 1 -80 0zM168 200c0-13.3 10.7-24 24-24s24 10.7 24 24l0 32 32 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-32 0 0 32c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-32-32 0c-13.3 0-24-10.7-24-24s10.7-24 24-24l32 0 0-32z"]},ai={prefix:"fas",iconName:"hand",icon:[512,512,[129306,9995,"hand-paper"],"f256","M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 208c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-176c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 272c0 1.5 0 3.1 .1 4.6L67.6 283c-16-15.2-41.3-14.6-56.6 1.4s-14.6 41.3 1.4 56.6L124.8 448c43.1 41.1 100.4 64 160 64l19.2 0c97.2 0 176-78.8 176-176l0-208c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 112c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-176c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 176c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-208z"]},an={prefix:"fas",iconName:"plug",icon:[384,512,[128268],"f1e6","M96 0C78.3 0 64 14.3 64 32l0 96 64 0 0-96c0-17.7-14.3-32-32-32zM288 0c-17.7 0-32 14.3-32 32l0 96 64 0 0-96c0-17.7-14.3-32-32-32zM32 160c-17.7 0-32 14.3-32 32s14.3 32 32 32l0 32c0 77.4 55 142 128 156.8l0 67.2c0 17.7 14.3 32 32 32s32-14.3 32-32l0-67.2C297 398 352 333.4 352 256l0-32c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 160z"]},ar={prefix:"fas",iconName:"ban",icon:[512,512,[128683,"cancel"],"f05e","M367.2 412.5L99.5 144.8C77.1 176.1 64 214.5 64 256c0 106 86 192 192 192c41.5 0 79.9-13.1 111.2-35.5zm45.3-45.3C434.9 335.9 448 297.5 448 256c0-106-86-192-192-192c-41.5 0-79.9 13.1-111.2 35.5L412.5 367.2zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z"]},aa={prefix:"fas",iconName:"rotate-left",icon:[512,512,["rotate-back","rotate-backward","undo-alt"],"f2ea","M48.5 224L40 224c-13.3 0-24-10.7-24-24L16 72c0-9.7 5.8-18.5 14.8-22.2s19.3-1.7 26.2 5.2L98.6 96.6c87.6-86.5 228.7-86.2 315.8 1c87.5 87.5 87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3c-62.2-62.2-162.7-62.5-225.3-1L185 183c6.9 6.9 8.9 17.2 5.2 26.2s-12.5 14.8-22.2 14.8L48.5 224z"]},as={prefix:"fas",iconName:"circle-play",icon:[512,512,[61469,"play-circle"],"f144","M0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256zM188.3 147.1c-7.6 4.2-12.3 12.3-12.3 20.9l0 176c0 8.7 4.7 16.7 12.3 20.9s16.8 4.1 24.3-.5l144-88c7.1-4.4 11.5-12.1 11.5-20.5s-4.4-16.1-11.5-20.5l-144-88c-7.4-4.5-16.7-4.7-24.3-.5z"]},ao={prefix:"fas",iconName:"person-shelter",icon:[512,512,[],"e54f","M271.9 4.2c-9.8-5.6-21.9-5.6-31.8 0l-224 128C6.2 137.9 0 148.5 0 160L0 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-301.4L256 68.9 448 178.6 448 480c0 17.7 14.3 32 32 32s32-14.3 32-32l0-320c0-11.5-6.2-22.1-16.1-27.8l-224-128zM256 208a40 40 0 1 0 0-80 40 40 0 1 0 0 80zm-8 280l0-88 16 0 0 88c0 13.3 10.7 24 24 24s24-10.7 24-24l0-174.5 26.9 49.9c6.3 11.7 20.8 16 32.5 9.8s16-20.8 9.8-32.5l-37.9-70.3c-15.3-28.5-45.1-46.3-77.5-46.3l-19.5 0c-32.4 0-62.1 17.8-77.5 46.3l-37.9 70.3c-6.3 11.7-1.9 26.2 9.8 32.5s26.2 1.9 32.5-9.8L200 313.5 200 488c0 13.3 10.7 24 24 24s24-10.7 24-24z"]},al={prefix:"fas",iconName:"hand-scissors",icon:[512,512,[],"f257","M40 208c-22.1 0-40 17.9-40 40s17.9 40 40 40l180.2 0c-7.6 8.5-12.2 19.7-12.2 32c0 25.3 19.5 46 44.3 47.9c-7.7 8.5-12.3 19.8-12.3 32.1c0 26.5 21.5 48 48 48l32 0 64 0c70.7 0 128-57.3 128-128l0-113.1c0-40.2-16-78.8-44.4-107.3C444.8 76.8 413.9 64 381.7 64L336 64c-21.3 0-39.3 13.9-45.6 33.1l74.5 23.7c8.4 2.7 13.1 11.7 10.4 20.1s-11.7 13.1-20.1 10.4L288 129.9c0 0 0 .1 0 .1L84 65.8C62.9 59.2 40.5 70.9 33.8 92s5.1 43.5 26.2 50.2L269.5 208 40 208z"]},ac={prefix:"fas",iconName:"street-view",icon:[512,512,[],"f21d","M320 64A64 64 0 1 0 192 64a64 64 0 1 0 128 0zm-96 96c-35.3 0-64 28.7-64 64l0 48c0 17.7 14.3 32 32 32l1.8 0 11.1 99.5c1.8 16.2 15.5 28.5 31.8 28.5l38.7 0c16.3 0 30-12.3 31.8-28.5L318.2 304l1.8 0c17.7 0 32-14.3 32-32l0-48c0-35.3-28.7-64-64-64l-64 0zM132.3 394.2c13-2.4 21.7-14.9 19.3-27.9s-14.9-21.7-27.9-19.3c-32.4 5.9-60.9 14.2-82 24.8c-10.5 5.3-20.3 11.7-27.8 19.6C6.4 399.5 0 410.5 0 424c0 21.4 15.5 36.1 29.1 45c14.7 9.6 34.3 17.3 56.4 23.4C130.2 504.7 190.4 512 256 512s125.8-7.3 170.4-19.6c22.1-6.1 41.8-13.8 56.4-23.4c13.7-8.9 29.1-23.6 29.1-45c0-13.5-6.4-24.5-14-32.6c-7.5-7.9-17.3-14.3-27.8-19.6c-21-10.6-49.5-18.9-82-24.8c-13-2.4-25.5 6.3-27.9 19.3s6.3 25.5 19.3 27.9c30.2 5.5 53.7 12.8 69 20.5c3.2 1.6 5.8 3.1 7.9 4.5c3.6 2.4 3.6 7.2 0 9.6c-8.8 5.7-23.1 11.8-43 17.3C374.3 457 318.5 464 256 464s-118.3-7-157.7-17.9c-19.9-5.5-34.2-11.6-43-17.3c-3.6-2.4-3.6-7.2 0-9.6c2.1-1.4 4.8-2.9 7.9-4.5c15.3-7.7 38.8-14.9 69-20.5z"]},ah={prefix:"fas",iconName:"gear",icon:[512,512,[9881,"cog"],"f013","M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z"]},au={prefix:"fas",iconName:"bug",icon:[512,512,[],"f188","M256 0c53 0 96 43 96 96l0 3.6c0 15.7-12.7 28.4-28.4 28.4l-135.1 0c-15.7 0-28.4-12.7-28.4-28.4l0-3.6c0-53 43-96 96-96zM41.4 105.4c12.5-12.5 32.8-12.5 45.3 0l64 64c.7 .7 1.3 1.4 1.9 2.1c14.2-7.3 30.4-11.4 47.5-11.4l112 0c17.1 0 33.2 4.1 47.5 11.4c.6-.7 1.2-1.4 1.9-2.1l64-64c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-64 64c-.7 .7-1.4 1.3-2.1 1.9c6.2 12 10.1 25.3 11.1 39.5l64.3 0c17.7 0 32 14.3 32 32s-14.3 32-32 32l-64 0c0 24.6-5.5 47.8-15.4 68.6c2.2 1.3 4.2 2.9 6 4.8l64 64c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0l-63.1-63.1c-24.5 21.8-55.8 36.2-90.3 39.6L272 240c0-8.8-7.2-16-16-16s-16 7.2-16 16l0 239.2c-34.5-3.4-65.8-17.8-90.3-39.6L86.6 502.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l64-64c1.9-1.9 3.9-3.4 6-4.8C101.5 367.8 96 344.6 96 320l-64 0c-17.7 0-32-14.3-32-32s14.3-32 32-32l64.3 0c1.1-14.1 5-27.5 11.1-39.5c-.7-.6-1.4-1.2-2.1-1.9l-64-64c-12.5-12.5-12.5-32.8 0-45.3z"]},ad={prefix:"fas",iconName:"angle-up",icon:[448,512,[8963],"f106","M201.4 137.4c12.5-12.5 32.8-12.5 45.3 0l160 160c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L224 205.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l160-160z"]},ap={prefix:"fas",iconName:"chevron-left",icon:[320,512,[9001],"f053","M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z"]},af={prefix:"fas",iconName:"hand-lizard",icon:[512,512,[],"f258","M0 112C0 85.5 21.5 64 48 64l112 0 80 0 46.5 0c36.8 0 71.2 18 92.1 48.2l113.5 164c13 18.7 19.9 41 19.9 63.8l0 12 0 16 0 48c0 17.7-14.3 32-32 32l-96 0c-17.7 0-32-14.3-32-32l0-13.8L273.9 352 240 352l-80 0-48 0c-26.5 0-48-21.5-48-48s21.5-48 48-48l48 0 80 0c26.5 0 48-21.5 48-48s-21.5-48-48-48l-80 0L48 160c-26.5 0-48-21.5-48-48z"]},am={prefix:"fas",iconName:"chevron-right",icon:[320,512,[9002],"f054","M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z"]},ag={prefix:"fas",iconName:"vr-cardboard",icon:[640,512,[],"f729","M576 64L64 64C28.7 64 0 92.7 0 128L0 384c0 35.3 28.7 64 64 64l120.4 0c24.2 0 46.4-13.7 57.2-35.4l32-64c8.8-17.5 26.7-28.6 46.3-28.6s37.5 11.1 46.3 28.6l32 64c10.8 21.7 33 35.4 57.2 35.4L576 448c35.3 0 64-28.7 64-64l0-256c0-35.3-28.7-64-64-64zM96 240a64 64 0 1 1 128 0A64 64 0 1 1 96 240zm384-64a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"]},av={prefix:"fas",iconName:"circle-xmark",icon:[512,512,[61532,"times-circle","xmark-circle"],"f057","M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM175 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"]},a_={prefix:"fas",iconName:"video",icon:[576,512,["video-camera"],"f03d","M0 128C0 92.7 28.7 64 64 64l256 0c35.3 0 64 28.7 64 64l0 256c0 35.3-28.7 64-64 64L64 448c-35.3 0-64-28.7-64-64L0 128zM559.1 99.8c10.4 5.6 16.9 16.4 16.9 28.2l0 256c0 11.8-6.5 22.6-16.9 28.2s-23 5-32.9-1.6l-96-64L416 337.1l0-17.1 0-128 0-17.1 14.2-9.5 96-64c9.8-6.5 22.4-7.2 32.9-1.6z"]},ax={"x-button-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M16.529 16.1h-.893l-1.653-2.713-1.68 2.713h-.832l2.074-3.255-1.942-2.992h.875l1.531 2.45 1.54-2.45h.831l-1.933 2.975 2.082 3.272Z",style:{fill:"#fff",fillOpacity:1}})]}),"y-button-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"m14.086 12.924 1.627-3.071h.849l-2.083 3.823V16.1h-.787v-2.389L11.61 9.853h.857l1.619 3.07Z",style:{fill:"#fff",fillOpacity:1}})]}),"a-button-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"m15.975 16.1-.753-1.934h-2.476l-.744 1.934h-.796l2.441-6.274h.709l2.432 6.274h-.813Zm-1.69-4.524a29.052 29.052 0 0 1-.21-.63 5.175 5.175 0 0 0-.087-.306c-.029.117-.06.236-.096.359-.03.116-.061.224-.096.323-.03.1-.056.184-.079.254l-.709 1.89h1.978l-.7-1.89Z",style:{fill:"#fff",fillOpacity:1}})]}),"b-button-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M7 13.125a7 7 0 1 0 14 0v1.75a7 7 0 0 1-14 0v-1.75Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.55,d:"M14 19.863a6.738 6.738 0 1 0 0-13.476 6.738 6.738 0 0 0 0 13.476Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M13.876 9.853c.519 0 .954.05 1.304.148.355.1.62.263.796.49.18.228.271.531.271.91 0 .245-.047.464-.14.656a1.198 1.198 0 0 1-.402.473 1.62 1.62 0 0 1-.648.254v.043c.262.041.499.117.709.228.216.11.385.268.507.473.123.204.184.47.184.796 0 .379-.088.703-.262.971a1.663 1.663 0 0 1-.753.604c-.32.134-.706.201-1.155.201h-2.196V9.853h1.785Zm.157 2.66c.537 0 .905-.085 1.103-.254.198-.175.297-.432.297-.77 0-.344-.122-.59-.367-.735-.24-.152-.624-.228-1.155-.228h-1.033v1.986h1.155Zm-1.155.656v2.266h1.26c.555 0 .94-.108 1.155-.324.216-.216.324-.498.324-.849 0-.221-.05-.414-.149-.577-.093-.163-.254-.289-.481-.376-.222-.093-.525-.14-.91-.14h-1.199Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.5,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M12.642 17.325v-6.247h.787v5.547h2.73v.7h-3.517ZM14.479 6.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875L14.478 6.39Z",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"m13.045 6.711-1.093-1.22a8.75 8.75 0 1 0 4.24.036L15.11 6.733A7.352 7.352 0 0 1 14 21.35a7.35 7.35 0 0 1-.955-14.639Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-up-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM13.697.611a.525.525 0 0 1 .782 0l2.234 2.495a.525.525 0 0 1-.39.875h-4.47a.525.525 0 0 1-.391-.875L13.697.61Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-down-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM14.479 27.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875l-2.235 2.495Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-right-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM27.389 13.521a.525.525 0 0 1 0 .782l-2.495 2.235a.525.525 0 0 1-.875-.39v-4.47c0-.454.537-.694.875-.391l2.495 2.234Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-left-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M12.642 17.325v-6.248h.787v5.548h2.73v.7h-3.517ZM.611 14.303a.525.525 0 0 1 0-.782l2.495-2.234a.525.525 0 0 1 .875.39v4.47a.525.525 0 0 1-.875.391L.61 14.303Z",style:{fill:"#fff",fillOpacity:1}})]}),"pose-left":()=>(0,Y.jsx)(r2,{icon:al,$reverse:!0}),"pinch-left":()=>(0,Y.jsx)(r2,{icon:af,$reverse:!0}),"thumbstick-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.7,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM14.479 6.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875L14.478 6.39Z",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"m13.045 6.711-1.093-1.22a8.75 8.75 0 1 0 4.24.036L15.11 6.733A7.352 7.352 0 0 1 14 21.35a7.35 7.35 0 0 1-.955-14.639Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-up-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM13.697.611a.525.525 0 0 1 .782 0l2.234 2.495a.525.525 0 0 1-.39.875h-4.47a.525.525 0 0 1-.391-.875L13.697.61Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-down-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM14.479 27.389a.525.525 0 0 1-.782 0l-2.235-2.495a.525.525 0 0 1 .39-.875h4.47c.454 0 .694.537.391.875l-2.235 2.495Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-right-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM27.389 13.521a.525.525 0 0 1 0 .782l-2.495 2.235a.525.525 0 0 1-.875-.39v-4.47c0-.454.537-.694.875-.391l2.495 2.234Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbstick-left-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:1.5,d:"M14 22.05a8.05 8.05 0 1 0 0-16.1 8.05 8.05 0 0 0 0 16.1Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.75,d:"M14 19.95a5.95 5.95 0 1 0 0-11.9 5.95 5.95 0 0 0 0 11.9Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M13.938 11.077c.52 0 .945.068 1.278.202.338.128.59.323.752.586.164.262.245.592.245.989 0 .332-.06.61-.183.83-.123.223-.28.4-.473.535a2.61 2.61 0 0 1-.595.306l1.715 2.8h-.919l-1.513-2.581h-1.243v2.58h-.787v-6.247h1.723Zm-.043.683h-.893v2.319h.936c.339 0 .616-.044.832-.132a.956.956 0 0 0 .472-.402c.105-.175.158-.394.158-.656 0-.274-.056-.493-.167-.657a.905.905 0 0 0-.49-.358c-.221-.076-.504-.114-.848-.114ZM.611 14.303a.525.525 0 0 1 0-.782l2.495-2.234a.525.525 0 0 1 .875.39v4.47a.525.525 0 0 1-.875.391L.61 14.303Z",style:{fill:"#fff",fillOpacity:1}})]}),"trigger-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.7,d:"M14 20.212a7.612 7.612 0 1 0 0-15.224 7.612 7.612 0 0 0 0 15.224Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M10.209 15.662V9.415h.787v5.548h2.73v.7H10.21Zm6.395 0h-.787v-5.556h-1.952v-.691h4.682v.691h-1.943v5.556Z",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M21.235 17.5a8.31 8.31 0 0 1-7.205 4.165A8.31 8.31 0 0 1 6.825 17.5c.823 3.4 3.737 5.915 7.205 5.915 3.469 0 6.382-2.514 7.205-5.915Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),"trigger-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.7,d:"M14 20.212a7.612 7.612 0 1 0 0-15.224 7.612 7.612 0 0 0 0 15.224Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M11.42 9.415c.52 0 .945.067 1.277.201.339.129.59.324.753.587.163.262.245.592.245.988 0 .333-.061.61-.184.832-.122.221-.28.4-.472.533-.187.129-.385.23-.595.307l1.715 2.8h-.92l-1.513-2.582h-1.242v2.582h-.788V9.415h1.724Zm-.044.683h-.892v2.318h.936c.338 0 .615-.043.831-.131a.956.956 0 0 0 .473-.402c.105-.175.157-.394.157-.657 0-.274-.055-.493-.166-.656a.905.905 0 0 0-.49-.359c-.222-.075-.505-.114-.849-.114Zm5.74 5.564h-.787v-5.556h-1.951v-.691h4.681v.691h-1.942v5.556Z",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M21.235 17.5a8.31 8.31 0 0 1-7.205 4.165A8.31 8.31 0 0 1 6.825 17.5c.823 3.4 3.737 5.915 7.205 5.915 3.469 0 6.382-2.514 7.205-5.915Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),"squeeze-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M7.525 7.875c-2.283 1.22-3.82 3.507-3.82 6.125s1.537 4.904 3.82 6.125C4.405 19.425 2.1 16.948 2.1 14s2.306-5.425 5.425-6.125Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.7,d:"M24.702 10.954a2.187 2.187 0 0 0-2.095-2.817H11.025a5.863 5.863 0 0 0 0 11.726h9.377c.966 0 1.818-.634 2.095-1.56l2.205-7.35Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M10.594 17.15v-6.248h.788v5.548h2.73v.7h-3.518Zm7.13-3.299h2.162v3.063c-.338.11-.68.192-1.024.245a7.837 7.837 0 0 1-1.172.078c-.648 0-1.193-.128-1.637-.385a2.567 2.567 0 0 1-1.015-1.11c-.227-.485-.34-1.057-.34-1.716 0-.653.127-1.219.384-1.697a2.699 2.699 0 0 1 1.103-1.112c.484-.268 1.067-.402 1.75-.402.35 0 .68.032.988.096.315.064.607.155.875.271l-.297.683a4.55 4.55 0 0 0-.753-.254 3.453 3.453 0 0 0-.857-.105c-.496 0-.922.102-1.278.306a2.004 2.004 0 0 0-.813.875c-.187.374-.28.82-.28 1.34 0 .495.078.935.236 1.32.163.38.417.677.761.893.344.21.796.315 1.356.315.187 0 .35-.006.49-.018.146-.017.277-.037.394-.06.123-.024.236-.047.341-.07V14.55h-1.373v-.7Z",style:{fill:"#fff",fillOpacity:1}})]}),"squeeze-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M20.441 7.875c2.283 1.22 3.82 3.507 3.82 6.125s-1.537 4.904-3.82 6.125c3.12-.7 5.425-3.177 5.425-6.125s-2.305-5.425-5.425-6.125Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{stroke:"#fff",strokeWidth:.7,d:"M3.264 10.954a2.187 2.187 0 0 1 2.095-2.817h11.582a5.862 5.862 0 0 1 0 11.726H7.564a2.188 2.188 0 0 1-2.095-1.56l-2.205-7.35Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",d:"M9.497 10.902c.519 0 .945.068 1.277.202.339.128.59.323.753.586.163.262.245.592.245.989 0 .332-.062.61-.184.83-.122.223-.28.4-.472.535-.187.128-.386.23-.595.306l1.714 2.8h-.918l-1.514-2.581H8.56v2.58h-.787v-6.247h1.724Zm-.044.683H8.56v2.319h.937c.338 0 .615-.044.831-.132a.956.956 0 0 0 .473-.402c.104-.175.157-.394.157-.656 0-.274-.055-.493-.166-.657a.905.905 0 0 0-.49-.358c-.222-.076-.505-.114-.849-.114Zm6.476 2.266h2.16v3.063c-.337.11-.679.192-1.023.245a7.837 7.837 0 0 1-1.172.078c-.648 0-1.193-.128-1.637-.385a2.568 2.568 0 0 1-1.015-1.11c-.227-.485-.34-1.057-.34-1.716 0-.653.127-1.219.384-1.697a2.699 2.699 0 0 1 1.103-1.112c.484-.268 1.067-.402 1.75-.402.35 0 .68.032.988.096.315.064.607.155.875.271l-.297.683a4.551 4.551 0 0 0-.753-.254 3.453 3.453 0 0 0-.857-.105c-.496 0-.922.102-1.278.306a2.004 2.004 0 0 0-.813.875c-.187.374-.28.82-.28 1.34 0 .495.078.935.236 1.32.163.38.417.677.761.893.344.21.796.315 1.356.315.187 0 .35-.006.49-.018a5.17 5.17 0 0 0 .394-.06c.123-.024.236-.047.341-.07V14.55H15.93v-.7Z",style:{fill:"#fff",fillOpacity:1}})]}),"thumbrest-left":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",d:"m20.01 15.768-4.242 4.242a5.5 5.5 0 1 1-7.778-7.778l4.242-4.242a5.5 5.5 0 1 1 7.778 7.778Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M11.172 16.828a1 1 0 0 0 1.414 0L15.414 14l.707.707-2.828 2.828a2 2 0 1 1-2.829-2.828l.708.707a1 1 0 0 0 0 1.414ZM12.586 14l2.828-2.829a1 1 0 1 1 1.414 1.415l.708.707a2 2 0 0 0-2.829-2.829l-2.828 2.829.707.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M15.414 16.828 18.243 14a3 3 0 0 0-2.289-5.117l-.869-.869a4 4 0 0 1 3.864 6.693l-2.828 2.828-.707-.707Zm-.707 2.122a4 4 0 1 1-5.657-5.657l4.243-4.243.707.707L9.757 14A3 3 0 1 0 14 18.242l.707.708Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),"thumbrest-right":({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:rV,height:rV,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("path",{stroke:"#fff",d:"m15.768 7.99 4.242 4.242a5.5 5.5 0 1 1-7.778 7.778L7.99 15.768a5.5 5.5 0 1 1 7.778-7.778Z",style:{stroke:"#fff",strokeOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M16.828 16.828a1 1 0 0 0 0-1.414L14 12.586l.707-.707 2.828 2.828a2 2 0 1 1-2.828 2.828l.707-.707a1 1 0 0 0 1.414 0ZM14 15.414l-2.828-2.828a1 1 0 0 1 1.414-1.414l.707-.708a2 2 0 0 0-2.829 2.829l2.829 2.828.707-.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("path",{fill:"#fff",fillRule:"evenodd",d:"M16.828 12.586 14 9.757a3 3 0 0 0-5.117 2.289l-.869.869a4 4 0 0 1 6.693-3.864l2.828 2.828-.707.707Zm2.122.707a4 4 0 1 1-5.657 5.657L9.05 14.707 9.757 14 14 18.243A3 3 0 1 0 18.243 14l.707-.707Z",clipRule:"evenodd",style:{fill:"#fff",fillOpacity:1}})]}),"pose-right":()=>(0,Y.jsx)(r2,{icon:al,$reverse:!1}),"pinch-right":()=>(0,Y.jsx)(r2,{icon:af,$reverse:!1})},ay=({buttonName:e,handedness:t})=>{let i=ax[`${e}-${t}`];return i?(0,Y.jsx)(i,{}):(0,Y.jsx)("div",{style:{width:rV,height:rV}})},aM=({size:e=14,color:t=rL})=>(0,Y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 14 14",fill:"none",children:(0,Y.jsx)("path",{stroke:t,strokeWidth:1.5,d:"M7 13.037V5.512m-.324.289 6.3-2.275m-11.952 0 6.3 2.275m.23 6.937 4.233-1.528a1.627 1.627 0 0 0 1.076-1.53V4.396c0-.685-.43-1.297-1.076-1.53L7.553 1.339a1.63 1.63 0 0 0-1.106 0L2.213 2.867a1.627 1.627 0 0 0-1.075 1.53V9.68c0 .686.43 1.298 1.075 1.53l4.234 1.529a1.63 1.63 0 0 0 1.106 0Z",style:{stroke:t,strokeOpacity:1}})}),aS=({size:e=14,color:t=rL})=>(0,Y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 14 14",fill:"none",children:(0,Y.jsx)("path",{stroke:t,strokeWidth:1.2,d:"M7 13.037V5.512M3.937 11.9V4.375m6.126 7.525V4.375M6.675 5.8l6.3-2.275m-9.275.962 6.3-2.275M1.024 3.526l6.3 2.275M6.85 9.388l6.3-2.275m-12.302 0 6.3 2.276m-3.15-7.176 6.3 2.276m-2.746 8.248 4.234-1.527a1.627 1.627 0 0 0 1.075-1.53V4.396c0-.685-.43-1.297-1.075-1.53L7.553 1.339a1.63 1.63 0 0 0-1.106 0L2.213 2.867a1.627 1.627 0 0 0-1.076 1.53V9.68c0 .686.43 1.298 1.076 1.53l4.234 1.529a1.63 1.63 0 0 0 1.106 0Z",style:{stroke:t,strokeOpacity:1}})}),ab=({size:e=14,color:t=rL})=>(0,Y.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 14 14",fill:"none",children:(0,Y.jsx)("path",{stroke:t,strokeWidth:1.2,d:"M1.225 8.225h11.55M2.1 5.075h9.8m-7 7L5.6 2.1m3.5 9.975L8.4 2.1m-5.708 9.712h8.617a1.75 1.75 0 0 0 1.696-2.183l-1.567-6.125a1.75 1.75 0 0 0-1.695-1.317H4.258c-.8 0-1.498.542-1.696 1.317L.996 9.629a1.75 1.75 0 0 0 1.696 2.183Z",style:{stroke:t,strokeOpacity:1}})}),aE=({size:e=14,color:t=rL})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 14 14",fill:"none",children:[(0,Y.jsx)("path",{fill:t,d:"M10.5 8.367a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8Z",style:{fill:t,fillOpacity:1}}),(0,Y.jsx)("path",{fill:t,fillRule:"evenodd",d:"M0 5.8A2.8 2.8 0 0 1 2.8 3h8.4A2.8 2.8 0 0 1 14 5.8v2.8a2.8 2.8 0 0 1-2.8 2.8H9.526c-.619 0-1.184-.35-1.46-.903l-.108-.214a.933.933 0 0 0-.835-.516h-.246c-.354 0-.677.2-.835.516l-.107.214a1.633 1.633 0 0 1-1.461.903H2.8A2.8 2.8 0 0 1 0 8.6V5.8Zm4.9 1.167a1.4 1.4 0 1 1-2.8 0 1.4 1.4 0 0 1 2.8 0Zm8.367-.768a.268.268 0 0 0 .076-.292 2.942 2.942 0 0 0-.187-.407l-.055-.096a3.012 3.012 0 0 0-.262-.37.27.27 0 0 0-.29-.08l-.66.21a2.279 2.279 0 0 0-.522-.302l-.148-.676a.268.268 0 0 0-.215-.211 3.062 3.062 0 0 0-1.008.001.268.268 0 0 0-.215.21l-.148.677a2.28 2.28 0 0 0-.522.301l-.66-.21a.268.268 0 0 0-.29.081c-.096.116-.184.24-.262.37l-.056.096c-.072.13-.135.265-.187.406a.268.268 0 0 0 .076.292l.513.467a2.293 2.293 0 0 0 0 .603l-.513.467a.268.268 0 0 0-.076.291c.052.141.115.276.187.407l.056.096c.078.13.166.253.262.37a.27.27 0 0 0 .29.08l.66-.211c.158.122.333.224.52.3l.149.677a.268.268 0 0 0 .215.211 3.06 3.06 0 0 0 1.007 0 .268.268 0 0 0 .216-.21l.148-.677a2.28 2.28 0 0 0 .521-.301l.66.21c.105.033.22.004.29-.08.097-.117.184-.24.263-.37l.055-.097c.073-.13.135-.265.188-.406a.268.268 0 0 0-.076-.292l-.513-.466a2.299 2.299 0 0 0 0-.602l.513-.467Z",clipRule:"evenodd",style:{fill:t,fillOpacity:1}})]}),aT={KeyA:"A",KeyB:"B",KeyC:"C",KeyD:"D",KeyE:"E",KeyF:"F",KeyG:"G",KeyH:"H",KeyI:"I",KeyJ:"J",KeyK:"K",KeyL:"L",KeyM:"M",KeyN:"N",KeyO:"O",KeyP:"P",KeyQ:"Q",KeyR:"R",KeyS:"S",KeyT:"T",KeyU:"U",KeyV:"V",KeyW:"W",KeyX:"X",KeyY:"Y",KeyZ:"Z",Digit0:"0",Digit1:"1",Digit2:"2",Digit3:"3",Digit4:"4",Digit5:"5",Digit6:"6",Digit7:"7",Digit8:"8",Digit9:"9",Tab:(0,Y.jsx)(r1,{icon:{prefix:"fas",iconName:"arrow-right-to-bracket",icon:[512,512,["sign-in"],"f090","M352 96l64 0c17.7 0 32 14.3 32 32l0 256c0 17.7-14.3 32-32 32l-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32l64 0c53 0 96-43 96-96l0-256c0-53-43-96-96-96l-64 0c-17.7 0-32 14.3-32 32s14.3 32 32 32zm-9.4 182.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L242.7 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l210.7 0-73.4 73.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l128-128z"]}}),Backspace:(0,Y.jsx)(r1,{icon:{prefix:"fas",iconName:"delete-left",icon:[576,512,[9003,"backspace"],"f55a","M576 128c0-35.3-28.7-64-64-64L205.3 64c-17 0-33.3 6.7-45.3 18.7L9.4 233.4c-6 6-9.4 14.1-9.4 22.6s3.4 16.6 9.4 22.6L160 429.3c12 12 28.3 18.7 45.3 18.7L512 448c35.3 0 64-28.7 64-64l0-256zM271 175c9.4-9.4 24.6-9.4 33.9 0l47 47 47-47c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-47 47 47 47c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-47-47-47 47c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l47-47-47-47c-9.4-9.4-9.4-24.6 0-33.9z"]}}),Enter:(0,Y.jsx)(r1,{style:{transform:"rotate(90deg)"},icon:{prefix:"fas",iconName:"arrow-turn-down",icon:[384,512,["level-down"],"f149","M32 64C14.3 64 0 49.7 0 32S14.3 0 32 0l96 0c53 0 96 43 96 96l0 306.7 73.4-73.4c12.5-12.5 32.8-12.5 45.3 0s12.5 32.8 0 45.3l-128 128c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 402.7 160 96c0-17.7-14.3-32-32-32L32 64z"]}}),ShiftLeft:(0,Y.jsx)(r1,{icon:ad}),ShiftRight:(0,Y.jsx)(r1,{icon:ad}),Space:" ",ArrowUp:(0,Y.jsx)(r1,{icon:{prefix:"fas",iconName:"caret-up",icon:[320,512,[],"f0d8","M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8l256 0c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"]}}),ArrowDown:(0,Y.jsx)(r1,{icon:{prefix:"fas",iconName:"caret-down",icon:[320,512,[],"f0d7","M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"]}}),ArrowLeft:(0,Y.jsx)(r1,{icon:{prefix:"fas",iconName:"caret-left",icon:[256,512,[],"f0d9","M9.4 278.6c-12.5-12.5-12.5-32.8 0-45.3l128-128c9.2-9.2 22.9-11.9 34.9-6.9s19.8 16.6 19.8 29.6l0 256c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-128-128z"]}}),ArrowRight:(0,Y.jsx)(r1,{icon:{prefix:"fas",iconName:"caret-right",icon:[256,512,[],"f0da","M246.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-128-128c-9.2-9.2-22.9-11.9-34.9-6.9s-19.8 16.6-19.8 29.6l0 256c0 12.9 7.8 24.6 19.8 29.6s25.7 2.2 34.9-6.9l128-128z"]}}),Semicolon:";",Equal:"=",Comma:",",Minus:"-",Period:".",Slash:"/",Backquote:"`",BracketLeft:"[",Backslash:"\\",BracketRight:"]",Quote:"'",MouseLeft:(0,Y.jsx)(({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:16,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("g",{clipPath:"url(#a)",children:(0,Y.jsx)("path",{stroke:"#fff",d:"M.5 6.5H6m-5.5 0V5C.5 2.237 2.237.5 5 .5h1m-5.5 6V11c0 2.762 1.737 4.5 4.5 4.5h2c2.762 0 4.5-1.738 4.5-4.5V6.5M6 6.5v-6m0 6h5.5M6 .5h1c2.762 0 4.5 1.737 4.5 4.5v1.5",style:{stroke:"#fff",strokeOpacity:1}})}),(0,Y.jsx)("path",{fill:"#fff",d:"M.5 6.5H6v-6H5C2.237.5.5 2.237.5 5v1.5Z",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("defs",{children:(0,Y.jsx)("clipPath",{id:"a",children:(0,Y.jsx)("path",{fill:"#fff",d:"M0 0h12v16H0z",style:{fill:"#fff",fillOpacity:1}})})})]}),{}),MouseRight:(0,Y.jsx)(({scale:e=1.2})=>(0,Y.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:12,height:16,fill:"none",transform:`scale(${e}, ${e})`,children:[(0,Y.jsx)("g",{clipPath:"url(#a)",children:(0,Y.jsx)("path",{stroke:"#fff",d:"M.5 6.5H6m-5.5 0V5C.5 2.237 2.237.5 5 .5h1m-5.5 6V11c0 2.762 1.737 4.5 4.5 4.5h2c2.762 0 4.5-1.738 4.5-4.5V6.5M6 6.5v-6m0 6h5.5M6 .5h1c2.762 0 4.5 1.737 4.5 4.5v1.5",style:{stroke:"#fff",strokeOpacity:1}})}),(0,Y.jsx)("path",{fill:"#fff",d:"M11.5 6.5H6v-6h1c2.762 0 4.5 1.737 4.5 4.5v1.5Z",style:{fill:"#fff",fillOpacity:1}}),(0,Y.jsx)("defs",{children:(0,Y.jsx)("clipPath",{id:"a",children:(0,Y.jsx)("path",{fill:"#fff",d:"M0 0h12v16H0z",style:{fill:"#fff",fillOpacity:1}})})})]}),{})};var aw=e.i(8155);let aA=e=>{let t=(0,aw.createStore)(e),i=e=>(function(e,t=e=>e){let i=i_.default.useSyncExternalStore(e.subscribe,i_.default.useCallback(()=>t(e.getState()),[e,t]),i_.default.useCallback(()=>t(e.getInitialState()),[e,t]));return i_.default.useDebugValue(i),i})(t,e);return Object.assign(i,t),i},aR=e=>e?aA(e):aA,aC={left:{"thumbstick-up":"KeyW","thumbstick-down":"KeyS","thumbstick-left":"KeyA","thumbstick-right":"KeyD",thumbstick:"KeyR","x-button":"KeyX","y-button":"KeyZ",trigger:"KeyQ",squeeze:"KeyE",pinch:"MouseLeft",pose:"KeyF"},right:{"thumbstick-up":"ArrowUp","thumbstick-down":"ArrowDown","thumbstick-left":"ArrowLeft","thumbstick-right":"ArrowRight",thumbstick:"Slash","a-button":"Enter","b-button":"ShiftRight",trigger:"MouseLeft",squeeze:"MouseRight",pinch:"MouseRight",pose:"Backslash"}},aP=aR(e=>({keyMap:aC,bindKey:(t,i,n="Unmapped")=>e(e=>({keyMap:{...e.keyMap,[t]:{...e.keyMap[t],[i]:n}}}))})),aL=rC.div`
278
+ display: flex;
279
+ height: ${rV};
280
+ align-items: center;
281
+ justify-content: space-between;
282
+ margin-bottom: ${"3px"};
283
+
284
+ &:last-child {
285
+ margin-bottom: 0;
286
+ }
287
+ `,aI=({handedness:e,actions:t})=>{let{keyMap:i,bindKey:n}=aP(),[r,a]=(0,i_.useState)(null);return(0,i_.useEffect)(()=>{let t=t=>{r&&aT[t.code]&&(n(e,r.action,t.code),a(null))},i=t=>{if(r){let i=0===t.button?"MouseLeft":2===t.button?"MouseRight":null;i&&aT[i]&&(n(e,r.action,i),a(null))}},s=e=>{e.preventDefault()};return window.addEventListener("keydown",t),window.addEventListener("mousedown",i),window.addEventListener("contextmenu",s),()=>{window.removeEventListener("keydown",t),window.removeEventListener("mousedown",i),window.removeEventListener("contextmenu",s)}},[r]),Object.keys(i[e]).filter(e=>t.includes(e)).map(t=>(0,Y.jsxs)(aL,{children:[(0,Y.jsx)(ay,{buttonName:"up"===t?"thumbstick":t,handedness:e}),(0,Y.jsxs)(rQ,{$reverse:!1,children:[(0,Y.jsx)(rY,{$reverse:!1,style:{width:"100px",background:r&&r.action===t?rk:rz},onClick:()=>{a({action:t})},onContextMenu:e=>e.preventDefault(),children:i[e][t]}),(0,Y.jsx)(rY,{style:{width:rq},$reverse:!1,onClick:()=>n(e,t),onContextMenu:e=>e.preventDefault(),children:(0,Y.jsx)(iL,{icon:ar})})]})]},t))},aN=({xrController:e,buttonId:t,pointerLocked:i,mappedKey:n})=>{let[r,a]=(0,i_.useState)(!1),[s,o]=(0,i_.useState)(!1),[l,c]=(0,i_.useState)(!1),[h,u]=(0,i_.useState)(0),d=e.inputSource.handedness;return(0,i_.useEffect)(()=>{let r=i=>{i.code===n&&(e.updateButtonValue(t,1),c(!0))},a=i=>{i.code===n&&(e.updateButtonValue(t,0),c(!1))},s=i=>{"MouseLeft"===n&&0===i.button?(e.updateButtonValue(t,1),c(!0)):"MouseRight"===n&&2===i.button&&(e.updateButtonValue(t,1),c(!0))},o=i=>{"MouseLeft"===n&&0===i.button?(e.updateButtonValue(t,0),c(!1)):"MouseRight"===n&&2===i.button&&(e.updateButtonValue(t,0),c(!1))};return i?"MouseLeft"===n||"MouseRight"===n?(window.addEventListener("mousedown",s),window.addEventListener("mouseup",o)):(window.addEventListener("keydown",r),window.addEventListener("keyup",a)):"MouseLeft"===n||"MouseRight"===n?(window.removeEventListener("mousedown",s),window.removeEventListener("mouseup",o)):(window.removeEventListener("keydown",r),window.removeEventListener("keyup",a)),()=>{"MouseLeft"===n||"MouseRight"===n?(window.removeEventListener("mousedown",s),window.removeEventListener("mouseup",o)):(window.removeEventListener("keydown",r),window.removeEventListener("keyup",a))}},[n,i,t,e]),(0,Y.jsxs)(rJ,{$reverse:"right"===d,children:[(0,Y.jsx)(ay,{buttonName:t,handedness:d}),(0,Y.jsx)(rQ,{$reverse:"right"===d,children:i?(0,Y.jsx)(r$,{$pressed:l,children:aT[n]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(rY,{$reverse:"right"===d,style:{background:s?rk:rz,width:rX},onClick:()=>{o(!0),e.updateButtonValue(t,1),setTimeout(()=>{o(!1),e.updateButtonValue(t,0)},250)},children:"Press"}),(0,Y.jsx)(rY,{title:"Click to toggle touch state",$reverse:"right"===d,style:{background:r?rk:rz,width:rq},onClick:()=>{a(!r),e.updateButtonTouch(t,!r)},children:(0,Y.jsx)(r1,{icon:ae})}),(0,Y.jsx)(r0,{$reverse:"right"===d,value:h,onChange:i=>{let n=Number(i.target.value);u(n),e.updateButtonValue(t,n/100)},min:"0",max:"100"})]})})]})},aD=({xrController:e,buttonId:t,pointerLocked:i,mappedKey:n})=>{let[r,a]=(0,i_.useState)(!1),[s,o]=(0,i_.useState)(!1),[l,c]=(0,i_.useState)(!1),[h,u]=(0,i_.useState)(!1),d=e.inputSource.handedness;return(0,i_.useEffect)(()=>{let r=i=>{i.code===n&&(e.updateButtonValue(t,1),u(!0))},a=i=>{i.code===n&&(e.updateButtonValue(t,0),u(!1))};return i?(window.addEventListener("keydown",r),window.addEventListener("keyup",a)):(window.removeEventListener("keydown",r),window.removeEventListener("keyup",a)),()=>{window.removeEventListener("keydown",r),window.removeEventListener("keyup",a)}},[n,i,t,e]),(0,Y.jsxs)(rJ,{$reverse:"right"===d,children:[(0,Y.jsx)(ay,{buttonName:t,handedness:d}),(0,Y.jsx)(rQ,{$reverse:"right"===d,children:i?(0,Y.jsx)(r$,{$pressed:h,children:aT[n]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(rY,{$reverse:"right"===d,style:{background:l?rk:rz,width:rX},onClick:()=>{c(!0),e.updateButtonValue(t,1),setTimeout(()=>{c(!1),e.updateButtonValue(t,0)},250)},children:"Press"}),(0,Y.jsx)(rY,{title:"Click to toggle touch state",$reverse:"right"===d,style:{background:r?rk:rz,width:rq},onClick:()=>{a(!r),e.updateButtonTouch(t,!r)},children:(0,Y.jsx)(r1,{icon:ae})}),(0,Y.jsx)(rY,{$reverse:"right"===d,style:{background:s?rk:rz,width:rX},onClick:()=>{o(!s),e.updateButtonValue(t,+!s)},children:"Hold"})]})})]})},aU=rC.div`
288
+ display: flex;
289
+ align-items: center;
290
+ margin-bottom: ${"3px"};
291
+ `,aO=`calc(2 * ${rV} + 3px)`,aF=rC.button`
292
+ background: ${rz};
293
+ border: none;
294
+ display: flex;
295
+ justify-content: center;
296
+ align-items: center;
297
+ padding: 0;
298
+ pointer-events: none;
299
+ width: ${aO};
300
+ height: ${aO};
301
+ border-radius: 50%;
302
+ position: relative;
303
+ margin: 0 5px;
304
+ `,aB=rC.div`
305
+ position: absolute;
306
+ font-size: 50px;
307
+ display: flex;
308
+ align-items: center;
309
+ justify-content: center;
310
+ color: ${rL};
311
+ cursor: pointer;
312
+ pointer-events: auto;
313
+ `,az=rC(rY)`
314
+ width: ${rX};
315
+ font-size: ${rH};
316
+
317
+ ${({$reverse:e})=>e?`
318
+ &:first-child {
319
+ border-radius: ${rj};
320
+ }
321
+
322
+ &:last-child {
323
+ border-radius: ${rW};
324
+ }
325
+ `:`
326
+ &:first-child {
327
+ border-radius: ${rW};
328
+ }
329
+
330
+ &:last-child {
331
+ border-radius: ${rj};
332
+ }
333
+ `}
334
+ `,ak=({xrController:e,pointerLocked:t,buttonId:i,mappedKeyUp:n,mappedKeyDown:r,mappedKeyLeft:a,mappedKeyRight:s,mappedKeyPressed:o})=>{let l=(0,i_.useRef)(null),[c,h]=(0,i_.useState)(!1),[u,d]=(0,i_.useState)(!1),[p,f]=(0,i_.useState)(!1),[m,g]=(0,i_.useState)(!1),[v,_]=(0,i_.useState)({x:0,y:0}),[x,y]=(0,i_.useState)({up:!1,down:!1,left:!1,right:!1,pressed:!1}),M=e.inputSource.handedness,S=t=>{if(c&&l.current){let n,r,a=t.clientX-v.x,s=t.clientY-v.y;if(12>Math.sqrt(a*a+s*s))n=a,r=s;else{let e=Math.atan2(s,a);n=12*Math.cos(e),r=12*Math.sin(e)}l.current.style.transform=`translate(${n}px, ${r}px)`;let o=n/12,c=r/12;e.updateAxes(i,o,c)}},b=()=>{h(!1),l.current&&(l.current.style.transform="translate(0, 0)",e.updateAxes(i,0,0))};return(0,i_.useEffect)(()=>{let l=t=>{let l={...x};t.code===n&&(l.up=!0),t.code===r&&(l.down=!0),t.code===a&&(l.left=!0),t.code===s&&(l.right=!0),t.code===o&&(l.pressed=!0,e.updateButtonValue(i,1)),y(l),h(l)},c=t=>{let l={...x};t.code===n&&(l.up=!1),t.code===r&&(l.down=!1),t.code===a&&(l.left=!1),t.code===s&&(l.right=!1),t.code===o&&(l.pressed=!1,e.updateButtonValue(i,0)),y(l),h(l)},h=t=>{let n=!!t.right-!!t.left,r=!!t.down-!!t.up,a=Math.sqrt(n*n+r*r);0===a?e.updateAxes(i,0,0):e.updateAxes(i,n/a,r/a)};return t?(window.addEventListener("keydown",l),window.addEventListener("keyup",c)):(window.removeEventListener("keydown",l),window.removeEventListener("keyup",c)),()=>{window.removeEventListener("keydown",l),window.removeEventListener("keyup",c)}},[n,r,a,s,t,x]),(0,i_.useEffect)(()=>(document.addEventListener("mousemove",S),document.addEventListener("mouseup",b),()=>{document.removeEventListener("mousemove",S),document.removeEventListener("mouseup",b)}),[c,v]),t?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(rJ,{$reverse:"right"===M,children:[(0,Y.jsx)(ay,{buttonName:"thumbstick",handedness:e.inputSource.handedness}),(0,Y.jsxs)(rQ,{$reverse:"right"===M,children:[(0,Y.jsx)(r$,{$pressed:x.up,children:aT[n]}),(0,Y.jsx)(r$,{$pressed:x.pressed,children:aT[o]})]})]}),(0,Y.jsx)(rJ,{$reverse:"right"===M,style:"right"===M?{marginRight:"2px"}:{marginLeft:"2px"},children:(0,Y.jsxs)(rQ,{$reverse:!1,style:{margin:0},children:[(0,Y.jsx)(r$,{$pressed:x.left,children:aT[a]}),(0,Y.jsx)(r$,{$pressed:x.down,children:aT[r]}),(0,Y.jsx)(r$,{$pressed:x.right,children:aT[s]})]})})]}):(0,Y.jsx)(aU,{style:{flexDirection:"left"===e.inputSource.handedness?"row":"row-reverse",alignItems:"flex-start"},children:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(ay,{buttonName:"thumbstick",handedness:e.inputSource.handedness}),(0,Y.jsx)(aF,{style:{margin:"0 5px"},children:(0,Y.jsx)(aB,{ref:l,onMouseDown:()=>{if(l.current){let e=l.current.getBoundingClientRect();_({x:e.left+e.width/2,y:e.top+e.height/2}),h(!0)}},children:(0,Y.jsx)(r1,{icon:av,$size:50})})}),(0,Y.jsxs)("div",{style:{display:"flex",flexDirection:"column",alignItems:"right"===M?"start":"end"},children:[(0,Y.jsx)(rY,{$reverse:"right"===M,style:{background:m?rk:rz,width:`calc(${rX} + ${rq} + 3px)`,marginBottom:"3px",borderRadius:rG},onClick:()=>{g(!0),e.updateButtonValue(i,1),setTimeout(()=>{g(!1),e.updateButtonValue(i,0)},250)},children:"Press"}),(0,Y.jsxs)(rQ,{$reverse:"right"===M,children:[(0,Y.jsx)(az,{title:"Click to toggle touch state",$reverse:"left"!==e.inputSource.handedness,style:{background:u?rk:rz,width:rq},onClick:()=>{d(!u),e.updateButtonTouch(i,!u)},children:(0,Y.jsx)(r1,{icon:ae})}),(0,Y.jsx)(az,{$reverse:"left"!==e.inputSource.handedness,style:{background:p?rk:rz,width:rX},onClick:()=>{f(!p),e.updateButtonValue(i,+!p)},children:"Hold"})]})]})]})})};function aV(e,t){let i=Math.pow(10,t);return Math.round(e*i)/i}let aH=rC.div`
335
+ width: 100%;
336
+ display: flex;
337
+ flex-direction: row;
338
+ justify-content: space-between;
339
+ align-items: center;
340
+ margin: 0;
341
+ font-size: 12px;
342
+ `,aG=({vector:e,label:t="",icon:i,multiplier:n=1,precision:r=2,onValidInput:a=()=>{},marginBottom:s="0"})=>{let[o,l]=(0,i_.useState)({x:(e.x/n).toFixed(r),y:(e.y/n).toFixed(r),z:(e.z/n).toFixed(r)}),c=(0,i_.useRef)({x:aV(e.x/n,r),y:aV(e.y/n,r),z:aV(e.z/n,r)}),h=(0,i_.useRef)(null),u=()=>{let t={x:aV(e.x/n,r),y:aV(e.y/n,r),z:aV(e.z/n,r)},{x:i,y:a,z:s}=c.current;(t.x!==i||t.y!==a||t.z!==s)&&(c.current=t,l({x:t.x.toFixed(r),y:t.y.toFixed(r),z:t.z.toFixed(r)})),h.current=requestAnimationFrame(u)};return(0,i_.useEffect)(()=>(h.current=requestAnimationFrame(u),()=>{h.current&&cancelAnimationFrame(h.current)}),[e,n,r]),(0,Y.jsxs)(aH,{style:{marginBottom:s},children:[i?(0,Y.jsx)(r1,{icon:i,style:{marginRight:"5px"}}):(0,Y.jsx)("span",{style:{marginRight:"5px"},children:t}),(0,Y.jsx)(r6,{children:["x","y","z"].map(i=>(0,Y.jsxs)("div",{style:{position:"relative",display:"inline-block",height:"25px"},children:[(0,Y.jsx)(r8,{value:o[i],onChange:t=>{let r=t.target.value,s=parseFloat(r);l(e=>({...e,[i]:r})),isNaN(s)||(c.current[i]=s,e[i]=s*n,a())},className:parseFloat(o[i])!==c.current[i]?"invalid":void 0}),(0,Y.jsx)(r7,{children:i.toUpperCase()})]},`${t}-${i}`))})]})},aW=({controller:e,handle:t,handedness:i,pointerLocked:n})=>{let{keyMap:r}=aP(),[a,s]=i_.default.useState(e.connected),[o,l]=i_.default.useState(!1),c=function(e){let t=new Set;for(let i of e.axes)i&&i.id&&t.add(i.id);let i=e.buttons.filter(e=>null!==e).map(e=>({id:e.id,type:e.type,hasAxes:t.has(e.id)}));return i.sort((e,t)=>e.hasAxes&&!t.hasAxes?-1:!e.hasAxes&&t.hasAxes?1:0),i}(e.gamepadConfig),h=c.flatMap(e=>e.hasAxes?[`${e.id}-left`,`${e.id}-right`,`${e.id}-up`,`${e.id}-down`,e.id]:e.id);return i_.default.useEffect(()=>{n&&l(!1)},[n]),(0,Y.jsxs)(r3,{style:"left"===i?{left:"8px",bottom:"8px"}:{right:"8px",bottom:"8px"},children:[!n&&(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[(0,Y.jsxs)("div",{style:{fontSize:"13px",display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,Y.jsx)(r1,{icon:at,style:{marginRight:"5px"}}),"Controller ",(0,Y.jsxs)("span",{style:{fontWeight:"bold"},children:["[","left"===i?"L":"R","]"]})]}),(0,Y.jsx)("div",{style:{display:"flex",flexDirection:"row",gap:"1px"},children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r4,{title:`Click to ${o?"close":"change"} key bindings`,onClick:()=>{l(!o)},children:(0,Y.jsx)(r1,{icon:ah})}),(0,Y.jsx)(r4,{title:`Click to disconnect ${i} controller`,$isRed:!0,onClick:()=>{e.connected=!1,s(!1)},children:(0,Y.jsx)(r1,{icon:av})})]}):(0,Y.jsx)(r4,{title:`Click to reconnect ${i} controller`,onClick:()=>{e.connected=!0,s(!0)},style:{marginLeft:"5px"},children:(0,Y.jsx)(r1,{icon:an})})})]})}),a&&!n&&(0,Y.jsxs)(Y.Fragment,{children:[!o&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r5,{}),(0,Y.jsx)(aG,{vector:t.position,label:"Position",marginBottom:"3px"}),(0,Y.jsx)(aG,{vector:t.rotation,label:"Rotation"})]}),(0,Y.jsx)(r5,{})]}),a&&(o?(0,Y.jsx)(aI,{handedness:i,actions:h}):c.map(t=>{let a=r[i];return t.hasAxes?(0,Y.jsx)(ak,{xrController:e,pointerLocked:n,buttonId:t.id,mappedKeyUp:r[i][`${t.id}-up`],mappedKeyDown:a[`${t.id}-down`],mappedKeyLeft:a[`${t.id}-left`],mappedKeyRight:a[`${t.id}-right`],mappedKeyPressed:a[t.id]},t.id):"analog"===t.type?(0,Y.jsx)(aN,{xrController:e,buttonId:t.id,mappedKey:a[t.id],pointerLocked:n},t.id):(0,Y.jsx)(aD,{xrController:e,buttonId:t.id,mappedKey:a[t.id],pointerLocked:n},t.id)}))]},i)},aj=`calc(${rX} + ${rq} + 3px)`,aX=({hand:e,pointerLocked:t,mappedKey:i})=>{let[n,r]=(0,i_.useState)(!1),[a,s]=(0,i_.useState)(!1),[o,l]=(0,i_.useState)(0),c=e.inputSource.handedness;return(0,i_.useEffect)(()=>{let n=t=>{t.code===i&&(e.updatePinchValue(1),s(!0))},r=t=>{t.code===i&&(e.updatePinchValue(0),s(!1))},a=t=>{("MouseLeft"===i&&0===t.button||"MouseRight"===i&&2===t.button)&&(e.updatePinchValue(1),s(!0))},o=t=>{("MouseLeft"===i&&0===t.button||"MouseRight"===i&&2===t.button)&&(e.updatePinchValue(0),s(!1))};return t?"MouseLeft"===i||"MouseRight"===i?(window.addEventListener("mousedown",a),window.addEventListener("mouseup",o)):(window.addEventListener("keydown",n),window.addEventListener("keyup",r)):"MouseLeft"===i||"MouseRight"===i?(window.removeEventListener("mousedown",a),window.removeEventListener("mouseup",o)):(window.removeEventListener("keydown",n),window.removeEventListener("keyup",r)),()=>{"MouseLeft"===i||"MouseRight"===i?(window.removeEventListener("mousedown",a),window.removeEventListener("mouseup",o)):(window.removeEventListener("keydown",n),window.removeEventListener("keyup",r))}},[i,t,e]),(0,Y.jsxs)(rJ,{$reverse:"right"===c,children:[(0,Y.jsx)(r2,{icon:af,$reverse:"left"===c}),(0,Y.jsx)(rQ,{$reverse:"right"===c,children:t?(0,Y.jsx)(r$,{$pressed:a,children:aT[i]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(rY,{$reverse:"right"===c,style:{background:n?rk:rz,width:rX},onClick:()=>{r(!0),e.updatePinchValue(1),setTimeout(()=>{r(!1),e.updatePinchValue(0)},250)},children:"Pinch"}),(0,Y.jsx)(r0,{$reverse:"right"===c,value:o,onChange:t=>{let i=Number(t.target.value);l(i),e.updatePinchValue(i/100)},style:{width:aj},min:"0",max:"100"})]})})]})},aq=["default","point"],aY=`calc(2 * ${rX} - ${rq})`,aK=({hand:e,pointerLocked:t,mappedKey:i})=>{let[n,r]=(0,i_.useState)(e.poseId),[a,s]=(0,i_.useState)(!1),o=e.inputSource.handedness,l=t=>{let i=(aq.indexOf(e.poseId)+aq.length+t)%aq.length;r(aq[i]),e.poseId=aq[i]},c="right"===o;return(0,i_.useEffect)(()=>{let e=e=>{e.code===i&&(l(1),s(!0))},n=e=>{e.code===i&&s(!1)};return t?(window.addEventListener("keydown",e),window.addEventListener("keyup",n)):(window.removeEventListener("keydown",e),window.removeEventListener("keyup",n)),()=>{window.removeEventListener("keydown",e),window.removeEventListener("keyup",n)}},[i,t,e]),(0,Y.jsxs)(rJ,{$reverse:c,children:[(0,Y.jsx)(r2,{icon:al,$reverse:"left"===o}),(0,Y.jsx)(rQ,{$reverse:c,children:t?(0,Y.jsx)(r$,{$pressed:a,children:aT[i]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(rY,{$reverse:c,style:{width:rq},onClick:()=>{l(c?1:-1)},children:(0,Y.jsx)(r1,{icon:c?am:ap})}),(0,Y.jsxs)(rY,{$reverse:c,style:{width:aY},disabled:!0,children:["Pose: ",n]}),(0,Y.jsx)(rY,{$reverse:c,style:{width:rq},onClick:()=>{l(c?-1:1)},children:(0,Y.jsx)(r1,{icon:c?ap:am})})]})})]})},aZ=({hand:e,handle:t,handedness:i,pointerLocked:n})=>{let{keyMap:r}=aP(),[a,s]=i_.default.useState(e.connected),[o,l]=i_.default.useState(!1);return i_.default.useEffect(()=>{n&&l(!1)},[n]),(0,Y.jsxs)(r3,{style:"left"===i?{left:"8px",bottom:"8px"}:{right:"8px",bottom:"8px"},children:[!n&&(0,Y.jsx)(Y.Fragment,{children:(0,Y.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center"},children:[(0,Y.jsxs)("div",{style:{fontSize:"13px",display:"flex",flexDirection:"row",alignItems:"center"},children:[(0,Y.jsx)(r1,{icon:ai,$reverse:"left"===i,style:{marginRight:"5px"}}),"Hand ",(0,Y.jsxs)("span",{style:{fontWeight:"bold"},children:["[","left"===i?"L":"R","]"]})]}),(0,Y.jsx)("div",{style:{display:"flex",flexDirection:"row",gap:"1px"},children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r4,{title:`Click to ${o?"close":"change"} key bindings`,onClick:()=>{l(!o)},children:(0,Y.jsx)(r1,{icon:ah})}),(0,Y.jsx)(r4,{title:`Click to disconnect ${i} controller`,$isRed:!0,onClick:()=>{e.connected=!1,s(!1)},children:(0,Y.jsx)(r1,{icon:av})})]}):(0,Y.jsx)(r4,{title:`Click to reconnect ${i} controller`,onClick:()=>{e.connected=!0,s(!0)},style:{marginLeft:"5px"},children:(0,Y.jsx)(r1,{icon:an})})})]})}),a&&!n&&(0,Y.jsxs)(Y.Fragment,{children:[!o&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r5,{}),(0,Y.jsx)(aG,{vector:t.position,label:"Position",marginBottom:"3px"}),(0,Y.jsx)(aG,{vector:t.rotation,label:"Rotation"})]}),(0,Y.jsx)(r5,{})]}),a&&(o?(0,Y.jsx)(aI,{handedness:i,actions:["pose","pinch"]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(aK,{hand:e,pointerLocked:n,mappedKey:r[i].pose}),(0,Y.jsx)(aX,{hand:e,pointerLocked:n,mappedKey:r[i].pinch})]}))]},i)},a$=aR(e=>({inputMode:"controller",setInputMode:t=>e(()=>({inputMode:t}))})),aJ=({xrDevice:e,inputLayer:t,pointerLocked:i})=>{let{inputMode:n}=a$();return(0,Y.jsx)(Y.Fragment,{children:"controller"===n?Object.entries(e.controllers).map(([e,n])=>(0,Y.jsx)(aW,{controller:n,handle:t.transformHandles.get(e),handedness:e,pointerLocked:i},`controller-${e}`)):Object.entries(e.hands).map(([e,n])=>(0,Y.jsx)(aZ,{hand:n,handle:t.transformHandles.get(e),handedness:e,pointerLocked:i},`hand-${e}`))})},aQ=rC.td`
343
+ text-align: right;
344
+ color: ${rL};
345
+ padding: 0 8px 0 0;
346
+ font-weight: bold;
347
+ `,a0=rC.td`
348
+ text-align: left;
349
+ color: ${rI};
350
+ padding: 0;
351
+ `,a1=["meeting_room","living_room","music_room","office_large","office_small"],a2=aR(e=>({infoPanelOpen:!1,envDropDownOpen:!1,setInfoPanelOpen:t=>e(()=>({infoPanelOpen:t})),setEnvDropDownOpen:t=>e(()=>({envDropDownOpen:t}))})),a3=({xrDevice:e,inputLayer:t})=>{var i,n,r;let[a,s]=i_.default.useState(!!(null==(i=e.sem)?void 0:i.planesVisible)),[o,l]=i_.default.useState(!!(null==(n=e.sem)?void 0:n.boundingBoxesVisible)),[c,h]=i_.default.useState(!!(null==(r=e.sem)?void 0:r.meshesVisible)),{inputMode:u,setInputMode:d}=a$(),{infoPanelOpen:p,setInfoPanelOpen:f,envDropDownOpen:m,setEnvDropDownOpen:g}=a2();return(0,Y.jsxs)("div",{style:{display:"flex",justifyContent:"center",flexDirection:"row",alignItems:"center",gap:"6px",padding:"8px"},children:[(0,Y.jsx)(rK,{children:(0,Y.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:"1px"},children:[(0,Y.jsx)(rZ,{title:"Click to reset device transforms",onClick:()=>{t.resetDeviceTransforms()},children:(0,Y.jsx)(r1,{icon:aa,$size:16})}),(0,Y.jsx)(rZ,{title:"Click to activate play mode",onClick:()=>{t.lockPointer(),g(!1),f(!1)},children:(0,Y.jsx)(r1,{icon:as,$size:16})}),(0,Y.jsx)(rZ,{title:"Click to toggle input mode",onClick:()=>{"controller"===u?(d("hand"),e.primaryInputMode="hand"):(d("controller"),e.primaryInputMode="controller")},children:(0,Y.jsx)(r1,{icon:"controller"===u?at:ai,$size:16})}),e.sem&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(r5,{$horizontal:!1}),(0,Y.jsx)(rZ,{title:"Click to select/change emulated environment",onClick:()=>g(!m),children:(0,Y.jsx)(r1,{icon:ao,$size:16})}),(0,Y.jsx)(rZ,{title:"Click to toggle visibility of planes",onClick:()=>{e.sem.planesVisible=!a,s(!a)},children:(0,Y.jsx)(ab,{size:16,color:a?rL:rI})}),(0,Y.jsx)(rZ,{title:"Click to toggle visibility of bounding boxes",onClick:()=>{e.sem.boundingBoxesVisible=!o,l(!o)},children:(0,Y.jsx)(aM,{size:16,color:o?rL:rI})}),(0,Y.jsx)(rZ,{title:"Click to toggle visibility of meshes",onClick:()=>{e.sem.meshesVisible=!c,h(!c)},children:(0,Y.jsx)(aS,{size:16,color:c?rL:rI})})]}),(0,Y.jsx)(r5,{$horizontal:!1}),(0,Y.jsx)(rZ,{title:"Click to exit XR session",onClick:()=>{let t=e.activeSession;null==t||t.end()},children:(0,Y.jsx)(r1,{icon:r9,$size:16})})]})}),(0,Y.jsx)(rK,{children:(0,Y.jsxs)("div",{style:{display:"flex",flexDirection:"row",gap:"1px"},children:[(0,Y.jsx)(rZ,{title:"About IWER",onClick:()=>{f(!p)},children:(0,Y.jsx)(aE,{size:16})}),(0,Y.jsx)(rZ,{title:"Report issues",onClick:()=>{window.open("https://github.com/meta-quest/immersive-web-emulation-runtime/issues","_blank")},children:(0,Y.jsx)(r1,{icon:au,$size:16})})]})}),p&&(0,Y.jsxs)(r3,{style:{top:"50vh",left:"50vw",transform:"translate(-50%, -50%)",maxWidth:"240px",gap:"4px"},children:[(0,Y.jsx)("div",{style:{display:"flex",justifyContent:"end"},children:(0,Y.jsx)(r4,{$isRed:!0,onClick:()=>{f(!1)},children:(0,Y.jsx)(r1,{icon:av})})}),(0,Y.jsx)("div",{style:{display:"flex",justifyContent:"center"},children:(0,Y.jsx)(aE,{size:100})}),(0,Y.jsxs)("p",{style:{textAlign:"center",padding:"0 5px",margin:"0"},children:[(0,Y.jsx)("b",{children:"Immersive Web Emulation Runtime"})," (IWER) is a free, open-source WebXR developer tool created by Meta Platforms, Inc."]}),(0,Y.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",display:"flex",justifyContent:"center",fontSize:"12px",padding:"8px"},children:(0,Y.jsxs)("tbody",{children:[(0,Y.jsxs)("tr",{children:[(0,Y.jsx)(aQ,{children:"IWER"}),(0,Y.jsxs)(a0,{children:["v",e.version]})]}),(0,Y.jsxs)("tr",{children:[(0,Y.jsx)(aQ,{children:"DevUI"}),(0,Y.jsxs)(a0,{children:["v",e.devui.version]})]}),e.sem&&(0,Y.jsxs)("tr",{children:[(0,Y.jsx)(aQ,{children:"SEM"}),(0,Y.jsxs)(a0,{children:["v",e.sem.version]})]})]})}),(0,Y.jsx)(rY,{style:{borderRadius:rG},onClick:()=>{window.open("https://github.com/meta-quest/immersive-web-emulation-runtime/blob/main/LICENSE","_blank")},children:"MIT License"}),(0,Y.jsx)(rY,{style:{borderRadius:rG},onClick:()=>{window.open("https://github.com/meta-quest/immersive-web-emulation-runtime","_blank")},children:"View Source on GitHub"})]}),m&&(0,Y.jsx)(r3,{style:{position:"absolute",top:"40px"},children:a1.map(t=>(0,Y.jsx)("div",{children:(0,Y.jsx)(rZ,{style:{fontSize:"12px",width:"100%",justifyContent:"start",borderRadius:"8px"},onClick:()=>{e.sem.loadDefaultEnvironment(t)},children:t.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")})},t))})]})},a5=rC.div`
352
+ width: 100%;
353
+ display: flex;
354
+ flex-direction: row;
355
+ justify-content: space-between;
356
+ align-items: center;
357
+ margin-top: ${"3px"};
358
+ font-size: 12px;
359
+ `,a4=rC.input.attrs({type:"range"})`
360
+ -webkit-appearance: none;
361
+ appearance: none;
362
+ background: ${rB};
363
+ border: 1px solid transparent;
364
+ height: 25px;
365
+ color: ${rL};
366
+ width: ${rX};
367
+ cursor: pointer;
368
+ margin: 0;
369
+ border-radius: 5px;
370
+ padding: 0 10px 0 5px;
371
+ box-sizing: border-box;
372
+ font-size: 10px;
373
+
374
+ &::-webkit-slider-thumb {
375
+ -webkit-appearance: none;
376
+ appearance: none;
377
+ width: 8px;
378
+ height: 25px;
379
+ background-color: ${rL};
380
+ border-radius: ${"3px"};
381
+ }
382
+
383
+ &::-moz-range-thumb {
384
+ width: 8px;
385
+ height: 25px;
386
+ background-color: ${rL};
387
+ border-radius: ${"3px"};
388
+ }
389
+
390
+ &::-ms-thumb {
391
+ width: 8px;
392
+ height: 25px;
393
+ background-color: ${rL};
394
+ border-radius: ${"3px"};
395
+ }
396
+ `,a6=({xrDevice:e,inputLayer:t,pointerLocked:i})=>{let[n,r]=i_.default.useState(e.fovy);return(0,Y.jsxs)(r3,{style:{left:"8px",top:"8px"},children:[(0,Y.jsxs)("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",height:"20px"},children:[(0,Y.jsxs)("div",{style:{fontSize:"13px",display:"flex",flexDirection:"row",alignItems:"center",justifyItems:"start"},children:[(0,Y.jsx)(r1,{icon:ag,style:{marginRight:"5px"}}),(0,Y.jsx)("div",{style:{alignItems:"end"},children:e.name})]}),(0,Y.jsx)("div",{style:{display:"flex",flexDirection:"row",gap:"1px"}})]}),(0,Y.jsx)(r5,{}),(0,Y.jsx)(aG,{vector:t.combinedCameraPosition,icon:ac}),!i&&(0,Y.jsxs)(a5,{children:[(0,Y.jsx)(r1,{icon:a_,style:{marginRight:"5px"}}),(0,Y.jsxs)(r6,{children:[(0,Y.jsxs)("div",{style:{position:"relative",display:"inline-block",height:"25px"},children:[(0,Y.jsx)(r8,{type:"text",value:(n/Math.PI*180).toFixed(0)+"°",readOnly:!0,style:{width:"73px"}}),(0,Y.jsx)(r7,{children:"FOV-Y"})]}),(0,Y.jsx)("div",{style:{position:"relative",display:"inline-block"},children:(0,Y.jsx)(a4,{value:n,onChange:t=>{let i=Number(t.target.value);r(i),e.fovy=i},min:Math.PI/6,max:Math.PI/1.5,step:Math.PI/48,style:{width:"80px"}})})]})]})]})},a8="srgb",a7="srgb-linear",a9="display-p3",se="display-p3-linear",st="linear",si="srgb",sn="rec709",sr="300 es";class sa{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let i=t.slice(0);for(let t=0,n=i.length;t<n;t++)i[t].call(this,e);e.target=null}}}let ss=["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"],so=Math.PI/180,sl=180/Math.PI;function sc(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0;return(ss[255&e]+ss[e>>8&255]+ss[e>>16&255]+ss[e>>24&255]+"-"+ss[255&t]+ss[t>>8&255]+"-"+ss[t>>16&15|64]+ss[t>>24&255]+"-"+ss[63&i|128]+ss[i>>8&255]+"-"+ss[i>>16&255]+ss[i>>24&255]+ss[255&n]+ss[n>>8&255]+ss[n>>16&255]+ss[n>>24&255]).toLowerCase()}function sh(e,t,i){return Math.max(t,Math.min(i,e))}function su(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function sd(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}class sp{constructor(e=0,t=0){sp.prototype.isVector2=!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 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 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){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(sh(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*n+e.x,this.y=r*n+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class sf{constructor(e,t,i,n,r,a,s,o,l){sf.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l)}set(e,t,i,n,r,a,s,o,l){let c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=r,c[5]=o,c[6]=i,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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){let 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){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],c=i[4],h=i[7],u=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],_=n[4],x=n[7],y=n[2],M=n[5],S=n[8];return r[0]=a*f+s*v+o*y,r[3]=a*m+s*_+o*M,r[6]=a*g+s*x+o*S,r[1]=l*f+c*v+h*y,r[4]=l*m+c*_+h*M,r[7]=l*g+c*x+h*S,r[2]=u*f+d*v+p*y,r[5]=u*m+d*_+p*M,r[8]=u*g+d*x+p*S,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*a*c-t*s*l-i*r*c+i*s*o+n*r*l-n*a*o}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=c*a-s*l,u=s*o-c*r,d=l*r-a*o,p=t*h+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=h*f,e[1]=(n*l-c*i)*f,e[2]=(s*i-n*a)*f,e[3]=u*f,e[4]=(c*t-n*o)*f,e[5]=(n*r-s*t)*f,e[6]=d*f,e[7]=(i*o-l*t)*f,e[8]=(a*t-i*r)*f,this}transpose(){let e,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){let 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,n,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-n*l,n*o,-n*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(sm.makeScale(e,t)),this}rotate(e){return this.premultiply(sm.makeRotation(-e)),this}translate(e,t){return this.premultiply(sm.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){let 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){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])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){let 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)}}let sm=new sf;function sg(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function sv(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let s_={};function sx(e){e in s_||(s_[e]=!0,console.warn(e))}let sy=new sf().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),sM=new sf().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),sS={[a7]:{transfer:st,primaries:sn,toReference:e=>e,fromReference:e=>e},[a8]:{transfer:si,primaries:sn,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[se]:{transfer:st,primaries:"p3",toReference:e=>e.applyMatrix3(sM),fromReference:e=>e.applyMatrix3(sy)},[a9]:{transfer:si,primaries:"p3",toReference:e=>e.convertSRGBToLinear().applyMatrix3(sM),fromReference:e=>e.applyMatrix3(sy).convertLinearToSRGB()}},sb=new Set([a7,se]),sE={enabled:!0,_workingColorSpace:a7,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(colorSpace){if(!sb.has(colorSpace))throw Error(`Unsupported working color space, "${colorSpace}".`);this._workingColorSpace=colorSpace},convert:function(e,t,i){if(!1===this.enabled||t===i||!t||!i)return e;let n=sS[t].toReference;return(0,sS[i].fromReference)(n(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return sS[e].primaries},getTransfer:function(e){return""===e?st:sS[e].transfer}};function sT(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function sw(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class sA{static getDataURL(e){let i;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)i=e;else{void 0===t&&(t=sv("canvas")),t.width=e.width,t.height=e.height;let n=t.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),i=t}return i.width>2048||i.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),i.toDataURL("image/jpeg",.6)):i.toDataURL("image/png")}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=sv("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),r=n.data;for(let e=0;e<r.length;e++)r[e]=255*sT(r[e]/255);return i.putImageData(n,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*sT(t[e]/255)):t[e]=sT(t[e]);return{data:t,width:e.width,height:e.height}}}}let sR=0;class sC{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:sR++}),this.uuid=sc(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(sP(n[t].image)):e.push(sP(n[t]))}else e=sP(n);i.url=e}return t||(e.images[this.uuid]=i),i}}function sP(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?sA.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let sL=0;class sI extends sa{constructor(e=sI.DEFAULT_IMAGE,t=sI.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,s=1023,o=1009,l=sI.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:sL++}),this.uuid=sc(),this.name="",this.source=new sC(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new sp(0,0),this.repeat=new sp(1,1),this.center=new sp(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new sf,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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)}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.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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.6,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,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(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}sI.DEFAULT_IMAGE=null,sI.DEFAULT_MAPPING=300,sI.DEFAULT_ANISOTROPY=1;class sN{constructor(e=0,t=0,i=0,n=1){sN.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}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,n){return this.x=e,this.y=t,this.z=i,this.w=n,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 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 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=void 0!==e.w?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){let t=this.x,i=this.y,n=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let 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,n,r,a=e.elements,s=a[0],o=a[4],l=a[8],c=a[1],h=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-c)&&.01>Math.abs(l-d)&&.01>Math.abs(u-p)){if(.1>Math.abs(o+c)&&.1>Math.abs(l+d)&&.1>Math.abs(u+p)&&.1>Math.abs(s+h+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(h+1)/2,m=(f+1)/2,g=(o+c)/4,v=(l+d)/4,_=(u+p)/4;return e>a&&e>m?e<.01?(i=0,n=.707106781,r=.707106781):(n=g/(i=Math.sqrt(e)),r=v/i):a>m?a<.01?(i=.707106781,n=0,r=.707106781):(i=g/(n=Math.sqrt(a)),r=_/n):m<.01?(i=.707106781,n=.707106781,r=0):(i=v/(r=Math.sqrt(m)),n=_/r),this.set(i,n,r,t),this}let m=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(c-o)*(c-o));return .001>Math.abs(m)&&(m=1),this.x=(p-u)/m,this.y=(l-d)/m,this.z=(c-o)/m,this.w=Math.acos((s+h+f-1)/2),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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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}}class sD extends sa{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new sN(0,0,e,t),this.scissorTest=!1,this.viewport=new sN(0,0,e,t);const n=new sI({width:e,height:t,depth:1},(i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i)).mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);n.flipY=!1,n.generateMipmaps=i.generateMipmaps,n.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let e=0;e<r;e++)this.textures[e]=n.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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 n=0,r=this.textures.length;n<r;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i;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;let t=Object.assign({},e.texture.image);return this.texture.source=new sC(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class sU extends sD{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class sO extends sI{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class sF{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,r,a,s){let o=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3],u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h;return}if(1===s){e[t+0]=u,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(h!==f||o!==u||l!==d||c!==p){let e=1-s,t=o*u+l*d+c*p+h*f,i=t>=0?1:-1,n=1-t*t;if(n>Number.EPSILON){let r=Math.sqrt(n),a=Math.atan2(r,t*i);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}let r=s*i;if(o=o*e+u*r,l=l*e+d*r,c=c*e+p*r,h=h*e+f*r,e===1-s){let e=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=e,l*=e,c*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,n,r,a){let s=i[n],o=i[n+1],l=i[n+2],c=i[n+3],h=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+c*h+o*d-l*u,e[t+1]=o*p+c*u+l*h-s*d,e[t+2]=l*p+c*d+s*u-o*h,e[t+3]=c*p-s*h-o*u-l*d,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,n){return this._x=e,this._y=t,this._z=i,this._w=n,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){let i=e._x,n=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),c=s(n/2),h=s(r/2),u=o(i/2),d=o(n/2),p=o(r/2);switch(a){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],c=t[6],h=t[10],u=i+s+h;if(u>0){let e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(a-n)*e}else if(i>s&&i>h){let e=2*Math.sqrt(1+i-s-h);this._w=(c-o)/e,this._x=.25*e,this._y=(n+a)/e,this._z=(r+l)/e}else if(s>h){let e=2*Math.sqrt(1+s-i-h);this._w=(r-l)/e,this._x=(n+a)/e,this._y=.25*e,this._z=(o+c)/e}else{let e=2*Math.sqrt(1+h-i-s);this._w=(a-n)/e,this._x=(r+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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(sh(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let n=Math.min(1,t/i);return this.slerp(e,n),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 0===e?(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){let i=e._x,n=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=i*c+a*s+n*l-r*o,this._y=n*c+a*o+r*s-i*l,this._z=r*c+a*l+i*o-n*s,this._w=a*c-i*s-n*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,n=this._y,r=this._z,a=this._w,s=a*e._w+i*e._x+n*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*i+t*this._x,this._y=e*n+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}let l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=a*h+this._w*u,this._x=i*h+this._x*u,this._y=n*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),r*Math.sin(t),r*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}}class sB{constructor(e=0,t=0,i=0){sB.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(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 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 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(sk.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(sk.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*n-s*i),c=2*(s*t-r*n),h=2*(r*i-a*t);return this.x=t+o*l+a*h-s*c,this.y=i+o*c+s*l-r*h,this.z=n+o*h+r*c-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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){let i=e.x,n=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=n*o-r*s,this.y=r*a-i*o,this.z=i*s-n*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return sz.copy(this).projectOnVector(e),this.sub(sz)}reflect(e){return this.sub(sz.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(sh(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}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){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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(){let e=Math.random()*Math.PI*2,t=2*Math.random()-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}}let sz=new sB,sk=new sF;class sV{constructor(e=new sB(Infinity,Infinity,Infinity),t=new sB(-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(sG.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(sG.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){let i=sG.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=Infinity,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);let i=e.geometry;if(void 0!==i){let n=i.getAttribute("position");if(!0===t&&void 0!==n&&!0!==e.isInstancedMesh)for(let t=0,i=n.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,sG):sG.fromBufferAttribute(n,t),sG.applyMatrix4(e.matrixWorld),this.expandByPoint(sG);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),sW.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),sW.copy(i.boundingBox)),sW.applyMatrix4(e.matrixWorld),this.union(sW)}let n=e.children;for(let e=0,i=n.length;e<i;e++)this.expandByObject(n[e],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,sG),sG.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(s$),sJ.subVectors(this.max,s$),sj.subVectors(e.a,s$),sX.subVectors(e.b,s$),sq.subVectors(e.c,s$),sY.subVectors(sX,sj),sK.subVectors(sq,sX),sZ.subVectors(sj,sq);let t=[0,-sY.z,sY.y,0,-sK.z,sK.y,0,-sZ.z,sZ.y,sY.z,0,-sY.x,sK.z,0,-sK.x,sZ.z,0,-sZ.x,-sY.y,sY.x,0,-sK.y,sK.x,0,-sZ.y,sZ.x,0];return!!s1(t,sj,sX,sq,sJ)&&!!s1(t=[1,0,0,0,1,0,0,0,1],sj,sX,sq,sJ)&&(sQ.crossVectors(sY,sK),s1(t=[sQ.x,sQ.y,sQ.z],sj,sX,sq,sJ))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sG).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(sG).length()),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()||(sH[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),sH[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),sH[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),sH[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),sH[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),sH[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),sH[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),sH[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(sH)),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)}}let sH=[new sB,new sB,new sB,new sB,new sB,new sB,new sB,new sB],sG=new sB,sW=new sV,sj=new sB,sX=new sB,sq=new sB,sY=new sB,sK=new sB,sZ=new sB,s$=new sB,sJ=new sB,sQ=new sB,s0=new sB;function s1(e,t,i,n,r){for(let a=0,s=e.length-3;a<=s;a+=3){s0.fromArray(e,a);let s=r.x*Math.abs(s0.x)+r.y*Math.abs(s0.y)+r.z*Math.abs(s0.z),o=t.dot(s0),l=i.dot(s0),c=n.dot(s0);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}let s2=new sV,s3=new sB,s5=new sB;class s4{constructor(e=new sB,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){let i=this.center;void 0!==t?i.copy(t):s2.setFromPoints(e).getCenter(i);let n=0;for(let t=0,r=e.length;t<r;t++)n=Math.max(n,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(n),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){let 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){let 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.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;s3.subVectors(e,this.center);let t=s3.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(s3,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(s5.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(s3.copy(e.center).add(s5)),this.expandByPoint(s3.copy(e.center).sub(s5)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let s6=new sB,s8=new sB,s7=new sB,s9=new sB,oe=new sB,ot=new sB,oi=new sB;class on{constructor(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m){on.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m)}set(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 on().fromArray(this.elements)}copy(e){let 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){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let 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 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){let t=this.elements,i=e.elements,n=1/or.setFromMatrixColumn(e,0).length(),r=1/or.setFromMatrixColumn(e,1).length(),a=1/or.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,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){let t=this.elements,i=e.x,n=e.y,r=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){let e=a*c,i=a*h,n=s*c,r=s*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=i+n*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=n+i*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*c,i=o*h,n=l*c,r=l*h;t[0]=e+r*s,t[4]=n*s-i,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-s,t[2]=i*s-n,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*c,i=o*h,n=l*c,r=l*h;t[0]=e-r*s,t[4]=-a*h,t[8]=n+i*s,t[1]=i+n*s,t[5]=a*c,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*c,i=a*h,n=s*c,r=s*h;t[0]=o*c,t[4]=n*l-i,t[8]=e*l+r,t[1]=o*h,t[5]=r*l+e,t[9]=i*l-n,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*c,t[4]=r-e*h,t[8]=n*h+i,t[1]=h,t[5]=a*c,t[9]=-s*c,t[2]=-l*c,t[6]=i*h+n,t[10]=e-r*h}else if("XZY"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=i*h-n,t[2]=n*h-i,t[6]=s*c,t[10]=r*h+e}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(os,e,oo)}lookAt(e,t,i){let n=this.elements;return oh.subVectors(e,t),0===oh.lengthSq()&&(oh.z=1),oh.normalize(),ol.crossVectors(i,oh),0===ol.lengthSq()&&(1===Math.abs(i.z)?oh.x+=1e-4:oh.z+=1e-4,oh.normalize(),ol.crossVectors(i,oh)),ol.normalize(),oc.crossVectors(oh,ol),n[0]=ol.x,n[4]=oc.x,n[8]=oh.x,n[1]=ol.y,n[5]=oc.y,n[9]=oh.y,n[2]=ol.z,n[6]=oc.z,n[10]=oh.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],c=i[1],h=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],_=i[7],x=i[11],y=i[15],M=n[0],S=n[4],b=n[8],E=n[12],T=n[1],w=n[5],A=n[9],R=n[13],C=n[2],P=n[6],L=n[10],I=n[14],N=n[3],D=n[7],U=n[11],O=n[15];return r[0]=a*M+s*T+o*C+l*N,r[4]=a*S+s*w+o*P+l*D,r[8]=a*b+s*A+o*L+l*U,r[12]=a*E+s*R+o*I+l*O,r[1]=c*M+h*T+u*C+d*N,r[5]=c*S+h*w+u*P+d*D,r[9]=c*b+h*A+u*L+d*U,r[13]=c*E+h*R+u*I+d*O,r[2]=p*M+f*T+m*C+g*N,r[6]=p*S+f*w+m*P+g*D,r[10]=p*b+f*A+m*L+g*U,r[14]=p*E+f*R+m*I+g*O,r[3]=v*M+_*T+x*C+y*N,r[7]=v*S+_*w+x*P+y*D,r[11]=v*b+_*A+x*L+y*U,r[15]=v*E+_*R+x*I+y*O,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(r*o*h-n*l*h-r*s*u+i*l*u+n*s*d-i*o*d)+e[7]*(t*o*d-t*l*u+r*a*u-n*a*d+n*l*c-r*o*c)+e[11]*(t*l*h-t*s*d-r*a*h+i*a*d+r*s*c-i*l*c)+e[15]*(-n*s*c-t*o*h+t*s*u+n*a*h-i*a*u+i*o*c)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=h*m*l-f*u*l+f*o*d-s*m*d-h*o*g+s*u*g,_=p*u*l-c*m*l-p*o*d+a*m*d+c*o*g-a*u*g,x=c*f*l-p*h*l+p*s*d-a*f*d-c*s*g+a*h*g,y=p*h*o-c*f*o-p*s*u+a*f*u+c*s*m-a*h*m,M=t*v+i*_+n*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/M;return e[0]=v*S,e[1]=(f*u*r-h*m*r-f*n*d+i*m*d+h*n*g-i*u*g)*S,e[2]=(s*m*r-f*o*r+f*n*l-i*m*l-s*n*g+i*o*g)*S,e[3]=(h*o*r-s*u*r-h*n*l+i*u*l+s*n*d-i*o*d)*S,e[4]=_*S,e[5]=(c*m*r-p*u*r+p*n*d-t*m*d-c*n*g+t*u*g)*S,e[6]=(p*o*r-a*m*r-p*n*l+t*m*l+a*n*g-t*o*g)*S,e[7]=(a*u*r-c*o*r+c*n*l-t*u*l-a*n*d+t*o*d)*S,e[8]=x*S,e[9]=(p*h*r-c*f*r-p*i*d+t*f*d+c*i*g-t*h*g)*S,e[10]=(a*f*r-p*s*r+p*i*l-t*f*l-a*i*g+t*s*g)*S,e[11]=(c*s*r-a*h*r-c*i*l+t*h*l+a*i*d-t*s*d)*S,e[12]=y*S,e[13]=(c*f*n-p*h*n+p*i*u-t*f*u-c*i*m+t*h*m)*S,e[14]=(p*s*n-a*f*n-p*i*o+t*f*o+a*i*m-t*s*m)*S,e[15]=(a*h*n-c*s*n+c*i*o-t*h*o-a*i*u+t*s*u)*S,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}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){let 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){let 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){let 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){let i=Math.cos(t),n=Math.sin(t),r=1-i,a=e.x,s=e.y,o=e.z,l=r*a,c=r*s;return this.set(l*a+i,l*s-n*o,l*o+n*s,0,l*s+n*o,c*s+i,c*o-n*a,0,l*o-n*s,c*o+n*a,r*o*o+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,n,r,a){return this.set(1,i,r,0,e,1,a,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,c=a+a,h=s+s,u=r*l,d=r*c,p=r*h,f=a*c,m=a*h,g=s*h,v=o*l,_=o*c,x=o*h,y=i.x,M=i.y,S=i.z;return n[0]=(1-(f+g))*y,n[1]=(d+x)*y,n[2]=(p-_)*y,n[3]=0,n[4]=(d-x)*M,n[5]=(1-(u+g))*M,n[6]=(m+v)*M,n[7]=0,n[8]=(p+_)*S,n[9]=(m-v)*S,n[10]=(1-(u+f))*S,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,r=or.set(n[0],n[1],n[2]).length(),a=or.set(n[4],n[5],n[6]).length(),s=or.set(n[8],n[9],n[10]).length();0>this.determinant()&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],oa.copy(this);let o=1/r,l=1/a,c=1/s;return oa.elements[0]*=o,oa.elements[1]*=o,oa.elements[2]*=o,oa.elements[4]*=l,oa.elements[5]*=l,oa.elements[6]*=l,oa.elements[8]*=c,oa.elements[9]*=c,oa.elements[10]*=c,t.setFromRotationMatrix(oa),i.x=r,i.y=a,i.z=s,this}makePerspective(e,t,i,n,r,a,s=2e3){let o,l,c=this.elements;if(2e3===s)o=-(a+r)/(a-r),l=-2*a*r/(a-r);else if(2001===s)o=-a/(a-r),l=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*r/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*r/(i-n),c[9]=(i+n)/(i-n),c[13]=0,c[2]=0,c[6]=0,c[10]=o,c[14]=l,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,n,r,a,s=2e3){let o,l,c=this.elements,h=1/(t-e),u=1/(i-n),d=1/(a-r);if(2e3===s)o=(a+r)*d,l=-2*d;else if(2001===s)o=r*d,l=-1*d;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2*h,c[4]=0,c[8]=0,c[12]=-((t+e)*h),c[1]=0,c[5]=2*u,c[9]=0,c[13]=-((i+n)*u),c[2]=0,c[6]=0,c[10]=l,c[14]=-o,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])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){let 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}}let or=new sB,oa=new on,os=new sB(0,0,0),oo=new sB(1,1,1),ol=new sB,oc=new sB,oh=new sB,ou=new on,od=new sF;class op{constructor(e=0,t=0,i=0,n=op.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}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,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,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){let n=e.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],c=n[9],h=n[2],u=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(sh(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-sh(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(sh(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-sh(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(sh(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-sh(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return ou.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ou,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return od.setFromEuler(this),this.setFromQuaternion(od,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],void 0!==e[3]&&(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}}op.DEFAULT_ORDER="XYZ";class of{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let om=0,og=new sB,ov=new sF,o_=new on,ox=new sB,oy=new sB,oM=new sB,oS=new sF,ob=new sB(1,0,0),oE=new sB(0,1,0),oT=new sB(0,0,1),ow={type:"added"},oA={type:"removed"},oR={type:"childadded",child:null},oC={type:"childremoved",child:null};class oP extends sa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:om++}),this.uuid=sc(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=oP.DEFAULT_UP.clone();const e=new sB,t=new op,i=new sF,n=new sB(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),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:n},modelViewMatrix:{value:new on},normalMatrix:{value:new sf}}),this.matrix=new on,this.matrixWorld=new on,this.matrixAutoUpdate=oP.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=oP.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new of,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 ov.setFromAxisAngle(e,t),this.quaternion.multiply(ov),this}rotateOnWorldAxis(e,t){return ov.setFromAxisAngle(e,t),this.quaternion.premultiply(ov),this}rotateX(e){return this.rotateOnAxis(ob,e)}rotateY(e){return this.rotateOnAxis(oE,e)}rotateZ(e){return this.rotateOnAxis(oT,e)}translateOnAxis(e,t){return og.copy(e).applyQuaternion(this.quaternion),this.position.add(og.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ob,e)}translateY(e){return this.translateOnAxis(oE,e)}translateZ(e){return this.translateOnAxis(oT,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(o_.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?ox.copy(e):ox.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),oy.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?o_.lookAt(oy,ox,this.up):o_.lookAt(ox,oy,this.up),this.quaternion.setFromRotationMatrix(o_),n&&(o_.extractRotation(n.matrixWorld),ov.setFromRotationMatrix(o_),this.quaternion.premultiply(ov.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(ow),oR.child=e,this.dispatchEvent(oR),oR.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(oA),oC.child=e,this.dispatchEvent(oC),oC.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),o_.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),o_.multiply(e.parent.matrixWorld)),e.applyMatrix4(o_),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(ow),oR.child=e,this.dispatchEvent(oR),oR.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,n=this.children.length;i<n;i++){let n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].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(oy,e,oM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(oy,oS,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,n=t.length;i<n;i++){let n=t[i];(!0===n.matrixWorldAutoUpdate||!0===e)&&n.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++){let i=e[t];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let n={};function r(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),n.maxGeometryCount=this._maxGeometryCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,n=i.length;t<n;t++){let n=i[t];r(e.shapes,n)}else r(e.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let i=0,n=this.material.length;i<n;i++)t.push(r(e.materials,this.material[i]));n.material=t}else n.material=r(e.materials,this.material);if(this.children.length>0){n.children=[];for(let t=0;t<this.children.length;t++)n.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];n.animations.push(r(e.animations,i))}}if(t){let t=a(e.geometries),n=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),c=a(e.animations),h=a(e.nodes);t.length>0&&(i.geometries=t),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),h.length>0&&(i.nodes=h)}return i.object=n,i;function a(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}}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.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}}oP.DEFAULT_UP=new sB(0,1,0),oP.DEFAULT_MATRIX_AUTO_UPDATE=!0,oP.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let oL=new sB,oI=new sB,oN=new sB,oD=new sB,oU=new sB,oO=new sB,oF=new sB,oB=new sB,oz=new sB,ok=new sB;class oV{constructor(e=new sB,t=new sB,i=new sB){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),oL.subVectors(e,t),n.cross(oL);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){oL.subVectors(n,t),oI.subVectors(i,t),oN.subVectors(e,t);let a=oL.dot(oL),s=oL.dot(oI),o=oL.dot(oN),l=oI.dot(oI),c=oI.dot(oN),h=a*l-s*s;if(0===h)return r.set(0,0,0),null;let u=1/h,d=(l*o-s*c)*u,p=(a*c-s*o)*u;return r.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return null!==this.getBarycoord(e,t,i,n,oD)&&oD.x>=0&&oD.y>=0&&oD.x+oD.y<=1}static getInterpolation(e,t,i,n,r,a,s,o){return null===this.getBarycoord(e,t,i,n,oD)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,oD.x),o.addScaledVector(a,oD.y),o.addScaledVector(s,oD.z),o)}static isFrontFacing(e,t,i,n){return oL.subVectors(i,t),oI.subVectors(e,t),0>oL.cross(oI).dot(n)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),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 oL.subVectors(this.c,this.b),oI.subVectors(this.a,this.b),.5*oL.cross(oI).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return oV.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return oV.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,r){return oV.getInterpolation(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return oV.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return oV.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,n,r=this.a,a=this.b,s=this.c;oU.subVectors(a,r),oO.subVectors(s,r),oB.subVectors(e,r);let o=oU.dot(oB),l=oO.dot(oB);if(o<=0&&l<=0)return t.copy(r);oz.subVectors(e,a);let c=oU.dot(oz),h=oO.dot(oz);if(c>=0&&h<=c)return t.copy(a);let u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return i=o/(o-c),t.copy(r).addScaledVector(oU,i);ok.subVectors(e,s);let d=oU.dot(ok),p=oO.dot(ok);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(r).addScaledVector(oO,n);let m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return oF.subVectors(s,a),n=(h-c)/(h-c+(d-p)),t.copy(a).addScaledVector(oF,n);let g=1/(m+f+u);return i=f*g,n=u*g,t.copy(r).addScaledVector(oU,i).addScaledVector(oO,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let oH={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},oG={h:0,s:0,l:0},oW={h:0,s:0,l:0};function oj(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}class oX{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){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=a8){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,sE.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=sE.workingColorSpace){return this.r=e,this.g=t,this.b=i,sE.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=sE.workingColorSpace){if(e=(e%1+1)%1,t=sh(t,0,1),i=sh(i,0,1),0===t)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=oj(r,n,e+1/3),this.g=oj(r,n,e),this.b=oj(r,n,e-1/3)}return sE.toWorkingColorSpace(this,n),this}setStyle(e,t=a8){let i;function n(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=a8){let i=oH[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.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=sT(e.r),this.g=sT(e.g),this.b=sT(e.b),this}copyLinearToSRGB(e){return this.r=sw(e.r),this.g=sw(e.g),this.b=sw(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=a8){return sE.fromWorkingColorSpace(oq.copy(this),e),65536*Math.round(sh(255*oq.r,0,255))+256*Math.round(sh(255*oq.g,0,255))+Math.round(sh(255*oq.b,0,255))}getHexString(e=a8){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=sE.workingColorSpace){let i,n;sE.fromWorkingColorSpace(oq.copy(this),t);let r=oq.r,a=oq.g,s=oq.b,o=Math.max(r,a,s),l=Math.min(r,a,s),c=(l+o)/2;if(l===o)i=0,n=0;else{let e=o-l;switch(n=c<=.5?e/(o+l):e/(2-o-l),o){case r:i=(a-s)/e+6*(a<s);break;case a:i=(s-r)/e+2;break;case s:i=(r-a)/e+4}i/=6}return e.h=i,e.s=n,e.l=c,e}getRGB(e,t=sE.workingColorSpace){return sE.fromWorkingColorSpace(oq.copy(this),t),e.r=oq.r,e.g=oq.g,e.b=oq.b,e}getStyle(e=a8){sE.fromWorkingColorSpace(oq.copy(this),e);let t=oq.r,i=oq.g,n=oq.b;return e!==a8?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(e,t,i){return this.getHSL(oG),this.setHSL(oG.h+e,oG.s+t,oG.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){var i,n,r;this.getHSL(oG),e.getHSL(oW);let a=(i=oG.h,(1-t)*i+t*oW.h),s=(n=oG.s,(1-t)*n+t*oW.s),o=(r=oG.l,(1-t)*r+t*oW.l);return this.setHSL(a,s,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,r=e.elements;return this.r=r[0]*t+r[3]*i+r[6]*n,this.g=r[1]*t+r[4]*i+r[7]*n,this.b=r[2]*t+r[5]*i+r[8]*n,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}}let oq=new oX;oX.NAMES=oH;let oY=0;class oK extends sa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:oY++}),this.uuid=sc(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new oX(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(void 0===n){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(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()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(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),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(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,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=n(e.textures),r=n(e.images);t.length>0&&(i.textures=t),r.length>0&&(i.images=r)}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;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let n=0;n!==e;++n)i[n]=t[n].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.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class oZ extends oK{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new oX(0xffffff),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 op,this.combine=0,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}}let o$=new sB,oJ=new sp;class oQ{constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return sx("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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 n=0,r=this.itemSize;n<r;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)oJ.fromBufferAttribute(this,t),oJ.applyMatrix3(e),this.setXY(t,oJ.x,oJ.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)o$.fromBufferAttribute(this,t),o$.applyMatrix3(e),this.setXYZ(t,o$.x,o$.y,o$.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)o$.fromBufferAttribute(this,t),o$.applyMatrix4(e),this.setXYZ(t,o$.x,o$.y,o$.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)o$.fromBufferAttribute(this,t),o$.applyNormalMatrix(e),this.setXYZ(t,o$.x,o$.y,o$.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)o$.fromBufferAttribute(this,t),o$.transformDirection(e),this.setXYZ(t,o$.x,o$.y,o$.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=su(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=sd(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=su(t,this.array)),t}setX(e,t){return this.normalized&&(t=sd(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=su(t,this.array)),t}setY(e,t){return this.normalized&&(t=sd(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=su(t,this.array)),t}setZ(e,t){return this.normalized&&(t=sd(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=su(t,this.array)),t}setW(e,t){return this.normalized&&(t=sd(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=sd(t,this.array),i=sd(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=sd(t,this.array),i=sd(i,this.array),n=sd(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,r){return e*=this.itemSize,this.normalized&&(t=sd(t,this.array),i=sd(i,this.array),n=sd(n,this.array),r=sd(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class o0 extends oQ{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class o1 extends oQ{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class o2 extends oQ{constructor(e,t,i){super(new Float32Array(e),t,i)}}let o3=0,o5=new on,o4=new oP,o6=new sB,o8=new sV,o7=new sV,o9=new sB;class le extends sa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:o3++}),this.uuid=sc(),this.name="",this.type="BufferGeometry",this.index=null,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(sg(e)?o1:o0)(e,1):this.index=e,this}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 void 0!==this.attributes[e]}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){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new sf().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return o5.makeRotationFromQuaternion(e),this.applyMatrix4(o5),this}rotateX(e){return o5.makeRotationX(e),this.applyMatrix4(o5),this}rotateY(e){return o5.makeRotationY(e),this.applyMatrix4(o5),this}rotateZ(e){return o5.makeRotationZ(e),this.applyMatrix4(o5),this}translate(e,t,i){return o5.makeTranslation(e,t,i),this.applyMatrix4(o5),this}scale(e,t,i){return o5.makeScale(e,t,i),this.applyMatrix4(o5),this}lookAt(e){return o4.lookAt(e),o4.updateMatrix(),this.applyMatrix4(o4.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(o6).negate(),this.translate(o6.x,o6.y,o6.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let n=e[i];t.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new o2(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new sV);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new sB(-1/0,-1/0,-1/0),new sB(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];o8.setFromBufferAttribute(i),this.morphTargetsRelative?(o9.addVectors(this.boundingBox.min,o8.min),this.boundingBox.expandByPoint(o9),o9.addVectors(this.boundingBox.max,o8.max),this.boundingBox.expandByPoint(o9)):(this.boundingBox.expandByPoint(o8.min),this.boundingBox.expandByPoint(o8.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new s4);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new sB,1/0);return}if(e){let i=this.boundingSphere.center;if(o8.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];o7.setFromBufferAttribute(i),this.morphTargetsRelative?(o9.addVectors(o8.min,o7.min),o8.expandByPoint(o9),o9.addVectors(o8.max,o7.max),o8.expandByPoint(o9)):(o8.expandByPoint(o7.min),o8.expandByPoint(o7.max))}o8.getCenter(i);let n=0;for(let t=0,r=e.count;t<r;t++)o9.fromBufferAttribute(e,t),n=Math.max(n,i.distanceToSquared(o9));if(t)for(let r=0,a=t.length;r<a;r++){let a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)o9.fromBufferAttribute(a,t),s&&(o6.fromBufferAttribute(e,t),o9.add(o6)),n=Math.max(n,i.distanceToSquared(o9))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=t.position,n=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new oQ(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new sB,o[e]=new sB;let l=new sB,c=new sB,h=new sB,u=new sp,d=new sp,p=new sp,f=new sB,m=new sB,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,n=g.length;t<n;++t){let n=g[t],a=n.start,v=n.count;for(let t=a,n=a+v;t<n;t+=3)!function(e,t,n){l.fromBufferAttribute(i,e),c.fromBufferAttribute(i,t),h.fromBufferAttribute(i,n),u.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,n),c.sub(l),h.sub(l),d.sub(u),p.sub(u);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(a),m.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[n].add(f),o[e].add(m),o[t].add(m),o[n].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new sB,_=new sB,x=new sB,y=new sB;function M(e){x.fromBufferAttribute(n,e),y.copy(x);let t=s[e];v.copy(t),v.sub(x.multiplyScalar(x.dot(t))).normalize(),_.crossVectors(y,t);let i=_.dot(o[e]);a.setXYZW(e,v.x,v.y,v.z,i<0?-1:1)}for(let t=0,i=g.length;t<i;++t){let i=g[t],n=i.start,r=i.count;for(let t=n,i=n+r;t<i;t+=3)M(e.getX(t+0)),M(e.getX(t+1)),M(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new oQ(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let n=new sB,r=new sB,a=new sB,s=new sB,o=new sB,l=new sB,c=new sB,h=new sB;if(e)for(let u=0,d=e.count;u<d;u+=3){let d=e.getX(u+0),p=e.getX(u+1),f=e.getX(u+2);n.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(c),o.add(c),l.add(c),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)n.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),i.setXYZ(e+0,c.x,c.y,c.z),i.setXYZ(e+1,c.x,c.y,c.z),i.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)o9.fromBufferAttribute(e,t),o9.normalize(),e.setXYZ(t,o9.x,o9.y,o9.z)}toNonIndexed(){function e(e,t){let i=e.array,n=e.itemSize,r=e.normalized,a=new i.constructor(t.length*n),s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*n;for(let e=0;e<n;e++)a[o++]=i[s++]}return new oQ(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new le,i=this.index.array,n=this.attributes;for(let r in n){let a=e(n[r],i);t.setAttribute(r,a)}let r=this.morphAttributes;for(let n in r){let a=[],s=r[n];for(let t=0,n=s.length;t<n;t++){let n=e(s[t],i);a.push(n)}t.morphAttributes[n]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,i=a.length;e<i;e++){let i=a[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,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),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let n=i[t];e.data.attributes[t]=n.toJSON(e.data)}let n={},r=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,n=i.length;t<n;t++){let n=i[t];a.push(n.toJSON(e.data))}a.length>0&&(n[t]=a,r=!0)}r&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),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;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let n=e.attributes;for(let e in n){let i=n[e];this.setAttribute(e,i.clone(t))}let r=e.morphAttributes;for(let e in r){let i=[],n=r[e];for(let e=0,r=n.length;e<r;e++)i.push(n[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let lt=new on,li=new class{constructor(e=new sB,t=new sB(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,s6)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let 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){let t=s6.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(s6.copy(this.origin).addScaledVector(this.direction,t),s6.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){let r,a,s,o;s8.copy(e).add(t).multiplyScalar(.5),s7.copy(t).sub(e).normalize(),s9.copy(this.origin).sub(s8);let l=.5*e.distanceTo(t),c=-this.direction.dot(s7),h=s9.dot(this.direction),u=-s9.dot(s7),d=s9.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(r=c*u-h,a=c*h-u,o=l*p,r>=0)if(a>=-o)if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+c*a+2*h)+a*(c*r+a+2*u)+d}else s=-(r=Math.max(0,-(c*(a=l)+h)))*r+a*(a+2*u)+d;else s=-(r=Math.max(0,-(c*(a=-l)+h)))*r+a*(a+2*u)+d;else a<=-o?(a=(r=Math.max(0,-(-c*l+h)))>0?-l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):(a=(r=Math.max(0,-(c*l+h)))>0?l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d);else a=c>0?-l:l,s=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,r),n&&n.copy(s8).addScaledVector(s7,a),s}intersectSphere(e,t){s6.subVectors(e.center,this.origin);let i=s6.dot(this.direction),n=s6.dot(s6)-i*i,r=e.radius*e.radius;if(n>r)return null;let a=Math.sqrt(r-n),s=i-a,o=i+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let i,n,r,a,s,o,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return(l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,a=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,a=(e.min.y-u.y)*c),i>a||r>n||((r>i||isNaN(i))&&(i=r),(a<n||isNaN(n))&&(n=a),h>=0?(s=(e.min.z-u.z)*h,o=(e.max.z-u.z)*h):(s=(e.max.z-u.z)*h,o=(e.min.z-u.z)*h),i>o||s>n||((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0)))?null:this.at(i>=0?i:n,t)}intersectsBox(e){return null!==this.intersectBox(e,s6)}intersectTriangle(e,t,i,n,r){let a;oe.subVectors(t,e),ot.subVectors(i,e),oi.crossVectors(oe,ot);let s=this.direction.dot(oi);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}s9.subVectors(this.origin,e);let o=a*this.direction.dot(ot.crossVectors(s9,ot));if(o<0)return null;let l=a*this.direction.dot(oe.cross(s9));if(l<0||o+l>s)return null;let c=-a*s9.dot(oi);return c<0?null:this.at(c/s,r)}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)}},ln=new s4,lr=new sB,la=new sB,ls=new sB,lo=new sB,ll=new sB,lc=new sB,lh=new sp,lu=new sp,ld=new sp,lp=new sB,lf=new sB,lm=new sB,lg=new sB,lv=new sB;class l_ extends oP{constructor(e=new le,t=new oZ){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(r&&s){lc.set(0,0,0);for(let i=0,n=r.length;i<n;i++){let n=s[i],o=r[i];0!==n&&(ll.fromBufferAttribute(o,e),a?lc.addScaledVector(ll,n):lc.addScaledVector(ll.sub(t),n))}t.add(lc)}return t}raycast(e,t){let i=this.geometry,n=this.material,r=this.matrixWorld;void 0===n||(null===i.boundingSphere&&i.computeBoundingSphere(),ln.copy(i.boundingSphere),ln.applyMatrix4(r),li.copy(e.ray).recast(e.near),!1===ln.containsPoint(li.origin)&&(null===li.intersectSphere(ln,lr)||li.origin.distanceToSquared(lr)>(e.far-e.near)**2)||(lt.copy(r).invert(),li.copy(e.ray).applyMatrix4(lt),(null===i.boundingBox||!1!==li.intersectsBox(i.boundingBox))&&this._computeIntersections(e,t,li)))}_computeIntersections(e,t,i){let n,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=u.length;r<o;r++){let o=u[r],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let r=f;r<m;r+=3)(n=lx(this,p,e,i,l,c,h,s.getX(r),s.getX(r+1),s.getX(r+2)))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=o.materialIndex,t.push(n))}else{let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let u=r;u<o;u+=3)(n=lx(this,a,e,i,l,c,h,s.getX(u),s.getX(u+1),s.getX(u+2)))&&(n.faceIndex=Math.floor(u/3),t.push(n))}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=u.length;r<s;r++){let s=u[r],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let r=f;r<m;r+=3)(n=lx(this,p,e,i,l,c,h,r,r+1,r+2))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=s.materialIndex,t.push(n))}else{let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=r;o<s;o+=3)(n=lx(this,a,e,i,l,c,h,o,o+1,o+2))&&(n.faceIndex=Math.floor(o/3),t.push(n))}}}function lx(e,t,i,n,r,a,s,o,l,c){e.getVertexPosition(o,la),e.getVertexPosition(l,ls),e.getVertexPosition(c,lo);let h=function(e,t,i,n,r,a,s,o){if(null===(1===t.side?n.intersectTriangle(s,a,r,!0,o):n.intersectTriangle(r,a,s,0===t.side,o)))return null;lv.copy(o),lv.applyMatrix4(e.matrixWorld);let l=i.ray.origin.distanceTo(lv);return l<i.near||l>i.far?null:{distance:l,point:lv.clone(),object:e}}(e,t,i,n,la,ls,lo,lg);if(h){r&&(lh.fromBufferAttribute(r,o),lu.fromBufferAttribute(r,l),ld.fromBufferAttribute(r,c),h.uv=oV.getInterpolation(lg,la,ls,lo,lh,lu,ld,new sp)),a&&(lh.fromBufferAttribute(a,o),lu.fromBufferAttribute(a,l),ld.fromBufferAttribute(a,c),h.uv1=oV.getInterpolation(lg,la,ls,lo,lh,lu,ld,new sp)),s&&(lp.fromBufferAttribute(s,o),lf.fromBufferAttribute(s,l),lm.fromBufferAttribute(s,c),h.normal=oV.getInterpolation(lg,la,ls,lo,lp,lf,lm,new sB),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let e={a:o,b:l,c:c,normal:new sB,materialIndex:0};oV.getNormal(la,ls,lo,e.normal),h.face=e}return h}class ly extends le{constructor(e=1,t=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const s=this;n=Math.floor(n),r=Math.floor(r);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,i,n,r,a,p,f,m,g,v){let _=a/m,x=p/g,y=a/2,M=p/2,S=f/2,b=m+1,E=g+1,T=0,w=0,A=new sB;for(let a=0;a<E;a++){let s=a*x-M;for(let o=0;o<b;o++){let u=o*_-y;A[e]=u*n,A[t]=s*r,A[i]=S,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[i]=f>0?1:-1,c.push(A.x,A.y,A.z),h.push(o/m),h.push(1-a/g),T+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let i=u+t+b*e,n=u+t+b*(e+1),r=u+(t+1)+b*(e+1),a=u+(t+1)+b*e;o.push(i,n,a),o.push(n,r,a),w+=6}s.addGroup(d,w,v),d+=w,u+=T}p("z","y","x",-1,-1,i,t,e,a=Math.floor(a),r,0),p("z","y","x",1,-1,i,t,-e,a,r,1),p("x","z","y",1,1,e,i,t,n,a,2),p("x","z","y",1,-1,e,i,-t,n,a,3),p("x","y","z",1,-1,e,t,i,n,r,4),p("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new o2(l,3)),this.setAttribute("normal",new o2(c,3)),this.setAttribute("uv",new o2(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ly(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function lM(e){let t={};for(let i in e)for(let n in t[i]={},e[i]){let r=e[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][n]=null):t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}return t}function lS(e){let t={};for(let i=0;i<e.length;i++){let n=lM(e[i]);for(let e in n)t[e]=n[e]}return t}function lb(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:sE.workingColorSpace}class lE extends oK{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=lM(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class lT extends oP{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new on,this.projectionMatrix=new on,this.projectionMatrixInverse=new on,this.coordinateSystem=2e3}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let lw=new sB,lA=new sp,lR=new sp;class lC extends lT{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*sl*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*so*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*sl*Math.atan(Math.tan(.5*so*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){lw.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(lw.x,lw.y).multiplyScalar(-e/lw.z),lw.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(lw.x,lw.y).multiplyScalar(-e/lw.z)}getViewSize(e,t){return this.getViewBounds(e,lA,lR),t.subVectors(lR,lA)}setViewOffset(e,t,i,n,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*so*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/e,t-=a.offsetY*i/s,n*=a.width/e,i*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class lP extends oP{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new lC(-90,1,e,t);n.layers=this.layers,this.add(n);const r=new lC(-90,1,e,t);r.layers=this.layers,this.add(r);const a=new lC(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new lC(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new lC(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new lC(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,c]=this.children,h=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,n),e.render(t,r),e.setRenderTarget(i,1,n),e.render(t,a),e.setRenderTarget(i,2,n),e.render(t,s),e.setRenderTarget(i,3,n),e.render(t,o),e.setRenderTarget(i,4,n),e.render(t,l),i.texture.generateMipmaps=f,e.setRenderTarget(i,5,n),e.render(t,c),e.setRenderTarget(h,u,d),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class lL extends sI{constructor(e,t,i,n,r,a,s,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:301,i,n,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class lI extends sU{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1};this.texture=new lL([i,i,i,i,i,i],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
397
+
398
+ varying vec3 vWorldDirection;
399
+
400
+ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
401
+
402
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
403
+
404
+ }
405
+
406
+ void main() {
407
+
408
+ vWorldDirection = transformDirection( position, modelMatrix );
409
+
410
+ #include <begin_vertex>
411
+ #include <project_vertex>
412
+
413
+ }
414
+ `,fragmentShader:`
415
+
416
+ uniform sampler2D tEquirect;
417
+
418
+ varying vec3 vWorldDirection;
419
+
420
+ #include <common>
421
+
422
+ void main() {
423
+
424
+ vec3 direction = normalize( vWorldDirection );
425
+
426
+ vec2 sampleUV = equirectUv( direction );
427
+
428
+ gl_FragColor = texture2D( tEquirect, sampleUV );
429
+
430
+ }
431
+ `},n=new ly(5,5,5),r=new lE({name:"CubemapFromEquirect",uniforms:lM(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;let a=new l_(n,r),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new lP(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,n){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,i,n);e.setRenderTarget(r)}}let lN=new sB,lD=new sB,lU=new sf;class lO{constructor(e=new sB(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,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=lN.subVectors(i,t).cross(lD.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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){let i=e.delta(lN),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let 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){let i=t||lU.getNormalMatrix(e),n=this.coplanarPoint(lN).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),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)}}let lF=new s4,lB=new sB;class lz{constructor(e=new lO,t=new lO,i=new lO,n=new lO,r=new lO,a=new lO){this.planes=[e,t,i,n,r,a]}set(e,t,i,n,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3){let i=this.planes,n=e.elements,r=n[0],a=n[1],s=n[2],o=n[3],l=n[4],c=n[5],h=n[6],u=n[7],d=n[8],p=n[9],f=n[10],m=n[11],g=n[12],v=n[13],_=n[14],x=n[15];if(i[0].setComponents(o-r,u-l,m-d,x-g).normalize(),i[1].setComponents(o+r,u+l,m+d,x+g).normalize(),i[2].setComponents(o+a,u+c,m+p,x+v).normalize(),i[3].setComponents(o-a,u-c,m-p,x-v).normalize(),i[4].setComponents(o-s,u-h,m-f,x-_).normalize(),2e3===t)i[5].setComponents(o+s,u+h,m+f,x+_).normalize();else if(2001===t)i[5].setComponents(s,h,f,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),lF.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),lF.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(lF)}intersectsSprite(e){return lF.center.set(0,0,0),lF.radius=.7071067811865476,lF.applyMatrix4(e.matrixWorld),this.intersectsSphere(lF)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(lB.x=n.normal.x>0?e.max.x:e.min.x,lB.y=n.normal.y>0?e.max.y:e.min.y,lB.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(lB))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}function lk(){let e=null,t=!1,i=null,n=null;function r(t,a){i(t,a),n=e.requestAnimationFrame(r)}return{start:function(){!0===t||null!==i&&(n=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function lV(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);let n=t.get(i);n&&(e.deleteBuffer(n.buffer),t.delete(i))},update:function(i,n){if(i.isGLBufferAttribute){let e=t.get(i);(!e||e.version<i.version)&&t.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version});return}i.isInterleavedBufferAttribute&&(i=i.data);let r=t.get(i);if(void 0===r)t.set(i,function(t,i){let n,r=t.array,a=t.usage,s=r.byteLength,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,r,a),t.onUploadCallback(),r instanceof Float32Array)n=e.FLOAT;else if(r instanceof Uint16Array)n=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)n=e.SHORT;else if(r instanceof Uint32Array)n=e.UNSIGNED_INT;else if(r instanceof Int32Array)n=e.INT;else if(r instanceof Int8Array)n=e.BYTE;else if(r instanceof Uint8Array)n=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)n=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);return{buffer:o,type:n,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:s}}(i,n));else if(r.version<i.version){if(r.size!==i.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,i,n){let r=i.array,a=i._updateRange,s=i.updateRanges;if(e.bindBuffer(n,t),-1===a.count&&0===s.length&&e.bufferSubData(n,0,r),0!==s.length){for(let t=0,i=s.length;t<i;t++){let i=s[t];e.bufferSubData(n,i.start*r.BYTES_PER_ELEMENT,r,i.start,i.count)}i.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(n,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),i.onUploadCallback()}(r.buffer,i,n),r.version=i.version}}}}class lH extends le{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};const r=e/2,a=t/2,s=Math.floor(i),o=Math.floor(n),l=s+1,c=o+1,h=e/s,u=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<c;e++){const t=e*u-a;for(let i=0;i<l;i++){const n=i*h-r;p.push(n,-t,0),f.push(0,0,1),m.push(i/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const i=t+l*e,n=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;d.push(i,n,a),d.push(n,r,a)}this.setIndex(d),this.setAttribute("position",new o2(p,3)),this.setAttribute("normal",new o2(f,3)),this.setAttribute("uv",new o2(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lH(e.width,e.height,e.widthSegments,e.heightSegments)}}let lG={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n attribute float batchId;\n uniform highp sampler2D batchingTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( batchId );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return shadow;\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n \n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n \n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n \n #else\n \n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n \n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},lW={common:{diffuse:{value:new oX(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new sf},alphaMap:{value:null},alphaMapTransform:{value:new sf},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new sf}},envmap:{envMap:{value:null},envMapRotation:{value:new sf},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new sf}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new sf}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new sf},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new sf},normalScale:{value:new sp(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new sf},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new sf}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new sf}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new sf}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new oX(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new oX(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new sf},alphaTest:{value:0},uvTransform:{value:new sf}},sprite:{diffuse:{value:new oX(0xffffff)},opacity:{value:1},center:{value:new sp(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new sf},alphaMap:{value:null},alphaMapTransform:{value:new sf},alphaTest:{value:0}}},lj={basic:{uniforms:lS([lW.common,lW.specularmap,lW.envmap,lW.aomap,lW.lightmap,lW.fog]),vertexShader:lG.meshbasic_vert,fragmentShader:lG.meshbasic_frag},lambert:{uniforms:lS([lW.common,lW.specularmap,lW.envmap,lW.aomap,lW.lightmap,lW.emissivemap,lW.bumpmap,lW.normalmap,lW.displacementmap,lW.fog,lW.lights,{emissive:{value:new oX(0)}}]),vertexShader:lG.meshlambert_vert,fragmentShader:lG.meshlambert_frag},phong:{uniforms:lS([lW.common,lW.specularmap,lW.envmap,lW.aomap,lW.lightmap,lW.emissivemap,lW.bumpmap,lW.normalmap,lW.displacementmap,lW.fog,lW.lights,{emissive:{value:new oX(0)},specular:{value:new oX(1118481)},shininess:{value:30}}]),vertexShader:lG.meshphong_vert,fragmentShader:lG.meshphong_frag},standard:{uniforms:lS([lW.common,lW.envmap,lW.aomap,lW.lightmap,lW.emissivemap,lW.bumpmap,lW.normalmap,lW.displacementmap,lW.roughnessmap,lW.metalnessmap,lW.fog,lW.lights,{emissive:{value:new oX(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:lG.meshphysical_vert,fragmentShader:lG.meshphysical_frag},toon:{uniforms:lS([lW.common,lW.aomap,lW.lightmap,lW.emissivemap,lW.bumpmap,lW.normalmap,lW.displacementmap,lW.gradientmap,lW.fog,lW.lights,{emissive:{value:new oX(0)}}]),vertexShader:lG.meshtoon_vert,fragmentShader:lG.meshtoon_frag},matcap:{uniforms:lS([lW.common,lW.bumpmap,lW.normalmap,lW.displacementmap,lW.fog,{matcap:{value:null}}]),vertexShader:lG.meshmatcap_vert,fragmentShader:lG.meshmatcap_frag},points:{uniforms:lS([lW.points,lW.fog]),vertexShader:lG.points_vert,fragmentShader:lG.points_frag},dashed:{uniforms:lS([lW.common,lW.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:lG.linedashed_vert,fragmentShader:lG.linedashed_frag},depth:{uniforms:lS([lW.common,lW.displacementmap]),vertexShader:lG.depth_vert,fragmentShader:lG.depth_frag},normal:{uniforms:lS([lW.common,lW.bumpmap,lW.normalmap,lW.displacementmap,{opacity:{value:1}}]),vertexShader:lG.meshnormal_vert,fragmentShader:lG.meshnormal_frag},sprite:{uniforms:lS([lW.sprite,lW.fog]),vertexShader:lG.sprite_vert,fragmentShader:lG.sprite_frag},background:{uniforms:{uvTransform:{value:new sf},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:lG.background_vert,fragmentShader:lG.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new sf}},vertexShader:lG.backgroundCube_vert,fragmentShader:lG.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:lG.cube_vert,fragmentShader:lG.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:lG.equirect_vert,fragmentShader:lG.equirect_frag},distanceRGBA:{uniforms:lS([lW.common,lW.displacementmap,{referencePosition:{value:new sB},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:lG.distanceRGBA_vert,fragmentShader:lG.distanceRGBA_frag},shadow:{uniforms:lS([lW.lights,lW.fog,{color:{value:new oX(0)},opacity:{value:1}}]),vertexShader:lG.shadow_vert,fragmentShader:lG.shadow_frag}};lj.physical={uniforms:lS([lj.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new sf},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new sf},clearcoatNormalScale:{value:new sp(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new sf},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new sf},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new sf},sheen:{value:0},sheenColor:{value:new oX(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new sf},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new sf},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new sf},transmissionSamplerSize:{value:new sp},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new sf},attenuationDistance:{value:0},attenuationColor:{value:new oX(0)},specularColor:{value:new oX(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new sf},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new sf},anisotropyVector:{value:new sp},anisotropyMap:{value:null},anisotropyMapTransform:{value:new sf}}]),vertexShader:lG.meshphysical_vert,fragmentShader:lG.meshphysical_frag};let lX={r:0,b:0,g:0},lq=new op,lY=new on;function lK(e,t,i,n,r,a,s){let o,l,c=new oX(0),h=+(!0!==a),u=null,d=0,p=null;function f(e){let n=!0===e.isScene?e.background:null;return n&&n.isTexture&&(n=(e.backgroundBlurriness>0?i:t).get(n)),n}function m(t,i){t.getRGB(lX,lb(e)),n.buffers.color.setClear(lX.r,lX.g,lX.b,i,s)}return{getClearColor:function(){return c},setClearColor:function(e,t=1){c.set(e),m(c,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){m(c,h=e)},render:function(t){let i=!1,r=f(t);null===r?m(c,h):r&&r.isColor&&(m(r,1),i=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?n.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&n.buffers.color.setClear(0,0,0,0,s),(e.autoClear||i)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,i){let n=f(i);n&&(n.isCubeTexture||306===n.mapping)?(void 0===l&&((l=new l_(new ly(1,1,1),new lE({name:"BackgroundCubeMaterial",uniforms:lM(lj.backgroundCube.uniforms),vertexShader:lj.backgroundCube.vertexShader,fragmentShader:lj.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),lq.copy(i.backgroundRotation),lq.x*=-1,lq.y*=-1,lq.z*=-1,n.isCubeTexture&&!1===n.isRenderTargetTexture&&(lq.y*=-1,lq.z*=-1),l.material.uniforms.envMap.value=n,l.material.uniforms.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(lY.makeRotationFromEuler(lq)),l.material.toneMapped=sE.getTransfer(n.colorSpace)!==si,(u!==n||d!==n.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,u=n,d=n.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):n&&n.isTexture&&(void 0===o&&((o=new l_(new lH(2,2),new lE({name:"BackgroundMaterial",uniforms:lM(lj.background.uniforms),vertexShader:lj.background.vertexShader,fragmentShader:lj.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=n,o.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,o.material.toneMapped=sE.getTransfer(n.colorSpace)!==si,!0===n.matrixAutoUpdate&&n.updateMatrix(),o.material.uniforms.uvTransform.value.copy(n.matrix),(u!==n||d!==n.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,u=n,d=n.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))}}}function lZ(e,t){let i=e.getParameter(e.MAX_VERTEX_ATTRIBS),n={},r=c(null),a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){let t=[],n=[],r=[];for(let e=0;e<i;e++)t[e]=0,n[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){let e=a.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function u(e){d(e,0)}function d(t,i){let n=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;n[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),s[t]!==i&&(e.vertexAttribDivisor(t,i),s[t]=i)}function p(){let t=a.newAttributes,i=a.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==t[n]&&(e.disableVertexAttribArray(n),i[n]=0)}function f(t,i,n,r,a,s,o){!0===o?e.vertexAttribIPointer(t,i,n,a,s):e.vertexAttribPointer(t,i,n,r,a,s)}function m(){g(),s=!0,a!==r&&o((a=r).object)}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(i,r,l,m,g){var v,_;let x,y,M,S,b=!1,E=(v=m,_=l,x=!0===r.wireframe,void 0===(y=n[v.id])&&(y={},n[v.id]=y),void 0===(M=y[_.id])&&(M={},y[_.id]=M),void 0===(S=M[x])&&(S=c(e.createVertexArray()),M[x]=S),S);a!==E&&o((a=E).object),(b=function(e,t,i,n){let r=a.attributes,s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=r[t],n=s[t];if(void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor)),void 0===i||i.attribute!==n||n&&i.data!==n.data)return!0;o++}return a.attributesNum!==o||a.index!==n}(i,m,l,g))&&function(e,t,i,n){let r={},s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[t]=n,o++}a.attributes=r,a.attributesNum=o,a.index=n}(i,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(b||s)&&(s=!1,function(i,n,r,a){h();let s=a.attributes,o=r.getAttributes(),l=n.defaultAttributeValues;for(let n in o){let r=o[n];if(r.location>=0){let o=s[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){let n=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let c=l.buffer,h=l.type,p=l.bytesPerElement,m=h===e.INT||h===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)d(r.location+e,t.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,h,n,l*p,(g+s/r.locationSize*e)*p,m)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)d(r.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,h,n,s*p,s/r.locationSize*e*p,m)}}else if(void 0!==l){let t=l[n];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(i,r,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){for(let e in m(),n){let t=n[e];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete n[e]}},releaseStatesOfGeometry:function(e){if(void 0===n[e.id])return;let t=n[e.id];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete n[e.id]},releaseStatesOfProgram:function(e){for(let t in n){let i=n[t];if(void 0===i[e.id])continue;let r=i[e.id];for(let e in r)l(r[e].object),delete r[e];delete i[e.id]}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function l$(e,t,i){let n;function r(t,r,a){0!==a&&(e.drawArraysInstanced(n,t,r,a),i.update(r,n,a))}this.setMode=function(e){n=e},this.render=function(t,r){e.drawArrays(n,t,r),i.update(r,n,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;let s=t.get("WEBGL_multi_draw");if(null===s)for(let t=0;t<a;t++)this.render(e[t],r[t]);else{s.multiDrawArraysWEBGL(n,e,0,r,0,a);let t=0;for(let e=0;e<a;e++)t+=r[e];i.update(t,n,1)}},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(n,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e];for(let e=0;e<o.length;e++)i.update(t,n,o[e])}}}function lJ(e,t,i,n){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==i.precision?i.precision:"highp",o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=!0===i.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return 1023===t||n.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){let r=1016===i&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===i||n.convert(i)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===i||!!r},precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function lQ(e){let t=this,i=null,n=0,r=!1,a=!1,s=new lO,o=new sf,l={value:null,needsUpdate:!1};function c(e,i,n,r){let a=null!==e?e.length:0,c=null;if(0!==a){if(c=l.value,!0!==r||null===c){let t=n+4*a,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,i=n;t!==a;++t,i+=4)s.copy(e[t]).applyMatrix4(r,o),s.normal.toArray(c,i),c[i+3]=s.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==n||r;return r=t,n=e.length,i},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){i=c(e,t,0)},this.setState=function(s,o,h){let u=s.clippingPlanes,d=s.clipIntersection,p=s.clipShadows,f=e.get(s);if(r&&null!==u&&0!==u.length&&(!a||p)){let e=a?0:n,t=4*e,r=f.clippingState||null;l.value=r,r=c(u,o,t,h);for(let e=0;e!==t;++e)r[e]=i[e];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else a?c(null):(l.value!==i&&(l.value=i,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0)}}function l0(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping;if(303===a||304===a)if(t.has(r))return i(t.get(r).texture,r.mapping);else{let a=r.image;if(!a||!(a.height>0))return null;{let s=new lI(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",n),i(s.texture,r.mapping)}}}return r},dispose:function(){t=new WeakMap}}}let l1=[.125,.215,.35,.446,.526,.582],l2=new class extends lT{constructor(e=-1,t=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,a=i+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}},l3=new oX,l5=null,l4=0,l6=0,l8=!1,l7=(1+Math.sqrt(5))/2,l9=1/l7,ce=[new sB(-l7,l9,0),new sB(l7,l9,0),new sB(-l9,0,l7),new sB(l9,0,l7),new sB(0,l7,-l9),new sB(0,l7,l9),new sB(-1,1,-1),new sB(1,1,-1),new sB(-1,1,1),new sB(1,1,1)];class ct{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){l5=this._renderer.getRenderTarget(),l4=this._renderer.getActiveCubeFace(),l6=this._renderer.getActiveMipmapLevel(),l8=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,n,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=ca(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=cr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(l5,l4,l6),this._renderer.xr.enabled=l8,e.scissorTest=!1,cn(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),l5=this._renderer.getRenderTarget(),l4=this._renderer.getActiveCubeFace(),l6=this._renderer.getActiveMipmapLevel(),l8=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:a7,depthBuffer:!1},n=ci(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var r;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=ci(e,t,i);let{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){let t=[],i=[],n=[],r=e,a=e-4+1+l1.length;for(let s=0;s<a;s++){let a=Math.pow(2,r);i.push(a);let o=1/a;s>e-4?o=l1[s-e+4-1]:0===s&&(o=0),n.push(o);let l=1/(a-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,n=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];d.set(n,18*e),p.set(u,12*e);let r=[e,e,e,e,e,e];f.set(r,6*e)}let m=new le;m.setAttribute("position",new oQ(d,3)),m.setAttribute("uv",new oQ(p,2)),m.setAttribute("faceIndex",new oQ(f,1)),t.push(m),r>4&&r--}return{lodPlanes:t,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=(r=n,new lE({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new sB(0,1,0)}},vertexShader:cs(),fragmentShader:`
432
+
433
+ precision mediump float;
434
+ precision mediump int;
435
+
436
+ varying vec3 vOutputDirection;
437
+
438
+ uniform sampler2D envMap;
439
+ uniform int samples;
440
+ uniform float weights[ n ];
441
+ uniform bool latitudinal;
442
+ uniform float dTheta;
443
+ uniform float mipInt;
444
+ uniform vec3 poleAxis;
445
+
446
+ #define ENVMAP_TYPE_CUBE_UV
447
+ #include <cube_uv_reflection_fragment>
448
+
449
+ vec3 getSample( float theta, vec3 axis ) {
450
+
451
+ float cosTheta = cos( theta );
452
+ // Rodrigues' axis-angle rotation
453
+ vec3 sampleDirection = vOutputDirection * cosTheta
454
+ + cross( axis, vOutputDirection ) * sin( theta )
455
+ + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
456
+
457
+ return bilinearCubeUV( envMap, sampleDirection, mipInt );
458
+
459
+ }
460
+
461
+ void main() {
462
+
463
+ vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
464
+
465
+ if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
466
+
467
+ axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
468
+
469
+ }
470
+
471
+ axis = normalize( axis );
472
+
473
+ gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
474
+ gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
475
+
476
+ for ( int i = 1; i < n; i++ ) {
477
+
478
+ if ( i >= samples ) {
479
+
480
+ break;
481
+
482
+ }
483
+
484
+ float theta = dTheta * float( i );
485
+ gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
486
+ gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
487
+
488
+ }
489
+
490
+ }
491
+ `,blending:0,depthTest:!1,depthWrite:!1}))}return n}_compileMaterial(e){let t=new l_(this._lodPlanes[0],e);this._renderer.compile(t,l2)}_sceneToCubeUV(e,t,i,n){let r=new lC(90,1,t,i),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(l3),o.toneMapping=0,o.autoClear=!1;let h=new oZ({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new l_(new ly,h),d=!1,p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(l3),d=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(r.up.set(0,a[t],0),r.lookAt(s[t],0,0)):1===i?(r.up.set(0,0,a[t]),r.lookAt(0,s[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,s[t]));let l=this._cubeSize;cn(n,i*l,t>2?l:0,l,l),o.setRenderTarget(n),d&&o.render(u,r),o.render(e,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let i=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=ca()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=cr());let r=n?this._cubemapMaterial:this._equirectMaterial,a=new l_(this._lodPlanes[0],r);r.uniforms.envMap.value=e;let s=this._cubeSize;cn(t,0,0,3*s,2*s),i.setRenderTarget(t),i.render(a,l2)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let n=this._lodPlanes.length;for(let t=1;t<n;t++){let i=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=ce[(n-t-1)%ce.length];this._blur(e,t-1,t,i,r)}t.autoClear=i}_blur(e,t,i,n,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,n,"latitudinal",r),this._halfBlur(a,e,i,i,n,"longitudinal",r)}_halfBlur(e,t,i,n,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let c=new l_(this._lodPlanes[n],l),h=l.uniforms,u=this._sizeLods[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,i=Math.exp(-t*t/2);m.push(i),0===e?g+=i:e<f&&(g+=2*i)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);let{_lodMax:v}=this;h.dTheta.value=d,h.mipInt.value=v-i;let _=this._sizeLods[n],x=4*(this._cubeSize-_);cn(t,3*_*(n>v-4?n-v+4:0),x,3*_,2*_),o.setRenderTarget(t),o.render(c,l2)}}function ci(e,t,i){let n=new sU(e,t,i);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function cn(e,t,i,n,r){e.viewport.set(t,i,n,r),e.scissor.set(t,i,n,r)}function cr(){return new lE({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cs(),fragmentShader:`
492
+
493
+ precision mediump float;
494
+ precision mediump int;
495
+
496
+ varying vec3 vOutputDirection;
497
+
498
+ uniform sampler2D envMap;
499
+
500
+ #include <common>
501
+
502
+ void main() {
503
+
504
+ vec3 outputDirection = normalize( vOutputDirection );
505
+ vec2 uv = equirectUv( outputDirection );
506
+
507
+ gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
508
+
509
+ }
510
+ `,blending:0,depthTest:!1,depthWrite:!1})}function ca(){return new lE({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cs(),fragmentShader:`
511
+
512
+ precision mediump float;
513
+ precision mediump int;
514
+
515
+ uniform float flipEnvMap;
516
+
517
+ varying vec3 vOutputDirection;
518
+
519
+ uniform samplerCube envMap;
520
+
521
+ void main() {
522
+
523
+ gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
524
+
525
+ }
526
+ `,blending:0,depthTest:!1,depthWrite:!1})}function cs(){return`
527
+
528
+ precision mediump float;
529
+ precision mediump int;
530
+
531
+ attribute float faceIndex;
532
+
533
+ varying vec3 vOutputDirection;
534
+
535
+ // RH coordinate system; PMREM face-indexing convention
536
+ vec3 getDirection( vec2 uv, float face ) {
537
+
538
+ uv = 2.0 * uv - 1.0;
539
+
540
+ vec3 direction = vec3( uv, 1.0 );
541
+
542
+ if ( face == 0.0 ) {
543
+
544
+ direction = direction.zyx; // ( 1, v, u ) pos x
545
+
546
+ } else if ( face == 1.0 ) {
547
+
548
+ direction = direction.xzy;
549
+ direction.xz *= -1.0; // ( -u, 1, -v ) pos y
550
+
551
+ } else if ( face == 2.0 ) {
552
+
553
+ direction.x *= -1.0; // ( -u, v, 1 ) pos z
554
+
555
+ } else if ( face == 3.0 ) {
556
+
557
+ direction = direction.zyx;
558
+ direction.xz *= -1.0; // ( -1, v, -u ) neg x
559
+
560
+ } else if ( face == 4.0 ) {
561
+
562
+ direction = direction.xzy;
563
+ direction.xy *= -1.0; // ( -u, -1, v ) neg y
564
+
565
+ } else if ( face == 5.0 ) {
566
+
567
+ direction.z *= -1.0; // ( u, v, -1 ) neg z
568
+
569
+ }
570
+
571
+ return direction;
572
+
573
+ }
574
+
575
+ void main() {
576
+
577
+ vOutputDirection = getDirection( uv, faceIndex );
578
+ gl_Position = vec4( position, 1.0 );
579
+
580
+ }
581
+ `}function co(e){let t=new WeakMap,i=null;function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){let a=t.get(r),l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===i&&(i=new ct(e)),(a=s?i.fromEquirectangular(r,a):i.fromCubemap(r,a)).texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;{if(void 0!==a)return a.texture;let l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(l)?(null===i&&(i=new ct(e)),(a=s?i.fromEquirectangular(r):i.fromCubemap(r)).texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",n),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function cl(e){let t={};function i(i){let n;if(void 0!==t[i])return t[i];switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(i)}return t[i]=n,n}return{has:function(e){return null!==i(e)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(e){let t=i(e);return null===t&&sx("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function cc(e,t,i,n){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);for(let e in o.morphAttributes){let i=o.morphAttributes[e];for(let e=0,n=i.length;e<n;e++)t.remove(i[e])}o.removeEventListener("dispose",s),delete r[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(e){let i=[],n=e.index,r=e.attributes.position,s=0;if(null!==n){let e=n.array;s=n.version;for(let t=0,n=e.length;t<n;t+=3){let n=e[t+0],r=e[t+1],a=e[t+2];i.push(n,r,r,a,a,n)}}else{if(void 0===r)return;let e=r.array;s=r.version;for(let t=0,n=e.length/3-1;t<n;t+=3){let e=t+0,n=t+1,r=t+2;i.push(e,n,n,r,r,e)}}let o=new(sg(i)?o1:o0)(i,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,i.memory.geometries++),t},update:function(i){let n=i.attributes;for(let i in n)t.update(n[i],e.ARRAY_BUFFER);let r=i.morphAttributes;for(let i in r){let n=r[i];for(let i=0,r=n.length;i<r;i++)t.update(n[i],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&o(e)}else o(e);return a.get(e)}}}function ch(e,t,i){let n,r,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(n,s,r,t*a,o),i.update(s,n,o))}this.setMode=function(e){n=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(n,s,r,t*a),i.update(s,n,1)},this.renderInstances=s,this.renderMultiDraw=function(e,s,o){if(0===o)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<o;t++)this.render(e[t]/a,s[t]);else{l.multiDrawElementsWEBGL(n,s,0,r,e,0,o);let t=0;for(let e=0;e<o;e++)t+=s[e];i.update(t,n,1)}},this.renderMultiDrawInstances=function(e,o,l,c){if(0===l)return;let h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(n,o,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e];for(let e=0;e<c.length;e++)i.update(t,n,c[e])}}}function cu(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(i,n,r){switch(t.calls++,n){case e.TRIANGLES:t.triangles+=i/3*r;break;case e.LINES:t.lines+=i/2*r;break;case e.LINE_STRIP:t.lines+=r*(i-1);break;case e.LINE_LOOP:t.lines+=r*i;break;case e.POINTS:t.points+=r*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function cd(e,t,i){let n=new WeakMap,r=new sN;return{update:function(a,s,o){let l=a.morphTargetInfluences,c=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,h=void 0!==c?c.length:0,u=n.get(s);if(void 0===u||u.count!==h){void 0!==u&&u.texture.dispose();let e=void 0!==s.morphAttributes.position,i=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],c=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===i&&(d=2),!0===a&&(d=3);let p=s.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*h),g=new sO(m,p,f,h);g.type=1015,g.needsUpdate=!0;let v=4*d;for(let t=0;t<h;t++){let n=o[t],s=l[t],h=c[t],u=p*f*4*t;for(let t=0;t<n.count;t++){let o=t*v;!0===e&&(r.fromBufferAttribute(n,t),m[u+o+0]=r.x,m[u+o+1]=r.y,m[u+o+2]=r.z,m[u+o+3]=0),!0===i&&(r.fromBufferAttribute(s,t),m[u+o+4]=r.x,m[u+o+5]=r.y,m[u+o+6]=r.z,m[u+o+7]=0),!0===a&&(r.fromBufferAttribute(h,t),m[u+o+8]=r.x,m[u+o+9]=r.y,m[u+o+10]=r.z,m[u+o+11]=4===h.itemSize?r.w:1)}}u={count:h,texture:g,size:new sp(p,f)},n.set(s,u),s.addEventListener("dispose",function e(){g.dispose(),n.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,i);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let i=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",i),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",u.texture,i),o.getUniforms().setValue(e,"morphTargetsTextureSize",u.size)}}}function cp(e,t,i,n){let r=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(s){let o=n.render.frame,l=s.geometry,c=t.get(s,l);if(r.get(c)!==o&&(t.update(c),r.set(c,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),r.get(s)!==o&&(i.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&i.update(s.instanceColor,e.ARRAY_BUFFER),r.set(s,o))),s.isSkinnedMesh){let e=s.skeleton;r.get(e)!==o&&(e.update(),r.set(e,o))}return c},dispose:function(){r=new WeakMap}}}class cf extends sI{constructor(e,t,i,n,r,a,s,o,l,c=1026){if(1026!==c&&1027!==c)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===c&&(i=1014),void 0===i&&1027===c&&(i=1020),super(null,n,r,a,s,o,c,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}let cm=new sI,cg=new cf(1,1);cg.compareFunction=515;let cv=new sO,c_=new class extends sI{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},cx=new lL,cy=[],cM=[],cS=new Float32Array(16),cb=new Float32Array(9),cE=new Float32Array(4);function cT(e,t,i){let n=e[0];if(n<=0||n>0)return e;let r=t*i,a=cy[r];if(void 0===a&&(a=new Float32Array(r),cy[r]=a),0!==t){n.toArray(a,0);for(let n=1,r=0;n!==t;++n)r+=i,e[n].toArray(a,r)}return a}function cw(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0}function cA(e,t){for(let i=0,n=t.length;i<n;i++)e[i]=t[i]}function cR(e,t){let i=cM[t];void 0===i&&(i=new Int32Array(t),cM[t]=i);for(let n=0;n!==t;++n)i[n]=e.allocateTextureUnit();return i}function cC(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function cP(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(cw(i,t))return;e.uniform2fv(this.addr,t),cA(i,t)}}function cL(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(cw(i,t))return;e.uniform3fv(this.addr,t),cA(i,t)}}function cI(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(cw(i,t))return;e.uniform4fv(this.addr,t),cA(i,t)}}function cN(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(cw(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),cA(i,t)}else{if(cw(i,n))return;cE.set(n),e.uniformMatrix2fv(this.addr,!1,cE),cA(i,n)}}function cD(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(cw(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),cA(i,t)}else{if(cw(i,n))return;cb.set(n),e.uniformMatrix3fv(this.addr,!1,cb),cA(i,n)}}function cU(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(cw(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),cA(i,t)}else{if(cw(i,n))return;cS.set(n),e.uniformMatrix4fv(this.addr,!1,cS),cA(i,n)}}function cO(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function cF(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(cw(i,t))return;e.uniform2iv(this.addr,t),cA(i,t)}}function cB(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(cw(i,t))return;e.uniform3iv(this.addr,t),cA(i,t)}}function cz(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(cw(i,t))return;e.uniform4iv(this.addr,t),cA(i,t)}}function ck(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function cV(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(cw(i,t))return;e.uniform2uiv(this.addr,t),cA(i,t)}}function cH(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(cw(i,t))return;e.uniform3uiv(this.addr,t),cA(i,t)}}function cG(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(cw(i,t))return;e.uniform4uiv(this.addr,t),cA(i,t)}}function cW(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r);let a=this.type===e.SAMPLER_2D_SHADOW?cg:cm;i.setTexture2D(t||a,r)}function cj(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(t||c_,r)}function cX(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(t||cx,r)}function cq(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(t||cv,r)}function cY(e,t){e.uniform1fv(this.addr,t)}function cK(e,t){let i=cT(t,this.size,2);e.uniform2fv(this.addr,i)}function cZ(e,t){let i=cT(t,this.size,3);e.uniform3fv(this.addr,i)}function c$(e,t){let i=cT(t,this.size,4);e.uniform4fv(this.addr,i)}function cJ(e,t){let i=cT(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function cQ(e,t){let i=cT(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function c0(e,t){let i=cT(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function c1(e,t){e.uniform1iv(this.addr,t)}function c2(e,t){e.uniform2iv(this.addr,t)}function c3(e,t){e.uniform3iv(this.addr,t)}function c5(e,t){e.uniform4iv(this.addr,t)}function c4(e,t){e.uniform1uiv(this.addr,t)}function c6(e,t){e.uniform2uiv(this.addr,t)}function c8(e,t){e.uniform3uiv(this.addr,t)}function c7(e,t){e.uniform4uiv(this.addr,t)}function c9(e,t,i){let n=this.cache,r=t.length,a=cR(i,r);cw(n,a)||(e.uniform1iv(this.addr,a),cA(n,a));for(let e=0;e!==r;++e)i.setTexture2D(t[e]||cm,a[e])}function he(e,t,i){let n=this.cache,r=t.length,a=cR(i,r);cw(n,a)||(e.uniform1iv(this.addr,a),cA(n,a));for(let e=0;e!==r;++e)i.setTexture3D(t[e]||c_,a[e])}function ht(e,t,i){let n=this.cache,r=t.length,a=cR(i,r);cw(n,a)||(e.uniform1iv(this.addr,a),cA(n,a));for(let e=0;e!==r;++e)i.setTextureCube(t[e]||cx,a[e])}function hi(e,t,i){let n=this.cache,r=t.length,a=cR(i,r);cw(n,a)||(e.uniform1iv(this.addr,a),cA(n,a));for(let e=0;e!==r;++e)i.setTexture2DArray(t[e]||cv,a[e])}class hn{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return cC;case 35664:return cP;case 35665:return cL;case 35666:return cI;case 35674:return cN;case 35675:return cD;case 35676:return cU;case 5124:case 35670:return cO;case 35667:case 35671:return cF;case 35668:case 35672:return cB;case 35669:case 35673:return cz;case 5125:return ck;case 36294:return cV;case 36295:return cH;case 36296:return cG;case 35678:case 36198:case 36298:case 36306:case 35682:return cW;case 35679:case 36299:case 36307:return cj;case 35680:case 36300:case 36308:case 36293:return cX;case 36289:case 36303:case 36311:case 36292:return cq}}(t.type)}}class hr{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return cY;case 35664:return cK;case 35665:return cZ;case 35666:return c$;case 35674:return cJ;case 35675:return cQ;case 35676:return c0;case 5124:case 35670:return c1;case 35667:case 35671:return c2;case 35668:case 35672:return c3;case 35669:case 35673:return c5;case 5125:return c4;case 36294:return c6;case 36295:return c8;case 36296:return c7;case 35678:case 36198:case 36298:case 36306:case 35682:return c9;case 35679:case 36299:case 36307:return he;case 35680:case 36300:case 36308:case 36293:return ht;case 36289:case 36303:case 36311:case 36292:return hi}}(t.type)}}class ha{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let r=0,a=n.length;r!==a;++r){let a=n[r];a.setValue(e,t[a.id],i)}}}let hs=/(\w+)(\])?(\[|\.)?/g;function ho(e,t){e.seq.push(t),e.map[t.id]=t}class hl{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=e.getActiveUniform(t,n),r=e.getUniformLocation(t,i.name);!function(e,t,i){let n=e.name,r=n.length;for(hs.lastIndex=0;;){let a=hs.exec(n),s=hs.lastIndex,o=a[1],l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){ho(i,void 0===c?new hn(o,e,t):new hr(o,e,t));break}{let e=i.map[o];void 0===e&&ho(i,e=new ha(o)),i=e}}}(i,r,this)}}setValue(e,t,i,n){let r=this.map[t];void 0!==r&&r.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];void 0!==n&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let r=0,a=t.length;r!==a;++r){let a=t[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,r=e.length;n!==r;++n){let r=e[n];r.id in t&&i.push(r)}return i}}function hc(e,t,i){let n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),n}let hh=0;function hu(e,t,i){let n=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(n&&""===r)return"";let a=/ERROR: 0:(\d+)/.exec(r);if(!a)return r;{let n=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){let i=e.split("\n"),n=[],r=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=r;e<a;e++){let r=e+1;n.push(`${r===t?">":" "} ${r}: ${i[e]}`)}return n.join("\n")}(e.getShaderSource(t),n)}}function hd(e){return""!==e}function hp(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function hf(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let hm=/^[ \t]*#include +<([\w\d./]+)>/gm;function hg(e){return e.replace(hm,h_)}let hv=new Map;function h_(e,t){let i=lG[t];if(void 0===i){let e=hv.get(t);if(void 0!==e)i=lG[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return hg(i)}let hx=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function hy(e){return e.replace(hx,hM)}function hM(e,t,i,n){let r="";for(let e=parseInt(t);e<parseInt(i);e++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function hS(e){let t=`precision ${e.precision} float;
582
+ precision ${e.precision} int;
583
+ precision ${e.precision} sampler2D;
584
+ precision ${e.precision} samplerCube;
585
+ precision ${e.precision} sampler3D;
586
+ precision ${e.precision} sampler2DArray;
587
+ precision ${e.precision} sampler2DShadow;
588
+ precision ${e.precision} samplerCubeShadow;
589
+ precision ${e.precision} sampler2DArrayShadow;
590
+ precision ${e.precision} isampler2D;
591
+ precision ${e.precision} isampler3D;
592
+ precision ${e.precision} isamplerCube;
593
+ precision ${e.precision} isampler2DArray;
594
+ precision ${e.precision} usampler2D;
595
+ precision ${e.precision} usampler3D;
596
+ precision ${e.precision} usamplerCube;
597
+ precision ${e.precision} usampler2DArray;
598
+ `;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function hb(e,t,i,n){let r,a,s,o,l,c,h=e.getContext(),u=i.defines,d=i.vertexShader,p=i.fragmentShader,f=(l="SHADOWMAP_TYPE_BASIC",1===i.shadowMapType?l="SHADOWMAP_TYPE_PCF":2===i.shadowMapType?l="SHADOWMAP_TYPE_PCF_SOFT":3===i.shadowMapType&&(l="SHADOWMAP_TYPE_VSM"),l),m=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(i),g=(c="ENVMAP_MODE_REFLECTION",i.envMap&&302===i.envMapMode&&(c="ENVMAP_MODE_REFRACTION"),c),v=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(i),_=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),x=[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(hd).join("\n"),y=function(e){let t=[];for(let i in e){let n=e[i];!1!==n&&t.push("#define "+i+" "+n)}return t.join("\n")}(u),M=h.createProgram(),S=i.glslVersion?"#version "+i.glslVersion+"\n":"";if(i.isRawShaderMaterial)(r=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(hd).join("\n")).length>0&&(r+="\n"),(a=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(hd).join("\n")).length>0&&(a+="\n");else{let e;r=[hS(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(hd).join("\n"),a=[hS(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+m:"",i.envMap?"#define "+g:"",i.envMap?"#define "+v:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?lG.tonemapping_pars_fragment:"",0!==i.toneMapping?function(e,t){let i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 6:i="AgX";break;case 7:i="Neutral";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",lG.colorspace_pars_fragment,(e=function(e){let t,i=sE.getPrimaries(sE.workingColorSpace),n=sE.getPrimaries(e);switch(i===n?t="":"p3"===i&&n===sn?t="LinearDisplayP3ToLinearSRGB":i===sn&&"p3"===n&&(t="LinearSRGBToLinearDisplayP3"),e){case a7:case se:return[t,"LinearTransferOETF"];case a8:case a9:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[t,"LinearTransferOETF"]}}(i.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(hd).join("\n")}d=hf(d=hp(d=hg(d),i),i),p=hf(p=hp(p=hg(p),i),i),d=hy(d),p=hy(p),!0!==i.isRawShaderMaterial&&(S="#version 300 es\n",r=[x,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in",i.glslVersion===sr?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===sr?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);let b=S+r+d,E=S+a+p,T=hc(h,h.VERTEX_SHADER,b),w=hc(h,h.FRAGMENT_SHADER,E);function A(t){if(e.debug.checkShaderErrors){let i=h.getProgramInfoLog(M).trim(),n=h.getShaderInfoLog(T).trim(),s=h.getShaderInfoLog(w).trim(),o=!0,l=!0;if(!1===h.getProgramParameter(M,h.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(h,M,T,w);else{let e=hu(h,T,"vertex"),n=hu(h,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+h.getError()+" - VALIDATE_STATUS "+h.getProgramParameter(M,h.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+n)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):(""===n||""===s)&&(l=!1);l&&(t.diagnostics={runnable:o,programLog:i,vertexShader:{log:n,prefix:r},fragmentShader:{log:s,prefix:a}})}h.deleteShader(T),h.deleteShader(w),s=new hl(h,M),o=function(e,t){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let n=e.getActiveAttrib(t,r),a=n.name,s=1;n.type===e.FLOAT_MAT2&&(s=2),n.type===e.FLOAT_MAT3&&(s=3),n.type===e.FLOAT_MAT4&&(s=4),i[a]={type:n.type,location:e.getAttribLocation(t,a),locationSize:s}}return i}(h,M)}h.attachShader(M,T),h.attachShader(M,w),void 0!==i.index0AttributeName?h.bindAttribLocation(M,0,i.index0AttributeName):!0===i.morphTargets&&h.bindAttribLocation(M,0,"position"),h.linkProgram(M),this.getUniforms=function(){return void 0===s&&A(this),s},this.getAttributes=function(){return void 0===o&&A(this),o};let R=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===R&&(R=h.getProgramParameter(M,37297)),R},this.destroy=function(){n.releaseStatesOfProgram(this),h.deleteProgram(M),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=hh++,this.cacheKey=t,this.usedTimes=1,this.program=M,this.vertexShader=T,this.fragmentShader=w,this}let hE=0;class hT{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new hw(e),t.set(e,i)),i}}class hw{constructor(e){this.id=hE++,this.code=e,this.usedTimes=0}}function hA(e,t,i,n,r,a,s){let o=new of,l=new hT,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures,p=r.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(e){return(c.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(a,o,h,g,v){let _,x,y,M,S=g.fog,b=v.geometry,E=a.isMeshStandardMaterial?g.environment:null,T=(a.isMeshStandardMaterial?i:t).get(a.envMap||E),w=T&&306===T.mapping?T.image.height:null,A=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let R=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,C=void 0!==R?R.length:0,P=0;if(void 0!==b.morphAttributes.position&&(P=1),void 0!==b.morphAttributes.normal&&(P=2),void 0!==b.morphAttributes.color&&(P=3),A){let e=lj[A];_=e.vertexShader,x=e.fragmentShader}else _=a.vertexShader,x=a.fragmentShader,l.update(a),y=l.getVertexShaderID(a),M=l.getFragmentShaderID(a);let L=e.getRenderTarget(),I=!0===v.isInstancedMesh,N=!0===v.isBatchedMesh,D=!!a.map,U=!!a.matcap,O=!!T,F=!!a.aoMap,B=!!a.lightMap,z=!!a.bumpMap,k=!!a.normalMap,V=!!a.displacementMap,H=!!a.emissiveMap,G=!!a.metalnessMap,W=!!a.roughnessMap,j=a.anisotropy>0,X=a.clearcoat>0,q=a.dispersion>0,Y=a.iridescence>0,K=a.sheen>0,Z=a.transmission>0,$=j&&!!a.anisotropyMap,J=X&&!!a.clearcoatMap,Q=X&&!!a.clearcoatNormalMap,ee=X&&!!a.clearcoatRoughnessMap,et=Y&&!!a.iridescenceMap,ei=Y&&!!a.iridescenceThicknessMap,en=K&&!!a.sheenColorMap,er=K&&!!a.sheenRoughnessMap,ea=!!a.specularMap,es=!!a.specularColorMap,eo=!!a.specularIntensityMap,el=Z&&!!a.transmissionMap,ec=Z&&!!a.thicknessMap,eh=!!a.gradientMap,eu=!!a.alphaMap,ed=a.alphaTest>0,ep=!!a.alphaHash,ef=!!a.extensions,em=0;a.toneMapped&&(null===L||!0===L.isXRRenderTarget)&&(em=e.toneMapping);let eg={shaderID:A,shaderType:a.type,shaderName:a.name,vertexShader:_,fragmentShader:x,defines:a.defines,customVertexShaderID:y,customFragmentShaderID:M,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:N,batchingColor:N&&null!==v._colorsTexture,instancing:I,instancingColor:I&&null!==v.instanceColor,instancingMorph:I&&null!==v.morphTexture,supportsVertexTextures:d,outputColorSpace:null===L?e.outputColorSpace:!0===L.isXRRenderTarget?L.texture.colorSpace:a7,alphaToCoverage:!!a.alphaToCoverage,map:D,matcap:U,envMap:O,envMapMode:O&&T.mapping,envMapCubeUVHeight:w,aoMap:F,lightMap:B,bumpMap:z,normalMap:k,displacementMap:d&&V,emissiveMap:H,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:G,roughnessMap:W,anisotropy:j,anisotropyMap:$,clearcoat:X,clearcoatMap:J,clearcoatNormalMap:Q,clearcoatRoughnessMap:ee,dispersion:q,iridescence:Y,iridescenceMap:et,iridescenceThicknessMap:ei,sheen:K,sheenColorMap:en,sheenRoughnessMap:er,specularMap:ea,specularColorMap:es,specularIntensityMap:eo,transmission:Z,transmissionMap:el,thicknessMap:ec,gradientMap:eh,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:eu,alphaTest:ed,alphaHash:ep,combine:a.combine,mapUv:D&&m(a.map.channel),aoMapUv:F&&m(a.aoMap.channel),lightMapUv:B&&m(a.lightMap.channel),bumpMapUv:z&&m(a.bumpMap.channel),normalMapUv:k&&m(a.normalMap.channel),displacementMapUv:V&&m(a.displacementMap.channel),emissiveMapUv:H&&m(a.emissiveMap.channel),metalnessMapUv:G&&m(a.metalnessMap.channel),roughnessMapUv:W&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:J&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:Q&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:ei&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:en&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:er&&m(a.sheenRoughnessMap.channel),specularMapUv:ea&&m(a.specularMap.channel),specularColorMapUv:es&&m(a.specularColorMap.channel),specularIntensityMapUv:eo&&m(a.specularIntensityMap.channel),transmissionMapUv:el&&m(a.transmissionMap.channel),thicknessMapUv:ec&&m(a.thicknessMap.channel),alphaMapUv:eu&&m(a.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(k||j),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!b.attributes.uv&&(D||eu),fog:!!S,useFog:!0===a.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:C,morphTextureStride:P,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:em,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&sE.getTransfer(a.map.colorSpace)===si,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ef&&!0===a.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:ef&&!0===a.extensions.multiDraw&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return eg.vertexUv1s=c.has(1),eg.vertexUv2s=c.has(2),eg.vertexUv3s=c.has(3),c.clear(),eg},getProgramCacheKey:function(t){var i,n,r,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i=s,n=t,i.push(n.precision),i.push(n.outputColorSpace),i.push(n.envMapMode),i.push(n.envMapCubeUVHeight),i.push(n.mapUv),i.push(n.alphaMapUv),i.push(n.lightMapUv),i.push(n.aoMapUv),i.push(n.bumpMapUv),i.push(n.normalMapUv),i.push(n.displacementMapUv),i.push(n.emissiveMapUv),i.push(n.metalnessMapUv),i.push(n.roughnessMapUv),i.push(n.anisotropyMapUv),i.push(n.clearcoatMapUv),i.push(n.clearcoatNormalMapUv),i.push(n.clearcoatRoughnessMapUv),i.push(n.iridescenceMapUv),i.push(n.iridescenceThicknessMapUv),i.push(n.sheenColorMapUv),i.push(n.sheenRoughnessMapUv),i.push(n.specularMapUv),i.push(n.specularColorMapUv),i.push(n.specularIntensityMapUv),i.push(n.transmissionMapUv),i.push(n.thicknessMapUv),i.push(n.combine),i.push(n.fogExp2),i.push(n.sizeAttenuation),i.push(n.morphTargetsCount),i.push(n.morphAttributeCount),i.push(n.numDirLights),i.push(n.numPointLights),i.push(n.numSpotLights),i.push(n.numSpotLightMaps),i.push(n.numHemiLights),i.push(n.numRectAreaLights),i.push(n.numDirLightShadows),i.push(n.numPointLightShadows),i.push(n.numSpotLightShadows),i.push(n.numSpotLightShadowsWithMaps),i.push(n.numLightProbes),i.push(n.shadowMapType),i.push(n.toneMapping),i.push(n.numClippingPlanes),i.push(n.numClipIntersection),i.push(n.depthPacking),r=s,a=t,o.disableAll(),a.supportsVertexTextures&&o.enable(0),a.instancing&&o.enable(1),a.instancingColor&&o.enable(2),a.instancingMorph&&o.enable(3),a.matcap&&o.enable(4),a.envMap&&o.enable(5),a.normalMapObjectSpace&&o.enable(6),a.normalMapTangentSpace&&o.enable(7),a.clearcoat&&o.enable(8),a.iridescence&&o.enable(9),a.alphaTest&&o.enable(10),a.vertexColors&&o.enable(11),a.vertexAlphas&&o.enable(12),a.vertexUv1s&&o.enable(13),a.vertexUv2s&&o.enable(14),a.vertexUv3s&&o.enable(15),a.vertexTangents&&o.enable(16),a.anisotropy&&o.enable(17),a.alphaHash&&o.enable(18),a.batching&&o.enable(19),a.dispersion&&o.enable(20),a.batchingColor&&o.enable(21),r.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.skinning&&o.enable(4),a.morphTargets&&o.enable(5),a.morphNormals&&o.enable(6),a.morphColors&&o.enable(7),a.premultipliedAlpha&&o.enable(8),a.shadowMapEnabled&&o.enable(9),a.doubleSided&&o.enable(10),a.flipSided&&o.enable(11),a.useDepthPacking&&o.enable(12),a.dithering&&o.enable(13),a.transmission&&o.enable(14),a.sheen&&o.enable(15),a.opaque&&o.enable(16),a.pointsUvs&&o.enable(17),a.decodeVideoTexture&&o.enable(18),a.alphaToCoverage&&o.enable(19),r.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,i=f[e.type];return t=i?lM(lj[i].uniforms):e.uniforms},acquireProgram:function(t,i){let n;for(let e=0,t=h.length;e<t;e++){let t=h[e];if(t.cacheKey===i){n=t,++n.usedTimes;break}}return void 0===n&&(n=new hb(e,i,t,a),h.push(n)),n},releaseProgram:function(e){if(0==--e.usedTimes){let t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function hR(){let e=new WeakMap;return{get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,n){e.get(t)[i]=n},dispose:function(){e=new WeakMap}}}function hC(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function hP(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function hL(){let e=[],t=0,i=[],n=[],r=[];function a(i,n,r,a,s,o){let l=e[t];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},e[t]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){t=0,i.length=0,n.length=0,r.length=0},push:function(e,t,s,o,l,c){let h=a(e,t,s,o,l,c);s.transmission>0?n.push(h):!0===s.transparent?r.push(h):i.push(h)},unshift:function(e,t,s,o,l,c){let h=a(e,t,s,o,l,c);s.transmission>0?n.unshift(h):!0===s.transparent?r.unshift(h):i.unshift(h)},finish:function(){for(let i=t,n=e.length;i<n;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||hC),n.length>1&&n.sort(t||hP),r.length>1&&r.sort(t||hP)}}}function hI(){let e=new WeakMap;return{get:function(t,i){let n,r=e.get(t);return void 0===r?(n=new hL,e.set(t,[n])):i>=r.length?(n=new hL,r.push(n)):n=r[i],n},dispose:function(){e=new WeakMap}}}function hN(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new sB,color:new oX};break;case"SpotLight":i={position:new sB,direction:new sB,color:new oX,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new sB,color:new oX,distance:0,decay:0};break;case"HemisphereLight":i={direction:new sB,skyColor:new oX,groundColor:new oX};break;case"RectAreaLight":i={color:new oX,position:new sB,halfWidth:new sB,halfHeight:new sB}}return e[t.id]=i,i}}}let hD=0;function hU(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function hO(e){let t,i=new hN,n=(t={},{get:function(e){let i;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new sp};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new sp,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new sB);let a=new sB,s=new on,o=new on;return{setup:function(t){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0;t.sort(hU);for(let e=0,x=t.length;e<x;e++){let x=t[e],y=x.color,M=x.intensity,S=x.distance,b=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)a+=y.r*M,s+=y.g*M,o+=y.b*M;else if(x.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(x.sh.coefficients[e],M);_++}else if(x.isDirectionalLight){let e=i.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),x.castShadow){let e=x.shadow,t=n.get(x);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=b,r.directionalShadowMatrix[l]=x.shadow.matrix,p++}r.directional[l]=e,l++}else if(x.isSpotLight){let e=i.get(x);e.position.setFromMatrixPosition(x.matrixWorld),e.color.copy(y).multiplyScalar(M),e.distance=S,e.coneCos=Math.cos(x.angle),e.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),e.decay=x.decay,r.spot[h]=e;let t=x.shadow;if(x.map&&(r.spotLightMap[g]=x.map,g++,t.updateMatrices(x),x.castShadow&&v++),r.spotLightMatrix[h]=t.matrix,x.castShadow){let e=n.get(x);e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,r.spotShadow[h]=e,r.spotShadowMap[h]=b,m++}h++}else if(x.isRectAreaLight){let e=i.get(x);e.color.copy(y).multiplyScalar(M),e.halfWidth.set(.5*x.width,0,0),e.halfHeight.set(0,.5*x.height,0),r.rectArea[u]=e,u++}else if(x.isPointLight){let e=i.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),e.distance=x.distance,e.decay=x.decay,x.castShadow){let e=x.shadow,t=n.get(x);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[c]=t,r.pointShadowMap[c]=b,r.pointShadowMatrix[c]=x.shadow.matrix,f++}r.point[c]=e,c++}else if(x.isHemisphereLight){let e=i.get(x);e.skyColor.copy(x.color).multiplyScalar(M),e.groundColor.copy(x.groundColor).multiplyScalar(M),r.hemi[d]=e,d++}}u>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=lW.LTC_FLOAT_1,r.rectAreaLTC2=lW.LTC_FLOAT_2):(r.rectAreaLTC1=lW.LTC_HALF_1,r.rectAreaLTC2=lW.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let x=r.hash;(x.directionalLength!==l||x.pointLength!==c||x.spotLength!==h||x.rectAreaLength!==u||x.hemiLength!==d||x.numDirectionalShadows!==p||x.numPointShadows!==f||x.numSpotShadows!==m||x.numSpotMaps!==g||x.numLightProbes!==_)&&(r.directional.length=l,r.spot.length=h,r.rectArea.length=u,r.point.length=c,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=_,x.directionalLength=l,x.pointLength=c,x.spotLength=h,x.rectAreaLength=u,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=_,r.version=hD++)},setupView:function(e,t){let i=0,n=0,l=0,c=0,h=0,u=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=r.directional[i];e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),i++}else if(d.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),l++}else if(d.isRectAreaLight){let e=r.rectArea[c];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(d.isPointLight){let e=r.point[n];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),n++}else if(d.isHemisphereLight){let e=r.hemi[h];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),h++}}},state:r}}function hF(e){let t=new hO(e),i=[],n=[],r={lightsArray:i,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,i.length=0,n.length=0},state:r,setupLights:function(){t.setup(i)},setupLightsView:function(e){t.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){n.push(e)}}}function hB(e){let t=new WeakMap;return{get:function(i,n=0){let r,a=t.get(i);return void 0===a?(r=new hF(e),t.set(i,[r])):n>=a.length?(r=new hF(e),a.push(r)):r=a[n],r},dispose:function(){t=new WeakMap}}}class hz extends oK{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class hk extends oK{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function hV(e,t,i){let n=new lz,r=new sp,a=new sp,s=new sN,o=new hz({depthPacking:3201}),l=new hk,c={},h=i.maxTextureSize,u={0:1,1:0,2:2},d=new lE({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new sp},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new le;f.setAttribute("position",new oQ(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new l_(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;function _(t,i,n,r){let a=null,s=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===n.isPointLight?l:o,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){let e=a.uuid,t=i.uuid,n=c[e];void 0===n&&(n={},c[e]=n);let r=n[t];void 0===r&&(r=a.clone(),n[t]=r,i.addEventListener("dispose",x)),a=r}return a.visible=i.visible,a.wireframe=i.wireframe,3===r?a.side=null!==i.shadowSide?i.shadowSide:i.side:a.side=null!==i.shadowSide?i.shadowSide:u[i.side],a.alphaMap=i.alphaMap,a.alphaTest=i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=n),a}function x(e){for(let t in e.target.removeEventListener("dispose",x),c){let i=c[t],n=e.target.uuid;n in i&&(i[n].dispose(),delete i[n])}}this.render=function(i,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===i.length)return;let c=e.getRenderTarget(),u=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),x=e.state;x.setBlending(0),x.buffers.color.setClear(1,1,1,1),x.buffers.depth.setTest(!0),x.setScissorTest(!1);let y=3!==v&&3===this.type,M=3===v&&3!==this.type;for(let c=0,u=i.length;c<u;c++){let u=i[c],f=u.shadow;if(void 0===f){console.warn("THREE.WebGLShadowMap:",u,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;r.copy(f.mapSize);let g=f.getFrameExtents();if(r.multiply(g),a.copy(f.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/g.x),r.x=a.x*g.x,f.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/g.y),r.y=a.y*g.y,f.mapSize.y=a.y)),null===f.map||!0===y||!0===M){let e=3!==this.type?{minFilter:1003,magFilter:1003}:{};null!==f.map&&f.map.dispose(),f.map=new sU(r.x,r.y,e),f.map.texture.name=u.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let v=f.getViewportCount();for(let i=0;i<v;i++){let r=f.getViewport(i);s.set(a.x*r.x,a.y*r.y,a.x*r.z,a.y*r.w),x.viewport(s),f.updateMatrices(u,i),n=f.getFrustum(),function i(r,a,s,o,l){if(!1===r.visible)return;if(r.layers.test(a.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===l)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,r.matrixWorld);let i=t.update(r),n=r.material;if(Array.isArray(n)){let t=i.groups;for(let c=0,h=t.length;c<h;c++){let h=t[c],u=n[h.materialIndex];if(u&&u.visible){let t=_(r,u,o,l);r.onBeforeShadow(e,r,a,s,i,t,h),e.renderBufferDirect(s,null,i,t,r,h),r.onAfterShadow(e,r,a,s,i,t,h)}}}else if(n.visible){let t=_(r,n,o,l);r.onBeforeShadow(e,r,a,s,i,t,null),e.renderBufferDirect(s,null,i,t,r,null),r.onAfterShadow(e,r,a,s,i,t,null)}}let c=r.children;for(let e=0,t=c.length;e<t;e++)i(c[e],a,s,o,l)}(o,l,f.camera,u,this.type)}!0!==f.isPointLightShadow&&3===this.type&&function(i,n){let a=t.update(m);d.defines.VSM_SAMPLES!==i.blurSamples&&(d.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new sU(r.x,r.y)),d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(n,null,a,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(n,null,a,p,m,null)}(f,l),f.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(c,u,f)}}function hH(e){let t=new function(){let t=!1,i=new sN,n=null,r=new sN(0,0,0,0);return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,a,s,o){!0===o&&(t*=s,n*=s,a*=s),i.set(t,n,a,s),!1===r.equals(i)&&(e.clearColor(t,n,a,s),r.copy(i))},reset:function(){t=!1,n=null,r.set(-1,0,0,0)}}},i=new function(){let t=!1,i=null,n=null,r=null;return{setTest:function(t){t?B(e.DEPTH_TEST):z(e.DEPTH_TEST)},setMask:function(n){i===n||t||(e.depthMask(n),i=n)},setFunc:function(t){if(n!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}n=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,i=null,n=null,r=null}}},n=new function(){let t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,c=null;return{setTest:function(i){t||(i?B(e.STENCIL_TEST):z(e.STENCIL_TEST))},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,s){(n!==t||r!==i||a!==s)&&(e.stencilFunc(t,i,s),n=t,r=i,a=s)},setOp:function(t,i,n){(s!==t||o!==i||l!==n)&&(e.stencilOp(t,i,n),s=t,o=i,l=n)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap,s={},o={},l=new WeakMap,c=[],h=null,u=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,x=new oX(0,0,0),y=0,M=!1,S=null,b=null,E=null,T=null,w=null,A=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),R=!1,C=e.getParameter(e.VERSION);-1!==C.indexOf("WebGL")?R=parseFloat(/^WebGL (\d)/.exec(C)[1])>=1:-1!==C.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL ES (\d)/.exec(C)[1])>=2);let P=null,L={},I=e.getParameter(e.SCISSOR_BOX),N=e.getParameter(e.VIEWPORT),D=new sN().fromArray(I),U=new sN().fromArray(N);function O(t,i,n,r){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<n;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(i,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(i+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let F={};function B(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function z(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}F[e.TEXTURE_2D]=O(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=O(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=O(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=O(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),i.setClear(1),n.setClear(0),B(e.DEPTH_TEST),i.setFunc(3),G(!1),W(1),B(e.CULL_FACE),H(0);let k={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};k[103]=e.MIN,k[104]=e.MAX;let V={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function H(t,i,n,r,a,s,o,l,c,h){if(0===t){!0===u&&(z(e.BLEND),u=!1);return}if(!1===u&&(B(e.BLEND),u=!0),5!==t){if(t!==d||h!==M){if((100!==p||100!==g)&&(e.blendEquation(e.FUNC_ADD),p=100,g=100),h)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}f=null,m=null,v=null,_=null,x.set(0,0,0),y=0,d=t,M=h}return}a=a||i,s=s||n,o=o||r,(i!==p||a!==g)&&(e.blendEquationSeparate(k[i],k[a]),p=i,g=a),(n!==f||r!==m||s!==v||o!==_)&&(e.blendFuncSeparate(V[n],V[r],V[s],V[o]),f=n,m=r,v=s,_=o),(!1===l.equals(x)||c!==y)&&(e.blendColor(l.r,l.g,l.b,c),x.copy(l),y=c),d=t,M=!1}function G(t){S!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),S=t)}function W(t){0!==t?(B(e.CULL_FACE),t!==b&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):z(e.CULL_FACE),b=t}function j(t,i,n){t?(B(e.POLYGON_OFFSET_FILL),(T!==i||w!==n)&&(e.polygonOffset(i,n),T=i,w=n)):z(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:i,stencil:n},enable:B,disable:z,bindFramebuffer:function(t,i){return o[t]!==i&&(e.bindFramebuffer(t,i),o[t]=i,t===e.DRAW_FRAMEBUFFER&&(o[e.FRAMEBUFFER]=i),t===e.FRAMEBUFFER&&(o[e.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(t,i){let n=c,r=!1;if(t){void 0===(n=l.get(i))&&(n=[],l.set(i,n));let a=t.textures;if(n.length!==a.length||n[0]!==e.COLOR_ATTACHMENT0){for(let t=0,i=a.length;t<i;t++)n[t]=e.COLOR_ATTACHMENT0+t;n.length=a.length,r=!0}}else n[0]!==e.BACK&&(n[0]=e.BACK,r=!0);r&&e.drawBuffers(n)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:H,setMaterial:function(r,a){2===r.side?z(e.CULL_FACE):B(e.CULL_FACE);let s=1===r.side;a&&(s=!s),G(s),1===r.blending&&!1===r.transparent?H(0):H(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),i.setFunc(r.depthFunc),i.setTest(r.depthTest),i.setMask(r.depthWrite),t.setMask(r.colorWrite);let o=r.stencilWrite;n.setTest(o),o&&(n.setMask(r.stencilWriteMask),n.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),n.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),j(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?B(e.SAMPLE_ALPHA_TO_COVERAGE):z(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:G,setCullFace:W,setLineWidth:function(t){t!==E&&(R&&e.lineWidth(t),E=t)},setPolygonOffset:j,setScissorTest:function(t){t?B(e.SCISSOR_TEST):z(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+A-1),P!==t&&(e.activeTexture(t),P=t)},bindTexture:function(t,i,n){void 0===n&&(n=null===P?e.TEXTURE0+A-1:P);let r=L[n];void 0===r&&(r={type:void 0,texture:void 0},L[n]=r),(r.type!==t||r.texture!==i)&&(P!==n&&(e.activeTexture(n),P=n),e.bindTexture(t,i||F[t]),r.type=t,r.texture=i)},unbindTexture:function(){let t=L[P];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,i){let n=a.get(i);void 0===n&&(n=new WeakMap,a.set(i,n));let r=n.get(t);void 0===r&&(r=e.getUniformBlockIndex(i,t.name),n.set(t,r))},uniformBlockBinding:function(t,i){let n=a.get(i).get(t);r.get(i)!==n&&(e.uniformBlockBinding(i,n,t.__bindingPointIndex),r.set(i,n))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===D.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),D.copy(t))},viewport:function(t){!1===U.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),U.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),s={},P=null,L={},o={},l=new WeakMap,c=[],h=null,u=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,x=new oX(0,0,0),y=0,M=!1,S=null,b=null,E=null,T=null,w=null,D.set(0,0,e.canvas.width,e.canvas.height),U.set(0,0,e.canvas.width,e.canvas.height),t.reset(),i.reset(),n.reset()}}}function hG(e,t,i,n,r,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),h=new sp,u=new WeakMap,d=new WeakMap,p=!1;try{p="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function f(e,t){return p?new OffscreenCanvas(e,t):sv("canvas")}function m(e,t,i){let n=1,r=k(e);if((r.width>i||r.height>i)&&(n=i/Math.max(r.width,r.height)),n<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let i=Math.floor(n*r.width),a=Math.floor(n*r.height);void 0===o&&(o=f(i,a));let s=t?f(i,a):o;return s.width=i,s.height=a,s.getContext("2d").drawImage(e,0,0,i,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+i+"x"+a+")."),s}else"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+").");return e}function g(e){return e.generateMipmaps&&1003!==e.minFilter&&1006!==e.minFilter}function v(t){e.generateMipmap(t)}function _(i,n,r,a,s=!1){if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),n===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),n===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),n===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),n===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),n===e.RGBA){let t=s?st:sE.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===si?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function x(t,i){let n;return t?null===i||1014===i||1020===i?n=e.DEPTH24_STENCIL8:1015===i?n=e.DEPTH32F_STENCIL8:1012===i&&(n=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||1014===i||1020===i?n=e.DEPTH_COMPONENT24:1015===i?n=e.DEPTH_COMPONENT32F:1012===i&&(n=e.DEPTH_COMPONENT16),n}function y(e,t){return!0===g(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function M(e){let t=e.target;t.removeEventListener("dispose",M),function(e){let t=n.get(e);if(void 0===t.__webglInit)return;let i=e.source,r=d.get(i);if(r){let n=r[t.__cacheKey];n.usedTimes--,0===n.usedTimes&&b(e),0===Object.keys(r).length&&d.delete(i)}n.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function S(t){let i=t.target;i.removeEventListener("dispose",S),function(t){let i=n.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let n=0;n<i.__webglFramebuffer[t].length;n++)e.deleteFramebuffer(i.__webglFramebuffer[t][n]);else e.deleteFramebuffer(i.__webglFramebuffer[t]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t])}else{if(Array.isArray(i.__webglFramebuffer))for(let t=0;t<i.__webglFramebuffer.length;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}let r=t.textures;for(let t=0,i=r.length;t<i;t++){let i=n.get(r[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),n.remove(r[t])}n.remove(t)}(i)}function b(t){let i=n.get(t);e.deleteTexture(i.__webglTexture);let r=t.source,a=d.get(r);delete a[i.__cacheKey],s.memory.textures--}let E=0;function T(t,r){var a;let o,l=n.get(t);if(t.isVideoTexture&&(a=t,o=s.render.frame,u.get(a)!==o&&(u.set(a,o),a.update())),!1===t.isRenderTargetTexture&&t.version>0&&l.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(l,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+r)}let w={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},A={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},R={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function C(i,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(i,e.TEXTURE_WRAP_S,w[a.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,w[a.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,w[a.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,R[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||n.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy}}function P(t,i){let n,r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",M));let a=i.source,o=d.get(a);void 0===o&&(o={},d.set(a,o));let l=((n=[]).push(i.wrapS),n.push(i.wrapT),n.push(i.wrapR||0),n.push(i.magFilter),n.push(i.minFilter),n.push(i.anisotropy),n.push(i.internalFormat),n.push(i.format),n.push(i.type),n.push(i.generateMipmaps),n.push(i.premultiplyAlpha),n.push(i.flipY),n.push(i.unpackAlignment),n.push(i.colorSpace),n.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),o[l].usedTimes++;let n=o[t.__cacheKey];void 0!==n&&(o[t.__cacheKey].usedTimes--,0===n.usedTimes&&b(i)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return r}function L(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let c=P(t,s),h=s.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let u=n.get(h);if(h.version!==u.__version||!0===c){let t;i.activeTexture(e.TEXTURE0+o);let n=sE.getPrimaries(sE.workingColorSpace),d=""===s.colorSpace?null:sE.getPrimaries(s.colorSpace),p=""===s.colorSpace||n===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,r.maxTextureSize);f=z(s,f);let M=a.convert(s.format,s.colorSpace),S=a.convert(s.type),b=_(s.internalFormat,M,S,s.colorSpace,s.isVideoTexture);C(l,s);let E=s.mipmaps,T=!0!==s.isVideoTexture,w=void 0===u.__version||!0===c,A=h.dataReady,R=y(s,f);if(s.isDepthTexture)b=x(1027===s.format,s.type),w&&(T?i.texStorage2D(e.TEXTURE_2D,1,b,f.width,f.height):i.texImage2D(e.TEXTURE_2D,0,b,f.width,f.height,0,M,S,null));else if(s.isDataTexture)if(E.length>0){T&&w&&i.texStorage2D(e.TEXTURE_2D,R,b,E[0].width,E[0].height);for(let n=0,r=E.length;n<r;n++)t=E[n],T?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,S,t.data):i.texImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,M,S,t.data);s.generateMipmaps=!1}else T?(w&&i.texStorage2D(e.TEXTURE_2D,R,b,f.width,f.height),A&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,f.width,f.height,M,S,f.data)):i.texImage2D(e.TEXTURE_2D,0,b,f.width,f.height,0,M,S,f.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){T&&w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,R,b,E[0].width,E[0].height,f.depth);for(let n=0,r=E.length;n<r;n++)if(t=E[n],1023!==s.format)if(null!==M)if(T){if(A)if(s.layerUpdates.size>0){for(let r of s.layerUpdates){let a=t.width*t.height;i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,r,t.width,t.height,1,M,t.data.slice(a*r,a*(r+1)),0,0)}s.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,f.depth,M,t.data,0,0)}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,n,b,t.width,t.height,f.depth,0,t.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?A&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,f.depth,M,S,t.data):i.texImage3D(e.TEXTURE_2D_ARRAY,n,b,t.width,t.height,f.depth,0,M,S,t.data)}else{T&&w&&i.texStorage2D(e.TEXTURE_2D,R,b,E[0].width,E[0].height);for(let n=0,r=E.length;n<r;n++)t=E[n],1023!==s.format?null!==M?T?A&&i.compressedTexSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,t.data):i.compressedTexImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,S,t.data):i.texImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,M,S,t.data)}else if(s.isDataArrayTexture)if(T){if(w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,R,b,f.width,f.height,f.depth),A)if(s.layerUpdates.size>0){let t;switch(S){case e.UNSIGNED_BYTE:switch(M){case e.ALPHA:case e.LUMINANCE:t=1;break;case e.LUMINANCE_ALPHA:t=2;break;case e.RGB:t=3;break;case e.RGBA:t=4;break;default:throw Error(`Unknown texel size for format ${M}.`)}break;case e.UNSIGNED_SHORT_4_4_4_4:case e.UNSIGNED_SHORT_5_5_5_1:case e.UNSIGNED_SHORT_5_6_5:t=1;break;default:throw Error(`Unknown texel size for type ${S}.`)}let n=f.width*f.height*t;for(let t of s.layerUpdates)i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,t,f.width,f.height,1,M,S,f.data.slice(n*t,n*(t+1)));s.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,M,S,f.data)}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,b,f.width,f.height,f.depth,0,M,S,f.data);else if(s.isData3DTexture)T?(w&&i.texStorage3D(e.TEXTURE_3D,R,b,f.width,f.height,f.depth),A&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,M,S,f.data)):i.texImage3D(e.TEXTURE_3D,0,b,f.width,f.height,f.depth,0,M,S,f.data);else if(s.isFramebufferTexture){if(w)if(T)i.texStorage2D(e.TEXTURE_2D,R,b,f.width,f.height);else{let t=f.width,n=f.height;for(let r=0;r<R;r++)i.texImage2D(e.TEXTURE_2D,r,b,t,n,0,M,S,null),t>>=1,n>>=1}}else if(E.length>0){if(T&&w){let t=k(E[0]);i.texStorage2D(e.TEXTURE_2D,R,b,t.width,t.height)}for(let n=0,r=E.length;n<r;n++)t=E[n],T?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,M,S,t):i.texImage2D(e.TEXTURE_2D,n,b,M,S,t);s.generateMipmaps=!1}else if(T){if(w){let t=k(f);i.texStorage2D(e.TEXTURE_2D,R,b,t.width,t.height)}A&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,M,S,f)}else i.texImage2D(e.TEXTURE_2D,0,b,M,S,f);g(s)&&v(l),u.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function I(t,r,s,o,c,h){let u=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=_(s.internalFormat,u,d,s.colorSpace);if(!n.get(r).__hasExternalTextures){let t=Math.max(1,r.width>>h),n=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?i.texImage3D(c,h,p,t,n,r.depth,0,u,d,null):i.texImage2D(c,h,p,t,n,0,u,d,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),B(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,c,n.get(s).__webglTexture,0,F(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,c,n.get(s).__webglTexture,h),i.bindFramebuffer(e.FRAMEBUFFER,null)}function N(t,i,n){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer){let r=i.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(i.stencilBuffer,a),o=i.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=F(i);B(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,s,i.width,i.height):n?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,s,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=i.textures;for(let r=0;r<t.length;r++){let s=t[r],o=a.convert(s.format,s.colorSpace),c=a.convert(s.type),h=_(s.internalFormat,o,c,s.colorSpace),u=F(i);n&&!1===B(i)?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,h,i.width,i.height):B(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,h,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,h,i.width,i.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function D(t){let r=n.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");var s=r.__webglFramebuffer;if(t&&t.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(e.FRAMEBUFFER,s),!(t.depthTexture&&t.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),T(t.depthTexture,0);let o=n.get(t.depthTexture).__webglTexture,c=F(t);if(1026===t.depthTexture.format)B(t)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0);else if(1027===t.depthTexture.format)B(t)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0);else throw Error("Unknown depthTexture format")}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=e.createRenderbuffer(),N(r.__webglDepthbuffer[n],t,!1)}else i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),N(r.__webglDepthbuffer,t,!1);i.bindFramebuffer(e.FRAMEBUFFER,null)}let U=[],O=[];function F(e){return Math.min(r.maxSamples,e.samples)}function B(e){let i=n.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function z(e,t){let i=e.colorSpace,n=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||i!==a7&&""!==i&&(sE.getTransfer(i)===si?(1023!==n||1009!==r)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),t}function k(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(h.width=e.naturalWidth||e.width,h.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(h.width=e.displayWidth,h.height=e.displayHeight):(h.width=e.width,h.height=e.height),h}this.allocateTextureUnit=function(){let e=E;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=T,this.setTexture2DArray=function(t,r){let a=n.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){let a=n.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){let o=n.get(t);t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let l=P(t,s),c=s.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let h=n.get(c);if(c.version!==h.__version||!0===l){let t;i.activeTexture(e.TEXTURE0+o);let n=sE.getPrimaries(sE.workingColorSpace),u=""===s.colorSpace?null:sE.getPrimaries(s.colorSpace),d=""===s.colorSpace||n===u?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,x=[];for(let e=0;e<6;e++)p||f?x[e]=f?s.image[e].image:s.image[e]:x[e]=m(s.image[e],!0,r.maxCubemapSize),x[e]=z(s,x[e]);let M=x[0],S=a.convert(s.format,s.colorSpace),b=a.convert(s.type),E=_(s.internalFormat,S,b,s.colorSpace),T=!0!==s.isVideoTexture,w=void 0===h.__version||!0===l,A=c.dataReady,R=y(s,M);if(C(e.TEXTURE_CUBE_MAP,s),p){T&&w&&i.texStorage2D(e.TEXTURE_CUBE_MAP,R,E,M.width,M.height);for(let n=0;n<6;n++){t=x[n].mipmaps;for(let r=0;r<t.length;r++){let a=t[r];1023!==s.format?null!==S?T?A&&i.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,S,a.data):i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,E,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,S,b,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,E,a.width,a.height,0,S,b,a.data)}}}else{if(t=s.mipmaps,T&&w){t.length>0&&R++;let n=k(x[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,R,E,n.width,n.height)}for(let n=0;n<6;n++)if(f){T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,x[n].width,x[n].height,S,b,x[n].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,E,x[n].width,x[n].height,0,S,b,x[n].data);for(let r=0;r<t.length;r++){let a=t[r].image[n].image;T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,a.width,a.height,S,b,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,E,a.width,a.height,0,S,b,a.data)}}else{T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,S,b,x[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,E,S,b,x[n]);for(let r=0;r<t.length;r++){let a=t[r];T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,S,b,a.image[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,E,S,b,a.image[n])}}}g(s)&&v(e.TEXTURE_CUBE_MAP),h.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,i,r){let a=n.get(t);void 0!==i&&I(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&D(t)},this.setupRenderTarget=function(t){let r=t.texture,o=n.get(t),l=n.get(r);t.addEventListener("dispose",S);let c=t.textures,h=!0===t.isWebGLCubeRenderTarget,u=c.length>1;if(!u&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let i=0;i<r.mipmaps.length;i++)o.__webglFramebuffer[t][i]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(u)for(let t=0,i=c.length;t<i;t++){let i=n.get(c[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===B(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<c.length;i++){let n=c[i];o.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[i]);let r=a.convert(n.format,n.colorSpace),s=a.convert(n.type),l=_(n.internalFormat,r,s,n.colorSpace,!0===t.isXRRenderTarget),h=F(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+i,e.RENDERBUFFER,o.__webglColorRenderbuffer[i])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),N(o.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),C(e.TEXTURE_CUBE_MAP,r);for(let i=0;i<6;i++)if(r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)I(o.__webglFramebuffer[i][n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else I(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);g(r)&&v(e.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let r=0,a=c.length;r<a;r++){let a=c[r],s=n.get(a);i.bindTexture(e.TEXTURE_2D,s.__webglTexture),C(e.TEXTURE_2D,a),I(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(a)&&v(e.TEXTURE_2D)}i.unbindTexture()}else{let n=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(n=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),C(n,r),r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)I(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,n,i);else I(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,n,0);g(r)&&v(n),i.unbindTexture()}t.depthBuffer&&D(t)},this.updateRenderTargetMipmap=function(t){let r=t.textures;for(let a=0,s=r.length;a<s;a++){let s=r[a];if(g(s)){let r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=n.get(s).__webglTexture;i.bindTexture(r,a),v(r),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===B(t)){let r=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=n.get(t),u=r.length>1;if(u)for(let t=0;t<r.length;t++)i.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),i.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);i.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<r.length;i++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),u){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[i]);let t=n.get(r[i]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===c&&(U.length=0,O.length=0,U.push(e.COLOR_ATTACHMENT0+i),t.depthBuffer&&!1===t.resolveDepthBuffer&&(U.push(l),O.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,O)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,U))}if(i.bindFramebuffer(e.READ_FRAMEBUFFER,null),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),u)for(let t=0;t<r.length;t++){i.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);let a=n.get(r[t]).__webglTexture;i.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}i.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&c){let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[i])}}},this.setupDepthRenderbuffer=D,this.setupFrameBufferTexture=I,this.useMultisampledRTT=B}function hW(e,t){return{convert:function(i,n=""){let r,a=sE.getTransfer(n);if(1009===i)return e.UNSIGNED_BYTE;if(1017===i)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===i)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===i)return e.BYTE;if(1011===i)return e.SHORT;if(1012===i)return e.UNSIGNED_SHORT;if(1013===i)return e.INT;if(1014===i)return e.UNSIGNED_INT;if(1015===i)return e.FLOAT;if(1016===i)return e.HALF_FLOAT;if(1021===i)return e.ALPHA;if(1022===i)return e.RGB;if(1023===i)return e.RGBA;if(1024===i)return e.LUMINANCE;if(1025===i)return e.LUMINANCE_ALPHA;if(1026===i)return e.DEPTH_COMPONENT;if(1027===i)return e.DEPTH_STENCIL;if(1028===i)return e.RED;if(1029===i)return e.RED_INTEGER;if(1030===i)return e.RG;if(1031===i)return e.RG_INTEGER;if(1033===i)return e.RGBA_INTEGER;if(33776===i||33777===i||33778===i||33779===i)if(a===si){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i||37492===i||37496===i){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(36196===i||37492===i)return a===si?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return a===si?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i||36494===i||36495===i){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return a===si?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(36492===i)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?e.UNSIGNED_INT_24_8:void 0!==e[i]?e[i]:null}}}class hj extends lC{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class hX extends oP{constructor(){super(),this.isGroup=!0,this.type="Group"}}let hq={type:"move"};class hY{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new hX,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new hX,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new sB,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new sB),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new hX,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new sB,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new sB),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let 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}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let n=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let n of(a=!0,e.hand.values())){let e=t.getJointPose(n,i),r=this._getHandJoint(l,n);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}let n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,i))&&(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);null!==s&&(null===(n=t.getPose(e.targetRaySpace,i))&&null!==r&&(n=r),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(hq)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new hX;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}let hK=`
599
+ void main() {
600
+
601
+ gl_Position = vec4( position, 1.0 );
602
+
603
+ }`,hZ=`
604
+ uniform sampler2DArray depthColor;
605
+ uniform float depthWidth;
606
+ uniform float depthHeight;
607
+
608
+ void main() {
609
+
610
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
611
+
612
+ if ( coord.x >= 1.0 ) {
613
+
614
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
615
+
616
+ } else {
617
+
618
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
619
+
620
+ }
621
+
622
+ }`;class h${constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(null===this.texture){let n=new sI;e.properties.get(n).__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,i=new lE({vertexShader:hK,fragmentShader:hZ,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new l_(new lH(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}}class hJ extends sa{constructor(e,t){super();const i=this;let n=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,p=null;const f=new h$,m=t.getContextAttributes();let g=null,v=null;const _=[],x=[],y=new sp;let M=null;const S=new lC;S.layers.enable(1),S.viewport=new sN;const b=new lC;b.layers.enable(2),b.viewport=new sN;const E=[S,b],T=new hj;T.layers.enable(1),T.layers.enable(2);let w=null,A=null;function R(e){let t=x.indexOf(e.inputSource);if(-1===t)return;let i=_[t];void 0!==i&&(i.update(e.inputSource,e.frame,l||a),i.dispatchEvent({type:e.type,data:e.inputSource}))}function C(){n.removeEventListener("select",R),n.removeEventListener("selectstart",R),n.removeEventListener("selectend",R),n.removeEventListener("squeeze",R),n.removeEventListener("squeezestart",R),n.removeEventListener("squeezeend",R),n.removeEventListener("end",C),n.removeEventListener("inputsourceschange",P);for(let e=0;e<_.length;e++){let t=x[e];null!==t&&(x[e]=null,_[e].disconnect(t))}w=null,A=null,f.reset(),e.setRenderTarget(g),d=null,u=null,h=null,n=null,v=null,U.stop(),i.isPresenting=!1,e.setPixelRatio(M),e.setSize(y.width,y.height,!1),i.dispatchEvent({type:"sessionend"})}function P(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],n=x.indexOf(i);n>=0&&(x[n]=null,_[n].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],n=x.indexOf(i);if(-1===n){for(let e=0;e<_.length;e++)if(e>=x.length){x.push(i),n=e;break}else if(null===x[e]){x[e]=i,n=e;break}if(-1===n)break}let r=_[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=_[e];return void 0===t&&(t=new hY,_[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=_[e];return void 0===t&&(t=new hY,_[e]=t),t.getGripSpace()},this.getHand=function(e){let t=_[e];return void 0===t&&(t=new hY,_[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(null!==(n=c)){if(g=e.getRenderTarget(),n.addEventListener("select",R),n.addEventListener("selectstart",R),n.addEventListener("selectend",R),n.addEventListener("squeeze",R),n.addEventListener("squeezestart",R),n.addEventListener("squeezeend",R),n.addEventListener("end",C),n.addEventListener("inputsourceschange",P),!0!==m.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(y),void 0===n.renderState.layers){let i={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(n,t,i),n.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),v=new sU(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let i=null,a=null,s=null;m.depth&&(s=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=m.stencil?1027:1026,a=m.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};u=(h=new XRWebGLBinding(n,t)).createProjectionLayer(o),n.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),v=new sU(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new cf(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:4*!!m.antialias,resolveDepthBuffer:!1===u.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await n.requestReferenceSpace(s),U.setContext(n),U.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};const L=new sB,I=new sB;function N(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,i,r;if(null===n)return;null!==f.texture&&(e.near=f.depthNear,e.far=f.depthFar),T.near=b.near=S.near=e.near,T.far=b.far=S.far=e.far,(w!==T.near||A!==T.far)&&(n.updateRenderState({depthNear:T.near,depthFar:T.far}),w=T.near,A=T.far,S.near=w,S.far=A,b.near=w,b.far=A,S.updateProjectionMatrix(),b.updateProjectionMatrix(),e.updateProjectionMatrix());let a=e.parent,s=T.cameras;N(T,a);for(let e=0;e<s.length;e++)N(s[e],a);if(2===s.length){let e,t,i,n,r,a,s,o,l,c,h,u,d;L.setFromMatrixPosition(S.matrixWorld),I.setFromMatrixPosition(b.matrixWorld),e=L.distanceTo(I),t=S.projectionMatrix.elements,i=b.projectionMatrix.elements,n=t[14]/(t[10]-1),r=t[14]/(t[10]+1),a=(t[9]+1)/t[5],s=(t[9]-1)/t[5],o=(t[8]-1)/t[0],h=-((c=e/(-o+(l=(i[8]+1)/i[0])))*o),S.matrixWorld.decompose(T.position,T.quaternion,T.scale),T.translateX(h),T.translateZ(c),T.matrixWorld.compose(T.position,T.quaternion,T.scale),T.matrixWorldInverse.copy(T.matrixWorld).invert(),u=n+c,d=r+c,T.projectionMatrix.makePerspective(n*o-h,n*l+(e-h),a*r/d*u,s*r/d*u,u,d),T.projectionMatrixInverse.copy(T.projectionMatrix).invert()}else T.projectionMatrix.copy(S.projectionMatrix);t=e,i=T,null===(r=a)?t.matrix.copy(i.matrixWorld):(t.matrix.copy(r.matrixWorld),t.matrix.invert(),t.matrix.multiply(i.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(i.projectionMatrix),t.projectionMatrixInverse.copy(i.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*sl*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return T},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(e){o=e,null!==u&&(u.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(T)};let D=null;const U=new lk;U.setAnimationLoop(function(t,r){if(c=r.getViewerPose(l||a),p=r,null!==c){let t=c.views;null!==d&&(e.setRenderTargetFramebuffer(v,d.framebuffer),e.setRenderTarget(v));let i=!1;t.length!==T.cameras.length&&(T.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(null!==d)a=d.getViewport(r);else{let t=h.getViewSubImage(u,r);a=t.viewport,0===n&&(e.setRenderTargetTextures(v,t.colorTexture,u.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(v))}let s=E[n];void 0===s&&((s=new lC).layers.enable(n),s.viewport=new sN,E[n]=s),s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(r.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===n&&(T.matrix.copy(s.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),!0===i&&T.cameras.push(s)}let r=n.enabledFeatures;if(r&&r.includes("depth-sensing")){let i=h.getDepthInformation(t[0]);i&&i.isValid&&i.texture&&f.init(e,i,n.renderState)}}for(let e=0;e<_.length;e++){let t=x[e],i=_[e];null!==t&&void 0!==i&&i.update(t,r,l||a)}D&&D(t,r),r.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:r}),p=null}),this.setAnimationLoop=function(e){D=e},this.dispose=function(){}}}let hQ=new op,h0=new on;function h1(e,t){function i(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function n(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map,i(n.map,e.mapTransform)),n.alphaMap&&(e.alphaMap.value=n.alphaMap,i(n.alphaMap,e.alphaMapTransform)),n.bumpMap&&(e.bumpMap.value=n.bumpMap,i(n.bumpMap,e.bumpMapTransform),e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,i(n.normalMap,e.normalMapTransform),e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,i(n.displacementMap,e.displacementMapTransform),e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap,i(n.emissiveMap,e.emissiveMapTransform)),n.specularMap&&(e.specularMap.value=n.specularMap,i(n.specularMap,e.specularMapTransform)),n.alphaTest>0&&(e.alphaTest.value=n.alphaTest);let r=t.get(n),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,hQ.copy(s),hQ.x*=-1,hQ.y*=-1,hQ.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(hQ.y*=-1,hQ.z*=-1),e.envMapRotation.value.setFromMatrix4(h0.makeRotationFromEuler(hQ)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio),n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity,i(n.lightMap,e.lightMapTransform)),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity,i(n.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,lb(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,a,s,o){var l,c,h,u,d,p,f,m,g,v,_,x,y,M,S,b,E,T,w,A,R,C,P;let L;r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),l=e,(c=r).gradientMap&&(l.gradientMap.value=c.gradientMap)):r.isMeshPhongMaterial?(n(e,r),h=e,u=r,h.specular.value.copy(u.specular),h.shininess.value=Math.max(u.shininess,1e-4)):r.isMeshStandardMaterial?(n(e,r),d=e,p=r,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,i(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,i(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),r.isMeshPhysicalMaterial&&(f=e,m=r,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,i(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,i(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,i(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,i(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,i(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),1===m.side&&f.clearcoatNormalScale.value.negate())),m.dispersion>0&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,i(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,i(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,i(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,i(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,i(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,i(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,i(m.specularIntensityMap,f.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(n(e,r),v=e,(_=r).matcap&&(v.matcap.value=_.matcap)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),x=e,y=r,L=t.get(y).light,x.referencePosition.value.setFromMatrixPosition(L.matrixWorld),x.nearDistance.value=L.shadow.camera.near,x.farDistance.value=L.shadow.camera.far):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(M=e,S=r,M.diffuse.value.copy(S.color),M.opacity.value=S.opacity,S.map&&(M.map.value=S.map,i(S.map,M.mapTransform)),r.isLineDashedMaterial&&(b=e,E=r,b.dashSize.value=E.dashSize,b.totalSize.value=E.dashSize+E.gapSize,b.scale.value=E.scale)):r.isPointsMaterial?(T=e,w=r,A=a,R=s,T.diffuse.value.copy(w.color),T.opacity.value=w.opacity,T.size.value=w.size*A,T.scale.value=.5*R,w.map&&(T.map.value=w.map,i(w.map,T.uvTransform)),w.alphaMap&&(T.alphaMap.value=w.alphaMap,i(w.alphaMap,T.alphaMapTransform)),w.alphaTest>0&&(T.alphaTest.value=w.alphaTest)):r.isSpriteMaterial?(C=e,P=r,C.diffuse.value.copy(P.color),C.opacity.value=P.opacity,C.rotation.value=P.rotation,P.map&&(C.map.value=P.map,i(P.map,C.mapTransform)),P.alphaMap&&(C.alphaMap.value=P.alphaMap,i(P.alphaMap,C.alphaMapTransform)),P.alphaTest>0&&(C.alphaTest.value=P.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function h2(e,t,i,n){let r={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){let i=t.target;i.removeEventListener("dispose",c);let n=s.indexOf(i.__bindingPointIndex);s.splice(n,1),e.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;n.uniformBlockBinding(e,i)},update:function(i,h){var u;let d,p,f,m,g=r[i.id];void 0===g&&(function(e){let t=e.uniforms,i=0;for(let e=0,n=t.length;e<n;e++){let n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=n.length;e<t;e++){let t=n[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,n=r.length;e<n;e++){let n=l(r[e]),a=i%16;0!==a&&16-a<n.boundary&&(i+=16-a),t.__data=new Float32Array(n.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,i+=n.storage}}}let n=i%16;n>0&&(i+=16-n),e.__size=i,e.__cache={}}(i),(u=i).__bindingPointIndex=d=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),p=e.createBuffer(),f=u.__size,m=u.usage,e.bindBuffer(e.UNIFORM_BUFFER,p),e.bufferData(e.UNIFORM_BUFFER,f,m),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,d,p),g=p,r[i.id]=g,i.addEventListener("dispose",c));let v=h.program;n.updateUBOMapping(i,v);let _=t.render.frame;a[i.id]!==_&&(function(t){let i=r[t.id],n=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,i);for(let t=0,i=n.length;t<i;t++){let i=Array.isArray(n[t])?n[t]:[n[t]];for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!0===function(e,t,i,n){let r=e.value,a=t+"_"+i;if(void 0===n[a])return"number"==typeof r||"boolean"==typeof r?n[a]=r:n[a]=r.clone(),!0;{let e=n[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return n[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}(r,t,n,a)){let t=r.__offset,i=Array.isArray(r.value)?r.value:[r.value],n=0;for(let a=0;a<i.length;a++){let s=i[a],o=l(s);"number"==typeof s||"boolean"==typeof s?(r.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+n,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=0,r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=0,r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=0):(s.toArray(r.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(i),a[i.id]=_)},dispose:function(){for(let t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}class h3{constructor(e={}){let t,i,n,r,a,s,o,l,c,h,u,d,p,f,m,g,v,_,x,y,M,S,b,E,T;const{canvas:w=function(){let e=sv("canvas");return e.style.display="block",e}(),context:A=null,depth:R=!0,stencil:C=!1,alpha:P=!1,antialias:L=!1,premultipliedAlpha:I=!0,preserveDrawingBuffer:N=!1,powerPreference:D="default",failIfMajorPerformanceCaveat:U=!1}=e;if(this.isWebGLRenderer=!0,null!==A){if("u">typeof WebGLRenderingContext&&A instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=A.getContextAttributes().alpha}else t=P;const O=new Uint32Array(4),F=new Int32Array(4);let B=null,z=null;const k=[],V=[];this.domElement=w,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=a8,this.toneMapping=0,this.toneMappingExposure=1;const H=this;let G=!1,W=0,j=0,X=null,q=-1,Y=null;const K=new sN,Z=new sN;let $=null;const J=new oX(0);let Q=0,ee=w.width,et=w.height,ei=1,en=null,er=null;const ea=new sN(0,0,ee,et),es=new sN(0,0,ee,et);let eo=!1;const el=new lz;let ec=!1,eh=!1;const eu=new on,ed=new sB,ep={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ef=!1;function em(){return null===X?ei:1}let eg=A;function ev(e,t){return w.getContext(e,t)}try{if("setAttribute"in w&&w.setAttribute("data-engine","three.js r165"),w.addEventListener("webglcontextlost",ey,!1),w.addEventListener("webglcontextrestored",eM,!1),w.addEventListener("webglcontextcreationerror",eS,!1),null===eg){const e="webgl2";if(eg=ev(e,{alpha:!0,depth:R,stencil:C,antialias:L,premultipliedAlpha:I,preserveDrawingBuffer:N,powerPreference:D,failIfMajorPerformanceCaveat:U}),null===eg)if(ev(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function e_(){(i=new cl(eg)).init(),b=new hW(eg,i),n=new lJ(eg,i,e,b),r=new hH(eg),a=new cu(eg),s=new hR,o=new hG(eg,i,r,s,n,b,a),l=new l0(H),c=new co(H),h=new lV(eg),E=new lZ(eg,h),u=new cc(eg,h,a,E),d=new cp(eg,u,h,a),y=new cd(eg,n,o),v=new lQ(s),p=new hA(H,l,c,i,n,E,v),f=new h1(H,s),m=new hI,g=new hB(i),x=new lK(H,l,c,r,d,t,I),_=new hV(H,d,n),T=new h2(eg,a,n,r),M=new l$(eg,i,a),S=new ch(eg,i,a),a.programs=p.programs,H.capabilities=n,H.extensions=i,H.properties=s,H.renderLists=m,H.shadowMap=_,H.state=r,H.info=a}e_();const ex=new hJ(H,eg);function ey(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),G=!0}function eM(){console.log("THREE.WebGLRenderer: Context Restored."),G=!1;let e=a.autoReset,t=_.enabled,i=_.autoUpdate,n=_.needsUpdate,r=_.type;e_(),a.autoReset=e,_.enabled=t,_.autoUpdate=i,_.needsUpdate=n,_.type=r}function eS(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eb(e){var t,i;let n,r=e.target;r.removeEventListener("dispose",eb),i=t=r,void 0!==(n=s.get(i).programs)&&(n.forEach(function(e){p.releaseProgram(e)}),i.isShaderMaterial&&p.releaseShaderCache(i)),s.remove(t)}function eE(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eD(e,t,i),e.side=0,e.needsUpdate=!0,eD(e,t,i),e.side=2):eD(e,t,i)}this.xr=ex,this.getContext=function(){return eg},this.getContextAttributes=function(){return eg.getContextAttributes()},this.forceContextLoss=function(){let e=i.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=i.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ei},this.setPixelRatio=function(e){void 0!==e&&(ei=e,this.setSize(ee,et,!1))},this.getSize=function(e){return e.set(ee,et)},this.setSize=function(e,t,i=!0){ex.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(ee=e,et=t,w.width=Math.floor(e*ei),w.height=Math.floor(t*ei),!0===i&&(w.style.width=e+"px",w.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(ee*ei,et*ei).floor()},this.setDrawingBufferSize=function(e,t,i){ee=e,et=t,ei=i,w.width=Math.floor(e*i),w.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(K)},this.getViewport=function(e){return e.copy(ea)},this.setViewport=function(e,t,i,n){e.isVector4?ea.set(e.x,e.y,e.z,e.w):ea.set(e,t,i,n),r.viewport(K.copy(ea).multiplyScalar(ei).round())},this.getScissor=function(e){return e.copy(es)},this.setScissor=function(e,t,i,n){e.isVector4?es.set(e.x,e.y,e.z,e.w):es.set(e,t,i,n),r.scissor(Z.copy(es).multiplyScalar(ei).round())},this.getScissorTest=function(){return eo},this.setScissorTest=function(e){r.setScissorTest(eo=e)},this.setOpaqueSort=function(e){en=e},this.setTransparentSort=function(e){er=e},this.getClearColor=function(e){return e.copy(x.getClearColor())},this.setClearColor=function(){x.setClearColor.apply(x,arguments)},this.getClearAlpha=function(){return x.getClearAlpha()},this.setClearAlpha=function(){x.setClearAlpha.apply(x,arguments)},this.clear=function(e=!0,t=!0,i=!0){let n=0;if(e){let e=!1;if(null!==X){let t=X.texture.format;e=1033===t||1031===t||1029===t}if(e){let e=X.texture.type,t=1009===e||1014===e||1012===e||1020===e||1017===e||1018===e,i=x.getClearColor(),n=x.getClearAlpha(),r=i.r,a=i.g,s=i.b;t?(O[0]=r,O[1]=a,O[2]=s,O[3]=n,eg.clearBufferuiv(eg.COLOR,0,O)):(F[0]=r,F[1]=a,F[2]=s,F[3]=n,eg.clearBufferiv(eg.COLOR,0,F))}else n|=eg.COLOR_BUFFER_BIT}t&&(n|=eg.DEPTH_BUFFER_BIT),i&&(n|=eg.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),eg.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){w.removeEventListener("webglcontextlost",ey,!1),w.removeEventListener("webglcontextrestored",eM,!1),w.removeEventListener("webglcontextcreationerror",eS,!1),m.dispose(),g.dispose(),s.dispose(),l.dispose(),c.dispose(),d.dispose(),E.dispose(),T.dispose(),p.dispose(),ex.dispose(),ex.removeEventListener("sessionstart",ew),ex.removeEventListener("sessionend",eA),eR.stop()},this.renderBufferDirect=function(e,t,i,a,d,p){let m;null===t&&(t=ep);let g=d.isMesh&&0>d.matrixWorld.determinant(),_=function(e,t,i,a,h){var u,d;!0!==t.isScene&&(t=ep),o.resetTextureUnits();let p=t.fog,m=a.isMeshStandardMaterial?t.environment:null,g=null===X?H.outputColorSpace:!0===X.isXRRenderTarget?X.texture.colorSpace:a7,_=(a.isMeshStandardMaterial?c:l).get(a.envMap||m),x=!0===a.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,M=!!i.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!i.morphAttributes.position,b=!!i.morphAttributes.normal,E=!!i.morphAttributes.color,w=0;a.toneMapped&&(null===X||!0===X.isXRRenderTarget)&&(w=H.toneMapping);let A=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,R=void 0!==A?A.length:0,C=s.get(a),P=z.state.lights;if(!0===ec&&(!0===eh||e!==Y)){let t=e===Y&&a.id===q;v.setState(a,e,t)}let L=!1;a.version===C.__version?C.needsLights&&C.lightsStateVersion!==P.state.version||C.outputColorSpace!==g||h.isBatchedMesh&&!1===C.batching?L=!0:h.isBatchedMesh||!0!==C.batching?h.isBatchedMesh&&!0===C.batchingColor&&null===h.colorTexture||h.isBatchedMesh&&!1===C.batchingColor&&null!==h.colorTexture||h.isInstancedMesh&&!1===C.instancing?L=!0:h.isInstancedMesh||!0!==C.instancing?h.isSkinnedMesh&&!1===C.skinning?L=!0:h.isSkinnedMesh||!0!==C.skinning?h.isInstancedMesh&&!0===C.instancingColor&&null===h.instanceColor||h.isInstancedMesh&&!1===C.instancingColor&&null!==h.instanceColor||h.isInstancedMesh&&!0===C.instancingMorph&&null===h.morphTexture||h.isInstancedMesh&&!1===C.instancingMorph&&null!==h.morphTexture||C.envMap!==_||!0===a.fog&&C.fog!==p||void 0!==C.numClippingPlanes&&(C.numClippingPlanes!==v.numPlanes||C.numIntersection!==v.numIntersection)||C.vertexAlphas!==x||C.vertexTangents!==M||C.morphTargets!==S||C.morphNormals!==b||C.morphColors!==E||C.toneMapping!==w?L=!0:C.morphTargetsCount!==R&&(L=!0):L=!0:L=!0:L=!0:(L=!0,C.__version=a.version);let I=C.currentProgram;!0===L&&(I=eD(a,t,h));let N=!1,D=!1,U=!1,O=I.getUniforms(),F=C.uniforms;if(r.useProgram(I.program)&&(N=!0,D=!0,U=!0),a.id!==q&&(q=a.id,D=!0),N||Y!==e){O.setValue(eg,"projectionMatrix",e.projectionMatrix),O.setValue(eg,"viewMatrix",e.matrixWorldInverse);let t=O.map.cameraPosition;void 0!==t&&t.setValue(eg,ed.setFromMatrixPosition(e.matrixWorld)),n.logarithmicDepthBuffer&&O.setValue(eg,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&O.setValue(eg,"isOrthographic",!0===e.isOrthographicCamera),Y!==e&&(Y=e,D=!0,U=!0)}if(h.isSkinnedMesh){O.setOptional(eg,h,"bindMatrix"),O.setOptional(eg,h,"bindMatrixInverse");let e=h.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eg,"boneTexture",e.boneTexture,o))}h.isBatchedMesh&&(O.setOptional(eg,h,"batchingTexture"),O.setValue(eg,"batchingTexture",h._matricesTexture,o),O.setOptional(eg,h,"batchingColorTexture"),null!==h._colorsTexture&&O.setValue(eg,"batchingColorTexture",h._colorsTexture,o));let B=i.morphAttributes;if((void 0!==B.position||void 0!==B.normal||void 0!==B.color)&&y.update(h,i,I),(D||C.receiveShadow!==h.receiveShadow)&&(C.receiveShadow=h.receiveShadow,O.setValue(eg,"receiveShadow",h.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(F.envMap.value=_,F.flipEnvMap.value=_.isCubeTexture&&!1===_.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(F.envMapIntensity.value=t.environmentIntensity),D&&(O.setValue(eg,"toneMappingExposure",H.toneMappingExposure),C.needsLights&&(u=F,d=U,u.ambientLightColor.needsUpdate=d,u.lightProbe.needsUpdate=d,u.directionalLights.needsUpdate=d,u.directionalLightShadows.needsUpdate=d,u.pointLights.needsUpdate=d,u.pointLightShadows.needsUpdate=d,u.spotLights.needsUpdate=d,u.spotLightShadows.needsUpdate=d,u.rectAreaLights.needsUpdate=d,u.hemisphereLights.needsUpdate=d),p&&!0===a.fog&&f.refreshFogUniforms(F,p),f.refreshMaterialUniforms(F,a,ei,et,z.state.transmissionRenderTarget[e.id]),hl.upload(eg,eU(C),F,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(hl.upload(eg,eU(C),F,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&O.setValue(eg,"center",h.center),O.setValue(eg,"modelViewMatrix",h.modelViewMatrix),O.setValue(eg,"normalMatrix",h.normalMatrix),O.setValue(eg,"modelMatrix",h.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,i=e.length;t<i;t++){let i=e[t];T.update(i,I),T.bind(i,I)}}return I}(e,t,i,a,d);r.setMaterial(a,g);let x=i.index,b=1;if(!0===a.wireframe){if(void 0===(x=u.getWireframeAttribute(i)))return;b=2}let w=i.drawRange,A=i.attributes.position,R=w.start*b,C=(w.start+w.count)*b;null!==p&&(R=Math.max(R,p.start*b),C=Math.min(C,(p.start+p.count)*b)),null!==x?(R=Math.max(R,0),C=Math.min(C,x.count)):null!=A&&(R=Math.max(R,0),C=Math.min(C,A.count));let P=C-R;if(P<0||P===1/0)return;E.setup(d,a,_,i,x);let L=M;if(null!==x&&(m=h.get(x),(L=S).setIndex(m)),d.isMesh)!0===a.wireframe?(r.setLineWidth(a.wireframeLinewidth*em()),L.setMode(eg.LINES)):L.setMode(eg.TRIANGLES);else if(d.isLine){let e=a.linewidth;void 0===e&&(e=1),r.setLineWidth(e*em()),d.isLineSegments?L.setMode(eg.LINES):d.isLineLoop?L.setMode(eg.LINE_LOOP):L.setMode(eg.LINE_STRIP)}else d.isPoints?L.setMode(eg.POINTS):d.isSprite&&L.setMode(eg.TRIANGLES);if(d.isBatchedMesh)null!==d._multiDrawInstances?L.renderMultiDrawInstances(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount,d._multiDrawInstances):L.renderMultiDraw(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount);else if(d.isInstancedMesh)L.renderInstances(R,P,d.count);else if(i.isInstancedBufferGeometry){let e=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,t=Math.min(i.instanceCount,e);L.renderInstances(R,P,t)}else L.render(R,P)},this.compile=function(e,t,i=null){null===i&&(i=e),(z=g.get(i)).init(t),V.push(z),i.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(z.pushLight(e),e.castShadow&&z.pushShadow(e))}),e!==i&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(z.pushLight(e),e.castShadow&&z.pushShadow(e))}),z.setupLights();let n=new Set;return e.traverse(function(e){let t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){let a=t[r];eE(a,i,e),n.add(a)}else eE(t,i,e),n.add(t)}),V.pop(),z=null,n},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){(r.forEach(function(e){s.get(e).currentProgram.isReady()&&r.delete(e)}),0===r.size)?t(e):setTimeout(n,10)}null!==i.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let eT=null;function ew(){eR.stop()}function eA(){eR.start()}const eR=new lk;function eC(e,t,i,n){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)z.pushLight(e),e.castShadow&&z.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||el.intersectsSprite(e)){n&&ed.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eu);let t=d.update(e),r=e.material;r.visible&&B.push(e,t,r,i,ed.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||el.intersectsObject(e))){let t=d.update(e),r=e.material;if(n&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ed.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ed.copy(t.boundingSphere.center)),ed.applyMatrix4(e.matrixWorld).applyMatrix4(eu)),Array.isArray(r)){let n=t.groups;for(let a=0,s=n.length;a<s;a++){let s=n[a],o=r[s.materialIndex];o&&o.visible&&B.push(e,t,o,i,ed.z,s)}}else r.visible&&B.push(e,t,r,i,ed.z,null)}}let r=e.children;for(let e=0,a=r.length;e<a;e++)eC(r[e],t,i,n)}function eP(e,t,i,n){let a=e.opaque,s=e.transmissive,o=e.transparent;z.setupLightsView(i),!0===ec&&v.setGlobalState(H.clippingPlanes,i),n&&r.viewport(K.copy(n)),a.length>0&&eI(a,t,i),s.length>0&&eI(s,t,i),o.length>0&&eI(o,t,i),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eL(e,t,n,r){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===z.state.transmissionRenderTarget[r.id]&&(z.state.transmissionRenderTarget[r.id]=new sU(1,1,{generateMipmaps:!0,type:i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float")?1016:1009,minFilter:1008,samples:4,stencilBuffer:C,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:sE.workingColorSpace}));let a=z.state.transmissionRenderTarget[r.id],s=r.viewport||K;a.setSize(s.z,s.w);let l=H.getRenderTarget();H.setRenderTarget(a),H.getClearColor(J),(Q=H.getClearAlpha())<1&&H.setClearColor(0xffffff,.5),ef?x.render(n):H.clear();let c=H.toneMapping;H.toneMapping=0;let h=r.viewport;if(void 0!==r.viewport&&(r.viewport=void 0),z.setupLightsView(r),!0===ec&&v.setGlobalState(H.clippingPlanes,r),eI(e,n,r),o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a),!1===i.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,a=t.length;i<a;i++){let a=t[i],s=a.object,o=a.geometry,l=a.material,c=a.group;if(2===l.side&&s.layers.test(r.layers)){let t=l.side;l.side=1,l.needsUpdate=!0,eN(s,n,r,o,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a))}H.setRenderTarget(l),H.setClearColor(J,Q),void 0!==h&&(r.viewport=h),H.toneMapping=c}function eI(e,t,i){let n=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){let a=e[r],s=a.object,o=a.geometry,l=null===n?a.material:n,c=a.group;s.layers.test(i.layers)&&eN(s,t,i,o,l,c)}}function eN(e,t,i,n,r,a){e.onBeforeRender(H,t,i,n,r,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(H,t,i,n,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,H.renderBufferDirect(i,t,n,r,e,a),r.side=0,r.needsUpdate=!0,H.renderBufferDirect(i,t,n,r,e,a),r.side=2):H.renderBufferDirect(i,t,n,r,e,a),e.onAfterRender(H,t,i,n,r,a)}function eD(e,t,i){var n;!0!==t.isScene&&(t=ep);let r=s.get(e),a=z.state.lights,o=z.state.shadowsArray,h=a.state.version,u=p.getParameters(e,a.state,o,t,i),d=p.getProgramCacheKey(u),f=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?c:l).get(e.envMap||r.environment),r.envMapRotation=null!==r.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===f&&(e.addEventListener("dispose",eb),r.programs=f=new Map);let m=f.get(d);if(void 0!==m){if(r.currentProgram===m&&r.lightsStateVersion===h)return eO(e,u),m}else u.uniforms=p.getUniforms(e),e.onBuild(i,u,H),e.onBeforeCompile(u,H),m=p.acquireProgram(u,d),f.set(d,m),r.uniforms=u.uniforms;let g=r.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(g.clippingPlanes=v.uniform),eO(e,u),r.needsLights=(n=e).isMeshLambertMaterial||n.isMeshToonMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isShadowMaterial||n.isShaderMaterial&&!0===n.lights,r.lightsStateVersion=h,r.needsLights&&(g.ambientLightColor.value=a.state.ambient,g.lightProbe.value=a.state.probe,g.directionalLights.value=a.state.directional,g.directionalLightShadows.value=a.state.directionalShadow,g.spotLights.value=a.state.spot,g.spotLightShadows.value=a.state.spotShadow,g.rectAreaLights.value=a.state.rectArea,g.ltc_1.value=a.state.rectAreaLTC1,g.ltc_2.value=a.state.rectAreaLTC2,g.pointLights.value=a.state.point,g.pointLightShadows.value=a.state.pointShadow,g.hemisphereLights.value=a.state.hemi,g.directionalShadowMap.value=a.state.directionalShadowMap,g.directionalShadowMatrix.value=a.state.directionalShadowMatrix,g.spotShadowMap.value=a.state.spotShadowMap,g.spotLightMatrix.value=a.state.spotLightMatrix,g.spotLightMap.value=a.state.spotLightMap,g.pointShadowMap.value=a.state.pointShadowMap,g.pointShadowMatrix.value=a.state.pointShadowMatrix),r.currentProgram=m,r.uniformsList=null,m}function eU(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=hl.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function eO(e,t){let i=s.get(e);i.outputColorSpace=t.outputColorSpace,i.batching=t.batching,i.batchingColor=t.batchingColor,i.instancing=t.instancing,i.instancingColor=t.instancingColor,i.instancingMorph=t.instancingMorph,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eR.setAnimationLoop(function(e){eT&&eT(e)}),"u">typeof self&&eR.setContext(self),this.setAnimationLoop=function(e){eT=e,ex.setAnimationLoop(e),null===e?eR.stop():eR.start()},ex.addEventListener("sessionstart",ew),ex.addEventListener("sessionend",eA),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===G)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===ex.enabled&&!0===ex.isPresenting&&(!0===ex.cameraAutoUpdate&&ex.updateCamera(t),t=ex.getCamera()),!0===e.isScene&&e.onBeforeRender(H,e,t,X),(z=g.get(e,V.length)).init(t),V.push(z),eu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),el.setFromProjectionMatrix(eu),eh=this.localClippingEnabled,ec=v.init(this.clippingPlanes,eh),(B=m.get(e,k.length)).init(),k.push(B),!0===ex.enabled&&!0===ex.isPresenting){let e=H.xr.getDepthSensingMesh();null!==e&&eC(e,t,-1/0,H.sortObjects)}eC(e,t,0,H.sortObjects),B.finish(),!0===H.sortObjects&&B.sort(en,er),(ef=!1===ex.enabled||!1===ex.isPresenting||!1===ex.hasDepthSensing())&&x.addToRenderList(B,e),this.info.render.frame++,!0===ec&&v.beginShadows();let i=z.state.shadowsArray;_.render(i,e,t),!0===ec&&v.endShadows(),!0===this.info.autoReset&&this.info.reset();let n=B.opaque,r=B.transmissive;if(z.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++)eL(n,r,e,i[t]);ef&&x.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];eP(B,e,n,n.viewport)}}else r.length>0&&eL(n,r,e,t),ef&&x.render(e),eP(B,e,t);null!==X&&(o.updateMultisampleRenderTarget(X),o.updateRenderTargetMipmap(X)),!0===e.isScene&&e.onAfterRender(H,e,t),E.resetDefaultState(),q=-1,Y=null,V.pop(),V.length>0?(z=V[V.length-1],!0===ec&&v.setGlobalState(H.clippingPlanes,z.state.camera)):z=null,k.pop(),B=k.length>0?k[k.length-1]:null},this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return j},this.getRenderTarget=function(){return X},this.setRenderTargetTextures=function(e,t,n){s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=n;let r=s.get(e);r.__hasExternalTextures=!0,r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0!==i.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){let i=s.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,i=0){X=e,W=t,j=i;let n=!0,a=null,l=!1,c=!1;if(e){let h=s.get(e);void 0!==h.__useDefaultFramebuffer?(r.bindFramebuffer(eg.FRAMEBUFFER,null),n=!1):void 0===h.__webglFramebuffer?o.setupRenderTarget(e):h.__hasExternalTextures&&o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);let u=e.texture;(u.isData3DTexture||u.isDataArrayTexture||u.isCompressedArrayTexture)&&(c=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][i]:d[t],l=!0):a=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[i]:d,K.copy(e.viewport),Z.copy(e.scissor),$=e.scissorTest}else K.copy(ea).multiplyScalar(ei).floor(),Z.copy(es).multiplyScalar(ei).floor(),$=eo;if(r.bindFramebuffer(eg.FRAMEBUFFER,a)&&n&&r.drawBuffers(e,a),r.viewport(K),r.scissor(Z),r.setScissorTest($),l){let n=s.get(e.texture);eg.framebufferTexture2D(eg.FRAMEBUFFER,eg.COLOR_ATTACHMENT0,eg.TEXTURE_CUBE_MAP_POSITIVE_X+t,n.__webglTexture,i)}else if(c){let n=s.get(e.texture);eg.framebufferTextureLayer(eg.FRAMEBUFFER,eg.COLOR_ATTACHMENT0,n.__webglTexture,i||0,t||0)}q=-1},this.readRenderTargetPixels=function(e,t,i,a,o,l,c){if(!(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(h=h[c]),h){r.bindFramebuffer(eg.FRAMEBUFFER,h);try{let r=e.texture,s=r.format,c=r.type;if(!n.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!n.textureTypeReadable(c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o&&eg.readPixels(t,i,a,o,b.convert(s),b.convert(c),l)}finally{let e=null!==X?s.get(X).__webglFramebuffer:null;r.bindFramebuffer(eg.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,a,o,l,c){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(h=h[c]),h){r.bindFramebuffer(eg.FRAMEBUFFER,h);try{let r=e.texture,s=r.format,c=r.type;if(!n.textureFormatReadable(s))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!n.textureTypeReadable(c))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o){var u;let e=eg.createBuffer();eg.bindBuffer(eg.PIXEL_PACK_BUFFER,e),eg.bufferData(eg.PIXEL_PACK_BUFFER,l.byteLength,eg.STREAM_READ),eg.readPixels(t,i,a,o,b.convert(s),b.convert(c),0),eg.flush();let n=eg.fenceSync(eg.SYNC_GPU_COMMANDS_COMPLETE,0);await (u=eg,new Promise(function(e,t){setTimeout(function i(){switch(u.clientWaitSync(n,u.SYNC_FLUSH_COMMANDS_BIT,0)){case u.WAIT_FAILED:t();break;case u.TIMEOUT_EXPIRED:setTimeout(i,4);break;default:e()}},4)}));try{eg.bindBuffer(eg.PIXEL_PACK_BUFFER,e),eg.getBufferSubData(eg.PIXEL_PACK_BUFFER,0,l)}finally{eg.deleteBuffer(e),eg.deleteSync(n)}return l}}finally{let e=null!==X?s.get(X).__webglFramebuffer:null;r.bindFramebuffer(eg.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,i=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);let n=Math.pow(2,-i),a=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n),l=null!==t?t.x:0,c=null!==t?t.y:0;o.setTexture2D(e,0),eg.copyTexSubImage2D(eg.TEXTURE_2D,i,0,0,l,c,a,s),r.unbindTexture()},this.copyTextureToTexture=function(e,t,i=null,n=null,a=0){let s,l,c,h,u,d;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),n=arguments[0]||null,e=arguments[1],t=arguments[2],a=arguments[3]||0,i=null),null!==i?(s=i.max.x-i.min.x,l=i.max.y-i.min.y,c=i.min.x,h=i.min.y):(s=e.image.width,l=e.image.height,c=0,h=0),null!==n?(u=n.x,d=n.y):(u=0,d=0);let p=b.convert(t.format),f=b.convert(t.type);o.setTexture2D(t,0),eg.pixelStorei(eg.UNPACK_FLIP_Y_WEBGL,t.flipY),eg.pixelStorei(eg.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eg.pixelStorei(eg.UNPACK_ALIGNMENT,t.unpackAlignment);let m=eg.getParameter(eg.UNPACK_ROW_LENGTH),g=eg.getParameter(eg.UNPACK_IMAGE_HEIGHT),v=eg.getParameter(eg.UNPACK_SKIP_PIXELS),_=eg.getParameter(eg.UNPACK_SKIP_ROWS),x=eg.getParameter(eg.UNPACK_SKIP_IMAGES),y=e.isCompressedTexture?e.mipmaps[a]:e.image;eg.pixelStorei(eg.UNPACK_ROW_LENGTH,y.width),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,y.height),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,c),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,h),e.isDataTexture?eg.texSubImage2D(eg.TEXTURE_2D,a,u,d,s,l,p,f,y.data):e.isCompressedTexture?eg.compressedTexSubImage2D(eg.TEXTURE_2D,a,u,d,y.width,y.height,p,y.data):eg.texSubImage2D(eg.TEXTURE_2D,a,u,d,p,f,y),eg.pixelStorei(eg.UNPACK_ROW_LENGTH,m),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,g),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,v),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,_),eg.pixelStorei(eg.UNPACK_SKIP_IMAGES,x),0===a&&t.generateMipmaps&&eg.generateMipmap(eg.TEXTURE_2D),r.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i=null,n=null,a=0){let s,l,c,h,u,d,p,f,m,g;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),i=arguments[0]||null,n=arguments[1]||null,e=arguments[2],t=arguments[3],a=arguments[4]||0);let v=e.isCompressedTexture?e.mipmaps[a]:e.image;null!==i?(s=i.max.x-i.min.x,l=i.max.y-i.min.y,c=i.max.z-i.min.z,h=i.min.x,u=i.min.y,d=i.min.z):(s=v.width,l=v.height,c=v.depth,h=0,u=0,d=0),null!==n?(p=n.x,f=n.y,m=n.z):(p=0,f=0,m=0);let _=b.convert(t.format),x=b.convert(t.type);if(t.isData3DTexture)o.setTexture3D(t,0),g=eg.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");o.setTexture2DArray(t,0),g=eg.TEXTURE_2D_ARRAY}eg.pixelStorei(eg.UNPACK_FLIP_Y_WEBGL,t.flipY),eg.pixelStorei(eg.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eg.pixelStorei(eg.UNPACK_ALIGNMENT,t.unpackAlignment);let y=eg.getParameter(eg.UNPACK_ROW_LENGTH),M=eg.getParameter(eg.UNPACK_IMAGE_HEIGHT),S=eg.getParameter(eg.UNPACK_SKIP_PIXELS),E=eg.getParameter(eg.UNPACK_SKIP_ROWS),T=eg.getParameter(eg.UNPACK_SKIP_IMAGES);eg.pixelStorei(eg.UNPACK_ROW_LENGTH,v.width),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,v.height),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,h),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,u),eg.pixelStorei(eg.UNPACK_SKIP_IMAGES,d),e.isDataTexture||e.isData3DTexture?eg.texSubImage3D(g,a,p,f,m,s,l,c,_,x,v.data):t.isCompressedArrayTexture?eg.compressedTexSubImage3D(g,a,p,f,m,s,l,c,_,v.data):eg.texSubImage3D(g,a,p,f,m,s,l,c,_,x,v),eg.pixelStorei(eg.UNPACK_ROW_LENGTH,y),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,M),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,S),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,E),eg.pixelStorei(eg.UNPACK_SKIP_IMAGES,T),0===a&&t.generateMipmaps&&eg.generateMipmap(g),r.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){W=0,j=0,X=null,r.reset(),E.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===a9?"display-p3":"srgb",t.unpackColorSpace=sE.workingColorSpace===se?"display-p3":"srgb"}}class h5 extends oP{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 op,this.environmentIntensity=1,this.environmentRotation=new op,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(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),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class h4{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)t.push(r+=(i=this.getPoint(a/e)).distanceTo(n)),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i,n=this.getLengths(),r=0,a=n.length;i=t||e*n[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=n[r=Math.floor(s+(o-s)/2)]-i)<0)s=r+1;else if(l>0)o=r-1;else{o=r;break}if(n[r=o]===i)return r/(a-1);let c=n[r],h=n[r+1];return(r+(i-c)/(h-c))/(a-1)}getTangent(e,t){let i=e-1e-4,n=e+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),a=this.getPoint(n),s=t||(r.isVector2?new sp:new sB);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new sB,n=[],r=[],a=[],s=new sB,o=new on;for(let t=0;t<=e;t++){let i=t/e;n[t]=this.getTangentAt(i,new sB)}r[0]=new sB,a[0]=new sB;let l=Number.MAX_VALUE,c=Math.abs(n[0].x),h=Math.abs(n[0].y),u=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),u<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(n[t-1],n[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(sh(n[t-1].dot(n[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(n[t],r[t])}if(!0===t){let t=Math.acos(sh(r[0].dot(r[e]),-1,1));t/=e,n[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let i=1;i<=e;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],t*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class h6 extends h4{constructor(e=0,t=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new sp){let i=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=i;for(;n>i;)n-=i;n<Number.EPSILON&&(n=r?0:i),!0!==this.aClockwise||r||(n===i?n=-i:n-=i);let a=this.aStartAngle+e*n,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=s-this.aX,n=o-this.aY;s=i*e-n*t+this.aX,o=i*t+n*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}function h8(){let e=0,t=0,i=0,n=0;function r(r,a,s,o){e=r,t=s,i=-3*r+3*a-2*s-o,n=2*r-2*a+s+o}return{initCatmullRom:function(e,t,i,n,a){r(t,i,a*(i-e),a*(n-t))},initNonuniformCatmullRom:function(e,t,i,n,a,s,o){let l=(t-e)/a-(i-e)/(a+s)+(i-t)/s,c=(i-t)/s-(n-t)/(s+o)+(n-i)/o;r(t,i,l*=s,c*=s)},calc:function(r){let a=r*r;return e+t*r+i*a+a*r*n}}}let h7=new sB,h9=new h8,ue=new h8,ut=new h8;function ui(e,t,i,n,r){let a=(n-t)*.5,s=(r-i)*.5,o=e*e;return e*o*(2*i-2*n+a+s)+(-3*i+3*n-2*a-s)*o+a*e+i}function un(e,t,i,n){let r;return(r=1-e)*r*t+2*(1-e)*e*i+e*e*n}function ur(e,t,i,n,r){let a,s;return(a=1-e)*a*a*t+3*(s=1-e)*s*e*i+3*(1-e)*e*e*n+e*e*e*r}class ua extends h4{constructor(e=new sp,t=new sp,i=new sp,n=new sp){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new sp){let i=this.v0,n=this.v1,r=this.v2,a=this.v3;return t.set(ur(e,i.x,n.x,r.x,a.x),ur(e,i.y,n.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class us extends h4{constructor(e=new sp,t=new sp){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new sp){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new sp){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class uo extends h4{constructor(e=new sp,t=new sp,i=new sp){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new sp){let i=this.v0,n=this.v1,r=this.v2;return t.set(un(e,i.x,n.x,r.x),un(e,i.y,n.y,r.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ul extends h4{constructor(e=new sB,t=new sB,i=new sB){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new sB){let i=this.v0,n=this.v1,r=this.v2;return t.set(un(e,i.x,n.x,r.x),un(e,i.y,n.y,r.y),un(e,i.z,n.z,r.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class uc extends h4{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new sp){let i=this.points,n=(i.length-1)*e,r=Math.floor(n),a=n-r,s=i[0===r?r:r-1],o=i[r],l=i[r>i.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return t.set(ui(a,s.x,o.x,l.x,c.x),ui(a,s.y,o.y,l.y,c.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new sp().fromArray(i))}return this}}class uh extends le{constructor(e=.5,t=1,i=32,n=1,r=0,a=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:n,thetaStart:r,thetaLength:a},i=Math.max(3,i);const s=[],o=[],l=[],c=[];let h=e;const u=(t-e)/(n=Math.max(1,n)),d=new sB,p=new sp;for(let e=0;e<=n;e++){for(let e=0;e<=i;e++){const n=r+e/i*a;d.x=h*Math.cos(n),d.y=h*Math.sin(n),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,c.push(p.x,p.y)}h+=u}for(let e=0;e<n;e++){const t=e*(i+1);for(let e=0;e<i;e++){const n=e+t,r=n+i+1,a=n+i+2,o=n+1;s.push(n,r,o),s.push(r,a,o)}}this.setIndex(s),this.setAttribute("position",new o2(o,3)),this.setAttribute("normal",new o2(l,3)),this.setAttribute("uv",new o2(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uh(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}function uu(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}class ud{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{let a;i:{n:if(!(e<n)){for(let a=i+2;;){if(void 0===n){if(e<r)break n;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=n,e<(n=t[++i]))break t}a=t.length;break i}if(!(e>=r)){let s=t[1];e<s&&(i=2,r=s);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(n=r,e>=(r=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let n=i+a>>>1;e<t[n]?a=n:i=n+1}if(n=t[i],void 0===(r=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n;for(let e=0;e!==n;++e)t[e]=i[r+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class up extends ud{constructor(e,t,i,n){super(e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,i){let n=this.parameterPositions,r=e-2,a=e+1,s=n[r],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-i;break;case 2402:r=n.length-2,s=t+n[r]-n[r+1];break;default:r=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*i-t;break;case 2402:a=1,o=i+n[1]-n[0];break;default:a=e-1,o=t}let l=(i-t)*.5,c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(n-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let e=0;e!==s;++e)r[e]=g*a[c+e]+v*a[l+e]+_*a[o+e]+x*a[h+e];return r}}class uf extends ud{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=(i-t)/(n-t),h=1-c;for(let e=0;e!==s;++e)r[e]=a[l+e]*h+a[o+e]*c;return r}}class um extends ud{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}}class ug{constructor(e,t,i,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=uu(t,this.TimeBufferType),this.values=uu(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t,i=e.constructor;if(i.toJSON!==this.toJSON)t=i.toJSON(e);else{t={name:e.name,times:uu(e.times,Array),values:uu(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new um(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new uf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new up(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,r=0,a=n-1;for(;r!==n&&i[r]<e;)++r;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=i.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){var e;let t=!0,i=this.getValueSize();i-Math.floor(i)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,r=this.values,a=n.length;0===a&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==a;e++){let i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==r&&ArrayBuffer.isView(e=r)&&!(e instanceof DataView))for(let e=0,i=r.length;e!==i;++e){let i=r[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),n=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s<r;++s){let r=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(n)r=!0;else{let e=s*i,n=e-i,a=e+i;for(let s=0;s!==i;++s){let i=t[e+s];if(i!==t[n+s]||i!==t[a+s]){r=!0;break}}}if(r){if(s!==a){e[a]=e[s];let n=s*i,r=a*i;for(let e=0;e!==i;++e)t[r+e]=t[n+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*i,n=a*i,s=0;s!==i;++s)t[n+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}ug.prototype.TimeBufferType=Float32Array,ug.prototype.ValueBufferType=Float32Array,ug.prototype.DefaultInterpolation=2301;class uv extends ug{constructor(e,t,i){super(e,t,i)}}uv.prototype.ValueTypeName="bool",uv.prototype.ValueBufferType=Array,uv.prototype.DefaultInterpolation=2300,uv.prototype.InterpolantFactoryMethodLinear=void 0,uv.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends ug{}).prototype.ValueTypeName="color",(class extends ug{}).prototype.ValueTypeName="number";class u_ extends ud{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(n-t),l=e*s;for(let e=l+s;l!==e;l+=4)sF.slerpFlat(r,0,a,l-s,a,l,o);return r}}class ux extends ug{InterpolantFactoryMethodLinear(e){return new u_(this.times,this.values,this.getValueSize(),e)}}ux.prototype.ValueTypeName="quaternion",ux.prototype.InterpolantFactoryMethodSmooth=void 0;class uy extends ug{constructor(e,t,i){super(e,t,i)}}uy.prototype.ValueTypeName="string",uy.prototype.ValueBufferType=Array,uy.prototype.DefaultInterpolation=2300,uy.prototype.InterpolantFactoryMethodLinear=void 0,uy.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends ug{}).prototype.ValueTypeName="vector";let uM="\\[\\]\\.:\\/",uS=RegExp("["+uM+"]","g"),ub="[^"+uM+"]",uE="[^"+uM.replace("\\.","")+"]",uT=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",ub)+/(WCOD+)?/.source.replace("WCOD",uE)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",ub)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",ub)+"$"),uw=["material","materials","bones","map"];class uA{constructor(e,t,i){this.path=t,this.parsedPath=i||uA.parseTrackName(t),this.node=uA.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new uA.Composite(e,t,i):new uA(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uS,"")}static parseTrackName(e){let t=uT.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){let e=i.nodeName.substring(n+1);-1!==uw.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let n=0;n<e.length;n++){let r=e[n];if(r.name===t||r.uuid===t)return r;let a=i(r.children);if(a)return a}return null},n=i(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)e[t++]=i[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=uA.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===n){n=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==n){if(void 0===e[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[n]}}let a=e[n];if(void 0===a)return void console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+n+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}uA.Composite=class{constructor(e,t,i){const n=i||uA.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},uA.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},uA.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},uA.prototype.GetterByBindingType=[uA.prototype._getValue_direct,uA.prototype._getValue_array,uA.prototype._getValue_arrayElement,uA.prototype._getValue_toArray],uA.prototype.SetterByBindingTypeAndVersioning=[[uA.prototype._setValue_direct,uA.prototype._setValue_direct_setNeedsUpdate,uA.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[uA.prototype._setValue_array,uA.prototype._setValue_array_setNeedsUpdate,uA.prototype._setValue_array_setMatrixWorldNeedsUpdate],[uA.prototype._setValue_arrayElement,uA.prototype._setValue_arrayElement_setNeedsUpdate,uA.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[uA.prototype._setValue_fromArray,uA.prototype._setValue_fromArray_setNeedsUpdate,uA.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1),"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"165"}})),"u">typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="165");var uR=e.i(90072),uC=e.i(70905);let uP=new uR.Matrix4,uL=new uR.Matrix4,uI={x:"XYZ",y:"YXZ",z:"ZXY"};function uN(e,t,i,n,r,a){let s;uP.copy(i),null!=r&&uP.premultiply(uL.copy(r).invert());let o=new uR.Vector3,l=new uR.Quaternion,c=new uR.Vector3;uP.decompose(o,l,c),uW(o,n.initialTargetPosition,a.translate??!0);let h=a.rotate??!0;if(!1===h)l.copy(n.initialTargetQuaternion),s=n.initialTargetRotation.clone();else if(Array.isArray(h)||!0===h||"string"!=typeof h&&!Array.isArray(h)&&!0===h.x&&!0===h.y&&!0===h.z)s=new uR.Euler().setFromQuaternion(l,n.initialTargetRotation.order);else if("string"==typeof h){let e=uI[h];for(let t of(s=new uR.Euler().setFromQuaternion(l,e),e)){let e=t.toLowerCase();e!==h&&(s[e]=0)}s.order=n.initialTargetRotation.order,l.setFromEuler(s)}else s=function(e,t,i){let n="",r="";for(let e of t.order)!1===i[e.toLowerCase()]?r+=e:n+=e;let a=n+r,s=new uR.Euler().setFromQuaternion(e,a);for(let e of a){let n=e.toLowerCase();s[n]=uj(n,s[n],t[n],i)}return e.setFromEuler(s),s}(l,n.initialTargetRotation,h);return"object"==typeof a.scale&&a.scale.uniform||uW(c,n.initialTargetScale,a.scale??!0),{pointerAmount:t,position:o,quaternion:l,rotation:s,scale:c,time:e}}let uD=new uR.Plane,uU=new uR.Vector3,uO=new uR.Vector3,uF=new uR.Vector3,uB=new uR.Quaternion;function uz(e,t,i){var n,r;return uD.normal.copy(e),uD.constant=0,n=uU,0===(r=uD.normal).x?n.set(1,0,0):0===r.y?n.set(0,1,0):0===r.z?n.set(0,0,1):n.set(-r.y,r.x,0),uO.copy(uU),uO.applyQuaternion(uB.copy(t).invert().premultiply(i)),uD.projectPoint(uU,uU).normalize(),uD.projectPoint(uO,uO).normalize(),(0>uF.crossVectors(uU,uD.normal).dot(uO)?1:-1)*uU.angleTo(uO)}let uk=new uR.Vector3,uV=new uR.Plane,uH=new uR.Vector3,uG=new uR.Vector3;function uW(e,t,i){if(Array.isArray(i)){switch(i.length){case 0:e.copy(t);break;case 1:e.sub(t),u8(e,i[0]instanceof uR.Vector3?i[0]:uk.fromArray(i[0])),e.add(t);break;case 2:uk.crossVectors(i[0]instanceof uR.Vector3?i[0]:uH.fromArray(i[0]),i[1]instanceof uR.Vector3?i[1]:uG.fromArray(i[1])),uV.setFromNormalAndCoplanarPoint(uk,t),uV.projectPoint(e,e)}return}e.x=uj("x",e.x,t.x,i),e.y=uj("y",e.y,t.y,i),e.z=uj("z",e.z,t.z,i)}function uj(e,t,i,n){if("boolean"==typeof n)return n?t:i;if("string"==typeof n)return n===e?t:i;let r=n[e];return!1===r?i:Array.isArray(r)?(0,uC.clamp)(t,...r):t}function uX(e=!0,t,i,n,r,a){if(e){switch(t.length){case 0:case 3:return;case 1:!function(e,t,i,n,r){let a=null==r?0:1-Math.abs(t.dot(r));if(null==r||a<.001)return u6(n,e,t);u4.subVectors(i,e);let s=t.dot(r),o=t.dot(u4),l=r.dot(u4),c=1-s*s;(s*o-l)/c<0?u6(n,e,t):(u4.copy(n),n.copy(e).addScaledVector(t,(o-s*l)/c))}(i,...t,n,r,a);return;case 2:!function(e,t,i,n,r,a){u5.crossVectors(e,t).normalize(),u3.setFromNormalAndCoplanarPoint(u5,i);let s=null==a?0:Math.abs(u5.dot(a));if(null==a||s<.01)return u3.projectPoint(r,r);let o=-u3.distanceToPoint(n)/a.dot(u3.normal);o<0?u3.projectPoint(r,r):(u4.copy(r),r.copy(n).addScaledVector(a,o))}(...t,i,n,r,a);return}throw Error(`space cannot be ${t.length}D but received (${t.map(e=>e.toArray().join("/")).join("; ")})`)}}let uq={x:new uR.Vector3(1,0,0),y:new uR.Vector3(0,1,0),z:new uR.Vector3(0,0,1)};function uY(e,t,i,n,r){if(!1!==n){if(!0===n){e[0]=uq.x,e[1]=uq.y,e[2]=uq.z;return}if("string"==typeof n)return void u0(e,t,i,n,r);if(Array.isArray(n)){for(let a of n)u0(e,t,i,a,r);return}!1!==n.x&&u0(e,t,i,"x",r),!1!==n.y&&u0(e,t,i,"y",r),!1!==n.z&&u0(e,t,i,"z",r)}}let uK=new uR.Quaternion,uZ=new uR.Euler,u$=new uR.Vector3,uJ=new uR.Vector3,uQ=new uR.Vector3;function u0(e,t,i,n,r){if(Array.isArray(n)?u$.set(...n):n instanceof uR.Vector3?u$.copy(n):u$.copy(uq[n]),"translate"===r){u$.applyQuaternion(t),u2(e,u$);return}if("scale"===r){Array.isArray(n)?uK.identity():uK.setFromEuler(i),uK.premultiply(t),u$.applyQuaternion(uK),u2(e,u$);return}if(Array.isArray(n))uZ.set(0,0,0);else{uZ.copy(i);for(let e=2;e>=0;e--){let t=i.order[e].toLowerCase();if(uZ[t]=0,t===n)break}}uK.setFromEuler(uZ).premultiply(t),u$.normalize(),uJ.set(0,1,0),u$.dot(uJ)>.99&&uJ.set(0,0,1),uQ.crossVectors(u$,uJ).normalize(),uJ.copy(uQ),uQ.applyQuaternion(uK),u2(e,uQ),uQ.crossVectors(u$,uJ).normalize(),uQ.applyQuaternion(uK),u2(e,uQ)}let u1=new uR.Vector3;function u2(e,t){if(3!==e.length){if(0===e.length)return void e.push(t.clone());if(1===e.length){.999>Math.abs(e[0].dot(t))&&e.push(t.clone());return}u1.crossVectors(e[0],e[1]),.001>Math.abs(u1.dot(t))||e.push(t.clone())}}let u3=new uR.Plane,u5=new uR.Vector3,u4=new uR.Vector3;function u6(e,t,i){e.sub(t),u8(e,i),e.add(t)}function u8(e,t){let i=e.dot(t);e.copy(t).multiplyScalar(i)}let u7=new uR.Matrix4,u9=new uR.Matrix4,de=new uR.Vector3,dt=new uR.Vector3,di=new uR.Quaternion,dn=new uR.Vector3(1,1,1),dr=[],da=new uR.Vector3,ds=new uR.Vector3,dl=new uR.Vector3,dc=new uR.Vector3,dh=new uR.Vector3,du=new uR.Vector3,dd=new uR.Vector3,dp=new uR.Matrix4,df=new uR.Matrix4,dm=new uR.Matrix4,dg=new uR.Quaternion,dv=new uR.Quaternion,d_=[],dx=new uR.Vector3,dy=new uR.Vector3,dM=new uR.Vector3,dS=new uR.Vector3,db=new uR.Vector3,dE=new uR.Quaternion,dT=new uR.Quaternion,dw=new uR.Matrix4,dA=new uR.Vector3,dR=[];class dC{t1;t2;_position;_quaternion;_rotation;_scale;constructor(e,t){this.t1=e,this.t2=t}get time(){return this.t1.time-this.t2.time}get position(){return this._position??=this.t1.position.clone().sub(this.t2.position)}get quaternion(){return this._quaternion??=this.t2.quaternion.clone().invert().premultiply(this.t1.quaternion)}get rotation(){return this._rotation??=new uR.Euler().setFromQuaternion(this.quaternion)}get scale(){return this._scale??=this.t1.scale.clone().sub(this.t2.scale)}}class dP{cancel;previous;memo;event;initial;current;first;last;_delta;_offset;constructor(e){this.cancel=e}start(e,t){this.event=e,this.previous=void 0,this.current=t,this.initial=t,this.first=!0,this.last=!1,this.memo=void 0,this._delta=void 0,this._offset=void 0}update(e,t){this.event=e,this.previous=this.current,this.current=t,this.first=!1,this.last=!1,this._delta=void 0,this._offset=void 0}end(e){this.event=e,this.first=!1,this.last=!0,this._delta=void 0,this._offset=void 0}get delta(){if(null!=this.previous)return this._delta??=new dC(this.current,this.previous)}get offset(){return this._offset??=new dC(this.current,this.initial)}}function dL(e,t){if("sphere"===e.details.type)return!1;if("lines"===e.details.type){let{line:i}=e.details;return t.copy(i.end).sub(i.start).normalize(),!0}return"screen-ray"===e.details.type?t.copy(e.details.direction):t.set(0,0,-1).applyQuaternion(e.pointerQuaternion),!0}let dI=new uR.Vector3;class dN{target;getOptions;outputState;latestMoveEvent;inputState=new Map;capturedObjects=new Map;initialTargetPosition=new uR.Vector3;initialTargetQuaternion=new uR.Quaternion;initialTargetRotation=new uR.Euler;initialTargetScale=new uR.Vector3;initialTargetParentWorldMatrix;prevTwoPointerDeltaRotation;prevTranslateAsDeltaRotation;prevAngle;handlers={onPointerDown:this.onPointerDown.bind(this),onPointerMove:this.onPointerMove.bind(this),onPointerUp:this.onPointerUp.bind(this)};constructor(e,t=()=>({})){this.target=e,this.getOptions=t,this.outputState=new dP(this.cancel.bind(this))}firstOnPointer(e){let t=this.getTarget();if(null==t)return;let i=dL(e,dI)?dI.clone():void 0;e.intersection.details.type,this.inputState.set(e.pointerId,{pointerWorldDirection:i,pointerWorldPoint:e.point,pointerWorldOrigin:e.pointerPosition,pointerWorldQuaternion:e.pointerQuaternion,initialPointerWorldPoint:e.point.clone(),initialPointerWorldDirection:i?.clone(),initialPointerWorldQuaternion:e.pointerQuaternion.clone(),prevPointerWorldQuaternion:e.pointerQuaternion}),this.save(),1===this.inputState.size&&this.outputState.start(e,{pointerAmount:1,time:e.timeStamp,position:this.initialTargetPosition.clone(),quaternion:this.initialTargetQuaternion.clone(),rotation:this.initialTargetRotation.clone(),scale:this.initialTargetScale.clone()}),this.outputState.memo=this.apply(t)}onPointerDown(e){this.getOptions().filter?.(e)===!1||(this.stopPropagation(e),this.capturePointer(e.pointerId,e.object)&&this.firstOnPointer(e))}onPointerMove(e){if(!this.capturedObjects.has(e.pointerId))return;this.stopPropagation(e);let t=this.inputState.get(e.pointerId);null==t?this.firstOnPointer(e):(this.latestMoveEvent=e,t.pointerWorldPoint=e.point,t.prevPointerWorldQuaternion=t.pointerWorldQuaternion,t.pointerWorldQuaternion=e.pointerQuaternion,t.pointerWorldOrigin=e.pointerPosition,null!=t.pointerWorldDirection&&dL(e,t.pointerWorldDirection))}cancel(){if(0===this.capturedObjects.size)return;for(let[e,t]of this.capturedObjects)t.releasePointerCapture(e);this.capturedObjects.clear(),this.inputState.clear(),this.outputState.end(void 0);let e=this.getTarget();null!=e&&this.apply(e)}onPointerUp(e){this.capturedObjects.has(e.pointerId)&&(this.stopPropagation(e),this.releasePointer(e.pointerId,e.object,e))}update(e){let t,i=this.getTarget();if(null==i||0===this.inputState.size||null==this.latestMoveEvent&&(this.getOptions().alwaysUpdate??!1)===!1)return;let n=this.getOptions();if("as-rotate"===n.translate||"as-rotate-and-scale"===n.translate||"as-scale"===n.translate){n.translate,this.prevTwoPointerDeltaRotation=void 0,this.prevAngle=void 0;let[r]=this.inputState.values();t=function(e,t,i,n,r,a){if(null==r?dE.identity():r.decompose(dx,dE,dy),dR.length=0,"as-scale"===a.translate&&uY(dR,dE,i.initialTargetRotation,a.scale??!0,"scale"),"as-scale"!=a.translate&&uY(dR,dE,i.initialTargetRotation,a.rotate??!0,"rotate"),dw.makeTranslation(i.initialTargetPosition),null!=i.initialTargetParentWorldMatrix&&dw.premultiply(i.initialTargetParentWorldMatrix),dS.setFromMatrixPosition(dw),uX(a.projectRays,dR,t.initialPointerWorldPoint,t.pointerWorldOrigin,dS,void 0),dS.negate().add(t.initialPointerWorldPoint),db.setFromMatrixPosition(n),uX(a.projectRays,dR,t.initialPointerWorldPoint,t.pointerWorldOrigin,db,void 0),uX(a.projectRays,dR,t.initialPointerWorldPoint,t.pointerWorldOrigin,dy.copy(t.pointerWorldPoint),t.pointerWorldDirection),db.negate().add(dy),"as-scale"===a.translate?dE.copy(i.initialTargetQuaternion):(dx.copy(dS),null!=i.prevTranslateAsDeltaRotation&&dx.applyQuaternion(i.prevTranslateAsDeltaRotation),dx.normalize(),dy.copy(db).normalize(),dE.setFromUnitVectors(dx,dy),null==i.prevTranslateAsDeltaRotation?i.prevTranslateAsDeltaRotation=new uR.Quaternion:dE.multiply(i.prevTranslateAsDeltaRotation),i.prevTranslateAsDeltaRotation.copy(dE),null!=i.initialTargetParentWorldMatrix&&(dT.setFromRotationMatrix(i.initialTargetParentWorldMatrix),dE.multiply(dT.normalize()),dE.premultiply(dT.invert())),dE.multiply(i.initialTargetQuaternion)),"as-rotate"===a.translate)dA.set(1,1,1);else if("object"==typeof a.scale&&a.scale.uniform)dA.setScalar(db.length()/dS.length());else if("as-rotate-and-scale"===a.translate){dw.compose(i.initialTargetPosition,i.initialTargetQuaternion,i.initialTargetScale),null!=i.initialTargetParentWorldMatrix&&dw.premultiply(i.initialTargetParentWorldMatrix),dw.decompose(dy,dT,dM),dx.copy(dS).applyQuaternion(dT.invert()).divide(dM),dx.x=Math.abs(dx.x),dx.y=Math.abs(dx.y),dx.z=Math.abs(dx.z);let e=Math.max(...dx.toArray());dx.divideScalar(e),dA.set(1,1,1),dA.addScaledVector(dx,db.length()/dS.length()-1)}else null!=i.initialTargetParentWorldMatrix?(i.initialTargetParentWorldMatrix.decompose(dx,dT,dy),dT.multiply(i.initialTargetQuaternion)):dT.copy(i.initialTargetQuaternion),dx.copy(dS).applyQuaternion(dT.invert()),null!=r?(r.decompose(dy,dT,dM),dT.multiply(i.initialTargetQuaternion)):dT.copy(i.initialTargetQuaternion),dy.copy(db).applyQuaternion(dT.invert()),dA.x=.001>Math.abs(dx.x)?1:Math.abs(dy.x/dx.x),dA.y=.001>Math.abs(dx.y)?1:Math.abs(dy.y/dx.y),dA.z=.001>Math.abs(dx.z)?1:Math.abs(dy.z/dx.z);return dA.multiply(i.initialTargetScale),dw.compose(i.initialTargetPosition,dE,dA),uN(e,1,dw,i,void 0,a)}(e,r,this,i.matrixWorld,i.parent?.matrixWorld,n)}else if(1===this.inputState.size){var r;this.prevTwoPointerDeltaRotation=void 0,this.prevAngle=void 0,this.prevTranslateAsDeltaRotation=void 0;let[a]=this.inputState.values();r=i.parent?.matrixWorld,null==r?di.identity():r.decompose(de,di,dt),dr.length=0,uY(dr,di,this.initialTargetRotation,n.translate??!0,"translate"),u9.makeRotationFromQuaternion(di.copy(a.initialPointerWorldQuaternion).invert()).multiply(u7.makeTranslation(de.copy(a.initialPointerWorldPoint).negate())),null!=this.initialTargetParentWorldMatrix&&u9.multiply(this.initialTargetParentWorldMatrix),uX(n.projectRays,dr,a.initialPointerWorldPoint,a.pointerWorldOrigin,de.copy(a.pointerWorldPoint),a.pointerWorldDirection),di.copy(a.pointerWorldQuaternion),(n.rotate??!0)===!1&&di.copy(a.initialPointerWorldQuaternion),u7.compose(de,di,dn).multiply(u9).multiply(u9.compose(this.initialTargetPosition,this.initialTargetQuaternion,this.initialTargetScale)),t=uN(e,1,u7,this,r,n)}else{this.prevTranslateAsDeltaRotation=void 0;let[r,a]=this.inputState.values();t=function(e,t,i,n,r,a){null==r?dg.identity():r.decompose(dl,dg,dc),d_.length=0,uY(d_,dg,n.initialTargetRotation,a.translate??!0,"translate"),uY(d_,dg,n.initialTargetRotation,a.rotate??!0,"rotate"),uY(d_,dg,n.initialTargetRotation,a.scale??!0,"scale"),uX(a.projectRays,d_,t.initialPointerWorldPoint,t.pointerWorldOrigin,dl.copy(t.pointerWorldPoint),t.pointerWorldDirection),uX(a.projectRays,d_,i.initialPointerWorldPoint,i.pointerWorldOrigin,dc.copy(i.pointerWorldPoint),i.pointerWorldDirection),da.copy(i.initialPointerWorldPoint).sub(t.initialPointerWorldPoint),ds.copy(dc).sub(dl),dl.copy(da),null!=n.prevTwoPointerDeltaRotation&&dl.applyQuaternion(n.prevTwoPointerDeltaRotation),dl.normalize(),dc.copy(ds).normalize(),dg.setFromUnitVectors(dl,dc),null==n.prevTwoPointerDeltaRotation?n.prevTwoPointerDeltaRotation=new uR.Quaternion:dg.multiply(n.prevTwoPointerDeltaRotation),n.prevTwoPointerDeltaRotation.copy(dg);let s=(uz(dc,t.prevPointerWorldQuaternion,t.pointerWorldQuaternion)+uz(dc,i.prevPointerWorldQuaternion,i.pointerWorldQuaternion))*.5+(n.prevAngle??0);if(n.prevAngle=s,dg.premultiply(dv.setFromAxisAngle(dc,s)),dm.compose(n.initialTargetPosition,n.initialTargetQuaternion,n.initialTargetScale),null!=n.initialTargetParentWorldMatrix&&dm.premultiply(n.initialTargetParentWorldMatrix),"object"==typeof a.scale&&a.scale.uniform)dd.setScalar(ds.length()/da.length());else{dm.decompose(dh,dv,du),dl.copy(da).applyQuaternion(dv.invert()).divide(du),dl.x=Math.abs(dl.x),dl.y=Math.abs(dl.y),dl.z=Math.abs(dl.z);let e=Math.max(...dl.toArray());dl.divideScalar(e),dd.set(1,1,1),dd.addScaledVector(dl,ds.length()/da.length()-1)}return dp.makeTranslation(dl.copy(ds).multiplyScalar(.5).add(t.pointerWorldPoint)).multiply(df.makeRotationFromQuaternion(dg)).multiply(df.makeRotationFromQuaternion(dv.invert())).multiply(df.makeScale(dd.x,dd.y,dd.z)).multiply(df.makeRotationFromQuaternion(dv.invert())).multiply(df.makeTranslation(dl.copy(da).multiplyScalar(.5).add(t.initialPointerWorldPoint).negate())).multiply(dm),uN(e,2,dp,n,r,a)}(e,r,a,this,i.parent?.matrixWorld,n)}this.outputState.update(this.latestMoveEvent,t),this.outputState.memo=this.apply(i),this.latestMoveEvent=void 0}getTarget(){return this.target instanceof uR.Object3D?this.target:this.target?.current}capturePointer(e,t){if(this.capturedObjects.has(e))return!1;let{multitouch:i,translate:n}=this.getOptions();return((i??!0)!==!1&&"string"!=typeof n||1!==this.capturedObjects.size)&&(this.capturedObjects.set(e,t),t.setPointerCapture(e),!0)}releasePointer(e,t,i){let n=this.getTarget();if(null!=n&&this.capturedObjects.delete(e)){if(this.inputState.delete(e),t.releasePointerCapture(e),this.inputState.size>0)return void this.save();this.outputState.end(i),this.apply(n)}}stopPropagation(e){null!=e&&(this.getOptions()?.stopPropagation??!0)&&e.stopPropagation()}apply(e){return(this.getOptions().apply??dU)(this.outputState,e)}getState(){return 0===this.inputState.size?void 0:this.outputState}save(){let e=this.getTarget();if(null!=e)for(let t of(e.updateWorldMatrix(!0,!1),this.prevAngle=void 0,this.prevTwoPointerDeltaRotation=void 0,this.prevTranslateAsDeltaRotation=void 0,this.initialTargetParentWorldMatrix=e.parent?.matrixWorld.clone(),e.matrixAutoUpdate?(this.initialTargetPosition.copy(e.position),this.initialTargetQuaternion.copy(e.quaternion),this.initialTargetRotation.copy(e.rotation),this.initialTargetScale.copy(e.scale)):(e.matrix.decompose(this.initialTargetPosition,this.initialTargetQuaternion,this.initialTargetScale),this.initialTargetRotation.setFromQuaternion(this.initialTargetQuaternion,e.rotation.order)),this.inputState.values()))null!=t.pointerWorldDirection&&t.initialPointerWorldDirection?.copy(t.pointerWorldDirection),t.initialPointerWorldPoint.copy(t.pointerWorldPoint),t.initialPointerWorldQuaternion.copy(t.pointerWorldQuaternion)}bind(e){let{onPointerDown:t,onPointerMove:i,onPointerUp:n}=this.handlers;return e.addEventListener("pointerdown",t),e.addEventListener("pointermove",i),e.addEventListener("pointerup",n),()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointermove",i),e.removeEventListener("pointerup",n),this.cancel()}}capture(e,t){return this.capturePointer(e,t)?()=>this.releasePointer(e,t,void 0):dD}}function dD(){}function dU(e,t){t.position.copy(e.current.position),t.rotation.order=e.current.rotation.order,t.quaternion.copy(e.current.quaternion),t.scale.copy(e.current.scale)}class dO{target;getOptions;handles=[];hoveredTagMap=new Map;hoverSubscriptions=[];applySubscriptions=[];space;constructor(e,t){this.target=e,this.getOptions=t}getSpace(){return this.space??"world"}getTarget(){return this.target instanceof uR.Object3D?this.target:this.target.current}getHandleOptions(e,t){let i=this.getOptions?.(),n=t?.();return{...i,...n,apply:(t,r)=>(this.onApply(e,t,r),(n?.apply??i?.apply??dU)?.(t,r))}}registerHandle(e,t,i){let n={object:t,store:e,tag:i};this.handles.push(n);let r=e.bind(t),a=this.onPointerEnter.bind(this,i),s=this.onPointerLeave.bind(this);return t.addEventListener("pointerenter",a),t.addEventListener("pointerleave",s),()=>{let t=this.handles.indexOf(n);-1!=t&&this.handles.splice(t,1),r(),e.cancel()}}subscribeHover(e){return this.hoverSubscriptions.push(e),e(Array.from(this.hoveredTagMap.values())),()=>{let t=this.hoverSubscriptions.indexOf(e);-1!==t&&this.hoverSubscriptions.splice(t,1)}}subscribeApply(e){return this.applySubscriptions.push(e),()=>{let t=this.applySubscriptions.indexOf(e);-1!==t&&this.applySubscriptions.splice(t,1)}}update(e){for(let{store:t}of this.handles)t.update(e)}onPointerEnter(e,t){this.hoveredTagMap.set(t.pointerId,e),this.updateHover()}onPointerLeave(e){this.hoveredTagMap.delete(e.pointerId),this.updateHover()}updateHover(){let e=Array.from(this.hoveredTagMap.values());for(let t of this.hoverSubscriptions)t(e)}onApply(e,t,i){for(let n of this.applySubscriptions)n(e,t,i)}}let dF={depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0};function dB(e,t,i,{color:n,hoverColor:r,hoverOpacity:a,opacity:s,disabled:o=!1}){if(null==r&&null==a||o){t.color.set(n),t.opacity=s??1,o&&(t.opacity*=.5,t.color.lerp(new uR.Color(1,1,1),.5));return}return r??=n,e.subscribeHover(e=>{let o=e.some(e=>e.includes(i));t.color.set(o?r:n),t.opacity=(o?a:s)??1})}var dz=uR;let dk=new dz.Quaternion,dV=new dz.BufferGeometry;dV.setAttribute("position",new dz.Float32BufferAttribute([-1e3,0,0,1e3,0,0],3));class dH extends dz.LineSegments{context;rotationOffset;constructor(e,t){super(dV),this.context=e,this.rotationOffset=t,this.renderOrder=1/0}update(){this.quaternion.setFromEuler(this.rotationOffset);let e=this.context.getTarget();"world"===this.context.getSpace()&&null!=e&&(e.getWorldQuaternion(dk).invert(),this.quaternion.premultiply(dk))}bind(e){this.material=new dz.LineBasicMaterial({...dF,color:this.material.color??"white",opacity:this.material.opacity??1});let t=this.context.subscribeHover(t=>{let i=t.some(t=>t.includes(e));this.visible=i}),i=this.context.subscribeApply((e,t)=>{if(t.last)return void this.position.set(0,0,0);this.position.copy(t.initial.position).sub(t.current.position);let i=this.context.getTarget();null!=i&&(dk.copy(i.quaternion).invert(),this.position.applyQuaternion(dk))});return()=>{this.material.dispose(),t(),i()}}}var dG=uR;class dW extends dG.Group{context;axis;store;options;tag;constructor(e,t,i,n){super(),this.context=e,this.axis=t,this.tag=(i??"")+t,this.store=new dN(e.target,()=>e.getHandleOptions(this.tag,n))}}var dj=uR;function dX(e,t=!0){if(!1===t)return{options:!1,disabled:!0};if(!0===t){let t={x:!1,y:!1,z:!1,e:!1};for(let i of e)t[i]=!0;return{options:t,disabled:!1}}if("disabled"===t)return{options:{x:!0,y:!0,z:!0,e:!0},disabled:!0};if("string"==typeof t)return{options:t===e&&{x:!1,y:!1,z:!1,e:!1,[e]:!0},disabled:!1};let i={x:!1,y:!1,z:!1,e:!1},n=!1;for(let r of e){let e=t[r]??!0;if(!1===e)return{options:!1,disabled:!0};"disabled"===e&&(n=!0,e=!0),i[r]=e}return{options:i,disabled:n}}let dq=new uR.Vector3,dY=new uR.Vector3;function dK(e,t,i,n){let r;return i?(t instanceof uR.OrthographicCamera?r=(t.top-t.bottom)/t.zoom:(t.getWorldPosition(dq),e.getWorldPosition(dY),r=dq.distanceTo(dY)*Math.min(1.9*Math.tan(Math.PI*t.fov/360)/t.zoom,7)),r*n/4):n}let dZ=new uR.CylinderGeometry(0,.04,.1,12);dZ.translate(0,.05,0);let d$=new uR.CylinderGeometry(.0075,.0075,.5,3);d$.translate(0,.25,0);let dJ=new uR.Euler(0,0,-Math.PI/2),dQ=new uR.Euler(0,0,Math.PI/2);class d0 extends dW{invert;showArrowBody;constructor(e,t,i="",n,r=!1,a=!0){super(e,t,i,()=>({scale:!1,rotate:!1,translate:null!=n?[n]:this.options,multitouch:!1})),this.invert=r,this.showArrowBody=a}bind(e,t,i){let n,r,{options:a,disabled:s}=dX(this.axis,i);if(!1===a)return;this.options=a;let o=this.invert?dQ:dJ,l=new uR.MeshBasicMaterial(dF),c=dB(this.context,l,this.tag,{color:e,hoverColor:t,disabled:s}),h=new uR.Mesh(dZ,l);if(h.renderOrder=1/0,h.position.x=this.invert?-.5:.5,h.rotation.copy(o),this.add(h),this.showArrowBody){let t=new uR.MeshBasicMaterial(dF);n=dB(this.context,t,this.tag,{color:e,hoverColor:0xffff40,disabled:s}),(r=new uR.Mesh(d$,t)).renderOrder=1/0,r.rotation.copy(o),this.add(r)}let u=new uR.Mesh(new uR.CylinderGeometry(.13,0,.6,4));u.pointerEventsOrder=1/0,u.position.x=this.invert?-.3:.3,u.rotation.copy(o),u.visible=!1,this.add(u);let d=s?void 0:this.context.registerHandle(this.store,u,this.tag);return()=>{l.dispose(),d?.(),c?.(),n?.(),this.remove(h),null!=r&&this.remove(r),this.remove(u)}}}class d1 extends dW{constructor(e,t,i="",n){super(e,t,i,()=>({translate:n??this.options,scale:!1,rotate:!1,multitouch:!1}))}bind(e,t,i){let{options:n,disabled:r}=dX(this.axis,i);if(!1===n)return;this.options=n;let a=new uR.MeshBasicMaterial(dF),s=dB(this.context,a,this.tag,{opacity:.5,hoverOpacity:1,color:e,hoverColor:t,disabled:r}),o=new uR.Mesh(new uR.BoxGeometry(.2,.2,.01),a);o.renderOrder=1/0,o.pointerEventsOrder=1/0,o.position.set(.15,.15,0);let l=r?void 0:this.context.registerHandle(this.store,o,this.tag);return this.add(o),()=>{a.dispose(),o.geometry.dispose(),l?.(),s?.(),this.remove(o)}}}new dj.Vector3;dj.Group,dj.Group;var d2=uR;let d3=new uR.Quaternion;class d5 extends dW{constructor(e){super(e,"xyz","",()=>({translate:this.options,scale:!1,rotate:!1,multitouch:!1}))}bind(e){let{options:t,disabled:i}=dX(this.axis,e);if(!1===t)return;this.options=t;let n=new uR.MeshBasicMaterial(dF),r=dB(this.context,n,this.tag,{color:0xffffff,hoverColor:0xffff00,opacity:.25,hoverOpacity:1,disabled:i}),a=new uR.Mesh(new uR.OctahedronGeometry(.1,0),n);a.renderOrder=1/0,this.add(a);let s=new uR.Mesh(new uR.OctahedronGeometry(.2,0));s.pointerEventsOrder=1/0,s.visible=!1,this.add(s);let o=i?void 0:this.context.registerHandle(this.store,s,this.tag);return()=>{n.dispose(),a.geometry.dispose(),s.geometry.dispose(),o?.(),r?.(),this.remove(a),this.remove(s)}}}let d4=new d2.Vector3,d6=new d2.Quaternion,d8=new d2.Quaternion,d7=new d2.Quaternion().setFromEuler(new d2.Euler(0,0,Math.PI/2)),d9=new d2.Quaternion().setFromEuler(new d2.Euler(0,-Math.PI/2,0)),pe=new d2.Quaternion,pt=new d2.Quaternion().setFromEuler(new d2.Euler(0,-Math.PI/2,0)),pi=new d2.Quaternion().setFromEuler(new d2.Euler(Math.PI/2,0,0));class pn extends d2.Group{context;size;fixed;free;translationX;translationY;translationZ;translationNegX;translationNegY;translationNegZ;translationXY;translationYZ;translationXZ;scaleGroup=new d2.Group;xAxis=new d2.Vector3;yAxis=new d2.Vector3;zAxis=new d2.Vector3;negXAxis=new d2.Vector3;negYAxis=new d2.Vector3;negZAxis=new d2.Vector3;constructor(e,t,i){super(),this.context=e,this.size=t,this.fixed=i,this.add(this.scaleGroup),this.free=new d5(this.context),this.scaleGroup.add(this.free),this.translationX=new d0(this.context,"x",void 0,this.xAxis),this.scaleGroup.add(this.translationX),this.translationY=new d0(this.context,"y",void 0,this.yAxis),this.scaleGroup.add(this.translationY),this.translationZ=new d0(this.context,"z",void 0,this.zAxis),this.scaleGroup.add(this.translationZ),this.translationNegX=new d0(this.context,"x",void 0,this.negXAxis,!0,!1),this.scaleGroup.add(this.translationNegX),this.translationNegY=new d0(this.context,"y",void 0,this.negYAxis,!0,!1),this.scaleGroup.add(this.translationNegY),this.translationNegZ=new d0(this.context,"z",void 0,this.negZAxis,!0,!1),this.scaleGroup.add(this.translationNegZ),this.translationXY=new d1(this.context,"xy",void 0,[this.xAxis,this.yAxis]),this.scaleGroup.add(this.translationXY),this.translationXZ=new d1(this.context,"xz",void 0,[this.xAxis,this.zAxis]),this.scaleGroup.add(this.translationXZ),this.translationYZ=new d1(this.context,"yz",void 0,[this.yAxis,this.zAxis]),this.scaleGroup.add(this.translationYZ)}update(e){this.updateWorldMatrix(!0,!1),this.xAxis.set(1,0,0),this.yAxis.set(0,1,0),this.zAxis.set(0,0,1),this.free.quaternion.identity(),this.translationX.quaternion.copy(d8),this.translationY.quaternion.copy(d7),this.translationZ.quaternion.copy(d9),this.translationNegX.quaternion.copy(d8),this.translationNegY.quaternion.copy(d7),this.translationNegZ.quaternion.copy(d9),this.translationXY.quaternion.copy(pe),this.translationYZ.quaternion.copy(pt),this.translationXZ.quaternion.copy(pi);let t=this.context.getSpace(),i=this.context.getTarget();"world"==t&&null!=i?(i.getWorldQuaternion(d6).invert(),this.free.quaternion.premultiply(d6),this.translationX.quaternion.premultiply(d6),this.translationY.quaternion.premultiply(d6),this.translationZ.quaternion.premultiply(d6),this.translationNegX.quaternion.premultiply(d6),this.translationNegY.quaternion.premultiply(d6),this.translationNegZ.quaternion.premultiply(d6),this.translationXY.quaternion.premultiply(d6),this.translationYZ.quaternion.premultiply(d6),this.translationXZ.quaternion.premultiply(d6),null!=i.parent&&(i.parent.getWorldQuaternion(d6).invert(),this.xAxis.applyQuaternion(d6),this.yAxis.applyQuaternion(d6),this.zAxis.applyQuaternion(d6))):null!=i&&(this.xAxis.applyQuaternion(i.quaternion),this.yAxis.applyQuaternion(i.quaternion),this.zAxis.applyQuaternion(i.quaternion)),this.negXAxis.copy(this.xAxis).negate(),this.negYAxis.copy(this.yAxis).negate(),this.negZAxis.copy(this.zAxis).negate(),this.scaleGroup.scale.setScalar(1),null!=i&&(i.getWorldScale(d4),this.scaleGroup.scale.divide(d4)),this.scaleGroup.scale.multiplyScalar(dK(this,e,this.fixed??!0,this.size??1))}bind(e){var t,i;let n,r,a,s,o,l=(t=this,i=this.context,(n=new uR.Mesh(new uR.OctahedronGeometry(.01,2),new uR.MeshBasicMaterial(dF))).renderOrder=1/0,n.visible=!1,t.add(n),(r=new uR.Mesh(new uR.OctahedronGeometry(.01,2),new uR.MeshBasicMaterial(dF))).renderOrder=1/0,r.visible=!1,t.add(r),(a=new uR.BufferGeometry).setAttribute("position",new uR.Float32BufferAttribute([0,0,0,1,1,1],3)),(s=new uR.LineSegments(a,new uR.LineBasicMaterial(dF))).renderOrder=1/0,s.visible=!1,t.add(s),o=i.subscribeApply((e,t)=>{r.position.set(0,0,0),n.position.copy(t.initial.position).sub(t.current.position);let a=i.getTarget();null!=a&&(d3.copy(a.quaternion).invert(),n.position.applyQuaternion(d3)),s.position.set(0,0,0),s.scale.copy(n.position),n.visible=!t.last,s.visible=!t.last,r.visible=!t.last}),()=>{n.geometry.dispose(),n.material.dispose(),r.geometry.dispose(),r.material.dispose(),s.geometry.dispose(),s.material.dispose(),t.remove(n),t.remove(r),t.remove(s),o()}),c=this.translationX.bind(0xff0000,0xffff00,e),h=this.translationY.bind(65280,0xffff00,e),u=this.translationZ.bind(255,0xffff00,e),d=this.translationNegX.bind(0xff0000,0xffff00,e),p=this.translationNegY.bind(65280,0xffff00,e),f=this.translationNegZ.bind(255,0xffff00,e),m=this.translationXY.bind(255,0xffff00,e),g=this.translationYZ.bind(0xff0000,0xffff00,e),v=this.translationXZ.bind(65280,0xffff00,e),_=this.free.bind(e);return()=>{l(),c?.(),h?.(),u?.(),d?.(),p?.(),f?.(),m?.(),g?.(),v?.(),_?.()}}}var pr=uR;let pa=new uR.Euler(0,0,-Math.PI/2),ps=new uR.Euler(0,0,Math.PI/2);class po extends dW{invert;showHandleLine;constructor(e,t,i="",n=!1,r=!0){super(e,t,i,()=>({scale:this.options,rotate:!1,translate:"as-scale",multitouch:!1})),this.invert=n,this.showHandleLine=r}bind(e,t,i){let n,r,a,{options:s,disabled:o}=dX(this.axis,i);if(!1===s)return;this.options=s;let l=this.invert?ps:pa,c=new uR.Group;c.position.x=this.invert?-.5:.5,c.rotation.copy(l),this.add(c);let h=new uR.MeshBasicMaterial(dF),u=dB(this.context,h,this.tag,{color:e,hoverColor:t,disabled:o}),d=new uR.Mesh(new uR.BoxGeometry(.08,.08,.08),h);if(d.renderOrder=1/0,d.rotation.copy(l),c.add(d),this.showHandleLine){(a=new uR.Group).rotation.copy(l),this.add(a);let i=new uR.MeshBasicMaterial(dF);n=dB(this.context,i,this.tag,{color:e,hoverColor:t,disabled:o}),(r=new uR.Mesh(new uR.CylinderGeometry(.0075,.0075,.5,3),i)).renderOrder=1/0,r.position.y=.25,a.add(r)}let p=new uR.Group;p.visible=!1,p.rotation.copy(l),p.position.x=this.invert?-.3:.3,this.add(p);let f=new uR.Mesh(new uR.CylinderGeometry(.2,0,.5,4));f.pointerEventsOrder=1/0,f.position.y=.04,p.add(f);let m=o?void 0:this.context.registerHandle(this.store,f,this.tag);return()=>{h.dispose(),f.geometry.dispose(),d.geometry.dispose(),r?.geometry.dispose(),m?.(),u?.(),n?.(),null!=a&&this.remove(a),this.remove(p),this.remove(c)}}}class pl extends dW{constructor(e,t,i=""){super(e,t,i,()=>({translate:"as-scale",scale:this.options,rotate:!1,multitouch:!1}))}bind(e,t,i){let{options:n,disabled:r}=dX(this.axis,i);if(!1===n)return;this.options=n;let a=new uR.MeshBasicMaterial(dF),s=dB(this.context,a,this.tag,{opacity:.5,hoverOpacity:1,color:e,hoverColor:t,disabled:r}),o=new uR.Mesh(new uR.BoxGeometry(.2,.2,.01),a);o.renderOrder=1/0,o.pointerEventsOrder=1/0,o.position.set(.15,.15,0);let l=r?void 0:this.context.registerHandle(this.store,o,this.tag);return this.add(o),()=>{a.dispose(),o.geometry.dispose(),l?.(),s?.(),this.remove(o)}}}let pc=new uR.Euler(0,0,-Math.PI/2),ph=new uR.Euler(0,0,Math.PI/2);class pu extends dW{actualAxis;invert;constructor(e,t="",i,n=!1){super(e,"xyz",t,()=>({scale:{uniform:!0,...this.options},rotate:!1,translate:"as-scale",multitouch:!1})),this.actualAxis=i,this.invert=n}bind(e,t,i){let{options:n,disabled:r}=dX(this.actualAxis,i);if(!1===n)return;this.options=n;let a=this.invert?ph:pc,s=new uR.Group;s.position.x=this.invert?-.7:.7,s.rotation.copy(a),this.add(s);let o=new uR.MeshBasicMaterial(dF),l=dB(this.context,o,this.tag,{color:e,hoverColor:t,opacity:.5,hoverOpacity:1,disabled:r}),c=new uR.Mesh(new uR.BoxGeometry(.08,.08,.08),o);c.renderOrder=1/0,c.rotation.copy(a),s.add(c);let h=new uR.Mesh(new uR.BoxGeometry(.15,.15,.15),o);h.visible=!1,h.pointerEventsOrder=1/0,h.rotation.copy(a),s.add(h);let u=r?void 0:this.context.registerHandle(this.store,h,this.tag);return()=>{o.dispose(),c.geometry.dispose(),u?.(),l?.(),this.remove(s)}}}let pd=new pr.Vector3;class pp extends pr.Group{context;size;fixed;scaleX;scaleY;scaleZ;scaleNegX;scaleNegY;scaleNegZ;translationX;translationY;translationZ;translationNegX;translationNegY;translationNegZ;translationXY;translationYZ;translationXZ;constructor(e,t,i){super(),this.context=e,this.size=t,this.fixed=i,this.scaleX=new pu(this.context,void 0,"x"),this.add(this.scaleX),this.scaleY=new pu(this.context,void 0,"y"),this.scaleY.rotation.z=Math.PI/2,this.add(this.scaleY),this.scaleZ=new pu(this.context,void 0,"z"),this.scaleZ.rotation.y=-Math.PI/2,this.add(this.scaleZ),this.scaleNegX=new pu(this.context,void 0,"x",!0),this.add(this.scaleNegX),this.scaleNegY=new pu(this.context,void 0,"y",!0),this.scaleNegY.rotation.z=Math.PI/2,this.add(this.scaleNegY),this.scaleNegZ=new pu(this.context,void 0,"z",!0),this.scaleNegZ.rotation.y=-Math.PI/2,this.add(this.scaleNegZ),this.translationX=new po(this.context,"x"),this.add(this.translationX),this.translationY=new po(this.context,"y"),this.translationY.rotation.z=Math.PI/2,this.add(this.translationY),this.translationZ=new po(this.context,"z"),this.translationZ.rotation.y=-Math.PI/2,this.add(this.translationZ),this.translationNegX=new po(this.context,"x",void 0,!0,!1),this.add(this.translationNegX),this.translationNegY=new po(this.context,"y",void 0,!0,!1),this.translationNegY.rotation.z=Math.PI/2,this.add(this.translationNegY),this.translationNegZ=new po(this.context,"z",void 0,!0,!1),this.translationNegZ.rotation.y=-Math.PI/2,this.add(this.translationNegZ),this.translationXY=new pl(this.context,"xy"),this.add(this.translationXY),this.translationXZ=new pl(this.context,"xz"),this.translationXZ.rotation.x=Math.PI/2,this.add(this.translationXZ),this.translationYZ=new pl(this.context,"yz"),this.translationYZ.rotation.y=-Math.PI/2,this.add(this.translationYZ)}update(e){this.updateWorldMatrix(!0,!1),this.scale.setScalar(1);let t=this.context.getTarget();null!=t&&(t.getWorldScale(pd),this.scale.divide(pd)),this.scale.multiplyScalar(dK(this,e,this.fixed??!0,this.size??1))}bind(e){let t=this.scaleX.bind(0xffffff,0xffff00,e),i=this.scaleY.bind(0xffffff,0xffff00,e),n=this.scaleZ.bind(0xffffff,0xffff00,e),r=this.scaleNegX.bind(0xffffff,0xffff00,e),a=this.scaleNegY.bind(0xffffff,0xffff00,e),s=this.scaleNegZ.bind(0xffffff,0xffff00,e),o=this.translationX.bind(0xff0000,0xffff00,e),l=this.translationY.bind(65280,0xffff00,e),c=this.translationZ.bind(255,0xffff00,e),h=this.translationNegX.bind(0xff0000,0xffff00,e),u=this.translationNegY.bind(65280,0xffff00,e),d=this.translationNegZ.bind(255,0xffff00,e),p=this.translationXY.bind(255,0xffff00,e),f=this.translationYZ.bind(0xff0000,0xffff00,e),m=this.translationXZ.bind(65280,0xffff00,e);return()=>{o?.(),l?.(),c?.(),h?.(),u?.(),d?.(),p?.(),f?.(),m?.(),t?.(),i?.(),n?.(),r?.(),a?.(),s?.()}}}var pf=uR;let pm={x:{vector1:new uR.Vector3(0,0,-1),vector2:new uR.Vector3(0,-1,0),rotationOffset:new uR.Quaternion,axis:[1,0,0]},y:{vector1:new uR.Vector3(0,0,-1),vector2:new uR.Vector3(-1,0,-1),rotationOffset:new uR.Quaternion().setFromEuler(new uR.Euler(0,0,Math.PI/2)),axis:[0,1,0]},z:{vector1:new uR.Vector3(-1,0,0),vector2:new uR.Vector3(0,-1,0),rotationOffset:new uR.Quaternion().setFromEuler(new uR.Euler(0,Math.PI/2,0)),axis:[0,0,1]}},pg=new uR.Vector3,pv=new uR.Vector3,p_=new uR.Vector3,px=new uR.Vector3,py=new uR.Quaternion;class pM extends dW{direction=new uR.Vector3(1,0,0);constructor(e,t,i=""){super(e,t,i,()=>({scale:!1,translate:"as-rotate",rotate:[this.direction],multitouch:!1}))}update(e){let{rotationOffset:t,vector1:i,vector2:n}=pm[this.axis];e.getWorldPosition(pg),this.getWorldPosition(pv).sub(pg),p_.copy(i),px.copy(n);let r=this.context.getTarget(),a=this.context.getSpace();"local"===a&&null!=r&&(r.getWorldQuaternion(py),p_.applyQuaternion(py),px.applyQuaternion(py)),px.crossVectors(p_,px);let s=pv.dot(px);px.multiplyScalar(s),pv.sub(px),this.quaternion.setFromUnitVectors(p_,pv.normalize()),"local"===a&&null!=r&&(r.getWorldQuaternion(py),this.quaternion.multiply(py)),this.quaternion.multiply(t),r?.parent!=null?(r.parent.matrixWorld.decompose(pg,py,pv),py.invert(),this.quaternion.premultiply(py)):py.identity(),null==this.store.getState()&&(this.direction.fromArray(pm[this.axis].axis),this.direction.applyQuaternion("local"===a&&null!=r?r?.quaternion:py)),null!=r&&this.quaternion.premultiply(py.copy(r.quaternion).invert())}bind(e,t){let{options:i,disabled:n}=dX(this.axis,t);if(!1===i)return;this.options=i;let r=new uR.MeshBasicMaterial(dF),a=dB(this.context,r,this.tag,{color:e,hoverColor:0xffff00,disabled:n}),s=new uR.Mesh(pI(.5,.5),r);s.renderOrder=1/0,this.add(s);let o=new uR.Mesh(new uR.TorusGeometry(.5,.1,4,24));o.visible=!1,o.pointerEventsOrder=1/0,o.rotation.set(0,-Math.PI/2,-Math.PI/2),this.add(o);let l=n?void 0:this.context.registerHandle(this.store,o,this.tag);return()=>{r.dispose(),o.geometry.dispose(),s.geometry.dispose(),l?.(),a?.(),this.remove(o),this.remove(s)}}}let pS=new uR.Vector3,pb=new uR.Vector3,pE=new uR.Vector3(1,0,0),pT=new uR.Quaternion;class pw extends dW{constructor(e,t=""){super(e,"xyz",t,()=>({scale:!1,translate:"as-rotate",rotate:this.options,multitouch:!1}))}update(e){e.getWorldPosition(pS),this.getWorldPosition(pb).sub(pS),this.quaternion.setFromUnitVectors(pE,pb.normalize());let t=this.context.getTarget();t?.parent!=null&&(t.parent.matrixWorld.decompose(pS,pT,pb),pT.invert(),this.quaternion.premultiply(pT)),null!=t&&(pT.copy(t.quaternion).invert(),this.quaternion.premultiply(pT))}bind(e){let{options:t,disabled:i}=dX(this.axis,e);if(!1===t)return;this.options=t;let n=new uR.MeshBasicMaterial(dF),r=dB(this.context,n,this.tag,{color:0xffffff,hoverColor:0xffff00,opacity:.25,disabled:i}),a=new uR.Mesh(pI(.5,1),n);a.renderOrder=1/0,this.add(a);let s=new uR.Mesh(new uR.SphereGeometry(.25,10,8));s.visible=!1,s.pointerEventsOrder=1/0,this.add(s);let o=i?void 0:this.context.registerHandle(this.store,s,this.tag);return()=>{this.pointerEvents="none",n.dispose(),s.geometry.dispose(),a.geometry.dispose(),o?.(),r?.(),this.remove(s),this.remove(a)}}}let pA=new uR.Vector3,pR=new uR.Vector3,pC=new uR.Vector3(1,0,0),pP=new uR.Quaternion;class pL extends dW{direction=new uR.Vector3(1,0,0);constructor(e,t=""){super(e,"e",t,()=>({scale:!1,translate:"as-rotate",rotate:[this.direction],multitouch:!1}))}update(e){e.getWorldPosition(pA),this.getWorldPosition(this.direction).sub(pA).normalize(),this.quaternion.setFromUnitVectors(pC,this.direction);let t=this.context.getTarget();t?.parent!=null&&(t.parent.matrixWorld.decompose(pA,pP,pR),pP.invert(),this.quaternion.premultiply(pP),this.direction.applyQuaternion(pP)),null!=t&&(pP.copy(t.quaternion).invert(),this.quaternion.premultiply(pP)),this.direction.negate()}bind(e){let{options:t,disabled:i}=dX(this.axis,e);if(!1===t)return;this.options=t;let n=new uR.MeshBasicMaterial(dF),r=dB(this.context,n,this.tag,{color:0xffff00,hoverColor:0xffff00,opacity:.5,disabled:i}),a=new uR.Mesh(pI(.75,1),n);a.renderOrder=1/0,this.add(a);let s=new uR.Mesh(new uR.TorusGeometry(.75,.1,2,24),new uR.MeshBasicMaterial({color:"white"}));s.visible=!1,s.rotation.y=Math.PI/2,s.pointerEventsOrder=1/0,this.add(s);let o=i?void 0:this.context.registerHandle(this.store,s,this.tag);return()=>{n.dispose(),s.geometry.dispose(),a.geometry.dispose(),o?.(),r?.(),this.remove(s),this.remove(a)}}}function pI(e,t){let i=new pf.TorusGeometry(e,.0075,3,64,t*Math.PI*2);return i.rotateY(Math.PI/2),i.rotateX(Math.PI/2),i}let pN=new pf.Vector3;class pD extends pf.Group{context;fixed;size;rotationX;rotationY;rotationZ;free;screen;constructor(e,t,i){super(),this.context=e,this.fixed=t,this.size=i,this.rotationX=new pM(this.context,"x"),this.add(this.rotationX),this.rotationY=new pM(this.context,"y"),this.add(this.rotationY),this.rotationZ=new pM(this.context,"z"),this.add(this.rotationZ),this.free=new pw(this.context),this.add(this.free),this.screen=new pL(this.context),this.add(this.screen)}update(e){this.updateWorldMatrix(!0,!1),this.rotationX.update(e),this.rotationY.update(e),this.rotationZ.update(e),this.free.update(e),this.screen.update(e),this.scale.setScalar(1);let t=this.context.getTarget();null!=t&&(t.getWorldScale(pN),this.scale.divide(pN)),this.scale.multiplyScalar(dK(this,e,this.fixed??!0,this.size??1))}bind(e){let t=this.rotationX.bind(0xff0000,e),i=this.rotationY.bind(65280,e),n=this.rotationZ.bind(255,e),r=this.screen.bind(e),a=this.free.bind(e);return()=>{t?.(),i?.(),n?.(),r?.(),a?.()}}}var pU=uR;let pO=new pU.Euler,pF=new pU.Euler(0,0,Math.PI/2),pB=new pU.Euler(0,-Math.PI/2,0);class pz extends pU.Group{xAxisHighlight;yAxisHighlight;zAxisHighlight;handles;context;constructor(e){super(),this.context=new dO(this,e),this.xAxisHighlight=new dH(this.context,pO),this.add(this.xAxisHighlight),this.yAxisHighlight=new dH(this.context,pF),this.add(this.yAxisHighlight),this.zAxisHighlight=new dH(this.context,pB),this.add(this.zAxisHighlight)}set space(e){this.context.space=e}get space(){return this.context.space}update(e,t){this.context.update(e),this.xAxisHighlight.update(),this.yAxisHighlight.update(),this.zAxisHighlight.update(),this.handles?.update(t)}bind(e,t){let i=this.xAxisHighlight.bind("x"),n=this.yAxisHighlight.bind("y"),r=this.zAxisHighlight.bind("z");switch(e){case"rotate":this.handles=new pD(this.context);break;case"scale":this.handles=new pp(this.context);break;case"translate":this.handles=new pn(this.context)}this.add(this.handles);let a=this.handles.bind(t);return()=>{null!=this.handles&&this.remove(this.handles),this.handles=void 0,a(),i(),n(),r()}}}new uR.Vector3(0,0,1),new uR.Vector3(0,1,0),new uR.Vector3,new uR.Vector3,new uR.Euler,new uR.Quaternion,new uR.Vector3,new uR.Quaternion,new uR.Quaternion,e.i(65487),e.i(81041),new uR.Vector2,new uR.Quaternion,new uR.Vector3,new uR.Vector3,new uR.Vector3,new uR.Vector2,new uR.Vector2,new uR.Vector3,new uR.Vector3,new uR.Vector2,new uR.Vector2,new uR.Vector2,new uR.Vector2,new uR.Vector3,new uR.Vector3;var pk=e.i(21146);Symbol("@@iwer/devui/input-scene");class pV{constructor(e){this.xrDevice=e,this.combinedCameraPosition=new sB,this.isPointerLocked=!1,this.vec3=new sB,this.quat=new sF,this.keyState={ShiftLeft:!1,KeyW:!1,KeyA:!1,KeyS:!1,KeyD:!1,ArrowUp:!1,ArrowDown:!1},this.lastTime=0,this.scene=new h5,this.camera=new lC(50,window.innerWidth/window.innerHeight,.1,40),this.playerRig=new hX,this.cameraRig=new hX,this.scene.add(this.playerRig),this.playerRig.add(this.cameraRig),this.cameraRig.position.fromArray(e.position.vec3),this.cameraRig.quaternion.fromArray(e.quaternion.quat),this.cameraRig.add(this.camera),this.camera.position.x-=e.ipd/2;const t=new l_(new uh(.25,.27,32),new oZ({color:0xffffff,side:0}));t.rotateX(-Math.PI/2),this.scene.add(t),this.renderer=new h3({alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.setClearColor(0,0),this.renderer.domElement.style.position="fixed",this.renderer.domElement.style.top="50vh",this.renderer.domElement.style.left="50vw",this.renderer.domElement.style.transform="translate(-50%, -50%)",this.transformHandles=new Map,["left","right"].forEach(t=>{let i=new pz;i.scale.setScalar(.1),i.position.fromArray(e.controllers[t].position.vec3),i.quaternion.fromArray(e.controllers[t].quaternion.quat),this.cameraRig.attach(i),i.userData={defaultPosition:i.position.toArray(),defaultQuaternion:i.quaternion.toArray()},i.userData.setMode=e=>{var t,n;null==(n=(t=i.userData).modeCleanup)||n.call(t),i.userData.modeCleanup=i.bind(e),i.userData.mode=e},i.userData.setMode("translate"),i.space="local",this.transformHandles.set(t,i),i.addEventListener("click",()=>{"translate"===i.userData.mode?i.userData.setMode("rotate"):i.userData.setMode("translate")})}),window.transformHandles=this.transformHandles,this.mouseMoveHandler=t=>{if(!this.isPointerLocked)return;let i=t.movementX||t.mozMovementX||t.webkitMovementX||0,n=t.movementY||t.mozMovementY||t.webkitMovementY||0;this.playerRig.rotation.y-=.002*i,this.cameraRig.rotation.x-=.002*n,e.quaternion.copy(this.cameraRig.getWorldQuaternion(new sF))},this.cameraRig.getWorldPosition(this.combinedCameraPosition),this.headsetDefaultPosition=this.cameraRig.position.clone(),this.headsetDefaultQuaternion=this.cameraRig.quaternion.clone(),this.forwardHtmlEvents=(0,pk.forwardHtmlEvents)(this.renderer.domElement,()=>this.camera,this.scene).update,document.addEventListener("pointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("mozpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("webkitpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.addEventListener("keydown",this.keyDownHandler.bind(this),!1),document.addEventListener("keyup",this.keyUpHandler.bind(this),!1)}lockPointer(){this.renderer.domElement.requestPointerLock=this.renderer.domElement.requestPointerLock||this.renderer.domElement.mozRequestPointerLock||this.renderer.domElement.webkitRequestPointerLock,this.renderer.domElement.requestPointerLock()}pointerLockChangeHandler(){this.isPointerLocked=document.pointerLockElement===this.renderer.domElement||document.mozPointerLockElement===this.renderer.domElement||document.webkitPointerLockElement===this.renderer.domElement,this.isPointerLocked?(document.addEventListener("mousemove",this.mouseMoveHandler,!1),Object.values(this.transformHandles).forEach(e=>{e.visible=!1})):(document.removeEventListener("mousemove",this.mouseMoveHandler,!1),Object.values(this.transformHandles).forEach(e=>{e.visible=!0}))}keyDownHandler(e){let{keyState:t}=this;e.code in t&&(t[e.code]=!0),t.ShiftLeft&&t.ArrowUp&&(this.cameraRig.position.y+=.05),t.ShiftLeft&&t.ArrowDown&&(this.cameraRig.position.y-=.05)}keyUpHandler(e){let{keyState:t}=this;e.code in t&&(t[e.code]=!1)}movePlayerRig(e){let{playerRig:t,keyState:i,vec3:n}=this;n.set(!!i.KeyD-!!i.KeyA,0,!!i.KeyS-!!i.KeyW),n.lengthSq()>0&&i.ShiftLeft&&(n.normalize().multiplyScalar(2*e).applyQuaternion(t.quaternion),t.position.add(n))}resetDeviceTransforms(){let{playerRig:e,cameraRig:t,transformHandles:i}=this;t.position.copy(this.headsetDefaultPosition),t.quaternion.copy(this.headsetDefaultQuaternion),e.position.set(0,0,0),e.quaternion.set(0,0,0,1),i.forEach(e=>{e.position.fromArray(e.userData.defaultPosition),e.quaternion.fromArray(e.userData.defaultQuaternion)})}syncDeviceTransforms(){let{xrDevice:e,cameraRig:t,transformHandles:i}=this;e.position.copy(t.getWorldPosition(this.vec3)),e.quaternion.copy(t.getWorldQuaternion(this.quat)),i.forEach((t,i)=>{let n="controller"===e.primaryInputMode?e.controllers[i]:e.hands[i];n.position.copy(t.getWorldPosition(this.vec3)),n.quaternion.copy(t.getWorldQuaternion(this.quat))})}renderScene(e){let t=this.xrDevice.fovy/Math.PI*180,i=!1;this.camera.fov!==t&&(this.camera.fov=t,i=!0);let n=this.xrDevice.canvasDimensions;if(n){let e=this.renderer.domElement;(e.width!==n.width||e.height!==n.height)&&(this.camera.aspect=n.width/n.height,this.renderer.setSize(n.width,n.height),i=!0)}i&&this.camera.updateProjectionMatrix(),this.isPointerLocked?this.cameraRig.getWorldPosition(this.combinedCameraPosition):(this.cameraRig.position.y=this.combinedCameraPosition.y,this.playerRig.position.x=this.combinedCameraPosition.x,this.playerRig.position.z=this.combinedCameraPosition.z),this.forwardHtmlEvents(),this.transformHandles.forEach((t,i)=>{var n;let r=!!(null==(n=this.xrDevice.controllers[i])?void 0:n.connected);t.visible=r&&!this.isPointerLocked,r&&t.update(e,this.camera)});let r=Math.min((e-this.lastTime)/1e3,.1);this.movePlayerRig(r),this.syncDeviceTransforms(),this.renderer.render(this.scene,this.camera),this.lastTime=e}get domElement(){return this.renderer.domElement}dispose(){this.renderer.dispose(),document.removeEventListener("pointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("mozpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("webkitpointerlockchange",this.pointerLockChangeHandler.bind(this),!1),document.removeEventListener("mousemove",this.mouseMoveHandler,!1),document.removeEventListener("keydown",this.keyDownHandler.bind(this),!1),document.removeEventListener("keyup",this.keyUpHandler.bind(this),!1)}}var pH=e.i(88014);class pG{constructor(e){this.version="1.1.1",e.ipd=0,a$.getState().setInputMode(e.primaryInputMode),this.devUIContainer=document.createElement("div"),this.devUIContainer.style.position="fixed",this.devUIContainer.style.width="100vw",this.devUIContainer.style.height="100vh",this.devUIContainer.style.top="50vh",this.devUIContainer.style.left="50vw",this.devUIContainer.style.transform="translate(-50%, -50%)",this.devUIContainer.style.pointerEvents="none";const t=this.devUIContainer.attachShadow({mode:"open"});this.inputLayer=new pV(e),(0,pH.createRoot)(t).render((0,Y.jsx)(pW,{xrDevice:e,inputLayer:this.inputLayer,shadowRoot:t}));const i=()=>{let t=document.createElement("div");document.body.appendChild(t);let i=t.attachShadow({mode:"open"});(0,pH.createRoot)(i).render((0,Y.jsx)(pj,{xrDevice:e,shadowRoot:i}))};document.body?i():window.onload=i}render(e){this.inputLayer.renderScene(e)}get devUICanvas(){return this.inputLayer.domElement}}let pW=({xrDevice:e,inputLayer:t,shadowRoot:i})=>{let[n,r]=(0,i_.useState)(!1);return(0,i_.useEffect)(()=>{let e=()=>{r(!!(document.pointerLockElement||document.mozPointerLockElement||document.webkitPointerLockElement))};return document.addEventListener("pointerlockchange",e,!1),document.addEventListener("mozpointerlockchange",e,!1),document.addEventListener("webkitpointerlockchange",e,!1),()=>{document.removeEventListener("pointerlockchange",e,!1),document.removeEventListener("mozpointerlockchange",e,!1),document.removeEventListener("webkitpointerlockchange",e,!1)}},[]),(0,Y.jsx)(rS,{target:i,disableCSSOMInjection:!0,children:(0,Y.jsxs)("div",{style:{width:"100vw",height:"100vh",display:"flex",flexDirection:"column",justifyContent:"space-between",pointerEvents:"none"},children:[(0,Y.jsx)(a3,{xrDevice:e,inputLayer:t}),(0,Y.jsx)(a6,{xrDevice:e,inputLayer:t,pointerLocked:n}),(0,Y.jsx)(aJ,{xrDevice:e,inputLayer:t,pointerLocked:n})]})})},pj=({xrDevice:e,shadowRoot:t})=>{let[i,n]=i_.default.useState(e.sessionOffered&&!e.activeSession);return i_.default.useEffect(()=>{setInterval(()=>{n(e.sessionOffered&&!e.activeSession)},1e3)},[]),(0,Y.jsx)(rS,{target:t,disableCSSOMInjection:!0,children:(0,Y.jsxs)(rK,{style:{zIndex:899,position:"fixed",top:i?"8px":"-30px",display:"flex",flexDirection:"row",alignItems:"center",justifyItems:"space-between",left:"50vw",transform:"translateX(-50%)",transition:"all 0.2s ease-in-out",paddingLeft:"5px",gap:"3px"},children:[(0,Y.jsx)(aE,{size:24}),(0,Y.jsx)(rZ,{onClick:()=>{e.grantOfferedSession()},style:{fontSize:"16px"},children:"Enter XR"})]})})},pX="srgb",pq="srgb-linear",pY="display-p3",pK="display-p3-linear",pZ="linear",p$="srgb",pJ="rec709",pQ="300 es";class p0{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let i=this._listeners;void 0===i[e]&&(i[e]=[]),-1===i[e].indexOf(t)&&i[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let i=this._listeners;return void 0!==i[e]&&-1!==i[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let i=this._listeners[e];if(void 0!==i){let e=i.indexOf(t);-1!==e&&i.splice(e,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let i=t.slice(0);for(let t=0,n=i.length;t<n;t++)i[t].call(this,e);e.target=null}}}let p1=["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"],p2=Math.PI/180,p3=180/Math.PI;function p5(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0;return(p1[255&e]+p1[e>>8&255]+p1[e>>16&255]+p1[e>>24&255]+"-"+p1[255&t]+p1[t>>8&255]+"-"+p1[t>>16&15|64]+p1[t>>24&255]+"-"+p1[63&i|128]+p1[i>>8&255]+"-"+p1[i>>16&255]+p1[i>>24&255]+p1[255&n]+p1[n>>8&255]+p1[n>>16&255]+p1[n>>24&255]).toLowerCase()}function p4(e,t,i){return Math.max(t,Math.min(i,e))}function p6(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/0xffffffff;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/0x7fffffff,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function p8(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(0xffffffff*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(0x7fffffff*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}class p7{constructor(e=0,t=0){p7.prototype.isVector2=!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 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 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){let t=this.x,i=this.y,n=e.elements;return this.x=n[0]*t+n[3]*i+n[6],this.y=n[1]*t+n[4]*i+n[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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(p4(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let i=Math.cos(t),n=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*i-a*n+e.x,this.y=r*n+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class p9{constructor(e,t,i,n,r,a,s,o,l){p9.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l)}set(e,t,i,n,r,a,s,o,l){let c=this.elements;return c[0]=e,c[1]=n,c[2]=s,c[3]=t,c[4]=r,c[5]=o,c[6]=i,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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){let 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){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[3],o=i[6],l=i[1],c=i[4],h=i[7],u=i[2],d=i[5],p=i[8],f=n[0],m=n[3],g=n[6],v=n[1],_=n[4],x=n[7],y=n[2],M=n[5],S=n[8];return r[0]=a*f+s*v+o*y,r[3]=a*m+s*_+o*M,r[6]=a*g+s*x+o*S,r[1]=l*f+c*v+h*y,r[4]=l*m+c*_+h*M,r[7]=l*g+c*x+h*S,r[2]=u*f+d*v+p*y,r[5]=u*m+d*_+p*M,r[8]=u*g+d*x+p*S,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8];return t*a*c-t*s*l-i*r*c+i*s*o+n*r*l-n*a*o}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=c*a-s*l,u=s*o-c*r,d=l*r-a*o,p=t*h+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);let f=1/p;return e[0]=h*f,e[1]=(n*l-c*i)*f,e[2]=(s*i-n*a)*f,e[3]=u*f,e[4]=(c*t-n*o)*f,e[5]=(n*r-s*t)*f,e[6]=d*f,e[7]=(i*o-l*t)*f,e[8]=(a*t-i*r)*f,this}transpose(){let e,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){let 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,n,r,a,s){let o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*a+l*s)+a+e,-n*l,n*o,-n*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(fe.makeScale(e,t)),this}rotate(e){return this.premultiply(fe.makeRotation(-e)),this}translate(e,t){return this.premultiply(fe.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){let 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){let t=this.elements,i=e.elements;for(let e=0;e<9;e++)if(t[e]!==i[e])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){let 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)}}let fe=new p9;function ft(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function fi(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;let fn={};function fr(e){e in fn||(fn[e]=!0,console.warn(e))}let fa=new p9().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),fs=new p9().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),fo={[pq]:{transfer:pZ,primaries:pJ,toReference:e=>e,fromReference:e=>e},[pX]:{transfer:p$,primaries:pJ,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[pK]:{transfer:pZ,primaries:"p3",toReference:e=>e.applyMatrix3(fs),fromReference:e=>e.applyMatrix3(fa)},[pY]:{transfer:p$,primaries:"p3",toReference:e=>e.convertSRGBToLinear().applyMatrix3(fs),fromReference:e=>e.applyMatrix3(fa).convertLinearToSRGB()}},fl=new Set([pq,pK]),fc={enabled:!0,_workingColorSpace:pq,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(colorSpace){if(!fl.has(colorSpace))throw Error(`Unsupported working color space, "${colorSpace}".`);this._workingColorSpace=colorSpace},convert:function(e,t,i){if(!1===this.enabled||t===i||!t||!i)return e;let n=fo[t].toReference;return(0,fo[i].fromReference)(n(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return fo[e].primaries},getTransfer:function(e){return""===e?pZ:fo[e].transfer}};function fh(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function fu(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}class fd{static getDataURL(e){let t;if(/^data:/i.test(e.src)||"u"<typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===i&&(i=fi("canvas")),i.width=e.width,i.height=e.height;let n=i.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=i}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=fi("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let n=i.getImageData(0,0,e.width,e.height),r=n.data;for(let e=0;e<r.length;e++)r[e]=255*fh(r[e]/255);return i.putImageData(n,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*fh(t[e]/255)):t[e]=fh(t[e]);return{data:t,width:e.width,height:e.height}}}}let fp=0;class ff{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:fp++}),this.uuid=p5(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let e;if(Array.isArray(n)){e=[];for(let t=0,i=n.length;t<i;t++)n[t].isDataTexture?e.push(fm(n[t].image)):e.push(fm(n[t]))}else e=fm(n);i.url=e}return t||(e.images[this.uuid]=i),i}}function fm(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?fd.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let fg=0;class fv extends p0{constructor(e=fv.DEFAULT_IMAGE,t=fv.DEFAULT_MAPPING,i=1001,n=1001,r=1006,a=1008,s=1023,o=1009,l=fv.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:fg++}),this.uuid=p5(),this.name="",this.source=new ff(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=n,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new p7(0,0),this.repeat=new p7(1,1),this.center=new p7(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new p9,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){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)}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.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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let i={metadata:{version:4.6,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,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(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}fv.DEFAULT_IMAGE=null,fv.DEFAULT_MAPPING=300,fv.DEFAULT_ANISOTROPY=1;class f_{constructor(e=0,t=0,i=0,n=1){f_.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=n}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,n){return this.x=e,this.y=t,this.z=i,this.w=n,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 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 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=void 0!==e.w?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){let t=this.x,i=this.y,n=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*n+a[12]*r,this.y=a[1]*t+a[5]*i+a[9]*n+a[13]*r,this.z=a[2]*t+a[6]*i+a[10]*n+a[14]*r,this.w=a[3]*t+a[7]*i+a[11]*n+a[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let 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,n,r,a=e.elements,s=a[0],o=a[4],l=a[8],c=a[1],h=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(.01>Math.abs(o-c)&&.01>Math.abs(l-d)&&.01>Math.abs(u-p)){if(.1>Math.abs(o+c)&&.1>Math.abs(l+d)&&.1>Math.abs(u+p)&&.1>Math.abs(s+h+f-3))return this.set(1,0,0,0),this;t=Math.PI;let e=(s+1)/2,a=(h+1)/2,m=(f+1)/2,g=(o+c)/4,v=(l+d)/4,_=(u+p)/4;return e>a&&e>m?e<.01?(i=0,n=.707106781,r=.707106781):(n=g/(i=Math.sqrt(e)),r=v/i):a>m?a<.01?(i=.707106781,n=0,r=.707106781):(i=g/(n=Math.sqrt(a)),r=_/n):m<.01?(i=.707106781,n=.707106781,r=0):(i=v/(r=Math.sqrt(m)),n=_/r),this.set(i,n,r,t),this}let m=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(c-o)*(c-o));return .001>Math.abs(m)&&(m=1),this.x=(p-u)/m,this.y=(l-d)/m,this.z=(c-o)/m,this.w=Math.acos((s+h+f-1)/2),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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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}}class fx extends p0{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new f_(0,0,e,t),this.scissorTest=!1,this.viewport=new f_(0,0,e,t);const n=new fv({width:e,height:t,depth:1},(i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i)).mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);n.flipY=!1,n.generateMipmaps=i.generateMipmaps,n.internalFormat=i.internalFormat,this.textures=[];const r=i.count;for(let e=0;e<r;e++)this.textures[e]=n.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}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 n=0,r=this.textures.length;n<r;n++)this.textures[n].image.width=e,this.textures[n].image.height=t,this.textures[n].image.depth=i;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;let t=Object.assign({},e.texture.image);return this.texture.source=new ff(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class fy extends fx{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class fM extends fv{constructor(e=null,t=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class fS{constructor(e=0,t=0,i=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=n}static slerpFlat(e,t,i,n,r,a,s){let o=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3],u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s){e[t+0]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h;return}if(1===s){e[t+0]=u,e[t+1]=d,e[t+2]=p,e[t+3]=f;return}if(h!==f||o!==u||l!==d||c!==p){let e=1-s,t=o*u+l*d+c*p+h*f,i=t>=0?1:-1,n=1-t*t;if(n>Number.EPSILON){let r=Math.sqrt(n),a=Math.atan2(r,t*i);e=Math.sin(e*a)/r,s=Math.sin(s*a)/r}let r=s*i;if(o=o*e+u*r,l=l*e+d*r,c=c*e+p*r,h=h*e+f*r,e===1-s){let e=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=e,l*=e,c*=e,h*=e}}e[t]=o,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,n,r,a){let s=i[n],o=i[n+1],l=i[n+2],c=i[n+3],h=r[a],u=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+c*h+o*d-l*u,e[t+1]=o*p+c*u+l*h-s*d,e[t+2]=l*p+c*d+s*u-o*h,e[t+3]=c*p-s*h-o*u-l*d,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,n){return this._x=e,this._y=t,this._z=i,this._w=n,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){let i=e._x,n=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(i/2),c=s(n/2),h=s(r/2),u=o(i/2),d=o(n/2),p=o(r/2);switch(a){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,n=Math.sin(i);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],n=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],c=t[6],h=t[10],u=i+s+h;if(u>0){let e=.5/Math.sqrt(u+1);this._w=.25/e,this._x=(c-o)*e,this._y=(r-l)*e,this._z=(a-n)*e}else if(i>s&&i>h){let e=2*Math.sqrt(1+i-s-h);this._w=(c-o)/e,this._x=.25*e,this._y=(n+a)/e,this._z=(r+l)/e}else if(s>h){let e=2*Math.sqrt(1+s-i-h);this._w=(r-l)/e,this._x=(n+a)/e,this._y=.25*e,this._z=(o+c)/e}else{let e=2*Math.sqrt(1+h-i-s);this._w=(a-n)/e,this._x=(r+l)/e,this._y=(o+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0):(this._x=0,this._y=-e.z,this._z=e.y)):(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(p4(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(0===i)return this;let n=Math.min(1,t/i);return this.slerp(e,n),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 0===e?(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){let i=e._x,n=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,c=t._w;return this._x=i*c+a*s+n*l-r*o,this._y=n*c+a*o+r*s-i*l,this._z=r*c+a*l+i*o-n*s,this._w=a*c-i*s-n*o-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let i=this._x,n=this._y,r=this._z,a=this._w,s=a*e._w+i*e._x+n*e._y+r*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=a,this._x=i,this._y=n,this._z=r,this;let o=1-s*s;if(o<=Number.EPSILON){let e=1-t;return this._w=e*a+t*this._w,this._x=e*i+t*this._x,this._y=e*n+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}let l=Math.sqrt(o),c=Math.atan2(l,s),h=Math.sin((1-t)*c)/l,u=Math.sin(t*c)/l;return this._w=a*h+this._w*u,this._x=i*h+this._x*u,this._y=n*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(e),n*Math.cos(e),r*Math.sin(t),r*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}}class fb{constructor(e=0,t=0,i=0){fb.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return void 0===i&&(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 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 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(fT.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(fT.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*n,this.y=r[1]*t+r[4]*i+r[7]*n,this.z=r[2]*t+r[5]*i+r[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,n=this.z,r=e.elements,a=1/(r[3]*t+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*n+r[12])*a,this.y=(r[1]*t+r[5]*i+r[9]*n+r[13])*a,this.z=(r[2]*t+r[6]*i+r[10]*n+r[14])*a,this}applyQuaternion(e){let t=this.x,i=this.y,n=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*n-s*i),c=2*(s*t-r*n),h=2*(r*i-a*t);return this.x=t+o*l+a*h-s*c,this.y=i+o*c+s*l-r*h,this.z=n+o*h+r*c-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,n=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*n,this.y=r[1]*t+r[5]*i+r[9]*n,this.z=r[2]*t+r[6]*i+r[10]*n,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=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}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){let i=e.x,n=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=n*o-r*s,this.y=r*a-i*o,this.z=i*s-n*a,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return fE.copy(this).projectOnVector(e),this.sub(fE)}reflect(e){return this.sub(fE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());return 0===t?Math.PI/2:Math.acos(p4(this.dot(e)/t,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,n=this.z-e.z;return t*t+i*i+n*n}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){let n=Math.sin(t)*e;return this.x=n*Math.sin(i),this.y=Math.cos(t)*e,this.z=n*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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}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(){let e=Math.random()*Math.PI*2,t=2*Math.random()-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}}let fE=new fb,fT=new fS;class fw{constructor(e=new fb(Infinity,Infinity,Infinity),t=new fb(-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(fR.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(fR.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){let i=fR.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=Infinity,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);let i=e.geometry;if(void 0!==i){let n=i.getAttribute("position");if(!0===t&&void 0!==n&&!0!==e.isInstancedMesh)for(let t=0,i=n.count;t<i;t++)!0===e.isMesh?e.getVertexPosition(t,fR):fR.fromBufferAttribute(n,t),fR.applyMatrix4(e.matrixWorld),this.expandByPoint(fR);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),fC.copy(e.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),fC.copy(i.boundingBox)),fC.applyMatrix4(e.matrixWorld),this.union(fC)}let n=e.children;for(let e=0,i=n.length;e<i;e++)this.expandByObject(n[e],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,fR),fR.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(fO),fF.subVectors(this.max,fO),fP.subVectors(e.a,fO),fL.subVectors(e.b,fO),fI.subVectors(e.c,fO),fN.subVectors(fL,fP),fD.subVectors(fI,fL),fU.subVectors(fP,fI);let t=[0,-fN.z,fN.y,0,-fD.z,fD.y,0,-fU.z,fU.y,fN.z,0,-fN.x,fD.z,0,-fD.x,fU.z,0,-fU.x,-fN.y,fN.x,0,-fD.y,fD.x,0,-fU.y,fU.x,0];return!!fk(t,fP,fL,fI,fF)&&!!fk(t=[1,0,0,0,1,0,0,0,1],fP,fL,fI,fF)&&(fB.crossVectors(fN,fD),fk(t=[fB.x,fB.y,fB.z],fP,fL,fI,fF))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,fR).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(fR).length()),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()||(fA[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fA[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fA[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fA[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fA[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fA[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fA[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fA[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fA)),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)}}let fA=[new fb,new fb,new fb,new fb,new fb,new fb,new fb,new fb],fR=new fb,fC=new fw,fP=new fb,fL=new fb,fI=new fb,fN=new fb,fD=new fb,fU=new fb,fO=new fb,fF=new fb,fB=new fb,fz=new fb;function fk(e,t,i,n,r){for(let a=0,s=e.length-3;a<=s;a+=3){fz.fromArray(e,a);let s=r.x*Math.abs(fz.x)+r.y*Math.abs(fz.y)+r.z*Math.abs(fz.z),o=t.dot(fz),l=i.dot(fz),c=n.dot(fz);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}let fV=new fw,fH=new fb,fG=new fb;class fW{constructor(e=new fb,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){let i=this.center;void 0!==t?i.copy(t):fV.setFromPoints(e).getCenter(i);let n=0;for(let t=0,r=e.length;t<r;t++)n=Math.max(n,i.distanceToSquared(e[t]));return this.radius=Math.sqrt(n),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){let 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){let 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.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;fH.subVectors(e,this.center);let t=fH.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),i=(e-this.radius)*.5;this.center.addScaledVector(fH,i/e),this.radius+=i}return this}union(e){return e.isEmpty()||(this.isEmpty()?this.copy(e):!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(fG.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(fH.copy(e.center).add(fG)),this.expandByPoint(fH.copy(e.center).sub(fG)))),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let fj=new fb,fX=new fb,fq=new fb,fY=new fb,fK=new fb,fZ=new fb,f$=new fb;class fJ{constructor(e=new fb,t=new fb(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,fj)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let 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){let t=fj.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(fj.copy(this.origin).addScaledVector(this.direction,t),fj.distanceToSquared(e))}distanceSqToSegment(e,t,i,n){let r,a,s,o;fX.copy(e).add(t).multiplyScalar(.5),fq.copy(t).sub(e).normalize(),fY.copy(this.origin).sub(fX);let l=.5*e.distanceTo(t),c=-this.direction.dot(fq),h=fY.dot(this.direction),u=-fY.dot(fq),d=fY.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(r=c*u-h,a=c*h-u,o=l*p,r>=0)if(a>=-o)if(a<=o){let e=1/p;r*=e,a*=e,s=r*(r+c*a+2*h)+a*(c*r+a+2*u)+d}else s=-(r=Math.max(0,-(c*(a=l)+h)))*r+a*(a+2*u)+d;else s=-(r=Math.max(0,-(c*(a=-l)+h)))*r+a*(a+2*u)+d;else a<=-o?(a=(r=Math.max(0,-(-c*l+h)))>0?-l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d):a<=o?(r=0,s=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):(a=(r=Math.max(0,-(c*l+h)))>0?l:Math.min(Math.max(-l,-u),l),s=-r*r+a*(a+2*u)+d);else a=c>0?-l:l,s=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+d;return i&&i.copy(this.origin).addScaledVector(this.direction,r),n&&n.copy(fX).addScaledVector(fq,a),s}intersectSphere(e,t){fj.subVectors(e.center,this.origin);let i=fj.dot(this.direction),n=fj.dot(fj)-i*i,r=e.radius*e.radius;if(n>r)return null;let a=Math.sqrt(r-n),s=i-a,o=i+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return null===i?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return!!(0===t||e.normal.dot(this.direction)*t<0)}intersectBox(e,t){let i,n,r,a,s,o,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return(l>=0?(i=(e.min.x-u.x)*l,n=(e.max.x-u.x)*l):(i=(e.max.x-u.x)*l,n=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,a=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,a=(e.min.y-u.y)*c),i>a||r>n||((r>i||isNaN(i))&&(i=r),(a<n||isNaN(n))&&(n=a),h>=0?(s=(e.min.z-u.z)*h,o=(e.max.z-u.z)*h):(s=(e.max.z-u.z)*h,o=(e.min.z-u.z)*h),i>o||s>n||((s>i||i!=i)&&(i=s),(o<n||n!=n)&&(n=o),n<0)))?null:this.at(i>=0?i:n,t)}intersectsBox(e){return null!==this.intersectBox(e,fj)}intersectTriangle(e,t,i,n,r){let a;fK.subVectors(t,e),fZ.subVectors(i,e),f$.crossVectors(fK,fZ);let s=this.direction.dot(f$);if(s>0){if(n)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}fY.subVectors(this.origin,e);let o=a*this.direction.dot(fZ.crossVectors(fY,fZ));if(o<0)return null;let l=a*this.direction.dot(fK.cross(fY));if(l<0||o+l>s)return null;let c=-a*fY.dot(f$);return c<0?null:this.at(c/s,r)}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 fQ{constructor(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m){fQ.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m)}set(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m){let g=this.elements;return g[0]=e,g[4]=t,g[8]=i,g[12]=n,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=f,g[15]=m,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 fQ().fromArray(this.elements)}copy(e){let 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){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let 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 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){let t=this.elements,i=e.elements,n=1/f0.setFromMatrixColumn(e,0).length(),r=1/f0.setFromMatrixColumn(e,1).length(),a=1/f0.setFromMatrixColumn(e,2).length();return t[0]=i[0]*n,t[1]=i[1]*n,t[2]=i[2]*n,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,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){let t=this.elements,i=e.x,n=e.y,r=e.z,a=Math.cos(i),s=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){let e=a*c,i=a*h,n=s*c,r=s*h;t[0]=o*c,t[4]=-o*h,t[8]=l,t[1]=i+n*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=n+i*l,t[10]=a*o}else if("YXZ"===e.order){let e=o*c,i=o*h,n=l*c,r=l*h;t[0]=e+r*s,t[4]=n*s-i,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-s,t[2]=i*s-n,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){let e=o*c,i=o*h,n=l*c,r=l*h;t[0]=e-r*s,t[4]=-a*h,t[8]=n+i*s,t[1]=i+n*s,t[5]=a*c,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){let e=a*c,i=a*h,n=s*c,r=s*h;t[0]=o*c,t[4]=n*l-i,t[8]=e*l+r,t[1]=o*h,t[5]=r*l+e,t[9]=i*l-n,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*c,t[4]=r-e*h,t[8]=n*h+i,t[1]=h,t[5]=a*c,t[9]=-s*c,t[2]=-l*c,t[6]=i*h+n,t[10]=e-r*h}else if("XZY"===e.order){let e=a*o,i=a*l,n=s*o,r=s*l;t[0]=o*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=a*c,t[9]=i*h-n,t[2]=n*h-i,t[6]=s*c,t[10]=r*h+e}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(f2,e,f3)}lookAt(e,t,i){let n=this.elements;return f6.subVectors(e,t),0===f6.lengthSq()&&(f6.z=1),f6.normalize(),f5.crossVectors(i,f6),0===f5.lengthSq()&&(1===Math.abs(i.z)?f6.x+=1e-4:f6.z+=1e-4,f6.normalize(),f5.crossVectors(i,f6)),f5.normalize(),f4.crossVectors(f6,f5),n[0]=f5.x,n[4]=f4.x,n[8]=f6.x,n[1]=f5.y,n[5]=f4.y,n[9]=f6.y,n[2]=f5.z,n[6]=f4.z,n[10]=f6.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,n=t.elements,r=this.elements,a=i[0],s=i[4],o=i[8],l=i[12],c=i[1],h=i[5],u=i[9],d=i[13],p=i[2],f=i[6],m=i[10],g=i[14],v=i[3],_=i[7],x=i[11],y=i[15],M=n[0],S=n[4],b=n[8],E=n[12],T=n[1],w=n[5],A=n[9],R=n[13],C=n[2],P=n[6],L=n[10],I=n[14],N=n[3],D=n[7],U=n[11],O=n[15];return r[0]=a*M+s*T+o*C+l*N,r[4]=a*S+s*w+o*P+l*D,r[8]=a*b+s*A+o*L+l*U,r[12]=a*E+s*R+o*I+l*O,r[1]=c*M+h*T+u*C+d*N,r[5]=c*S+h*w+u*P+d*D,r[9]=c*b+h*A+u*L+d*U,r[13]=c*E+h*R+u*I+d*O,r[2]=p*M+f*T+m*C+g*N,r[6]=p*S+f*w+m*P+g*D,r[10]=p*b+f*A+m*L+g*U,r[14]=p*E+f*R+m*I+g*O,r[3]=v*M+_*T+x*C+y*N,r[7]=v*S+_*w+x*P+y*D,r[11]=v*b+_*A+x*L+y*U,r[15]=v*E+_*R+x*I+y*O,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[4],n=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],c=e[2],h=e[6],u=e[10],d=e[14];return e[3]*(r*o*h-n*l*h-r*s*u+i*l*u+n*s*d-i*o*d)+e[7]*(t*o*d-t*l*u+r*a*u-n*a*d+n*l*c-r*o*c)+e[11]*(t*l*h-t*s*d-r*a*h+i*a*d+r*s*c-i*l*c)+e[15]*(-n*s*c-t*o*h+t*s*u+n*a*h-i*a*u+i*o*c)}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(e,t,i){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=h*m*l-f*u*l+f*o*d-s*m*d-h*o*g+s*u*g,_=p*u*l-c*m*l-p*o*d+a*m*d+c*o*g-a*u*g,x=c*f*l-p*h*l+p*s*d-a*f*d-c*s*g+a*h*g,y=p*h*o-c*f*o-p*s*u+a*f*u+c*s*m-a*h*m,M=t*v+i*_+n*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/M;return e[0]=v*S,e[1]=(f*u*r-h*m*r-f*n*d+i*m*d+h*n*g-i*u*g)*S,e[2]=(s*m*r-f*o*r+f*n*l-i*m*l-s*n*g+i*o*g)*S,e[3]=(h*o*r-s*u*r-h*n*l+i*u*l+s*n*d-i*o*d)*S,e[4]=_*S,e[5]=(c*m*r-p*u*r+p*n*d-t*m*d-c*n*g+t*u*g)*S,e[6]=(p*o*r-a*m*r-p*n*l+t*m*l+a*n*g-t*o*g)*S,e[7]=(a*u*r-c*o*r+c*n*l-t*u*l-a*n*d+t*o*d)*S,e[8]=x*S,e[9]=(p*h*r-c*f*r-p*i*d+t*f*d+c*i*g-t*h*g)*S,e[10]=(a*f*r-p*s*r+p*i*l-t*f*l-a*i*g+t*s*g)*S,e[11]=(c*s*r-a*h*r-c*i*l+t*h*l+a*i*d-t*s*d)*S,e[12]=y*S,e[13]=(c*f*n-p*h*n+p*i*u-t*f*u-c*i*m+t*h*m)*S,e[14]=(p*s*n-a*f*n-p*i*o+t*f*o+a*i*m-t*s*m)*S,e[15]=(a*h*n-c*s*n+c*i*o-t*h*o-a*i*u+t*s*u)*S,this}scale(e){let t=this.elements,i=e.x,n=e.y,r=e.z;return t[0]*=i,t[4]*=n,t[8]*=r,t[1]*=i,t[5]*=n,t[9]*=r,t[2]*=i,t[6]*=n,t[10]*=r,t[3]*=i,t[7]*=n,t[11]*=r,this}getMaxScaleOnAxis(){let e=this.elements;return Math.sqrt(Math.max(e[0]*e[0]+e[1]*e[1]+e[2]*e[2],e[4]*e[4]+e[5]*e[5]+e[6]*e[6],e[8]*e[8]+e[9]*e[9]+e[10]*e[10]))}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){let 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){let 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){let 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){let i=Math.cos(t),n=Math.sin(t),r=1-i,a=e.x,s=e.y,o=e.z,l=r*a,c=r*s;return this.set(l*a+i,l*s-n*o,l*o+n*s,0,l*s+n*o,c*s+i,c*o-n*a,0,l*o-n*s,c*o+n*a,r*o*o+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,n,r,a){return this.set(1,i,r,0,e,1,a,0,t,n,1,0,0,0,0,1),this}compose(e,t,i){let n=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,c=a+a,h=s+s,u=r*l,d=r*c,p=r*h,f=a*c,m=a*h,g=s*h,v=o*l,_=o*c,x=o*h,y=i.x,M=i.y,S=i.z;return n[0]=(1-(f+g))*y,n[1]=(d+x)*y,n[2]=(p-_)*y,n[3]=0,n[4]=(d-x)*M,n[5]=(1-(u+g))*M,n[6]=(m+v)*M,n[7]=0,n[8]=(p+_)*S,n[9]=(m-v)*S,n[10]=(1-(u+f))*S,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,i){let n=this.elements,r=f0.set(n[0],n[1],n[2]).length(),a=f0.set(n[4],n[5],n[6]).length(),s=f0.set(n[8],n[9],n[10]).length();0>this.determinant()&&(r=-r),e.x=n[12],e.y=n[13],e.z=n[14],f1.copy(this);let o=1/r,l=1/a,c=1/s;return f1.elements[0]*=o,f1.elements[1]*=o,f1.elements[2]*=o,f1.elements[4]*=l,f1.elements[5]*=l,f1.elements[6]*=l,f1.elements[8]*=c,f1.elements[9]*=c,f1.elements[10]*=c,t.setFromRotationMatrix(f1),i.x=r,i.y=a,i.z=s,this}makePerspective(e,t,i,n,r,a,s=2e3){let o,l,c=this.elements;if(2e3===s)o=-(a+r)/(a-r),l=-2*a*r/(a-r);else if(2001===s)o=-a/(a-r),l=-a*r/(a-r);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*r/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*r/(i-n),c[9]=(i+n)/(i-n),c[13]=0,c[2]=0,c[6]=0,c[10]=o,c[14]=l,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,n,r,a,s=2e3){let o,l,c=this.elements,h=1/(t-e),u=1/(i-n),d=1/(a-r);if(2e3===s)o=(a+r)*d,l=-2*d;else if(2001===s)o=r*d,l=-1*d;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2*h,c[4]=0,c[8]=0,c[12]=-((t+e)*h),c[1]=0,c[5]=2*u,c[9]=0,c[13]=-((i+n)*u),c[2]=0,c[6]=0,c[10]=l,c[14]=-o,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let e=0;e<16;e++)if(t[e]!==i[e])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){let 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}}let f0=new fb,f1=new fQ,f2=new fb(0,0,0),f3=new fb(1,1,1),f5=new fb,f4=new fb,f6=new fb,f8=new fQ,f7=new fS;class f9{constructor(e=0,t=0,i=0,n=f9.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=n}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,n=this._order){return this._x=e,this._y=t,this._z=i,this._order=n,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){let n=e.elements,r=n[0],a=n[4],s=n[8],o=n[1],l=n[5],c=n[9],h=n[2],u=n[6],d=n[10];switch(t){case"XYZ":this._y=Math.asin(p4(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-p4(c,-1,1)),.9999999>Math.abs(c)?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(p4(u,-1,1)),.9999999>Math.abs(u)?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-p4(h,-1,1)),.9999999>Math.abs(h)?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(p4(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-p4(a,-1,1)),.9999999>Math.abs(a)?(this._x=Math.atan2(u,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===i&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return f8.makeRotationFromQuaternion(e),this.setFromRotationMatrix(f8,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return f7.setFromEuler(this),this.setFromQuaternion(f7,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],void 0!==e[3]&&(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}}f9.DEFAULT_ORDER="XYZ";class me{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&1<<e)!=0}}let mt=0,mi=new fb,mn=new fS,mr=new fQ,ma=new fb,ms=new fb,mo=new fb,ml=new fS,mc=new fb(1,0,0),mh=new fb(0,1,0),mu=new fb(0,0,1),md={type:"added"},mp={type:"removed"},mf={type:"childadded",child:null},mm={type:"childremoved",child:null};class mg extends p0{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:mt++}),this.uuid=p5(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mg.DEFAULT_UP.clone();const e=new fb,t=new f9,i=new fS,n=new fb(1,1,1);t._onChange(function(){i.setFromEuler(t,!1)}),i._onChange(function(){t.setFromQuaternion(i,void 0,!1)}),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:n},modelViewMatrix:{value:new fQ},normalMatrix:{value:new p9}}),this.matrix=new fQ,this.matrixWorld=new fQ,this.matrixAutoUpdate=mg.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=mg.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new me,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}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 mn.setFromAxisAngle(e,t),this.quaternion.multiply(mn),this}rotateOnWorldAxis(e,t){return mn.setFromAxisAngle(e,t),this.quaternion.premultiply(mn),this}rotateX(e){return this.rotateOnAxis(mc,e)}rotateY(e){return this.rotateOnAxis(mh,e)}rotateZ(e){return this.rotateOnAxis(mu,e)}translateOnAxis(e,t){return mi.copy(e).applyQuaternion(this.quaternion),this.position.add(mi.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(mc,e)}translateY(e){return this.translateOnAxis(mh,e)}translateZ(e){return this.translateOnAxis(mu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(mr.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?ma.copy(e):ma.set(e,t,i);let n=this.parent;this.updateWorldMatrix(!0,!1),ms.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?mr.lookAt(ms,ma,this.up):mr.lookAt(ma,ms,this.up),this.quaternion.setFromRotationMatrix(mr),n&&(mr.extractRotation(n.matrixWorld),mn.setFromRotationMatrix(mr),this.quaternion.premultiply(mn.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?console.error("THREE.Object3D.add: object can't be added as a child of itself.",e):e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(md),mf.child=e,this.dispatchEvent(mf),mf.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}let t=this.children.indexOf(e);return -1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(mp),mm.child=e,this.dispatchEvent(mm),mm.child=null),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),mr.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),mr.multiply(e.parent.matrixWorld)),e.applyMatrix4(mr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(md),mf.child=e,this.dispatchEvent(mf),mf.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,n=this.children.length;i<n;i++){let n=this.children[i].getObjectByProperty(e,t);if(void 0!==n)return n}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let n=this.children;for(let r=0,a=n.length;r<a;r++)n[r].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(ms,e,mo),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ms,ml,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let i=0,n=t.length;i<n;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,n=t.length;i<n;i++){let n=t[i];(!0===n.matrixWorldAutoUpdate||!0===e)&&n.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(!0===e&&null!==i&&!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){let e=this.children;for(let t=0,i=e.length;t<i;t++){let i=e[t];!0===i.matrixWorldAutoUpdate&&i.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let n={};function r(t,i){return void 0===t[i.uuid]&&(t[i.uuid]=i.toJSON(e)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.visibility=this._visibility,n.active=this._active,n.bounds=this._bounds.map(e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()})),n.maxGeometryCount=this._maxGeometryCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.geometryCount=this._geometryCount,n.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(n.boundingSphere={center:n.boundingSphere.center.toArray(),radius:n.boundingSphere.radius}),null!==this.boundingBox&&(n.boundingBox={min:n.boundingBox.min.toArray(),max:n.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(e.geometries,this.geometry);let t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){let i=t.shapes;if(Array.isArray(i))for(let t=0,n=i.length;t<n;t++){let n=i[t];r(e.shapes,n)}else r(e.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){let t=[];for(let i=0,n=this.material.length;i<n;i++)t.push(r(e.materials,this.material[i]));n.material=t}else n.material=r(e.materials,this.material);if(this.children.length>0){n.children=[];for(let t=0;t<this.children.length;t++)n.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let t=0;t<this.animations.length;t++){let i=this.animations[t];n.animations.push(r(e.animations,i))}}if(t){let t=a(e.geometries),n=a(e.materials),r=a(e.textures),s=a(e.images),o=a(e.shapes),l=a(e.skeletons),c=a(e.animations),h=a(e.nodes);t.length>0&&(i.geometries=t),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),h.length>0&&(i.nodes=h)}return i.object=n,i;function a(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}}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.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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){let i=e.children[t];this.add(i.clone())}return this}}mg.DEFAULT_UP=new fb(0,1,0),mg.DEFAULT_MATRIX_AUTO_UPDATE=!0,mg.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let mv=new fb,m_=new fb,mx=new fb,my=new fb,mM=new fb,mS=new fb,mb=new fb,mE=new fb,mT=new fb,mw=new fb;class mA{constructor(e=new fb,t=new fb,i=new fb){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,n){n.subVectors(i,t),mv.subVectors(e,t),n.cross(mv);let r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(e,t,i,n,r){mv.subVectors(n,t),m_.subVectors(i,t),mx.subVectors(e,t);let a=mv.dot(mv),s=mv.dot(m_),o=mv.dot(mx),l=m_.dot(m_),c=m_.dot(mx),h=a*l-s*s;if(0===h)return r.set(0,0,0),null;let u=1/h,d=(l*o-s*c)*u,p=(a*c-s*o)*u;return r.set(1-d-p,p,d)}static containsPoint(e,t,i,n){return null!==this.getBarycoord(e,t,i,n,my)&&my.x>=0&&my.y>=0&&my.x+my.y<=1}static getInterpolation(e,t,i,n,r,a,s,o){return null===this.getBarycoord(e,t,i,n,my)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,my.x),o.addScaledVector(a,my.y),o.addScaledVector(s,my.z),o)}static isFrontFacing(e,t,i,n){return mv.subVectors(i,t),m_.subVectors(e,t),0>mv.cross(m_).dot(n)}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,n){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,i,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,n),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 mv.subVectors(this.c,this.b),m_.subVectors(this.a,this.b),.5*mv.cross(m_).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return mA.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return mA.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,n,r){return mA.getInterpolation(e,this.a,this.b,this.c,t,i,n,r)}containsPoint(e){return mA.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return mA.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i,n,r=this.a,a=this.b,s=this.c;mM.subVectors(a,r),mS.subVectors(s,r),mE.subVectors(e,r);let o=mM.dot(mE),l=mS.dot(mE);if(o<=0&&l<=0)return t.copy(r);mT.subVectors(e,a);let c=mM.dot(mT),h=mS.dot(mT);if(c>=0&&h<=c)return t.copy(a);let u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return i=o/(o-c),t.copy(r).addScaledVector(mM,i);mw.subVectors(e,s);let d=mM.dot(mw),p=mS.dot(mw);if(p>=0&&d<=p)return t.copy(s);let f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return n=l/(l-p),t.copy(r).addScaledVector(mS,n);let m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return mb.subVectors(s,a),n=(h-c)/(h-c+(d-p)),t.copy(a).addScaledVector(mb,n);let g=1/(m+f+u);return i=f*g,n=u*g,t.copy(r).addScaledVector(mM,i).addScaledVector(mS,n)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let mR={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32},mC={h:0,s:0,l:0},mP={h:0,s:0,l:0};function mL(e,t,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?e+(t-e)*6*i:i<.5?t:i<2/3?e+(t-e)*6*(2/3-i):e}class mI{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){return void 0===t&&void 0===i?e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e):this.setRGB(e,t,i),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=pX){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,fc.toWorkingColorSpace(this,t),this}setRGB(e,t,i,n=fc.workingColorSpace){return this.r=e,this.g=t,this.b=i,fc.toWorkingColorSpace(this,n),this}setHSL(e,t,i,n=fc.workingColorSpace){if(e=(e%1+1)%1,t=p4(t,0,1),i=p4(i,0,1),0===t)this.r=this.g=this.b=i;else{let n=i<=.5?i*(1+t):i+t-i*t,r=2*i-n;this.r=mL(r,n,e+1/3),this.g=mL(r,n,e),this.b=mL(r,n,e-1/3)}return fc.toWorkingColorSpace(this,n),this}setStyle(e,t=pX){let i;function n(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r,a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=pX){let i=mR[e.toLowerCase()];return void 0!==i?this.setHex(i,t):console.warn("THREE.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=fh(e.r),this.g=fh(e.g),this.b=fh(e.b),this}copyLinearToSRGB(e){return this.r=fu(e.r),this.g=fu(e.g),this.b=fu(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=pX){return fc.fromWorkingColorSpace(mN.copy(this),e),65536*Math.round(p4(255*mN.r,0,255))+256*Math.round(p4(255*mN.g,0,255))+Math.round(p4(255*mN.b,0,255))}getHexString(e=pX){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=fc.workingColorSpace){let i,n;fc.fromWorkingColorSpace(mN.copy(this),t);let r=mN.r,a=mN.g,s=mN.b,o=Math.max(r,a,s),l=Math.min(r,a,s),c=(l+o)/2;if(l===o)i=0,n=0;else{let e=o-l;switch(n=c<=.5?e/(o+l):e/(2-o-l),o){case r:i=(a-s)/e+6*(a<s);break;case a:i=(s-r)/e+2;break;case s:i=(r-a)/e+4}i/=6}return e.h=i,e.s=n,e.l=c,e}getRGB(e,t=fc.workingColorSpace){return fc.fromWorkingColorSpace(mN.copy(this),t),e.r=mN.r,e.g=mN.g,e.b=mN.b,e}getStyle(e=pX){fc.fromWorkingColorSpace(mN.copy(this),e);let t=mN.r,i=mN.g,n=mN.b;return e!==pX?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(e,t,i){return this.getHSL(mC),this.setHSL(mC.h+e,mC.s+t,mC.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){var i,n,r;this.getHSL(mC),e.getHSL(mP);let a=(i=mC.h,(1-t)*i+t*mP.h),s=(n=mC.s,(1-t)*n+t*mP.s),o=(r=mC.l,(1-t)*r+t*mP.l);return this.setHSL(a,s,o),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,n=this.b,r=e.elements;return this.r=r[0]*t+r[3]*i+r[6]*n,this.g=r[1]*t+r[4]*i+r[7]*n,this.b=r[2]*t+r[5]*i+r[8]*n,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}}let mN=new mI;mI.NAMES=mR;let mD=0;class mU extends p0{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:mD++}),this.uuid=p5(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new mI(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=7680,this.stencilZFail=7680,this.stencilZPass=7680,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.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}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let i=e[t];if(void 0===i){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(void 0===n){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[t]=i}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(e){let t=[];for(let i in e){let n=e[i];delete n.metadata,t.push(n)}return t}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(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()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(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),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(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,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(i.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(i.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),t){let t=n(e.textures),r=n(e.images);t.length>0&&(i.textures=t),r.length>0&&(i.images=r)}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;let t=e.clippingPlanes,i=null;if(null!==t){let e=t.length;i=Array(e);for(let n=0;n!==e;++n)i[n]=t[n].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.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class mO extends mU{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new mI(0xffffff),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 f9,this.combine=0,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}}let mF=new fb,mB=new p7;class mz{constructor(e,t,i=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=i,this.usage=35044,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}get updateRange(){return fr("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}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 n=0,r=this.itemSize;n<r;n++)this.array[e+n]=t.array[i+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,i=this.count;t<i;t++)mB.fromBufferAttribute(this,t),mB.applyMatrix3(e),this.setXY(t,mB.x,mB.y);else if(3===this.itemSize)for(let t=0,i=this.count;t<i;t++)mF.fromBufferAttribute(this,t),mF.applyMatrix3(e),this.setXYZ(t,mF.x,mF.y,mF.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)mF.fromBufferAttribute(this,t),mF.applyMatrix4(e),this.setXYZ(t,mF.x,mF.y,mF.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)mF.fromBufferAttribute(this,t),mF.applyNormalMatrix(e),this.setXYZ(t,mF.x,mF.y,mF.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)mF.fromBufferAttribute(this,t),mF.transformDirection(e),this.setXYZ(t,mF.x,mF.y,mF.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=p6(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=p8(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=p6(t,this.array)),t}setX(e,t){return this.normalized&&(t=p8(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=p6(t,this.array)),t}setY(e,t){return this.normalized&&(t=p8(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=p6(t,this.array)),t}setZ(e,t){return this.normalized&&(t=p8(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=p6(t,this.array)),t}setW(e,t){return this.normalized&&(t=p8(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=p8(t,this.array),i=p8(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,n){return e*=this.itemSize,this.normalized&&(t=p8(t,this.array),i=p8(i,this.array),n=p8(n,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this}setXYZW(e,t,i,n,r){return e*=this.itemSize,this.normalized&&(t=p8(t,this.array),i=p8(i,this.array),n=p8(n,this.array),r=p8(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=n,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),e}}class mk extends mz{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class mV extends mz{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class mH extends mz{constructor(e,t,i){super(new Float32Array(e),t,i)}}let mG=0,mW=new fQ,mj=new mg,mX=new fb,mq=new fw,mY=new fw,mK=new fb;class mZ extends p0{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mG++}),this.uuid=p5(),this.name="",this.type="BufferGeometry",this.index=null,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(ft(e)?mV:mk)(e,1):this.index=e,this}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 void 0!==this.attributes[e]}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){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(void 0!==i){let t=new p9().getNormalMatrix(e);i.applyNormalMatrix(t),i.needsUpdate=!0}let n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(e),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return mW.makeRotationFromQuaternion(e),this.applyMatrix4(mW),this}rotateX(e){return mW.makeRotationX(e),this.applyMatrix4(mW),this}rotateY(e){return mW.makeRotationY(e),this.applyMatrix4(mW),this}rotateZ(e){return mW.makeRotationZ(e),this.applyMatrix4(mW),this}translate(e,t,i){return mW.makeTranslation(e,t,i),this.applyMatrix4(mW),this}scale(e,t,i){return mW.makeScale(e,t,i),this.applyMatrix4(mW),this}lookAt(e){return mj.lookAt(e),mj.updateMatrix(),this.applyMatrix4(mj.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(mX).negate(),this.translate(mX.x,mX.y,mX.z),this}setFromPoints(e){let t=[];for(let i=0,n=e.length;i<n;i++){let n=e[i];t.push(n.x,n.y,n.z||0)}return this.setAttribute("position",new mH(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new fw);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new fb(-1/0,-1/0,-1/0),new fb(Infinity,Infinity,Infinity));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];mq.setFromBufferAttribute(i),this.morphTargetsRelative?(mK.addVectors(this.boundingBox.min,mq.min),this.boundingBox.expandByPoint(mK),mK.addVectors(this.boundingBox.max,mq.max),this.boundingBox.expandByPoint(mK)):(this.boundingBox.expandByPoint(mq.min),this.boundingBox.expandByPoint(mq.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new fW);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new fb,1/0);return}if(e){let i=this.boundingSphere.center;if(mq.setFromBufferAttribute(e),t)for(let e=0,i=t.length;e<i;e++){let i=t[e];mY.setFromBufferAttribute(i),this.morphTargetsRelative?(mK.addVectors(mq.min,mY.min),mq.expandByPoint(mK),mK.addVectors(mq.max,mY.max),mq.expandByPoint(mK)):(mq.expandByPoint(mY.min),mq.expandByPoint(mY.max))}mq.getCenter(i);let n=0;for(let t=0,r=e.count;t<r;t++)mK.fromBufferAttribute(e,t),n=Math.max(n,i.distanceToSquared(mK));if(t)for(let r=0,a=t.length;r<a;r++){let a=t[r],s=this.morphTargetsRelative;for(let t=0,r=a.count;t<r;t++)mK.fromBufferAttribute(a,t),s&&(mX.fromBufferAttribute(e,t),mK.add(mX)),n=Math.max(n,i.distanceToSquared(mK))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");let i=t.position,n=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new mz(new Float32Array(4*i.count),4));let a=this.getAttribute("tangent"),s=[],o=[];for(let e=0;e<i.count;e++)s[e]=new fb,o[e]=new fb;let l=new fb,c=new fb,h=new fb,u=new p7,d=new p7,p=new p7,f=new fb,m=new fb,g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,n=g.length;t<n;++t){let n=g[t],a=n.start,v=n.count;for(let t=a,n=a+v;t<n;t+=3)!function(e,t,n){l.fromBufferAttribute(i,e),c.fromBufferAttribute(i,t),h.fromBufferAttribute(i,n),u.fromBufferAttribute(r,e),d.fromBufferAttribute(r,t),p.fromBufferAttribute(r,n),c.sub(l),h.sub(l),d.sub(u),p.sub(u);let a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(a),m.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(a),s[e].add(f),s[t].add(f),s[n].add(f),o[e].add(m),o[t].add(m),o[n].add(m))}(e.getX(t+0),e.getX(t+1),e.getX(t+2))}let v=new fb,_=new fb,x=new fb,y=new fb;function M(e){x.fromBufferAttribute(n,e),y.copy(x);let t=s[e];v.copy(t),v.sub(x.multiplyScalar(x.dot(t))).normalize(),_.crossVectors(y,t);let i=_.dot(o[e]);a.setXYZW(e,v.x,v.y,v.z,i<0?-1:1)}for(let t=0,i=g.length;t<i;++t){let i=g[t],n=i.start,r=i.count;for(let t=n,i=n+r;t<i;t+=3)M(e.getX(t+0)),M(e.getX(t+1)),M(e.getX(t+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let i=this.getAttribute("normal");if(void 0===i)i=new mz(new Float32Array(3*t.count),3),this.setAttribute("normal",i);else for(let e=0,t=i.count;e<t;e++)i.setXYZ(e,0,0,0);let n=new fb,r=new fb,a=new fb,s=new fb,o=new fb,l=new fb,c=new fb,h=new fb;if(e)for(let u=0,d=e.count;u<d;u+=3){let d=e.getX(u+0),p=e.getX(u+1),f=e.getX(u+2);n.fromBufferAttribute(t,d),r.fromBufferAttribute(t,p),a.fromBufferAttribute(t,f),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),s.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,f),s.add(c),o.add(c),l.add(c),i.setXYZ(d,s.x,s.y,s.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(f,l.x,l.y,l.z)}else for(let e=0,s=t.count;e<s;e+=3)n.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),a.fromBufferAttribute(t,e+2),c.subVectors(a,r),h.subVectors(n,r),c.cross(h),i.setXYZ(e+0,c.x,c.y,c.z),i.setXYZ(e+1,c.x,c.y,c.z),i.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)mK.fromBufferAttribute(e,t),mK.normalize(),e.setXYZ(t,mK.x,mK.y,mK.z)}toNonIndexed(){function e(e,t){let i=e.array,n=e.itemSize,r=e.normalized,a=new i.constructor(t.length*n),s=0,o=0;for(let r=0,l=t.length;r<l;r++){s=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*n;for(let e=0;e<n;e++)a[o++]=i[s++]}return new mz(a,n,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new mZ,i=this.index.array,n=this.attributes;for(let r in n){let a=e(n[r],i);t.setAttribute(r,a)}let r=this.morphAttributes;for(let n in r){let a=[],s=r[n];for(let t=0,n=s.length;t<n;t++){let n=e(s[t],i);a.push(n)}t.morphAttributes[n]=a}t.morphTargetsRelative=this.morphTargetsRelative;let a=this.groups;for(let e=0,i=a.length;e<i;e++){let i=a[e];t.addGroup(i.start,i.count,i.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,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),void 0!==this.parameters){let t=this.parameters;for(let i in t)void 0!==t[i]&&(e[i]=t[i]);return e}e.data={attributes:{}};let t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let t in i){let n=i[t];e.data.attributes[t]=n.toJSON(e.data)}let n={},r=!1;for(let t in this.morphAttributes){let i=this.morphAttributes[t],a=[];for(let t=0,n=i.length;t<n;t++){let n=i[t];a.push(n.toJSON(e.data))}a.length>0&&(n[t]=a,r=!0)}r&&(e.data.morphAttributes=n,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let s=this.boundingSphere;return null!==s&&(e.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),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;let t={};this.name=e.name;let i=e.index;null!==i&&this.setIndex(i.clone(t));let n=e.attributes;for(let e in n){let i=n[e];this.setAttribute(e,i.clone(t))}let r=e.morphAttributes;for(let e in r){let i=[],n=r[e];for(let e=0,r=n.length;e<r;e++)i.push(n[e].clone(t));this.morphAttributes[e]=i}this.morphTargetsRelative=e.morphTargetsRelative;let a=e.groups;for(let e=0,t=a.length;e<t;e++){let t=a[e];this.addGroup(t.start,t.count,t.materialIndex)}let s=e.boundingBox;null!==s&&(this.boundingBox=s.clone());let o=e.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let m$=new fQ,mJ=new fJ,mQ=new fW,m0=new fb,m1=new fb,m2=new fb,m3=new fb,m5=new fb,m4=new fb,m6=new p7,m8=new p7,m7=new p7,m9=new fb,ge=new fb,gt=new fb,gi=new fb,gn=new fb;class gr extends mg{constructor(e=new mZ,t=new mO){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){let i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,a=i.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(r&&s){m4.set(0,0,0);for(let i=0,n=r.length;i<n;i++){let n=s[i],o=r[i];0!==n&&(m5.fromBufferAttribute(o,e),a?m4.addScaledVector(m5,n):m4.addScaledVector(m5.sub(t),n))}t.add(m4)}return t}raycast(e,t){let i=this.geometry,n=this.material,r=this.matrixWorld;void 0===n||(null===i.boundingSphere&&i.computeBoundingSphere(),mQ.copy(i.boundingSphere),mQ.applyMatrix4(r),mJ.copy(e.ray).recast(e.near),!1===mQ.containsPoint(mJ.origin)&&(null===mJ.intersectSphere(mQ,m0)||mJ.origin.distanceToSquared(m0)>(e.far-e.near)**2)||(m$.copy(r).invert(),mJ.copy(e.ray).applyMatrix4(m$),(null===i.boundingBox||!1!==mJ.intersectsBox(i.boundingBox))&&this._computeIntersections(e,t,mJ)))}_computeIntersections(e,t,i){let n,r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=u.length;r<o;r++){let o=u[r],p=a[o.materialIndex],f=Math.max(o.start,d.start),m=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));for(let r=f;r<m;r+=3)(n=ga(this,p,e,i,l,c,h,s.getX(r),s.getX(r+1),s.getX(r+2)))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=o.materialIndex,t.push(n))}else{let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);for(let u=r;u<o;u+=3)(n=ga(this,a,e,i,l,c,h,s.getX(u),s.getX(u+1),s.getX(u+2)))&&(n.faceIndex=Math.floor(u/3),t.push(n))}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=u.length;r<s;r++){let s=u[r],p=a[s.materialIndex],f=Math.max(s.start,d.start),m=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));for(let r=f;r<m;r+=3)(n=ga(this,p,e,i,l,c,h,r,r+1,r+2))&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=s.materialIndex,t.push(n))}else{let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);for(let o=r;o<s;o+=3)(n=ga(this,a,e,i,l,c,h,o,o+1,o+2))&&(n.faceIndex=Math.floor(o/3),t.push(n))}}}function ga(e,t,i,n,r,a,s,o,l,c){e.getVertexPosition(o,m1),e.getVertexPosition(l,m2),e.getVertexPosition(c,m3);let h=function(e,t,i,n,r,a,s,o){if(null===(1===t.side?n.intersectTriangle(s,a,r,!0,o):n.intersectTriangle(r,a,s,0===t.side,o)))return null;gn.copy(o),gn.applyMatrix4(e.matrixWorld);let l=i.ray.origin.distanceTo(gn);return l<i.near||l>i.far?null:{distance:l,point:gn.clone(),object:e}}(e,t,i,n,m1,m2,m3,gi);if(h){r&&(m6.fromBufferAttribute(r,o),m8.fromBufferAttribute(r,l),m7.fromBufferAttribute(r,c),h.uv=mA.getInterpolation(gi,m1,m2,m3,m6,m8,m7,new p7)),a&&(m6.fromBufferAttribute(a,o),m8.fromBufferAttribute(a,l),m7.fromBufferAttribute(a,c),h.uv1=mA.getInterpolation(gi,m1,m2,m3,m6,m8,m7,new p7)),s&&(m9.fromBufferAttribute(s,o),ge.fromBufferAttribute(s,l),gt.fromBufferAttribute(s,c),h.normal=mA.getInterpolation(gi,m1,m2,m3,m9,ge,gt,new fb),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));let e={a:o,b:l,c:c,normal:new fb,materialIndex:0};mA.getNormal(m1,m2,m3,e.normal),h.face=e}return h}class gs extends mZ{constructor(e=1,t=1,i=1,n=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:n,heightSegments:r,depthSegments:a};const s=this;n=Math.floor(n),r=Math.floor(r);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(e,t,i,n,r,a,p,f,m,g,v){let _=a/m,x=p/g,y=a/2,M=p/2,S=f/2,b=m+1,E=g+1,T=0,w=0,A=new fb;for(let a=0;a<E;a++){let s=a*x-M;for(let o=0;o<b;o++){let u=o*_-y;A[e]=u*n,A[t]=s*r,A[i]=S,l.push(A.x,A.y,A.z),A[e]=0,A[t]=0,A[i]=f>0?1:-1,c.push(A.x,A.y,A.z),h.push(o/m),h.push(1-a/g),T+=1}}for(let e=0;e<g;e++)for(let t=0;t<m;t++){let i=u+t+b*e,n=u+t+b*(e+1),r=u+(t+1)+b*(e+1),a=u+(t+1)+b*e;o.push(i,n,a),o.push(n,r,a),w+=6}s.addGroup(d,w,v),d+=w,u+=T}p("z","y","x",-1,-1,i,t,e,a=Math.floor(a),r,0),p("z","y","x",1,-1,i,t,-e,a,r,1),p("x","z","y",1,1,e,i,t,n,a,2),p("x","z","y",1,-1,e,i,-t,n,a,3),p("x","y","z",1,-1,e,t,i,n,r,4),p("x","y","z",-1,-1,e,t,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new mH(l,3)),this.setAttribute("normal",new mH(c,3)),this.setAttribute("uv",new mH(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function go(e){let t={};for(let i in e)for(let n in t[i]={},e[i]){let r=e[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[i][n]=null):t[i][n]=r.clone():Array.isArray(r)?t[i][n]=r.slice():t[i][n]=r}return t}function gl(e){let t={};for(let i=0;i<e.length;i++){let n=go(e[i]);for(let e in n)t[e]=n[e]}return t}function gc(e){let t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:fc.workingColorSpace}class gh extends mU{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=go(e.uniforms),this.uniformsGroups=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let i in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let n=this.uniforms[i].value;n&&n.isTexture?t.uniforms[i]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[i]={type:"m4",value:n.toArray()}:t.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let i={};for(let e in this.extensions)!0===this.extensions[e]&&(i[e]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class gu extends mg{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new fQ,this.projectionMatrix=new fQ,this.projectionMatrixInverse=new fQ,this.coordinateSystem=2e3}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}let gd=new fb,gp=new p7,gf=new p7;class gm extends gu{constructor(e=50,t=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*p3*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*p2*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*p3*Math.atan(Math.tan(.5*p2*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,i){gd.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(gd.x,gd.y).multiplyScalar(-e/gd.z),gd.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(gd.x,gd.y).multiplyScalar(-e/gd.z)}getViewSize(e,t){return this.getViewBounds(e,gp,gf),t.subVectors(gf,gp)}setViewOffset(e,t,i,n,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*p2*this.fov)/this.zoom,i=2*t,n=this.aspect*i,r=-.5*n,a=this.view;if(null!==this.view&&this.view.enabled){let e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*n/e,t-=a.offsetY*i/s,n*=a.width/e,i*=a.height/s}let s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class gg extends mg{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new gm(-90,1,e,t);n.layers=this.layers,this.add(n);const r=new gm(-90,1,e,t);r.layers=this.layers,this.add(r);const a=new gm(-90,1,e,t);a.layers=this.layers,this.add(a);const s=new gm(-90,1,e,t);s.layers=this.layers,this.add(s);const o=new gm(-90,1,e,t);o.layers=this.layers,this.add(o);const l=new gm(-90,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[i,n,r,a,s,o]=t;for(let e of t)this.remove(e);if(2e3===e)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else if(2001===e)i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[r,a,s,o,l,c]=this.children,h=e.getRenderTarget(),u=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let f=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,n),e.render(t,r),e.setRenderTarget(i,1,n),e.render(t,a),e.setRenderTarget(i,2,n),e.render(t,s),e.setRenderTarget(i,3,n),e.render(t,o),e.setRenderTarget(i,4,n),e.render(t,l),i.texture.generateMipmaps=f,e.setRenderTarget(i,5,n),e.render(t,c),e.setRenderTarget(h,u,d),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class gv extends fv{constructor(e,t,i,n,r,a,s,o,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:301,i,n,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class g_ extends fy{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1};this.texture=new gv([i,i,i,i,i,i],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let i={uniforms:{tEquirect:{value:null}},vertexShader:`
623
+
624
+ varying vec3 vWorldDirection;
625
+
626
+ vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
627
+
628
+ return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
629
+
630
+ }
631
+
632
+ void main() {
633
+
634
+ vWorldDirection = transformDirection( position, modelMatrix );
635
+
636
+ #include <begin_vertex>
637
+ #include <project_vertex>
638
+
639
+ }
640
+ `,fragmentShader:`
641
+
642
+ uniform sampler2D tEquirect;
643
+
644
+ varying vec3 vWorldDirection;
645
+
646
+ #include <common>
647
+
648
+ void main() {
649
+
650
+ vec3 direction = normalize( vWorldDirection );
651
+
652
+ vec2 sampleUV = equirectUv( direction );
653
+
654
+ gl_FragColor = texture2D( tEquirect, sampleUV );
655
+
656
+ }
657
+ `},n=new gs(5,5,5),r=new gh({name:"CubemapFromEquirect",uniforms:go(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=t;let a=new gr(n,r),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new gg(1,10,this).update(e,a),t.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,n){let r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,i,n);e.setRenderTarget(r)}}let gx=new fb,gy=new fb,gM=new p9;class gS{constructor(e=new fb(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,n){return this.normal.set(e,t,i),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){let n=gx.subVectors(i,t).cross(gy.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let 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){let i=e.delta(gx),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let r=-(e.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:t.copy(e.start).addScaledVector(i,r)}intersectsLine(e){let 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){let i=t||gM.getNormalMatrix(e),n=this.coplanarPoint(gx).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),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)}}let gb=new fW,gE=new fb;class gT{constructor(e=new gS,t=new gS,i=new gS,n=new gS,r=new gS,a=new gS){this.planes=[e,t,i,n,r,a]}set(e,t,i,n,r,a){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(i),s[3].copy(n),s[4].copy(r),s[5].copy(a),this}copy(e){let t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=2e3){let i=this.planes,n=e.elements,r=n[0],a=n[1],s=n[2],o=n[3],l=n[4],c=n[5],h=n[6],u=n[7],d=n[8],p=n[9],f=n[10],m=n[11],g=n[12],v=n[13],_=n[14],x=n[15];if(i[0].setComponents(o-r,u-l,m-d,x-g).normalize(),i[1].setComponents(o+r,u+l,m+d,x+g).normalize(),i[2].setComponents(o+a,u+c,m+p,x+v).normalize(),i[3].setComponents(o-a,u-c,m-p,x-v).normalize(),i[4].setComponents(o-s,u-h,m-f,x-_).normalize(),2e3===t)i[5].setComponents(o+s,u+h,m+f,x+_).normalize();else if(2001===t)i[5].setComponents(s,h,f,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),gb.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),gb.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(gb)}intersectsSprite(e){return gb.center.set(0,0,0),gb.radius=.7071067811865476,gb.applyMatrix4(e.matrixWorld),this.intersectsSphere(gb)}intersectsSphere(e){let t=this.planes,i=e.center,n=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(i)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let i=0;i<6;i++){let n=t[i];if(gE.x=n.normal.x>0?e.max.x:e.min.x,gE.y=n.normal.y>0?e.max.y:e.min.y,gE.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(gE))return!1}return!0}containsPoint(e){let t=this.planes;for(let i=0;i<6;i++)if(0>t[i].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}function gw(){let e=null,t=!1,i=null,n=null;function r(t,a){i(t,a),n=e.requestAnimationFrame(r)}return{start:function(){!0===t||null!==i&&(n=e.requestAnimationFrame(r),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){i=e},setContext:function(t){e=t}}}function gA(e){let t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);let n=t.get(i);n&&(e.deleteBuffer(n.buffer),t.delete(i))},update:function(i,n){if(i.isGLBufferAttribute){let e=t.get(i);(!e||e.version<i.version)&&t.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version});return}i.isInterleavedBufferAttribute&&(i=i.data);let r=t.get(i);if(void 0===r)t.set(i,function(t,i){let n,r=t.array,a=t.usage,s=r.byteLength,o=e.createBuffer();if(e.bindBuffer(i,o),e.bufferData(i,r,a),t.onUploadCallback(),r instanceof Float32Array)n=e.FLOAT;else if(r instanceof Uint16Array)n=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(r instanceof Int16Array)n=e.SHORT;else if(r instanceof Uint32Array)n=e.UNSIGNED_INT;else if(r instanceof Int32Array)n=e.INT;else if(r instanceof Int8Array)n=e.BYTE;else if(r instanceof Uint8Array)n=e.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)n=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);return{buffer:o,type:n,bytesPerElement:r.BYTES_PER_ELEMENT,version:t.version,size:s}}(i,n));else if(r.version<i.version){if(r.size!==i.array.byteLength)throw Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,i,n){let r=i.array,a=i._updateRange,s=i.updateRanges;if(e.bindBuffer(n,t),-1===a.count&&0===s.length&&e.bufferSubData(n,0,r),0!==s.length){for(let t=0,i=s.length;t<i;t++){let i=s[t];e.bufferSubData(n,i.start*r.BYTES_PER_ELEMENT,r,i.start,i.count)}i.clearUpdateRanges()}-1!==a.count&&(e.bufferSubData(n,a.offset*r.BYTES_PER_ELEMENT,r,a.offset,a.count),a.count=-1),i.onUploadCallback()}(r.buffer,i,n),r.version=i.version}}}}class gR extends mZ{constructor(e=1,t=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:n};const r=e/2,a=t/2,s=Math.floor(i),o=Math.floor(n),l=s+1,c=o+1,h=e/s,u=t/o,d=[],p=[],f=[],m=[];for(let e=0;e<c;e++){const t=e*u-a;for(let i=0;i<l;i++){const n=i*h-r;p.push(n,-t,0),f.push(0,0,1),m.push(i/s),m.push(1-e/o)}}for(let e=0;e<o;e++)for(let t=0;t<s;t++){const i=t+l*e,n=t+l*(e+1),r=t+1+l*(e+1),a=t+1+l*e;d.push(i,n,a),d.push(n,r,a)}this.setIndex(d),this.setAttribute("position",new mH(p,3)),this.setAttribute("normal",new mH(f,3)),this.setAttribute("uv",new mH(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gR(e.width,e.height,e.widthSegments,e.heightSegments)}}let gC={alphahash_fragment:"#ifdef USE_ALPHAHASH\n if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n const float ALPHA_HASH_SCALE = 0.05;\n float hash2D( vec2 value ) {\n return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n }\n float hash3D( vec3 value ) {\n return hash2D( vec2( hash2D( value.xy ), value.z ) );\n }\n float getAlphaHashThreshold( vec3 position ) {\n float maxDeriv = max(\n length( dFdx( position.xyz ) ),\n length( dFdy( position.xyz ) )\n );\n float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n vec2 pixScales = vec2(\n exp2( floor( log2( pixScale ) ) ),\n exp2( ceil( log2( pixScale ) ) )\n );\n vec2 alpha = vec2(\n hash3D( floor( pixScales.x * position.xyz ) ),\n hash3D( floor( pixScales.y * position.xyz ) )\n );\n float lerpFactor = fract( log2( pixScale ) );\n float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n float a = min( lerpFactor, 1.0 - lerpFactor );\n vec3 cases = vec3(\n x * x / ( 2.0 * a * ( 1.0 - a ) ),\n ( x - 0.5 * a ) / ( 1.0 - a ),\n 1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n );\n float threshold = ( x < ( 1.0 - a ) )\n ? ( ( x < a ) ? cases.x : cases.y )\n : cases.z;\n return clamp( threshold , 1.0e-6, 1.0 );\n }\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n #ifdef ALPHA_TO_COVERAGE\n diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n if ( diffuseColor.a < alphaTest ) discard;\n #endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n uniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n reflectedLight.indirectDiffuse *= ambientOcclusion;\n #if defined( USE_CLEARCOAT ) \n clearcoatSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_SHEEN ) \n sheenSpecularIndirect *= ambientOcclusion;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD )\n float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n #endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n uniform sampler2D aoMap;\n uniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n attribute float batchId;\n uniform highp sampler2D batchingTexture;\n mat4 getBatchingMatrix( const in float i ) {\n int size = textureSize( batchingTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif\n#ifdef USE_BATCHING_COLOR\n uniform sampler2D batchingColorTexture;\n vec3 getBatchingColor( const in float i ) {\n int size = textureSize( batchingColorTexture, 0 ).x;\n int j = int( i );\n int x = j % size;\n int y = j / size;\n return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n }\n#endif",batching_vertex:"#ifdef USE_BATCHING\n mat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n vPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n vec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n return 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n float G = G_BlinnPhong_Implicit( );\n float D = D_BlinnPhong( shininess, dotNH );\n return F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n const mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n );\n vec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n }\n vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n }\n float IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n }\n vec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 rgb = XYZ_TO_REC709 * xyz;\n return rgb;\n }\n vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++ m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n }\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( vBumpMapUv );\n vec2 dSTdy = dFdy( vBumpMapUv );\n float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n return vec2( dBx, dBy );\n }\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n vec3 vN = surf_norm;\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n vec4 plane;\n #ifdef ALPHA_TO_COVERAGE\n float distanceToPlane, distanceGradient;\n float clipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n if ( clipOpacity == 0.0 ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n float unionClipOpacity = 1.0;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n distanceGradient = fwidth( distanceToPlane ) / 2.0;\n unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n }\n #pragma unroll_loop_end\n clipOpacity *= 1.0 - unionClipOpacity;\n #endif\n diffuseColor.a *= clipOpacity;\n if ( diffuseColor.a == 0.0 ) discard;\n #else\n #pragma unroll_loop_start\n for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n }\n #pragma unroll_loop_end\n #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n bool clipped = true;\n #pragma unroll_loop_start\n for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n plane = clippingPlanes[ i ];\n clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n }\n #pragma unroll_loop_end\n if ( clipped ) discard;\n #endif\n #endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n varying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n vClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n diffuseColor *= vColor;\n#elif defined( USE_COLOR )\n diffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR )\n varying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n varying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n varying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n vColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n vColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n vColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n vColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n vec3 batchingColor = getBatchingColor( batchId );\n vColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n return fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n float precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n float precisionSafeLength( vec3 v ) {\n float maxComponent = max3( abs( v ) );\n return length( v / maxComponent ) * maxComponent;\n }\n#endif\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n varying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n mat3 tmp;\n tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n return tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n return dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n return vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n return RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n #define cubeUV_minMipLevel 4.0\n #define cubeUV_minTileSize 16.0\n float getFace( vec3 direction ) {\n vec3 absDirection = abs( direction );\n float face = - 1.0;\n if ( absDirection.x > absDirection.z ) {\n if ( absDirection.x > absDirection.y )\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if ( absDirection.z > absDirection.y )\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n }\n vec2 getUV( vec3 direction, float face ) {\n vec2 uv;\n if ( face == 0.0 ) {\n uv = vec2( direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 1.0 ) {\n uv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n } else if ( face == 2.0 ) {\n uv = vec2( - direction.x, direction.y ) / abs( direction.z );\n } else if ( face == 3.0 ) {\n uv = vec2( - direction.z, direction.y ) / abs( direction.x );\n } else if ( face == 4.0 ) {\n uv = vec2( - direction.x, direction.z ) / abs( direction.y );\n } else {\n uv = vec2( direction.x, direction.y ) / abs( direction.z );\n }\n return 0.5 * ( uv + 1.0 );\n }\n vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n float face = getFace( direction );\n float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n mipInt = max( mipInt, cubeUV_minMipLevel );\n float faceSize = exp2( mipInt );\n highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n if ( face > 2.0 ) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n uv.x += filterInt * 3.0 * cubeUV_minTileSize;\n uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n uv.x *= CUBEUV_TEXEL_WIDTH;\n uv.y *= CUBEUV_TEXEL_HEIGHT;\n #ifdef texture2DGradEXT\n return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n #else\n return texture2D( envMap, uv ).rgb;\n #endif\n }\n #define cubeUV_r0 1.0\n #define cubeUV_m0 - 2.0\n #define cubeUV_r1 0.8\n #define cubeUV_m1 - 1.0\n #define cubeUV_r4 0.4\n #define cubeUV_m4 2.0\n #define cubeUV_r5 0.305\n #define cubeUV_m5 3.0\n #define cubeUV_r6 0.21\n #define cubeUV_m6 4.0\n float roughnessToMip( float roughness ) {\n float mip = 0.0;\n if ( roughness >= cubeUV_r1 ) {\n mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n } else if ( roughness >= cubeUV_r4 ) {\n mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n } else if ( roughness >= cubeUV_r5 ) {\n mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n } else if ( roughness >= cubeUV_r6 ) {\n mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n } else {\n mip = - 2.0 * log2( 1.16 * roughness ); }\n return mip;\n }\n vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n float mipF = fract( mip );\n float mipInt = floor( mip );\n vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n if ( mipF == 0.0 ) {\n return vec4( color0, 1.0 );\n } else {\n vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n return vec4( mix( color0, color1, mipF ), 1.0 );\n }\n }\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n vec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n mat3 bm = mat3( batchingMatrix );\n transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n transformedNormal = bm * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = bm * transformedTangent;\n #endif\n#endif\n#ifdef USE_INSTANCING\n mat3 im = mat3( instanceMatrix );\n transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n transformedNormal = im * transformedNormal;\n #ifdef USE_TANGENT\n transformedTangent = im * transformedTangent;\n #endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n transformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n #ifdef FLIP_SIDED\n transformedTangent = - transformedTangent;\n #endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n uniform sampler2D displacementMap;\n uniform float displacementScale;\n uniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n totalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n uniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n vec3( 0.8224621, 0.177538, 0.0 ),\n vec3( 0.0331941, 0.9668058, 0.0 ),\n vec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n vec3( 1.2249401, - 0.2249404, 0.0 ),\n vec3( - 0.0420569, 1.0420571, 0.0 ),\n vec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n return value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n return value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n return sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vec3 cameraToFrag;\n if ( isOrthographic ) {\n cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToFrag = normalize( vWorldPosition - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vec3 reflectVec = reflect( cameraToFrag, worldNormal );\n #else\n vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n #endif\n #else\n vec3 reflectVec = vReflect;\n #endif\n #ifdef ENVMAP_TYPE_CUBE\n vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n #else\n vec4 envColor = vec4( 0.0 );\n #endif\n #ifdef ENVMAP_BLENDING_MULTIPLY\n outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_MIX )\n outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n #elif defined( ENVMAP_BLENDING_ADD )\n outgoingLight += envColor.xyz * specularStrength * reflectivity;\n #endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n uniform float envMapIntensity;\n uniform float flipEnvMap;\n uniform mat3 envMapRotation;\n #ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n #else\n uniform sampler2D envMap;\n #endif\n \n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n uniform float reflectivity;\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n varying vec3 vWorldPosition;\n uniform float refractionRatio;\n #else\n varying vec3 vReflect;\n #endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n #define ENV_WORLDPOS\n #endif\n #ifdef ENV_WORLDPOS\n \n varying vec3 vWorldPosition;\n #else\n varying vec3 vReflect;\n uniform float refractionRatio;\n #endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n vec3 getIBLIrradiance( const in vec3 normal ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n return PI * envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 reflectVec = reflect( - viewDir, normal );\n reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n reflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n return envMapColor.rgb * envMapIntensity;\n #else\n return vec3( 0.0 );\n #endif\n }\n #ifdef USE_ANISOTROPY\n vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n #ifdef ENVMAP_TYPE_CUBE_UV\n vec3 bentNormal = cross( bitangent, viewDir );\n bentNormal = normalize( cross( bentNormal, bitangent ) );\n bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n return getIBLRadiance( viewDir, bentNormal, roughness );\n #else\n return vec3( 0.0 );\n #endif\n }\n #endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n #ifdef ENV_WORLDPOS\n vWorldPosition = worldPosition.xyz;\n #else\n vec3 cameraToVertex;\n if ( isOrthographic ) {\n cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n } else {\n cameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n }\n vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n #ifdef ENVMAP_MODE_REFLECTION\n vReflect = reflect( cameraToVertex, worldNormal );\n #else\n vReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n #endif\n #endif\n#endif",fog_vertex:"#ifdef USE_FOG\n vFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n varying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n #ifdef FOG_EXP2\n float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n #else\n float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n #endif\n gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n uniform vec3 fogColor;\n varying float vFogDepth;\n #ifdef FOG_EXP2\n uniform float fogDensity;\n #else\n uniform float fogNear;\n uniform float fogFar;\n #endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n uniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n float dotNL = dot( normal, lightDirection );\n vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n #ifdef USE_GRADIENTMAP\n return vec3( texture2D( gradientMap, coord ).r );\n #else\n vec2 fw = fwidth( coord ) * 0.5;\n return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n #endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n uniform sampler2D lightMap;\n uniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n vec3 diffuseColor;\n float specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Lambert\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n uniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n float x = normal.x, y = normal.y, z = normal.z;\n vec3 result = shCoefficients[ 0 ] * 0.886227;\n result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n return result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n return irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n vec3 irradiance = ambientLightColor;\n return irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n struct DirectionalLight {\n vec3 direction;\n vec3 color;\n };\n uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n light.color = directionalLight.color;\n light.direction = directionalLight.direction;\n light.visible = true;\n }\n#endif\n#if NUM_POINT_LIGHTS > 0\n struct PointLight {\n vec3 position;\n vec3 color;\n float distance;\n float decay;\n };\n uniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = pointLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float lightDistance = length( lVector );\n light.color = pointLight.color;\n light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n }\n#endif\n#if NUM_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n struct RectAreaLight {\n vec3 color;\n vec3 position;\n vec3 halfWidth;\n vec3 halfHeight;\n };\n uniform sampler2D ltc_1; uniform sampler2D ltc_2;\n uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n struct HemisphereLight {\n vec3 direction;\n vec3 skyColor;\n vec3 groundColor;\n };\n uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n float dotNL = dot( normal, hemiLight.direction );\n float hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n return irradiance;\n }\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n vec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_Toon\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n material.ior = ior;\n #ifdef USE_SPECULAR\n float specularIntensityFactor = specularIntensity;\n vec3 specularColorFactor = specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n #endif\n material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n #else\n float specularIntensityFactor = 1.0;\n vec3 specularColorFactor = vec3( 1.0 );\n material.specularF90 = 1.0;\n #endif\n material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n material.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n material.clearcoat = clearcoat;\n material.clearcoatRoughness = clearcoatRoughness;\n material.clearcoatF0 = vec3( 0.04 );\n material.clearcoatF90 = 1.0;\n #ifdef USE_CLEARCOATMAP\n material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n #endif\n #ifdef USE_CLEARCOAT_ROUGHNESSMAP\n material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n #endif\n material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n material.clearcoatRoughness += geometryRoughness;\n material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n material.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n material.iridescence = iridescence;\n material.iridescenceIOR = iridescenceIOR;\n #ifdef USE_IRIDESCENCEMAP\n material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n #endif\n #ifdef USE_IRIDESCENCE_THICKNESSMAP\n material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n #else\n material.iridescenceThickness = iridescenceThicknessMaximum;\n #endif\n#endif\n#ifdef USE_SHEEN\n material.sheenColor = sheenColor;\n #ifdef USE_SHEEN_COLORMAP\n material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n #endif\n material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n #ifdef USE_SHEEN_ROUGHNESSMAP\n material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n #ifdef USE_ANISOTROPYMAP\n mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n #else\n vec2 anisotropyV = anisotropyVector;\n #endif\n material.anisotropy = length( anisotropyV );\n if( material.anisotropy == 0.0 ) {\n anisotropyV = vec2( 1.0, 0.0 );\n } else {\n anisotropyV /= material.anisotropy;\n material.anisotropy = saturate( material.anisotropy );\n }\n material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n float dispersion;\n #ifdef USE_CLEARCOAT\n float clearcoat;\n float clearcoatRoughness;\n vec3 clearcoatF0;\n float clearcoatF90;\n #endif\n #ifdef USE_IRIDESCENCE\n float iridescence;\n float iridescenceIOR;\n float iridescenceThickness;\n vec3 iridescenceFresnel;\n vec3 iridescenceF0;\n #endif\n #ifdef USE_SHEEN\n vec3 sheenColor;\n float sheenRoughness;\n #endif\n #ifdef IOR\n float ior;\n #endif\n #ifdef USE_TRANSMISSION\n float transmission;\n float transmissionAlpha;\n float thickness;\n float attenuationDistance;\n vec3 attenuationColor;\n #endif\n #ifdef USE_ANISOTROPY\n float anisotropy;\n float alphaT;\n vec3 anisotropyT;\n vec3 anisotropyB;\n #endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n float a2 = pow2( alpha );\n float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n return 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n float a2 = pow2( alpha );\n float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n return RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n float v = 0.5 / ( gv + gl );\n return saturate(v);\n }\n float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n float a2 = alphaT * alphaB;\n highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n highp float v2 = dot( v, v );\n float w2 = a2 / v2;\n return RECIPROCAL_PI * a2 * pow2 ( w2 );\n }\n#endif\n#ifdef USE_CLEARCOAT\n vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n vec3 f0 = material.clearcoatF0;\n float f90 = material.clearcoatF90;\n float roughness = material.clearcoatRoughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n return F * ( V * D );\n }\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n vec3 f0 = material.specularColor;\n float f90 = material.specularF90;\n float roughness = material.roughness;\n float alpha = pow2( roughness );\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n vec3 F = F_Schlick( f0, f90, dotVH );\n #ifdef USE_IRIDESCENCE\n F = mix( F, material.iridescenceFresnel, material.iridescence );\n #endif\n #ifdef USE_ANISOTROPY\n float dotTL = dot( material.anisotropyT, lightDir );\n float dotTV = dot( material.anisotropyT, viewDir );\n float dotTH = dot( material.anisotropyT, halfDir );\n float dotBL = dot( material.anisotropyB, lightDir );\n float dotBV = dot( material.anisotropyB, viewDir );\n float dotBH = dot( material.anisotropyB, halfDir );\n float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n #else\n float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n float D = D_GGX( alpha, dotNH );\n #endif\n return F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n const float LUT_SIZE = 64.0;\n const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n const float LUT_BIAS = 0.5 / LUT_SIZE;\n float dotNV = saturate( dot( N, V ) );\n vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n uv = uv * LUT_SCALE + LUT_BIAS;\n return uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n float l = length( f );\n return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n float x = dot( v1, v2 );\n float y = abs( x );\n float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n float b = 3.4175940 + ( 4.1616724 + y ) * y;\n float v = a / b;\n float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n return cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n vec3 lightNormal = cross( v1, v2 );\n if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n vec3 T1, T2;\n T1 = normalize( V - N * dot( V, N ) );\n T2 = - cross( N, T1 );\n mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n vec3 coords[ 4 ];\n coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n coords[ 0 ] = normalize( coords[ 0 ] );\n coords[ 1 ] = normalize( coords[ 1 ] );\n coords[ 2 ] = normalize( coords[ 2 ] );\n coords[ 3 ] = normalize( coords[ 3 ] );\n vec3 vectorFormFactor = vec3( 0.0 );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n float result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n return vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n float alpha = pow2( roughness );\n float invAlpha = 1.0 / alpha;\n float cos2h = dotNH * dotNH;\n float sin2h = max( 1.0 - cos2h, 0.0078125 );\n return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n vec3 halfDir = normalize( lightDir + viewDir );\n float dotNL = saturate( dot( normal, lightDir ) );\n float dotNV = saturate( dot( normal, viewDir ) );\n float dotNH = saturate( dot( normal, halfDir ) );\n float D = D_Charlie( sheenRoughness, dotNH );\n float V = V_Neubelt( dotNV, dotNL );\n return sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n float r2 = roughness * roughness;\n float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n return saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n float dotNV = saturate( dot( normal, viewDir ) );\n const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n vec4 r = roughness * c0 + c1;\n float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n return fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n return specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n vec2 fab = DFGApprox( normal, viewDir, roughness );\n #ifdef USE_IRIDESCENCE\n vec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n #else\n vec3 Fr = specularColor;\n #endif\n vec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n vec3 normal = geometryNormal;\n vec3 viewDir = geometryViewDir;\n vec3 position = geometryPosition;\n vec3 lightPos = rectAreaLight.position;\n vec3 halfWidth = rectAreaLight.halfWidth;\n vec3 halfHeight = rectAreaLight.halfHeight;\n vec3 lightColor = rectAreaLight.color;\n float roughness = material.roughness;\n vec3 rectCoords[ 4 ];\n rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n vec2 uv = LTC_Uv( normal, viewDir, roughness );\n vec4 t1 = texture2D( ltc_1, uv );\n vec4 t2 = texture2D( ltc_2, uv );\n mat3 mInv = mat3(\n vec3( t1.x, 0, t1.y ),\n vec3( 0, 1, 0 ),\n vec3( t1.z, 0, t1.w )\n );\n vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n }\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n float dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n vec3 irradiance = dotNL * directLight.color;\n #ifdef USE_CLEARCOAT\n float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n vec3 ccIrradiance = dotNLcc * directLight.color;\n clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n #endif\n reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n #ifdef USE_CLEARCOAT\n clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n #endif\n #ifdef USE_SHEEN\n sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n #endif\n vec3 singleScattering = vec3( 0.0 );\n vec3 multiScattering = vec3( 0.0 );\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n #ifdef USE_IRIDESCENCE\n computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n #else\n computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n #endif\n vec3 totalScattering = singleScattering + multiScattering;\n vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct RE_Direct_Physical\n#define RE_Direct_RectArea RE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular RE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n geometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n float dotNVi = saturate( dot( normal, geometryViewDir ) );\n if ( material.iridescenceThickness == 0.0 ) {\n material.iridescence = 0.0;\n } else {\n material.iridescence = saturate( material.iridescence );\n }\n if ( material.iridescence > 0.0 ) {\n material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n }\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n PointLight pointLight;\n #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n pointLight = pointLights[ i ];\n getPointLightInfo( pointLight, geometryPosition, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n pointLightShadow = pointLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n SpotLight spotLight;\n vec4 spotColor;\n vec3 spotLightCoord;\n bool inSpotLightMap;\n #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n spotLight = spotLights[ i ];\n getSpotLightInfo( spotLight, geometryPosition, directLight );\n #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n #else\n #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n #endif\n #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n #endif\n #undef SPOT_LIGHT_MAP_INDEX\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n spotLightShadow = spotLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n directionalLight = directionalLights[ i ];\n getDirectionalLightInfo( directionalLight, directLight );\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n RectAreaLight rectAreaLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n rectAreaLight = rectAreaLights[ i ];\n RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n }\n #pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3( 0.0 );\n vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n #if defined( USE_LIGHT_PROBES )\n irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n #endif\n #if ( NUM_HEMI_LIGHTS > 0 )\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n irradiance += lightMapIrradiance;\n #endif\n #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n iblIrradiance += getIBLIrradiance( geometryNormal );\n #endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n #ifdef USE_ANISOTROPY\n radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n #else\n radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n #endif\n #ifdef USE_CLEARCOAT\n clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n #endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n uniform float logDepthBufFC;\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n varying float vFragDepth;\n varying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n vFragDepth = 1.0 + gl_Position.w;\n vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n vec4 sampledDiffuseColor = texture2D( map, vMapUv );\n #ifdef DECODE_VIDEO_TEXTURE\n sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n \n #endif\n diffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n uniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n #if defined( USE_POINTS_UV )\n vec2 uv = vUv;\n #else\n vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n #endif\n#endif\n#ifdef USE_MAP\n diffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n diffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n varying vec2 vUv;\n#else\n #if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n uniform mat3 uvTransform;\n #endif\n#endif\n#ifdef USE_MAP\n uniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n uniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n metalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n uniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n }\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n vColor *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n #if defined( USE_COLOR_ALPHA )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n #elif defined( USE_COLOR )\n if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n #endif\n }\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n objectNormal *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n #ifndef USE_INSTANCING_MORPH\n uniform float morphTargetBaseInfluence;\n uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n #endif\n uniform sampler2DArray morphTargetsTexture;\n uniform ivec2 morphTargetsTextureSize;\n vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n int y = texelIndex / morphTargetsTextureSize.x;\n int x = texelIndex - y * morphTargetsTextureSize.x;\n ivec3 morphUV = ivec3( x, y, morphTargetIndex );\n return texelFetch( morphTargetsTexture, morphUV, 0 );\n }\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n transformed *= morphTargetBaseInfluence;\n for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n }\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal *= faceDirection;\n #endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n #ifdef USE_TANGENT\n mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn = getTangentFrame( - vViewPosition, normal,\n #if defined( USE_NORMALMAP )\n vNormalMapUv\n #elif defined( USE_CLEARCOAT_NORMALMAP )\n vClearcoatNormalMapUv\n #else\n vUv\n #endif\n );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn[0] *= faceDirection;\n tbn[1] *= faceDirection;\n #endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n #ifdef USE_TANGENT\n mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n #else\n mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n #endif\n #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n tbn2[0] *= faceDirection;\n tbn2[1] *= faceDirection;\n #endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n #ifdef FLIP_SIDED\n normal = - normal;\n #endif\n #ifdef DOUBLE_SIDED\n normal = normal * faceDirection;\n #endif\n normal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n mapN.xy *= normalScale;\n normal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n varying vec3 vNormal;\n #ifdef USE_TANGENT\n varying vec3 vTangent;\n varying vec3 vBitangent;\n #endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n vNormal = normalize( transformedNormal );\n #ifdef USE_TANGENT\n vTangent = normalize( transformedTangent );\n vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n #endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n uniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( uv.st );\n vec2 st1 = dFdy( uv.st );\n vec3 N = surf_norm;\n vec3 q1perp = cross( q1, N );\n vec3 q0perp = cross( N, q0 );\n vec3 T = q1perp * st0.x + q0perp * st1.x;\n vec3 B = q1perp * st0.y + q0perp * st1.y;\n float det = max( dot( T, T ), dot( B, B ) );\n float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n return mat3( T * scale, B * scale, N );\n }\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n vec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n clearcoatMapN.xy *= clearcoatNormalScale;\n clearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n uniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform sampler2D clearcoatNormalMap;\n uniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n uniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n return normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n return 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n vec4 r = vec4( fract( v * PackFactors ), v );\n r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n return dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n return packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n return ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n return ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n mvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n mvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n gl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n vec3 dithering( vec3 color ) {\n float grid_position = rand( gl_FragCoord.xy );\n vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n return color + dither_shift_RGB;\n }\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n roughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n uniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n return unpackRGBATo2Half( texture2D( shadow, uv ) );\n }\n float VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n float occlusion = 1.0;\n vec2 distribution = texture2DDistribution( shadow, uv );\n float hard_shadow = step( compare , distribution.x );\n if (hard_shadow != 1.0 ) {\n float distance = compare - distribution.x ;\n float variance = max( 0.00000, distribution.y * distribution.y );\n float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n }\n return occlusion;\n }\n float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n float shadow = 1.0;\n shadowCoord.xyz /= shadowCoord.w;\n shadowCoord.z += shadowBias;\n bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n bool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n if ( frustumTest ) {\n #if defined( SHADOWMAP_TYPE_PCF )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx0 = - texelSize.x * shadowRadius;\n float dy0 = - texelSize.y * shadowRadius;\n float dx1 = + texelSize.x * shadowRadius;\n float dy1 = + texelSize.y * shadowRadius;\n float dx2 = dx0 / 2.0;\n float dy2 = dy0 / 2.0;\n float dx3 = dx1 / 2.0;\n float dy3 = dy1 / 2.0;\n shadow = (\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n ) * ( 1.0 / 17.0 );\n #elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n vec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n float dx = texelSize.x;\n float dy = texelSize.y;\n vec2 uv = shadowCoord.xy;\n vec2 f = fract( uv * shadowMapSize + 0.5 );\n uv -= f * texelSize;\n shadow = (\n texture2DCompare( shadowMap, uv, shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n f.x ) +\n mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n f.y ) +\n mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n f.x ),\n mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n f.x ),\n f.y )\n ) * ( 1.0 / 9.0 );\n #elif defined( SHADOWMAP_TYPE_VSM )\n shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n #else\n shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n #endif\n }\n return shadow;\n }\n vec2 cubeToUV( vec3 v, float texelSizeY ) {\n vec3 absV = abs( v );\n float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n absV *= scaleToCube;\n v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n vec2 planar = v.xy;\n float almostATexel = 1.5 * texelSizeY;\n float almostOne = 1.0 - almostATexel;\n if ( absV.z >= almostOne ) {\n if ( v.z > 0.0 )\n planar.x = 4.0 - v.x;\n } else if ( absV.x >= almostOne ) {\n float signX = sign( v.x );\n planar.x = v.z * signX + 2.0 * signX;\n } else if ( absV.y >= almostOne ) {\n float signY = sign( v.y );\n planar.x = v.x + 2.0 * signY + 2.0;\n planar.y = v.z * signY - 2.0;\n }\n return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n }\n float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n float shadow = 1.0;\n vec3 lightToPosition = shadowCoord.xyz;\n \n float lightToPositionLength = length( lightToPosition );\n if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias;\n vec3 bd3D = normalize( lightToPosition );\n vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n shadow = (\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n ) * ( 1.0 / 9.0 );\n #else\n shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n #endif\n }\n return shadow;\n }\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n struct DirectionalLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n struct SpotLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n };\n uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n struct PointLightShadow {\n float shadowBias;\n float shadowNormalBias;\n float shadowRadius;\n vec2 shadowMapSize;\n float shadowCameraNear;\n float shadowCameraFar;\n };\n uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n #endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n vec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n #if NUM_DIR_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n #endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n shadowWorldPosition = worldPosition;\n #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n #endif\n vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n }\n #pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n float shadow = 1.0;\n #ifdef USE_SHADOWMAP\n #if NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n directionalLight = directionalLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_SPOT_LIGHT_SHADOWS > 0\n SpotLightShadow spotLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n spotLight = spotLightShadows[ i ];\n shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #if NUM_POINT_LIGHT_SHADOWS > 0\n PointLightShadow pointLight;\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n pointLight = pointLightShadows[ i ];\n shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n }\n #pragma unroll_loop_end\n #endif\n #endif\n return shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix( skinIndex.x );\n mat4 boneMatY = getBoneMatrix( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix( skinIndex.z );\n mat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture;\n mat4 getBoneMatrix( const in float i ) {\n int size = textureSize( boneTexture, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinned = vec4( 0.0 );\n skinned += boneMatX * skinVertex * skinWeight.x;\n skinned += boneMatY * skinVertex * skinWeight.y;\n skinned += boneMatZ * skinVertex * skinWeight.z;\n skinned += boneMatW * skinVertex * skinWeight.w;\n transformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n #ifdef USE_TANGENT\n objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n #endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n specularStrength = texelSpecular.r;\n#else\n specularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n uniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n return saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n return saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n color = max( vec3( 0.0 ), color - 0.004 );\n return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n vec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n return a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n const mat3 ACESInputMat = mat3(\n vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ),\n vec3( 0.04823, 0.01566, 0.83777 )\n );\n const mat3 ACESOutputMat = mat3(\n vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ),\n vec3( -0.07367, -0.00605, 1.07602 )\n );\n color *= toneMappingExposure / 0.6;\n color = ACESInputMat * color;\n color = RRTAndODTFit( color );\n color = ACESOutputMat * color;\n return saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n vec3( 1.6605, - 0.1246, - 0.0182 ),\n vec3( - 0.5876, 1.1329, - 0.1006 ),\n vec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n vec3( 0.6274, 0.0691, 0.0164 ),\n vec3( 0.3293, 0.9195, 0.0880 ),\n vec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n vec3 x2 = x * x;\n vec3 x4 = x2 * x2;\n return + 15.5 * x4 * x2\n - 40.14 * x4 * x\n + 31.96 * x4\n - 6.868 * x2 * x\n + 0.4298 * x2\n + 0.1191 * x\n - 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n const mat3 AgXInsetMatrix = mat3(\n vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n );\n const mat3 AgXOutsetMatrix = mat3(\n vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n );\n const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069;\n color *= toneMappingExposure;\n color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n color = AgXInsetMatrix * color;\n color = max( color, 1e-10 ); color = log2( color );\n color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n color = clamp( color, 0.0, 1.0 );\n color = agxDefaultContrastApprox( color );\n color = AgXOutsetMatrix * color;\n color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n color = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n color = clamp( color, 0.0, 1.0 );\n return color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n const float StartCompression = 0.8 - 0.04;\n const float Desaturation = 0.15;\n color *= toneMappingExposure;\n float x = min( color.r, min( color.g, color.b ) );\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n float peak = max( color.r, max( color.g, color.b ) );\n if ( peak < StartCompression ) return color;\n float d = 1. - StartCompression;\n float newPeak = 1. - d * d / ( peak + d - StartCompression );\n color *= newPeak / peak;\n float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n return mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n material.transmission = transmission;\n material.transmissionAlpha = 1.0;\n material.thickness = thickness;\n material.attenuationDistance = attenuationDistance;\n material.attenuationColor = attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n #endif\n #ifdef USE_THICKNESSMAP\n material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n #endif\n vec3 pos = vWorldPosition;\n vec3 v = normalize( cameraPosition - pos );\n vec3 n = inverseTransformDirection( normal, viewMatrix );\n vec4 transmitted = getIBLVolumeRefraction(\n n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n material.attenuationColor, material.attenuationDistance );\n material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n uniform float transmission;\n uniform float thickness;\n uniform float attenuationDistance;\n uniform vec3 attenuationColor;\n #ifdef USE_TRANSMISSIONMAP\n uniform sampler2D transmissionMap;\n #endif\n #ifdef USE_THICKNESSMAP\n uniform sampler2D thicknessMap;\n #endif\n uniform vec2 transmissionSamplerSize;\n uniform sampler2D transmissionSamplerMap;\n uniform mat4 modelMatrix;\n uniform mat4 projectionMatrix;\n varying vec3 vWorldPosition;\n float w0( float a ) {\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n }\n float w1( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n }\n float w2( float a ){\n return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n }\n float w3( float a ) {\n return ( 1.0 / 6.0 ) * ( a * a * a );\n }\n float g0( float a ) {\n return w0( a ) + w1( a );\n }\n float g1( float a ) {\n return w2( a ) + w3( a );\n }\n float h0( float a ) {\n return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n }\n float h1( float a ) {\n return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n }\n vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n uv = uv * texelSize.zw + 0.5;\n vec2 iuv = floor( uv );\n vec2 fuv = fract( uv );\n float g0x = g0( fuv.x );\n float g1x = g1( fuv.x );\n float h0x = h0( fuv.x );\n float h1x = h1( fuv.x );\n float h0y = h0( fuv.y );\n float h1y = h1( fuv.y );\n vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n }\n vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n vec2 fLodSizeInv = 1.0 / fLodSize;\n vec2 cLodSizeInv = 1.0 / cLodSize;\n vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n return mix( fSample, cSample, fract( lod ) );\n }\n vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n vec3 modelScale;\n modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n return normalize( refractionVector ) * thickness * modelScale;\n }\n float applyIorToRoughness( const in float roughness, const in float ior ) {\n return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n }\n vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n }\n vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n if ( isinf( attenuationDistance ) ) {\n return vec3( 1.0 );\n } else {\n vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance;\n }\n }\n vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n const in vec3 attenuationColor, const in float attenuationDistance ) {\n vec4 transmittedLight;\n vec3 transmittance;\n #ifdef USE_DISPERSION\n float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n for ( int i = 0; i < 3; i ++ ) {\n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n \n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n \n vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n transmittedLight[ i ] = transmissionSample[ i ];\n transmittedLight.a += transmissionSample.a;\n transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n }\n transmittedLight.a /= 3.0;\n \n #else\n \n vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n vec3 refractedRayExit = position + transmissionRay;\n vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n vec2 refractionCoords = ndcPos.xy / ndcPos.w;\n refractionCoords += 1.0;\n refractionCoords /= 2.0;\n transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n \n #endif\n vec3 attenuatedColor = transmittance * transmittedLight.rgb;\n vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n }\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n varying vec2 vUv;\n#endif\n#ifdef USE_MAP\n uniform mat3 mapTransform;\n varying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n uniform mat3 alphaMapTransform;\n varying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n uniform mat3 lightMapTransform;\n varying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n uniform mat3 aoMapTransform;\n varying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n uniform mat3 bumpMapTransform;\n varying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n uniform mat3 normalMapTransform;\n varying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n uniform mat3 displacementMapTransform;\n varying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n uniform mat3 emissiveMapTransform;\n varying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n uniform mat3 metalnessMapTransform;\n varying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n uniform mat3 roughnessMapTransform;\n varying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n uniform mat3 anisotropyMapTransform;\n varying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n uniform mat3 clearcoatMapTransform;\n varying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n uniform mat3 clearcoatNormalMapTransform;\n varying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n uniform mat3 clearcoatRoughnessMapTransform;\n varying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n uniform mat3 sheenColorMapTransform;\n varying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n uniform mat3 sheenRoughnessMapTransform;\n varying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n uniform mat3 iridescenceMapTransform;\n varying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n uniform mat3 iridescenceThicknessMapTransform;\n varying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n uniform mat3 specularMapTransform;\n varying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n uniform mat3 specularColorMapTransform;\n varying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n uniform mat3 specularIntensityMapTransform;\n varying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n uniform mat3 transmissionMapTransform;\n varying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n uniform mat3 thicknessMapTransform;\n varying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n vUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n vec4 worldPosition = vec4( transformed, 1.0 );\n #ifdef USE_BATCHING\n worldPosition = batchingMatrix * worldPosition;\n #endif\n #ifdef USE_INSTANCING\n worldPosition = instanceMatrix * worldPosition;\n #endif\n worldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n gl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n vec4 texColor = texture2D( t2D, vUv );\n #ifdef DECODE_VIDEO_TEXTURE\n texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n uniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n uniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n #ifdef ENVMAP_TYPE_CUBE\n vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n #elif defined( ENVMAP_TYPE_CUBE_UV )\n vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n #else\n vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n #endif\n texColor.rgb *= backgroundIntensity;\n gl_FragColor = texColor;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n gl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n gl_FragColor = texColor;\n gl_FragColor.a *= opacity;\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n uniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #if DEPTH_PACKING == 3200\n diffuseColor.a = opacity;\n #endif\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <logdepthbuf_fragment>\n float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n #if DEPTH_PACKING == 3200\n gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n #elif DEPTH_PACKING == 3201\n gl_FragColor = packDepthToRGBA( fragCoordZ );\n #endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <skinbase_vertex>\n #include <morphinstance_vertex>\n #ifdef USE_DISPLACEMENTMAP\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <worldpos_vertex>\n #include <clipping_planes_vertex>\n vWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n vec4 diffuseColor = vec4( 1.0 );\n #include <clipping_planes_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n float dist = length( vWorldPosition - referencePosition );\n dist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n dist = saturate( dist );\n gl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vWorldDirection = transformDirection( position, modelMatrix );\n #include <begin_vertex>\n #include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n vec3 direction = normalize( vWorldDirection );\n vec2 sampleUV = equirectUv( direction );\n gl_FragColor = texture2D( tEquirect, sampleUV );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n vLineDistance = scale * lineDistance;\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n discard;\n }\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #endif\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n varying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n #ifdef USE_LIGHTMAP\n vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n #else\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n #endif\n #include <aomap_fragment>\n reflectedLight.indirectDiffuse *= diffuseColor.rgb;\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n vViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n vec3 viewDir = normalize( vViewPosition );\n vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n vec3 y = cross( viewDir, x );\n vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n #ifdef USE_MATCAP\n vec4 matcapColor = texture2D( matcap, uv );\n #else\n vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n #endif\n vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n vViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n varying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n #include <clipping_planes_fragment>\n #include <logdepthbuf_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n #ifdef OPAQUE\n gl_FragColor.a = 1.0;\n #endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_phong_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n varying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n#ifdef USE_TRANSMISSION\n vWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n #define IOR\n #define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n uniform float ior;\n#endif\n#ifdef USE_SPECULAR\n uniform float specularIntensity;\n uniform vec3 specularColor;\n #ifdef USE_SPECULAR_COLORMAP\n uniform sampler2D specularColorMap;\n #endif\n #ifdef USE_SPECULAR_INTENSITYMAP\n uniform sampler2D specularIntensityMap;\n #endif\n#endif\n#ifdef USE_CLEARCOAT\n uniform float clearcoat;\n uniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n uniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n uniform float iridescence;\n uniform float iridescenceIOR;\n uniform float iridescenceThicknessMinimum;\n uniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n uniform vec3 sheenColor;\n uniform float sheenRoughness;\n #ifdef USE_SHEEN_COLORMAP\n uniform sampler2D sheenColorMap;\n #endif\n #ifdef USE_SHEEN_ROUGHNESSMAP\n uniform sampler2D sheenRoughnessMap;\n #endif\n#endif\n#ifdef USE_ANISOTROPY\n uniform vec2 anisotropyVector;\n #ifdef USE_ANISOTROPYMAP\n uniform sampler2D anisotropyMap;\n #endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <roughnessmap_fragment>\n #include <metalnessmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <clearcoat_normal_fragment_begin>\n #include <clearcoat_normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_physical_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n #include <transmission_fragment>\n vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n #ifdef USE_SHEEN\n float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n #endif\n #ifdef USE_CLEARCOAT\n float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n #endif\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n vViewPosition = - mvPosition.xyz;\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n vec3 totalEmissiveRadiance = emissive;\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n #include <lights_toon_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n #include <aomap_fragment>\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n varying vec2 vUv;\n uniform mat3 uvTransform;\n#endif\nvoid main() {\n #ifdef USE_POINTS_UV\n vUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n #endif\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n gl_PointSize = size;\n #ifdef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n #endif\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <worldpos_vertex>\n #include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_particle_fragment>\n #include <color_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <morphinstance_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <worldpos_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n #include <logdepthbuf_fragment>\n gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n #include <uv_vertex>\n vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n vec2 scale;\n scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n #ifndef USE_SIZEATTENUATION\n bool isPerspective = isPerspectiveMatrix( projectionMatrix );\n if ( isPerspective ) scale *= - mvPosition.z;\n #endif\n vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n vec2 rotatedPosition;\n rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n mvPosition.xy += rotatedPosition;\n gl_Position = projectionMatrix * mvPosition;\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n vec3 outgoingLight = vec3( 0.0 );\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n outgoingLight = diffuseColor.rgb;\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n}"},gP={common:{diffuse:{value:new mI(0xffffff)},opacity:{value:1},map:{value:null},mapTransform:{value:new p9},alphaMap:{value:null},alphaMapTransform:{value:new p9},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new p9}},envmap:{envMap:{value:null},envMapRotation:{value:new p9},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new p9}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new p9}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new p9},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new p9},normalScale:{value:new p7(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new p9},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new p9}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new p9}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new p9}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new mI(0xffffff)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new mI(0xffffff)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new p9},alphaTest:{value:0},uvTransform:{value:new p9}},sprite:{diffuse:{value:new mI(0xffffff)},opacity:{value:1},center:{value:new p7(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new p9},alphaMap:{value:null},alphaMapTransform:{value:new p9},alphaTest:{value:0}}},gL={basic:{uniforms:gl([gP.common,gP.specularmap,gP.envmap,gP.aomap,gP.lightmap,gP.fog]),vertexShader:gC.meshbasic_vert,fragmentShader:gC.meshbasic_frag},lambert:{uniforms:gl([gP.common,gP.specularmap,gP.envmap,gP.aomap,gP.lightmap,gP.emissivemap,gP.bumpmap,gP.normalmap,gP.displacementmap,gP.fog,gP.lights,{emissive:{value:new mI(0)}}]),vertexShader:gC.meshlambert_vert,fragmentShader:gC.meshlambert_frag},phong:{uniforms:gl([gP.common,gP.specularmap,gP.envmap,gP.aomap,gP.lightmap,gP.emissivemap,gP.bumpmap,gP.normalmap,gP.displacementmap,gP.fog,gP.lights,{emissive:{value:new mI(0)},specular:{value:new mI(1118481)},shininess:{value:30}}]),vertexShader:gC.meshphong_vert,fragmentShader:gC.meshphong_frag},standard:{uniforms:gl([gP.common,gP.envmap,gP.aomap,gP.lightmap,gP.emissivemap,gP.bumpmap,gP.normalmap,gP.displacementmap,gP.roughnessmap,gP.metalnessmap,gP.fog,gP.lights,{emissive:{value:new mI(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gC.meshphysical_vert,fragmentShader:gC.meshphysical_frag},toon:{uniforms:gl([gP.common,gP.aomap,gP.lightmap,gP.emissivemap,gP.bumpmap,gP.normalmap,gP.displacementmap,gP.gradientmap,gP.fog,gP.lights,{emissive:{value:new mI(0)}}]),vertexShader:gC.meshtoon_vert,fragmentShader:gC.meshtoon_frag},matcap:{uniforms:gl([gP.common,gP.bumpmap,gP.normalmap,gP.displacementmap,gP.fog,{matcap:{value:null}}]),vertexShader:gC.meshmatcap_vert,fragmentShader:gC.meshmatcap_frag},points:{uniforms:gl([gP.points,gP.fog]),vertexShader:gC.points_vert,fragmentShader:gC.points_frag},dashed:{uniforms:gl([gP.common,gP.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gC.linedashed_vert,fragmentShader:gC.linedashed_frag},depth:{uniforms:gl([gP.common,gP.displacementmap]),vertexShader:gC.depth_vert,fragmentShader:gC.depth_frag},normal:{uniforms:gl([gP.common,gP.bumpmap,gP.normalmap,gP.displacementmap,{opacity:{value:1}}]),vertexShader:gC.meshnormal_vert,fragmentShader:gC.meshnormal_frag},sprite:{uniforms:gl([gP.sprite,gP.fog]),vertexShader:gC.sprite_vert,fragmentShader:gC.sprite_frag},background:{uniforms:{uvTransform:{value:new p9},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:gC.background_vert,fragmentShader:gC.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new p9}},vertexShader:gC.backgroundCube_vert,fragmentShader:gC.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:gC.cube_vert,fragmentShader:gC.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gC.equirect_vert,fragmentShader:gC.equirect_frag},distanceRGBA:{uniforms:gl([gP.common,gP.displacementmap,{referencePosition:{value:new fb},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gC.distanceRGBA_vert,fragmentShader:gC.distanceRGBA_frag},shadow:{uniforms:gl([gP.lights,gP.fog,{color:{value:new mI(0)},opacity:{value:1}}]),vertexShader:gC.shadow_vert,fragmentShader:gC.shadow_frag}};gL.physical={uniforms:gl([gL.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new p9},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new p9},clearcoatNormalScale:{value:new p7(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new p9},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new p9},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new p9},sheen:{value:0},sheenColor:{value:new mI(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new p9},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new p9},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new p9},transmissionSamplerSize:{value:new p7},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new p9},attenuationDistance:{value:0},attenuationColor:{value:new mI(0)},specularColor:{value:new mI(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new p9},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new p9},anisotropyVector:{value:new p7},anisotropyMap:{value:null},anisotropyMapTransform:{value:new p9}}]),vertexShader:gC.meshphysical_vert,fragmentShader:gC.meshphysical_frag};let gI={r:0,b:0,g:0},gN=new f9,gD=new fQ;function gU(e,t,i,n,r,a,s){let o,l,c=new mI(0),h=+(!0!==a),u=null,d=0,p=null;function f(e){let n=!0===e.isScene?e.background:null;return n&&n.isTexture&&(n=(e.backgroundBlurriness>0?i:t).get(n)),n}function m(t,i){t.getRGB(gI,gc(e)),n.buffers.color.setClear(gI.r,gI.g,gI.b,i,s)}return{getClearColor:function(){return c},setClearColor:function(e,t=1){c.set(e),m(c,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){m(c,h=e)},render:function(t){let i=!1,r=f(t);null===r?m(c,h):r&&r.isColor&&(m(r,1),i=!0);let a=e.xr.getEnvironmentBlendMode();"additive"===a?n.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&n.buffers.color.setClear(0,0,0,0,s),(e.autoClear||i)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,i){let n=f(i);n&&(n.isCubeTexture||306===n.mapping)?(void 0===l&&((l=new gr(new gs(1,1,1),new gh({name:"BackgroundCubeMaterial",uniforms:go(gL.backgroundCube.uniforms),vertexShader:gL.backgroundCube.vertexShader,fragmentShader:gL.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(l)),gN.copy(i.backgroundRotation),gN.x*=-1,gN.y*=-1,gN.z*=-1,n.isCubeTexture&&!1===n.isRenderTargetTexture&&(gN.y*=-1,gN.z*=-1),l.material.uniforms.envMap.value=n,l.material.uniforms.flipEnvMap.value=n.isCubeTexture&&!1===n.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(gD.makeRotationFromEuler(gN)),l.material.toneMapped=fc.getTransfer(n.colorSpace)!==p$,(u!==n||d!==n.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,u=n,d=n.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):n&&n.isTexture&&(void 0===o&&((o=new gr(new gR(2,2),new gh({name:"BackgroundMaterial",uniforms:go(gL.background.uniforms),vertexShader:gL.background.vertexShader,fragmentShader:gL.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(o)),o.material.uniforms.t2D.value=n,o.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,o.material.toneMapped=fc.getTransfer(n.colorSpace)!==p$,!0===n.matrixAutoUpdate&&n.updateMatrix(),o.material.uniforms.uvTransform.value.copy(n.matrix),(u!==n||d!==n.version||p!==e.toneMapping)&&(o.material.needsUpdate=!0,u=n,d=n.version,p=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))}}}function gO(e,t){let i=e.getParameter(e.MAX_VERTEX_ATTRIBS),n={},r=c(null),a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){let t=[],n=[],r=[];for(let e=0;e<i;e++)t[e]=0,n[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:n,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){let e=a.newAttributes;for(let t=0,i=e.length;t<i;t++)e[t]=0}function u(e){d(e,0)}function d(t,i){let n=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;n[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),s[t]!==i&&(e.vertexAttribDivisor(t,i),s[t]=i)}function p(){let t=a.newAttributes,i=a.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==t[n]&&(e.disableVertexAttribArray(n),i[n]=0)}function f(t,i,n,r,a,s,o){!0===o?e.vertexAttribIPointer(t,i,n,a,s):e.vertexAttribPointer(t,i,n,r,a,s)}function m(){g(),s=!0,a!==r&&o((a=r).object)}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(i,r,l,m,g){var v,_;let x,y,M,S,b=!1,E=(v=m,_=l,x=!0===r.wireframe,void 0===(y=n[v.id])&&(y={},n[v.id]=y),void 0===(M=y[_.id])&&(M={},y[_.id]=M),void 0===(S=M[x])&&(S=c(e.createVertexArray()),M[x]=S),S);a!==E&&o((a=E).object),(b=function(e,t,i,n){let r=a.attributes,s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=r[t],n=s[t];if(void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor)),void 0===i||i.attribute!==n||n&&i.data!==n.data)return!0;o++}return a.attributesNum!==o||a.index!==n}(i,m,l,g))&&function(e,t,i,n){let r={},s=t.attributes,o=0,l=i.getAttributes();for(let t in l)if(l[t].location>=0){let i=s[t];void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor));let n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[t]=n,o++}a.attributes=r,a.attributesNum=o,a.index=n}(i,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(b||s)&&(s=!1,function(i,n,r,a){h();let s=a.attributes,o=r.getAttributes(),l=n.defaultAttributeValues;for(let n in o){let r=o[n];if(r.location>=0){let o=s[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){let n=o.normalized,s=o.itemSize,l=t.get(o);if(void 0===l)continue;let c=l.buffer,h=l.type,p=l.bytesPerElement,m=h===e.INT||h===e.UNSIGNED_INT||1013===o.gpuType;if(o.isInterleavedBufferAttribute){let t=o.data,l=t.stride,g=o.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)d(r.location+e,t.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,h,n,l*p,(g+s/r.locationSize*e)*p,m)}else{if(o.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)d(r.location+e,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let e=0;e<r.locationSize;e++)u(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)f(r.location+e,s/r.locationSize,h,n,s*p,s/r.locationSize*e*p,m)}}else if(void 0!==l){let t=l[n];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(i,r,l,m),null!==g&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){for(let e in m(),n){let t=n[e];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete n[e]}},releaseStatesOfGeometry:function(e){if(void 0===n[e.id])return;let t=n[e.id];for(let e in t){let i=t[e];for(let e in i)l(i[e].object),delete i[e];delete t[e]}delete n[e.id]},releaseStatesOfProgram:function(e){for(let t in n){let i=n[t];if(void 0===i[e.id])continue;let r=i[e.id];for(let e in r)l(r[e].object),delete r[e];delete i[e.id]}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function gF(e,t,i){let n;function r(t,r,a){0!==a&&(e.drawArraysInstanced(n,t,r,a),i.update(r,n,a))}this.setMode=function(e){n=e},this.render=function(t,r){e.drawArrays(n,t,r),i.update(r,n,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,a){if(0===a)return;let s=t.get("WEBGL_multi_draw");if(null===s)for(let t=0;t<a;t++)this.render(e[t],r[t]);else{s.multiDrawArraysWEBGL(n,e,0,r,0,a);let t=0;for(let e=0;e<a;e++)t+=r[e];i.update(t,n,1)}},this.renderMultiDrawInstances=function(e,a,s,o){if(0===s)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],a[t],o[t]);else{l.multiDrawArraysInstancedWEBGL(n,e,0,a,0,o,0,s);let t=0;for(let e=0;e<s;e++)t+=a[e];for(let e=0;e<o.length;e++)i.update(t,n,o[e])}}}function gB(e,t,i,n){let r;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==i.precision?i.precision:"highp",o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);let l=!0===i.logarithmicDepthBuffer,c=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){let i=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return 1023===t||n.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){let r=1016===i&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return 1009===i||n.convert(i)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)||1015===i||!!r},precision:s,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function gz(e){let t=this,i=null,n=0,r=!1,a=!1,s=new gS,o=new p9,l={value:null,needsUpdate:!1};function c(e,i,n,r){let a=null!==e?e.length:0,c=null;if(0!==a){if(c=l.value,!0!==r||null===c){let t=n+4*a,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,i=n;t!==a;++t,i+=4)s.copy(e[t]).applyMatrix4(r,o),s.normal.toArray(c,i),c[i+3]=s.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=a,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let i=0!==e.length||t||0!==n||r;return r=t,n=e.length,i},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){i=c(e,t,0)},this.setState=function(s,o,h){let u=s.clippingPlanes,d=s.clipIntersection,p=s.clipShadows,f=e.get(s);if(r&&null!==u&&0!==u.length&&(!a||p)){let e=a?0:n,t=4*e,r=f.clippingState||null;l.value=r,r=c(u,o,t,h);for(let e=0;e!==t;++e)r[e]=i[e];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}else a?c(null):(l.value!==i&&(l.value=i,l.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0)}}function gk(e){let t=new WeakMap;function i(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping;if(303===a||304===a)if(t.has(r))return i(t.get(r).texture,r.mapping);else{let a=r.image;if(!a||!(a.height>0))return null;{let s=new g_(a.height);return s.fromEquirectangularTexture(e,r),t.set(r,s),r.addEventListener("dispose",n),i(s.texture,r.mapping)}}}return r},dispose:function(){t=new WeakMap}}}let gV=[.125,.215,.35,.446,.526,.582],gH=new class extends gu{constructor(e=-1,t=1,i=1,n=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=n,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,i,n,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2,r=i-e,a=i+e,s=n+t,o=n-t;if(null!==this.view&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}},gG=new mI,gW=null,gj=0,gX=0,gq=!1,gY=(1+Math.sqrt(5))/2,gK=1/gY,gZ=[new fb(-gY,gK,0),new fb(gY,gK,0),new fb(-gK,0,gY),new fb(gK,0,gY),new fb(0,gY,-gK),new fb(0,gY,gK),new fb(-1,1,-1),new fb(1,1,-1),new fb(-1,1,1),new fb(1,1,1)];class g${constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,n=100){gW=this._renderer.getRenderTarget(),gj=this._renderer.getActiveCubeFace(),gX=this._renderer.getActiveMipmapLevel(),gq=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);let r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,n,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=g1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=g0(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(gW,gj,gX),this._renderer.xr.enabled=gq,e.scissorTest=!1,gQ(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),gW=this._renderer.getRenderTarget(),gj=this._renderer.getActiveCubeFace(),gX=this._renderer.getActiveMipmapLevel(),gq=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;let i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:pq,depthBuffer:!1},n=gJ(e,t,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){var r;null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=gJ(e,t,i);let{_lodMax:n}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){let t=[],i=[],n=[],r=e,a=e-4+1+gV.length;for(let s=0;s<a;s++){let a=Math.pow(2,r);i.push(a);let o=1/a;s>e-4?o=gV[s-e+4-1]:0===s&&(o=0),n.push(o);let l=1/(a-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=new Float32Array(108),p=new Float32Array(72),f=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,i=e>2?0:-1,n=[t,i,0,t+2/3,i,0,t+2/3,i+1,0,t,i,0,t+2/3,i+1,0,t,i+1,0];d.set(n,18*e),p.set(u,12*e);let r=[e,e,e,e,e,e];f.set(r,6*e)}let m=new mZ;m.setAttribute("position",new mz(d,3)),m.setAttribute("uv",new mz(p,2)),m.setAttribute("faceIndex",new mz(f,1)),t.push(m),r>4&&r--}return{lodPlanes:t,sizeLods:i,sigmas:n}}(n)),this._blurMaterial=(r=n,new gh({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:new Float32Array(20)},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new fb(0,1,0)}},vertexShader:g2(),fragmentShader:`
658
+
659
+ precision mediump float;
660
+ precision mediump int;
661
+
662
+ varying vec3 vOutputDirection;
663
+
664
+ uniform sampler2D envMap;
665
+ uniform int samples;
666
+ uniform float weights[ n ];
667
+ uniform bool latitudinal;
668
+ uniform float dTheta;
669
+ uniform float mipInt;
670
+ uniform vec3 poleAxis;
671
+
672
+ #define ENVMAP_TYPE_CUBE_UV
673
+ #include <cube_uv_reflection_fragment>
674
+
675
+ vec3 getSample( float theta, vec3 axis ) {
676
+
677
+ float cosTheta = cos( theta );
678
+ // Rodrigues' axis-angle rotation
679
+ vec3 sampleDirection = vOutputDirection * cosTheta
680
+ + cross( axis, vOutputDirection ) * sin( theta )
681
+ + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
682
+
683
+ return bilinearCubeUV( envMap, sampleDirection, mipInt );
684
+
685
+ }
686
+
687
+ void main() {
688
+
689
+ vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
690
+
691
+ if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
692
+
693
+ axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
694
+
695
+ }
696
+
697
+ axis = normalize( axis );
698
+
699
+ gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
700
+ gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
701
+
702
+ for ( int i = 1; i < n; i++ ) {
703
+
704
+ if ( i >= samples ) {
705
+
706
+ break;
707
+
708
+ }
709
+
710
+ float theta = dTheta * float( i );
711
+ gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
712
+ gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
713
+
714
+ }
715
+
716
+ }
717
+ `,blending:0,depthTest:!1,depthWrite:!1}))}return n}_compileMaterial(e){let t=new gr(this._lodPlanes[0],e);this._renderer.compile(t,gH)}_sceneToCubeUV(e,t,i,n){let r=new gm(90,1,t,i),a=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],o=this._renderer,l=o.autoClear,c=o.toneMapping;o.getClearColor(gG),o.toneMapping=0,o.autoClear=!1;let h=new mO({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),u=new gr(new gs,h),d=!1,p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,d=!0):(h.color.copy(gG),d=!0);for(let t=0;t<6;t++){let i=t%3;0===i?(r.up.set(0,a[t],0),r.lookAt(s[t],0,0)):1===i?(r.up.set(0,0,a[t]),r.lookAt(0,s[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,s[t]));let l=this._cubeSize;gQ(n,i*l,t>2?l:0,l,l),o.setRenderTarget(n),d&&o.render(u,r),o.render(e,r)}u.geometry.dispose(),u.material.dispose(),o.toneMapping=c,o.autoClear=l,e.background=p}_textureToCubeUV(e,t){let i=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=g1()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=g0());let r=n?this._cubemapMaterial:this._equirectMaterial,a=new gr(this._lodPlanes[0],r);r.uniforms.envMap.value=e;let s=this._cubeSize;gQ(t,0,0,3*s,2*s),i.setRenderTarget(t),i.render(a,gH)}_applyPMREM(e){let t=this._renderer,i=t.autoClear;t.autoClear=!1;let n=this._lodPlanes.length;for(let t=1;t<n;t++){let i=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=gZ[(n-t-1)%gZ.length];this._blur(e,t-1,t,i,r)}t.autoClear=i}_blur(e,t,i,n,r){let a=this._pingPongRenderTarget;this._halfBlur(e,a,t,i,n,"latitudinal",r),this._halfBlur(a,e,i,i,n,"longitudinal",r)}_halfBlur(e,t,i,n,r,a,s){let o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");let c=new gr(this._lodPlanes[n],l),h=l.uniforms,u=this._sizeLods[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):20;f>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);let m=[],g=0;for(let e=0;e<20;++e){let t=e/p,i=Math.exp(-t*t/2);m.push(i),0===e?g+=i:e<f&&(g+=2*i)}for(let e=0;e<m.length;e++)m[e]=m[e]/g;h.envMap.value=e.texture,h.samples.value=f,h.weights.value=m,h.latitudinal.value="latitudinal"===a,s&&(h.poleAxis.value=s);let{_lodMax:v}=this;h.dTheta.value=d,h.mipInt.value=v-i;let _=this._sizeLods[n],x=4*(this._cubeSize-_);gQ(t,3*_*(n>v-4?n-v+4:0),x,3*_,2*_),o.setRenderTarget(t),o.render(c,gH)}}function gJ(e,t,i){let n=new fy(e,t,i);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function gQ(e,t,i,n,r){e.viewport.set(t,i,n,r),e.scissor.set(t,i,n,r)}function g0(){return new gh({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:g2(),fragmentShader:`
718
+
719
+ precision mediump float;
720
+ precision mediump int;
721
+
722
+ varying vec3 vOutputDirection;
723
+
724
+ uniform sampler2D envMap;
725
+
726
+ #include <common>
727
+
728
+ void main() {
729
+
730
+ vec3 outputDirection = normalize( vOutputDirection );
731
+ vec2 uv = equirectUv( outputDirection );
732
+
733
+ gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
734
+
735
+ }
736
+ `,blending:0,depthTest:!1,depthWrite:!1})}function g1(){return new gh({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:g2(),fragmentShader:`
737
+
738
+ precision mediump float;
739
+ precision mediump int;
740
+
741
+ uniform float flipEnvMap;
742
+
743
+ varying vec3 vOutputDirection;
744
+
745
+ uniform samplerCube envMap;
746
+
747
+ void main() {
748
+
749
+ gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
750
+
751
+ }
752
+ `,blending:0,depthTest:!1,depthWrite:!1})}function g2(){return`
753
+
754
+ precision mediump float;
755
+ precision mediump int;
756
+
757
+ attribute float faceIndex;
758
+
759
+ varying vec3 vOutputDirection;
760
+
761
+ // RH coordinate system; PMREM face-indexing convention
762
+ vec3 getDirection( vec2 uv, float face ) {
763
+
764
+ uv = 2.0 * uv - 1.0;
765
+
766
+ vec3 direction = vec3( uv, 1.0 );
767
+
768
+ if ( face == 0.0 ) {
769
+
770
+ direction = direction.zyx; // ( 1, v, u ) pos x
771
+
772
+ } else if ( face == 1.0 ) {
773
+
774
+ direction = direction.xzy;
775
+ direction.xz *= -1.0; // ( -u, 1, -v ) pos y
776
+
777
+ } else if ( face == 2.0 ) {
778
+
779
+ direction.x *= -1.0; // ( -u, v, 1 ) pos z
780
+
781
+ } else if ( face == 3.0 ) {
782
+
783
+ direction = direction.zyx;
784
+ direction.xz *= -1.0; // ( -1, v, -u ) neg x
785
+
786
+ } else if ( face == 4.0 ) {
787
+
788
+ direction = direction.xzy;
789
+ direction.xy *= -1.0; // ( -u, -1, v ) neg y
790
+
791
+ } else if ( face == 5.0 ) {
792
+
793
+ direction.z *= -1.0; // ( u, v, -1 ) neg z
794
+
795
+ }
796
+
797
+ return direction;
798
+
799
+ }
800
+
801
+ void main() {
802
+
803
+ vOutputDirection = getDirection( uv, faceIndex );
804
+ gl_Position = vec4( position, 1.0 );
805
+
806
+ }
807
+ `}function g3(e){let t=new WeakMap,i=null;function n(e){let i=e.target;i.removeEventListener("dispose",n);let r=t.get(i);void 0!==r&&(t.delete(i),r.dispose())}return{get:function(r){if(r&&r.isTexture){let a=r.mapping,s=303===a||304===a,o=301===a||302===a;if(s||o){let a=t.get(r),l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===i&&(i=new g$(e)),(a=s?i.fromEquirectangular(r,a):i.fromCubemap(r,a)).texture.pmremVersion=r.pmremVersion,t.set(r,a),a.texture;{if(void 0!==a)return a.texture;let l=r.image;return s&&l&&l.height>0||o&&l&&function(e){let t=0;for(let i=0;i<6;i++)void 0!==e[i]&&t++;return 6===t}(l)?(null===i&&(i=new g$(e)),(a=s?i.fromEquirectangular(r):i.fromCubemap(r)).texture.pmremVersion=r.pmremVersion,t.set(r,a),r.addEventListener("dispose",n),a.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function g5(e){let t={};function i(i){let n;if(void 0!==t[i])return t[i];switch(i){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(i)}return t[i]=n,n}return{has:function(e){return null!==i(e)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(e){let t=i(e);return null===t&&fr("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function g4(e,t,i,n){let r={},a=new WeakMap;function s(e){let o=e.target;for(let e in null!==o.index&&t.remove(o.index),o.attributes)t.remove(o.attributes[e]);for(let e in o.morphAttributes){let i=o.morphAttributes[e];for(let e=0,n=i.length;e<n;e++)t.remove(i[e])}o.removeEventListener("dispose",s),delete r[o.id];let l=a.get(o);l&&(t.remove(l),a.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(e){let i=[],n=e.index,r=e.attributes.position,s=0;if(null!==n){let e=n.array;s=n.version;for(let t=0,n=e.length;t<n;t+=3){let n=e[t+0],r=e[t+1],a=e[t+2];i.push(n,r,r,a,a,n)}}else{if(void 0===r)return;let e=r.array;s=r.version;for(let t=0,n=e.length/3-1;t<n;t+=3){let e=t+0,n=t+1,r=t+2;i.push(e,n,n,r,r,e)}}let o=new(ft(i)?mV:mk)(i,1);o.version=s;let l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,i.memory.geometries++),t},update:function(i){let n=i.attributes;for(let i in n)t.update(n[i],e.ARRAY_BUFFER);let r=i.morphAttributes;for(let i in r){let n=r[i];for(let i=0,r=n.length;i<r;i++)t.update(n[i],e.ARRAY_BUFFER)}},getWireframeAttribute:function(e){let t=a.get(e);if(t){let i=e.index;null!==i&&t.version<i.version&&o(e)}else o(e);return a.get(e)}}}function g6(e,t,i){let n,r,a;function s(t,s,o){0!==o&&(e.drawElementsInstanced(n,s,r,t*a,o),i.update(s,n,o))}this.setMode=function(e){n=e},this.setIndex=function(e){r=e.type,a=e.bytesPerElement},this.render=function(t,s){e.drawElements(n,s,r,t*a),i.update(s,n,1)},this.renderInstances=s,this.renderMultiDraw=function(e,s,o){if(0===o)return;let l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<o;t++)this.render(e[t]/a,s[t]);else{l.multiDrawElementsWEBGL(n,s,0,r,e,0,o);let t=0;for(let e=0;e<o;e++)t+=s[e];i.update(t,n,1)}},this.renderMultiDrawInstances=function(e,o,l,c){if(0===l)return;let h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)s(e[t]/a,o[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(n,o,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e];for(let e=0;e<c.length;e++)i.update(t,n,c[e])}}}function g8(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(i,n,r){switch(t.calls++,n){case e.TRIANGLES:t.triangles+=i/3*r;break;case e.LINES:t.lines+=i/2*r;break;case e.LINE_STRIP:t.lines+=r*(i-1);break;case e.LINE_LOOP:t.lines+=r*i;break;case e.POINTS:t.points+=r*i;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",n)}}}}function g7(e,t,i){let n=new WeakMap,r=new f_;return{update:function(a,s,o){let l=a.morphTargetInfluences,c=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,h=void 0!==c?c.length:0,u=n.get(s);if(void 0===u||u.count!==h){void 0!==u&&u.texture.dispose();let e=void 0!==s.morphAttributes.position,i=void 0!==s.morphAttributes.normal,a=void 0!==s.morphAttributes.color,o=s.morphAttributes.position||[],l=s.morphAttributes.normal||[],c=s.morphAttributes.color||[],d=0;!0===e&&(d=1),!0===i&&(d=2),!0===a&&(d=3);let p=s.attributes.position.count*d,f=1;p>t.maxTextureSize&&(f=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let m=new Float32Array(p*f*4*h),g=new fM(m,p,f,h);g.type=1015,g.needsUpdate=!0;let v=4*d;for(let t=0;t<h;t++){let n=o[t],s=l[t],h=c[t],u=p*f*4*t;for(let t=0;t<n.count;t++){let o=t*v;!0===e&&(r.fromBufferAttribute(n,t),m[u+o+0]=r.x,m[u+o+1]=r.y,m[u+o+2]=r.z,m[u+o+3]=0),!0===i&&(r.fromBufferAttribute(s,t),m[u+o+4]=r.x,m[u+o+5]=r.y,m[u+o+6]=r.z,m[u+o+7]=0),!0===a&&(r.fromBufferAttribute(h,t),m[u+o+8]=r.x,m[u+o+9]=r.y,m[u+o+10]=r.z,m[u+o+11]=4===h.itemSize?r.w:1)}}u={count:h,texture:g,size:new p7(p,f)},n.set(s,u),s.addEventListener("dispose",function e(){g.dispose(),n.delete(s),s.removeEventListener("dispose",e)})}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(e,"morphTexture",a.morphTexture,i);else{let t=0;for(let e=0;e<l.length;e++)t+=l[e];let i=s.morphTargetsRelative?1:1-t;o.getUniforms().setValue(e,"morphTargetBaseInfluence",i),o.getUniforms().setValue(e,"morphTargetInfluences",l)}o.getUniforms().setValue(e,"morphTargetsTexture",u.texture,i),o.getUniforms().setValue(e,"morphTargetsTextureSize",u.size)}}}function g9(e,t,i,n){let r=new WeakMap;function a(e){let t=e.target;t.removeEventListener("dispose",a),i.remove(t.instanceMatrix),null!==t.instanceColor&&i.remove(t.instanceColor)}return{update:function(s){let o=n.render.frame,l=s.geometry,c=t.get(s,l);if(r.get(c)!==o&&(t.update(c),r.set(c,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),r.get(s)!==o&&(i.update(s.instanceMatrix,e.ARRAY_BUFFER),null!==s.instanceColor&&i.update(s.instanceColor,e.ARRAY_BUFFER),r.set(s,o))),s.isSkinnedMesh){let e=s.skeleton;r.get(e)!==o&&(e.update(),r.set(e,o))}return c},dispose:function(){r=new WeakMap}}}class ve extends fv{constructor(e,t,i,n,r,a,s,o,l,c=1026){if(1026!==c&&1027!==c)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===i&&1026===c&&(i=1014),void 0===i&&1027===c&&(i=1020),super(null,n,r,a,s,o,c,i,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==o?o:1003,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}let vt=new fv,vi=new ve(1,1);vi.compareFunction=515;let vn=new fM,vr=new class extends fv{constructor(e=null,t=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},va=new gv,vs=[],vo=[],vl=new Float32Array(16),vc=new Float32Array(9),vh=new Float32Array(4);function vu(e,t,i){let n=e[0];if(n<=0||n>0)return e;let r=t*i,a=vs[r];if(void 0===a&&(a=new Float32Array(r),vs[r]=a),0!==t){n.toArray(a,0);for(let n=1,r=0;n!==t;++n)r+=i,e[n].toArray(a,r)}return a}function vd(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0}function vp(e,t){for(let i=0,n=t.length;i<n;i++)e[i]=t[i]}function vf(e,t){let i=vo[t];void 0===i&&(i=new Int32Array(t),vo[t]=i);for(let n=0;n!==t;++n)i[n]=e.allocateTextureUnit();return i}function vm(e,t){let i=this.cache;i[0]!==t&&(e.uniform1f(this.addr,t),i[0]=t)}function vg(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(vd(i,t))return;e.uniform2fv(this.addr,t),vp(i,t)}}function vv(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else if(void 0!==t.r)(i[0]!==t.r||i[1]!==t.g||i[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),i[0]=t.r,i[1]=t.g,i[2]=t.b);else{if(vd(i,t))return;e.uniform3fv(this.addr,t),vp(i,t)}}function v_(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(vd(i,t))return;e.uniform4fv(this.addr,t),vp(i,t)}}function vx(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(vd(i,t))return;e.uniformMatrix2fv(this.addr,!1,t),vp(i,t)}else{if(vd(i,n))return;vh.set(n),e.uniformMatrix2fv(this.addr,!1,vh),vp(i,n)}}function vy(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(vd(i,t))return;e.uniformMatrix3fv(this.addr,!1,t),vp(i,t)}else{if(vd(i,n))return;vc.set(n),e.uniformMatrix3fv(this.addr,!1,vc),vp(i,n)}}function vM(e,t){let i=this.cache,n=t.elements;if(void 0===n){if(vd(i,t))return;e.uniformMatrix4fv(this.addr,!1,t),vp(i,t)}else{if(vd(i,n))return;vl.set(n),e.uniformMatrix4fv(this.addr,!1,vl),vp(i,n)}}function vS(e,t){let i=this.cache;i[0]!==t&&(e.uniform1i(this.addr,t),i[0]=t)}function vb(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(vd(i,t))return;e.uniform2iv(this.addr,t),vp(i,t)}}function vE(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(vd(i,t))return;e.uniform3iv(this.addr,t),vp(i,t)}}function vT(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(vd(i,t))return;e.uniform4iv(this.addr,t),vp(i,t)}}function vw(e,t){let i=this.cache;i[0]!==t&&(e.uniform1ui(this.addr,t),i[0]=t)}function vA(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),i[0]=t.x,i[1]=t.y);else{if(vd(i,t))return;e.uniform2uiv(this.addr,t),vp(i,t)}}function vR(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),i[0]=t.x,i[1]=t.y,i[2]=t.z);else{if(vd(i,t))return;e.uniform3uiv(this.addr,t),vp(i,t)}}function vC(e,t){let i=this.cache;if(void 0!==t.x)(i[0]!==t.x||i[1]!==t.y||i[2]!==t.z||i[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=t.w);else{if(vd(i,t))return;e.uniform4uiv(this.addr,t),vp(i,t)}}function vP(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r);let a=this.type===e.SAMPLER_2D_SHADOW?vi:vt;i.setTexture2D(t||a,r)}function vL(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(t||vr,r)}function vI(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(t||va,r)}function vN(e,t,i){let n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(e.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(t||vn,r)}function vD(e,t){e.uniform1fv(this.addr,t)}function vU(e,t){let i=vu(t,this.size,2);e.uniform2fv(this.addr,i)}function vO(e,t){let i=vu(t,this.size,3);e.uniform3fv(this.addr,i)}function vF(e,t){let i=vu(t,this.size,4);e.uniform4fv(this.addr,i)}function vB(e,t){let i=vu(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,i)}function vz(e,t){let i=vu(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,i)}function vk(e,t){let i=vu(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,i)}function vV(e,t){e.uniform1iv(this.addr,t)}function vH(e,t){e.uniform2iv(this.addr,t)}function vG(e,t){e.uniform3iv(this.addr,t)}function vW(e,t){e.uniform4iv(this.addr,t)}function vj(e,t){e.uniform1uiv(this.addr,t)}function vX(e,t){e.uniform2uiv(this.addr,t)}function vq(e,t){e.uniform3uiv(this.addr,t)}function vY(e,t){e.uniform4uiv(this.addr,t)}function vK(e,t,i){let n=this.cache,r=t.length,a=vf(i,r);vd(n,a)||(e.uniform1iv(this.addr,a),vp(n,a));for(let e=0;e!==r;++e)i.setTexture2D(t[e]||vt,a[e])}function vZ(e,t,i){let n=this.cache,r=t.length,a=vf(i,r);vd(n,a)||(e.uniform1iv(this.addr,a),vp(n,a));for(let e=0;e!==r;++e)i.setTexture3D(t[e]||vr,a[e])}function v$(e,t,i){let n=this.cache,r=t.length,a=vf(i,r);vd(n,a)||(e.uniform1iv(this.addr,a),vp(n,a));for(let e=0;e!==r;++e)i.setTextureCube(t[e]||va,a[e])}function vJ(e,t,i){let n=this.cache,r=t.length,a=vf(i,r);vd(n,a)||(e.uniform1iv(this.addr,a),vp(n,a));for(let e=0;e!==r;++e)i.setTexture2DArray(t[e]||vn,a[e])}class vQ{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return vm;case 35664:return vg;case 35665:return vv;case 35666:return v_;case 35674:return vx;case 35675:return vy;case 35676:return vM;case 5124:case 35670:return vS;case 35667:case 35671:return vb;case 35668:case 35672:return vE;case 35669:case 35673:return vT;case 5125:return vw;case 36294:return vA;case 36295:return vR;case 36296:return vC;case 35678:case 36198:case 36298:case 36306:case 35682:return vP;case 35679:case 36299:case 36307:return vL;case 35680:case 36300:case 36308:case 36293:return vI;case 36289:case 36303:case 36311:case 36292:return vN}}(t.type)}}class v0{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return vD;case 35664:return vU;case 35665:return vO;case 35666:return vF;case 35674:return vB;case 35675:return vz;case 35676:return vk;case 5124:case 35670:return vV;case 35667:case 35671:return vH;case 35668:case 35672:return vG;case 35669:case 35673:return vW;case 5125:return vj;case 36294:return vX;case 36295:return vq;case 36296:return vY;case 35678:case 36198:case 36298:case 36306:case 35682:return vK;case 35679:case 36299:case 36307:return vZ;case 35680:case 36300:case 36308:case 36293:return v$;case 36289:case 36303:case 36311:case 36292:return vJ}}(t.type)}}class v1{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){let n=this.seq;for(let r=0,a=n.length;r!==a;++r){let a=n[r];a.setValue(e,t[a.id],i)}}}let v2=/(\w+)(\])?(\[|\.)?/g;function v3(e,t){e.seq.push(t),e.map[t.id]=t}class v5{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=e.getActiveUniform(t,n),r=e.getUniformLocation(t,i.name);!function(e,t,i){let n=e.name,r=n.length;for(v2.lastIndex=0;;){let a=v2.exec(n),s=v2.lastIndex,o=a[1],l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){v3(i,void 0===c?new vQ(o,e,t):new v0(o,e,t));break}{let e=i.map[o];void 0===e&&v3(i,e=new v1(o)),i=e}}}(i,r,this)}}setValue(e,t,i,n){let r=this.map[t];void 0!==r&&r.setValue(e,i,n)}setOptional(e,t,i){let n=t[i];void 0!==n&&this.setValue(e,i,n)}static upload(e,t,i,n){for(let r=0,a=t.length;r!==a;++r){let a=t[r],s=i[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,n)}}static seqWithValue(e,t){let i=[];for(let n=0,r=e.length;n!==r;++n){let r=e[n];r.id in t&&i.push(r)}return i}}function v4(e,t,i){let n=e.createShader(t);return e.shaderSource(n,i),e.compileShader(n),n}let v6=0;function v8(e,t,i){let n=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(n&&""===r)return"";let a=/ERROR: 0:(\d+)/.exec(r);if(!a)return r;{let n=parseInt(a[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){let i=e.split("\n"),n=[],r=Math.max(t-6,0),a=Math.min(t+6,i.length);for(let e=r;e<a;e++){let r=e+1;n.push(`${r===t?">":" "} ${r}: ${i[e]}`)}return n.join("\n")}(e.getShaderSource(t),n)}}function v7(e){return""!==e}function v9(e,t){let i=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function _e(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let _t=/^[ \t]*#include +<([\w\d./]+)>/gm;function _i(e){return e.replace(_t,_r)}let _n=new Map;function _r(e,t){let i=gC[t];if(void 0===i){let e=_n.get(t);if(void 0!==e)i=gC[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e);else throw Error("Can not resolve #include <"+t+">")}return _i(i)}let _a=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function _s(e){return e.replace(_a,_o)}function _o(e,t,i,n){let r="";for(let e=parseInt(t);e<parseInt(i);e++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function _l(e){let t=`precision ${e.precision} float;
808
+ precision ${e.precision} int;
809
+ precision ${e.precision} sampler2D;
810
+ precision ${e.precision} samplerCube;
811
+ precision ${e.precision} sampler3D;
812
+ precision ${e.precision} sampler2DArray;
813
+ precision ${e.precision} sampler2DShadow;
814
+ precision ${e.precision} samplerCubeShadow;
815
+ precision ${e.precision} sampler2DArrayShadow;
816
+ precision ${e.precision} isampler2D;
817
+ precision ${e.precision} isampler3D;
818
+ precision ${e.precision} isamplerCube;
819
+ precision ${e.precision} isampler2DArray;
820
+ precision ${e.precision} usampler2D;
821
+ precision ${e.precision} usampler3D;
822
+ precision ${e.precision} usamplerCube;
823
+ precision ${e.precision} usampler2DArray;
824
+ `;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function _c(e,t,i,n){let r,a,s,o,l,c,h=e.getContext(),u=i.defines,d=i.vertexShader,p=i.fragmentShader,f=(l="SHADOWMAP_TYPE_BASIC",1===i.shadowMapType?l="SHADOWMAP_TYPE_PCF":2===i.shadowMapType?l="SHADOWMAP_TYPE_PCF_SOFT":3===i.shadowMapType&&(l="SHADOWMAP_TYPE_VSM"),l),m=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case 301:case 302:t="ENVMAP_TYPE_CUBE";break;case 306:t="ENVMAP_TYPE_CUBE_UV"}return t}(i),g=(c="ENVMAP_MODE_REFLECTION",i.envMap&&302===i.envMapMode&&(c="ENVMAP_MODE_REFRACTION"),c),v=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case 0:t="ENVMAP_BLENDING_MULTIPLY";break;case 1:t="ENVMAP_BLENDING_MIX";break;case 2:t="ENVMAP_BLENDING_ADD"}return t}(i),_=function(e){let t=e.envMapCubeUVHeight;if(null===t)return null;let i=Math.log2(t)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:1/t,maxMip:i}}(i),x=[i.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",i.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(v7).join("\n"),y=function(e){let t=[];for(let i in e){let n=e[i];!1!==n&&t.push("#define "+i+" "+n)}return t.join("\n")}(u),M=h.createProgram(),S=i.glslVersion?"#version "+i.glslVersion+"\n":"";if(i.isRawShaderMaterial)(r=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(v7).join("\n")).length>0&&(r+="\n"),(a=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y].filter(v7).join("\n")).length>0&&(a+="\n");else{let e;r=[_l(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+g:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(v7).join("\n"),a=[_l(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,y,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+m:"",i.envMap?"#define "+g:"",i.envMap?"#define "+v:"",_?"#define CUBEUV_TEXEL_WIDTH "+_.texelWidth:"",_?"#define CUBEUV_TEXEL_HEIGHT "+_.texelHeight:"",_?"#define CUBEUV_MAX_MIP "+_.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor||i.batchingColor?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+f:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?gC.tonemapping_pars_fragment:"",0!==i.toneMapping?function(e,t){let i;switch(t){case 1:i="Linear";break;case 2:i="Reinhard";break;case 3:i="OptimizedCineon";break;case 4:i="ACESFilmic";break;case 6:i="AgX";break;case 7:i="Neutral";break;case 5:i="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),i="Linear"}return"vec3 "+e+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",gC.colorspace_pars_fragment,(e=function(e){let t,i=fc.getPrimaries(fc.workingColorSpace),n=fc.getPrimaries(e);switch(i===n?t="":"p3"===i&&n===pJ?t="LinearDisplayP3ToLinearSRGB":i===pJ&&"p3"===n&&(t="LinearSRGBToLinearDisplayP3"),e){case pq:case pK:return[t,"LinearTransferOETF"];case pX:case pY:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",e),[t,"LinearTransferOETF"]}}(i.outputColorSpace),`vec4 linearToOutputTexel( vec4 value ) { return ${e[0]}( ${e[1]}( value ) ); }`),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(v7).join("\n")}d=_e(d=v9(d=_i(d),i),i),p=_e(p=v9(p=_i(p),i),i),d=_s(d),p=_s(p),!0!==i.isRawShaderMaterial&&(S="#version 300 es\n",r=[x,"#define attribute in\n#define varying out\n#define texture2D texture"].join("\n")+"\n"+r,a=["#define varying in",i.glslVersion===pQ?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===pQ?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+a);let b=S+r+d,E=S+a+p,T=v4(h,h.VERTEX_SHADER,b),w=v4(h,h.FRAGMENT_SHADER,E);function A(t){if(e.debug.checkShaderErrors){let i=h.getProgramInfoLog(M).trim(),n=h.getShaderInfoLog(T).trim(),s=h.getShaderInfoLog(w).trim(),o=!0,l=!0;if(!1===h.getProgramParameter(M,h.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(h,M,T,w);else{let e=v8(h,T,"vertex"),n=v8(h,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+h.getError()+" - VALIDATE_STATUS "+h.getProgramParameter(M,h.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+i+"\n"+e+"\n"+n)}else""!==i?console.warn("THREE.WebGLProgram: Program Info Log:",i):(""===n||""===s)&&(l=!1);l&&(t.diagnostics={runnable:o,programLog:i,vertexShader:{log:n,prefix:r},fragmentShader:{log:s,prefix:a}})}h.deleteShader(T),h.deleteShader(w),s=new v5(h,M),o=function(e,t){let i={},n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){let n=e.getActiveAttrib(t,r),a=n.name,s=1;n.type===e.FLOAT_MAT2&&(s=2),n.type===e.FLOAT_MAT3&&(s=3),n.type===e.FLOAT_MAT4&&(s=4),i[a]={type:n.type,location:e.getAttribLocation(t,a),locationSize:s}}return i}(h,M)}h.attachShader(M,T),h.attachShader(M,w),void 0!==i.index0AttributeName?h.bindAttribLocation(M,0,i.index0AttributeName):!0===i.morphTargets&&h.bindAttribLocation(M,0,"position"),h.linkProgram(M),this.getUniforms=function(){return void 0===s&&A(this),s},this.getAttributes=function(){return void 0===o&&A(this),o};let R=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===R&&(R=h.getProgramParameter(M,37297)),R},this.destroy=function(){n.releaseStatesOfProgram(this),h.deleteProgram(M),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=v6++,this.cacheKey=t,this.usedTimes=1,this.program=M,this.vertexShader=T,this.fragmentShader=w,this}let _h=0;class _u{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,i=e.fragmentShader,n=this._getShaderStage(t),r=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return!1===a.has(n)&&(a.add(n),n.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(e){for(let t of this.materialCache.get(e))t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,i=t.get(e);return void 0===i&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){let t=this.shaderCache,i=t.get(e);return void 0===i&&(i=new _d(e),t.set(e,i)),i}}class _d{constructor(e){this.id=_h++,this.code=e,this.usedTimes=0}}function _p(e,t,i,n,r,a,s){let o=new me,l=new _u,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures,p=r.precision,f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(e){return(c.add(e),0===e)?"uv":`uv${e}`}return{getParameters:function(a,o,h,g,v){let _,x,y,M,S=g.fog,b=v.geometry,E=a.isMeshStandardMaterial?g.environment:null,T=(a.isMeshStandardMaterial?i:t).get(a.envMap||E),w=T&&306===T.mapping?T.image.height:null,A=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision))!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead.");let R=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,C=void 0!==R?R.length:0,P=0;if(void 0!==b.morphAttributes.position&&(P=1),void 0!==b.morphAttributes.normal&&(P=2),void 0!==b.morphAttributes.color&&(P=3),A){let e=gL[A];_=e.vertexShader,x=e.fragmentShader}else _=a.vertexShader,x=a.fragmentShader,l.update(a),y=l.getVertexShaderID(a),M=l.getFragmentShaderID(a);let L=e.getRenderTarget(),I=!0===v.isInstancedMesh,N=!0===v.isBatchedMesh,D=!!a.map,U=!!a.matcap,O=!!T,F=!!a.aoMap,B=!!a.lightMap,z=!!a.bumpMap,k=!!a.normalMap,V=!!a.displacementMap,H=!!a.emissiveMap,G=!!a.metalnessMap,W=!!a.roughnessMap,j=a.anisotropy>0,X=a.clearcoat>0,q=a.dispersion>0,Y=a.iridescence>0,K=a.sheen>0,Z=a.transmission>0,$=j&&!!a.anisotropyMap,J=X&&!!a.clearcoatMap,Q=X&&!!a.clearcoatNormalMap,ee=X&&!!a.clearcoatRoughnessMap,et=Y&&!!a.iridescenceMap,ei=Y&&!!a.iridescenceThicknessMap,en=K&&!!a.sheenColorMap,er=K&&!!a.sheenRoughnessMap,ea=!!a.specularMap,es=!!a.specularColorMap,eo=!!a.specularIntensityMap,el=Z&&!!a.transmissionMap,ec=Z&&!!a.thicknessMap,eh=!!a.gradientMap,eu=!!a.alphaMap,ed=a.alphaTest>0,ep=!!a.alphaHash,ef=!!a.extensions,em=0;a.toneMapped&&(null===L||!0===L.isXRRenderTarget)&&(em=e.toneMapping);let eg={shaderID:A,shaderType:a.type,shaderName:a.name,vertexShader:_,fragmentShader:x,defines:a.defines,customVertexShaderID:y,customFragmentShaderID:M,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:N,batchingColor:N&&null!==v._colorsTexture,instancing:I,instancingColor:I&&null!==v.instanceColor,instancingMorph:I&&null!==v.morphTexture,supportsVertexTextures:d,outputColorSpace:null===L?e.outputColorSpace:!0===L.isXRRenderTarget?L.texture.colorSpace:pq,alphaToCoverage:!!a.alphaToCoverage,map:D,matcap:U,envMap:O,envMapMode:O&&T.mapping,envMapCubeUVHeight:w,aoMap:F,lightMap:B,bumpMap:z,normalMap:k,displacementMap:d&&V,emissiveMap:H,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:G,roughnessMap:W,anisotropy:j,anisotropyMap:$,clearcoat:X,clearcoatMap:J,clearcoatNormalMap:Q,clearcoatRoughnessMap:ee,dispersion:q,iridescence:Y,iridescenceMap:et,iridescenceThicknessMap:ei,sheen:K,sheenColorMap:en,sheenRoughnessMap:er,specularMap:ea,specularColorMap:es,specularIntensityMap:eo,transmission:Z,transmissionMap:el,thicknessMap:ec,gradientMap:eh,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:eu,alphaTest:ed,alphaHash:ep,combine:a.combine,mapUv:D&&m(a.map.channel),aoMapUv:F&&m(a.aoMap.channel),lightMapUv:B&&m(a.lightMap.channel),bumpMapUv:z&&m(a.bumpMap.channel),normalMapUv:k&&m(a.normalMap.channel),displacementMapUv:V&&m(a.displacementMap.channel),emissiveMapUv:H&&m(a.emissiveMap.channel),metalnessMapUv:G&&m(a.metalnessMap.channel),roughnessMapUv:W&&m(a.roughnessMap.channel),anisotropyMapUv:$&&m(a.anisotropyMap.channel),clearcoatMapUv:J&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:Q&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ee&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:ei&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:en&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:er&&m(a.sheenRoughnessMap.channel),specularMapUv:ea&&m(a.specularMap.channel),specularColorMapUv:es&&m(a.specularColorMap.channel),specularIntensityMapUv:eo&&m(a.specularIntensityMap.channel),transmissionMapUv:el&&m(a.transmissionMap.channel),thicknessMapUv:ec&&m(a.thicknessMap.channel),alphaMapUv:eu&&m(a.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(k||j),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===v.isPoints&&!!b.attributes.uv&&(D||eu),fog:!!S,useFog:!0===a.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:u,skinning:!0===v.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:C,morphTextureStride:P,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:em,decodeVideoTexture:D&&!0===a.map.isVideoTexture&&fc.getTransfer(a.map.colorSpace)===p$,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ef&&!0===a.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:ef&&!0===a.extensions.multiDraw&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return eg.vertexUv1s=c.has(1),eg.vertexUv2s=c.has(2),eg.vertexUv3s=c.has(3),c.clear(),eg},getProgramCacheKey:function(t){var i,n,r,a;let s=[];if(t.shaderID?s.push(t.shaderID):(s.push(t.customVertexShaderID),s.push(t.customFragmentShaderID)),void 0!==t.defines)for(let e in t.defines)s.push(e),s.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(i=s,n=t,i.push(n.precision),i.push(n.outputColorSpace),i.push(n.envMapMode),i.push(n.envMapCubeUVHeight),i.push(n.mapUv),i.push(n.alphaMapUv),i.push(n.lightMapUv),i.push(n.aoMapUv),i.push(n.bumpMapUv),i.push(n.normalMapUv),i.push(n.displacementMapUv),i.push(n.emissiveMapUv),i.push(n.metalnessMapUv),i.push(n.roughnessMapUv),i.push(n.anisotropyMapUv),i.push(n.clearcoatMapUv),i.push(n.clearcoatNormalMapUv),i.push(n.clearcoatRoughnessMapUv),i.push(n.iridescenceMapUv),i.push(n.iridescenceThicknessMapUv),i.push(n.sheenColorMapUv),i.push(n.sheenRoughnessMapUv),i.push(n.specularMapUv),i.push(n.specularColorMapUv),i.push(n.specularIntensityMapUv),i.push(n.transmissionMapUv),i.push(n.thicknessMapUv),i.push(n.combine),i.push(n.fogExp2),i.push(n.sizeAttenuation),i.push(n.morphTargetsCount),i.push(n.morphAttributeCount),i.push(n.numDirLights),i.push(n.numPointLights),i.push(n.numSpotLights),i.push(n.numSpotLightMaps),i.push(n.numHemiLights),i.push(n.numRectAreaLights),i.push(n.numDirLightShadows),i.push(n.numPointLightShadows),i.push(n.numSpotLightShadows),i.push(n.numSpotLightShadowsWithMaps),i.push(n.numLightProbes),i.push(n.shadowMapType),i.push(n.toneMapping),i.push(n.numClippingPlanes),i.push(n.numClipIntersection),i.push(n.depthPacking),r=s,a=t,o.disableAll(),a.supportsVertexTextures&&o.enable(0),a.instancing&&o.enable(1),a.instancingColor&&o.enable(2),a.instancingMorph&&o.enable(3),a.matcap&&o.enable(4),a.envMap&&o.enable(5),a.normalMapObjectSpace&&o.enable(6),a.normalMapTangentSpace&&o.enable(7),a.clearcoat&&o.enable(8),a.iridescence&&o.enable(9),a.alphaTest&&o.enable(10),a.vertexColors&&o.enable(11),a.vertexAlphas&&o.enable(12),a.vertexUv1s&&o.enable(13),a.vertexUv2s&&o.enable(14),a.vertexUv3s&&o.enable(15),a.vertexTangents&&o.enable(16),a.anisotropy&&o.enable(17),a.alphaHash&&o.enable(18),a.batching&&o.enable(19),a.dispersion&&o.enable(20),a.batchingColor&&o.enable(21),r.push(o.mask),o.disableAll(),a.fog&&o.enable(0),a.useFog&&o.enable(1),a.flatShading&&o.enable(2),a.logarithmicDepthBuffer&&o.enable(3),a.skinning&&o.enable(4),a.morphTargets&&o.enable(5),a.morphNormals&&o.enable(6),a.morphColors&&o.enable(7),a.premultipliedAlpha&&o.enable(8),a.shadowMapEnabled&&o.enable(9),a.doubleSided&&o.enable(10),a.flipSided&&o.enable(11),a.useDepthPacking&&o.enable(12),a.dithering&&o.enable(13),a.transmission&&o.enable(14),a.sheen&&o.enable(15),a.opaque&&o.enable(16),a.pointsUvs&&o.enable(17),a.decodeVideoTexture&&o.enable(18),a.alphaToCoverage&&o.enable(19),r.push(o.mask),s.push(e.outputColorSpace)),s.push(t.customProgramCacheKey),s.join()},getUniforms:function(e){let t,i=f[e.type];return t=i?go(gL[i].uniforms):e.uniforms},acquireProgram:function(t,i){let n;for(let e=0,t=h.length;e<t;e++){let t=h[e];if(t.cacheKey===i){n=t,++n.usedTimes;break}}return void 0===n&&(n=new _c(e,i,t,a),h.push(n)),n},releaseProgram:function(e){if(0==--e.usedTimes){let t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function _f(){let e=new WeakMap;return{get:function(t){let i=e.get(t);return void 0===i&&(i={},e.set(t,i)),i},remove:function(t){e.delete(t)},update:function(t,i,n){e.get(t)[i]=n},dispose:function(){e=new WeakMap}}}function _m(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function _g(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function _v(){let e=[],t=0,i=[],n=[],r=[];function a(i,n,r,a,s,o){let l=e[t];return void 0===l?(l={id:i.id,object:i,geometry:n,material:r,groupOrder:a,renderOrder:i.renderOrder,z:s,group:o},e[t]=l):(l.id=i.id,l.object=i,l.geometry=n,l.material=r,l.groupOrder=a,l.renderOrder=i.renderOrder,l.z=s,l.group=o),t++,l}return{opaque:i,transmissive:n,transparent:r,init:function(){t=0,i.length=0,n.length=0,r.length=0},push:function(e,t,s,o,l,c){let h=a(e,t,s,o,l,c);s.transmission>0?n.push(h):!0===s.transparent?r.push(h):i.push(h)},unshift:function(e,t,s,o,l,c){let h=a(e,t,s,o,l,c);s.transmission>0?n.unshift(h):!0===s.transparent?r.unshift(h):i.unshift(h)},finish:function(){for(let i=t,n=e.length;i<n;i++){let t=e[i];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){i.length>1&&i.sort(e||_m),n.length>1&&n.sort(t||_g),r.length>1&&r.sort(t||_g)}}}function __(){let e=new WeakMap;return{get:function(t,i){let n,r=e.get(t);return void 0===r?(n=new _v,e.set(t,[n])):i>=r.length?(n=new _v,r.push(n)):n=r[i],n},dispose:function(){e=new WeakMap}}}function _x(){let e={};return{get:function(t){let i;if(void 0!==e[t.id])return e[t.id];switch(t.type){case"DirectionalLight":i={direction:new fb,color:new mI};break;case"SpotLight":i={position:new fb,direction:new fb,color:new mI,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new fb,color:new mI,distance:0,decay:0};break;case"HemisphereLight":i={direction:new fb,skyColor:new mI,groundColor:new mI};break;case"RectAreaLight":i={color:new mI,position:new fb,halfWidth:new fb,halfHeight:new fb}}return e[t.id]=i,i}}}let _y=0;function _M(e,t){return 2*!!t.castShadow-2*!!e.castShadow+ +!!t.map-!!e.map}function _S(e){let t,i=new _x,n=(t={},{get:function(e){let i;if(void 0!==t[e.id])return t[e.id];switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p7};break;case"PointLight":i={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new p7,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new fb);let a=new fb,s=new fQ,o=new fQ;return{setup:function(t){let a=0,s=0,o=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,f=0,m=0,g=0,v=0,_=0;t.sort(_M);for(let e=0,x=t.length;e<x;e++){let x=t[e],y=x.color,M=x.intensity,S=x.distance,b=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)a+=y.r*M,s+=y.g*M,o+=y.b*M;else if(x.isLightProbe){for(let e=0;e<9;e++)r.probe[e].addScaledVector(x.sh.coefficients[e],M);_++}else if(x.isDirectionalLight){let e=i.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),x.castShadow){let e=x.shadow,t=n.get(x);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,r.directionalShadow[l]=t,r.directionalShadowMap[l]=b,r.directionalShadowMatrix[l]=x.shadow.matrix,p++}r.directional[l]=e,l++}else if(x.isSpotLight){let e=i.get(x);e.position.setFromMatrixPosition(x.matrixWorld),e.color.copy(y).multiplyScalar(M),e.distance=S,e.coneCos=Math.cos(x.angle),e.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),e.decay=x.decay,r.spot[h]=e;let t=x.shadow;if(x.map&&(r.spotLightMap[g]=x.map,g++,t.updateMatrices(x),x.castShadow&&v++),r.spotLightMatrix[h]=t.matrix,x.castShadow){let e=n.get(x);e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,r.spotShadow[h]=e,r.spotShadowMap[h]=b,m++}h++}else if(x.isRectAreaLight){let e=i.get(x);e.color.copy(y).multiplyScalar(M),e.halfWidth.set(.5*x.width,0,0),e.halfHeight.set(0,.5*x.height,0),r.rectArea[u]=e,u++}else if(x.isPointLight){let e=i.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),e.distance=x.distance,e.decay=x.decay,x.castShadow){let e=x.shadow,t=n.get(x);t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,r.pointShadow[c]=t,r.pointShadowMap[c]=b,r.pointShadowMatrix[c]=x.shadow.matrix,f++}r.point[c]=e,c++}else if(x.isHemisphereLight){let e=i.get(x);e.skyColor.copy(x.color).multiplyScalar(M),e.groundColor.copy(x.groundColor).multiplyScalar(M),r.hemi[d]=e,d++}}u>0&&(!0===e.has("OES_texture_float_linear")?(r.rectAreaLTC1=gP.LTC_FLOAT_1,r.rectAreaLTC2=gP.LTC_FLOAT_2):(r.rectAreaLTC1=gP.LTC_HALF_1,r.rectAreaLTC2=gP.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=s,r.ambient[2]=o;let x=r.hash;(x.directionalLength!==l||x.pointLength!==c||x.spotLength!==h||x.rectAreaLength!==u||x.hemiLength!==d||x.numDirectionalShadows!==p||x.numPointShadows!==f||x.numSpotShadows!==m||x.numSpotMaps!==g||x.numLightProbes!==_)&&(r.directional.length=l,r.spot.length=h,r.rectArea.length=u,r.point.length=c,r.hemi.length=d,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=f,r.pointShadowMap.length=f,r.spotShadow.length=m,r.spotShadowMap.length=m,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=f,r.spotLightMatrix.length=m+g-v,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=v,r.numLightProbes=_,x.directionalLength=l,x.pointLength=c,x.spotLength=h,x.rectAreaLength=u,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=_,r.version=_y++)},setupView:function(e,t){let i=0,n=0,l=0,c=0,h=0,u=t.matrixWorldInverse;for(let t=0,d=e.length;t<d;t++){let d=e[t];if(d.isDirectionalLight){let e=r.directional[i];e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),i++}else if(d.isSpotLight){let e=r.spot[l];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),e.direction.setFromMatrixPosition(d.matrixWorld),a.setFromMatrixPosition(d.target.matrixWorld),e.direction.sub(a),e.direction.transformDirection(u),l++}else if(d.isRectAreaLight){let e=r.rectArea[c];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),e.halfWidth.set(.5*d.width,0,0),e.halfHeight.set(0,.5*d.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(d.isPointLight){let e=r.point[n];e.position.setFromMatrixPosition(d.matrixWorld),e.position.applyMatrix4(u),n++}else if(d.isHemisphereLight){let e=r.hemi[h];e.direction.setFromMatrixPosition(d.matrixWorld),e.direction.transformDirection(u),h++}}},state:r}}function _b(e){let t=new _S(e),i=[],n=[],r={lightsArray:i,shadowsArray:n,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,i.length=0,n.length=0},state:r,setupLights:function(){t.setup(i)},setupLightsView:function(e){t.setupView(i,e)},pushLight:function(e){i.push(e)},pushShadow:function(e){n.push(e)}}}function _E(e){let t=new WeakMap;return{get:function(i,n=0){let r,a=t.get(i);return void 0===a?(r=new _b(e),t.set(i,[r])):n>=a.length?(r=new _b(e),a.push(r)):r=a[n],r},dispose:function(){t=new WeakMap}}}class _T extends mU{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class _w extends mU{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function _A(e,t,i){let n=new gT,r=new p7,a=new p7,s=new f_,o=new _T({depthPacking:3201}),l=new _w,c={},h=i.maxTextureSize,u={0:1,1:0,2:2},d=new gh({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new p7},radius:{value:4}},vertexShader:"void main() {\n gl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;let f=new mZ;f.setAttribute("position",new mz(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let m=new gr(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let v=this.type;function _(t,i,n,r){let a=null,s=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===n.isPointLight?l:o,e.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0){let e=a.uuid,t=i.uuid,n=c[e];void 0===n&&(n={},c[e]=n);let r=n[t];void 0===r&&(r=a.clone(),n[t]=r,i.addEventListener("dispose",x)),a=r}return a.visible=i.visible,a.wireframe=i.wireframe,3===r?a.side=null!==i.shadowSide?i.shadowSide:i.side:a.side=null!==i.shadowSide?i.shadowSide:u[i.side],a.alphaMap=i.alphaMap,a.alphaTest=i.alphaTest,a.map=i.map,a.clipShadows=i.clipShadows,a.clippingPlanes=i.clippingPlanes,a.clipIntersection=i.clipIntersection,a.displacementMap=i.displacementMap,a.displacementScale=i.displacementScale,a.displacementBias=i.displacementBias,a.wireframeLinewidth=i.wireframeLinewidth,a.linewidth=i.linewidth,!0===n.isPointLight&&!0===a.isMeshDistanceMaterial&&(e.properties.get(a).light=n),a}function x(e){for(let t in e.target.removeEventListener("dispose",x),c){let i=c[t],n=e.target.uuid;n in i&&(i[n].dispose(),delete i[n])}}this.render=function(i,o,l){if(!1===g.enabled||!1===g.autoUpdate&&!1===g.needsUpdate||0===i.length)return;let c=e.getRenderTarget(),u=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),x=e.state;x.setBlending(0),x.buffers.color.setClear(1,1,1,1),x.buffers.depth.setTest(!0),x.setScissorTest(!1);let y=3!==v&&3===this.type,M=3===v&&3!==this.type;for(let c=0,u=i.length;c<u;c++){let u=i[c],f=u.shadow;if(void 0===f){console.warn("THREE.WebGLShadowMap:",u,"has no shadow.");continue}if(!1===f.autoUpdate&&!1===f.needsUpdate)continue;r.copy(f.mapSize);let g=f.getFrameExtents();if(r.multiply(g),a.copy(f.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(a.x=Math.floor(h/g.x),r.x=a.x*g.x,f.mapSize.x=a.x),r.y>h&&(a.y=Math.floor(h/g.y),r.y=a.y*g.y,f.mapSize.y=a.y)),null===f.map||!0===y||!0===M){let e=3!==this.type?{minFilter:1003,magFilter:1003}:{};null!==f.map&&f.map.dispose(),f.map=new fy(r.x,r.y,e),f.map.texture.name=u.name+".shadowMap",f.camera.updateProjectionMatrix()}e.setRenderTarget(f.map),e.clear();let v=f.getViewportCount();for(let i=0;i<v;i++){let r=f.getViewport(i);s.set(a.x*r.x,a.y*r.y,a.x*r.z,a.y*r.w),x.viewport(s),f.updateMatrices(u,i),n=f.getFrustum(),function i(r,a,s,o,l){if(!1===r.visible)return;if(r.layers.test(a.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===l)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,r.matrixWorld);let i=t.update(r),n=r.material;if(Array.isArray(n)){let t=i.groups;for(let c=0,h=t.length;c<h;c++){let h=t[c],u=n[h.materialIndex];if(u&&u.visible){let t=_(r,u,o,l);r.onBeforeShadow(e,r,a,s,i,t,h),e.renderBufferDirect(s,null,i,t,r,h),r.onAfterShadow(e,r,a,s,i,t,h)}}}else if(n.visible){let t=_(r,n,o,l);r.onBeforeShadow(e,r,a,s,i,t,null),e.renderBufferDirect(s,null,i,t,r,null),r.onAfterShadow(e,r,a,s,i,t,null)}}let c=r.children;for(let e=0,t=c.length;e<t;e++)i(c[e],a,s,o,l)}(o,l,f.camera,u,this.type)}!0!==f.isPointLightShadow&&3===this.type&&function(i,n){let a=t.update(m);d.defines.VSM_SAMPLES!==i.blurSamples&&(d.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new fy(r.x,r.y)),d.uniforms.shadow_pass.value=i.map.texture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,e.setRenderTarget(i.mapPass),e.clear(),e.renderBufferDirect(n,null,a,d,m,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,e.setRenderTarget(i.map),e.clear(),e.renderBufferDirect(n,null,a,p,m,null)}(f,l),f.needsUpdate=!1}v=this.type,g.needsUpdate=!1,e.setRenderTarget(c,u,f)}}function _R(e){let t=new function(){let t=!1,i=new f_,n=null,r=new f_(0,0,0,0);return{setMask:function(i){n===i||t||(e.colorMask(i,i,i,i),n=i)},setLocked:function(e){t=e},setClear:function(t,n,a,s,o){!0===o&&(t*=s,n*=s,a*=s),i.set(t,n,a,s),!1===r.equals(i)&&(e.clearColor(t,n,a,s),r.copy(i))},reset:function(){t=!1,n=null,r.set(-1,0,0,0)}}},i=new function(){let t=!1,i=null,n=null,r=null;return{setTest:function(t){t?B(e.DEPTH_TEST):z(e.DEPTH_TEST)},setMask:function(n){i===n||t||(e.depthMask(n),i=n)},setFunc:function(t){if(n!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}n=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,i=null,n=null,r=null}}},n=new function(){let t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,c=null;return{setTest:function(i){t||(i?B(e.STENCIL_TEST):z(e.STENCIL_TEST))},setMask:function(n){i===n||t||(e.stencilMask(n),i=n)},setFunc:function(t,i,s){(n!==t||r!==i||a!==s)&&(e.stencilFunc(t,i,s),n=t,r=i,a=s)},setOp:function(t,i,n){(s!==t||o!==i||l!==n)&&(e.stencilOp(t,i,n),s=t,o=i,l=n)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,i=null,n=null,r=null,a=null,s=null,o=null,l=null,c=null}}},r=new WeakMap,a=new WeakMap,s={},o={},l=new WeakMap,c=[],h=null,u=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,x=new mI(0,0,0),y=0,M=!1,S=null,b=null,E=null,T=null,w=null,A=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),R=!1,C=e.getParameter(e.VERSION);-1!==C.indexOf("WebGL")?R=parseFloat(/^WebGL (\d)/.exec(C)[1])>=1:-1!==C.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL ES (\d)/.exec(C)[1])>=2);let P=null,L={},I=e.getParameter(e.SCISSOR_BOX),N=e.getParameter(e.VIEWPORT),D=new f_().fromArray(I),U=new f_().fromArray(N);function O(t,i,n,r){let a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let s=0;s<n;s++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(i,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,a):e.texImage2D(i+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,a);return s}let F={};function B(t){!0!==s[t]&&(e.enable(t),s[t]=!0)}function z(t){!1!==s[t]&&(e.disable(t),s[t]=!1)}F[e.TEXTURE_2D]=O(e.TEXTURE_2D,e.TEXTURE_2D,1),F[e.TEXTURE_CUBE_MAP]=O(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),F[e.TEXTURE_2D_ARRAY]=O(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),F[e.TEXTURE_3D]=O(e.TEXTURE_3D,e.TEXTURE_3D,1,1),t.setClear(0,0,0,1),i.setClear(1),n.setClear(0),B(e.DEPTH_TEST),i.setFunc(3),G(!1),W(1),B(e.CULL_FACE),H(0);let k={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};k[103]=e.MIN,k[104]=e.MAX;let V={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function H(t,i,n,r,a,s,o,l,c,h){if(0===t){!0===u&&(z(e.BLEND),u=!1);return}if(!1===u&&(B(e.BLEND),u=!0),5!==t){if(t!==d||h!==M){if((100!==p||100!==g)&&(e.blendEquation(e.FUNC_ADD),p=100,g=100),h)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}f=null,m=null,v=null,_=null,x.set(0,0,0),y=0,d=t,M=h}return}a=a||i,s=s||n,o=o||r,(i!==p||a!==g)&&(e.blendEquationSeparate(k[i],k[a]),p=i,g=a),(n!==f||r!==m||s!==v||o!==_)&&(e.blendFuncSeparate(V[n],V[r],V[s],V[o]),f=n,m=r,v=s,_=o),(!1===l.equals(x)||c!==y)&&(e.blendColor(l.r,l.g,l.b,c),x.copy(l),y=c),d=t,M=!1}function G(t){S!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),S=t)}function W(t){0!==t?(B(e.CULL_FACE),t!==b&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):z(e.CULL_FACE),b=t}function j(t,i,n){t?(B(e.POLYGON_OFFSET_FILL),(T!==i||w!==n)&&(e.polygonOffset(i,n),T=i,w=n)):z(e.POLYGON_OFFSET_FILL)}return{buffers:{color:t,depth:i,stencil:n},enable:B,disable:z,bindFramebuffer:function(t,i){return o[t]!==i&&(e.bindFramebuffer(t,i),o[t]=i,t===e.DRAW_FRAMEBUFFER&&(o[e.FRAMEBUFFER]=i),t===e.FRAMEBUFFER&&(o[e.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(t,i){let n=c,r=!1;if(t){void 0===(n=l.get(i))&&(n=[],l.set(i,n));let a=t.textures;if(n.length!==a.length||n[0]!==e.COLOR_ATTACHMENT0){for(let t=0,i=a.length;t<i;t++)n[t]=e.COLOR_ATTACHMENT0+t;n.length=a.length,r=!0}}else n[0]!==e.BACK&&(n[0]=e.BACK,r=!0);r&&e.drawBuffers(n)},useProgram:function(t){return h!==t&&(e.useProgram(t),h=t,!0)},setBlending:H,setMaterial:function(r,a){2===r.side?z(e.CULL_FACE):B(e.CULL_FACE);let s=1===r.side;a&&(s=!s),G(s),1===r.blending&&!1===r.transparent?H(0):H(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),i.setFunc(r.depthFunc),i.setTest(r.depthTest),i.setMask(r.depthWrite),t.setMask(r.colorWrite);let o=r.stencilWrite;n.setTest(o),o&&(n.setMask(r.stencilWriteMask),n.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),n.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),j(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?B(e.SAMPLE_ALPHA_TO_COVERAGE):z(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:G,setCullFace:W,setLineWidth:function(t){t!==E&&(R&&e.lineWidth(t),E=t)},setPolygonOffset:j,setScissorTest:function(t){t?B(e.SCISSOR_TEST):z(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+A-1),P!==t&&(e.activeTexture(t),P=t)},bindTexture:function(t,i,n){void 0===n&&(n=null===P?e.TEXTURE0+A-1:P);let r=L[n];void 0===r&&(r={type:void 0,texture:void 0},L[n]=r),(r.type!==t||r.texture!==i)&&(P!==n&&(e.activeTexture(n),P=n),e.bindTexture(t,i||F[t]),r.type=t,r.texture=i)},unbindTexture:function(){let t=L[P];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,i){let n=a.get(i);void 0===n&&(n=new WeakMap,a.set(i,n));let r=n.get(t);void 0===r&&(r=e.getUniformBlockIndex(i,t.name),n.set(t,r))},uniformBlockBinding:function(t,i){let n=a.get(i).get(t);r.get(i)!==n&&(e.uniformBlockBinding(i,n,t.__bindingPointIndex),r.set(i,n))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===D.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),D.copy(t))},viewport:function(t){!1===U.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),U.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(0xffffffff),e.stencilFunc(e.ALWAYS,0,0xffffffff),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),s={},P=null,L={},o={},l=new WeakMap,c=[],h=null,u=!1,d=null,p=null,f=null,m=null,g=null,v=null,_=null,x=new mI(0,0,0),y=0,M=!1,S=null,b=null,E=null,T=null,w=null,D.set(0,0,e.canvas.width,e.canvas.height),U.set(0,0,e.canvas.width,e.canvas.height),t.reset(),i.reset(),n.reset()}}}function _C(e,t,i,n,r,a,s){let o,l=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,c="u">typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),h=new p7,u=new WeakMap,d=new WeakMap,p=!1;try{p="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function f(e,t){return p?new OffscreenCanvas(e,t):fi("canvas")}function m(e,t,i){let n=1,r=k(e);if((r.width>i||r.height>i)&&(n=i/Math.max(r.width,r.height)),n<1)if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof VideoFrame&&e instanceof VideoFrame){let i=Math.floor(n*r.width),a=Math.floor(n*r.height);void 0===o&&(o=f(i,a));let s=t?f(i,a):o;return s.width=i,s.height=a,s.getContext("2d").drawImage(e,0,0,i,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+i+"x"+a+")."),s}else"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+").");return e}function g(e){return e.generateMipmaps&&1003!==e.minFilter&&1006!==e.minFilter}function v(t){e.generateMipmap(t)}function _(i,n,r,a,s=!1){if(null!==i){if(void 0!==e[i])return e[i];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===e.RED&&(r===e.FLOAT&&(o=e.R32F),r===e.HALF_FLOAT&&(o=e.R16F),r===e.UNSIGNED_BYTE&&(o=e.R8)),n===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.R8UI),r===e.UNSIGNED_SHORT&&(o=e.R16UI),r===e.UNSIGNED_INT&&(o=e.R32UI),r===e.BYTE&&(o=e.R8I),r===e.SHORT&&(o=e.R16I),r===e.INT&&(o=e.R32I)),n===e.RG&&(r===e.FLOAT&&(o=e.RG32F),r===e.HALF_FLOAT&&(o=e.RG16F),r===e.UNSIGNED_BYTE&&(o=e.RG8)),n===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(o=e.RG8UI),r===e.UNSIGNED_SHORT&&(o=e.RG16UI),r===e.UNSIGNED_INT&&(o=e.RG32UI),r===e.BYTE&&(o=e.RG8I),r===e.SHORT&&(o=e.RG16I),r===e.INT&&(o=e.RG32I)),n===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(o=e.RGB9_E5),n===e.RGBA){let t=s?pZ:fc.getTransfer(a);r===e.FLOAT&&(o=e.RGBA32F),r===e.HALF_FLOAT&&(o=e.RGBA16F),r===e.UNSIGNED_BYTE&&(o=t===p$?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(o=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(o=e.RGB5_A1)}return(o===e.R16F||o===e.R32F||o===e.RG16F||o===e.RG32F||o===e.RGBA16F||o===e.RGBA32F)&&t.get("EXT_color_buffer_float"),o}function x(t,i){let n;return t?null===i||1014===i||1020===i?n=e.DEPTH24_STENCIL8:1015===i?n=e.DEPTH32F_STENCIL8:1012===i&&(n=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||1014===i||1020===i?n=e.DEPTH_COMPONENT24:1015===i?n=e.DEPTH_COMPONENT32F:1012===i&&(n=e.DEPTH_COMPONENT16),n}function y(e,t){return!0===g(e)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function M(e){let t=e.target;t.removeEventListener("dispose",M),function(e){let t=n.get(e);if(void 0===t.__webglInit)return;let i=e.source,r=d.get(i);if(r){let n=r[t.__cacheKey];n.usedTimes--,0===n.usedTimes&&b(e),0===Object.keys(r).length&&d.delete(i)}n.remove(e)}(t),t.isVideoTexture&&u.delete(t)}function S(t){let i=t.target;i.removeEventListener("dispose",S),function(t){let i=n.get(t);if(t.depthTexture&&t.depthTexture.dispose(),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(i.__webglFramebuffer[t]))for(let n=0;n<i.__webglFramebuffer[t].length;n++)e.deleteFramebuffer(i.__webglFramebuffer[t][n]);else e.deleteFramebuffer(i.__webglFramebuffer[t]);i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer[t])}else{if(Array.isArray(i.__webglFramebuffer))for(let t=0;t<i.__webglFramebuffer.length;t++)e.deleteFramebuffer(i.__webglFramebuffer[t]);else e.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&e.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&e.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let t=0;t<i.__webglColorRenderbuffer.length;t++)i.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(i.__webglColorRenderbuffer[t]);i.__webglDepthRenderbuffer&&e.deleteRenderbuffer(i.__webglDepthRenderbuffer)}let r=t.textures;for(let t=0,i=r.length;t<i;t++){let i=n.get(r[t]);i.__webglTexture&&(e.deleteTexture(i.__webglTexture),s.memory.textures--),n.remove(r[t])}n.remove(t)}(i)}function b(t){let i=n.get(t);e.deleteTexture(i.__webglTexture);let r=t.source,a=d.get(r);delete a[i.__cacheKey],s.memory.textures--}let E=0;function T(t,r){var a;let o,l=n.get(t);if(t.isVideoTexture&&(a=t,o=s.render.frame,u.get(a)!==o&&(u.set(a,o),a.update())),!1===t.isRenderTargetTexture&&t.version>0&&l.__version!==t.version){let e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void L(l,t,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+r)}let w={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},A={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},R={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function C(i,a){if((1015===a.type&&!1===t.has("OES_texture_float_linear")&&(1006===a.magFilter||1007===a.magFilter||1005===a.magFilter||1008===a.magFilter||1006===a.minFilter||1007===a.minFilter||1005===a.minFilter||1008===a.minFilter)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(i,e.TEXTURE_WRAP_S,w[a.wrapS]),e.texParameteri(i,e.TEXTURE_WRAP_T,w[a.wrapT]),(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY)&&e.texParameteri(i,e.TEXTURE_WRAP_R,w[a.wrapR]),e.texParameteri(i,e.TEXTURE_MAG_FILTER,A[a.magFilter]),e.texParameteri(i,e.TEXTURE_MIN_FILTER,A[a.minFilter]),a.compareFunction&&(e.texParameteri(i,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(i,e.TEXTURE_COMPARE_FUNC,R[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic"))&&1003!==a.magFilter&&(1005===a.minFilter||1008===a.minFilter)&&(1015!==a.type||!1!==t.has("OES_texture_float_linear"))&&(a.anisotropy>1||n.get(a).__currentAnisotropy)){let s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(i,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),n.get(a).__currentAnisotropy=a.anisotropy}}function P(t,i){let n,r=!1;void 0===t.__webglInit&&(t.__webglInit=!0,i.addEventListener("dispose",M));let a=i.source,o=d.get(a);void 0===o&&(o={},d.set(a,o));let l=((n=[]).push(i.wrapS),n.push(i.wrapT),n.push(i.wrapR||0),n.push(i.magFilter),n.push(i.minFilter),n.push(i.anisotropy),n.push(i.internalFormat),n.push(i.format),n.push(i.type),n.push(i.generateMipmaps),n.push(i.premultiplyAlpha),n.push(i.flipY),n.push(i.unpackAlignment),n.push(i.colorSpace),n.join());if(l!==t.__cacheKey){void 0===o[l]&&(o[l]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,r=!0),o[l].usedTimes++;let n=o[t.__cacheKey];void 0!==n&&(o[t.__cacheKey].usedTimes--,0===n.usedTimes&&b(i)),t.__cacheKey=l,t.__webglTexture=o[l].texture}return r}function L(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);let c=P(t,s),h=s.source;i.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);let u=n.get(h);if(h.version!==u.__version||!0===c){let t;i.activeTexture(e.TEXTURE0+o);let n=fc.getPrimaries(fc.workingColorSpace),d=""===s.colorSpace?null:fc.getPrimaries(s.colorSpace),p=""===s.colorSpace||n===d?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);let f=m(s.image,!1,r.maxTextureSize);f=z(s,f);let M=a.convert(s.format,s.colorSpace),S=a.convert(s.type),b=_(s.internalFormat,M,S,s.colorSpace,s.isVideoTexture);C(l,s);let E=s.mipmaps,T=!0!==s.isVideoTexture,w=void 0===u.__version||!0===c,A=h.dataReady,R=y(s,f);if(s.isDepthTexture)b=x(1027===s.format,s.type),w&&(T?i.texStorage2D(e.TEXTURE_2D,1,b,f.width,f.height):i.texImage2D(e.TEXTURE_2D,0,b,f.width,f.height,0,M,S,null));else if(s.isDataTexture)if(E.length>0){T&&w&&i.texStorage2D(e.TEXTURE_2D,R,b,E[0].width,E[0].height);for(let n=0,r=E.length;n<r;n++)t=E[n],T?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,S,t.data):i.texImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,M,S,t.data);s.generateMipmaps=!1}else T?(w&&i.texStorage2D(e.TEXTURE_2D,R,b,f.width,f.height),A&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,f.width,f.height,M,S,f.data)):i.texImage2D(e.TEXTURE_2D,0,b,f.width,f.height,0,M,S,f.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){T&&w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,R,b,E[0].width,E[0].height,f.depth);for(let n=0,r=E.length;n<r;n++)if(t=E[n],1023!==s.format)if(null!==M)if(T){if(A)if(s.layerUpdates.size>0){for(let r of s.layerUpdates){let a=t.width*t.height;i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,r,t.width,t.height,1,M,t.data.slice(a*r,a*(r+1)),0,0)}s.clearLayerUpdates()}else i.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,f.depth,M,t.data,0,0)}else i.compressedTexImage3D(e.TEXTURE_2D_ARRAY,n,b,t.width,t.height,f.depth,0,t.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?A&&i.texSubImage3D(e.TEXTURE_2D_ARRAY,n,0,0,0,t.width,t.height,f.depth,M,S,t.data):i.texImage3D(e.TEXTURE_2D_ARRAY,n,b,t.width,t.height,f.depth,0,M,S,t.data)}else{T&&w&&i.texStorage2D(e.TEXTURE_2D,R,b,E[0].width,E[0].height);for(let n=0,r=E.length;n<r;n++)t=E[n],1023!==s.format?null!==M?T?A&&i.compressedTexSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,t.data):i.compressedTexImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,t.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,t.width,t.height,M,S,t.data):i.texImage2D(e.TEXTURE_2D,n,b,t.width,t.height,0,M,S,t.data)}else if(s.isDataArrayTexture)if(T){if(w&&i.texStorage3D(e.TEXTURE_2D_ARRAY,R,b,f.width,f.height,f.depth),A)if(s.layerUpdates.size>0){let t;switch(S){case e.UNSIGNED_BYTE:switch(M){case e.ALPHA:case e.LUMINANCE:t=1;break;case e.LUMINANCE_ALPHA:t=2;break;case e.RGB:t=3;break;case e.RGBA:t=4;break;default:throw Error(`Unknown texel size for format ${M}.`)}break;case e.UNSIGNED_SHORT_4_4_4_4:case e.UNSIGNED_SHORT_5_5_5_1:case e.UNSIGNED_SHORT_5_6_5:t=1;break;default:throw Error(`Unknown texel size for type ${S}.`)}let n=f.width*f.height*t;for(let t of s.layerUpdates)i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,t,f.width,f.height,1,M,S,f.data.slice(n*t,n*(t+1)));s.clearLayerUpdates()}else i.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,f.width,f.height,f.depth,M,S,f.data)}else i.texImage3D(e.TEXTURE_2D_ARRAY,0,b,f.width,f.height,f.depth,0,M,S,f.data);else if(s.isData3DTexture)T?(w&&i.texStorage3D(e.TEXTURE_3D,R,b,f.width,f.height,f.depth),A&&i.texSubImage3D(e.TEXTURE_3D,0,0,0,0,f.width,f.height,f.depth,M,S,f.data)):i.texImage3D(e.TEXTURE_3D,0,b,f.width,f.height,f.depth,0,M,S,f.data);else if(s.isFramebufferTexture){if(w)if(T)i.texStorage2D(e.TEXTURE_2D,R,b,f.width,f.height);else{let t=f.width,n=f.height;for(let r=0;r<R;r++)i.texImage2D(e.TEXTURE_2D,r,b,t,n,0,M,S,null),t>>=1,n>>=1}}else if(E.length>0){if(T&&w){let t=k(E[0]);i.texStorage2D(e.TEXTURE_2D,R,b,t.width,t.height)}for(let n=0,r=E.length;n<r;n++)t=E[n],T?A&&i.texSubImage2D(e.TEXTURE_2D,n,0,0,M,S,t):i.texImage2D(e.TEXTURE_2D,n,b,M,S,t);s.generateMipmaps=!1}else if(T){if(w){let t=k(f);i.texStorage2D(e.TEXTURE_2D,R,b,t.width,t.height)}A&&i.texSubImage2D(e.TEXTURE_2D,0,0,0,M,S,f)}else i.texImage2D(e.TEXTURE_2D,0,b,M,S,f);g(s)&&v(l),u.__version=h.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}function I(t,r,s,o,c,h){let u=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=_(s.internalFormat,u,d,s.colorSpace);if(!n.get(r).__hasExternalTextures){let t=Math.max(1,r.width>>h),n=Math.max(1,r.height>>h);c===e.TEXTURE_3D||c===e.TEXTURE_2D_ARRAY?i.texImage3D(c,h,p,t,n,r.depth,0,u,d,null):i.texImage2D(c,h,p,t,n,0,u,d,null)}i.bindFramebuffer(e.FRAMEBUFFER,t),B(r)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,o,c,n.get(s).__webglTexture,0,F(r)):(c===e.TEXTURE_2D||c>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,o,c,n.get(s).__webglTexture,h),i.bindFramebuffer(e.FRAMEBUFFER,null)}function N(t,i,n){if(e.bindRenderbuffer(e.RENDERBUFFER,t),i.depthBuffer){let r=i.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(i.stencilBuffer,a),o=i.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=F(i);B(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,s,i.width,i.height):n?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,s,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,s,i.width,i.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,o,e.RENDERBUFFER,t)}else{let t=i.textures;for(let r=0;r<t.length;r++){let s=t[r],o=a.convert(s.format,s.colorSpace),c=a.convert(s.type),h=_(s.internalFormat,o,c,s.colorSpace),u=F(i);n&&!1===B(i)?e.renderbufferStorageMultisample(e.RENDERBUFFER,u,h,i.width,i.height):B(i)?l.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,u,h,i.width,i.height):e.renderbufferStorage(e.RENDERBUFFER,h,i.width,i.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function D(t){let r=n.get(t),a=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw Error("target.depthTexture not supported in Cube render targets");var s=r.__webglFramebuffer;if(t&&t.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(e.FRAMEBUFFER,s),!(t.depthTexture&&t.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(t.depthTexture).__webglTexture&&t.depthTexture.image.width===t.width&&t.depthTexture.image.height===t.height||(t.depthTexture.image.width=t.width,t.depthTexture.image.height=t.height,t.depthTexture.needsUpdate=!0),T(t.depthTexture,0);let o=n.get(t.depthTexture).__webglTexture,c=F(t);if(1026===t.depthTexture.format)B(t)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0);else if(1027===t.depthTexture.format)B(t)?l.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0);else throw Error("Unknown depthTexture format")}else if(a){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[n]),r.__webglDepthbuffer[n]=e.createRenderbuffer(),N(r.__webglDepthbuffer[n],t,!1)}else i.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),r.__webglDepthbuffer=e.createRenderbuffer(),N(r.__webglDepthbuffer,t,!1);i.bindFramebuffer(e.FRAMEBUFFER,null)}let U=[],O=[];function F(e){return Math.min(r.maxSamples,e.samples)}function B(e){let i=n.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function z(e,t){let i=e.colorSpace,n=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||i!==pq&&""!==i&&(fc.getTransfer(i)===p$?(1023!==n||1009!==r)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),t}function k(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement?(h.width=e.naturalWidth||e.width,h.height=e.naturalHeight||e.height):"u">typeof VideoFrame&&e instanceof VideoFrame?(h.width=e.displayWidth,h.height=e.displayHeight):(h.width=e.width,h.height=e.height),h}this.allocateTextureUnit=function(){let e=E;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),E+=1,e},this.resetTextureUnits=function(){E=0},this.setTexture2D=T,this.setTexture2DArray=function(t,r){let a=n.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):i.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r)},this.setTexture3D=function(t,r){let a=n.get(t);t.version>0&&a.__version!==t.version?L(a,t,r):i.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){let o=n.get(t);t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;let l=P(t,s),c=s.source;i.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);let h=n.get(c);if(c.version!==h.__version||!0===l){let t;i.activeTexture(e.TEXTURE0+o);let n=fc.getPrimaries(fc.workingColorSpace),u=""===s.colorSpace?null:fc.getPrimaries(s.colorSpace),d=""===s.colorSpace||n===u?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=s.isCompressedTexture||s.image[0].isCompressedTexture,f=s.image[0]&&s.image[0].isDataTexture,x=[];for(let e=0;e<6;e++)p||f?x[e]=f?s.image[e].image:s.image[e]:x[e]=m(s.image[e],!0,r.maxCubemapSize),x[e]=z(s,x[e]);let M=x[0],S=a.convert(s.format,s.colorSpace),b=a.convert(s.type),E=_(s.internalFormat,S,b,s.colorSpace),T=!0!==s.isVideoTexture,w=void 0===h.__version||!0===l,A=c.dataReady,R=y(s,M);if(C(e.TEXTURE_CUBE_MAP,s),p){T&&w&&i.texStorage2D(e.TEXTURE_CUBE_MAP,R,E,M.width,M.height);for(let n=0;n<6;n++){t=x[n].mipmaps;for(let r=0;r<t.length;r++){let a=t[r];1023!==s.format?null!==S?T?A&&i.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,S,a.data):i.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,E,a.width,a.height,0,a.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,0,0,a.width,a.height,S,b,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r,E,a.width,a.height,0,S,b,a.data)}}}else{if(t=s.mipmaps,T&&w){t.length>0&&R++;let n=k(x[0]);i.texStorage2D(e.TEXTURE_CUBE_MAP,R,E,n.width,n.height)}for(let n=0;n<6;n++)if(f){T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,x[n].width,x[n].height,S,b,x[n].data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,E,x[n].width,x[n].height,0,S,b,x[n].data);for(let r=0;r<t.length;r++){let a=t[r].image[n].image;T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,a.width,a.height,S,b,a.data):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,E,a.width,a.height,0,S,b,a.data)}}else{T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,S,b,x[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,E,S,b,x[n]);for(let r=0;r<t.length;r++){let a=t[r];T?A&&i.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,0,0,S,b,a.image[n]):i.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+n,r+1,E,S,b,a.image[n])}}}g(s)&&v(e.TEXTURE_CUBE_MAP),h.__version=c.version,s.onUpdate&&s.onUpdate(s)}t.__version=s.version}(o,t,s):i.bindTexture(e.TEXTURE_CUBE_MAP,o.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function(t,i,r){let a=n.get(t);void 0!==i&&I(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&D(t)},this.setupRenderTarget=function(t){let r=t.texture,o=n.get(t),l=n.get(r);t.addEventListener("dispose",S);let c=t.textures,h=!0===t.isWebGLCubeRenderTarget,u=c.length>1;if(!u&&(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),h){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let i=0;i<r.mipmaps.length;i++)o.__webglFramebuffer[t][i]=e.createFramebuffer()}else o.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)o.__webglFramebuffer[t]=e.createFramebuffer()}else o.__webglFramebuffer=e.createFramebuffer();if(u)for(let t=0,i=c.length;t<i;t++){let i=n.get(c[t]);void 0===i.__webglTexture&&(i.__webglTexture=e.createTexture(),s.memory.textures++)}if(t.samples>0&&!1===B(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<c.length;i++){let n=c[i];o.__webglColorRenderbuffer[i]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,o.__webglColorRenderbuffer[i]);let r=a.convert(n.format,n.colorSpace),s=a.convert(n.type),l=_(n.internalFormat,r,s,n.colorSpace,!0===t.isXRRenderTarget),h=F(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+i,e.RENDERBUFFER,o.__webglColorRenderbuffer[i])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(o.__webglDepthRenderbuffer=e.createRenderbuffer(),N(o.__webglDepthRenderbuffer,t,!0)),i.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){i.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),C(e.TEXTURE_CUBE_MAP,r);for(let i=0;i<6;i++)if(r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)I(o.__webglFramebuffer[i][n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else I(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);g(r)&&v(e.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let r=0,a=c.length;r<a;r++){let a=c[r],s=n.get(a);i.bindTexture(e.TEXTURE_2D,s.__webglTexture),C(e.TEXTURE_2D,a),I(o.__webglFramebuffer,t,a,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),g(a)&&v(e.TEXTURE_2D)}i.unbindTexture()}else{let n=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(n=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),C(n,r),r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)I(o.__webglFramebuffer[i],t,r,e.COLOR_ATTACHMENT0,n,i);else I(o.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,n,0);g(r)&&v(n),i.unbindTexture()}t.depthBuffer&&D(t)},this.updateRenderTargetMipmap=function(t){let r=t.textures;for(let a=0,s=r.length;a<s;a++){let s=r[a];if(g(s)){let r=t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,a=n.get(s).__webglTexture;i.bindTexture(r,a),v(r),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0){if(!1===B(t)){let r=t.textures,a=t.width,s=t.height,o=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=n.get(t),u=r.length>1;if(u)for(let t=0;t<r.length;t++)i.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),i.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);i.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<r.length;i++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(o|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(o|=e.STENCIL_BUFFER_BIT)),u){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[i]);let t=n.get(r[i]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,a,s,0,0,a,s,o,e.NEAREST),!0===c&&(U.length=0,O.length=0,U.push(e.COLOR_ATTACHMENT0+i),t.depthBuffer&&!1===t.resolveDepthBuffer&&(U.push(l),O.push(l),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,O)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,U))}if(i.bindFramebuffer(e.READ_FRAMEBUFFER,null),i.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),u)for(let t=0;t<r.length;t++){i.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);let a=n.get(r[t]).__webglTexture;i.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,a,0)}i.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&c){let i=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[i])}}},this.setupDepthRenderbuffer=D,this.setupFrameBufferTexture=I,this.useMultisampledRTT=B}function _P(e,t){return{convert:function(i,n=""){let r,a=fc.getTransfer(n);if(1009===i)return e.UNSIGNED_BYTE;if(1017===i)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===i)return e.UNSIGNED_SHORT_5_5_5_1;if(35902===i)return e.UNSIGNED_INT_5_9_9_9_REV;if(1010===i)return e.BYTE;if(1011===i)return e.SHORT;if(1012===i)return e.UNSIGNED_SHORT;if(1013===i)return e.INT;if(1014===i)return e.UNSIGNED_INT;if(1015===i)return e.FLOAT;if(1016===i)return e.HALF_FLOAT;if(1021===i)return e.ALPHA;if(1022===i)return e.RGB;if(1023===i)return e.RGBA;if(1024===i)return e.LUMINANCE;if(1025===i)return e.LUMINANCE_ALPHA;if(1026===i)return e.DEPTH_COMPONENT;if(1027===i)return e.DEPTH_STENCIL;if(1028===i)return e.RED;if(1029===i)return e.RED_INTEGER;if(1030===i)return e.RG;if(1031===i)return e.RG_INTEGER;if(1033===i)return e.RGBA_INTEGER;if(33776===i||33777===i||33778===i||33779===i)if(a===p$){if(null===(r=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===i)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===i)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(r=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===i)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===i)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===i)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===i)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(35840===i||35841===i||35842===i||35843===i){if(null===(r=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===i)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===i)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===i)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===i)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===i||37492===i||37496===i){if(null===(r=t.get("WEBGL_compressed_texture_etc")))return null;if(36196===i||37492===i)return a===p$?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(37496===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(37808===i||37809===i||37810===i||37811===i||37812===i||37813===i||37814===i||37815===i||37816===i||37817===i||37818===i||37819===i||37820===i||37821===i){if(null===(r=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===i)return a===p$?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===i||36494===i||36495===i){if(null===(r=t.get("EXT_texture_compression_bptc")))return null;if(36492===i)return a===p$?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===i)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===i)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===i||36284===i||36285===i||36286===i){if(null===(r=t.get("EXT_texture_compression_rgtc")))return null;if(36492===i)return r.COMPRESSED_RED_RGTC1_EXT;if(36284===i)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===i)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===i)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===i?e.UNSIGNED_INT_24_8:void 0!==e[i]?e[i]:null}}}class _L extends gm{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class _I extends mg{constructor(){super(),this.isGroup=!0,this.type="Group"}}let _N={type:"move"};class _D{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new _I,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new _I,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new fb,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new fb),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new _I,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new fb,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new fb),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let 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}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,i){let n=null,r=null,a=null,s=this._targetRay,o=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){for(let n of(a=!0,e.hand.values())){let e=t.getJointPose(n,i),r=this._getHandJoint(l,n);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}let n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=n.position.distanceTo(r.position);l.inputState.pinching&&s>.025?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=.015&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&null!==(r=t.getPose(e.gripSpace,i))&&(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);null!==s&&(null===(n=t.getPose(e.targetRaySpace,i))&&null!==r&&(n=r),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(_N)))}return null!==s&&(s.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let i=new _I;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}let _U=`
825
+ void main() {
826
+
827
+ gl_Position = vec4( position, 1.0 );
828
+
829
+ }`,_O=`
830
+ uniform sampler2DArray depthColor;
831
+ uniform float depthWidth;
832
+ uniform float depthHeight;
833
+
834
+ void main() {
835
+
836
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
837
+
838
+ if ( coord.x >= 1.0 ) {
839
+
840
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
841
+
842
+ } else {
843
+
844
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
845
+
846
+ }
847
+
848
+ }`;class _F{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(null===this.texture){let n=new fv;e.properties.get(n).__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){let t=e.cameras[0].viewport,i=new gh({vertexShader:_U,fragmentShader:_O,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new gr(new gR(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}}class _B extends p0{constructor(e,t){super();const i=this;let n=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,p=null;const f=new _F,m=t.getContextAttributes();let g=null,v=null;const _=[],x=[],y=new p7;let M=null;const S=new gm;S.layers.enable(1),S.viewport=new f_;const b=new gm;b.layers.enable(2),b.viewport=new f_;const E=[S,b],T=new _L;T.layers.enable(1),T.layers.enable(2);let w=null,A=null;function R(e){let t=x.indexOf(e.inputSource);if(-1===t)return;let i=_[t];void 0!==i&&(i.update(e.inputSource,e.frame,l||a),i.dispatchEvent({type:e.type,data:e.inputSource}))}function C(){n.removeEventListener("select",R),n.removeEventListener("selectstart",R),n.removeEventListener("selectend",R),n.removeEventListener("squeeze",R),n.removeEventListener("squeezestart",R),n.removeEventListener("squeezeend",R),n.removeEventListener("end",C),n.removeEventListener("inputsourceschange",P);for(let e=0;e<_.length;e++){let t=x[e];null!==t&&(x[e]=null,_[e].disconnect(t))}w=null,A=null,f.reset(),e.setRenderTarget(g),d=null,u=null,h=null,n=null,v=null,U.stop(),i.isPresenting=!1,e.setPixelRatio(M),e.setSize(y.width,y.height,!1),i.dispatchEvent({type:"sessionend"})}function P(e){for(let t=0;t<e.removed.length;t++){let i=e.removed[t],n=x.indexOf(i);n>=0&&(x[n]=null,_[n].disconnect(i))}for(let t=0;t<e.added.length;t++){let i=e.added[t],n=x.indexOf(i);if(-1===n){for(let e=0;e<_.length;e++)if(e>=x.length){x.push(i),n=e;break}else if(null===x[e]){x[e]=i,n=e;break}if(-1===n)break}let r=_[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=_[e];return void 0===t&&(t=new _D,_[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=_[e];return void 0===t&&(t=new _D,_[e]=t),t.getGripSpace()},this.getHand=function(e){let t=_[e];return void 0===t&&(t=new _D,_[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===i.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(null!==(n=c)){if(g=e.getRenderTarget(),n.addEventListener("select",R),n.addEventListener("selectstart",R),n.addEventListener("selectend",R),n.addEventListener("squeeze",R),n.addEventListener("squeezestart",R),n.addEventListener("squeezeend",R),n.addEventListener("end",C),n.addEventListener("inputsourceschange",P),!0!==m.xrCompatible&&await t.makeXRCompatible(),M=e.getPixelRatio(),e.getSize(y),void 0===n.renderState.layers){let i={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(n,t,i),n.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),v=new fy(d.framebufferWidth,d.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:m.stencil})}else{let i=null,a=null,s=null;m.depth&&(s=m.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,i=m.stencil?1027:1026,a=m.stencil?1020:1014);let o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};u=(h=new XRWebGLBinding(n,t)).createProjectionLayer(o),n.updateRenderState({layers:[u]}),e.setPixelRatio(1),e.setSize(u.textureWidth,u.textureHeight,!1),v=new fy(u.textureWidth,u.textureHeight,{format:1023,type:1009,depthTexture:new ve(u.textureWidth,u.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:m.stencil,colorSpace:e.outputColorSpace,samples:4*!!m.antialias,resolveDepthBuffer:!1===u.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await n.requestReferenceSpace(s),U.setContext(n),U.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};const L=new fb,I=new fb;function N(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,i,r;if(null===n)return;null!==f.texture&&(e.near=f.depthNear,e.far=f.depthFar),T.near=b.near=S.near=e.near,T.far=b.far=S.far=e.far,(w!==T.near||A!==T.far)&&(n.updateRenderState({depthNear:T.near,depthFar:T.far}),w=T.near,A=T.far,S.near=w,S.far=A,b.near=w,b.far=A,S.updateProjectionMatrix(),b.updateProjectionMatrix(),e.updateProjectionMatrix());let a=e.parent,s=T.cameras;N(T,a);for(let e=0;e<s.length;e++)N(s[e],a);if(2===s.length){let e,t,i,n,r,a,s,o,l,c,h,u,d;L.setFromMatrixPosition(S.matrixWorld),I.setFromMatrixPosition(b.matrixWorld),e=L.distanceTo(I),t=S.projectionMatrix.elements,i=b.projectionMatrix.elements,n=t[14]/(t[10]-1),r=t[14]/(t[10]+1),a=(t[9]+1)/t[5],s=(t[9]-1)/t[5],o=(t[8]-1)/t[0],h=-((c=e/(-o+(l=(i[8]+1)/i[0])))*o),S.matrixWorld.decompose(T.position,T.quaternion,T.scale),T.translateX(h),T.translateZ(c),T.matrixWorld.compose(T.position,T.quaternion,T.scale),T.matrixWorldInverse.copy(T.matrixWorld).invert(),u=n+c,d=r+c,T.projectionMatrix.makePerspective(n*o-h,n*l+(e-h),a*r/d*u,s*r/d*u,u,d),T.projectionMatrixInverse.copy(T.projectionMatrix).invert()}else T.projectionMatrix.copy(S.projectionMatrix);t=e,i=T,null===(r=a)?t.matrix.copy(i.matrixWorld):(t.matrix.copy(r.matrixWorld),t.matrix.invert(),t.matrix.multiply(i.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(i.projectionMatrix),t.projectionMatrixInverse.copy(i.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*p3*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return T},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(e){o=e,null!==u&&(u.fixedFoveation=e),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(T)};let D=null;const U=new gw;U.setAnimationLoop(function(t,r){if(c=r.getViewerPose(l||a),p=r,null!==c){let t=c.views;null!==d&&(e.setRenderTargetFramebuffer(v,d.framebuffer),e.setRenderTarget(v));let i=!1;t.length!==T.cameras.length&&(T.cameras.length=0,i=!0);for(let n=0;n<t.length;n++){let r=t[n],a=null;if(null!==d)a=d.getViewport(r);else{let t=h.getViewSubImage(u,r);a=t.viewport,0===n&&(e.setRenderTargetTextures(v,t.colorTexture,u.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(v))}let s=E[n];void 0===s&&((s=new gm).layers.enable(n),s.viewport=new f_,E[n]=s),s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(r.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===n&&(T.matrix.copy(s.matrix),T.matrix.decompose(T.position,T.quaternion,T.scale)),!0===i&&T.cameras.push(s)}let r=n.enabledFeatures;if(r&&r.includes("depth-sensing")){let i=h.getDepthInformation(t[0]);i&&i.isValid&&i.texture&&f.init(e,i,n.renderState)}}for(let e=0;e<_.length;e++){let t=x[e],i=_[e];null!==t&&void 0!==i&&i.update(t,r,l||a)}D&&D(t,r),r.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:r}),p=null}),this.setAnimationLoop=function(e){D=e},this.dispose=function(){}}}let _z=new f9,_k=new fQ;function _V(e,t){function i(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function n(e,n){e.opacity.value=n.opacity,n.color&&e.diffuse.value.copy(n.color),n.emissive&&e.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(e.map.value=n.map,i(n.map,e.mapTransform)),n.alphaMap&&(e.alphaMap.value=n.alphaMap,i(n.alphaMap,e.alphaMapTransform)),n.bumpMap&&(e.bumpMap.value=n.bumpMap,i(n.bumpMap,e.bumpMapTransform),e.bumpScale.value=n.bumpScale,1===n.side&&(e.bumpScale.value*=-1)),n.normalMap&&(e.normalMap.value=n.normalMap,i(n.normalMap,e.normalMapTransform),e.normalScale.value.copy(n.normalScale),1===n.side&&e.normalScale.value.negate()),n.displacementMap&&(e.displacementMap.value=n.displacementMap,i(n.displacementMap,e.displacementMapTransform),e.displacementScale.value=n.displacementScale,e.displacementBias.value=n.displacementBias),n.emissiveMap&&(e.emissiveMap.value=n.emissiveMap,i(n.emissiveMap,e.emissiveMapTransform)),n.specularMap&&(e.specularMap.value=n.specularMap,i(n.specularMap,e.specularMapTransform)),n.alphaTest>0&&(e.alphaTest.value=n.alphaTest);let r=t.get(n),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,_z.copy(s),_z.x*=-1,_z.y*=-1,_z.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(_z.y*=-1,_z.z*=-1),e.envMapRotation.value.setFromMatrix4(_k.makeRotationFromEuler(_z)),e.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,e.reflectivity.value=n.reflectivity,e.ior.value=n.ior,e.refractionRatio.value=n.refractionRatio),n.lightMap&&(e.lightMap.value=n.lightMap,e.lightMapIntensity.value=n.lightMapIntensity,i(n.lightMap,e.lightMapTransform)),n.aoMap&&(e.aoMap.value=n.aoMap,e.aoMapIntensity.value=n.aoMapIntensity,i(n.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,i){i.color.getRGB(t.fogColor.value,gc(e)),i.isFog?(t.fogNear.value=i.near,t.fogFar.value=i.far):i.isFogExp2&&(t.fogDensity.value=i.density)},refreshMaterialUniforms:function(e,r,a,s,o){var l,c,h,u,d,p,f,m,g,v,_,x,y,M,S,b,E,T,w,A,R,C,P;let L;r.isMeshBasicMaterial||r.isMeshLambertMaterial?n(e,r):r.isMeshToonMaterial?(n(e,r),l=e,(c=r).gradientMap&&(l.gradientMap.value=c.gradientMap)):r.isMeshPhongMaterial?(n(e,r),h=e,u=r,h.specular.value.copy(u.specular),h.shininess.value=Math.max(u.shininess,1e-4)):r.isMeshStandardMaterial?(n(e,r),d=e,p=r,d.metalness.value=p.metalness,p.metalnessMap&&(d.metalnessMap.value=p.metalnessMap,i(p.metalnessMap,d.metalnessMapTransform)),d.roughness.value=p.roughness,p.roughnessMap&&(d.roughnessMap.value=p.roughnessMap,i(p.roughnessMap,d.roughnessMapTransform)),p.envMap&&(d.envMapIntensity.value=p.envMapIntensity),r.isMeshPhysicalMaterial&&(f=e,m=r,g=o,f.ior.value=m.ior,m.sheen>0&&(f.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),f.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(f.sheenColorMap.value=m.sheenColorMap,i(m.sheenColorMap,f.sheenColorMapTransform)),m.sheenRoughnessMap&&(f.sheenRoughnessMap.value=m.sheenRoughnessMap,i(m.sheenRoughnessMap,f.sheenRoughnessMapTransform))),m.clearcoat>0&&(f.clearcoat.value=m.clearcoat,f.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(f.clearcoatMap.value=m.clearcoatMap,i(m.clearcoatMap,f.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(f.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,i(m.clearcoatRoughnessMap,f.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(f.clearcoatNormalMap.value=m.clearcoatNormalMap,i(m.clearcoatNormalMap,f.clearcoatNormalMapTransform),f.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),1===m.side&&f.clearcoatNormalScale.value.negate())),m.dispersion>0&&(f.dispersion.value=m.dispersion),m.iridescence>0&&(f.iridescence.value=m.iridescence,f.iridescenceIOR.value=m.iridescenceIOR,f.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],f.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(f.iridescenceMap.value=m.iridescenceMap,i(m.iridescenceMap,f.iridescenceMapTransform)),m.iridescenceThicknessMap&&(f.iridescenceThicknessMap.value=m.iridescenceThicknessMap,i(m.iridescenceThicknessMap,f.iridescenceThicknessMapTransform))),m.transmission>0&&(f.transmission.value=m.transmission,f.transmissionSamplerMap.value=g.texture,f.transmissionSamplerSize.value.set(g.width,g.height),m.transmissionMap&&(f.transmissionMap.value=m.transmissionMap,i(m.transmissionMap,f.transmissionMapTransform)),f.thickness.value=m.thickness,m.thicknessMap&&(f.thicknessMap.value=m.thicknessMap,i(m.thicknessMap,f.thicknessMapTransform)),f.attenuationDistance.value=m.attenuationDistance,f.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(f.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(f.anisotropyMap.value=m.anisotropyMap,i(m.anisotropyMap,f.anisotropyMapTransform))),f.specularIntensity.value=m.specularIntensity,f.specularColor.value.copy(m.specularColor),m.specularColorMap&&(f.specularColorMap.value=m.specularColorMap,i(m.specularColorMap,f.specularColorMapTransform)),m.specularIntensityMap&&(f.specularIntensityMap.value=m.specularIntensityMap,i(m.specularIntensityMap,f.specularIntensityMapTransform)))):r.isMeshMatcapMaterial?(n(e,r),v=e,(_=r).matcap&&(v.matcap.value=_.matcap)):r.isMeshDepthMaterial?n(e,r):r.isMeshDistanceMaterial?(n(e,r),x=e,y=r,L=t.get(y).light,x.referencePosition.value.setFromMatrixPosition(L.matrixWorld),x.nearDistance.value=L.shadow.camera.near,x.farDistance.value=L.shadow.camera.far):r.isMeshNormalMaterial?n(e,r):r.isLineBasicMaterial?(M=e,S=r,M.diffuse.value.copy(S.color),M.opacity.value=S.opacity,S.map&&(M.map.value=S.map,i(S.map,M.mapTransform)),r.isLineDashedMaterial&&(b=e,E=r,b.dashSize.value=E.dashSize,b.totalSize.value=E.dashSize+E.gapSize,b.scale.value=E.scale)):r.isPointsMaterial?(T=e,w=r,A=a,R=s,T.diffuse.value.copy(w.color),T.opacity.value=w.opacity,T.size.value=w.size*A,T.scale.value=.5*R,w.map&&(T.map.value=w.map,i(w.map,T.uvTransform)),w.alphaMap&&(T.alphaMap.value=w.alphaMap,i(w.alphaMap,T.alphaMapTransform)),w.alphaTest>0&&(T.alphaTest.value=w.alphaTest)):r.isSpriteMaterial?(C=e,P=r,C.diffuse.value.copy(P.color),C.opacity.value=P.opacity,C.rotation.value=P.rotation,P.map&&(C.map.value=P.map,i(P.map,C.mapTransform)),P.alphaMap&&(C.alphaMap.value=P.alphaMap,i(P.alphaMap,C.alphaMapTransform)),P.alphaTest>0&&(C.alphaTest.value=P.alphaTest)):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function _H(e,t,i,n){let r={},a={},s=[],o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e){let t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){let i=t.target;i.removeEventListener("dispose",c);let n=s.indexOf(i.__bindingPointIndex);s.splice(n,1),e.deleteBuffer(r[i.id]),delete r[i.id],delete a[i.id]}return{bind:function(e,t){let i=t.program;n.uniformBlockBinding(e,i)},update:function(i,h){var u;let d,p,f,m,g=r[i.id];void 0===g&&(function(e){let t=e.uniforms,i=0;for(let e=0,n=t.length;e<n;e++){let n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=n.length;e<t;e++){let t=n[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,n=r.length;e<n;e++){let n=l(r[e]),a=i%16;0!==a&&16-a<n.boundary&&(i+=16-a),t.__data=new Float32Array(n.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=i,i+=n.storage}}}let n=i%16;n>0&&(i+=16-n),e.__size=i,e.__cache={}}(i),(u=i).__bindingPointIndex=d=function(){for(let e=0;e<o;e++)if(-1===s.indexOf(e))return s.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}(),p=e.createBuffer(),f=u.__size,m=u.usage,e.bindBuffer(e.UNIFORM_BUFFER,p),e.bufferData(e.UNIFORM_BUFFER,f,m),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,d,p),g=p,r[i.id]=g,i.addEventListener("dispose",c));let v=h.program;n.updateUBOMapping(i,v);let _=t.render.frame;a[i.id]!==_&&(function(t){let i=r[t.id],n=t.uniforms,a=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,i);for(let t=0,i=n.length;t<i;t++){let i=Array.isArray(n[t])?n[t]:[n[t]];for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!0===function(e,t,i,n){let r=e.value,a=t+"_"+i;if(void 0===n[a])return"number"==typeof r||"boolean"==typeof r?n[a]=r:n[a]=r.clone(),!0;{let e=n[a];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return n[a]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}(r,t,n,a)){let t=r.__offset,i=Array.isArray(r.value)?r.value:[r.value],n=0;for(let a=0;a<i.length;a++){let s=i[a],o=l(s);"number"==typeof s||"boolean"==typeof s?(r.__data[0]=s,e.bufferSubData(e.UNIFORM_BUFFER,t+n,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=0,r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=0,r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=0):(s.toArray(r.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(i),a[i.id]=_)},dispose:function(){for(let t in r)e.deleteBuffer(r[t]);s=[],r={},a={}}}}class _G{constructor(e={}){let t,i,n,r,a,s,o,l,c,h,u,d,p,f,m,g,v,_,x,y,M,S,b,E,T;const{canvas:w=function(){let e=fi("canvas");return e.style.display="block",e}(),context:A=null,depth:R=!0,stencil:C=!1,alpha:P=!1,antialias:L=!1,premultipliedAlpha:I=!0,preserveDrawingBuffer:N=!1,powerPreference:D="default",failIfMajorPerformanceCaveat:U=!1}=e;if(this.isWebGLRenderer=!0,null!==A){if("u">typeof WebGLRenderingContext&&A instanceof WebGLRenderingContext)throw Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");t=A.getContextAttributes().alpha}else t=P;const O=new Uint32Array(4),F=new Int32Array(4);let B=null,z=null;const k=[],V=[];this.domElement=w,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=pX,this.toneMapping=0,this.toneMappingExposure=1;const H=this;let G=!1,W=0,j=0,X=null,q=-1,Y=null;const K=new f_,Z=new f_;let $=null;const J=new mI(0);let Q=0,ee=w.width,et=w.height,ei=1,en=null,er=null;const ea=new f_(0,0,ee,et),es=new f_(0,0,ee,et);let eo=!1;const el=new gT;let ec=!1,eh=!1;const eu=new fQ,ed=new fb,ep={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ef=!1;function em(){return null===X?ei:1}let eg=A;function ev(e,t){return w.getContext(e,t)}try{if("setAttribute"in w&&w.setAttribute("data-engine","three.js r165"),w.addEventListener("webglcontextlost",ey,!1),w.addEventListener("webglcontextrestored",eM,!1),w.addEventListener("webglcontextcreationerror",eS,!1),null===eg){const e="webgl2";if(eg=ev(e,{alpha:!0,depth:R,stencil:C,antialias:L,premultipliedAlpha:I,preserveDrawingBuffer:N,powerPreference:D,failIfMajorPerformanceCaveat:U}),null===eg)if(ev(e))throw Error("Error creating WebGL context with your selected attributes.");else throw Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function e_(){(i=new g5(eg)).init(),b=new _P(eg,i),n=new gB(eg,i,e,b),r=new _R(eg),a=new g8(eg),s=new _f,o=new _C(eg,i,r,s,n,b,a),l=new gk(H),c=new g3(H),h=new gA(eg),E=new gO(eg,h),u=new g4(eg,h,a,E),d=new g9(eg,u,h,a),y=new g7(eg,n,o),v=new gz(s),p=new _p(H,l,c,i,n,E,v),f=new _V(H,s),m=new __,g=new _E(i),x=new gU(H,l,c,r,d,t,I),_=new _A(H,d,n),T=new _H(eg,a,n,r),M=new gF(eg,i,a),S=new g6(eg,i,a),a.programs=p.programs,H.capabilities=n,H.extensions=i,H.properties=s,H.renderLists=m,H.shadowMap=_,H.state=r,H.info=a}e_();const ex=new _B(H,eg);function ey(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),G=!0}function eM(){console.log("THREE.WebGLRenderer: Context Restored."),G=!1;let e=a.autoReset,t=_.enabled,i=_.autoUpdate,n=_.needsUpdate,r=_.type;e_(),a.autoReset=e,_.enabled=t,_.autoUpdate=i,_.needsUpdate=n,_.type=r}function eS(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function eb(e){var t,i;let n,r=e.target;r.removeEventListener("dispose",eb),i=t=r,void 0!==(n=s.get(i).programs)&&(n.forEach(function(e){p.releaseProgram(e)}),i.isShaderMaterial&&p.releaseShaderCache(i)),s.remove(t)}function eE(e,t,i){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,eD(e,t,i),e.side=0,e.needsUpdate=!0,eD(e,t,i),e.side=2):eD(e,t,i)}this.xr=ex,this.getContext=function(){return eg},this.getContextAttributes=function(){return eg.getContextAttributes()},this.forceContextLoss=function(){let e=i.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=i.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return ei},this.setPixelRatio=function(e){void 0!==e&&(ei=e,this.setSize(ee,et,!1))},this.getSize=function(e){return e.set(ee,et)},this.setSize=function(e,t,i=!0){ex.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(ee=e,et=t,w.width=Math.floor(e*ei),w.height=Math.floor(t*ei),!0===i&&(w.style.width=e+"px",w.style.height=t+"px"),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(ee*ei,et*ei).floor()},this.setDrawingBufferSize=function(e,t,i){ee=e,et=t,ei=i,w.width=Math.floor(e*i),w.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.getCurrentViewport=function(e){return e.copy(K)},this.getViewport=function(e){return e.copy(ea)},this.setViewport=function(e,t,i,n){e.isVector4?ea.set(e.x,e.y,e.z,e.w):ea.set(e,t,i,n),r.viewport(K.copy(ea).multiplyScalar(ei).round())},this.getScissor=function(e){return e.copy(es)},this.setScissor=function(e,t,i,n){e.isVector4?es.set(e.x,e.y,e.z,e.w):es.set(e,t,i,n),r.scissor(Z.copy(es).multiplyScalar(ei).round())},this.getScissorTest=function(){return eo},this.setScissorTest=function(e){r.setScissorTest(eo=e)},this.setOpaqueSort=function(e){en=e},this.setTransparentSort=function(e){er=e},this.getClearColor=function(e){return e.copy(x.getClearColor())},this.setClearColor=function(){x.setClearColor.apply(x,arguments)},this.getClearAlpha=function(){return x.getClearAlpha()},this.setClearAlpha=function(){x.setClearAlpha.apply(x,arguments)},this.clear=function(e=!0,t=!0,i=!0){let n=0;if(e){let e=!1;if(null!==X){let t=X.texture.format;e=1033===t||1031===t||1029===t}if(e){let e=X.texture.type,t=1009===e||1014===e||1012===e||1020===e||1017===e||1018===e,i=x.getClearColor(),n=x.getClearAlpha(),r=i.r,a=i.g,s=i.b;t?(O[0]=r,O[1]=a,O[2]=s,O[3]=n,eg.clearBufferuiv(eg.COLOR,0,O)):(F[0]=r,F[1]=a,F[2]=s,F[3]=n,eg.clearBufferiv(eg.COLOR,0,F))}else n|=eg.COLOR_BUFFER_BIT}t&&(n|=eg.DEPTH_BUFFER_BIT),i&&(n|=eg.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(0xffffffff)),eg.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){w.removeEventListener("webglcontextlost",ey,!1),w.removeEventListener("webglcontextrestored",eM,!1),w.removeEventListener("webglcontextcreationerror",eS,!1),m.dispose(),g.dispose(),s.dispose(),l.dispose(),c.dispose(),d.dispose(),E.dispose(),T.dispose(),p.dispose(),ex.dispose(),ex.removeEventListener("sessionstart",ew),ex.removeEventListener("sessionend",eA),eR.stop()},this.renderBufferDirect=function(e,t,i,a,d,p){let m;null===t&&(t=ep);let g=d.isMesh&&0>d.matrixWorld.determinant(),_=function(e,t,i,a,h){var u,d;!0!==t.isScene&&(t=ep),o.resetTextureUnits();let p=t.fog,m=a.isMeshStandardMaterial?t.environment:null,g=null===X?H.outputColorSpace:!0===X.isXRRenderTarget?X.texture.colorSpace:pq,_=(a.isMeshStandardMaterial?c:l).get(a.envMap||m),x=!0===a.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,M=!!i.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),S=!!i.morphAttributes.position,b=!!i.morphAttributes.normal,E=!!i.morphAttributes.color,w=0;a.toneMapped&&(null===X||!0===X.isXRRenderTarget)&&(w=H.toneMapping);let A=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,R=void 0!==A?A.length:0,C=s.get(a),P=z.state.lights;if(!0===ec&&(!0===eh||e!==Y)){let t=e===Y&&a.id===q;v.setState(a,e,t)}let L=!1;a.version===C.__version?C.needsLights&&C.lightsStateVersion!==P.state.version||C.outputColorSpace!==g||h.isBatchedMesh&&!1===C.batching?L=!0:h.isBatchedMesh||!0!==C.batching?h.isBatchedMesh&&!0===C.batchingColor&&null===h.colorTexture||h.isBatchedMesh&&!1===C.batchingColor&&null!==h.colorTexture||h.isInstancedMesh&&!1===C.instancing?L=!0:h.isInstancedMesh||!0!==C.instancing?h.isSkinnedMesh&&!1===C.skinning?L=!0:h.isSkinnedMesh||!0!==C.skinning?h.isInstancedMesh&&!0===C.instancingColor&&null===h.instanceColor||h.isInstancedMesh&&!1===C.instancingColor&&null!==h.instanceColor||h.isInstancedMesh&&!0===C.instancingMorph&&null===h.morphTexture||h.isInstancedMesh&&!1===C.instancingMorph&&null!==h.morphTexture||C.envMap!==_||!0===a.fog&&C.fog!==p||void 0!==C.numClippingPlanes&&(C.numClippingPlanes!==v.numPlanes||C.numIntersection!==v.numIntersection)||C.vertexAlphas!==x||C.vertexTangents!==M||C.morphTargets!==S||C.morphNormals!==b||C.morphColors!==E||C.toneMapping!==w?L=!0:C.morphTargetsCount!==R&&(L=!0):L=!0:L=!0:L=!0:(L=!0,C.__version=a.version);let I=C.currentProgram;!0===L&&(I=eD(a,t,h));let N=!1,D=!1,U=!1,O=I.getUniforms(),F=C.uniforms;if(r.useProgram(I.program)&&(N=!0,D=!0,U=!0),a.id!==q&&(q=a.id,D=!0),N||Y!==e){O.setValue(eg,"projectionMatrix",e.projectionMatrix),O.setValue(eg,"viewMatrix",e.matrixWorldInverse);let t=O.map.cameraPosition;void 0!==t&&t.setValue(eg,ed.setFromMatrixPosition(e.matrixWorld)),n.logarithmicDepthBuffer&&O.setValue(eg,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&O.setValue(eg,"isOrthographic",!0===e.isOrthographicCamera),Y!==e&&(Y=e,D=!0,U=!0)}if(h.isSkinnedMesh){O.setOptional(eg,h,"bindMatrix"),O.setOptional(eg,h,"bindMatrixInverse");let e=h.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),O.setValue(eg,"boneTexture",e.boneTexture,o))}h.isBatchedMesh&&(O.setOptional(eg,h,"batchingTexture"),O.setValue(eg,"batchingTexture",h._matricesTexture,o),O.setOptional(eg,h,"batchingColorTexture"),null!==h._colorsTexture&&O.setValue(eg,"batchingColorTexture",h._colorsTexture,o));let B=i.morphAttributes;if((void 0!==B.position||void 0!==B.normal||void 0!==B.color)&&y.update(h,i,I),(D||C.receiveShadow!==h.receiveShadow)&&(C.receiveShadow=h.receiveShadow,O.setValue(eg,"receiveShadow",h.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(F.envMap.value=_,F.flipEnvMap.value=_.isCubeTexture&&!1===_.isRenderTargetTexture?-1:1),a.isMeshStandardMaterial&&null===a.envMap&&null!==t.environment&&(F.envMapIntensity.value=t.environmentIntensity),D&&(O.setValue(eg,"toneMappingExposure",H.toneMappingExposure),C.needsLights&&(u=F,d=U,u.ambientLightColor.needsUpdate=d,u.lightProbe.needsUpdate=d,u.directionalLights.needsUpdate=d,u.directionalLightShadows.needsUpdate=d,u.pointLights.needsUpdate=d,u.pointLightShadows.needsUpdate=d,u.spotLights.needsUpdate=d,u.spotLightShadows.needsUpdate=d,u.rectAreaLights.needsUpdate=d,u.hemisphereLights.needsUpdate=d),p&&!0===a.fog&&f.refreshFogUniforms(F,p),f.refreshMaterialUniforms(F,a,ei,et,z.state.transmissionRenderTarget[e.id]),v5.upload(eg,eU(C),F,o)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(v5.upload(eg,eU(C),F,o),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&O.setValue(eg,"center",h.center),O.setValue(eg,"modelViewMatrix",h.modelViewMatrix),O.setValue(eg,"normalMatrix",h.normalMatrix),O.setValue(eg,"modelMatrix",h.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let e=a.uniformsGroups;for(let t=0,i=e.length;t<i;t++){let i=e[t];T.update(i,I),T.bind(i,I)}}return I}(e,t,i,a,d);r.setMaterial(a,g);let x=i.index,b=1;if(!0===a.wireframe){if(void 0===(x=u.getWireframeAttribute(i)))return;b=2}let w=i.drawRange,A=i.attributes.position,R=w.start*b,C=(w.start+w.count)*b;null!==p&&(R=Math.max(R,p.start*b),C=Math.min(C,(p.start+p.count)*b)),null!==x?(R=Math.max(R,0),C=Math.min(C,x.count)):null!=A&&(R=Math.max(R,0),C=Math.min(C,A.count));let P=C-R;if(P<0||P===1/0)return;E.setup(d,a,_,i,x);let L=M;if(null!==x&&(m=h.get(x),(L=S).setIndex(m)),d.isMesh)!0===a.wireframe?(r.setLineWidth(a.wireframeLinewidth*em()),L.setMode(eg.LINES)):L.setMode(eg.TRIANGLES);else if(d.isLine){let e=a.linewidth;void 0===e&&(e=1),r.setLineWidth(e*em()),d.isLineSegments?L.setMode(eg.LINES):d.isLineLoop?L.setMode(eg.LINE_LOOP):L.setMode(eg.LINE_STRIP)}else d.isPoints?L.setMode(eg.POINTS):d.isSprite&&L.setMode(eg.TRIANGLES);if(d.isBatchedMesh)null!==d._multiDrawInstances?L.renderMultiDrawInstances(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount,d._multiDrawInstances):L.renderMultiDraw(d._multiDrawStarts,d._multiDrawCounts,d._multiDrawCount);else if(d.isInstancedMesh)L.renderInstances(R,P,d.count);else if(i.isInstancedBufferGeometry){let e=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,t=Math.min(i.instanceCount,e);L.renderInstances(R,P,t)}else L.render(R,P)},this.compile=function(e,t,i=null){null===i&&(i=e),(z=g.get(i)).init(t),V.push(z),i.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(z.pushLight(e),e.castShadow&&z.pushShadow(e))}),e!==i&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(z.pushLight(e),e.castShadow&&z.pushShadow(e))}),z.setupLights();let n=new Set;return e.traverse(function(e){let t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){let a=t[r];eE(a,i,e),n.add(a)}else eE(t,i,e),n.add(t)}),V.pop(),z=null,n},this.compileAsync=function(e,t,n=null){let r=this.compile(e,t,n);return new Promise(t=>{function n(){(r.forEach(function(e){s.get(e).currentProgram.isReady()&&r.delete(e)}),0===r.size)?t(e):setTimeout(n,10)}null!==i.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let eT=null;function ew(){eR.stop()}function eA(){eR.start()}const eR=new gw;function eC(e,t,i,n){if(!1===e.visible)return;if(e.layers.test(t.layers)){if(e.isGroup)i=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)z.pushLight(e),e.castShadow&&z.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||el.intersectsSprite(e)){n&&ed.setFromMatrixPosition(e.matrixWorld).applyMatrix4(eu);let t=d.update(e),r=e.material;r.visible&&B.push(e,t,r,i,ed.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||el.intersectsObject(e))){let t=d.update(e),r=e.material;if(n&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ed.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ed.copy(t.boundingSphere.center)),ed.applyMatrix4(e.matrixWorld).applyMatrix4(eu)),Array.isArray(r)){let n=t.groups;for(let a=0,s=n.length;a<s;a++){let s=n[a],o=r[s.materialIndex];o&&o.visible&&B.push(e,t,o,i,ed.z,s)}}else r.visible&&B.push(e,t,r,i,ed.z,null)}}let r=e.children;for(let e=0,a=r.length;e<a;e++)eC(r[e],t,i,n)}function eP(e,t,i,n){let a=e.opaque,s=e.transmissive,o=e.transparent;z.setupLightsView(i),!0===ec&&v.setGlobalState(H.clippingPlanes,i),n&&r.viewport(K.copy(n)),a.length>0&&eI(a,t,i),s.length>0&&eI(s,t,i),o.length>0&&eI(o,t,i),r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),r.setPolygonOffset(!1)}function eL(e,t,n,r){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===z.state.transmissionRenderTarget[r.id]&&(z.state.transmissionRenderTarget[r.id]=new fy(1,1,{generateMipmaps:!0,type:i.has("EXT_color_buffer_half_float")||i.has("EXT_color_buffer_float")?1016:1009,minFilter:1008,samples:4,stencilBuffer:C,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:fc.workingColorSpace}));let a=z.state.transmissionRenderTarget[r.id],s=r.viewport||K;a.setSize(s.z,s.w);let l=H.getRenderTarget();H.setRenderTarget(a),H.getClearColor(J),(Q=H.getClearAlpha())<1&&H.setClearColor(0xffffff,.5),ef?x.render(n):H.clear();let c=H.toneMapping;H.toneMapping=0;let h=r.viewport;if(void 0!==r.viewport&&(r.viewport=void 0),z.setupLightsView(r),!0===ec&&v.setGlobalState(H.clippingPlanes,r),eI(e,n,r),o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a),!1===i.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let i=0,a=t.length;i<a;i++){let a=t[i],s=a.object,o=a.geometry,l=a.material,c=a.group;if(2===l.side&&s.layers.test(r.layers)){let t=l.side;l.side=1,l.needsUpdate=!0,eN(s,n,r,o,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(o.updateMultisampleRenderTarget(a),o.updateRenderTargetMipmap(a))}H.setRenderTarget(l),H.setClearColor(J,Q),void 0!==h&&(r.viewport=h),H.toneMapping=c}function eI(e,t,i){let n=!0===t.isScene?t.overrideMaterial:null;for(let r=0,a=e.length;r<a;r++){let a=e[r],s=a.object,o=a.geometry,l=null===n?a.material:n,c=a.group;s.layers.test(i.layers)&&eN(s,t,i,o,l,c)}}function eN(e,t,i,n,r,a){e.onBeforeRender(H,t,i,n,r,a),e.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(H,t,i,n,e,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,H.renderBufferDirect(i,t,n,r,e,a),r.side=0,r.needsUpdate=!0,H.renderBufferDirect(i,t,n,r,e,a),r.side=2):H.renderBufferDirect(i,t,n,r,e,a),e.onAfterRender(H,t,i,n,r,a)}function eD(e,t,i){var n;!0!==t.isScene&&(t=ep);let r=s.get(e),a=z.state.lights,o=z.state.shadowsArray,h=a.state.version,u=p.getParameters(e,a.state,o,t,i),d=p.getProgramCacheKey(u),f=r.programs;r.environment=e.isMeshStandardMaterial?t.environment:null,r.fog=t.fog,r.envMap=(e.isMeshStandardMaterial?c:l).get(e.envMap||r.environment),r.envMapRotation=null!==r.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===f&&(e.addEventListener("dispose",eb),r.programs=f=new Map);let m=f.get(d);if(void 0!==m){if(r.currentProgram===m&&r.lightsStateVersion===h)return eO(e,u),m}else u.uniforms=p.getUniforms(e),e.onBuild(i,u,H),e.onBeforeCompile(u,H),m=p.acquireProgram(u,d),f.set(d,m),r.uniforms=u.uniforms;let g=r.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(g.clippingPlanes=v.uniform),eO(e,u),r.needsLights=(n=e).isMeshLambertMaterial||n.isMeshToonMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isShadowMaterial||n.isShaderMaterial&&!0===n.lights,r.lightsStateVersion=h,r.needsLights&&(g.ambientLightColor.value=a.state.ambient,g.lightProbe.value=a.state.probe,g.directionalLights.value=a.state.directional,g.directionalLightShadows.value=a.state.directionalShadow,g.spotLights.value=a.state.spot,g.spotLightShadows.value=a.state.spotShadow,g.rectAreaLights.value=a.state.rectArea,g.ltc_1.value=a.state.rectAreaLTC1,g.ltc_2.value=a.state.rectAreaLTC2,g.pointLights.value=a.state.point,g.pointLightShadows.value=a.state.pointShadow,g.hemisphereLights.value=a.state.hemi,g.directionalShadowMap.value=a.state.directionalShadowMap,g.directionalShadowMatrix.value=a.state.directionalShadowMatrix,g.spotShadowMap.value=a.state.spotShadowMap,g.spotLightMatrix.value=a.state.spotLightMatrix,g.spotLightMap.value=a.state.spotLightMap,g.pointShadowMap.value=a.state.pointShadowMap,g.pointShadowMatrix.value=a.state.pointShadowMatrix),r.currentProgram=m,r.uniformsList=null,m}function eU(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=v5.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function eO(e,t){let i=s.get(e);i.outputColorSpace=t.outputColorSpace,i.batching=t.batching,i.batchingColor=t.batchingColor,i.instancing=t.instancing,i.instancingColor=t.instancingColor,i.instancingMorph=t.instancingMorph,i.skinning=t.skinning,i.morphTargets=t.morphTargets,i.morphNormals=t.morphNormals,i.morphColors=t.morphColors,i.morphTargetsCount=t.morphTargetsCount,i.numClippingPlanes=t.numClippingPlanes,i.numIntersection=t.numClipIntersection,i.vertexAlphas=t.vertexAlphas,i.vertexTangents=t.vertexTangents,i.toneMapping=t.toneMapping}eR.setAnimationLoop(function(e){eT&&eT(e)}),"u">typeof self&&eR.setContext(self),this.setAnimationLoop=function(e){eT=e,ex.setAnimationLoop(e),null===e?eR.stop():eR.start()},ex.addEventListener("sessionstart",ew),ex.addEventListener("sessionend",eA),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===G)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===ex.enabled&&!0===ex.isPresenting&&(!0===ex.cameraAutoUpdate&&ex.updateCamera(t),t=ex.getCamera()),!0===e.isScene&&e.onBeforeRender(H,e,t,X),(z=g.get(e,V.length)).init(t),V.push(z),eu.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),el.setFromProjectionMatrix(eu),eh=this.localClippingEnabled,ec=v.init(this.clippingPlanes,eh),(B=m.get(e,k.length)).init(),k.push(B),!0===ex.enabled&&!0===ex.isPresenting){let e=H.xr.getDepthSensingMesh();null!==e&&eC(e,t,-1/0,H.sortObjects)}eC(e,t,0,H.sortObjects),B.finish(),!0===H.sortObjects&&B.sort(en,er),(ef=!1===ex.enabled||!1===ex.isPresenting||!1===ex.hasDepthSensing())&&x.addToRenderList(B,e),this.info.render.frame++,!0===ec&&v.beginShadows();let i=z.state.shadowsArray;_.render(i,e,t),!0===ec&&v.endShadows(),!0===this.info.autoReset&&this.info.reset();let n=B.opaque,r=B.transmissive;if(z.setupLights(),t.isArrayCamera){let i=t.cameras;if(r.length>0)for(let t=0,a=i.length;t<a;t++)eL(n,r,e,i[t]);ef&&x.render(e);for(let t=0,n=i.length;t<n;t++){let n=i[t];eP(B,e,n,n.viewport)}}else r.length>0&&eL(n,r,e,t),ef&&x.render(e),eP(B,e,t);null!==X&&(o.updateMultisampleRenderTarget(X),o.updateRenderTargetMipmap(X)),!0===e.isScene&&e.onAfterRender(H,e,t),E.resetDefaultState(),q=-1,Y=null,V.pop(),V.length>0?(z=V[V.length-1],!0===ec&&v.setGlobalState(H.clippingPlanes,z.state.camera)):z=null,k.pop(),B=k.length>0?k[k.length-1]:null},this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return j},this.getRenderTarget=function(){return X},this.setRenderTargetTextures=function(e,t,n){s.get(e.texture).__webglTexture=t,s.get(e.depthTexture).__webglTexture=n;let r=s.get(e);r.__hasExternalTextures=!0,r.__autoAllocateDepthBuffer=void 0===n,r.__autoAllocateDepthBuffer||!0!==i.has("WEBGL_multisampled_render_to_texture")||(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),r.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){let i=s.get(e);i.__webglFramebuffer=t,i.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,i=0){X=e,W=t,j=i;let n=!0,a=null,l=!1,c=!1;if(e){let h=s.get(e);void 0!==h.__useDefaultFramebuffer?(r.bindFramebuffer(eg.FRAMEBUFFER,null),n=!1):void 0===h.__webglFramebuffer?o.setupRenderTarget(e):h.__hasExternalTextures&&o.rebindTextures(e,s.get(e.texture).__webglTexture,s.get(e.depthTexture).__webglTexture);let u=e.texture;(u.isData3DTexture||u.isDataArrayTexture||u.isCompressedArrayTexture)&&(c=!0);let d=s.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][i]:d[t],l=!0):a=e.samples>0&&!1===o.useMultisampledRTT(e)?s.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[i]:d,K.copy(e.viewport),Z.copy(e.scissor),$=e.scissorTest}else K.copy(ea).multiplyScalar(ei).floor(),Z.copy(es).multiplyScalar(ei).floor(),$=eo;if(r.bindFramebuffer(eg.FRAMEBUFFER,a)&&n&&r.drawBuffers(e,a),r.viewport(K),r.scissor(Z),r.setScissorTest($),l){let n=s.get(e.texture);eg.framebufferTexture2D(eg.FRAMEBUFFER,eg.COLOR_ATTACHMENT0,eg.TEXTURE_CUBE_MAP_POSITIVE_X+t,n.__webglTexture,i)}else if(c){let n=s.get(e.texture);eg.framebufferTextureLayer(eg.FRAMEBUFFER,eg.COLOR_ATTACHMENT0,n.__webglTexture,i||0,t||0)}q=-1},this.readRenderTargetPixels=function(e,t,i,a,o,l,c){if(!(e&&e.isWebGLRenderTarget))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(h=h[c]),h){r.bindFramebuffer(eg.FRAMEBUFFER,h);try{let r=e.texture,s=r.format,c=r.type;if(!n.textureFormatReadable(s))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!n.textureTypeReadable(c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o&&eg.readPixels(t,i,a,o,b.convert(s),b.convert(c),l)}finally{let e=null!==X?s.get(X).__webglFramebuffer:null;r.bindFramebuffer(eg.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,i,a,o,l,c){if(!(e&&e.isWebGLRenderTarget))throw Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let h=s.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(h=h[c]),h){r.bindFramebuffer(eg.FRAMEBUFFER,h);try{let r=e.texture,s=r.format,c=r.type;if(!n.textureFormatReadable(s))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!n.textureTypeReadable(c))throw Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-a&&i>=0&&i<=e.height-o){var u;let e=eg.createBuffer();eg.bindBuffer(eg.PIXEL_PACK_BUFFER,e),eg.bufferData(eg.PIXEL_PACK_BUFFER,l.byteLength,eg.STREAM_READ),eg.readPixels(t,i,a,o,b.convert(s),b.convert(c),0),eg.flush();let n=eg.fenceSync(eg.SYNC_GPU_COMMANDS_COMPLETE,0);await (u=eg,new Promise(function(e,t){setTimeout(function i(){switch(u.clientWaitSync(n,u.SYNC_FLUSH_COMMANDS_BIT,0)){case u.WAIT_FAILED:t();break;case u.TIMEOUT_EXPIRED:setTimeout(i,4);break;default:e()}},4)}));try{eg.bindBuffer(eg.PIXEL_PACK_BUFFER,e),eg.getBufferSubData(eg.PIXEL_PACK_BUFFER,0,l)}finally{eg.deleteBuffer(e),eg.deleteSync(n)}return l}}finally{let e=null!==X?s.get(X).__webglFramebuffer:null;r.bindFramebuffer(eg.FRAMEBUFFER,e)}}},this.copyFramebufferToTexture=function(e,t=null,i=0){!0!==e.isTexture&&(console.warn("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);let n=Math.pow(2,-i),a=Math.floor(e.image.width*n),s=Math.floor(e.image.height*n),l=null!==t?t.x:0,c=null!==t?t.y:0;o.setTexture2D(e,0),eg.copyTexSubImage2D(eg.TEXTURE_2D,i,0,0,l,c,a,s),r.unbindTexture()},this.copyTextureToTexture=function(e,t,i=null,n=null,a=0){let s,l,c,h,u,d;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture function signature has changed."),n=arguments[0]||null,e=arguments[1],t=arguments[2],a=arguments[3]||0,i=null),null!==i?(s=i.max.x-i.min.x,l=i.max.y-i.min.y,c=i.min.x,h=i.min.y):(s=e.image.width,l=e.image.height,c=0,h=0),null!==n?(u=n.x,d=n.y):(u=0,d=0);let p=b.convert(t.format),f=b.convert(t.type);o.setTexture2D(t,0),eg.pixelStorei(eg.UNPACK_FLIP_Y_WEBGL,t.flipY),eg.pixelStorei(eg.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eg.pixelStorei(eg.UNPACK_ALIGNMENT,t.unpackAlignment);let m=eg.getParameter(eg.UNPACK_ROW_LENGTH),g=eg.getParameter(eg.UNPACK_IMAGE_HEIGHT),v=eg.getParameter(eg.UNPACK_SKIP_PIXELS),_=eg.getParameter(eg.UNPACK_SKIP_ROWS),x=eg.getParameter(eg.UNPACK_SKIP_IMAGES),y=e.isCompressedTexture?e.mipmaps[a]:e.image;eg.pixelStorei(eg.UNPACK_ROW_LENGTH,y.width),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,y.height),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,c),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,h),e.isDataTexture?eg.texSubImage2D(eg.TEXTURE_2D,a,u,d,s,l,p,f,y.data):e.isCompressedTexture?eg.compressedTexSubImage2D(eg.TEXTURE_2D,a,u,d,y.width,y.height,p,y.data):eg.texSubImage2D(eg.TEXTURE_2D,a,u,d,p,f,y),eg.pixelStorei(eg.UNPACK_ROW_LENGTH,m),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,g),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,v),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,_),eg.pixelStorei(eg.UNPACK_SKIP_IMAGES,x),0===a&&t.generateMipmaps&&eg.generateMipmap(eg.TEXTURE_2D),r.unbindTexture()},this.copyTextureToTexture3D=function(e,t,i=null,n=null,a=0){let s,l,c,h,u,d,p,f,m,g;!0!==e.isTexture&&(console.warn("WebGLRenderer: copyTextureToTexture3D function signature has changed."),i=arguments[0]||null,n=arguments[1]||null,e=arguments[2],t=arguments[3],a=arguments[4]||0);let v=e.isCompressedTexture?e.mipmaps[a]:e.image;null!==i?(s=i.max.x-i.min.x,l=i.max.y-i.min.y,c=i.max.z-i.min.z,h=i.min.x,u=i.min.y,d=i.min.z):(s=v.width,l=v.height,c=v.depth,h=0,u=0,d=0),null!==n?(p=n.x,f=n.y,m=n.z):(p=0,f=0,m=0);let _=b.convert(t.format),x=b.convert(t.type);if(t.isData3DTexture)o.setTexture3D(t,0),g=eg.TEXTURE_3D;else{if(!t.isDataArrayTexture&&!t.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");o.setTexture2DArray(t,0),g=eg.TEXTURE_2D_ARRAY}eg.pixelStorei(eg.UNPACK_FLIP_Y_WEBGL,t.flipY),eg.pixelStorei(eg.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),eg.pixelStorei(eg.UNPACK_ALIGNMENT,t.unpackAlignment);let y=eg.getParameter(eg.UNPACK_ROW_LENGTH),M=eg.getParameter(eg.UNPACK_IMAGE_HEIGHT),S=eg.getParameter(eg.UNPACK_SKIP_PIXELS),E=eg.getParameter(eg.UNPACK_SKIP_ROWS),T=eg.getParameter(eg.UNPACK_SKIP_IMAGES);eg.pixelStorei(eg.UNPACK_ROW_LENGTH,v.width),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,v.height),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,h),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,u),eg.pixelStorei(eg.UNPACK_SKIP_IMAGES,d),e.isDataTexture||e.isData3DTexture?eg.texSubImage3D(g,a,p,f,m,s,l,c,_,x,v.data):t.isCompressedArrayTexture?eg.compressedTexSubImage3D(g,a,p,f,m,s,l,c,_,v.data):eg.texSubImage3D(g,a,p,f,m,s,l,c,_,x,v),eg.pixelStorei(eg.UNPACK_ROW_LENGTH,y),eg.pixelStorei(eg.UNPACK_IMAGE_HEIGHT,M),eg.pixelStorei(eg.UNPACK_SKIP_PIXELS,S),eg.pixelStorei(eg.UNPACK_SKIP_ROWS,E),eg.pixelStorei(eg.UNPACK_SKIP_IMAGES,T),0===a&&t.generateMipmaps&&eg.generateMipmap(g),r.unbindTexture()},this.initRenderTarget=function(e){void 0===s.get(e).__webglFramebuffer&&o.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?o.setTextureCube(e,0):e.isData3DTexture?o.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?o.setTexture2DArray(e,0):o.setTexture2D(e,0),r.unbindTexture()},this.resetState=function(){W=0,j=0,X=null,r.reset(),E.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===pY?"display-p3":"srgb",t.unpackColorSpace=fc.workingColorSpace===pK?"display-p3":"srgb"}}class _W extends mg{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 f9,this.environmentIntensity=1,this.environmentRotation=new f9,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(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),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class _j extends mU{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new mI(0xffffff),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}let _X=new fb,_q=new fb,_Y=new fQ,_K=new fJ,_Z=new fW,_$=new fb,_J=new fb;class _Q extends mg{constructor(e=new mZ,t=new _j){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[0];for(let e=1,n=t.count;e<n;e++)_X.fromBufferAttribute(t,e-1),_q.fromBufferAttribute(t,e),i[e]=i[e-1],i[e]+=_X.distanceTo(_q);e.setAttribute("lineDistance",new mH(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){let i=this.geometry,n=this.matrixWorld,r=e.params.Line.threshold,a=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),_Z.copy(i.boundingSphere),_Z.applyMatrix4(n),_Z.radius+=r,!1===e.ray.intersectsSphere(_Z))return;_Y.copy(n).invert(),_K.copy(e.ray).applyMatrix4(_Y);let s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=this.isLineSegments?2:1,c=i.index,h=i.attributes.position;if(null!==c){let i=Math.max(0,a.start),n=Math.min(c.count,a.start+a.count);for(let r=i,a=n-1;r<a;r+=l){let i=_0(this,e,_K,o,c.getX(r),c.getX(r+1));i&&t.push(i)}if(this.isLineLoop){let r=_0(this,e,_K,o,c.getX(n-1),c.getX(i));r&&t.push(r)}}else{let i=Math.max(0,a.start),n=Math.min(h.count,a.start+a.count);for(let r=i,a=n-1;r<a;r+=l){let i=_0(this,e,_K,o,r,r+1);i&&t.push(i)}if(this.isLineLoop){let r=_0(this,e,_K,o,n-1,i);r&&t.push(r)}}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let i=e[t[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=i.length;e<t;e++){let t=i[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function _0(e,t,i,n,r,a){let s=e.geometry.attributes.position;if(_X.fromBufferAttribute(s,r),_q.fromBufferAttribute(s,a),i.distanceSqToSegment(_X,_q,_$,_J)>n)return;_$.applyMatrix4(e.matrixWorld);let o=t.ray.origin.distanceTo(_$);if(!(o<t.near)&&!(o>t.far))return{distance:o,point:_J.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,object:e}}let _1=new fb,_2=new fb;class _3 extends _Q{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){let e=this.geometry;if(null===e.index){let t=e.attributes.position,i=[];for(let e=0,n=t.count;e<n;e+=2)_1.fromBufferAttribute(t,e),_2.fromBufferAttribute(t,e+1),i[e]=0===e?0:i[e-1],i[e+1]=i[e]+_1.distanceTo(_2);e.setAttribute("lineDistance",new mH(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class _5{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],i,n=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)t.push(r+=(i=this.getPoint(a/e)).distanceTo(n)),n=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i,n=this.getLengths(),r=0,a=n.length;i=t||e*n[a-1];let s=0,o=a-1,l;for(;s<=o;)if((l=n[r=Math.floor(s+(o-s)/2)]-i)<0)s=r+1;else if(l>0)o=r-1;else{o=r;break}if(n[r=o]===i)return r/(a-1);let c=n[r],h=n[r+1];return(r+(i-c)/(h-c))/(a-1)}getTangent(e,t){let i=e-1e-4,n=e+1e-4;i<0&&(i=0),n>1&&(n=1);let r=this.getPoint(i),a=this.getPoint(n),s=t||(r.isVector2?new p7:new fb);return s.copy(a).sub(r).normalize(),s}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new fb,n=[],r=[],a=[],s=new fb,o=new fQ;for(let t=0;t<=e;t++){let i=t/e;n[t]=this.getTangentAt(i,new fb)}r[0]=new fb,a[0]=new fb;let l=Number.MAX_VALUE,c=Math.abs(n[0].x),h=Math.abs(n[0].y),u=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),u<=l&&i.set(0,0,1),s.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],s),a[0].crossVectors(n[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),a[t]=a[t-1].clone(),s.crossVectors(n[t-1],n[t]),s.length()>Number.EPSILON){s.normalize();let e=Math.acos(p4(n[t-1].dot(n[t]),-1,1));r[t].applyMatrix4(o.makeRotationAxis(s,e))}a[t].crossVectors(n[t],r[t])}if(!0===t){let t=Math.acos(p4(r[0].dot(r[e]),-1,1));t/=e,n[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let i=1;i<=e;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],t*i)),a[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class _4 extends _5{constructor(e=0,t=0,i=1,n=1,r=0,a=2*Math.PI,s=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e,t=new p7){let i=2*Math.PI,n=this.aEndAngle-this.aStartAngle,r=Math.abs(n)<Number.EPSILON;for(;n<0;)n+=i;for(;n>i;)n-=i;n<Number.EPSILON&&(n=r?0:i),!0!==this.aClockwise||r||(n===i?n=-i:n-=i);let a=this.aStartAngle+e*n,s=this.aX+this.xRadius*Math.cos(a),o=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),i=s-this.aX,n=o-this.aY;s=i*e-n*t+this.aX,o=i*t+n*e+this.aY}return t.set(s,o)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}function _6(){let e=0,t=0,i=0,n=0;function r(r,a,s,o){e=r,t=s,i=-3*r+3*a-2*s-o,n=2*r-2*a+s+o}return{initCatmullRom:function(e,t,i,n,a){r(t,i,a*(i-e),a*(n-t))},initNonuniformCatmullRom:function(e,t,i,n,a,s,o){let l=(t-e)/a-(i-e)/(a+s)+(i-t)/s,c=(i-t)/s-(n-t)/(s+o)+(n-i)/o;r(t,i,l*=s,c*=s)},calc:function(r){let a=r*r;return e+t*r+i*a+a*r*n}}}let _8=new fb,_7=new _6,_9=new _6,xe=new _6;function xt(e,t,i,n,r){let a=(n-t)*.5,s=(r-i)*.5,o=e*e;return e*o*(2*i-2*n+a+s)+(-3*i+3*n-2*a-s)*o+a*e+i}function xi(e,t,i,n){let r;return(r=1-e)*r*t+2*(1-e)*e*i+e*e*n}function xn(e,t,i,n,r){let a,s;return(a=1-e)*a*a*t+3*(s=1-e)*s*e*i+3*(1-e)*e*e*n+e*e*e*r}class xr extends _5{constructor(e=new p7,t=new p7,i=new p7,n=new p7){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=n}getPoint(e,t=new p7){let i=this.v0,n=this.v1,r=this.v2,a=this.v3;return t.set(xn(e,i.x,n.x,r.x,a.x),xn(e,i.y,n.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class xa extends _5{constructor(e=new p7,t=new p7){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new p7){return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new p7){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class xs extends _5{constructor(e=new p7,t=new p7,i=new p7){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new p7){let i=this.v0,n=this.v1,r=this.v2;return t.set(xi(e,i.x,n.x,r.x),xi(e,i.y,n.y,r.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class xo extends _5{constructor(e=new fb,t=new fb,i=new fb){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new fb){let i=this.v0,n=this.v1,r=this.v2;return t.set(xi(e,i.x,n.x,r.x),xi(e,i.y,n.y,r.y),xi(e,i.z,n.z,r.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class xl extends _5{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new p7){let i=this.points,n=(i.length-1)*e,r=Math.floor(n),a=n-r,s=i[0===r?r:r-1],o=i[r],l=i[r>i.length-2?i.length-1:r+1],c=i[r>i.length-3?i.length-1:r+2];return t.set(xt(a,s.x,o.x,l.x,c.x),xt(a,s.y,o.y,l.y,c.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(i.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let i=e.points[t];this.points.push(new p7().fromArray(i))}return this}}class xc extends mU{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new mI(0xffffff),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new p7(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}function xh(e,t,i){return e&&(i||e.constructor!==t)?"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}class xu{constructor(e,t,i,n){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,n=t[i],r=t[i-1];e:{t:{let a;i:{n:if(!(e<n)){for(let a=i+2;;){if(void 0===n){if(e<r)break n;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(r=n,e<(n=t[++i]))break t}a=t.length;break i}if(!(e>=r)){let s=t[1];e<s&&(i=2,r=s);for(let a=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(n=r,e>=(r=t[--i-1]))break t}a=i,i=0;break i}break e}for(;i<a;){let n=i+a>>>1;e<t[n]?a=n:i=n+1}if(n=t[i],void 0===(r=t[i-1]))return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,e,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=e*n;for(let e=0;e!==n;++e)t[e]=i[r+e];return t}interpolate_(){throw Error("call to abstract method")}intervalChanged_(){}}class xd extends xu{constructor(e,t,i,n){super(e,t,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:2400,endingEnd:2400}}intervalChanged_(e,t,i){let n=this.parameterPositions,r=e-2,a=e+1,s=n[r],o=n[a];if(void 0===s)switch(this.getSettings_().endingStart){case 2401:r=e,s=2*t-i;break;case 2402:r=n.length-2,s=t+n[r]-n[r+1];break;default:r=e,s=i}if(void 0===o)switch(this.getSettings_().endingEnd){case 2401:a=e,o=2*i-t;break;case 2402:a=1,o=i+n[1]-n[0];break;default:a=e-1,o=t}let l=(i-t)*.5,c=this.valueSize;this._weightPrev=l/(t-s),this._weightNext=l/(o-i),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-t)/(n-t),f=p*p,m=f*p,g=-u*m+2*u*f-u*p,v=(1+u)*m+(-1.5-2*u)*f+(-.5+u)*p+1,_=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let e=0;e!==s;++e)r[e]=g*a[c+e]+v*a[l+e]+_*a[o+e]+x*a[h+e];return r}}class xp extends xu{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=e*s,l=o-s,c=(i-t)/(n-t),h=1-c;for(let e=0;e!==s;++e)r[e]=a[l+e]*h+a[o+e]*c;return r}}class xf extends xu{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e){return this.copySampleValue_(e-1)}}class xm{constructor(e,t,i,n){if(void 0===e)throw Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=xh(t,this.TimeBufferType),this.values=xh(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(e){let t,i=e.constructor;if(i.toJSON!==this.toJSON)t=i.toJSON(e);else{t={name:e.name,times:xh(e.times,Array),values:xh(e.values,Array)};let i=e.getInterpolation();i!==e.DefaultInterpolation&&(t.interpolation=i)}return t.type=e.ValueTypeName,t}InterpolantFactoryMethodDiscrete(e){return new xf(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new xp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new xd(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case 2300:t=this.InterpolantFactoryMethodDiscrete;break;case 2301:t=this.InterpolantFactoryMethodLinear;break;case 2302:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){let t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw Error(t);return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return 2300;case this.InterpolantFactoryMethodLinear:return 2301;case this.InterpolantFactoryMethodSmooth:return 2302}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]+=e}return this}scale(e){if(1!==e){let t=this.times;for(let i=0,n=t.length;i!==n;++i)t[i]*=e}return this}trim(e,t){let i=this.times,n=i.length,r=0,a=n-1;for(;r!==n&&i[r]<e;)++r;for(;-1!==a&&i[a]>t;)--a;if(++a,0!==r||a!==n){r>=a&&(r=(a=Math.max(a,1))-1);let e=this.getValueSize();this.times=i.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){var e;let t=!0,i=this.getValueSize();i-Math.floor(i)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let n=this.times,r=this.values,a=n.length;0===a&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==a;e++){let i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==r&&ArrayBuffer.isView(e=r)&&!(e instanceof DataView))for(let e=0,i=r.length;e!==i;++e){let i=r[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),n=2302===this.getInterpolation(),r=e.length-1,a=1;for(let s=1;s<r;++s){let r=!1,o=e[s];if(o!==e[s+1]&&(1!==s||o!==e[0]))if(n)r=!0;else{let e=s*i,n=e-i,a=e+i;for(let s=0;s!==i;++s){let i=t[e+s];if(i!==t[n+s]||i!==t[a+s]){r=!0;break}}}if(r){if(s!==a){e[a]=e[s];let n=s*i,r=a*i;for(let e=0;e!==i;++e)t[r+e]=t[n+e]}++a}}if(r>0){e[a]=e[r];for(let e=r*i,n=a*i,s=0;s!==i;++s)t[n+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=new this.constructor(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}xm.prototype.TimeBufferType=Float32Array,xm.prototype.ValueBufferType=Float32Array,xm.prototype.DefaultInterpolation=2301;class xg extends xm{constructor(e,t,i){super(e,t,i)}}xg.prototype.ValueTypeName="bool",xg.prototype.ValueBufferType=Array,xg.prototype.DefaultInterpolation=2300,xg.prototype.InterpolantFactoryMethodLinear=void 0,xg.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends xm{}).prototype.ValueTypeName="color",(class extends xm{}).prototype.ValueTypeName="number";class xv extends xu{constructor(e,t,i,n){super(e,t,i,n)}interpolate_(e,t,i,n){let r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(i-t)/(n-t),l=e*s;for(let e=l+s;l!==e;l+=4)fS.slerpFlat(r,0,a,l-s,a,l,o);return r}}class x_ extends xm{InterpolantFactoryMethodLinear(e){return new xv(this.times,this.values,this.getValueSize(),e)}}x_.prototype.ValueTypeName="quaternion",x_.prototype.InterpolantFactoryMethodSmooth=void 0;class xx extends xm{constructor(e,t,i){super(e,t,i)}}xx.prototype.ValueTypeName="string",xx.prototype.ValueBufferType=Array,xx.prototype.DefaultInterpolation=2300,xx.prototype.InterpolantFactoryMethodLinear=void 0,xx.prototype.InterpolantFactoryMethodSmooth=void 0,(class extends xm{}).prototype.ValueTypeName="vector";let xy="\\[\\]\\.:\\/",xM=RegExp("["+xy+"]","g"),xS="[^"+xy+"]",xb="[^"+xy.replace("\\.","")+"]",xE=RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",xS)+/(WCOD+)?/.source.replace("WCOD",xb)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xS)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xS)+"$"),xT=["material","materials","bones","map"];class xw{constructor(e,t,i){this.path=t,this.parsedPath=i||xw.parseTrackName(t),this.node=xw.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new xw.Composite(e,t,i):new xw(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(xM,"")}static parseTrackName(e){let t=xE.exec(e);if(null===t)throw Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){let e=i.nodeName.substring(n+1);-1!==xT.indexOf(e)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=e)}if(null===i.propertyName||0===i.propertyName.length)throw Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){let i=e.skeleton.getBoneByName(t);if(void 0!==i)return i}if(e.children){let i=function(e){for(let n=0;n<e.length;n++){let r=e[n];if(r.name===t||r.uuid===t)return r;let a=i(r.children);if(a)return a}return null},n=i(e.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)e[t++]=i[n]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,n=t.propertyName,r=t.propertyIndex;if(e||(e=xw.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=t.objectIndex;switch(i){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===n){n=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[i]}if(void 0!==n){if(void 0===e[n])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[n]}}let a=e[n];if(void 0===a)return void console.error("THREE.PropertyBinding: Trying to update property for track: "+t.nodeName+"."+n+" but it wasn't found.",e);let s=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?s=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}xw.Composite=class{constructor(e,t,i){const n=i||xw.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,n)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},xw.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},xw.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},xw.prototype.GetterByBindingType=[xw.prototype._getValue_direct,xw.prototype._getValue_array,xw.prototype._getValue_arrayElement,xw.prototype._getValue_toArray],xw.prototype.SetterByBindingTypeAndVersioning=[[xw.prototype._setValue_direct,xw.prototype._setValue_direct_setNeedsUpdate,xw.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[xw.prototype._setValue_array,xw.prototype._setValue_array_setNeedsUpdate,xw.prototype._setValue_array_setMatrixWorldNeedsUpdate],[xw.prototype._setValue_arrayElement,xw.prototype._setValue_arrayElement_setNeedsUpdate,xw.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[xw.prototype._setValue_fromArray,xw.prototype._setValue_fromArray_setNeedsUpdate,xw.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]],new Float32Array(1);let xA=new fQ;class xR{constructor(e,t,i=0,n=1/0){this.ray=new fJ(e,t),this.near=i,this.far=n,this.camera=null,this.layers=new me,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return xA.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(xA),this}intersectObject(e,t=!0,i=[]){return xP(e,this,i,t),i.sort(xC),i}intersectObjects(e,t=!0,i=[]){for(let n=0,r=e.length;n<r;n++)xP(e[n],this,i,t);return i.sort(xC),i}}function xC(e,t){return e.distance-t.distance}function xP(e,t,i,n){let r=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,i)&&(r=!1),!0===r&&!0===n){let n=e.children;for(let e=0,r=n.length;e<r;e++)xP(n[e],t,i,!0)}}class xL extends _3{constructor(e=10,t=10,i=4473924,n=8947848){i=new mI(i),n=new mI(n);const r=t/2,a=e/t,s=e/2,o=[],l=[];for(let e=0,c=0,h=-s;e<=t;e++,h+=a){o.push(-s,0,h,s,0,h),o.push(h,0,-s,h,0,s);const t=e===r?i:n;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new mZ;c.setAttribute("position",new mH(o,3)),c.setAttribute("color",new mH(l,3)),super(c,new _j({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"165"}})),"u">typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="165");var xI="u">typeof Float32Array?Float32Array:Array,xN=Math.random;function xD(e){return e>=0?Math.round(e):e%.5==0?Math.floor(e):Math.round(e)}function xU(){var e=new xI(16);return xI!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function xO(e){var t=new xI(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function xF(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function xB(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m){var g=new xI(16);return g[0]=e,g[1]=t,g[2]=i,g[3]=n,g[4]=r,g[5]=a,g[6]=s,g[7]=o,g[8]=l,g[9]=c,g[10]=h,g[11]=u,g[12]=d,g[13]=p,g[14]=f,g[15]=m,g}function xz(e,t,i,n,r,a,s,o,l,c,h,u,d,p,f,m,g){return e[0]=t,e[1]=i,e[2]=n,e[3]=r,e[4]=a,e[5]=s,e[6]=o,e[7]=l,e[8]=c,e[9]=h,e[10]=u,e[11]=d,e[12]=p,e[13]=f,e[14]=m,e[15]=g,e}function xk(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function xV(e,t){if(e===t){var i=t[1],n=t[2],r=t[3],a=t[6],s=t[7],o=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=i,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=r,e[13]=s,e[14]=o}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function xH(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],_=i*o-n*s,x=i*l-r*s,y=i*c-a*s,M=n*l-r*o,S=n*c-a*o,b=r*c-a*l,E=h*m-u*f,T=h*g-d*f,w=h*v-p*f,A=u*g-d*m,R=u*v-p*m,C=d*v-p*g,P=_*C-x*R+y*A+M*w-S*T+b*E;return P?(P=1/P,e[0]=(o*C-l*R+c*A)*P,e[1]=(r*R-n*C-a*A)*P,e[2]=(m*b-g*S+v*M)*P,e[3]=(d*S-u*b-p*M)*P,e[4]=(l*w-s*C-c*T)*P,e[5]=(i*C-r*w+a*T)*P,e[6]=(g*y-f*b-v*x)*P,e[7]=(h*b-d*y+p*x)*P,e[8]=(s*R-o*w+c*E)*P,e[9]=(n*w-i*R-a*E)*P,e[10]=(f*S-m*y+v*_)*P,e[11]=(u*y-h*S-p*_)*P,e[12]=(o*T-s*A-l*E)*P,e[13]=(i*A-n*T+r*E)*P,e[14]=(m*x-f*M-g*_)*P,e[15]=(h*M-u*x+d*_)*P,e):null}function xG(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],h=t[8],u=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],v=t[15],_=i*o-n*s,x=i*l-r*s,y=i*c-a*s,M=n*l-r*o,S=n*c-a*o,b=r*c-a*l,E=h*m-u*f,T=h*g-d*f,w=h*v-p*f,A=u*g-d*m,R=u*v-p*m,C=d*v-p*g;return e[0]=o*C-l*R+c*A,e[1]=r*R-n*C-a*A,e[2]=m*b-g*S+v*M,e[3]=d*S-u*b-p*M,e[4]=l*w-s*C-c*T,e[5]=i*C-r*w+a*T,e[6]=g*y-f*b-v*x,e[7]=h*b-d*y+p*x,e[8]=s*R-o*w+c*E,e[9]=n*w-i*R-a*E,e[10]=f*S-m*y+v*_,e[11]=u*y-h*S-p*_,e[12]=o*T-s*A-l*E,e[13]=i*A-n*T+r*E,e[14]=m*x-f*M-g*_,e[15]=h*M-u*x+d*_,e}function xW(e){var t=e[0],i=e[1],n=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],c=e[8],h=e[9],u=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=t*s-i*a,_=t*o-n*a,x=i*o-n*s,y=c*f-h*p,M=c*m-u*p,S=h*m-u*f;return l*(t*S-i*M+n*y)-r*(a*S-s*M+o*y)+g*(c*x-h*_+u*v)-d*(p*x-f*_+m*v)}function xj(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],v=t[14],_=t[15],x=i[0],y=i[1],M=i[2],S=i[3];return e[0]=x*n+y*o+M*u+S*m,e[1]=x*r+y*l+M*d+S*g,e[2]=x*a+y*c+M*p+S*v,e[3]=x*s+y*h+M*f+S*_,x=i[4],y=i[5],M=i[6],S=i[7],e[4]=x*n+y*o+M*u+S*m,e[5]=x*r+y*l+M*d+S*g,e[6]=x*a+y*c+M*p+S*v,e[7]=x*s+y*h+M*f+S*_,x=i[8],y=i[9],M=i[10],S=i[11],e[8]=x*n+y*o+M*u+S*m,e[9]=x*r+y*l+M*d+S*g,e[10]=x*a+y*c+M*p+S*v,e[11]=x*s+y*h+M*f+S*_,x=i[12],y=i[13],M=i[14],S=i[15],e[12]=x*n+y*o+M*u+S*m,e[13]=x*r+y*l+M*d+S*g,e[14]=x*a+y*c+M*p+S*v,e[15]=x*s+y*h+M*f+S*_,e}function xX(e,t,i){var n,r,a,s,o,l,c,h,u,d,p,f,m=i[0],g=i[1],v=i[2];return t===e?(e[12]=t[0]*m+t[4]*g+t[8]*v+t[12],e[13]=t[1]*m+t[5]*g+t[9]*v+t[13],e[14]=t[2]*m+t[6]*g+t[10]*v+t[14],e[15]=t[3]*m+t[7]*g+t[11]*v+t[15]):(n=t[0],r=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],e[0]=n,e[1]=r,e[2]=a,e[3]=s,e[4]=o,e[5]=l,e[6]=c,e[7]=h,e[8]=u,e[9]=d,e[10]=p,e[11]=f,e[12]=n*m+o*g+u*v+t[12],e[13]=r*m+l*g+d*v+t[13],e[14]=a*m+c*g+p*v+t[14],e[15]=s*m+h*g+f*v+t[15]),e}function xq(e,t,i){var n=i[0],r=i[1],a=i[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function xY(e,t,i,n){var r,a,s,o,l,c,h,u,d,p,f,m,g,v,_,x,y,M,S,b,E,T,w,A,R=n[0],C=n[1],P=n[2],L=Math.sqrt(R*R+C*C+P*P);return L<1e-6?null:(R*=L=1/L,C*=L,P*=L,r=Math.sin(i),s=1-(a=Math.cos(i)),o=t[0],l=t[1],c=t[2],h=t[3],u=t[4],d=t[5],p=t[6],f=t[7],m=t[8],g=t[9],v=t[10],_=t[11],x=R*R*s+a,y=C*R*s+P*r,M=P*R*s-C*r,S=R*C*s-P*r,b=C*C*s+a,E=P*C*s+R*r,T=R*P*s+C*r,w=C*P*s-R*r,A=P*P*s+a,e[0]=o*x+u*y+m*M,e[1]=l*x+d*y+g*M,e[2]=c*x+p*y+v*M,e[3]=h*x+f*y+_*M,e[4]=o*S+u*b+m*E,e[5]=l*S+d*b+g*E,e[6]=c*S+p*b+v*E,e[7]=h*S+f*b+_*E,e[8]=o*T+u*w+m*A,e[9]=l*T+d*w+g*A,e[10]=c*T+p*w+v*A,e[11]=h*T+f*w+_*A,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function xK(e,t,i){var n=Math.sin(i),r=Math.cos(i),a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*r+c*n,e[5]=s*r+h*n,e[6]=o*r+u*n,e[7]=l*r+d*n,e[8]=c*r-a*n,e[9]=h*r-s*n,e[10]=u*r-o*n,e[11]=d*r-l*n,e}function xZ(e,t,i){var n=Math.sin(i),r=Math.cos(i),a=t[0],s=t[1],o=t[2],l=t[3],c=t[8],h=t[9],u=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r-c*n,e[1]=s*r-h*n,e[2]=o*r-u*n,e[3]=l*r-d*n,e[8]=a*n+c*r,e[9]=s*n+h*r,e[10]=o*n+u*r,e[11]=l*n+d*r,e}function x$(e,t,i){var n=Math.sin(i),r=Math.cos(i),a=t[0],s=t[1],o=t[2],l=t[3],c=t[4],h=t[5],u=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*r+c*n,e[1]=s*r+h*n,e[2]=o*r+u*n,e[3]=l*r+d*n,e[4]=c*r-a*n,e[5]=h*r-s*n,e[6]=u*r-o*n,e[7]=d*r-l*n,e}function xJ(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function xQ(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x0(e,t,i){var n,r,a,s=i[0],o=i[1],l=i[2],c=Math.sqrt(s*s+o*o+l*l);return c<1e-6?null:(s*=c=1/c,o*=c,l*=c,n=Math.sin(t),a=1-(r=Math.cos(t)),e[0]=s*s*a+r,e[1]=o*s*a+l*n,e[2]=l*s*a-o*n,e[3]=0,e[4]=s*o*a-l*n,e[5]=o*o*a+r,e[6]=l*o*a+s*n,e[7]=0,e[8]=s*l*a+o*n,e[9]=o*l*a-s*n,e[10]=l*l*a+r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function x1(e,t){var i=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=i,e[7]=0,e[8]=0,e[9]=-i,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x2(e,t){var i=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-i,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=i,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x3(e,t){var i=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=i,e[2]=0,e[3]=0,e[4]=-i,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function x5(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=n+n,l=r+r,c=a+a,h=n*o,u=n*l,d=n*c,p=r*l,f=r*c,m=a*c,g=s*o,v=s*l,_=s*c;return e[0]=1-(p+m),e[1]=u+_,e[2]=d-v,e[3]=0,e[4]=u-_,e[5]=1-(h+m),e[6]=f+g,e[7]=0,e[8]=d+v,e[9]=f-g,e[10]=1-(h+p),e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function x4(e,t){var i=new xI(3),n=-t[0],r=-t[1],a=-t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=n*n+r*r+a*a+s*s;return u>0?(i[0]=(o*s+h*n+l*a-c*r)*2/u,i[1]=(l*s+h*r+c*n-o*a)*2/u,i[2]=(c*s+h*a+o*r-l*n)*2/u):(i[0]=(o*s+h*n+l*a-c*r)*2,i[1]=(l*s+h*r+c*n-o*a)*2,i[2]=(c*s+h*a+o*r-l*n)*2),x5(e,t,i),e}function x6(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function x8(e,t){var i=t[0],n=t[1],r=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],h=t[10];return e[0]=Math.sqrt(i*i+n*n+r*r),e[1]=Math.sqrt(a*a+s*s+o*o),e[2]=Math.sqrt(l*l+c*c+h*h),e}function x7(e,t){var i=new xI(3);x8(i,t);var n=1/i[0],r=1/i[1],a=1/i[2],s=t[0]*n,o=t[1]*r,l=t[2]*a,c=t[4]*n,h=t[5]*r,u=t[6]*a,d=t[8]*n,p=t[9]*r,f=t[10]*a,m=s+h+f,g=0;return m>0?(g=2*Math.sqrt(m+1),e[3]=.25*g,e[0]=(u-p)/g,e[1]=(d-l)/g,e[2]=(o-c)/g):s>h&&s>f?(g=2*Math.sqrt(1+s-h-f),e[3]=(u-p)/g,e[0]=.25*g,e[1]=(o+c)/g,e[2]=(d+l)/g):h>f?(g=2*Math.sqrt(1+h-s-f),e[3]=(d-l)/g,e[0]=(o+c)/g,e[1]=.25*g,e[2]=(u+p)/g):(g=2*Math.sqrt(1+f-s-h),e[3]=(o-c)/g,e[0]=(d+l)/g,e[1]=(u+p)/g,e[2]=.25*g),e}function x9(e,t,i,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];var r=n[0],a=n[1],s=n[2],o=n[4],l=n[5],c=n[6],h=n[8],u=n[9],d=n[10];i[0]=Math.sqrt(r*r+a*a+s*s),i[1]=Math.sqrt(o*o+l*l+c*c),i[2]=Math.sqrt(h*h+u*u+d*d);var p=1/i[0],f=1/i[1],m=1/i[2],g=r*p,v=a*f,_=s*m,x=o*p,y=l*f,M=c*m,S=h*p,b=u*f,E=d*m,T=g+y+E,w=0;return T>0?(w=2*Math.sqrt(T+1),e[3]=.25*w,e[0]=(M-b)/w,e[1]=(S-_)/w,e[2]=(v-x)/w):g>y&&g>E?(w=2*Math.sqrt(1+g-y-E),e[3]=(M-b)/w,e[0]=.25*w,e[1]=(v+x)/w,e[2]=(S+_)/w):y>E?(w=2*Math.sqrt(1+y-g-E),e[3]=(S-_)/w,e[0]=(v+x)/w,e[1]=.25*w,e[2]=(M+b)/w):(w=2*Math.sqrt(1+E-g-y),e[3]=(v-x)/w,e[0]=(S+_)/w,e[1]=(M+b)/w,e[2]=.25*w),e}function ye(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=t[3],l=r+r,c=a+a,h=s+s,u=r*l,d=r*c,p=r*h,f=a*c,m=a*h,g=s*h,v=o*l,_=o*c,x=o*h,y=n[0],M=n[1],S=n[2];return e[0]=(1-(f+g))*y,e[1]=(d+x)*y,e[2]=(p-_)*y,e[3]=0,e[4]=(d-x)*M,e[5]=(1-(u+g))*M,e[6]=(m+v)*M,e[7]=0,e[8]=(p+_)*S,e[9]=(m-v)*S,e[10]=(1-(u+f))*S,e[11]=0,e[12]=i[0],e[13]=i[1],e[14]=i[2],e[15]=1,e}function yt(e,t,i,n,r){var a=t[0],s=t[1],o=t[2],l=t[3],c=a+a,h=s+s,u=o+o,d=a*c,p=a*h,f=a*u,m=s*h,g=s*u,v=o*u,_=l*c,x=l*h,y=l*u,M=n[0],S=n[1],b=n[2],E=r[0],T=r[1],w=r[2],A=(1-(m+v))*M,R=(p+y)*M,C=(f-x)*M,P=(p-y)*S,L=(1-(d+v))*S,I=(g+_)*S,N=(f+x)*b,D=(g-_)*b,U=(1-(d+m))*b;return e[0]=A,e[1]=R,e[2]=C,e[3]=0,e[4]=P,e[5]=L,e[6]=I,e[7]=0,e[8]=N,e[9]=D,e[10]=U,e[11]=0,e[12]=i[0]+E-(A*E+P*T+N*w),e[13]=i[1]+T-(R*E+L*T+D*w),e[14]=i[2]+w-(C*E+I*T+U*w),e[15]=1,e}function yi(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=i+i,o=n+n,l=r+r,c=i*s,h=n*s,u=n*o,d=r*s,p=r*o,f=r*l,m=a*s,g=a*o,v=a*l;return e[0]=1-u-f,e[1]=h+v,e[2]=d-g,e[3]=0,e[4]=h-v,e[5]=1-c-f,e[6]=p+m,e[7]=0,e[8]=d+g,e[9]=p-m,e[10]=1-c-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function yn(e,t,i,n,r,a,s){var o=1/(i-t),l=1/(r-n),c=1/(a-s);return e[0]=2*a*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*a*l,e[6]=0,e[7]=0,e[8]=(i+t)*o,e[9]=(r+n)*l,e[10]=(s+a)*c,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*a*2*c,e[15]=0,e}function yr(e,t,i,n,r){var a=1/Math.tan(t/2);if(e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0){var s=1/(n-r);e[10]=(r+n)*s,e[14]=2*r*n*s}else e[10]=-1,e[14]=-2*n;return e}function ya(e,t,i,n,r){var a=1/Math.tan(t/2);if(e[0]=a/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=r&&r!==1/0){var s=1/(n-r);e[10]=r*s,e[14]=r*n*s}else e[10]=-1,e[14]=-n;return e}function ys(e,t,i,n){var r=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),c=2/(r+a);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=c,e[6]=0,e[7]=0,e[8]=-((s-o)*l*.5),e[9]=(r-a)*c*.5,e[10]=n/(i-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*i/(i-n),e[15]=0,e}function yo(e,t,i,n,r,a,s){var o=1/(t-i),l=1/(n-r),c=1/(a-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*c,e[11]=0,e[12]=(t+i)*o,e[13]=(r+n)*l,e[14]=(s+a)*c,e[15]=1,e}function yl(e,t,i,n,r,a,s){var o=1/(t-i),l=1/(n-r),c=1/(a-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=c,e[11]=0,e[12]=(t+i)*o,e[13]=(r+n)*l,e[14]=a*c,e[15]=1,e}function yc(e,t,i,n){var r,a,s,o,l,c,h,u,d,p,f=t[0],m=t[1],g=t[2],v=n[0],_=n[1],x=n[2],y=i[0],M=i[1],S=i[2];return 1e-6>Math.abs(f-y)&&1e-6>Math.abs(m-M)&&1e-6>Math.abs(g-S)?xk(e):(p=1/Math.sqrt((h=f-y)*h+(u=m-M)*u+(d=g-S)*d),h*=p,u*=p,d*=p,(p=Math.sqrt((r=_*d-x*u)*r+(a=x*h-v*d)*a+(s=v*u-_*h)*s))?(r*=p=1/p,a*=p,s*=p):(r=0,a=0,s=0),(p=Math.sqrt((o=u*s-d*a)*o+(l=d*r-h*s)*l+(c=h*a-u*r)*c))?(o*=p=1/p,l*=p,c*=p):(o=0,l=0,c=0),e[0]=r,e[1]=o,e[2]=h,e[3]=0,e[4]=a,e[5]=l,e[6]=u,e[7]=0,e[8]=s,e[9]=c,e[10]=d,e[11]=0,e[12]=-(r*f+a*m+s*g),e[13]=-(o*f+l*m+c*g),e[14]=-(h*f+u*m+d*g),e[15]=1,e)}function yh(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=n[0],l=n[1],c=n[2],h=r-i[0],u=a-i[1],d=s-i[2],p=h*h+u*u+d*d;p>0&&(h*=p=1/Math.sqrt(p),u*=p,d*=p);var f=l*d-c*u,m=c*h-o*d,g=o*u-l*h;return(p=f*f+m*m+g*g)>0&&(f*=p=1/Math.sqrt(p),m*=p,g*=p),e[0]=f,e[1]=m,e[2]=g,e[3]=0,e[4]=u*g-d*m,e[5]=d*f-h*g,e[6]=h*m-u*f,e[7]=0,e[8]=h,e[9]=u,e[10]=d,e[11]=0,e[12]=r,e[13]=a,e[14]=s,e[15]=1,e}function yu(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function yd(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]+e[4]*e[4]+e[5]*e[5]+e[6]*e[6]+e[7]*e[7]+e[8]*e[8]+e[9]*e[9]+e[10]*e[10]+e[11]*e[11]+e[12]*e[12]+e[13]*e[13]+e[14]*e[14]+e[15]*e[15])}function yp(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e[4]=t[4]+i[4],e[5]=t[5]+i[5],e[6]=t[6]+i[6],e[7]=t[7]+i[7],e[8]=t[8]+i[8],e[9]=t[9]+i[9],e[10]=t[10]+i[10],e[11]=t[11]+i[11],e[12]=t[12]+i[12],e[13]=t[13]+i[13],e[14]=t[14]+i[14],e[15]=t[15]+i[15],e}function yf(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e[4]=t[4]-i[4],e[5]=t[5]-i[5],e[6]=t[6]-i[6],e[7]=t[7]-i[7],e[8]=t[8]-i[8],e[9]=t[9]-i[9],e[10]=t[10]-i[10],e[11]=t[11]-i[11],e[12]=t[12]-i[12],e[13]=t[13]-i[13],e[14]=t[14]-i[14],e[15]=t[15]-i[15],e}function ym(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=t[11]*i,e[12]=t[12]*i,e[13]=t[13]*i,e[14]=t[14]*i,e[15]=t[15]*i,e}function yg(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e[2]=t[2]+i[2]*n,e[3]=t[3]+i[3]*n,e[4]=t[4]+i[4]*n,e[5]=t[5]+i[5]*n,e[6]=t[6]+i[6]*n,e[7]=t[7]+i[7]*n,e[8]=t[8]+i[8]*n,e[9]=t[9]+i[9]*n,e[10]=t[10]+i[10]*n,e[11]=t[11]+i[11]*n,e[12]=t[12]+i[12]*n,e[13]=t[13]+i[13]*n,e[14]=t[14]+i[14]*n,e[15]=t[15]+i[15]*n,e}function yv(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function y_(e,t){var i=e[0],n=e[1],r=e[2],a=e[3],s=e[4],o=e[5],l=e[6],c=e[7],h=e[8],u=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],v=e[15],_=t[0],x=t[1],y=t[2],M=t[3],S=t[4],b=t[5],E=t[6],T=t[7],w=t[8],A=t[9],R=t[10],C=t[11],P=t[12],L=t[13],I=t[14],N=t[15];return Math.abs(i-_)<=1e-6*Math.max(1,Math.abs(i),Math.abs(_))&&Math.abs(n-x)<=1e-6*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(r-y)<=1e-6*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(a-M)<=1e-6*Math.max(1,Math.abs(a),Math.abs(M))&&Math.abs(s-S)<=1e-6*Math.max(1,Math.abs(s),Math.abs(S))&&Math.abs(o-b)<=1e-6*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(l-E)<=1e-6*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-T)<=1e-6*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(h-w)<=1e-6*Math.max(1,Math.abs(h),Math.abs(w))&&Math.abs(u-A)<=1e-6*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(d-R)<=1e-6*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-C)<=1e-6*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(f-P)<=1e-6*Math.max(1,Math.abs(f),Math.abs(P))&&Math.abs(m-L)<=1e-6*Math.max(1,Math.abs(m),Math.abs(L))&&Math.abs(g-I)<=1e-6*Math.max(1,Math.abs(g),Math.abs(I))&&Math.abs(v-N)<=1e-6*Math.max(1,Math.abs(v),Math.abs(N))}e.s(["add",()=>yp,"adjoint",()=>xG,"clone",()=>xO,"copy",()=>xF,"create",()=>xU,"decompose",()=>x9,"determinant",()=>xW,"equals",()=>y_,"exactEquals",()=>yv,"frob",()=>yd,"fromQuat",()=>yi,"fromQuat2",()=>x4,"fromRotation",()=>x0,"fromRotationTranslation",()=>x5,"fromRotationTranslationScale",()=>ye,"fromRotationTranslationScaleOrigin",()=>yt,"fromScaling",()=>xQ,"fromTranslation",()=>xJ,"fromValues",()=>xB,"fromXRotation",()=>x1,"fromYRotation",()=>x2,"fromZRotation",()=>x3,"frustum",()=>yn,"getRotation",()=>x7,"getScaling",()=>x8,"getTranslation",()=>x6,"identity",()=>xk,"invert",()=>xH,"lookAt",()=>yc,"mul",()=>xj,"multiply",()=>xj,"multiplyScalar",()=>ym,"multiplyScalarAndAdd",()=>yg,"ortho",()=>yo,"orthoNO",()=>yo,"orthoZO",()=>yl,"perspective",()=>yr,"perspectiveFromFieldOfView",()=>ys,"perspectiveNO",()=>yr,"perspectiveZO",()=>ya,"rotate",()=>xY,"rotateX",()=>xK,"rotateY",()=>xZ,"rotateZ",()=>x$,"scale",()=>xq,"set",()=>xz,"str",()=>yu,"sub",()=>yf,"subtract",()=>yf,"targetTo",()=>yh,"translate",()=>xX,"transpose",()=>xV],53128);var yx=e.i(53128),yx=yx;function yy(){var e=new xI(3);return xI!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function yM(e){var t=new xI(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function yS(e){var t=e[0],i=e[1],n=e[2];return Math.sqrt(t*t+i*i+n*n)}function yb(e,t,i){var n=new xI(3);return n[0]=e,n[1]=t,n[2]=i,n}function yE(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function yT(e,t,i,n){return e[0]=t,e[1]=i,e[2]=n,e}function yw(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function yA(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function yR(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e}function yC(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e}function yP(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function yL(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function yI(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e}function yN(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e}function yD(e,t){return e[0]=xD(t[0]),e[1]=xD(t[1]),e[2]=xD(t[2]),e}function yU(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function yO(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e[2]=t[2]+i[2]*n,e}function yF(e,t){var i=t[0]-e[0],n=t[1]-e[1],r=t[2]-e[2];return Math.sqrt(i*i+n*n+r*r)}function yB(e,t){var i=t[0]-e[0],n=t[1]-e[1],r=t[2]-e[2];return i*i+n*n+r*r}function yz(e){var t=e[0],i=e[1],n=e[2];return t*t+i*i+n*n}function yk(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function yV(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function yH(e,t){var i=t[0],n=t[1],r=t[2],a=i*i+n*n+r*r;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function yG(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function yW(e,t,i){var n=t[0],r=t[1],a=t[2],s=i[0],o=i[1],l=i[2];return e[0]=r*l-a*o,e[1]=a*s-n*l,e[2]=n*o-r*s,e}function yj(e,t,i,n){var r=t[0],a=t[1],s=t[2];return e[0]=r+n*(i[0]-r),e[1]=a+n*(i[1]-a),e[2]=s+n*(i[2]-s),e}function yX(e,t,i,n){var r=Math.acos(Math.min(Math.max(yG(t,i),-1),1)),a=Math.sin(r),s=Math.sin((1-n)*r)/a,o=Math.sin(n*r)/a;return e[0]=s*t[0]+o*i[0],e[1]=s*t[1]+o*i[1],e[2]=s*t[2]+o*i[2],e}function yq(e,t,i,n,r,a){var s=a*a,o=s*(2*a-3)+1,l=s*(a-2)+a,c=s*(a-1),h=s*(3-2*a);return e[0]=t[0]*o+i[0]*l+n[0]*c+r[0]*h,e[1]=t[1]*o+i[1]*l+n[1]*c+r[1]*h,e[2]=t[2]*o+i[2]*l+n[2]*c+r[2]*h,e}function yY(e,t,i,n,r,a){var s=1-a,o=s*s,l=a*a,c=o*s,h=3*a*o,u=3*l*s,d=l*a;return e[0]=t[0]*c+i[0]*h+n[0]*u+r[0]*d,e[1]=t[1]*c+i[1]*h+n[1]*u+r[1]*d,e[2]=t[2]*c+i[2]*h+n[2]*u+r[2]*d,e}function yK(e,t){t=void 0===t?1:t;var i=2*xN()*Math.PI,n=2*xN()-1,r=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(i)*r,e[1]=Math.sin(i)*r,e[2]=n*t,e}function yZ(e,t,i){var n=t[0],r=t[1],a=t[2],s=i[3]*n+i[7]*r+i[11]*a+i[15];return s=s||1,e[0]=(i[0]*n+i[4]*r+i[8]*a+i[12])/s,e[1]=(i[1]*n+i[5]*r+i[9]*a+i[13])/s,e[2]=(i[2]*n+i[6]*r+i[10]*a+i[14])/s,e}function y$(e,t,i){var n=t[0],r=t[1],a=t[2];return e[0]=n*i[0]+r*i[3]+a*i[6],e[1]=n*i[1]+r*i[4]+a*i[7],e[2]=n*i[2]+r*i[5]+a*i[8],e}function yJ(e,t,i){var n=i[0],r=i[1],a=i[2],s=i[3],o=t[0],l=t[1],c=t[2],h=r*c-a*l,u=a*o-n*c,d=n*l-r*o;return h+=h,u+=u,d+=d,e[0]=o+s*h+r*d-a*u,e[1]=l+s*u+a*h-n*d,e[2]=c+s*d+n*u-r*h,e}function yQ(e,t,i,n){var r=[],a=[];return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],a[0]=r[0],a[1]=r[1]*Math.cos(n)-r[2]*Math.sin(n),a[2]=r[1]*Math.sin(n)+r[2]*Math.cos(n),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function y0(e,t,i,n){var r=[],a=[];return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],a[0]=r[2]*Math.sin(n)+r[0]*Math.cos(n),a[1]=r[1],a[2]=r[2]*Math.cos(n)-r[0]*Math.sin(n),e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function y1(e,t,i,n){var r=[],a=[];return r[0]=t[0]-i[0],r[1]=t[1]-i[1],r[2]=t[2]-i[2],a[0]=r[0]*Math.cos(n)-r[1]*Math.sin(n),a[1]=r[0]*Math.sin(n)+r[1]*Math.cos(n),a[2]=r[2],e[0]=a[0]+i[0],e[1]=a[1]+i[1],e[2]=a[2]+i[2],e}function y2(e,t){var i=e[0],n=e[1],r=e[2],a=t[0],s=t[1],o=t[2],l=Math.sqrt((i*i+n*n+r*r)*(a*a+s*s+o*o));return Math.acos(Math.min(Math.max(l&&yG(e,t)/l,-1),1))}function y3(e){return e[0]=0,e[1]=0,e[2]=0,e}function y5(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function y4(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function y6(e,t){var i=e[0],n=e[1],r=e[2],a=t[0],s=t[1],o=t[2];return Math.abs(i-a)<=1e-6*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-s)<=1e-6*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(r-o)<=1e-6*Math.max(1,Math.abs(r),Math.abs(o))}var y8=(r=yy(),function(e,t,i,n,a,s){var o,l;for(t||(t=3),i||(i=0),l=n?Math.min(n*t+i,e.length):e.length,o=i;o<l;o+=t)r[0]=e[o],r[1]=e[o+1],r[2]=e[o+2],a(r,r,s),e[o]=r[0],e[o+1]=r[1],e[o+2]=r[2];return e});e.s(["add",()=>yw,"angle",()=>y2,"bezier",()=>yY,"ceil",()=>yP,"clone",()=>yM,"copy",()=>yE,"create",()=>yy,"cross",()=>yW,"dist",()=>yF,"distance",()=>yF,"div",()=>yC,"divide",()=>yC,"dot",()=>yG,"equals",()=>y6,"exactEquals",()=>y4,"floor",()=>yL,"forEach",()=>y8,"fromValues",()=>yb,"hermite",()=>yq,"inverse",()=>yV,"len",()=>yS,"length",()=>yS,"lerp",()=>yj,"max",()=>yN,"min",()=>yI,"mul",()=>yR,"multiply",()=>yR,"negate",()=>yk,"normalize",()=>yH,"random",()=>yK,"rotateX",()=>yQ,"rotateY",()=>y0,"rotateZ",()=>y1,"round",()=>yD,"scale",()=>yU,"scaleAndAdd",()=>yO,"set",()=>yT,"slerp",()=>yX,"sqrDist",()=>yB,"sqrLen",()=>yz,"squaredDistance",()=>yB,"squaredLength",()=>yz,"str",()=>y5,"sub",()=>yA,"subtract",()=>yA,"transformMat3",()=>y$,"transformMat4",()=>yZ,"transformQuat",()=>yJ,"zero",()=>y3],72208);var y7=e.i(72208),y7=y7;let y9=Symbol("@iwer/action-player");Symbol("@iwer/action-recorder");let Me=Symbol("@iwer/xr-anchor"),Mt=Symbol("@iwer/xr-controller"),Mi=Symbol("@iwer/xr-device"),Mn=Symbol("@iwer/xr-hand-input"),Mr=Symbol("@iwer/xr-tracked-input"),Ma=Symbol("@iwer/xr-frame"),Ms=Symbol("@iwer/gamepad"),Mo=Symbol("@iwer/xr-system"),Ml=Symbol("@iwer/xr-input-source"),Mc=Symbol("@iwer/xr-webgl-layer"),Mh=Symbol("@iwer/xr-mesh"),Mu=Symbol("@iwer/xr-plane"),Md=Symbol("@iwer/xr-joint-pose"),Mp=Symbol("@iwer/xr-pose"),Mf=Symbol("@iwer/xr-viewer-pose"),Mm=Symbol("@iwer/xr-rigid-transform"),Mg=Symbol("@iwer/xr-render-state"),Mv=Symbol("@iwer/xr-session"),M_=Symbol("@iwer/xr-joint-space"),Mx=Symbol("@iwer/xr-reference-space"),My=Symbol("@iwer/xr-space"),MM=Symbol("@iwer/xr-view"),MS=Symbol("@iwer/xr-viewport"),Mb=Symbol("@iwer/xr-ray"),ME=Symbol("@iwer/xr-hit-test");class MT extends EventTarget{constructor(e,t){super(),this[My]={parentSpace:e,offsetMatrix:t?yx.clone(t):yx.create(),emulated:!0}}}class Mw extends MT{constructor(){super(void 0,yx.create())}}class MA{static updateOffsetPosition(e,t){let i=e[My].offsetMatrix;yx.fromTranslation(i,t)}static updateOffsetQuaternion(e,t){let i=e[My].offsetMatrix,n=y7.create();yx.getTranslation(n,i),yx.fromRotationTranslation(i,t,n)}static updateOffsetMatrix(e,t){let i=e[My].offsetMatrix;yx.copy(i,t)}static calculateGlobalOffsetMatrix(e,t=yx.create()){let i=e[My].parentSpace?MA.calculateGlobalOffsetMatrix(e[My].parentSpace):yx.create();return yx.multiply(t,i,e[My].offsetMatrix),t}}function MR(){var e=new xI(4);return xI!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function MC(e){var t=new xI(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function MP(e,t,i,n){var r=new xI(4);return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function ML(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function MI(e,t,i,n,r){return e[0]=t,e[1]=i,e[2]=n,e[3]=r,e}function MN(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e[3]=t[3]+i[3],e}function MD(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e[3]=t[3]-i[3],e}function MU(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function MO(e,t,i){return e[0]=t[0]/i[0],e[1]=t[1]/i[1],e[2]=t[2]/i[2],e[3]=t[3]/i[3],e}function MF(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function MB(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function Mz(e,t,i){return e[0]=Math.min(t[0],i[0]),e[1]=Math.min(t[1],i[1]),e[2]=Math.min(t[2],i[2]),e[3]=Math.min(t[3],i[3]),e}function Mk(e,t,i){return e[0]=Math.max(t[0],i[0]),e[1]=Math.max(t[1],i[1]),e[2]=Math.max(t[2],i[2]),e[3]=Math.max(t[3],i[3]),e}function MV(e,t){return e[0]=xD(t[0]),e[1]=xD(t[1]),e[2]=xD(t[2]),e[3]=xD(t[3]),e}function MH(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function MG(e,t,i,n){return e[0]=t[0]+i[0]*n,e[1]=t[1]+i[1]*n,e[2]=t[2]+i[2]*n,e[3]=t[3]+i[3]*n,e}function MW(e,t){var i=t[0]-e[0],n=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(i*i+n*n+r*r+a*a)}function Mj(e,t){var i=t[0]-e[0],n=t[1]-e[1],r=t[2]-e[2],a=t[3]-e[3];return i*i+n*n+r*r+a*a}function MX(e){var t=e[0],i=e[1],n=e[2],r=e[3];return Math.sqrt(t*t+i*i+n*n+r*r)}function Mq(e){var t=e[0],i=e[1],n=e[2],r=e[3];return t*t+i*i+n*n+r*r}function MY(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function MK(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function MZ(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=i*i+n*n+r*r+a*a;return s>0&&(s=1/Math.sqrt(s)),e[0]=i*s,e[1]=n*s,e[2]=r*s,e[3]=a*s,e}function M$(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function MJ(e,t,i,n){var r=i[0]*n[1]-i[1]*n[0],a=i[0]*n[2]-i[2]*n[0],s=i[0]*n[3]-i[3]*n[0],o=i[1]*n[2]-i[2]*n[1],l=i[1]*n[3]-i[3]*n[1],c=i[2]*n[3]-i[3]*n[2],h=t[0],u=t[1],d=t[2],p=t[3];return e[0]=u*c-d*l+p*o,e[1]=-(h*c)+d*s-p*a,e[2]=h*l-u*s+p*r,e[3]=-(h*o)+u*a-d*r,e}function MQ(e,t,i,n){var r=t[0],a=t[1],s=t[2],o=t[3];return e[0]=r+n*(i[0]-r),e[1]=a+n*(i[1]-a),e[2]=s+n*(i[2]-s),e[3]=o+n*(i[3]-o),e}function M0(e,t){t=void 0===t?1:t,i=2*(s=xN())-1,n=(4*xN()-2)*Math.sqrt(-(s*s)+s),r=2*(s=xN())-1;var i,n,r,a,s,o=Math.sqrt((1-(i*i+n*n))/(r*r+(a=(4*xN()-2)*Math.sqrt(-(s*s)+s))*a));return e[0]=t*i,e[1]=t*n,e[2]=t*r*o,e[3]=t*a*o,e}function M1(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3];return e[0]=i[0]*n+i[4]*r+i[8]*a+i[12]*s,e[1]=i[1]*n+i[5]*r+i[9]*a+i[13]*s,e[2]=i[2]*n+i[6]*r+i[10]*a+i[14]*s,e[3]=i[3]*n+i[7]*r+i[11]*a+i[15]*s,e}function M2(e,t,i){var n=i[0],r=i[1],a=i[2],s=i[3],o=t[0],l=t[1],c=t[2],h=r*c-a*l,u=a*o-n*c,d=n*l-r*o;return h+=h,u+=u,d+=d,e[0]=o+s*h+r*d-a*u,e[1]=l+s*u+a*h-n*d,e[2]=c+s*d+n*u-r*h,e[3]=t[3],e}function M3(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function M5(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function M4(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function M6(e,t){var i=e[0],n=e[1],r=e[2],a=e[3],s=t[0],o=t[1],l=t[2],c=t[3];return Math.abs(i-s)<=1e-6*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-o)<=1e-6*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-l)<=1e-6*Math.max(1,Math.abs(r),Math.abs(l))&&Math.abs(a-c)<=1e-6*Math.max(1,Math.abs(a),Math.abs(c))}var M8=(a=MR(),function(e,t,i,n,r,s){var o,l;for(t||(t=4),i||(i=0),l=n?Math.min(n*t+i,e.length):e.length,o=i;o<l;o+=t)a[0]=e[o],a[1]=e[o+1],a[2]=e[o+2],a[3]=e[o+3],r(a,a,s),e[o]=a[0],e[o+1]=a[1],e[o+2]=a[2],e[o+3]=a[3];return e});function M7(){var e=new xI(4);return xI!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function M9(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function Se(e,t,i){var n=Math.sin(i*=.5);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(i),e}function St(e,t){var i=2*Math.acos(t[3]),n=Math.sin(i/2);return n>1e-6?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),i}function Si(e,t){var i=Sx(e,t);return Math.acos(2*i*i-1)}function Sn(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=i[0],l=i[1],c=i[2],h=i[3];return e[0]=n*h+s*o+r*c-a*l,e[1]=r*h+s*l+a*o-n*c,e[2]=a*h+s*c+n*l-r*o,e[3]=s*h-n*o-r*l-a*c,e}function Sr(e,t,i){i*=.5;var n=t[0],r=t[1],a=t[2],s=t[3],o=Math.sin(i),l=Math.cos(i);return e[0]=n*l+s*o,e[1]=r*l+a*o,e[2]=a*l-r*o,e[3]=s*l-n*o,e}function Sa(e,t,i){i*=.5;var n=t[0],r=t[1],a=t[2],s=t[3],o=Math.sin(i),l=Math.cos(i);return e[0]=n*l-a*o,e[1]=r*l+s*o,e[2]=a*l+n*o,e[3]=s*l-r*o,e}function Ss(e,t,i){i*=.5;var n=t[0],r=t[1],a=t[2],s=t[3],o=Math.sin(i),l=Math.cos(i);return e[0]=n*l+r*o,e[1]=r*l-n*o,e[2]=a*l+s*o,e[3]=s*l-a*o,e}function So(e,t){var i=t[0],n=t[1],r=t[2];return e[0]=i,e[1]=n,e[2]=r,e[3]=Math.sqrt(Math.abs(1-i*i-n*n-r*r)),e}function Sl(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=Math.sqrt(i*i+n*n+r*r),o=Math.exp(a),l=s>0?o*Math.sin(s)/s:0;return e[0]=i*l,e[1]=n*l,e[2]=r*l,e[3]=o*Math.cos(s),e}function Sc(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=Math.sqrt(i*i+n*n+r*r),o=s>0?Math.atan2(s,a)/s:0;return e[0]=i*o,e[1]=n*o,e[2]=r*o,e[3]=.5*Math.log(i*i+n*n+r*r+a*a),e}function Sh(e,t,i){return Sc(e,t),S_(e,e,i),Sl(e,e),e}function Su(e,t,i,n){var r,a,s,o,l,c=t[0],h=t[1],u=t[2],d=t[3],p=i[0],f=i[1],m=i[2],g=i[3];return(a=c*p+h*f+u*m+d*g)<0&&(a=-a,p=-p,f=-f,m=-m,g=-g),1-a>1e-6?(s=Math.sin(r=Math.acos(a)),o=Math.sin((1-n)*r)/s,l=Math.sin(n*r)/s):(o=1-n,l=n),e[0]=o*c+l*p,e[1]=o*h+l*f,e[2]=o*u+l*m,e[3]=o*d+l*g,e}function Sd(e){var t=xN(),i=xN(),n=xN(),r=Math.sqrt(1-t),a=Math.sqrt(t);return e[0]=r*Math.sin(2*Math.PI*i),e[1]=r*Math.cos(2*Math.PI*i),e[2]=a*Math.sin(2*Math.PI*n),e[3]=a*Math.cos(2*Math.PI*n),e}function Sp(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=i*i+n*n+r*r+a*a,o=s?1/s:0;return e[0]=-i*o,e[1]=-n*o,e[2]=-r*o,e[3]=a*o,e}function Sf(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function Sm(e,t){var i,n=t[0]+t[4]+t[8];if(n>0)i=Math.sqrt(n+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var r=0;t[4]>t[0]&&(r=1),t[8]>t[3*r+r]&&(r=2);var a=(r+1)%3,s=(r+2)%3;i=Math.sqrt(t[3*r+r]-t[3*a+a]-t[3*s+s]+1),e[r]=.5*i,i=.5/i,e[3]=(t[3*a+s]-t[3*s+a])*i,e[a]=(t[3*a+r]+t[3*r+a])*i,e[s]=(t[3*s+r]+t[3*r+s])*i}return e}function Sg(e,t,i,n){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",a=Math.PI/360;t*=a,n*=a;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(i*=a),c=Math.cos(i),h=Math.sin(n),u=Math.cos(n);switch(r){case"xyz":e[0]=s*c*u+o*l*h,e[1]=o*l*u-s*c*h,e[2]=o*c*h+s*l*u,e[3]=o*c*u-s*l*h;break;case"xzy":e[0]=s*c*u-o*l*h,e[1]=o*l*u-s*c*h,e[2]=o*c*h+s*l*u,e[3]=o*c*u+s*l*h;break;case"yxz":e[0]=s*c*u+o*l*h,e[1]=o*l*u-s*c*h,e[2]=o*c*h-s*l*u,e[3]=o*c*u+s*l*h;break;case"yzx":e[0]=s*c*u+o*l*h,e[1]=o*l*u+s*c*h,e[2]=o*c*h-s*l*u,e[3]=o*c*u-s*l*h;break;case"zxy":e[0]=s*c*u-o*l*h,e[1]=o*l*u+s*c*h,e[2]=o*c*h+s*l*u,e[3]=o*c*u-s*l*h;break;case"zyx":e[0]=s*c*u-o*l*h,e[1]=o*l*u+s*c*h,e[2]=o*c*h-s*l*u,e[3]=o*c*u+s*l*h;break;default:throw Error("Unknown angle order "+r)}return e}function Sv(e){return"quat("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}e.s(["add",()=>MN,"ceil",()=>MF,"clone",()=>MC,"copy",()=>ML,"create",()=>MR,"cross",()=>MJ,"dist",()=>MW,"distance",()=>MW,"div",()=>MO,"divide",()=>MO,"dot",()=>M$,"equals",()=>M6,"exactEquals",()=>M4,"floor",()=>MB,"forEach",()=>M8,"fromValues",()=>MP,"inverse",()=>MK,"len",()=>MX,"length",()=>MX,"lerp",()=>MQ,"max",()=>Mk,"min",()=>Mz,"mul",()=>MU,"multiply",()=>MU,"negate",()=>MY,"normalize",()=>MZ,"random",()=>M0,"round",()=>MV,"scale",()=>MH,"scaleAndAdd",()=>MG,"set",()=>MI,"sqrDist",()=>Mj,"sqrLen",()=>Mq,"squaredDistance",()=>Mj,"squaredLength",()=>Mq,"str",()=>M5,"sub",()=>MD,"subtract",()=>MD,"transformMat4",()=>M1,"transformQuat",()=>M2,"zero",()=>M3],36239);var S_=MH,Sx=M$;function Sy(e,t){return Math.abs(M$(e,t))>=.999999}var SM=(s=yy(),o=yb(1,0,0),l=yb(0,1,0),function(e,t,i){var n=yG(t,i);return n<-.999999?(yW(s,o,t),1e-6>yS(s)&&yW(s,l,t),yH(s,s),Se(e,s,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(yW(s,t,i),e[0]=s[0],e[1]=s[1],e[2]=s[2],e[3]=1+n,MZ(e,e))}),SS=(c=M7(),h=M7(),function(e,t,i,n,r,a){return Su(c,t,r,a),Su(h,i,n,a),Su(e,c,h,2*a*(1-a)),e}),Sb=(u=new xI(9),xI!=Float32Array&&(u[1]=0,u[2]=0,u[3]=0,u[5]=0,u[6]=0,u[7]=0),u[0]=1,u[4]=1,u[8]=1,d=u,function(e,t,i,n){return d[0]=i[0],d[3]=i[1],d[6]=i[2],d[1]=n[0],d[4]=n[1],d[7]=n[2],d[2]=-t[0],d[5]=-t[1],d[8]=-t[2],MZ(e,Sm(e,d))});e.s(["add",()=>MN,"calculateW",()=>So,"clone",()=>MC,"conjugate",()=>Sf,"copy",()=>ML,"create",()=>M7,"dot",()=>Sx,"equals",()=>Sy,"exactEquals",()=>M4,"exp",()=>Sl,"fromEuler",()=>Sg,"fromMat3",()=>Sm,"fromValues",()=>MP,"getAngle",()=>Si,"getAxisAngle",()=>St,"identity",()=>M9,"invert",()=>Sp,"len",()=>MX,"length",()=>MX,"lerp",()=>MQ,"ln",()=>Sc,"mul",()=>Sn,"multiply",()=>Sn,"normalize",()=>MZ,"pow",()=>Sh,"random",()=>Sd,"rotateX",()=>Sr,"rotateY",()=>Sa,"rotateZ",()=>Ss,"rotationTo",()=>SM,"scale",()=>S_,"set",()=>MI,"setAxes",()=>Sb,"setAxisAngle",()=>Se,"slerp",()=>Su,"sqlerp",()=>SS,"sqrLen",()=>Mq,"squaredLength",()=>Mq,"str",()=>Sv],64795);var SE=e.i(64795),SE=SE,y7=y7;class ST{constructor(e=0,t=0,i=0){this.vec3=y7.fromValues(e,t,i),this.tempVec3=y7.create()}get x(){return this.vec3[0]}set x(e){this.vec3[0]=e}get y(){return this.vec3[1]}set y(e){this.vec3[1]=e}get z(){return this.vec3[2]}set z(e){this.vec3[2]=e}set(e,t,i){return y7.set(this.vec3,e,t,i),this}clone(){return new ST(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}normalize(){return y7.copy(this.tempVec3,this.vec3),y7.normalize(this.vec3,this.tempVec3),this}add(e){return y7.copy(this.tempVec3,this.vec3),y7.add(this.vec3,this.tempVec3,e.vec3),this}applyQuaternion(e){return y7.copy(this.tempVec3,this.vec3),y7.transformQuat(this.vec3,this.tempVec3,e.quat),this}}class Sw{constructor(e=0,t=0,i=0,n=1){this.quat=SE.fromValues(e,t,i,n),this.tempQuat=SE.create()}get x(){return this.quat[0]}set x(e){this.quat[0]=e}get y(){return this.quat[1]}set y(e){this.quat[1]=e}get z(){return this.quat[2]}set z(e){this.quat[2]=e}get w(){return this.quat[3]}set w(e){this.quat[3]=e}set(e,t,i,n){return SE.set(this.quat,e,t,i,n),this}clone(){return new Sw(this.x,this.y,this.z,this.w)}copy(e){return SE.set(this.quat,e.x,e.y,e.z,e.w),this}normalize(){return SE.copy(this.tempQuat,this.quat),SE.normalize(this.quat,this.tempQuat),this}invert(){return SE.copy(this.tempQuat,this.quat),SE.conjugate(this.quat,this.tempQuat),this}multiply(e){return SE.copy(this.tempQuat,this.quat),SE.multiply(this.quat,this.tempQuat,e.quat),this}setFromAxisAngle(e,t){return SE.setAxisAngle(this.quat,e.vec3,t),this}}(p=P||(P={})).None="",p.Standard="standard",p.XRStandard="xr-standard";class SA{constructor(e,t){this[Ms]={type:e,eventTrigger:t,pressed:!1,touched:!1,value:0,lastFrameValue:0,pendingValue:null}}get pressed(){return"manual"===this[Ms].type?this[Ms].pressed:this[Ms].value>0}get touched(){return"manual"===this[Ms].type?this[Ms].touched:this[Ms].touched||this.pressed}get value(){return this[Ms].value}}class SR{constructor(){this.pressed=!1,this.touched=!1,this.value=0}}class SC{constructor(e,t="",i=-1){this[Ms]={id:t,index:i,connected:!1,timestamp:performance.now(),mapping:e.mapping,buttonsMap:{},buttonsSequence:[],axesMap:{},axesSequence:[],hapticActuators:[]},e.buttons.forEach(e=>{var t;null===e?this[Ms].buttonsSequence.push(null):(this[Ms].buttonsSequence.push(e.id),this[Ms].buttonsMap[e.id]=new SA(e.type,null!=(t=e.eventTrigger)?t:null))}),e.axes.forEach(e=>{null===e?this[Ms].axesSequence.push(null):(this[Ms].axesSequence.push(e.id+e.type),this[Ms].axesMap[e.id]||(this[Ms].axesMap[e.id]={x:0,y:0}))})}get id(){return this[Ms].id}get index(){return this[Ms].index}get connected(){return this[Ms].connected}get timestamp(){return this[Ms].timestamp}get mapping(){return this[Ms].mapping}get axes(){let e=[];return this[Ms].axesSequence.forEach(t=>{if(null===t)e.push(null);else{let i=t.substring(0,t.length-6),n=t.substring(t.length-6);e.push("y-axis"===n?this[Ms].axesMap[i].y:this[Ms].axesMap[i].x)}}),e}get buttons(){return this[Ms].buttonsSequence.map(e=>null===e?new SR:this[Ms].buttonsMap[e])}get hapticActuators(){return this[Ms].hapticActuators}get vibrationActuator(){return null}}(f=L||(L={})).None="none",f.Left="left",f.Right="right",(m=I||(I={})).Gaze="gaze",m.TrackedPointer="tracked-pointer",m.Screen="screen",m.TransientPointer="transient-pointer";class SP extends Array{}class SL{constructor(e,t,i,n,r,a,s){this[Ml]={handedness:e,targetRayMode:t,targetRaySpace:n,gripSpace:a,profiles:i,gamepad:r,hand:s}}get handedness(){return this[Ml].handedness}get targetRayMode(){return this[Ml].targetRayMode}get targetRaySpace(){return this[Ml].targetRaySpace}get gripSpace(){return this[Ml].gripSpace}get profiles(){return this[Ml].profiles}get gamepad(){return this[Ml].gamepad}get hand(){return this[Ml].hand}}class SI extends Event{constructor(e,t){if(super(e,t),!t.frame)throw Error("XRInputSourceEventInit.frame is required");if(!t.inputSource)throw Error("XRInputSourceEventInit.inputSource is required");this.frame=t.frame,this.inputSource=t.inputSource}}var yx=yx;let SN={[L.Left]:{position:new ST(-.25,1.5,-.4),quaternion:new Sw},[L.Right]:{position:new ST(.25,1.5,-.4),quaternion:new Sw},[L.None]:{position:new ST(.25,1.5,-.4),quaternion:new Sw}};class SD{constructor(e){this[Mr]={inputSource:e,position:SN[e.handedness].position.clone(),quaternion:SN[e.handedness].quaternion.clone(),connected:!0,lastFrameConnected:!1,inputSourceChanged:!0}}get position(){return this[Mr].position}get quaternion(){return this[Mr].quaternion}get inputSource(){return this[Mr].inputSource}get connected(){return this[Mr].connected}set connected(e){this[Mr].connected=e,this[Mr].inputSource.gamepad[Ms].connected=e}onFrameStart(e){let t=this[Mr].inputSource.targetRaySpace;yx.fromRotationTranslation(t[My].offsetMatrix,this[Mr].quaternion.quat,this[Mr].position.vec3);let i=e.session;this[Mr].inputSource.gamepad.buttons.forEach(t=>{t instanceof SA&&(t[Ms].lastFrameValue=t[Ms].value,null!=t[Ms].pendingValue&&(t[Ms].value=t[Ms].pendingValue,t[Ms].pendingValue=null),null!=t[Ms].eventTrigger&&(0===t[Ms].lastFrameValue&&t[Ms].value>0?(i.dispatchEvent(new SI(t[Ms].eventTrigger,{frame:e,inputSource:this[Mr].inputSource})),i.dispatchEvent(new SI(t[Ms].eventTrigger+"start",{frame:e,inputSource:this[Mr].inputSource}))):t[Ms].lastFrameValue>0&&0===t[Ms].value&&i.dispatchEvent(new SI(t[Ms].eventTrigger+"end",{frame:e,inputSource:this[Mr].inputSource}))))}),this[Mr].inputSourceChanged=this.connected!==this[Mr].lastFrameConnected,this[Mr].lastFrameConnected=this.connected}}class SU extends SD{constructor(e,t,i){if(!e.layout[t])throw new DOMException("Handedness not supported","InvalidStateError");const n=new MT(i),r=e.layout[t].gripOffsetMatrix?new MT(n,e.layout[t].gripOffsetMatrix):void 0,a=[e.profileId,...e.fallbackProfileIds];super(new SL(t,I.TrackedPointer,a,n,new SC(e.layout[t].gamepad),r)),this[Mt]={profileId:e.profileId,gamepadConfig:e.layout[t].gamepad}}get gamepadConfig(){return this[Mt].gamepadConfig}get profileId(){return this[Mt].profileId}updateButtonValue(e,t){if(t>1||t<0)return void console.warn(`Out-of-range value ${t} provided for button ${e}.`);let i=this[Mr].inputSource.gamepad[Ms].buttonsMap[e];if(i){if("binary"===i[Ms].type&&1!=t&&0!=t)return void console.warn(`Non-binary value ${t} provided for binary button ${e}.`);i[Ms].pendingValue=t}else console.warn(`Current controller does not have button ${e}.`)}updateButtonTouch(e,t){let i=this[Mr].inputSource.gamepad[Ms].buttonsMap[e];i?i[Ms].touched=t:console.warn(`Current controller does not have button ${e}.`)}updateAxis(e,t,i){if(i>1||i<-1)return void console.warn(`Out-of-range value ${i} provided for ${e} axes.`);let n=this[Mr].inputSource.gamepad[Ms].axesMap[e];n?"x-axis"===t?n.x=i:"y-axis"===t&&(n.y=i):console.warn(`Current controller does not have ${e} axes.`)}updateAxes(e,t,i){if(t>1||t<-1||i>1||i<-1)return void console.warn(`Out-of-range value x:${t}, y:${i} provided for ${e} axes.`);let n=this[Mr].inputSource.gamepad[Ms].axesMap[e];n?(n.x=t,n.y=i):console.warn(`Current controller does not have ${e} axes.`)}}class SO{constructor(e,t,i,n,r){this[Mh]={nativeMesh:e,frame:void 0,meshSpace:t,vertices:i,indices:n,lastChangedTime:performance.now(),semanticLabel:r}}get meshSpace(){return this[Mh].meshSpace}get vertices(){return this[Mh].vertices}get indices(){return this[Mh].indices}get lastChangedTime(){return this[Mh].lastChangedTime}get semanticLabel(){return this[Mh].semanticLabel}}class SF extends Set{}class SB{constructor(e,t,i,n){this.transform=e,this.vertices=t,this.indices=i,this.semanticLabel=n}}(g=N||(N={})).Desk="desk",g.Couch="couch",g.Floor="floor",g.Ceiling="ceiling",g.Wall="wall",g.Door="door",g.Window="window",g.Table="table",g.Shelf="shelf",g.Bed="bed",g.Screen="screen",g.Lamp="lamp",g.Plant="plant",g.WallArt="wall art",g.GlobalMesh="global mesh",g.Other="other",(v=D||(D={})).Horizontal="horizontal",v.Vertical="vertical";let Sz={[N.Desk]:D.Horizontal,[N.Couch]:D.Horizontal,[N.Floor]:D.Horizontal,[N.Ceiling]:D.Horizontal,[N.Wall]:D.Vertical,[N.Door]:D.Vertical,[N.Window]:D.Vertical,[N.Table]:D.Horizontal,[N.Shelf]:D.Horizontal,[N.Bed]:D.Horizontal,[N.Screen]:D.Horizontal,[N.Lamp]:D.Horizontal,[N.Plant]:D.Horizontal,[N.WallArt]:D.Vertical};class Sk{constructor(e,t,i,n){this[Mu]={nativePlane:e,frame:void 0,planeSpace:t,polygon:i,lastChangedTime:performance.now(),semanticLabel:n,orientation:n?Sz[n]:void 0}}get planeSpace(){return this[Mu].planeSpace}get polygon(){return this[Mu].polygon}get orientation(){return this[Mu].orientation}get lastChangedTime(){return this[Mu].lastChangedTime}get semanticLabel(){return this[Mu].semanticLabel}}class SV extends Set{}class SH{constructor(e,t,i){this.transform=e,this.polygon=t,this.semanticLabel=i}}class SG{constructor(e,t){this[Me]={anchorSpace:e,session:t,deleted:!1},t[Mv].trackedAnchors.add(this)}get anchorSpace(){if(this[Me].deleted)throw new DOMException("XRAnchor has already been deleted.","InvalidStateError");return this[Me].anchorSpace}requestPersistentHandle(){return new Promise((e,t)=>{if(this[Me].deleted)t(new DOMException("XRAnchor has already been deleted.","InvalidStateError"));else{for(let[t,i]of this[Me].session[Mv].persistentAnchors.entries())if(i===this)return void e(t);let t=crypto.randomUUID();SX.createPersistentAnchor(this[Me].session,this,t),e(t)}})}delete(){this[Me].deleted||(this[Me].anchorSpace=null,this[Me].deleted=!0,this[Me].session[Mv].trackedAnchors.delete(this))}}class SW extends Set{}let Sj="@immersive-web-emulation-runtime/persistent-anchors";class SX{static recoverPersistentAnchorsFromStorage(e){Object.entries(JSON.parse(localStorage.getItem(Sj)||"{}")).forEach(([t,i])=>{let n=new SG(new MT(e[Mv].device[Mi].globalSpace,i),e);e[Mv].persistentAnchors.set(t,n)})}static createPersistentAnchor(e,t,i){e[Mv].trackedAnchors.add(t),e[Mv].persistentAnchors.set(i,t);let n=JSON.parse(localStorage.getItem(Sj)||"{}");n[i]=Array.from(t[Me].anchorSpace[My].offsetMatrix),localStorage.setItem(Sj,JSON.stringify(n))}}var yx=yx,y7=y7,Sq=e.i(36239),Sq=Sq,yx=yx,SE=SE,y7=y7;class SY{constructor(e,t){const i=y7.fromValues(0,0,0),n=SE.create();this[Mm]={matrix:yx.create(),position:e?y7.fromValues(e.x,e.y,e.z):i,orientation:t?SE.normalize(SE.create(),SE.fromValues(t.x,t.y,t.z,t.w)):n,inverse:null},this.updateMatrix()}updateMatrix(){yx.fromRotationTranslation(this[Mm].matrix,this[Mm].orientation,this[Mm].position)}get matrix(){return this[Mm].matrix}get position(){let e=this[Mm].position;return new DOMPointReadOnly(e[0],e[1],e[2],1)}get orientation(){let e=this[Mm].orientation;return new DOMPointReadOnly(e[0],e[1],e[2],e[3])}get inverse(){if(!this[Mm].inverse){let e=yx.create();if(!yx.invert(e,this[Mm].matrix))throw Error("Matrix is not invertible.");let t=y7.create();yx.getTranslation(t,e);let i=SE.create();yx.getRotation(i,e),this[Mm].inverse=new SY(new DOMPointReadOnly(t[0],t[1],t[2],1),new DOMPointReadOnly(i[0],i[1],i[2],i[3])),this[Mm].inverse[Mm].inverse=this}return this[Mm].inverse}}class SK{constructor(e=0,t=0,i=0,n=1){this.x=e,this.y=t,this.z=i,this.w=n}}class SZ{constructor(e,t){const i={x:0,y:0,z:0,w:1},n={x:0,y:0,z:-1,w:0};if(e instanceof SY){const t=e.matrix,r=Sq.set(Sq.create(),i.x,i.y,i.z,i.w),a=Sq.set(Sq.create(),n.x,n.y,n.z,n.w);Sq.transformMat4(r,r,t),Sq.transformMat4(a,a,t),i.x=r[0],i.y=r[1],i.z=r[2],i.w=r[3],n.x=a[0],n.y=a[1],n.z=a[2],n.w=a[3]}else if(e&&(i.x=e.x,i.y=e.y,i.z=e.z,i.w=e.w),t){if(0===t.x&&0===t.y&&0===t.z||0!==t.w)throw new DOMException("Invalid direction value to construct XRRay","TypeError");n.x=t.x,n.y=t.y,n.z=t.z,n.w=t.w}const r=Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z)||1;n.x=n.x/r,n.y=n.y/r,n.z=n.z/r,this[Mb]={origin:new SK(i.x,i.y,i.z,i.w),direction:new SK(n.x,n.y,n.z,n.w),matrix:null}}get origin(){return this[Mb].origin}get direction(){return this[Mb].direction}get matrix(){if(this[Mb].matrix)return this[Mb].matrix;let e=y7.set(y7.create(),0,0,-1),t=y7.set(y7.create(),this[Mb].origin.x,this[Mb].origin.y,this[Mb].origin.z),i=y7.set(y7.create(),this[Mb].direction.x,this[Mb].direction.y,this[Mb].direction.z),n=y7.cross(y7.create(),i,e),r=y7.dot(i,e),a=yx.create();r>-1&&r<1?yx.fromRotation(a,Math.acos(r),n):-1===r?yx.fromRotation(a,Math.acos(r),y7.set(y7.create(),1,0,0)):yx.identity(a);let s=yx.fromTranslation(yx.create(),t),o=yx.multiply(yx.create(),s,a);return this[Mb].matrix=new Float32Array(o),this[Mb].matrix}}class S${constructor(e,t){var i;this[ME]={session:e,space:t.space,offsetRay:null!=(i=t.offsetRay)?i:new SZ}}cancel(){this[ME].session[Mv].hitTestSources.delete(this)}}class SJ{constructor(e,t){this[ME]={frame:e,offsetSpace:t}}getPose(e){return this[ME].frame.getPose(this[ME].offsetSpace,e)}createAnchor(){return this[ME].frame.createAnchor(new SY,this[ME].offsetSpace)}}class SQ extends Event{constructor(e,t){if(super(e,t),!t.session)throw Error("XRInputSourcesChangeEventInit.session is required");if(!t.added)throw Error("XRInputSourcesChangeEventInit.added is required");if(!t.removed)throw Error("XRInputSourcesChangeEventInit.removed is required");this.session=t.session,this.added=t.added,this.removed=t.removed}}(_=O||(O={})).Viewer="viewer",_.Local="local",_.LocalFloor="local-floor",_.BoundedFloor="bounded-floor",_.Unbounded="unbounded";class S0 extends MT{constructor(e,t,i){super(t,i),this[U]={type:null,onreset:()=>{}},this[Mx].type=e}get onreset(){var e;return null!=(e=this[Mx].onreset)?e:()=>{}}set onreset(e){this[Mx].onreset&&this.removeEventListener("reset",this[Mx].onreset),this[Mx].onreset=e,e&&this.addEventListener("reset",e)}getOffsetReferenceSpace(e){return new S0(this[Mx].type,this,e)}}U=Mx;class S1{constructor(e={},t){this[Mg]={depthNear:e.depthNear||(null==t?void 0:t.depthNear)||.1,depthFar:e.depthFar||(null==t?void 0:t.depthFar)||1e3,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null==t?void 0:t.inlineVerticalFieldOfView)||null,baseLayer:e.baseLayer||(null==t?void 0:t.baseLayer)||null}}get depthNear(){return this[Mg].depthNear}get depthFar(){return this[Mg].depthFar}get inlineVerticalFieldOfView(){return this[Mg].inlineVerticalFieldOfView}get baseLayer(){return this[Mg].baseLayer}}class S2 extends Event{constructor(e,t){if(super(e,t),!t.session)throw Error("XRSessionEventInit.session is required");this.session=t.session}}(x=F||(F={})).None="none",x.Left="left",x.Right="right";class S3{constructor(e,t,i,n){this[MM]={eye:e,projectionMatrix:t,transform:i,recommendedViewportScale:null,requestedViewportScale:1,session:n}}get eye(){return this[MM].eye}get projectionMatrix(){return this[MM].projectionMatrix}get transform(){return this[MM].transform}get recommendedViewportScale(){return this[MM].recommendedViewportScale}requestViewportScale(e){null===e||e<=0||e>1?console.warn("Invalid scale value. Scale must be > 0 and <= 1."):this[MM].requestedViewportScale=e}}var yx=yx,SE=SE,y7=y7;class S5{constructor(e,t=!1,i,n){this[Mp]={transform:e,emulatedPosition:t,linearVelocity:i,angularVelocity:n}}get transform(){return this[Mp].transform}get emulatedPosition(){return this[Mp].emulatedPosition}get linearVelocity(){return this[Mp].linearVelocity}get angularVelocity(){return this[Mp].angularVelocity}}class S4 extends S5{constructor(e,t,i=!1,n,r){super(e,i,n,r),this[Md]={radius:t}}get radius(){return this[Md].radius}}class S6 extends S5{constructor(e,t,i=!1,n,r){super(e,i,n,r),this[Mf]={views:Object.freeze(t)}}get views(){return this[Mf].views}}let S8=yx.create(),S7=yx.create(),S9=yx.create(),be=(e,t,i)=>{MA.calculateGlobalOffsetMatrix(t,S8),MA.calculateGlobalOffsetMatrix(i,S7),yx.invert(S9,S7),yx.multiply(e,S9,S8)};class bt{constructor(e,t,i,n,r){this[Ma]={session:e,id:t,active:i,animationFrame:n,predictedDisplayTime:r,tempMat4:yx.create(),detectedPlanes:new SV,detectedMeshes:new SF,trackedAnchors:e[Mv].frameTrackedAnchors,hitTestResultsMap:new Map}}get session(){return this[Ma].session}get predictedDisplayTime(){return this[Ma].predictedDisplayTime}getPose(e,t){if(!this[Ma].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");be(this[Ma].tempMat4,e,t);let i=y7.create();yx.getTranslation(i,this[Ma].tempMat4);let n=SE.create();return yx.getRotation(n,this[Ma].tempMat4),new S5(new SY({x:i[0],y:i[1],z:i[2],w:1},{x:n[0],y:n[1],z:n[2],w:n[3]}),e[My].emulated)}getViewerPose(e){if(!this[Ma].animationFrame)throw new DOMException("getViewerPose can only be called on XRFrame objects passed to XRSession.requestAnimationFrame callbacks.","InvalidStateError");let t=this[Ma].session,i=t[Mv].device,n=this.getPose(i.viewerSpace,e),r="inline"===t[Mv].mode?[F.None]:[F.Left,F.Right],a=[];return r.forEach(n=>{let r=i.viewSpaces[n],s=this.getPose(r,e),o=t[Mv].getProjectionMatrix(n),l=new S3(n,new Float32Array(o),s.transform,t);a.push(l)}),new S6(n.transform,a,!1)}getJointPose(e,t){let i=this.getPose(e,t),n=e[M_].radius;return new S4(i.transform,n,!1)}fillJointRadii(e,t){if(e=Array.from(e),!this[Ma].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(e.length>t.length)throw new DOMException("The length of jointSpaces is larger than the number of elements in radii","TypeError");let i=!0;for(let n=0;n<e.length;n++)e[n][M_].radius?t[n]=e[n][M_].radius:(t[n]=NaN,i=!1);return i}fillPoses(e,t,i){if(e=Array.from(e),!this[Ma].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");if(16*e.length>i.length)throw new DOMException("The length of spaces multiplied by 16 is larger than the number of elements in transforms","TypeError");return e.forEach((e,n)=>{be(this[Ma].tempMat4,e,t);for(let e=0;e<16;e++)i[16*n+e]=this[Ma].tempMat4[e]}),!0}get detectedPlanes(){if(!this[Ma].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");return this[Ma].detectedPlanes}get detectedMeshes(){if(!this[Ma].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");return this[Ma].detectedMeshes}get trackedAnchors(){if(!this[Ma].active)throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError");return this[Ma].trackedAnchors}createAnchor(e,t){return new Promise((i,n)=>{if(this[Ma].active){let r=this[Ma].session[Mv].device[Mi].globalSpace,a=new MT(t,e.matrix),s=new SG(new MT(r,MA.calculateGlobalOffsetMatrix(a)),this[Ma].session);this[Ma].session[Mv].trackedAnchors.add(s),this[Ma].session[Mv].newAnchors.set(s,{resolve:i,reject:n})}else n(new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError"))})}getHitTestResults(e){if(this[Ma].active)if(this[Ma].hitTestResultsMap.has(e))return[...this[Ma].hitTestResultsMap.get(e)];else throw new DOMException("Requested hit test results are not available for current frame.","InvalidStateError");throw new DOMException("XRFrame access outside the callback that produced it is invalid.","InvalidStateError")}}var yx=yx;(y=B||(B={})).Opaque="opaque",y.AlphaBlend="alpha-blend",y.Additive="additive",(M=z||(z={})).ScreenSpace="screen-space",M.WorldSpace="world-space";class bi extends EventTarget{constructor(e,t,i){super(),this[Mv]={device:e,mode:t,renderState:new S1,pendingRenderState:null,enabledFeatures:i,isSystemKeyboardSupported:!1,ended:!1,projectionMatrices:{[F.Left]:yx.create(),[F.Right]:yx.create(),[F.None]:yx.create()},getProjectionMatrix:e=>this[Mv].projectionMatrices[e],referenceSpaceIsSupported:e=>{if(!this[Mv].enabledFeatures.includes(e))return!1;switch(e){case O.Viewer:return!0;case O.Local:case O.LocalFloor:case O.BoundedFloor:case O.Unbounded:return"inline"!=this[Mv].mode}},frameHandle:0,frameCallbacks:[],currentFrameCallbacks:null,onDeviceFrame:()=>{if(this[Mv].ended)return;this[Mv].deviceFrameHandle=globalThis.requestAnimationFrame(this[Mv].onDeviceFrame),null!=this[Mv].pendingRenderState&&(this[Mv].renderState=this[Mv].pendingRenderState,this[Mv].pendingRenderState=null,this[Mv].device[Mi].onBaseLayerSet(this[Mv].renderState.baseLayer));let e=this[Mv].renderState.baseLayer;if(null===e)return;let t=e.context,i=t.canvas;if("inline"!=this[Mv].mode){let e=t.getParameter(t.COLOR_CLEAR_VALUE),i=t.getParameter(t.DEPTH_CLEAR_VALUE),n=t.getParameter(t.STENCIL_CLEAR_VALUE);t.clearColor(0,0,0,0),t.clearDepth(1),t.clearStencil(0),t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),t.clearColor(e[0],e[1],e[2],e[3]),t.clearDepth(i),t.clearStencil(n)}let{depthNear:n,depthFar:r}=this[Mv].renderState,{width:a,height:s}=i;if("inline"!==this[Mv].mode){let e=a*(this[Mv].device.stereoEnabled?.5:1)/s;yx.perspective(this[Mv].projectionMatrices[F.Left],this[Mv].device.fovy,e,n,r),yx.copy(this[Mv].projectionMatrices[F.Right],this[Mv].projectionMatrices[F.Left])}else yx.perspective(this[Mv].projectionMatrices[F.None],this[Mv].renderState.inlineVerticalFieldOfView,a/s,n,r);let o=new bt(this,this[Mv].frameHandle,!0,!0,performance.now()),l=performance.now(),c=this[Mv].device[Mi].devui;if(c&&c.render(l),"immersive-ar"===this[Mv].mode){let e=this[Mv].device[Mi].sem;e&&e.render(l)}this[Mv].enabledFeatures.includes("anchors")&&this[Mv].updateTrackedAnchors(),this[Mv].enabledFeatures.includes("plane-detection")&&this[Mv].updateTrackedPlanes(o),this[Mv].enabledFeatures.includes("mesh-detection")&&this[Mv].updateTrackedMeshes(o),this[Mv].enabledFeatures.includes("hit-test")&&this[Mv].computeHitTestResults(o),this[Mv].device[Mi].onFrameStart(o),this[Mv].updateActiveInputSources();let h=this[Mv].currentFrameCallbacks=this[Mv].frameCallbacks;this[Mv].frameCallbacks=[];let u=performance.now();for(let e=0;e<h.length;e++)try{h[e].cancelled||h[e].callback(u,o)}catch(e){console.error(e)}this[Mv].currentFrameCallbacks=null,o[Ma].active=!1},nominalFrameRate:e.internalNominalFrameRate,referenceSpaces:[],inputSourceArray:[],activeInputSources:[],updateActiveInputSources:()=>{let e=this[Mv].enabledFeatures.includes("hand-tracking"),t=this[Mv].activeInputSources,i=this[Mv].device.inputSources.filter(t=>!t.hand||e),n=i.filter(e=>!t.includes(e)),r=t.filter(e=>!i.includes(e));this[Mv].activeInputSources=i,(n.length>0||r.length>0)&&this.dispatchEvent(new SQ("inputsourceschange",{session:this,added:n,removed:r}))},trackedAnchors:new SW,persistentAnchors:new Map,newAnchors:new Map,frameTrackedAnchors:new SW,updateTrackedAnchors:()=>{this[Mv].enabledFeatures.includes("anchors")&&(this[Mv].frameTrackedAnchors.clear(),Array.from(this[Mv].trackedAnchors).forEach(e=>{if(e[Me].deleted){if(this[Mv].trackedAnchors.delete(e),this[Mv].newAnchors.has(e)){let{reject:t}=this[Mv].newAnchors.get(e);t(new DOMException("Anchor is no longer tracked","InvalidStateError"))}}else if(this[Mv].frameTrackedAnchors.add(e),this[Mv].newAnchors.has(e)){let{resolve:t}=this[Mv].newAnchors.get(e);t(e),this[Mv].newAnchors.delete(e)}}))},trackedPlanes:new Map,updateTrackedPlanes:e=>{let t=this[Mv].device[Mi].sem;t&&(Array.from(this[Mv].trackedPlanes.keys()).forEach(e=>{t.trackedPlanes.has(e)||this[Mv].trackedPlanes.delete(e)}),t.trackedPlanes.forEach(t=>{let i=this[Mv].trackedPlanes.get(t);if(!i){let e=new MT(this[Mv].device[Mi].globalSpace,t.transform.matrix);i=new Sk(t,e,t.polygon,t.semanticLabel),this[Mv].trackedPlanes.set(t,i)}i[Mu].lastChangedTime=e.predictedDisplayTime,i[Mu].frame=e,e[Ma].detectedPlanes.add(i)}))},trackedMeshes:new Map,updateTrackedMeshes:e=>{let t=this[Mv].device[Mi].sem;t&&(Array.from(this[Mv].trackedMeshes.keys()).forEach(e=>{t.trackedMeshes.has(e)||this[Mv].trackedMeshes.delete(e)}),t.trackedMeshes.forEach(t=>{let i=this[Mv].trackedMeshes.get(t);if(!i){let e=new MT(this[Mv].device[Mi].globalSpace,t.transform.matrix);i=new SO(t,e,t.vertices,t.indices,t.semanticLabel),this[Mv].trackedMeshes.set(t,i)}i[Mh].lastChangedTime=e.predictedDisplayTime,i[Mh].frame=e,e[Ma].detectedMeshes.add(i)}))},hitTestSources:new Set,computeHitTestResults:e=>{let t=this[Mv].device[Mi].sem;if(!t)return;let i=this[Mv].device[Mi].globalSpace;this[Mv].hitTestSources.forEach(n=>{let r=n[ME].space,a=MA.calculateGlobalOffsetMatrix(r),s=n[ME].offsetRay.matrix,o=yx.create();yx.multiply(o,a,s);let l=[];t.computeHitTestResults(o).forEach(t=>{let n=new SJ(e,new MT(i,t));l.push(n)}),e[Ma].hitTestResultsMap.set(n,l)})},onend:null,oninputsourceschange:null,onselect:null,onselectstart:null,onselectend:null,onsqueeze:null,onsqueezestart:null,onsqueezeend:null,onvisibilitychange:null,onframeratechange:null},SX.recoverPersistentAnchorsFromStorage(this),this[Mv].onDeviceFrame()}get visibilityState(){return this[Mv].device.visibilityState}get frameRate(){return this[Mv].nominalFrameRate}get supportedFrameRates(){return new Float32Array(this[Mv].device.supportedFrameRates)}get renderState(){return this[Mv].renderState}get inputSources(){return this[Mv].inputSourceArray.length=0,this[Mv].ended||"inline"===this[Mv].mode||this[Mv].inputSourceArray.push(...this[Mv].activeInputSources),this[Mv].inputSourceArray}get enabledFeatures(){return this[Mv].enabledFeatures}get isSystemKeyboardSupported(){return this[Mv].isSystemKeyboardSupported}get environmentBlendMode(){var e;return null!=(e=this[Mv].device[Mi].environmentBlendModes[this[Mv].mode])?e:B.Opaque}get interactionMode(){return this[Mv].device[Mi].interactionMode}updateRenderState(e={}){var t,i,n,r;if(this[Mv].ended)throw new DOMException("XRSession has already ended.","InvalidStateError");if(e.baseLayer&&e.baseLayer[Mc].session!==this)throw new DOMException("Base layer was created by a different XRSession","InvalidStateError");if(null!=e.inlineVerticalFieldOfView&&"inline"!==this[Mv].mode)throw new DOMException("InlineVerticalFieldOfView must not be set for an immersive session","InvalidStateError");let a={baseLayer:e.baseLayer||(null==(t=this[Mv].pendingRenderState)?void 0:t.baseLayer)||void 0,depthFar:e.depthFar||(null==(i=this[Mv].pendingRenderState)?void 0:i.depthFar)||void 0,depthNear:e.depthNear||(null==(n=this[Mv].pendingRenderState)?void 0:n.depthNear)||void 0,inlineVerticalFieldOfView:e.inlineVerticalFieldOfView||(null==(r=this[Mv].pendingRenderState)?void 0:r.inlineVerticalFieldOfView)||void 0};this[Mv].pendingRenderState=new S1(a,this[Mv].renderState)}async updateTargetFrameRate(e){return new Promise((t,i)=>{this[Mv].ended?i(new DOMException("XRSession has already ended.","InvalidStateError")):this[Mv].device.supportedFrameRates.includes(e)?(this[Mv].nominalFrameRate===e?console.log("Requested frame rate is the same as the current nominal frame rate, no update made"):(this[Mv].nominalFrameRate=e,this.dispatchEvent(new S2("frameratechange",{session:this})),console.log(`Nominal frame rate updated to ${e}`)),t()):i(new DOMException("Requested frame rate not supported.","InvalidStateError"))})}async requestReferenceSpace(e){return new Promise((t,i)=>{let n;if(this[Mv].ended||!this[Mv].referenceSpaceIsSupported(e))return void i(new DOMException("The requested reference space type is not supported.","NotSupportedError"));switch(e){case O.Viewer:n=this[Mv].device.viewerSpace;break;case O.Local:n=new S0(e,this[Mv].device[Mi].globalSpace,this[Mv].device.viewerSpace[My].offsetMatrix);break;case O.LocalFloor:case O.BoundedFloor:case O.Unbounded:n=new S0(e,this[Mv].device[Mi].globalSpace)}this[Mv].referenceSpaces.push(n),t(n)})}requestAnimationFrame(e){if(this[Mv].ended)return 0;let t=++this[Mv].frameHandle;return this[Mv].frameCallbacks.push({handle:t,callback:e,cancelled:!1}),t}cancelAnimationFrame(e){let t=this[Mv].frameCallbacks,i=t.findIndex(t=>t&&t.handle===e);i>-1&&(t[i].cancelled=!0,t.splice(i,1)),(t=this[Mv].currentFrameCallbacks)&&(i=t.findIndex(t=>t&&t.handle===e))>-1&&(t[i].cancelled=!0)}async end(){return new Promise((e,t)=>{this[Mv].ended||null===this[Mv].deviceFrameHandle?t(new DOMException("XRSession has already ended.","InvalidStateError")):(globalThis.cancelAnimationFrame(this[Mv].deviceFrameHandle),this[Mv].device[Mi].onSessionEnd(),this.dispatchEvent(new S2("end",{session:this})),e())})}get persistentAnchors(){return Array.from(this[Mv].persistentAnchors.keys())}restorePersistentAnchor(e){return new Promise((t,i)=>{if(this[Mv].persistentAnchors.has(e))if(this[Mv].ended)i(new DOMException("XRSession has already ended.","InvalidStateError"));else{let n=this[Mv].persistentAnchors.get(e);this[Mv].newAnchors.has(n)?i(new DOMException(`Multiple concurrent attempts detected to restore the anchor with UUID: ${e}.`,"InvalidStateError")):(this[Mv].trackedAnchors.add(n),this[Mv].newAnchors.set(n,{resolve:t,reject:i}))}else i(new DOMException(`Persistent anchor with uuid ${e} not found.`,"InvalidStateError"))})}deletePersistentAnchor(e){return new Promise((t,i)=>{if(this[Mv].persistentAnchors.has(e)){let i=this[Mv].persistentAnchors.get(e);this[Mv].persistentAnchors.delete(e),i.delete(),t(void 0)}else i(new DOMException(`Persistent anchor with uuid ${e} not found.`,"InvalidStateError"))})}requestHitTestSource(e){return new Promise((t,i)=>{if(this[Mv].enabledFeatures.includes("hit-test"))if(this[Mv].ended)i(new DOMException("XRSession has already ended.","InvalidStateError"));else if(this[Mv].device[Mi].sem){let i=new S$(this,e);this[Mv].hitTestSources.add(i),t(i)}else i(new DOMException("Synthethic Environment Module required for emulating hit-test","OperationError"));else i(new DOMException('WebXR feature "hit-test" is not supported by current session',"NotSupportedError"))})}get onend(){var e;return null!=(e=this[Mv].onend)?e:()=>{}}set onend(e){this[Mv].onend&&this.removeEventListener("end",this[Mv].onend),this[Mv].onend=e,e&&this.addEventListener("end",e)}get oninputsourceschange(){var e;return null!=(e=this[Mv].oninputsourceschange)?e:()=>{}}set oninputsourceschange(e){this[Mv].oninputsourceschange&&this.removeEventListener("inputsourceschange",this[Mv].oninputsourceschange),this[Mv].oninputsourceschange=e,e&&this.addEventListener("inputsourceschange",e)}get onselect(){var e;return null!=(e=this[Mv].onselect)?e:()=>{}}set onselect(e){this[Mv].onselect&&this.removeEventListener("select",this[Mv].onselect),this[Mv].onselect=e,e&&this.addEventListener("select",e)}get onselectstart(){var e;return null!=(e=this[Mv].onselectstart)?e:()=>{}}set onselectstart(e){this[Mv].onselectstart&&this.removeEventListener("selectstart",this[Mv].onselectstart),this[Mv].onselectstart=e,e&&this.addEventListener("selectstart",e)}get onselectend(){var e;return null!=(e=this[Mv].onselectend)?e:()=>{}}set onselectend(e){this[Mv].onselectend&&this.removeEventListener("selectend",this[Mv].onselectend),this[Mv].onselectend=e,e&&this.addEventListener("selectend",e)}get onsqueeze(){var e;return null!=(e=this[Mv].onsqueeze)?e:()=>{}}set onsqueeze(e){this[Mv].onsqueeze&&this.removeEventListener("squeeze",this[Mv].onsqueeze),this[Mv].onsqueeze=e,e&&this.addEventListener("squeeze",e)}get onsqueezestart(){var e;return null!=(e=this[Mv].onsqueezestart)?e:()=>{}}set onsqueezestart(e){this[Mv].onsqueezestart&&this.removeEventListener("squeezestart",this[Mv].onsqueezestart),this[Mv].onsqueezestart=e,e&&this.addEventListener("squeezestart",e)}get onsqueezeend(){var e;return null!=(e=this[Mv].onsqueezeend)?e:()=>{}}set onsqueezeend(e){this[Mv].onsqueezeend&&this.removeEventListener("squeezeend",this[Mv].onsqueezeend),this[Mv].onsqueezeend=e,e&&this.addEventListener("squeezeend",e)}get onvisibilitychange(){var e;return null!=(e=this[Mv].onvisibilitychange)?e:()=>{}}set onvisibilitychange(e){this[Mv].onvisibilitychange&&this.removeEventListener("visibilitychange",this[Mv].onvisibilitychange),this[Mv].onvisibilitychange=e,e&&this.addEventListener("visibilitychange",e)}get onframeratechange(){var e;return null!=(e=this[Mv].onframeratechange)?e:()=>{}}set onframeratechange(e){this[Mv].onframeratechange&&this.removeEventListener("frameratechange",this[Mv].onframeratechange),this[Mv].onframeratechange=e,e&&this.addEventListener("frameratechange",e)}}(S=k||(k={})).Wrist="wrist",S.ThumbMetacarpal="thumb-metacarpal",S.ThumbPhalanxProximal="thumb-phalanx-proximal",S.ThumbPhalanxDistal="thumb-phalanx-distal",S.ThumbTip="thumb-tip",S.IndexFingerMetacarpal="index-finger-metacarpal",S.IndexFingerPhalanxProximal="index-finger-phalanx-proximal",S.IndexFingerPhalanxIntermediate="index-finger-phalanx-intermediate",S.IndexFingerPhalanxDistal="index-finger-phalanx-distal",S.IndexFingerTip="index-finger-tip",S.MiddleFingerMetacarpal="middle-finger-metacarpal",S.MiddleFingerPhalanxProximal="middle-finger-phalanx-proximal",S.MiddleFingerPhalanxIntermediate="middle-finger-phalanx-intermediate",S.MiddleFingerPhalanxDistal="middle-finger-phalanx-distal",S.MiddleFingerTip="middle-finger-tip",S.RingFingerMetacarpal="ring-finger-metacarpal",S.RingFingerPhalanxProximal="ring-finger-phalanx-proximal",S.RingFingerPhalanxIntermediate="ring-finger-phalanx-intermediate",S.RingFingerPhalanxDistal="ring-finger-phalanx-distal",S.RingFingerTip="ring-finger-tip",S.PinkyFingerMetacarpal="pinky-finger-metacarpal",S.PinkyFingerPhalanxProximal="pinky-finger-phalanx-proximal",S.PinkyFingerPhalanxIntermediate="pinky-finger-phalanx-intermediate",S.PinkyFingerPhalanxDistal="pinky-finger-phalanx-distal",S.PinkyFingerTip="pinky-finger-tip";class bn extends Map{}var yx=yx,SE=SE,y7=y7;class br extends MT{constructor(e,t,i){super(t,i),this[M_]={jointName:e,radius:0}}get jointName(){return this[M_].jointName}}let ba={profileId:"oculus-hand",fallbackProfileIds:["generic-hand","generic-hand-select","generic-trigger"],poses:{default:{jointTransforms:{wrist:{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,5348679260350764e-19,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.04913589730858803,.0021463718730956316,.11701996624469757,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.07536252588033676,-.9959676265716553,-.04867160692811012,0,.5877083539962769,-.08379616588354111,.8047218918800354,0,-.8055551648139954,.032041035592556,.5916536450386047,0,-.010643752291798592,6936835707165301e-19,.08736639469861984,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.1374533325433731,-.9904957413673401,.004982374142855406,0,.5534393787384033,.08097179979085922,.8289443850517273,0,-.8214688897132874,-.11118389666080475,.559309184551239,0,.015547193586826324,-3480653394944966e-19,.0681300163269043,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.04330715537071228,.003409178927540779,.0492292083799839,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.04659227654337883,-.9974699020385742,-.05369402840733528,0,.6812446117401123,-.07104194164276123,.728600800037384,0,-.7305715084075928,-.002631746232509613,.6828309893608093,0,.062003348022699356,.004069602582603693,.03322213143110275,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,5348679260350764e-19,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.02009812369942665,.008770795539021492,.08660387247800827,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9001791477203369,-.2598813474178314,.3494834005832672,0,.06073702871799469,.8695210218429565,.490146666765213,0,-.4312632381916046,-.41999316215515137,.7985095381736755,0,-17739279428496957e-20,.03890012577176094,.039073407649993896,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9082008600234985,-.20898112654685974,.36262574791908264,0,.11045389622449875,.9553793668746948,.27395179867744446,0,-.40369608998298645,-.20874978601932526,.8907597661018372,0,.01617925800383091,.05482936650514603,.008788082748651505,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.02599053829908371,.059902746230363846,-.012860597111284733,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9309692978858948,-.16783711314201355,.32423174381256104,0,.1080828532576561,.9749603867530823,.1943446695804596,0,-.34873148798942566,-.14588497579097748,.9257990717887878,0,.03362493962049484,.06421422213315964,-.033461250364780426,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,5348679260350764e-19,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.03627845644950867,.011579737067222595,.08550142496824265,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9876697659492493,-.06786545366048813,.1410750150680542,0,-.015095947310328484,.855663537979126,.5173118710517883,0,-.15582047402858734,-.5130629539489746,.8440889716148376,0,-.021259509027004242,.04587256908416748,.03659208118915558,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.988391637802124,-.04354291781783104,.14555205404758453,0,.008894841186702251,.9729899168014526,.23067504167556763,0,-.15166506171226501,-.22670257091522217,.9620829224586487,0,-.014570588245987892,.06789684295654297,3578895702958107e-19,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.010392282158136368,.07414241135120392,-.026147106662392616,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9853697419166565,.044260796159505844,.16458062827587128,0,-.0757969319820404,.9787378311157227,.19059516489505768,0,-.1526455283164978,-.20028135180473328,.9677740931510925,0,-.0069718430750072,.08024183660745621,-.05014154314994812,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9616971015930176,-.13805118203163147,.2368120402097702,0,5348679260350764e-19,.8648636937141418,.5020061135292053,0,-.2741127610206604,-.48265108466148376,.8318111300468445,0,-.05402477830648422,.015797706320881844,.08152295649051666,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9940828680992126,.05735103040933609,.09224652498960495,0,-.10022822767496109,.8116500377655029,.5754809379577637,0,-.041867565363645554,-.5813214182853699,.8125960826873779,0,-.041623555123806,.04171867296099663,.03582974523305893,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9843675494194031,.12044742703437805,.12850022315979004,0,-.15629759430885315,.9337108135223389,.3221098482608795,0,-.08118485659360886,-.3371586799621582,.937940776348114,0,-.039990875869989395,.06438793987035751,.004141641780734062,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03783353418111801,.07334739714860916,-.020782606676220894,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9748351573944092,.11857274919748306,.18877571821212769,0,-.15575434267520905,.9681083559989929,.19623035192489624,0,-.15948788821697235,-.22069483995437622,.9622148275375366,0,-.03445569798350334,.0802423357963562,-.04392268508672714,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9181402921676636,.35625091195106506,.17350243031978607,0,-.39615097641944885,.8352503180503845,.38134080171585083,0,-.009065053425729275,-.41885748505592346,.9080066680908203,0,-.06191859766840935,.013620133511722088,.07850203663110733,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9714386463165283,.236698180437088,-.016745081171393394,0,-.18462024629116058,.7982627749443054,.5733163952827454,0,.14906984567642212,-.5538501739501953,.8191629648208618,0,-.061502378433942795,.032741155475378036,.03705105185508728,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9337416291236877,.35620439052581787,-.03527557849884033,0,-.33203884959220886,.8987522721290588,.28634607791900635,0,.13370157778263092,-.2556603252887726,.9574766755104065,0,-.06608185172080994,.049755651503801346,.011886020191013813,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.0687975287437439,.054948460310697556,-.007561664097011089,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9419984817504883,.3303581774234772,.059175245463848114,0,-.33483216166496277,.9130291938781738,.23294763267040253,0,.02292730286717415,-.2392500638961792,.970687210559845,0,-.06947512179613113,.0613851435482502,-.028543535619974136,1],radius:.005425984505563974}},gripOffsetMatrix:[-5348679260350764e-19,-.8648636937141418,-.5020061135292053,0,-.2741127908229828,-.48265108466148376,.8318111896514893,0,-.9616971015930176,.13805119693279266,-.2368120402097702,0,-.02878567762672901,.0017147823236882687,.04536811262369156,1]},pinch:{jointTransforms:{wrist:{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06867414712905884,-.009423808194696903,.10627774149179459,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[-.5012241005897522,-.8650535345077515,-.0213695727288723,0,.7415963411331177,-.4421543478965759,.5045139193534851,0,-.44587990641593933,.23702676594257355,.8631392121315002,0,-.032122574746608734,-.01196830440312624,.07194234430789948,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[-.3175753057003021,-.9460570216178894,-.06419729441404343,0,.8958902955055237,-.32153913378715515,.30658137798309326,0,-.3106854259967804,.03984907269477844,.9496771097183228,0,-.017625702545046806,-.01967475935816765,.04387917369604111,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,-.007126678712666035,-.021021386608481407,.011786630377173424,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[-.4944636821746826,-.8691971898078918,.001086252392269671,0,.8307800889015198,-.4722411036491394,.2946045398712158,0,-.25555649399757385,.14657381176948547,.9556186199188232,0,3423091256991029e-19,-.024528030306100845,-.011410919018089771,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.038037415593862534,-.0020236473064869642,.07626739144325256,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.7986818552017212,-.35985732078552246,.48229536414146423,0,.538311243057251,.7854709625244141,-.30537736415863037,0,-.2689369022846222,.5035246014595032,.8210577368736267,0,-.006869405973702669,.033938243985176086,.04206443578004837,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.8285930156707764,-.32672837376594543,.4546217918395996,0,.5577570199966431,.4116027057170868,-.7207564115524292,0,.04836784675717354,.8507823944091797,.5232869386672974,0,.0033306588884443045,.014840902760624886,.010923954658210278,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,.0021551470272243023,-.0058362227864563465,-.0017938464879989624,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.8412464261054993,-.35794928669929504,.4051857888698578,0,.5139996409416199,.29711154103279114,-.8046918511390686,0,.16765329241752625,.8852096796035767,.4339304566383362,0,-.00131594471167773,-.025222131982445717,-.012442642822861671,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.05395089089870453,.003063359996303916,.07402937114238739,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9187911748886108,-.1530158370733261,.36387869715690613,0,.038666240870952606,.9522662162780762,.302808940410614,0,-.3928440511226654,-.26414817571640015,.8808513283729553,0,-.02717282809317112,.04162866622209549,.03678669035434723,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9228746294975281,-.12856416404247284,.36300456523895264,0,.14524033665657043,.9892153143882751,-.01890045404434204,0,-.3566599190235138,.07016586512327194,.9315956234931946,0,-.01030921470373869,.05296773463487625,-.0010256498353555799,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,-4833847051486373e-19,.05103470757603645,-.026690717786550522,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9325166344642639,-.040404170751571655,.35885775089263916,0,.06836572289466858,.995502769947052,-.0655682161450386,0,-.3545948565006256,.08567725121974945,.9310863614082336,0,.008158999495208263,.05004044249653816,-.050120558589696884,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9060805439949036,-.1844543218612671,.3807799518108368,0,-.08027800172567368,.8086723685264587,.5827555656433105,0,-.4154181182384491,-.5585917234420776,.7179155349731445,0,-.06732909381389618,.007902119308710098,.07209732383489609,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9391821026802063,-.027994679287075996,.34227466583251953,0,-.18282271921634674,.8029410243034363,.5673282742500305,0,-.2907087206840515,-.5954000353813171,.7489906549453735,0,-.047129884362220764,.03806127607822418,.032147664576768875,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9249380826950073,.03699534013867378,.3783116042613983,0,-.12898847460746765,.9667453765869141,.2208271026611328,0,-.3575615882873535,-.25304901599884033,.8989526629447937,0,-.03579339757561684,.06127955764532089,.002939916681498289,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.026291755959391594,.06800390034914017,-.02094830758869648,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9001164436340332,.03983335196971893,.4338230490684509,0,-.09662467986345291,.9892624020576477,.10964841395616531,0,-.4247973561286926,-.14061418175697327,.8943013548851013,0,-.016345610842108727,.07300511747598648,-.04263874143362045,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.8769711852073669,.31462907791137695,.36322021484375,0,-.4506046175956726,.801031768321991,.39408499002456665,0,-.16696058213710785,-.5092697143554688,.8442559838294983,0,-.07460174709558487,.0062340241856873035,.06756893545389175,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9498357176780701,.1553308218717575,.2714462876319885,0,-.3019258379936218,.6817675232887268,.6663586497306824,0,-.08155745267868042,-.7148879170417786,.694466233253479,0,-.06697750836610794,.029482364654541016,.02902858518064022,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9214097261428833,.27928245067596436,.2701927423477173,0,-.3670244514942169,.8538867831230164,.36901235580444336,0,-.12765564024448395,-.43917882442474365,.8892839550971985,0,-.06447203457355499,.05144399777054787,.0076942890882492065,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.06187915802001953,.060364335775375366,-.010368337854743004,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9038633704185486,.23618005216121674,.3567195236682892,0,-.3532794713973999,.8823202252388,.3109731376171112,0,-.24129553139209747,-.4070987403392792,.8809353709220886,0,-.056796226650476456,.07042007893323898,-.02921444922685623,1],radius:.005425984505563974}},gripOffsetMatrix:[.08027800917625427,-.8086723685264587,-.5827556252479553,0,-.4154181480407715,-.5585916638374329,.7179154753684998,0,-.9060805439949036,.1844543218612671,-.3807799518108368,0,-.038054611533880234,-.002910431008785963,.03720742464065552,1]},point:{jointTransforms:{wrist:{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05789132043719292,.01670890860259533,.11183350533246994,1],radius:.021460847929120064},"thumb-metacarpal":{offsetMatrix:[.02145560085773468,-.9978390336036682,.0621047280728817,0,.41311800479888916,.06541631370782852,.9083252549171448,0,-.9104245901107788,.006167683284729719,.4136286973953247,0,-.016488194465637207,.012708572670817375,.08862338215112686,1],radius:.019382517784833908},"thumb-phalanx-proximal":{offsetMatrix:[.21270370483398438,-.966137707233429,.14606566727161407,0,.49890995025634766,.2359165996313095,.8339261412620544,0,-.8401462435722351,-.10450579971075058,.5321959853172302,0,.013112368993461132,.012508046813309193,.07517509907484055,1],radius:.01228295173496008},"thumb-phalanx-distal":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.04150351136922836,.016039609909057617,.05719054117798805,1],radius:.009768804535269737},"thumb-tip":{offsetMatrix:[.01653280481696129,-.9986647963523865,.048943229019641876,0,.26313456892967224,.051570065319538116,.9633802771568298,0,-.9646173715591431,-.0030490627977997065,.26363563537597656,0,.06548332422971725,.01683700829744339,.0516640841960907,1],radius:.008768804371356964},"index-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.02592567168176174,.019982583820819855,.08479326963424683,1],radius:.021228281781077385},"index-finger-phalanx-proximal":{offsetMatrix:[.9063700437545776,-.21756279468536377,.3621589243412018,0,.0970839336514473,.9415287375450134,.3226419687271118,0,-.41117796301841736,-.2572731077671051,.8744958639144897,0,-.0015709538711234927,.043078210204839706,.034657616168260574,1],radius:.010295259766280651},"index-finger-phalanx-intermediate":{offsetMatrix:[.9159826040267944,-.1651475727558136,.36565208435058594,0,.09755707532167435,.9756820797920227,.1962820291519165,0,-.3891757130622864,-.14411886036396027,.9098196625709534,0,.014023927971720695,.052835866808891296,.0014903299743309617,1],radius:.00853810179978609},"index-finger-phalanx-distal":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.023482320830225945,.05633850023150444,-.020621655508875847,1],radius:.007636196445673704},"index-finger-tip":{offsetMatrix:[.9378057718276978,-.12329639494419098,.3245268166065216,0,.032558172941207886,.9619227051734924,.2713746726512909,0,-.3456292748451233,-.2439306229352951,.9061115384101868,0,.03096788562834263,.06281610578298569,-.040703095495700836,1],radius:.006636196281760931},"middle-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.04184452444314957,.022474845871329308,.08177298307418823,1],radius:.021231964230537415},"middle-finger-phalanx-proximal":{offsetMatrix:[.9720265865325928,-.08313076198101044,.21966552734375,0,.20477405190467834,.7580050826072693,-.6192700862884521,0,-.11502730846405029,.6469289064407349,.7538246512413025,0,-.022107340395450592,.05035499855875969,.02970452979207039,1],radius:.01117393933236599},"middle-finger-phalanx-intermediate":{offsetMatrix:[.9779140949249268,-.07129573822021484,.19646917283535004,0,.1287083923816681,-.5352076292037964,-.8348574042320251,0,.1646735966205597,.8417060971260071,-.5142109394073486,0,-.017169542610645294,.022584279999136925,-.00265491777099669,1],radius:.008030958473682404},"middle-finger-phalanx-distal":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02170622907578945,-6043742760084569e-19,.011511396616697311,1],radius:.007629410829395056},"middle-finger-tip":{offsetMatrix:[.9774913787841797,-.19657190144062042,.07661263644695282,0,-.1924918293952942,-.9796126484870911,-.05749811604619026,0,.08635343611240387,.041456472128629684,-.995401918888092,0,-.02438267692923546,-.0026927536819130182,.03627248480916023,1],radius:.006629410665482283},"ring-finger-metacarpal":{offsetMatrix:[.9340395331382751,-.13936476409435272,.32885703444480896,0,-.005510995630174875,.914999783039093,.40341612696647644,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.05944233387708664,.0264605600386858,.07478221505880356,1],radius:.019088275730609894},"ring-finger-phalanx-proximal":{offsetMatrix:[.9842101335525513,.024470895528793335,.1753024309873581,0,.12200043350458145,.6237703561782837,-.7720272541046143,0,-.12824076414108276,.7812241315841675,.610936164855957,0,-.04249368980526924,.0467497780919075,.027722163125872612,1],radius:.00992213748395443},"ring-finger-phalanx-intermediate":{offsetMatrix:[.9941774606704712,.05949164181947708,.08983955532312393,0,.10504482686519623,-.7208291888237,-.6851072907447815,0,.024001073092222214,.6905553936958313,-.7228817939758301,0,-.0374927744269371,.016285063698887825,.0038980208337306976,1],radius:.007611672393977642},"ring-finger-phalanx-distal":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.038130562752485275,-.0020653479732573032,.02310742810368538,1],radius:.007231088820844889},"ring-finger-tip":{offsetMatrix:[.9995742440223694,.01638498157262802,.02412819117307663,0,.007813597097992897,-.9474818110466003,.31971633434295654,0,.028100071474909782,-.31939181685447693,-.9472070932388306,0,-.0390593595802784,.004176302347332239,.0466572530567646,1],radius:.0062310886569321156},"pinky-finger-metacarpal":{offsetMatrix:[.9147363901138306,.3458845317363739,.20885537564754486,0,-.3923271894454956,.8839452862739563,.2544005811214447,0,-.09662359952926636,-.3146490156650543,.9442773461341858,0,-.06715242564678192,.024195827543735504,.07137546688318253,1],radius:.01808827556669712},"pinky-finger-phalanx-proximal":{offsetMatrix:[.9613109827041626,.22439135611057281,.15977802872657776,0,.01002211682498455,.5511574745178223,-.8343409299850464,0,-.27528178691864014,.8036624789237976,.5275853276252747,0,-.06273911893367767,.038559623062610626,.028268879279494286,1],radius:.008483353070914745},"pinky-finger-phalanx-intermediate":{offsetMatrix:[.9820972084999084,.18811029195785522,-.00995189044624567,0,.14063723385334015,-.7673450708389282,-.6256227493286133,0,-.12532226741313934,.6130226850509644,-.7800630927085876,0,-.05428232625126839,.013870777562260628,.012061242014169693,1],radius:.0067641944624483585},"pinky-finger-phalanx-distal":{offsetMatrix:[.9744614362716675,.20454788208007813,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05173685774207115,.0014194445684552193,.02790539152920246,1],radius:.0064259846694767475},"pinky-finger-tip":{offsetMatrix:[.9744614362716675,.20454788208007813,-.09265263378620148,0,.22429193556308746,-.9065253138542175,.35764020681381226,0,-.010836843401193619,-.3692878782749176,-.9292529225349426,0,-.05098633095622063,.008463085629045963,.048688892275094986,1],radius:.005425984505563974}},gripOffsetMatrix:[.005510995630174875,-.9149997234344482,-.40341615676879883,0,-.3571262061595917,-.37861889600753784,.8538784384727478,0,-.9340395331382751,.13936474919319153,-.32885703444480896,0,-.031803809106349945,.007837686687707901,.04313928261399269,1]}}},bs={mapping:P.None,buttons:[{id:"pinch",type:"analog",eventTrigger:"select"}],axes:[]},bo=y7.create(),bl=SE.create(),bc=y7.create(),bh=y7.create(),bu=SE.create(),bd=y7.create(),bp=y7.create(),bf=SE.create(),bm=y7.create(),bg=(e,t,i,n)=>(yx.getTranslation(bo,t),yx.getRotation(bl,t),yx.getScaling(bc,t),yx.getTranslation(bh,i),yx.getRotation(bu,i),yx.getScaling(bd,i),y7.lerp(bp,bo,bh,n),SE.slerp(bf,bl,bu,n),y7.lerp(bm,bc,bd,n),yx.fromRotationTranslationScale(e,bf,bp,bm),e),bv=[1,-1,-1,0,-1,1,1,0,-1,1,1,0,-1,1,1,1];class b_ extends SD{constructor(e,t,i){if(t!==L.Left&&t!==L.Right)throw new DOMException('handedness for XRHandInput must be either "left" or "right"',"InvalidStateError");if(!e.poses.default||!e.poses.pinch)throw new DOMException('"default" and "pinch" hand pose configs are required',"InvalidStateError");const n=new MT(i),r=new MT(n),a=[e.profileId,...e.fallbackProfileIds],s=new bn;Object.values(k).forEach(e=>{s.set(e,new br(e,n))}),super(new SL(t,I.TrackedPointer,a,n,new SC(bs),r,s)),this[Mn]={poseId:"default",poses:e.poses},this.updateHandPose()}get poseId(){return this[Mn].poseId}set poseId(e){this[Mn].poses[e]?this[Mn].poseId=e:console.warn(`Pose config ${e} not found`)}updateHandPose(){let e=this[Mn].poses[this[Mn].poseId],t=this[Mn].poses.pinch;Object.values(k).forEach(i=>{let n=e.jointTransforms[i].offsetMatrix,r=t.jointTransforms[i].offsetMatrix,a=this.inputSource.hand.get(i);bg(a[My].offsetMatrix,n,r,this.pinchValue),this.inputSource.handedness===L.Right&&(e=>{for(let t=0;t<16;t++)e[t]*=bv[t]})(a[My].offsetMatrix),a[M_].radius=(1-this.pinchValue)*e.jointTransforms[i].radius+this.pinchValue*t.jointTransforms[i].radius}),e.gripOffsetMatrix&&t.gripOffsetMatrix&&bg(this.inputSource.gripSpace[My].offsetMatrix,e.gripOffsetMatrix,t.gripOffsetMatrix,this.pinchValue)}get pinchValue(){return this[Mr].inputSource.gamepad[Ms].buttonsMap.pinch.value}updatePinchValue(e){e>1||e<0?console.warn(`Out-of-range value ${e} provided for pinch`):this[Mr].inputSource.gamepad[Ms].buttonsMap.pinch[Ms].pendingValue=e}onFrameStart(e){super.onFrameStart(e),this.updateHandPose()}}class bx extends EventTarget{}let by={antialias:!0,depth:!0,stencil:!1,alpha:!0,ignoreDepthValues:!1,framebufferScaleFactor:1};class bM extends bx{constructor(e,t,i={}){if(super(),e[Mv].ended)throw new DOMException("Session has ended","InvalidStateError");const n={...by,...i};this[Mc]={session:e,context:t,antialias:n.antialias}}get context(){return this[Mc].context}get antialias(){return this[Mc].antialias}get ignoreDepthValues(){return!0}get framebuffer(){return null}get framebufferWidth(){return this[Mc].context.drawingBufferWidth}get framebufferHeight(){return this[Mc].context.drawingBufferHeight}getViewport(e){if(e[MM].session!==this[Mc].session)throw new DOMException("View's session differs from Layer's session","InvalidStateError");return this[Mc].session[Mv].device[Mi].getViewport(this,e)}static getNativeFramebufferScaleFactor(e){if(!(e instanceof bi))throw TypeError("getNativeFramebufferScaleFactor must be passed a session.");return+!e[Mv].ended}}var yx=yx,y7=y7,yx=yx,SE=SE,y7=y7;class bS{constructor(e,t,i){const{schema:n,frames:r}=t;if(!r||!n||0===r.length)throw new DOMException("wrong recording format","NotSupportedError");const a=new S0(O.Viewer,e),s={[F.Left]:new MT(a),[F.Right]:new MT(a),[F.None]:new MT(a)};this[y9]={refSpace:e,inputSources:new Map,inputSchemas:new Map,frames:r,recordedFramePointer:0,startingTimeStamp:r[0][0],endingTimeStamp:r[r.length-1][0],playbackTime:r[0][0],playing:!1,viewerSpace:a,viewSpaces:s,vec3:y7.create(),quat:SE.create()},yx.fromTranslation(this[y9].viewSpaces[F.Left][My].offsetMatrix,y7.fromValues(-i/2,0,0)),yx.fromTranslation(this[y9].viewSpaces[F.Right][My].offsetMatrix,y7.fromValues(i/2,0,0)),n.forEach(t=>{let i,n,r=t[0],a=t[1];if(a.hasGamepad){let e=[];for(let t=0;t<a.numButtons;t++)e.push({id:t.toString(),type:"manual"});let t=[];for(let e=0;e<a.numAxes;e++)t.push({id:e.toString(),type:"manual"});i=new SC({mapping:a.mapping,buttons:e,axes:t})}let s=new MT(e);a.hasHand&&(n=new bn,Object.values(k).forEach(e=>{n.set(e,new br(e,s))}));let o=new SL(a.handedness,a.targetRayMode,a.profiles,s,i,a.hasGrip?new MT(e):void 0,a.hasHand?n:void 0);this[y9].inputSources.set(r,{active:!1,source:o}),this[y9].inputSchemas.set(r,a)})}play(){this[y9].recordedFramePointer=0,this[y9].playbackTime=this[y9].startingTimeStamp,this[y9].playing=!0,this[y9].actualTimeStamp=performance.now()}stop(){this[y9].playing=!1}get playing(){return this[y9].playing}get viewerSpace(){return this[y9].viewerSpace}get viewSpaces(){return this[y9].viewSpaces}get inputSources(){return Array.from(this[y9].inputSources.values()).filter(e=>e.active).map(e=>e.source)}playFrame(){let e=performance.now(),t=e-this[y9].actualTimeStamp;if(this[y9].actualTimeStamp=e,this[y9].playbackTime+=t,this[y9].playbackTime>this[y9].endingTimeStamp)return void this.stop();for(;this[y9].frames[this[y9].recordedFramePointer+1][0]<this[y9].playbackTime;)this[y9].recordedFramePointer++;let i=this[y9].frames[this[y9].recordedFramePointer],n=this[y9].frames[this[y9].recordedFramePointer+1],r=(this[y9].playbackTime-i[0])/(n[0]-i[0]);this.updateXRSpaceFromMergedFrames(this[y9].viewerSpace,i.slice(1,8),n.slice(1,8),r);let a=new Map;for(let e=8;e<i.length;e++){let{index:t,inputData:n}=this.processRawInputData(i[e]);a.set(t,n)}let s=new Map;for(let e=8;e<n.length;e++){let{index:t,inputData:i}=this.processRawInputData(n[e]);s.set(t,i)}this[y9].inputSources.forEach(e=>{e.active=!1}),s.forEach((e,t)=>{this[y9].inputSources.get(t).active=!0;let i=this[y9].inputSources.get(t).source,n=this[y9].inputSchemas.get(t);this.updateInputSource(i,n,a.has(t)?a.get(t):e,e,r)})}updateInputSource(e,t,i,n,r){if(this.updateXRSpaceFromMergedFrames(e.targetRaySpace,i.targetRayTransform,n.targetRayTransform,r),t.hasGrip&&this.updateXRSpaceFromMergedFrames(e.gripSpace,i.gripTransform,n.gripTransform,r),t.hasHand)for(let a=0;a<25;a++){let s=i.handTransforms.slice(8*a,8*a+7),o=n.handTransforms.slice(8*a,8*a+7),l=i.handTransforms[8*a+7],c=n.handTransforms[8*a+7],h=e.hand.get(t.jointSequence[a]);this.updateXRSpaceFromMergedFrames(h,s,o,r),h[M_].radius=(c-l)*r+l}if(t.hasGamepad){let t=e.gamepad;n.buttons.forEach((e,n)=>{let a=t.buttons[n];a[Ms].pressed=1===e[0],a[Ms].touched=1===e[1];let s=i.buttons[n][2],o=e[2];a[Ms].value=(o-s)*r+s}),n.axes.forEach((e,n)=>{let a=i.axes[n];t[Ms].axesMap[n.toString()].x=(e-a)*r+a})}}updateXRSpaceFromMergedFrames(e,t,i,n){let r=y7.fromValues(t[0],t[1],t[2]),a=SE.fromValues(t[3],t[4],t[5],t[6]),s=y7.fromValues(i[0],i[1],i[2]),o=SE.fromValues(i[3],i[4],i[5],i[6]);y7.lerp(this[y9].vec3,r,s,n),SE.slerp(this[y9].quat,a,o,n),yx.fromRotationTranslation(e[My].offsetMatrix,this[y9].quat,this[y9].vec3)}processRawInputData(e){let t=e[0],i=this[y9].inputSchemas.get(t),n={targetRayTransform:e.slice(1,8)},r=8;if(i.hasGrip&&(n.gripTransform=e[r++]),i.hasHand&&(n.handTransforms=e[r++]),i.hasGamepad){let t=e[r];n.buttons=t.slice(0,i.numButtons),n.axes=t.slice(i.numButtons)}return{index:t,inputData:n}}}let bb="2.1.1";class bE extends Event{constructor(e,t){if(super(e,t),!t.referenceSpace)throw Error("XRReferenceSpaceEventInit.referenceSpace is required");this.referenceSpace=t.referenceSpace,this.transform=t.transform}}class bT extends EventTarget{constructor(e){super(),this[Mo]={device:e,grantSession:({resolve:e,reject:t,mode:i,options:n})=>{if(this[Mo].activeSession)return void t(new DOMException("An active XRSession already exists.","InvalidStateError"));let{requiredFeatures:r=[],optionalFeatures:a=[]}=n,{supportedFeatures:s}=this[Mo].device;if(!r.every(e=>s.includes(e)))return void t(Error("One or more required features are not supported by the device."));let o=Array.from(new Set([...r,...a.filter(e=>s.includes(e)),"viewer","local"])),l=new bi(this[Mo].device,i,o);this[Mo].activeSession=l,l.addEventListener("end",()=>{this[Mo].activeSession=void 0}),e(l)}}}isSessionSupported(e){return new Promise((t,i)=>{t("inline"===e||this[Mo].device.supportedSessionModes.includes(e))})}requestSession(e,t={}){return new Promise((i,n)=>{this.isSessionSupported(e).then(r=>{r?this[Mo].grantSession({resolve:i,reject:n,mode:e,options:t}):n(new DOMException("The requested XRSession mode is not supported.","NotSupportedError"))}).catch(n)})}offerSession(e,t={}){return new Promise((i,n)=>{this.isSessionSupported(e).then(r=>{r?this[Mo].offeredSessionConfig={resolve:i,reject:n,mode:e,options:t}:n(new DOMException("The requested XRSession mode is not supported.","NotSupportedError"))}).catch(n)})}}class bw{constructor(e,t,i,n){this[MS]={x:e,y:t,width:i,height:n}}get x(){return this[MS].x}get y(){return this[MS].y}get width(){return this[MS].width}get height(){return this[MS].height}}(b=V||(V={})).texture="texture",b["texture-array"]="texture-array",(E=H||(H={})).default="default",E.mono="mono",E.stereo="stereo",E["stereo-left-right"]="stereo-left-right",E["stereo-top-bottom"]="stereo-top-bottom";let bA=e=>e&&"function"==typeof e.getOffsetReferenceSpace,bR=(e,t)=>{switch(t){case e.RGBA8:case e.RGB5_A1:case e.RGBA4:case e.SRGB8_ALPHA8:return{internalFormat:t,textureFormat:e.RGBA,type:e.UNSIGNED_BYTE};case e.RGBA8_SNORM:return{internalFormat:t,textureFormat:e.RGBA,type:e.BYTE};case e.RGB10_A2:return{internalFormat:t,textureFormat:e.RGBA,type:e.UNSIGNED_INT_2_10_10_10_REV};case e.RGBA16F:return{internalFormat:t,textureFormat:e.RGBA,type:e.HALF_FLOAT};case e.RGBA32F:return{internalFormat:t,textureFormat:e.RGBA,type:e.FLOAT};case e.RGBA8UI:return{internalFormat:t,textureFormat:e.RGBA_INTEGER,type:e.UNSIGNED_BYTE};case e.RGBA8I:return{internalFormat:t,textureFormat:e.RGBA_INTEGER,type:e.BYTE};case e.RGBA16UI:return{internalFormat:t,textureFormat:e.RGBA_INTEGER,type:e.UNSIGNED_SHORT};case e.RGBA16I:return{internalFormat:t,textureFormat:e.RGBA_INTEGER,type:e.SHORT};case e.RGBA32UI:return{internalFormat:t,textureFormat:e.RGBA_INTEGER,type:e.UNSIGNED_INT};case e.RGBA32I:return{internalFormat:t,textureFormat:e.RGBA_INTEGER,type:e.INT};case e.RGB10_A2UI:return{internalFormat:t,textureFormat:e.RGBA_INTEGER,type:e.UNSIGNED_INT_2_10_10_10_REV};case e.RGB8:case e.RGB565:case e.SRGB8:return{internalFormat:t,textureFormat:e.RGB,type:e.UNSIGNED_BYTE};case e.RGB8_SNORM:return{internalFormat:t,textureFormat:e.RGB,type:e.BYTE};case e.RGB16F:case e.R11F_G11F_B10F:case e.RGB9_E5:return{internalFormat:t,textureFormat:e.RGB,type:e.HALF_FLOAT};case e.RGB32F:return{internalFormat:t,textureFormat:e.RGB,type:e.FLOAT};case e.RGB8UI:return{internalFormat:t,textureFormat:e.RGB_INTEGER,type:e.UNSIGNED_BYTE};case e.RGB8I:return{internalFormat:t,textureFormat:e.RGB_INTEGER,type:e.BYTE};case e.RGB16UI:return{internalFormat:t,textureFormat:e.RGB_INTEGER,type:e.UNSIGNED_SHORT};case e.RGB16I:return{internalFormat:t,textureFormat:e.RGB_INTEGER,type:e.SHORT};case e.RGB32UI:return{internalFormat:t,textureFormat:e.RGB_INTEGER,type:e.UNSIGNED_INT};case e.RGB32I:return{internalFormat:t,textureFormat:e.RGB_INTEGER,type:e.INT};case e.DEPTH_COMPONENT16:return{internalFormat:t,textureFormat:e.DEPTH_COMPONENT,type:e.UNSIGNED_SHORT};case e.DEPTH_COMPONENT24:return{internalFormat:t,textureFormat:e.DEPTH_COMPONENT,type:e.UNSIGNED_INT};case e.DEPTH_COMPONENT32F:return{internalFormat:t,textureFormat:e.DEPTH_COMPONENT,type:e.FLOAT};case e.DEPTH24_STENCIL8:return{internalFormat:t,textureFormat:e.DEPTH_STENCIL,type:e.UNSIGNED_INT_24_8};case e.DEPTH32F_STENCIL8:return{internalFormat:t,textureFormat:e.DEPTH_STENCIL,type:e.FLOAT_32_UNSIGNED_INT_24_8_REV};case e.DEPTH_COMPONENT:return bR(e,e.DEPTH_COMPONENT24);case e.DEPTH_STENCIL:return bR(e,e.DEPTH24_STENCIL8);case e.RGBA:case e.RGB:case e.LUMINANCE_ALPHA:case e.LUMINANCE:case e.ALPHA:return{internalFormat:t,textureFormat:t,type:e.UNSIGNED_BYTE};default:throw Error("Attempted to create polyfill with unsupported format.")}};class bC{constructor(){this._hasRunDeferredInitialize=!1,this._media=null}initialize(e,t){this.session=e,t&&(this.context=t),this.blendTextureSourceAlpha=!0}destroy(){this._colorTextures=[],this._depthStencilTextures=[]}addEventListener(e,t,i){}dispatchEvent(e){return!1}removeEventListener(e,t,i){}getContext(){return this.context}getTextureType(){throw Error("Unimplemented")}get colorTextures(){return this._colorTextures}get depthStencilTextures(){return this._depthStencilTextures}get colorTexturesMeta(){return this._texturesMeta}get media(){return this.isMediaLayer()||console.warn("Attempted to retrieve media from a non-media layer"),this._media}determineLayoutAttribute(e,t,i){if(!(t instanceof WebGL2RenderingContext)&&e===V["texture-array"])throw TypeError();if(i===H.mono)return i;if(i===H.default){if(this.session.internalViews&&1===this.session.internalViews.length)return H.mono;if(e===V["texture-array"])return i}return i===H.default||i===H.stereo?H["stereo-left-right"]:i}isMediaLayer(){return null!==this._media}_deferredInitialize(){}initializeIfNeeded(){this._hasRunDeferredInitialize||(this._hasRunDeferredInitialize=!0,this._deferredInitialize())}_allocateColorTexturesInternal(e,t){let i=this.session.internalViews;if(!i||0===i.length)return void console.warn("We can't allocate color textures without views");if(this.initializeIfNeeded(),this.layout===H.mono)if(e===V["texture-array"]){let i=this._createNewColorTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.colorFormat);this._texturesMeta=[i],this._colorTextures=[i.texture];return}else{let i=this._createNewColorTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.colorFormat);this._texturesMeta=[i],this._colorTextures=[i.texture];return}if(this.layout===H.stereo)if(e===V["texture-array"]){let i=this._createNewColorTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.colorFormat,2);this._texturesMeta=[i],this._colorTextures=[i.texture];return}else{let i=this._createNewColorTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.colorFormat),n=this._createNewColorTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.colorFormat);this._texturesMeta=[i,n],this._colorTextures=[i.texture,n.texture];return}if(this.layout===H["stereo-left-right"]){let i=this._createNewColorTexture(2*t.viewPixelWidth,t.viewPixelHeight,e,t.colorFormat);this._texturesMeta=[i],this._colorTextures=[i.texture];return}if(this.layout===H["stereo-top-bottom"]){let i=this._createNewColorTexture(t.viewPixelWidth,2*t.viewPixelHeight,e,t.colorFormat);this._texturesMeta=[i],this._colorTextures=[i.texture];return}}_allocateDepthStencilTexturesInternal(e,t){if(!t.depthFormat){this._depthStencilTextures=[];return}if(0>this._getSupportedDepthFormats().indexOf(t.depthFormat))throw Error("Depth format provided is not supported in non-projection layers.");if(t.mipLevels<1)throw Error("Invalid miplevel. Miplevel needs to be >= 1");if(this.layout===H.mono)if(e===V["texture-array"]){let i=this._createNewDepthStencilTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.depthFormat);this._depthStencilTextures=[i.texture];return}else{let i=this._createNewColorTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.depthFormat);this._depthStencilTextures=[i.texture];return}if(this.layout===H.stereo)if(e===V["texture-array"]){let i=this._createNewDepthStencilTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.depthFormat,2);this._depthStencilTextures=[i.texture];return}else{let i=this._createNewDepthStencilTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.depthFormat),n=this._createNewDepthStencilTexture(t.viewPixelWidth,t.viewPixelHeight,e,t.depthFormat);this._depthStencilTextures=[i.texture,n.texture];return}if(this.layout===H["stereo-left-right"]){let i=this._createNewDepthStencilTexture(2*t.viewPixelWidth,t.viewPixelHeight,e,t.depthFormat);this._depthStencilTextures=[i.texture];return}if(this.layout===H["stereo-top-bottom"]){let i=this._createNewDepthStencilTexture(t.viewPixelWidth,2*t.viewPixelHeight,e,t.depthFormat);this._depthStencilTextures=[i.texture];return}}_createNewColorTexture(e,t,i,n,r=1){return this._createGenericPolyfillTexture(i,e,t,n,0,r)}_createNewDepthStencilTexture(e,t,i,n,r=1){return this._createGenericPolyfillTexture(i,e,t,n,0,r)}_createGenericPolyfillTexture(e,t,i,n,r=0,a=1){if(e===V["texture-array"]&&a<=1&&console.warn("creating a texture array with a single layer..."),e===V["texture-array"]&&this.context instanceof WebGLRenderingContext)throw Error("WebGL 1 does not support texture array");let s=this.context.createTexture(),o={width:t,height:i,layers:a,type:e,textureFormat:n,texture:s},l=n,c=this.context.UNSIGNED_BYTE;if(this.context instanceof WebGL2RenderingContext){let e=bR(this.context,n);l=e.internalFormat,n=e.textureFormat,c=e.type}else n===this.context.DEPTH_COMPONENT&&(c=this.context.UNSIGNED_INT),n===this.context.DEPTH_STENCIL&&(c=this.context.UNSIGNED_INT_24_8_WEBGL);if(e===V["texture-array"]&&this.context instanceof WebGL2RenderingContext){console.warn("texture-array layers are supported...questionably in the polyfill at the moment. Use at your own risk.");let e=this.context.getParameter(this.context.TEXTURE_BINDING_2D_ARRAY);this.context.bindTexture(this.context.TEXTURE_2D_ARRAY,s),this._getSupportedDepthFormats().indexOf(n)>=0?this.context.texStorage3D(this.context.TEXTURE_2D_ARRAY,1,l,t,i,a):this.context.texImage3D(this.context.TEXTURE_2D_ARRAY,0,l,t,i,a,0,n,c,null),this.context.bindTexture(this.context.TEXTURE_2D_ARRAY,e)}else{let e=this.context.getParameter(this.context.TEXTURE_BINDING_2D);this.context.bindTexture(this.context.TEXTURE_2D,s),this.context.texImage2D(this.context.TEXTURE_2D,0,l,t,i,0,n,c,null),this.context.bindTexture(this.context.TEXTURE_2D,e)}return o}_getSupportedDepthFormats(){let e=[];return this.context instanceof WebGLRenderingContext&&!this.context.getExtension("WEBGL_depth_texture")||(e.push(this.context.DEPTH_COMPONENT,this.context.DEPTH_STENCIL),this.context instanceof WebGL2RenderingContext&&e.push(this.context.DEPTH_COMPONENT24,this.context.DEPTH24_STENCIL8)),e}}let bP={colorFormat:6408,mipLevels:1,layout:H.mono,isStatic:!1,space:null,viewPixelHeight:0,viewPixelWidth:0,textureType:V.texture,radius:2,centralAngle:.78539,aspectRatio:2},bL={layout:H.mono,invertStereo:!1,space:null,radius:2,centralAngle:.78539};class bI extends bC{constructor(t,i){super(),this._media=null!=i?i:null,this.isMediaLayer()?this.init=Object.assign(Object.assign({},bL),t):this.init=Object.assign(Object.assign({},bP),t),this.radius=this.init.radius,this.centralAngle=this.init.centralAngle,this.aspectRatio=this.init.aspectRatio,this.space=this.init.space,this.layout=this.init.layout;const n=e.g;this.init.transform?this.transform=new n.XRRigidTransform(t.transform.position,t.transform.orientation):this.transform=new n.XRRigidTransform({x:0,y:0,z:0,w:1}),this.isMediaLayer()||(this.isStatic=t.isStatic)}getTextureType(){return this.isMediaLayer()?V.texture:this.init.textureType}_deferredInitialize(){let e=this.determineLayoutAttribute(this.init.textureType,this.context,this.init.layout);this.layout=e,this.needsRedraw=!0}get colorTextures(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._colorTextures&&this._colorTextures.length||this._allocateColorTexturesInternal(this.getTextureType(),this.init),this._colorTextures}get depthStencilTextures(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._depthStencilTextures&&this._depthStencilTextures.length||this._allocateDepthStencilTexturesInternal(this.getTextureType(),this.init),this._depthStencilTextures}get colorTexturesMeta(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._colorTextures&&this._colorTextures.length||this._allocateColorTexturesInternal(this.getTextureType(),this.init),this._texturesMeta}get width(){return 2*this.radius*Math.PI*(this.centralAngle/(2*Math.PI))}get height(){return this.width/this.aspectRatio}}let bN={colorFormat:6408,mipLevels:1,layout:H.mono,isStatic:!1,space:null,viewPixelHeight:0,viewPixelWidth:0,textureType:V.texture,radius:0,centralHorizontalAngle:6.28318,upperVerticalAngle:1.570795,lowerVerticalAngle:-1.570795},bD={space:null,layout:H.mono,invertStereo:!1,radius:0,centralHorizontalAngle:6.28318,upperVerticalAngle:1.570795,lowerVerticalAngle:-1.570795};class bU extends bC{constructor(t,i){if(super(),this._media=null!=i?i:null,this.isMediaLayer()?this.init=Object.assign(Object.assign({},bD),t):this.init=Object.assign(Object.assign({},bN),t),!bA(this.init.space))throw TypeError("Equirect layer's space needs to be an XRReferenceSpace");this.radius=this.init.radius,this.centralHorizontalAngle=this.init.centralHorizontalAngle,this.upperVerticalAngle=this.init.upperVerticalAngle,this.lowerVerticalAngle=this.init.lowerVerticalAngle,this.space=this.init.space,this.layout=this.init.layout;const n=e.g;t.transform?this.transform=new n.XRRigidTransform(t.transform.position,t.transform.orientation):this.transform=new n.XRRigidTransform({x:0,y:0,z:0,w:1}),this.isMediaLayer()||(this.isStatic=t.isStatic)}getTextureType(){return this.isMediaLayer()?V.texture:this.init.textureType}_deferredInitialize(){let e=this.determineLayoutAttribute(this.init.textureType,this.context,this.init.layout);this.layout=e,this.needsRedraw=!0}get colorTextures(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._colorTextures&&this._colorTextures.length||this._allocateColorTexturesInternal(this.getTextureType(),this.init),this._colorTextures}get depthStencilTextures(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._depthStencilTextures&&this._depthStencilTextures.length||this._allocateDepthStencilTexturesInternal(this.getTextureType(),this.init),this._depthStencilTextures}get colorTexturesMeta(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._colorTextures&&this._colorTextures.length||this._allocateColorTexturesInternal(this.getTextureType(),this.init),this._texturesMeta}}let bO={colorFormat:6408,mipLevels:1,layout:H.mono,isStatic:!1,space:null,viewPixelHeight:0,viewPixelWidth:0,textureType:V.texture,width:1,height:1},bF={space:null,layout:H.mono,invertStereo:!1};class bB extends bC{constructor(t,i){super(),this._media=null!=i?i:null,this.isMediaLayer()?this.init=Object.assign(Object.assign({},bF),t):this.init=Object.assign(Object.assign({},bO),t),this.width=this.init.width,this.height=this.init.height,this.space=this.init.space,this.layout=this.init.layout;const n=e.g;this.init.transform?this.transform=new n.XRRigidTransform(t.transform.position,t.transform.orientation):this.transform=new n.XRRigidTransform({x:0,y:0,z:0,w:1}),this.isMediaLayer()||(this.isStatic=t.isStatic)}getTextureType(){return this.isMediaLayer()?V.texture:this.init.textureType}_deferredInitialize(){let e=this.determineLayoutAttribute(this.init.textureType,this.context,this.init.layout);this.layout=e,this.needsRedraw=!0}get colorTextures(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._colorTextures&&this._colorTextures.length||this._allocateColorTexturesInternal(this.getTextureType(),this.init),this._colorTextures}get depthStencilTextures(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._depthStencilTextures&&this._depthStencilTextures.length||this._allocateDepthStencilTexturesInternal(this.getTextureType(),this.init),this._depthStencilTextures}get colorTexturesMeta(){if(this.isMediaLayer())throw Error("Media layers do not have associated textures");return this._colorTextures&&this._colorTextures.length||this._allocateColorTexturesInternal(this.getTextureType(),this.init),this._texturesMeta}}class bz{constructor(e){if(this.session=e,this.session.ended)throw Error("Session has ended")}createQuadLayer(e,t){if(this.session.ended)throw Error("Session has ended");if(t.layout===H.default)throw TypeError("Media Quad layer cannot be created with layout of default");let i=this.calculateAspectRatio(e,t.layout);void 0===t.width&&void 0===t.height&&(t.width=1),void 0===t.height&&(t.height=t.width/i),void 0===t.width&&(t.width=t.height/i);let n=new bB(t,e);return n.needsRedraw=!1,n.initialize(this.session),n}createCylinderLayer(e,t){if(this.session.ended)throw Error("Session has ended");if(t.layout===H.default)throw TypeError("Media Cylinder layer cannot be created with layout of default");let i=this.calculateAspectRatio(e,t.layout);void 0===t.aspectRatio&&(t.aspectRatio=i);let n=new bI(t,e);return n.needsRedraw=!1,n.initialize(this.session),n}createEquirectLayer(e,t){if(this.session.ended)throw Error("Session has ended");if(t.layout===H.default)throw TypeError("Media Equirect layer cannot be created with layout of default");if(!bA(t.space))throw Error("Media Equirect layer's space must be of type XRReferenceSpace");let i=new bU(t,e);return i.needsRedraw=!1,i.initialize(this.session),i}calculateAspectRatio(e,t){let i=e.videoWidth,n=e.videoHeight;return t===H["stereo-left-right"]&&(i/=2),t===H["stereo-top-bottom"]&&(n/=2),i/n}}let bk={textureType:V.texture,colorFormat:6408,depthFormat:6402,scaleFactor:1};class bV extends bC{constructor(e=bk){super(),this.init=Object.assign(Object.assign({},bk),e)}initialize(e,t){super.initialize(e,t),this.initializeIfNeeded();let i=e.getBaseLayer();this.textureWidth=i.framebufferWidth*this.init.scaleFactor,this.textureHeight=i.framebufferHeight*this.init.scaleFactor}_allocateProjectionColorTextures(){let e=[],t=[],i=()=>{for(let i of(e=[],t))e.push(i.texture)},n=this.session,r=n.internalViews;if(!r||0===r.length)return void console.warn("We can't allocate color textures without views");let a=n.getBaseLayer(),s=r.length,o=a.framebufferWidth*this.init.scaleFactor/r.length,l=a.framebufferHeight*this.init.scaleFactor;if(this.layout===H.mono||this.layout===H.default){if(this.init.textureType===V["texture-array"])t=[this._createNewColorTexture(o,l,V["texture-array"],this.init.colorFormat,s)];else for(let e of r){let e=this._createNewColorTexture(o,l,V.texture,this.init.colorFormat);t.push(e)}i(),this._colorTexturesMeta=t,this._colorTextures=e;return}this.layout===H["stereo-left-right"]?t=[this._createNewColorTexture(o*s,l,this.init.textureType,this.init.colorFormat)]:this.layout===H["stereo-top-bottom"]&&(t=[this._createNewColorTexture(o,l*s,this.init.textureType,this.init.colorFormat)]),i(),this._colorTexturesMeta=t,this._colorTextures=e}_allocateProjectionDepthStencilTextures(){let e=this.session,t=e.internalViews;if(!t||0===t.length)return;if(0===this.init.depthFormat||this.context instanceof WebGLRenderingContext&&!this.context.getExtension("WEBGL_depth_texture")){this._depthStencilTextures=[];return}let i=[],n=[],r=()=>{for(let e of(i=[],n))i.push(e.texture)};this.initializeIfNeeded();let a=e.getBaseLayer(),s=t.length,o=a.framebufferWidth*this.init.scaleFactor/t.length,l=a.framebufferHeight*this.init.scaleFactor;if(this.layout===H.mono||this.layout===H.default){if(this.init.textureType===V["texture-array"])n=[this._createNewDepthStencilTexture(o,l,this.init.textureType,this.init.depthFormat,s)];else for(let e of t){let e=this._createNewDepthStencilTexture(o,l,this.init.textureType,this.init.depthFormat);n.push(e)}r(),this._depthStencilTextures=i;return}this.layout===H["stereo-left-right"]?n=[this._createNewDepthStencilTexture(o*s,l,this.init.textureType,this.init.depthFormat)]:this.layout===H["stereo-top-bottom"]&&(n=[this._createNewDepthStencilTexture(o,l*s,this.init.textureType,this.init.depthFormat)]),r(),this._depthStencilTextures=i}get colorTextures(){return this._colorTextures&&this._colorTextures.length||this._allocateProjectionColorTextures(),this._colorTextures}get depthStencilTextures(){return void 0===this._depthStencilTextures&&this._allocateProjectionDepthStencilTextures(),this._depthStencilTextures||[]}get colorTexturesMeta(){return this._colorTextures&&this._colorTextures.length||this._allocateProjectionColorTextures(),this._colorTexturesMeta}getTextureType(){return this.init.textureType}_deferredInitialize(){this.isStatic=!1,this.ignoreDepthValues=!1,this.fixedFoveation=0;let e=this.determineLayoutAttribute(this.init.textureType,this.context,H.default);this.layout=e,this.needsRedraw=!0;let t=this.determineMaximumScaleFactor(),i=Math.min(this.init.scaleFactor,t);this.init.scaleFactor=i}determineMaximumScaleFactor(){let e=this.session.getBaseLayer(this.context),t=e.framebufferWidth,i=e.framebufferHeight;this.layout===H["stereo-left-right"]&&(t*=2),this.layout===H["stereo-top-bottom"]&&(i*=2);let n=Math.max(t,i);return this.context.getParameter(this.context.MAX_TEXTURE_SIZE)/n}}let bH=(e,t,i,n,r)=>{let a=0,s=0,o=t.width,l=t.height;i===H["stereo-left-right"]?(a=t.width*n/r,o=t.width/r):i===H["stereo-top-bottom"]&&(s=t.height*n/r,l=t.height/r),e.x=a,e.y=s,e.width=o,e.height=l},bG=(e,t,i)=>{var n=e.createShader(i);if(e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS))throw"could not compile shader:"+e.getShaderInfoLog(n);return n},bW=(e,t,i)=>{let n=e.createProgram(),r=bG(e,t,e.VERTEX_SHADER),a=bG(e,i,e.FRAGMENT_SHADER);if(e.attachShader(n,r),e.attachShader(n,a),e.deleteShader(r),e.deleteShader(a),e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS))throw"program failed to link:"+e.getProgramInfoLog(n);return n},bj=e=>{if(e instanceof WebGL2RenderingContext)return e;let t=e.getExtension("OES_vertex_array_object");if(!t)throw Error("Cannot use VAOs.");return{VERTEX_ARRAY_BINDING:t.VERTEX_ARRAY_BINDING_OES,bindVertexArray:t.bindVertexArrayOES.bind(t),createVertexArray:t.createVertexArrayOES.bind(t),deleteVertexArray:t.deleteVertexArrayOES.bind(t),isVertexArray:t.isVertexArrayOES.bind(t)}},bX=e=>e,bq=bX`
849
+ attribute vec2 a_position;
850
+ attribute vec2 a_texCoord;
851
+
852
+ varying vec2 v_texCoord;
853
+
854
+ void main() {
855
+ // convert the rectangle from pixels to 0.0 to 1.0
856
+ vec2 zeroToOne = a_position;
857
+
858
+ // convert from 0->1 to 0->2
859
+ vec2 zeroToTwo = zeroToOne * 2.0;
860
+
861
+ // convert from 0->2 to -1->+1 (clipspace)
862
+ vec2 clipSpace = zeroToTwo - 1.0;
863
+
864
+ gl_Position = vec4(clipSpace * vec2(1, 1), 0, 1);
865
+
866
+ // pass the texCoord to the fragment shader
867
+ // The GPU will interpolate this value between points.
868
+ v_texCoord = a_texCoord;
869
+ }
870
+ `,bY=bX`
871
+ precision mediump float;
872
+
873
+ // our texture
874
+ uniform sampler2D u_image;
875
+
876
+ // the texCoords passed in from the vertex shader.
877
+ varying vec2 v_texCoord;
878
+
879
+ void main() {
880
+ vec4 tex = texture2D(u_image, v_texCoord);
881
+ gl_FragColor = vec4(tex.rgb, tex.a);
882
+ }
883
+ `;class bK{constructor(e,t){this.gl=t,this.layer=e,this.program=bW(this.gl,bq,bY),this.programInfo={attribLocations:{a_position:this.gl.getAttribLocation(this.program,"a_position"),a_texCoord:this.gl.getAttribLocation(this.program,"a_texCoord")}},this._createVAOs()}render(e){let t=this.gl,i=e.getBaseLayer();t.viewport(0,0,i.framebufferWidth,i.framebufferHeight);let n=this.layer.getTextureType(),r=t.getParameter(t.TEXTURE_BINDING_2D),a=t.getParameter(t.ACTIVE_TEXTURE);if(n===V.texture)t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,this.layer.colorTextures[0]),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);else throw Error(`Created a texture projection renderer instead of a texture-array projection renderer for a texture-array layer.
884
+ This is probably an error with the polyfill itself; please file an issue on Github if you run into this.`);for(let n of e.internalViews){let e=i.getViewport(n);t.viewport(e.x,e.y,e.width,e.height),this._shouldUseStereoTexturePoints()?this._renderInternalStereo(n):this._renderInternal()}t.activeTexture(a),t.bindTexture(t.TEXTURE_2D,r)}_renderInternal(){let e=this.gl,t=e.getParameter(e.CURRENT_PROGRAM);e.useProgram(this.program),this.vaoGl.bindVertexArray(this.vao);var i=e.TRIANGLES;e.drawArrays(i,0,6),this.vaoGl.bindVertexArray(null),e.useProgram(t)}_renderInternalStereo(e){if("none"===e.eye)return this._renderInternal();let t=this.gl;this.vaoGl.bindVertexArray(this.vao);let i=t.getParameter(t.CURRENT_PROGRAM);t.useProgram(this.program),this._setStereoTextureBuffer(+("right"===e.eye));var n=t.TRIANGLES;t.drawArrays(n,0,6),this.vaoGl.bindVertexArray(null),t.useProgram(i)}_createVAOs(){var e,t;this._createTextureUVs();let i=this.gl;this.vaoGl=bj(i);let n=i.createBuffer();this.vao=this.vaoGl.createVertexArray(),this.vaoGl.bindVertexArray(this.vao),i.enableVertexAttribArray(this.programInfo.attribLocations.a_position),i.bindBuffer(i.ARRAY_BUFFER,n),e=1,t=1,i.bufferData(i.ARRAY_BUFFER,new Float32Array([0,0,e,0,0,t,0,t,e,0,e,t]),i.DYNAMIC_DRAW);let r=i.FLOAT;i.vertexAttribPointer(this.programInfo.attribLocations.a_position,2,r,!1,0,0),this.texcoordBuffer=i.createBuffer(),i.enableVertexAttribArray(this.programInfo.attribLocations.a_texCoord),i.bindBuffer(i.ARRAY_BUFFER,this.texcoordBuffer),i.bufferData(i.ARRAY_BUFFER,this.texturePoints,i.DYNAMIC_DRAW),i.vertexAttribPointer(this.programInfo.attribLocations.a_texCoord,2,r,!1,0,0),this.vaoGl.bindVertexArray(null),i.bindBuffer(i.ARRAY_BUFFER,null)}_setStereoTextureBuffer(e){let t=this.gl;t.enableVertexAttribArray(this.programInfo.attribLocations.a_texCoord),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),t.bufferData(t.ARRAY_BUFFER,this.stereoTexturePoints[e],t.STATIC_DRAW);var i=t.FLOAT;t.vertexAttribPointer(this.programInfo.attribLocations.a_texCoord,2,i,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,null)}_createTextureUVs(){this.texturePoints=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]);let e={x:0,y:0,width:1,height:1};this._shouldUseStereoTexturePoints()&&(this.stereoTexturePoints=[],bH(e,this.layer.colorTexturesMeta[0],this.layer.layout,0,2),this.stereoTexturePoints[0]=this._offsetTextureUVsByRect(this.layer.colorTexturesMeta[0],this.texturePoints,e),bH(e,this.layer.colorTexturesMeta[0],this.layer.layout,1,2),this.stereoTexturePoints[1]=this._offsetTextureUVsByRect(this.layer.colorTexturesMeta[0],this.texturePoints,e))}_offsetTextureUVsByRect(e,t,i){let n=(i=null!=i?i:{x:0,y:0,width:e.width,height:e.height}).x/e.width,r=i.y/e.height,a=i.width/e.width,s=i.height/e.height,o=[];for(let e=0;e<t.length;e+=2){let i=t[e],l=t[e+1],c=i*a+n,h=l*s+r;o[e]=c,o[e+1]=h}return new Float32Array(o)}_shouldUseStereoTexturePoints(){return this.layer.layout===H["stereo-left-right"]||this.layer.layout===H["stereo-top-bottom"]}}let bZ=bX`#version 300 es
885
+
886
+ in vec2 a_position;
887
+ in vec2 a_texCoord;
888
+
889
+ out vec2 v_texCoord;
890
+
891
+ void main() {
892
+ // convert the rectangle from pixels to 0.0 to 1.0
893
+ vec2 zeroToOne = a_position;
894
+
895
+ // convert from 0->1 to 0->2
896
+ vec2 zeroToTwo = zeroToOne * 2.0;
897
+
898
+ // convert from 0->2 to -1->+1 (clipspace)
899
+ vec2 clipSpace = zeroToTwo - 1.0;
900
+
901
+ gl_Position = vec4(clipSpace * vec2(1, 1), 0, 1);
902
+
903
+ // pass the texCoord to the fragment shader
904
+ // The GPU will interpolate this value between points.
905
+ v_texCoord = a_texCoord;
906
+ }
907
+ `,b$=bX`#version 300 es
908
+ precision mediump float;
909
+ precision mediump int;
910
+ precision mediump sampler2DArray;
911
+
912
+ uniform sampler2DArray u_image;
913
+ uniform int u_layer;
914
+
915
+ in vec2 v_texCoord;
916
+
917
+ out vec4 fragColor;
918
+
919
+ void main() {
920
+ vec4 tex = texture(u_image, vec3(v_texCoord.x, v_texCoord.y, u_layer));
921
+ fragColor = vec4(tex.rgb, tex.a);
922
+ }
923
+
924
+ `;class bJ extends bK{constructor(e,t){super(e,t),this.program=bW(this.gl,bZ,b$),this._createVAOs(),this.u_layerInfo=this.gl.getUniformLocation(this.program,"u_layer")}render(e){let t=this.gl;if(this.layer.getTextureType()===V.texture)throw Error("Using texture array projection renderer on a layer without texture array.");let i=e.getBaseLayer(),n=t.getParameter(t.TEXTURE_BINDING_2D_ARRAY);for(let n of(t.bindTexture(t.TEXTURE_2D_ARRAY,this.layer.colorTextures[0]),t.texParameteri(t.TEXTURE_2D_ARRAY,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D_ARRAY,t.TEXTURE_MIN_FILTER,t.LINEAR),e.internalViews)){let r=e.getViewIndex(n),a=i.getViewport(n);t.viewport(a.x,a.y,a.width,a.height),this._renderInternal(r)}t.bindTexture(t.TEXTURE_2D_ARRAY,n)}_renderInternal(e=0){let t=this.gl,i=t.getParameter(t.CURRENT_PROGRAM);t.useProgram(this.program),t.bindVertexArray(this.vao),t.uniform1i(this.u_layerInfo,e);var n=t.TRIANGLES;t.drawArrays(n,0,6),t.bindVertexArray(null),t.useProgram(i)}}let bQ=(e,t)=>e.getTextureType()===V["texture-array"]&&t instanceof WebGL2RenderingContext?new bJ(e,t):new bK(e,t);var b0="u">typeof Float32Array?Float32Array:Array;function b1(){var e=new b0(16);return b0!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function b2(e,t,i){var n=t[0],r=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],h=t[7],u=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],v=t[14],_=t[15],x=i[0],y=i[1],M=i[2],S=i[3];return e[0]=x*n+y*o+M*u+S*m,e[1]=x*r+y*l+M*d+S*g,e[2]=x*a+y*c+M*p+S*v,e[3]=x*s+y*h+M*f+S*_,x=i[4],y=i[5],M=i[6],S=i[7],e[4]=x*n+y*o+M*u+S*m,e[5]=x*r+y*l+M*d+S*g,e[6]=x*a+y*c+M*p+S*v,e[7]=x*s+y*h+M*f+S*_,x=i[8],y=i[9],M=i[10],S=i[11],e[8]=x*n+y*o+M*u+S*m,e[9]=x*r+y*l+M*d+S*g,e[10]=x*a+y*c+M*p+S*v,e[11]=x*s+y*h+M*f+S*_,x=i[12],y=i[13],M=i[14],S=i[15],e[12]=x*n+y*o+M*u+S*m,e[13]=x*r+y*l+M*d+S*g,e[14]=x*a+y*c+M*p+S*v,e[15]=x*s+y*h+M*f+S*_,e}function b3(e,t){var i=t[0],n=t[1],r=t[2],a=t[3],s=i+i,o=n+n,l=r+r,c=i*s,h=n*s,u=n*o,d=r*s,p=r*o,f=r*l,m=a*s,g=a*o,v=a*l;return e[0]=1-u-f,e[1]=h+v,e[2]=d-g,e[3]=0,e[4]=h-v,e[5]=1-c-f,e[6]=p+m,e[7]=0,e[8]=d+g,e[9]=p-m,e[10]=1-c-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function b5(){var e=new b0(2);return b0!=Float32Array&&(e[0]=0,e[1]=0),e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)}),b5();let b4=e=>e,b6=b4`
925
+ attribute vec4 a_position;
926
+ attribute vec2 a_texCoord;
927
+
928
+ uniform mat4 u_matrix;
929
+ uniform mat4 u_projectionMatrix;
930
+
931
+ varying vec2 v_texCoord;
932
+
933
+ void main() {
934
+ // Multiply the position by the matrix.
935
+ gl_Position = u_projectionMatrix * u_matrix * a_position;
936
+
937
+ // pass the texCoord to the fragment shader
938
+ // The GPU will interpolate this value between points.
939
+ v_texCoord = a_texCoord;
940
+ }
941
+ `,b8=b4`
942
+ precision mediump float;
943
+
944
+ // our texture
945
+ uniform sampler2D u_image;
946
+
947
+ // the texCoords passed in from the vertex shader.
948
+ varying vec2 v_texCoord;
949
+
950
+ void main() {
951
+ vec4 tex = texture2D(u_image, v_texCoord);
952
+ gl_FragColor = vec4(tex.rgb, tex.a);
953
+ // gl_FragColor = vec4(1.0, 0, 0, 1.0);
954
+ }
955
+ `,b7=b4`#version 300 es
956
+
957
+ in vec4 a_position;
958
+ in vec2 a_texCoord;
959
+
960
+ uniform mat4 u_matrix;
961
+ uniform mat4 u_projectionMatrix;
962
+
963
+ out vec2 v_texCoord;
964
+
965
+ void main() {
966
+ // Multiply the position by the matrix.
967
+ gl_Position = u_projectionMatrix * u_matrix * a_position;
968
+
969
+ // pass the texCoord to the fragment shader
970
+ // The GPU will interpolate this value between points.
971
+ v_texCoord = a_texCoord;
972
+ }
973
+ `,b9=b4`#version 300 es
974
+ precision mediump float;
975
+ precision mediump int;
976
+ precision mediump sampler2DArray;
977
+
978
+ uniform sampler2DArray u_image;
979
+ uniform int u_layer;
980
+
981
+ in vec2 v_texCoord;
982
+
983
+ out vec4 fragColor;
984
+
985
+ void main() {
986
+ vec4 tex = texture(u_image, vec3(v_texCoord.x, v_texCoord.y, u_layer));
987
+ fragColor = vec4(tex.rgb, tex.a);
988
+ }
989
+
990
+ `;class Ee{constructor(e,t){this.usesTextureArrayShaders=!1,this.savedVaoState={vao:null,arrayBuffer:null},this.hasMipmap=!1,this.gl=t,this.layer=e;let i=this.gl;this.transformMatrix=b1(),t instanceof WebGL2RenderingContext&&this.layer.getTextureType()===V["texture-array"]&&(this.usesTextureArrayShaders=!0),this.usesTextureArrayShaders?this.program=bW(i,b7,b9):this.program=bW(i,b6,b8),this.programInfo={attribLocations:{a_position:i.getAttribLocation(this.program,"a_position"),a_texCoord:i.getAttribLocation(this.program,"a_texCoord")},uniformLocations:{u_matrix:i.getUniformLocation(this.program,"u_matrix"),u_projectionMatrix:i.getUniformLocation(this.program,"u_projectionMatrix")}},this.usesTextureArrayShaders&&(this.programInfo.uniformLocations.u_layer=i.getUniformLocation(this.program,"u_layer"))}saveVaoState(){this.savedVaoState.vao=this.gl.getParameter(this.vaoGl.VERTEX_ARRAY_BINDING),this.savedVaoState.arrayBuffer=this.gl.getParameter(this.gl.ARRAY_BUFFER_BINDING)}restoreVaoState(){this.vaoGl.bindVertexArray(this.savedVaoState.vao),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.savedVaoState.arrayBuffer),this.savedVaoState.vao=this.savedVaoState.arrayBuffer=null}initialize(){let e=this.gl;if(this.layer.isMediaLayer()){this.mediaTexture=e.createTexture(),this.mediaTexturePolyfill={texture:this.mediaTexture,textureFormat:e.RGBA,width:this.layer.media.videoWidth,height:this.layer.media.videoHeight,type:V.texture};let t=e.getParameter(e.TEXTURE_BINDING_2D);e.bindTexture(e.TEXTURE_2D,this.mediaTexture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,this.layer.media.videoWidth,this.layer.media.videoHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),e.bindTexture(e.TEXTURE_2D,t)}this._createVAOs()}render(e,t){this.saveVaoState();let i=this.gl,n=e.getBaseLayer(),r=t.getViewerPose(e.getReferenceSpace()),a=i.getParameter(i.ACTIVE_TEXTURE);for(let s of r.views){let r=n.getViewport(s);if(i.viewport(r.x,r.y,r.width,r.height),i.activeTexture(i.TEXTURE0),this.usesTextureArrayShaders){if(i instanceof WebGLRenderingContext)throw Error("This should never happen; texture-arrays only supported on WebGL2.");if(this.layer.isMediaLayer())throw Error("This should never happen. Media layers should never be created with texture-array");let n=i.getParameter(i.TEXTURE_BINDING_2D_ARRAY);i.bindTexture(i.TEXTURE_2D_ARRAY,this.layer.colorTextures[0]),this.layer.isStatic?(!0===this.layer.needsRedraw&&i.generateMipmap(i.TEXTURE_2D_ARRAY),this.hasMipmap=!0):this.hasMipmap=this.layer.mipLevels>0,i.texParameteri(i.TEXTURE_2D_ARRAY,i.TEXTURE_MAG_FILTER,this.hasMipmap?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),i.texParameteri(i.TEXTURE_2D_ARRAY,i.TEXTURE_MIN_FILTER,this.hasMipmap?i.LINEAR_MIPMAP_LINEAR:i.LINEAR);let r=0;this.layer.layout===H.stereo&&"right"===s.eye&&(r=1),this._shouldUseStereoTexturePoints()?this._renderInternalStereo(e,t,s,r):this._renderInternal(e,t,s,r),i.activeTexture(a),i.bindTexture(i.TEXTURE_2D_ARRAY,n)}else{let n=i.getParameter(i.TEXTURE_BINDING_2D);this.layer.isMediaLayer()?(i.bindTexture(i.TEXTURE_2D,this.mediaTexture),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,!0),i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.layer.media.videoWidth,this.layer.media.videoHeight,i.RGBA,i.UNSIGNED_BYTE,this.layer.media)):this.layer.layout===H.stereo&&"right"===s.eye?i.bindTexture(i.TEXTURE_2D,this.layer.colorTextures[1]):i.bindTexture(i.TEXTURE_2D,this.layer.colorTextures[0]),this.layer.isStatic?(!0===this.layer.needsRedraw&&i.generateMipmap(i.TEXTURE_2D),this.hasMipmap=!0):this.hasMipmap=this.layer.mipLevels>0,i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.hasMipmap?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,this.hasMipmap?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),this._shouldUseStereoTexturePoints()?this._renderInternalStereo(e,t,s):this._renderInternal(e,t,s),i.activeTexture(a),i.bindTexture(i.TEXTURE_2D,n)}}this.restoreVaoState()}createPositionPoints(){return new Float32Array([])}createTextureUVs(){return new Float32Array([])}_offsetTextureUVsByRect(e,t,i){let n=(i=null!=i?i:{x:0,y:0,width:e.width,height:e.height}).x/e.width,r=i.y/e.height,a=i.width/e.width,s=i.height/e.height,o=[];for(let e=0;e<t.length;e+=2){let i=t[e],l=t[e+1],c=i*a+n,h=l*s+r;o[e]=c,o[e+1]=h}return new Float32Array(o)}_shouldUseStereoTexturePoints(){return this.layer.layout===H["stereo-left-right"]||this.layer.layout===H["stereo-top-bottom"]}_setStereoTextureBuffer(e){let t=this.gl;t.enableVertexAttribArray(this.programInfo.attribLocations.a_texCoord),t.bindBuffer(t.ARRAY_BUFFER,this.texcoordBuffer),t.bufferData(t.ARRAY_BUFFER,this.stereoTexturePoints[e],t.STATIC_DRAW);var i=t.FLOAT;t.vertexAttribPointer(this.programInfo.attribLocations.a_texCoord,2,i,!1,0,0),t.bindBuffer(t.ARRAY_BUFFER,null)}_recalculateVertices(){this.positionPoints=this.createPositionPoints(),this.texturePoints=this.createTextureUVs();let e={x:0,y:0,width:1,height:1};if(this._shouldUseStereoTexturePoints()){if(this.stereoTexturePoints=[],this.layer.isMediaLayer()){bH(e,this.mediaTexturePolyfill,this.layer.layout,0,2),this.stereoTexturePoints[0]=this._offsetTextureUVsByRect(this.mediaTexturePolyfill,this.texturePoints,e),bH(e,this.mediaTexturePolyfill,this.layer.layout,1,2),this.stereoTexturePoints[1]=this._offsetTextureUVsByRect(this.mediaTexturePolyfill,this.texturePoints,e),this.layer.layout===H["stereo-top-bottom"]&&([this.stereoTexturePoints[0],this.stereoTexturePoints[1]]=[this.stereoTexturePoints[1],this.stereoTexturePoints[0]]);return}bH(e,this.layer.colorTexturesMeta[0],this.layer.layout,0,2),this.stereoTexturePoints[0]=this._offsetTextureUVsByRect(this.layer.colorTexturesMeta[0],this.texturePoints,e),bH(e,this.layer.colorTexturesMeta[0],this.layer.layout,1,2),this.stereoTexturePoints[1]=this._offsetTextureUVsByRect(this.layer.colorTexturesMeta[0],this.texturePoints,e),this.layer.layout===H["stereo-top-bottom"]&&([this.stereoTexturePoints[0],this.stereoTexturePoints[1]]=[this.stereoTexturePoints[1],this.stereoTexturePoints[0]])}}_createVAOs(){this._recalculateVertices();let e=this.gl;this.vaoGl=bj(e),this.saveVaoState();let t=e.createBuffer();this.vao=this.vaoGl.createVertexArray(),this.vaoGl.bindVertexArray(this.vao),e.enableVertexAttribArray(this.programInfo.attribLocations.a_position),e.bindBuffer(e.ARRAY_BUFFER,t);let i=this.positionPoints;e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW);var n=3,r=e.FLOAT,a=!1,s=0,o=0;e.vertexAttribPointer(this.programInfo.attribLocations.a_position,n,r,a,s,o),e.enableVertexAttribArray(this.programInfo.attribLocations.a_texCoord),this.texcoordBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this.texcoordBuffer),e.bufferData(e.ARRAY_BUFFER,this.texturePoints,e.STATIC_DRAW);var n=2,r=e.FLOAT,a=!1,s=0,o=0;e.vertexAttribPointer(this.programInfo.attribLocations.a_texCoord,n,r,a,s,o),this.restoreVaoState()}_renderInternal(e,t,i,n){let r=this.gl,a=r.getParameter(r.CURRENT_PROGRAM);r.useProgram(this.program),this.vaoGl.bindVertexArray(this.vao),this.usesTextureArrayShaders&&r.uniform1i(this.programInfo.uniformLocations.u_layer,n),this._setTransformMatrix(e,t,i),r.uniformMatrix4fv(this.programInfo.uniformLocations.u_matrix,!1,this.transformMatrix),r.uniformMatrix4fv(this.programInfo.uniformLocations.u_projectionMatrix,!1,i.projectionMatrix);var s=r.TRIANGLES,o=this.positionPoints.length/3;r.drawArrays(s,0,o),this.vaoGl.bindVertexArray(null),r.useProgram(a)}_renderInternalStereo(e,t,i,n){if("none"===i.eye)return this._renderInternal(e,t,i);let r=this.gl;this.vaoGl.bindVertexArray(this.vao);let a=r.getParameter(r.CURRENT_PROGRAM);r.useProgram(this.program),this._setStereoTextureBuffer(+("right"===i.eye)),this.usesTextureArrayShaders&&r.uniform1i(this.programInfo.uniformLocations.u_layer,n),this._setTransformMatrix(e,t,i),r.uniformMatrix4fv(this.programInfo.uniformLocations.u_matrix,!1,this.transformMatrix),r.uniformMatrix4fv(this.programInfo.uniformLocations.u_projectionMatrix,!1,i.projectionMatrix);var s=r.TRIANGLES,o=this.positionPoints.length/3;r.drawArrays(s,0,o),this.vaoGl.bindVertexArray(null),r.useProgram(a)}_setTransformMatrix(e,t,i){let n=t.getPose(this.layer.space,e.getReferenceSpace());b2(this.transformMatrix,n.transform.matrix,this.layer.transform.matrix),b2(this.transformMatrix,i.transform.inverse.matrix,this.transformMatrix)}}class Et extends Ee{constructor(e,t){super(e,t),this.initialize()}createPositionPoints(){let e=this.layer.width,t=this.layer.height;return new Float32Array([-e,-t,0,e,-t,0,-e,t,0,-e,t,0,e,-t,0,e,t,0])}createTextureUVs(){return new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1])}}class Ei extends Ee{constructor(e,t){super(e,t),this.segments=16,this.initialize()}createPositionPoints(){let e=[],t=this.layer.centralAngle,i=this.layer.height,n=this.layer.radius,r=t/this.segments,a=Math.PI/2-t/2,s=[],o=b5();o[0]=n*Math.cos(a),o[1]=-n*Math.sin(a),s.push(o);for(let e=0;e<this.segments;e++){let t=b5();t[0]=n*Math.cos(a+r*(e+1)),t[1]=-n*Math.sin(a+r*(e+1)),s.push(t)}s.reverse();for(let t=0;t<this.segments;t++){let n=s[t],r=s[t+1];e.push(n[0],-i/2,n[1]),e.push(r[0],-i/2,r[1]),e.push(n[0],i/2,n[1]),e.push(n[0],i/2,n[1]),e.push(r[0],-i/2,r[1]),e.push(r[0],i/2,r[1])}return new Float32Array(e)}createTextureUVs(){let e=[],t=1/this.segments;for(let i=0;i<this.segments;i++){let n=t*i,r=t*(i+1);e.push(n,0),e.push(r,0),e.push(n,1),e.push(n,1),e.push(r,0),e.push(r,1)}return new Float32Array(e)}}class En extends Ee{constructor(e,t){super(e,t),this.segmentsPerAxis=40,this.initialize()}createPositionPoints(){let e=[],t=this.layer.radius;0===t&&(t=25),t>25&&(t=25);let i=this.layer.centralHorizontalAngle,n=this.layer.upperVerticalAngle+Math.PI/2,r=this.layer.lowerVerticalAngle+Math.PI/2,a=Math.PI/2-i/2,s=a+i,o=r-n,l=s-a,c=[];for(let e=0;e<=this.segmentsPerAxis;e++)for(let i=0;i<=this.segmentsPerAxis;i++){let r=i/this.segmentsPerAxis,a=e/this.segmentsPerAxis,h=t,u=s-l*r,d=o*a+n,p=Math.cos(u)*Math.sin(d),f=Math.cos(d),m=-Math.sin(u)*Math.sin(d);c.push([h*p,h*f,h*m])}let h=this.segmentsPerAxis+1;for(let t=0;t<this.segmentsPerAxis;t++)for(let i=0;i<this.segmentsPerAxis;i++)e.push(...c[i*h+t]),e.push(...c[i*h+t+1]),e.push(...c[(i+1)*h+t]),e.push(...c[(i+1)*h+t]),e.push(...c[i*h+t+1]),e.push(...c[(i+1)*h+t+1]);return new Float32Array(e)}createTextureUVs(){let e=[],t=[];for(let e=0;e<=this.segmentsPerAxis;e++)for(let i=0;i<=this.segmentsPerAxis;i++){let n=i/this.segmentsPerAxis,r=e/this.segmentsPerAxis;t.push([n,r])}let i=this.segmentsPerAxis+1;for(let n=0;n<this.segmentsPerAxis;n++)for(let r=0;r<this.segmentsPerAxis;r++)e.push(...t[r*i+n]),e.push(...t[r*i+n+1]),e.push(...t[(r+1)*i+n]),e.push(...t[(r+1)*i+n]),e.push(...t[r*i+n+1]),e.push(...t[(r+1)*i+n+1]);return new Float32Array(e)}}let Er={colorFormat:6408,mipLevels:1,layout:H.mono,isStatic:!1,space:null,viewPixelHeight:0,viewPixelWidth:0};class Ea extends bC{constructor(e=Er){if(super(),!bA(e.space))throw TypeError("XRCubeLayer's space needs to be an XRReferenceSpace");switch(this.init=Object.assign(Object.assign({},Er),e),this.space=this.init.space,this.isStatic=this.init.isStatic,this.init.orientation?this.orientation=DOMPointReadOnly.fromPoint(this.init.orientation):this.orientation=new DOMPointReadOnly,this.init.layout){case H.default:case H["stereo-left-right"]:case H["stereo-top-bottom"]:throw TypeError("Invalid layout format for XRCubeLayer")}this.layout=this.init.layout,this.needsRedraw=!0}initialize(e,t){super.initialize(e,t),this._allocateColorTexturesInternal(),this._allocateDepthStencilTexturesInternal()}_allocateColorTexturesInternal(){if(this._colorTextures=[],this._texturesMeta=[],this.layout===H.mono){let e=this._createCubeColorTexture();this._texturesMeta.push(e),this._colorTextures.push(e.texture);return}{let e=this._createCubeColorTexture(),t=this._createCubeColorTexture();this._texturesMeta.push(e,t),this._colorTextures.push(e.texture,t.texture);return}}_allocateDepthStencilTexturesInternal(){if(this._depthStencilTextures=[],this.init.depthFormat){if(this.context instanceof WebGLRenderingContext&&!this.context.getExtension("WEBGL_depth_texture"))throw TypeError("Depth textures not supported in the current context");if(this.layout===H.mono){let e=this._createCubeDepthTexture();this._depthStencilTextures.push(e.texture);return}{let e=this._createCubeDepthTexture(),t=this._createCubeDepthTexture();this._depthStencilTextures.push(e.texture,t.texture);return}}}_createCubeColorTexture(){let e=this.context.createTexture(),t={width:this.init.viewPixelWidth,height:this.init.viewPixelHeight,layers:1,type:V.texture,textureFormat:this.init.colorFormat,texture:e},i=this.context.getParameter(this.context.TEXTURE_BINDING_CUBE_MAP);this.context.bindTexture(this.context.TEXTURE_CUBE_MAP,e);for(let e=0;e<6;e++)this.context.texImage2D(this.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,t.textureFormat,t.width,t.height,0,t.textureFormat,this.context.UNSIGNED_BYTE,null);return this.context.bindTexture(this.context.TEXTURE_CUBE_MAP,i),t}_createCubeDepthTexture(){let e=this.context.createTexture(),t={width:this.init.viewPixelWidth,height:this.init.viewPixelHeight,layers:1,type:V.texture,textureFormat:this.init.depthFormat,texture:e},i=this.context.getParameter(this.context.TEXTURE_BINDING_CUBE_MAP);this.context.bindTexture(this.context.TEXTURE_CUBE_MAP,e);let n=this.init.depthFormat;this.context instanceof WebGL2RenderingContext&&(n===this.context.DEPTH_COMPONENT&&(n=this.context.DEPTH_COMPONENT24),n===this.context.DEPTH_STENCIL&&(n=this.context.DEPTH24_STENCIL8));for(let e=0;e<6;e++)this.context.texImage2D(this.context.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,n,t.width,t.height,0,t.textureFormat,this.context.UNSIGNED_INT,null);return this.context.bindTexture(this.context.TEXTURE_CUBE_MAP,i),t}getTextureType(){return V.texture}}let Es=e=>e,Eo=Es`
991
+ attribute vec4 a_position;
992
+ uniform mat4 u_projectionMatrix;
993
+ uniform mat4 u_matrix;
994
+ varying vec3 v_normal;
995
+
996
+ void main() {
997
+ gl_Position = u_projectionMatrix * u_matrix * a_position;
998
+
999
+ v_normal = normalize(a_position.xyz);
1000
+ }
1001
+ `,El=Es`
1002
+ precision mediump float;
1003
+
1004
+ varying vec3 v_normal;
1005
+
1006
+ uniform samplerCube u_texture;
1007
+
1008
+ void main() {
1009
+ gl_FragColor = textureCube(u_texture, normalize(v_normal));
1010
+ }
1011
+ `;class Ec{constructor(e,t){this.savedVaoState={vao:null,arrayBuffer:null},this.hasMipmap=!1,this.layer=e,this.gl=t,this.transformMatrix=b1(),this.program=bW(t,Eo,El),this.programInfo={attribLocations:{a_position:t.getAttribLocation(this.program,"a_position")},uniformLocations:{u_matrix:t.getUniformLocation(this.program,"u_matrix"),u_texture:t.getUniformLocation(this.program,"u_texture"),u_projectionMatrix:t.getUniformLocation(this.program,"u_projectionMatrix")}},this._createVAOs()}saveVaoState(){this.savedVaoState.vao=this.gl.getParameter(this.vaoGl.VERTEX_ARRAY_BINDING),this.savedVaoState.arrayBuffer=this.gl.getParameter(this.gl.ARRAY_BUFFER_BINDING)}restoreVaoState(){this.vaoGl.bindVertexArray(this.savedVaoState.vao),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.savedVaoState.arrayBuffer),this.savedVaoState.vao=this.savedVaoState.arrayBuffer=null}render(e,t){this.saveVaoState();let i=this.gl,n=e.getBaseLayer(),r=t.getViewerPose(e.getReferenceSpace()),a=i.getParameter(i.ACTIVE_TEXTURE);for(let e of r.views){let t=n.getViewport(e);i.viewport(t.x,t.y,t.width,t.height),i.activeTexture(i.TEXTURE0);let r=i.getParameter(i.TEXTURE_BINDING_CUBE_MAP);if(this.layer.layout===H.stereo){let t=+("right"===e.eye);i.bindTexture(i.TEXTURE_CUBE_MAP,this.layer.colorTextures[t])}else i.bindTexture(i.TEXTURE_CUBE_MAP,this.layer.colorTextures[0]);this.layer.isStatic?(!0===this.layer.needsRedraw&&i.generateMipmap(i.TEXTURE_CUBE_MAP),this.hasMipmap=!0):this.hasMipmap=this.layer.mipLevels>0,i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAG_FILTER,this.hasMipmap?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MIN_FILTER,this.hasMipmap?i.LINEAR_MIPMAP_LINEAR:i.LINEAR),this._renderInternal(this.layer.orientation,e),i.activeTexture(a),i.bindTexture(i.TEXTURE_CUBE_MAP,r)}this.restoreVaoState()}createPositionPoints(){return new Float32Array([-.5,-.5,-.5,-.5,.5,-.5,.5,-.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,-.5,-.5,-.5,-.5,.5,.5,-.5,.5,-.5,.5,.5,-.5,.5,.5,.5,-.5,.5,.5,.5,.5,-.5,.5,-.5,-.5,.5,.5,.5,.5,-.5,-.5,.5,.5,.5,.5,.5,.5,.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,.5,.5,-.5,-.5,.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,.5,-.5,.5,-.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,-.5,.5,-.5,-.5,.5,.5,-.5,.5,-.5,.5,.5,-.5,.5,.5,.5,-.5,.5,.5,.5])}_renderInternal(e,t){let i=this.gl,n=i.getParameter(i.CURRENT_PROGRAM);i.useProgram(this.program),this.vaoGl.bindVertexArray(this.vao),b3(this.transformMatrix,[e.x,e.y,e.z,e.w]),this._poseOrientationMatrix||(this._poseOrientationMatrix=b1()),b3(this._poseOrientationMatrix,[t.transform.inverse.orientation.x,t.transform.inverse.orientation.y,t.transform.inverse.orientation.z,t.transform.inverse.orientation.w]),b2(this.transformMatrix,this.transformMatrix,this._poseOrientationMatrix),i.uniformMatrix4fv(this.programInfo.uniformLocations.u_matrix,!1,this.transformMatrix),i.uniformMatrix4fv(this.programInfo.uniformLocations.u_projectionMatrix,!1,t.projectionMatrix),i.uniform1i(this.programInfo.uniformLocations.u_texture,0);var r=i.TRIANGLES,a=this.positionPoints.length/3;i.drawArrays(r,0,a),this.vaoGl.bindVertexArray(null),i.useProgram(n)}_recalculateVertices(){this.positionPoints=this.createPositionPoints()}_createVAOs(){this._recalculateVertices();let e=this.gl;this.vaoGl=bj(e),this.saveVaoState();let t=e.createBuffer();this.vao=this.vaoGl.createVertexArray(),this.vaoGl.bindVertexArray(this.vao),e.enableVertexAttribArray(this.programInfo.attribLocations.a_position),e.bindBuffer(e.ARRAY_BUFFER,t);let i=this.positionPoints;e.bufferData(e.ARRAY_BUFFER,i,e.STATIC_DRAW);var n=e.FLOAT;e.vertexAttribPointer(this.programInfo.attribLocations.a_position,3,n,!1,0,0),this.restoreVaoState()}}class Eh{constructor(){this.mode="inline",this.layers=[],this.views=[],this.initializedViews=!1,this.isPolyfillActive=!1,this.taskQueue=[]}requestAnimationFrame(e){this.injectedFrameCallback||(this.injectedFrameCallback=(t,i)=>{let n=this.context;if(!this.initializedViews&&this.referenceSpace){let e=i.getViewerPose(this.referenceSpace);e&&(this.views=e.views,this.initializedViews=!0)}if(this.isPolyfillActive&&this.initializedViews){this.tempFramebuffer||(this.tempFramebuffer=n.createFramebuffer()),n.bindFramebuffer(n.FRAMEBUFFER,this.tempFramebuffer);let e=n.getParameter(n.COLOR_CLEAR_VALUE),t=n.getParameter(n.FRAMEBUFFER_BINDING);for(let e of(n.clearColor(0,0,0,0),this.layers))if(e instanceof bV)for(let t=0;t<e.colorTextures.length;t++)e.colorTexturesMeta[t].type===V["texture-array"]||(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,e.colorTextures[t],0),e.depthStencilTextures&&t<e.depthStencilTextures.length?n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,e.depthStencilTextures[t],0):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,null,0),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT));n.bindFramebuffer(n.FRAMEBUFFER,t),n.clearColor(e[0],e[1],e[2],e[3])}if(e(t,i),this.isPolyfillActive&&this.initializedViews){let e=n.isEnabled(n.BLEND),t=n.isEnabled(n.DEPTH_TEST),r=n.isEnabled(n.CULL_FACE),a=n.getParameter(n.FRAMEBUFFER_BINDING),s=n.getParameter(n.COLOR_CLEAR_VALUE);n.bindFramebuffer(n.FRAMEBUFFER,this.getBaseLayer().framebuffer),n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),n.clearColor(s[0],s[1],s[2],s[3]),n.enable(n.BLEND),n.disable(n.DEPTH_TEST),n.disable(n.CULL_FACE);let o=n.getParameter(n.BLEND_SRC_RGB),l=n.getParameter(n.BLEND_SRC_ALPHA),c=n.getParameter(n.BLEND_DST_RGB),h=n.getParameter(n.BLEND_DST_ALPHA);for(let e of(n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA),this.layers))if(this.renderers||(this.renderers=new WeakMap),e instanceof bV)this.renderers.has(e)||this.renderers.set(e,bQ(e,this.context)),this.renderers.get(e).render(this);else if(e instanceof bB)this.renderers.has(e)||this.renderers.set(e,new Et(e,this.context)),this.renderers.get(e).render(this,i);else if(e instanceof bI)this.renderers.has(e)||this.renderers.set(e,new Ei(e,this.context)),this.renderers.get(e).render(this,i);else if(e instanceof bU)this.renderers.has(e)||this.renderers.set(e,new En(e,this.context)),this.renderers.get(e).render(this,i);else if(e instanceof Ea)this.renderers.has(e)||this.renderers.set(e,new Ec(e,this.context)),this.renderers.get(e).render(this,i);else{if(null===e.framebuffer)continue;n instanceof WebGL2RenderingContext?(n.bindFramebuffer(n.READ_FRAMEBUFFER,e.framebuffer),n.bindFramebuffer(n.DRAW_FRAMEBUFFER,this.getBaseLayer().framebuffer),n.blitFramebuffer(0,0,e.framebufferWidth,e.framebufferHeight,0,0,this.getBaseLayer().framebufferWidth,this.getBaseLayer().framebufferHeight,n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT,n.LINEAR)):console.warn("GL blitFramebuffer is not supported on WebGL1, so XRWebGLLayers may not show up properly when polyfilled.")}for(e||n.disable(n.BLEND),t&&n.enable(n.DEPTH_TEST),r&&n.enable(n.CULL_FACE),n.blendFuncSeparate(o,c,l,h),n.bindFramebuffer(n.FRAMEBUFFER,a);this.taskQueue.length>0;)this.taskQueue.shift()()}}),this._requestAnimationFrame(this.injectedFrameCallback)}updateRenderState(e){let t;if(this.existingBaseLayer=e.baseLayer,e.layers&&(this.layers=e.layers),this.activeRenderState||this.createActiveRenderState(),this.activeRenderState=Object.assign(Object.assign({},this.activeRenderState),e),!e.layers)return void this._updateRenderState(e);let i=Object.assign({},e);for(let e of(delete i.layers,this.layers))if(e instanceof bC){t=e.getContext();break}if(!t&&!this.context){console.log("No existing context! Have the session make one");let e=document.createElement("canvas");if((t=e.getContext("webgl2",{xrCompatible:!0}))||(t=e.getContext("webgl",{xrCompatible:!0})),!t)throw Error("No webGL support detected.");function n(){t.canvas.width=t.canvas.clientWidth*window.devicePixelRatio,t.canvas.height=t.canvas.clientHeight*window.devicePixelRatio}document.body.appendChild(t.canvas),window.addEventListener("resize",n),n()}this.createInternalLayer(t),this.isPolyfillActive=!0,this._updateRenderState(Object.assign(Object.assign({},i),{baseLayer:this.internalLayer}))}initializeSession(e){this.mode=e,this.requestReferenceSpace("local").then(e=>{this.referenceSpace=e}).catch(e=>{}),this.requestReferenceSpace("viewer").then(e=>{this.viewerSpace=e})}getBaseLayer(e){return this.internalLayer||this.existingBaseLayer||!e||this.createInternalLayer(e),this.internalLayer||this.existingBaseLayer}getReferenceSpace(){return this.referenceSpace?this.referenceSpace:this.viewerSpace}getViewerSpace(){return this.viewerSpace}queueTask(e){this.taskQueue.push(e)}get renderState(){return this.activeRenderState||this.createActiveRenderState(),this.activeRenderState}get internalViews(){return this.views}getViewIndex(e){for(let t=0;t<this.views.length;t++){let i=this.views[t];if(e.eye===i.eye&&e.recommendedViewportScale===i.recommendedViewportScale)return t}return -1}createInternalLayer(t){if(!t&&this.internalLayer||t===this.context&&this.internalLayer)return this.internalLayer;let i=e.g;return this.internalLayer=new i.XRWebGLLayer(this,t),this.setContext(t),this.internalLayer}setContext(e){this.context=e,this.tempFramebuffer=e.createFramebuffer(),this.renderers=new WeakMap}createActiveRenderState(){let t=Object.getOwnPropertyNames(e.g.XRRenderState.prototype),i={};for(let e of t)i[e]=this._renderState[e];i.layers=[],this.activeRenderState=i}}class Eu{constructor(){this.viewport={x:0,y:0,width:0,height:0}}}class Ed{constructor(e,t){this.session=e,this.context=t,this.subImageCache=new Ep}createProjectionLayer(e=bk){let t=new bV(e);if(this.session.ended)throw Error("Session has ended");if(this.context.isContextLost())throw Error("context is lost");return t.initialize(this.session,this.context),t}createQuadLayer(e=bO){if(this.session.ended)throw Error("Session has ended");if(this.context.isContextLost())throw Error("context is lost");if(e.layout===H.default)throw TypeError("Trying to create a quad layer with default layout");let t=new bB(e);return t.initialize(this.session,this.context),t}createCylinderLayer(e=bP){if(this.session.ended)throw Error("Session has ended");if(this.context.isContextLost())throw Error("context is lost");if(e.layout===H.default)throw TypeError("Cylinder Layer cannot have a default layout");let t=new bI(e);return t.initialize(this.session,this.context),t}createEquirectLayer(e=bN){if(this.session.ended)throw Error("Session has ended");if(this.context.isContextLost())throw Error("context is lost");if(e.layout===H.default)throw TypeError("Equirect Layer cannot have a default layout");if(!bA(e.space))throw TypeError("Equirect layer requires an XRReferenceSpace");let t=new bU(e);return t.initialize(this.session,this.context),t}createCubeLayer(e){if(this.session.ended)throw Error("Session has ended");if(this.context.isContextLost())throw Error("context is lost");if(!(this.context instanceof WebGL2RenderingContext))throw Error("XRCubeLayer only work on WebGL2");if(!bA(e.space))throw TypeError("XRCubeLayer requires a space of type XRReferenceSpace");let t=new Ea(e);return t.initialize(this.session,this.context),t}getSubImage(e,t,i="none"){if(e.isStatic&&!1===e.needsRedraw)throw Error("Invalid state for subimage creation");let n=this.subImageCache.tryGetCachedSubImage(this.context,e,i);if(n)return n;let r=new Eu;if(e instanceof bV||e.layout===H.default)throw TypeError();if(!this.validateStateofSubImageCreation(e,t))throw Error("Invalid state for subimage creation");let a=0;if(e.layout===H.stereo){if("none"===i)throw TypeError();"right"===i&&(a=1)}e.getTextureType()===V["texture-array"]?r.imageIndex=a:r.imageIndex=0;let s=0;e.getTextureType()===V.texture?(r.colorTexture=e.colorTextures[a],s=a):(r.colorTexture=e.colorTextures[0],s=0),e.depthStencilTextures&&e.depthStencilTextures.length?e.getTextureType()===V.texture?r.depthStencilTexture=e.depthStencilTextures[a]:r.depthStencilTexture=e.depthStencilTextures[0]:r.depthStencilTexture=null;let o=e.colorTexturesMeta[s];r.textureWidth=o.width,r.textureHeight=o.height;let l=1;return(e.layout===H["stereo-left-right"]||e.layout===H["stereo-top-bottom"])&&(l=2),bH(r.viewport,o,e.layout,a,l),this.session.queueTask(()=>{e.needsRedraw=!1}),this.subImageCache.cacheSubImage(r,this.context,e,i),r}getViewSubImage(e,t){let i=this.subImageCache.tryGetCachedViewSubImage(this.context,e,t);if(i)return i;let n=new Eu,r=this.session;if(!r.internalViews||!r.internalViews.length)return console.warn("Tried to get view sub image before we have any views"),n;let a=r.getViewIndex(t),s=0;return e.getTextureType()===V["texture-array"]?n.imageIndex=a:n.imageIndex=0,e.layout===H.default&&e.getTextureType()===V.texture?(n.colorTexture=e.colorTextures[a],s=a):(n.colorTexture=e.colorTextures[0],s=0),0===e.depthStencilTextures.length?n.depthStencilTexture=null:e.layout===H.default&&e.getTextureType()===V.texture?n.depthStencilTexture=e.depthStencilTextures[a]:n.depthStencilTexture=e.depthStencilTextures[0],n.textureWidth=e.colorTexturesMeta[s].width,n.textureHeight=e.colorTexturesMeta[s].height,bH(n.viewport,e.colorTexturesMeta[s],e.layout,a,r.internalViews.length),e.needsRedraw=!1,this.subImageCache.cacheViewSubImage(n,this.context,e,t),n}validateStateofSubImageCreation(e,t){return t.session===e.session&&this.session===e.session&&this.context===e.context&&!!e.colorTextures&&!!e.colorTextures.length&&(!e.isStatic||!1!==e.needsRedraw)}}class Ep{constructor(){this.cache=new Map,this.viewCache=new Map}cacheSubImage(e,t,i,n){let r=new Map;r.set(n,e);let a=new Map;a.set(i,r),this.cache.set(t,a)}tryGetCachedSubImage(e,t,i){var n,r;return null==(r=null==(n=this.cache.get(e))?void 0:n.get(t))?void 0:r.get(i)}cacheViewSubImage(e,t,i,n){let r=new Map;r.set(n,e);let a=new Map;a.set(i,r),this.viewCache.set(t,a)}tryGetCachedViewSubImage(e,t,i){var n,r;return null==(r=null==(n=this.viewCache.get(e))?void 0:n.get(t))?void 0:r.get(i)}}let Ef=class{constructor(){this.injected=!1;const t=e.g;this._injectPolyfill(t)}_injectPolyfill(e){if(!("xr"in e.navigator))throw Error("WebXR Layers polyfill requires WebXR support.");!0===this.injected&&console.warn("Polyfill has already been injected..."),e.navigator.xr&&e.XRMediaBinding&&e.XRWebGLBinding||(this._polyfillRequiredLayersFeature(e),this._polyfillXRSession(e),e.XRWebGLBinding=Ed,e.XRMediaBinding=bz,this.injected=!0,console.log("Injected Layers Polyfill"))}_polyfillXRSession(e){e.XRSession.prototype._updateRenderState=e.XRSession.prototype.updateRenderState,e.XRSession.prototype._requestAnimationFrame=e.XRSession.prototype.requestAnimationFrame;let t=Object.getOwnPropertyDescriptor(e.XRSession.prototype,"renderState");Object.defineProperty(e.XRSession.prototype,"_renderState",t);let i=Object.getOwnPropertyDescriptor(Eh.prototype,"renderState");for(let t of(Object.defineProperty(e.XRSession.prototype,"renderState",i),Object.getOwnPropertyNames(Eh.prototype))){let i=Object.getOwnPropertyDescriptor(Eh.prototype,t);Object.defineProperty(e.XRSession.prototype,t,i)}}_polyfillRequiredLayersFeature(e){let t=e.navigator.xr.requestSession;Object.defineProperty(e.navigator.xr,"requestSessionInternal",{writable:!0}),e.navigator.xr.requestSessionInternal=t,Object.defineProperty(e.navigator.xr,"requestSession",{writable:!0}),e.navigator.xr.requestSession=(t,i)=>{let n=(i,n)=>e.navigator.xr.requestSessionInternal(i,n).then(e=>(Object.assign(e,new Eh),e.initializeSession(t),Promise.resolve(e)));if("immersive-vr"!==t||!i)return n(t,i);if(i.requiredFeatures&&i.requiredFeatures.indexOf("layers")>-1){let e=Object.assign({},i),r=[...i.requiredFeatures],a=r.indexOf("layers");return r.splice(a,1),e.requiredFeatures=r,n(t,e)}return n(t,i)}}},Em={ipd:.063,fovy:Math.PI/2,headsetPosition:new ST(0,1.6,0),headsetQuaternion:new Sw,stereoEnabled:!1};class Eg{constructor(e,t={}){var i,n,r,a,s,o;this.version=bb;const l=new Mw,c=new S0(O.Viewer,l),h={[F.Left]:new MT(c),[F.Right]:new MT(c),[F.None]:new MT(c)},u=e.controllerConfig,d={};u&&Object.values(L).forEach(e=>{u.layout[e]&&(d[e]=new SU(u,e,l))});const p={[L.Left]:new b_(ba,L.Left,l),[L.Right]:new b_(ba,L.Right,l)},f=null!=(i=t.canvasContainer)?i:document.createElement("div");f.dataset.webxr_runtime=`Immersive Web Emulation Runtime v${bb}`,f.style.position="fixed",f.style.width="100%",f.style.height="100%",f.style.top="0",f.style.left="0",f.style.display="flex",f.style.justifyContent="center",f.style.alignItems="center",f.style.overflow="hidden",f.style.zIndex="999",this[Mi]={name:e.name,supportedSessionModes:e.supportedSessionModes,supportedFeatures:e.supportedFeatures,supportedFrameRates:e.supportedFrameRates,isSystemKeyboardSupported:e.isSystemKeyboardSupported,internalNominalFrameRate:e.internalNominalFrameRate,environmentBlendModes:e.environmentBlendModes,interactionMode:e.interactionMode,userAgent:e.userAgent,position:null!=(n=t.headsetPosition)?n:Em.headsetPosition.clone(),quaternion:null!=(r=t.headsetQuaternion)?r:Em.headsetQuaternion.clone(),stereoEnabled:null!=(a=t.stereoEnabled)?a:Em.stereoEnabled,ipd:null!=(s=t.ipd)?s:Em.ipd,fovy:null!=(o=t.fovy)?o:Em.fovy,controllers:d,hands:p,primaryInputMode:"controller",pendingReferenceSpaceReset:!1,visibilityState:"visible",pendingVisibilityState:null,xrSystem:null,matrix:yx.create(),globalSpace:l,viewerSpace:c,viewSpaces:h,canvasContainer:f,getViewport:(e,t)=>{let{width:i,height:n}=e.context.canvas;switch(t.eye){case F.None:return new bw(0,0,i,n);case F.Left:return new bw(0,0,this[Mi].stereoEnabled?i/2:i,n);case F.Right:return new bw(i/2,0,this[Mi].stereoEnabled?i/2:0,n)}},updateViews:()=>{let e=this[Mi].viewerSpace;yx.fromRotationTranslation(e[My].offsetMatrix,this[Mi].quaternion.quat,this[Mi].position.vec3),yx.fromTranslation(this[Mi].viewSpaces[F.Left][My].offsetMatrix,y7.fromValues(-this[Mi].ipd/2,0,0)),yx.fromTranslation(this[Mi].viewSpaces[F.Right][My].offsetMatrix,y7.fromValues(this[Mi].ipd/2,0,0))},onBaseLayerSet:e=>{if(!e)return;let t=e.context.canvas;if(t.parentElement!==this[Mi].canvasContainer){let e=this[Mi].devui;if(e){let{devUICanvas:t,devUIContainer:i}=e;t.style.zIndex="3",i.style.zIndex="4",this[Mi].canvasContainer.appendChild(e.devUICanvas),this[Mi].canvasContainer.appendChild(e.devUIContainer)}let i=this[Mi].sem;i&&(i.environmentCanvas.style.zIndex="1",this[Mi].canvasContainer.appendChild(i.environmentCanvas)),this[Mi].canvasData={canvas:t,parent:t.parentElement,width:t.width,height:t.height,zIndex:t.style.zIndex},t.style.zIndex="2",this[Mi].canvasContainer.appendChild(t),document.body.appendChild(this[Mi].canvasContainer)}t.width=window.innerWidth,t.height=window.innerHeight},onSessionEnd:()=>{if(this[Mi].canvasData){let{canvas:e,parent:t,width:i,height:n,zIndex:r}=this[Mi].canvasData;e.width=i,e.height=n,e.style.zIndex=r,t?t.appendChild(e):this[Mi].canvasContainer.removeChild(e);let a=this[Mi].devui;a&&(this[Mi].canvasContainer.removeChild(a.devUICanvas),this[Mi].canvasContainer.removeChild(a.devUIContainer));let s=this[Mi].sem;s&&this[Mi].canvasContainer.removeChild(s.environmentCanvas),document.body.removeChild(this[Mi].canvasContainer),this[Mi].canvasData=void 0,window.dispatchEvent(new Event("resize"))}},onFrameStart:e=>{var t;if(null==(t=this[Mi].actionPlayer)?void 0:t.playing)this[Mi].actionPlayer.playFrame();else{let t=e.session;this[Mi].updateViews(),this[Mi].pendingVisibilityState&&(this[Mi].visibilityState=this[Mi].pendingVisibilityState,this[Mi].pendingVisibilityState=null,t.dispatchEvent(new S2("visibilitychange",{session:t}))),"visible"===this[Mi].visibilityState&&this.activeInputs.forEach(t=>{t.onFrameStart(e)}),this[Mi].pendingReferenceSpaceReset&&(t[Mv].referenceSpaces.forEach(e=>{switch(e[Mx].type){case O.Local:case O.LocalFloor:case O.BoundedFloor:case O.Unbounded:e.dispatchEvent(new bE("reset",{referenceSpace:e}))}}),this[Mi].pendingReferenceSpaceReset=!1)}this[Mi].updateViews()}},this[Mi].updateViews()}installRuntime(e){var t;let i=null!=(t=null==e?void 0:e.globalObject)?t:globalThis,n=null==e?void 0:e.polyfillLayers;Object.defineProperty(WebGL2RenderingContext.prototype,"makeXRCompatible",{value:function(){return new Promise((e,t)=>{e(!0)})},configurable:!0}),this[Mi].xrSystem=new bT(this),Object.defineProperty(globalThis.navigator,"xr",{value:this[Mi].xrSystem,configurable:!0}),Object.defineProperty(navigator,"userAgent",{value:this[Mi].userAgent,writable:!1,configurable:!1,enumerable:!0}),i.XRSystem=bT,i.XRSession=bi,i.XRRenderState=S1,i.XRFrame=bt,i.XRSpace=MT,i.XRReferenceSpace=S0,i.XRJointSpace=br,i.XRView=S3,i.XRViewport=bw,i.XRRigidTransform=SY,i.XRPose=S5,i.XRViewerPose=S6,i.XRJointPose=S4,i.XRInputSource=SL,i.XRInputSourceArray=SP,i.XRHand=bn,i.XRLayer=bx,i.XRWebGLLayer=bM,i.XRSessionEvent=S2,i.XRInputSourceEvent=SI,i.XRInputSourcesChangeEvent=SQ,i.XRReferenceSpaceEvent=bE,n?new Ef:(i.XRMediaBinding=void 0,i.XRWebGLBinding=void 0)}installDevUI(e){this[Mi].devui=new e(this)}installSEM(e){this[Mi].sem=new e(this)}get supportedSessionModes(){return this[Mi].supportedSessionModes}get supportedFeatures(){return this[Mi].supportedFeatures}get supportedFrameRates(){return this[Mi].supportedFrameRates}get isSystemKeyboardSupported(){return this[Mi].isSystemKeyboardSupported}get internalNominalFrameRate(){return this[Mi].internalNominalFrameRate}get stereoEnabled(){return this[Mi].stereoEnabled}set stereoEnabled(e){this[Mi].stereoEnabled=e}get ipd(){return this[Mi].ipd}set ipd(e){this[Mi].ipd=e}get fovy(){return this[Mi].fovy}set fovy(e){this[Mi].fovy=e}get position(){return this[Mi].position}get quaternion(){return this[Mi].quaternion}get viewerSpace(){var e;return(null==(e=this[Mi].actionPlayer)?void 0:e.playing)?this[Mi].actionPlayer.viewerSpace:this[Mi].viewerSpace}get viewSpaces(){var e;return(null==(e=this[Mi].actionPlayer)?void 0:e.playing)?this[Mi].actionPlayer.viewSpaces:this[Mi].viewSpaces}get controllers(){return this[Mi].controllers}get hands(){return this[Mi].hands}get primaryInputMode(){return this[Mi].primaryInputMode}set primaryInputMode(e){"controller"!==e&&"hand"!==e?console.warn('primary input mode can only be "controller" or "hand"'):this[Mi].primaryInputMode=e}get activeInputs(){return"visible"!==this[Mi].visibilityState?[]:("controller"===this[Mi].primaryInputMode?Object.values(this[Mi].controllers):Object.values(this[Mi].hands)).filter(e=>e.connected)}get inputSources(){var e;return(null==(e=this[Mi].actionPlayer)?void 0:e.playing)?this[Mi].actionPlayer.inputSources:this.activeInputs.map(e=>e.inputSource)}get canvasContainer(){return this[Mi].canvasContainer}get canvasDimensions(){if(this[Mi].canvasData){let{width:e,height:t}=this[Mi].canvasData.canvas;return{width:e,height:t}}}get activeSession(){var e;return null==(e=this[Mi].xrSystem)?void 0:e[Mo].activeSession}get sessionOffered(){var e;return!!(null==(e=this[Mi].xrSystem)?void 0:e[Mo].offeredSessionConfig)}get name(){return this[Mi].name}grantOfferedSession(){let e=this[Mi].xrSystem,t=null==e?void 0:e[Mo];if(t&&t.offeredSessionConfig){let{resolve:i,reject:n,mode:r,options:a}=t.offeredSessionConfig;t.offeredSessionConfig=void 0,e.requestSession(r,a).then(i).catch(n)}}recenter(){let e=new ST(-this.position.x,0,-this.position.z),t=new ST(0,0,-1).applyQuaternion(this.quaternion);t.y=0,t.normalize();let i=Math.atan2(t.x,-t.z),n=new Sw().setFromAxisAngle(new ST(0,1,0),i);this.position.add(e),this.quaternion.multiply(n),[...Object.values(this[Mi].controllers),...Object.values(this[Mi].hands)].forEach(t=>{t.position.add(e),t.quaternion.multiply(n),t.position.applyQuaternion(n)}),this[Mi].pendingReferenceSpaceReset=!0}get visibilityState(){return this[Mi].visibilityState}updateVisibilityState(e){if(!Object.values(["visible","visible-blurred","hidden"]).includes(e))throw new DOMException("Invalid XRVisibilityState value","NotSupportedError");e!==this[Mi].visibilityState&&(this[Mi].pendingVisibilityState=e)}createActionPlayer(e,t){return this[Mi].actionPlayer=new bS(e,t,this[Mi].ipd),this[Mi].actionPlayer}get devui(){return this[Mi].devui}get sem(){return this[Mi].sem}}let Ev={mapping:P.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"x-button",type:"binary"},{id:"y-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},E_={mapping:P.XRStandard,buttons:[{id:"trigger",type:"analog",eventTrigger:"select"},{id:"squeeze",type:"analog",eventTrigger:"squeeze"},null,{id:"thumbstick",type:"binary"},{id:"a-button",type:"binary"},{id:"b-button",type:"binary"},{id:"thumbrest",type:"binary"}],axes:[null,null,{id:"thumbstick",type:"x-axis"},{id:"thumbstick",type:"y-axis"}]},Ex={name:"Oculus Quest 1",controllerConfig:{profileId:"oculus-touch-v2",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:Ev,gripOffsetMatrix:[.9925461411476135,4673031295254759e-24,-.12186938524246216,0,.08617470413446426,.7071065306663513,.7018362283706665,0,.0861746296286583,-.70710688829422,.7018358707427979,0,-.003979847766458988,-.01585787907242775,.04964185878634453,1],numHapticActuators:1},right:{gamepad:E_,gripOffsetMatrix:[.9925461411476135,3688163374704345e-23,.12186937034130096,0,-.08617469668388367,.7071066498756409,.7018361687660217,0,-.0861746147274971,-.7071068286895752,.7018359899520874,0,.003979853354394436,-.01585787907242775,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:["inline","immersive-vr","immersive-ar"],supportedFeatures:["viewer","local","local-floor","bounded-floor","unbounded","anchors","plane-detection","hand-tracking"],supportedFrameRates:[72,80,90],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,environmentBlendModes:{"immersive-vr":B.Opaque,"immersive-ar":B.AlphaBlend},interactionMode:z.WorldSpace,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 1) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},Ey={name:"Meta Quest 2",controllerConfig:{profileId:"oculus-touch-v3",fallbackProfileIds:["oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:Ev,gripOffsetMatrix:[.9925461411476135,20823669899527886e-24,-.12186937034130096,0,.08617465198040009,.7071067094802856,.701836109161377,0,.08617466688156128,-.7071067690849304,.7018360495567322,0,-.003979838453233242,-.015857907012104988,.04964181408286095,1],numHapticActuators:1},right:{gamepad:E_,gripOffsetMatrix:[.9925461411476135,-8329467959811154e-23,.12186941504478455,0,-.08617465943098068,.7071066498756409,.7018361687660217,0,-.08617471158504486,-.7071068286895752,.7018359303474426,0,.003979798872023821,-.015857888385653496,.049641866236925125,1],numHapticActuators:1}}},supportedSessionModes:["inline","immersive-vr","immersive-ar"],supportedFeatures:["viewer","local","local-floor","bounded-floor","unbounded","anchors","plane-detection","mesh-detection","hit-test","hand-tracking"],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:72,environmentBlendModes:{"immersive-vr":B.Opaque,"immersive-ar":B.AlphaBlend},interactionMode:z.WorldSpace,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 2) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},EM={name:"Meta Quest Pro",controllerConfig:{profileId:"meta-quest-touch-pro",fallbackProfileIds:["oculus-touch-v2","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:Ev,gripOffsetMatrix:[.9925461411476135,-15779937356796836e-24,-.12186935544013977,0,.08617467433214188,.7071067094802856,.701836109161377,0,.0861746296286583,-.7071067690849304,.7018360495567322,0,-.003979836590588093,-.015857847407460213,.049641840159893036,1],numHapticActuators:3},right:{gamepad:E_,gripOffsetMatrix:[.9925461411476135,9267653311439972e-26,.12186937034130096,0,-.08617467433214188,.7071067094802856,.7018361687660217,0,-.08617464452981949,-.7071067690849304,.7018360495567322,0,.003979847766458988,-.01585782691836357,.04964186251163483,1],numHapticActuators:3}}},supportedSessionModes:["inline","immersive-vr","immersive-ar"],supportedFeatures:["viewer","local","local-floor","bounded-floor","unbounded","anchors","plane-detection","mesh-detection","hit-test","hand-tracking"],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,environmentBlendModes:{"immersive-vr":B.Opaque,"immersive-ar":B.AlphaBlend},interactionMode:z.WorldSpace,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest Pro) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"},ES={name:"Meta Quest 3",controllerConfig:{profileId:"meta-quest-touch-plus",fallbackProfileIds:["oculus-touch-v3","oculus-touch","generic-trigger-squeeze-thumbstick"],layout:{left:{gamepad:Ev,gripOffsetMatrix:[.9925461411476135,10736208366779465e-24,-.12186933308839798,0,.08617459982633591,.70710688829422,.7018360495567322,0,.08617466688156128,-.7071067094802856,.7018362283706665,0,-.003979803062975407,-.015857873484492302,.04964187368750572,1],numHapticActuators:1},right:{gamepad:E_,gripOffsetMatrix:[.9925461411476135,-26238110351073374e-24,.12186934053897858,0,-.0861746147274971,.7071067690849304,.7018360495567322,0,-.08617465943098068,-.7071067094802856,.701836109161377,0,.003979838453233242,-.015857869759202003,.04964182525873184,1],numHapticActuators:1}}},supportedSessionModes:["inline","immersive-vr","immersive-ar"],supportedFeatures:["viewer","local","local-floor","bounded-floor","unbounded","anchors","plane-detection","mesh-detection","hit-test","hand-tracking","depth-sensing"],supportedFrameRates:[72,80,90,120],isSystemKeyboardSupported:!0,internalNominalFrameRate:90,environmentBlendModes:{"immersive-vr":B.Opaque,"immersive-ar":B.AlphaBlend},interactionMode:z.WorldSpace,userAgent:"Mozilla/5.0 (X11; Linux x86_64; Quest 3) AppleWebKit/537.36 (KHTML, like Gecko) OculusBrowser/33.0.0.x.x.x Chrome/126.0.6478.122 VR Safari/537.36"};var yx=yx,SE=SE,y7=y7;function Eb(){let e=0,t=0;for(let i=0;i<28;i+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<i,(128&n)==0)return this.assertBounds(),[e,t]}let i=this.buf[this.pos++];if(e|=(15&i)<<28,t=(112&i)>>4,(128&i)==0)return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<i,(128&n)==0)return this.assertBounds(),[e,t]}throw Error("invalid varint")}function EE(e,t,i){for(let n=0;n<28;n+=7){let r=e>>>n,a=r>>>7!=0||0!=t,s=(a?128|r:r)&255;if(i.push(s),!a)return}let n=e>>>28&15|(7&t)<<4,r=t>>3!=0;if(i.push((r?128|n:n)&255),r){for(let e=3;e<31;e+=7){let n=t>>>e,r=n>>>7!=0,a=(r?128|n:n)&255;if(i.push(a),!r)return}i.push(t>>>31&1)}}function ET(e){let t="-"===e[0];t&&(e=e.slice(1));let i=0,n=0;function r(t,r){let a=Number(e.slice(t,r));n*=1e6,(i=1e6*i+a)>=0x100000000&&(n+=i/0x100000000|0,i%=0x100000000)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),t?ER(i,n):EA(i,n)}function Ew(e,t){if({lo:e,hi:t}={lo:e>>>0,hi:t>>>0},t<=2097151)return String(0x100000000*t+e);let i=0xffffff&e,n=(e>>>24|t<<8)&0xffffff,r=t>>16&65535,a=i+6777216*n+6710656*r,s=n+8147497*r,o=2*r;return a>=1e7&&(s+=Math.floor(a/1e7),a%=1e7),s>=1e7&&(o+=Math.floor(s/1e7),s%=1e7),o.toString()+EC(s)+EC(a)}function EA(e,t){return{lo:0|e,hi:0|t}}function ER(e,t){return t=~t,e?e=~e+1:t+=1,EA(e,t)}let EC=e=>{let t=String(e);return"0000000".slice(t.length)+t};function EP(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let i=0;i<9;i++)t.push(127&e|128),e>>=7;t.push(1)}}function EL(){let e=this.buf[this.pos++],t=127&e;if((128&e)==0||(t|=(127&(e=this.buf[this.pos++]))<<7,(128&e)==0)||(t|=(127&(e=this.buf[this.pos++]))<<14,(128&e)==0)||(t|=(127&(e=this.buf[this.pos++]))<<21,(128&e)==0))return this.assertBounds(),t;t|=(15&(e=this.buf[this.pos++]))<<28;for(let t=5;(128&e)!=0&&t<10;t++)e=this.buf[this.pos++];if((128&e)!=0)throw Error("invalid varint");return this.assertBounds(),t>>>0}let EI=function(){let e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&(globalThis.Deno||"object"!=typeof K.default||"object"!=typeof K.default.env||"1"!==K.default.env.BUF_BIGINT_DISABLE)){let t=BigInt("-9223372036854775808"),i=BigInt("9223372036854775807"),n=BigInt("0"),r=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){let n="bigint"==typeof e?e:BigInt(e);if(n>i||n<t)throw Error(`invalid int64: ${e}`);return n},uParse(e){let t="bigint"==typeof e?e:BigInt(e);if(t>r||t<n)throw Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,i)=>(e.setInt32(0,t,!0),e.setInt32(4,i,!0),e.getBigInt64(0,!0)),uDec:(t,i)=>(e.setInt32(0,t,!0),e.setInt32(4,i,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),EN(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),ED(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),EN(e),ET(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),ED(e),ET(e)),dec:(e,t)=>{let i,n,r;return(n=0x80000000&(i=EA(e,t)).hi)&&(i=ER(i.lo,i.hi)),r=Ew(i.lo,i.hi),n?"-"+r:r},uDec:(e,t)=>Ew(e,t)}}();function EN(e){if(!/^-?[0-9]+$/.test(e))throw Error("invalid int64: "+e)}function ED(e){if(!/^[0-9]+$/.test(e))throw Error("invalid uint64: "+e)}let EU=Symbol.for("@bufbuild/protobuf/text-encoding");function EO(){if(void 0==globalThis[EU]){let e=new globalThis.TextEncoder,t=new globalThis.TextDecoder;globalThis[EU]={encodeUtf8:t=>e.encode(t),decodeUtf8:e=>t.decode(e),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(e){return!1}}}}return globalThis[EU]}(T=G||(G={}))[T.Varint=0]="Varint",T[T.Bit64=1]="Bit64",T[T.LengthDelimited=2]="LengthDelimited",T[T.StartGroup=3]="StartGroup",T[T.EndGroup=4]="EndGroup",T[T.Bit32=5]="Bit32";class EF{constructor(e=EO().encodeUtf8){this.encodeUtf8=e,this.stack=[],this.chunks=[],this.buf=[]}finish(){this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]);let e=0;for(let t=0;t<this.chunks.length;t++)e+=this.chunks[t].length;let t=new Uint8Array(e),i=0;for(let e=0;e<this.chunks.length;e++)t.set(this.chunks[e],i),i+=this.chunks[e].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Ek(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Ez(e),EP(e,this.buf),this}bool(e){return this.buf.push(+!!e),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let t=this.encodeUtf8(e);return this.uint32(t.byteLength),this.raw(t)}float(e){var t=e;if("string"==typeof t){let e=t;if(Number.isNaN(t=Number(t))&&"NaN"!==e)throw Error("invalid float32: "+e)}else if("number"!=typeof t)throw Error("invalid float32: "+typeof t);if(Number.isFinite(t)&&(t>34028234663852886e22||t<-34028234663852886e22))throw Error("invalid float32: "+t);let i=new Uint8Array(4);return new DataView(i.buffer).setFloat32(0,e,!0),this.raw(i)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Ek(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Ez(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Ez(e),EP(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),n=EI.enc(e);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),i=new DataView(t.buffer),n=EI.uEnc(e);return i.setInt32(0,n.lo,!0),i.setInt32(4,n.hi,!0),this.raw(t)}int64(e){let t=EI.enc(e);return EE(t.lo,t.hi,this.buf),this}sint64(e){let t=EI.enc(e),i=t.hi>>31;return EE(t.lo<<1^i,(t.hi<<1|t.lo>>>31)^i,this.buf),this}uint64(e){let t=EI.uEnc(e);return EE(t.lo,t.hi,this.buf),this}}class EB{constructor(e,t=EO().decodeUtf8){this.decodeUtf8=t,this.varint64=Eb,this.uint32=EL,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.uint32(),t=e>>>3,i=7&e;if(t<=0||i<0||i>5)throw Error("illegal tag: field no "+t+" wire type "+i);return[t,i]}skip(e,t){let i=this.pos;switch(e){case G.Varint:for(;128&this.buf[this.pos++];);break;case G.Bit64:this.pos+=4;case G.Bit32:this.pos+=4;break;case G.LengthDelimited:let n=this.uint32();this.pos+=n;break;case G.StartGroup:for(;;){let[e,i]=this.tag();if(i===G.EndGroup){if(void 0!==t&&e!==t)throw Error("invalid end group tag");break}this.skip(i,e)}break;default:throw Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return EI.dec(...this.varint64())}uint64(){return EI.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),i=-(1&e);return e=(e>>>1|(1&t)<<31)^i,t=t>>>1^i,EI.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return EI.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return EI.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.decodeUtf8(this.bytes())}}function Ez(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>0x7fffffff||e<-0x80000000)throw Error("invalid int32: "+e)}function Ek(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>0xffffffff||e<0)throw Error("invalid uint32: "+e)}let EV={encode:(e,t=new EF)=>(0!==e.x&&t.uint32(13).float(e.x),0!==e.y&&t.uint32(21).float(e.y),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r={x:0,y:0};for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(13!==e)break;r.x=i.float();continue;case 2:if(21!==e)break;r.y=i.float();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({x:E2(e.x)?globalThis.Number(e.x):0,y:E2(e.y)?globalThis.Number(e.y):0}),toJSON(e){let t={};return 0!==e.x&&(t.x=e.x),0!==e.y&&(t.y=e.y),t},create:e=>EV.fromPartial(null!=e?e:{}),fromPartial(e){var t,i;let n={x:0,y:0};return n.x=null!=(t=e.x)?t:0,n.y=null!=(i=e.y)?i:0,n}};function EH(){return{width:0,height:0}}let EG={encode:(e,t=new EF)=>(0!==e.width&&t.uint32(13).float(e.width),0!==e.height&&t.uint32(21).float(e.height),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=EH();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(13!==e)break;r.width=i.float();continue;case 2:if(21!==e)break;r.height=i.float();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({width:E2(e.width)?globalThis.Number(e.width):0,height:E2(e.height)?globalThis.Number(e.height):0}),toJSON(e){let t={};return 0!==e.width&&(t.width=e.width),0!==e.height&&(t.height=e.height),t},create:e=>EG.fromPartial(null!=e?e:{}),fromPartial(e){var t,i;let n=EH();return n.width=null!=(t=e.width)?t:0,n.height=null!=(i=e.height)?i:0,n}};function EW(){return{x:0,y:0,z:0}}let Ej={encode:(e,t=new EF)=>(0!==e.x&&t.uint32(13).float(e.x),0!==e.y&&t.uint32(21).float(e.y),0!==e.z&&t.uint32(29).float(e.z),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=EW();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(13!==e)break;r.x=i.float();continue;case 2:if(21!==e)break;r.y=i.float();continue;case 3:if(29!==e)break;r.z=i.float();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({x:E2(e.x)?globalThis.Number(e.x):0,y:E2(e.y)?globalThis.Number(e.y):0,z:E2(e.z)?globalThis.Number(e.z):0}),toJSON(e){let t={};return 0!==e.x&&(t.x=e.x),0!==e.y&&(t.y=e.y),0!==e.z&&(t.z=e.z),t},create:e=>Ej.fromPartial(null!=e?e:{}),fromPartial(e){var t,i,n;let r=EW();return r.x=null!=(t=e.x)?t:0,r.y=null!=(i=e.y)?i:0,r.z=null!=(n=e.z)?n:0,r}};function EX(){return{width:0,height:0,depth:0}}let Eq={encode:(e,t=new EF)=>(0!==e.width&&t.uint32(13).float(e.width),0!==e.height&&t.uint32(21).float(e.height),0!==e.depth&&t.uint32(29).float(e.depth),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=EX();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(13!==e)break;r.width=i.float();continue;case 2:if(21!==e)break;r.height=i.float();continue;case 3:if(29!==e)break;r.depth=i.float();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({width:E2(e.width)?globalThis.Number(e.width):0,height:E2(e.height)?globalThis.Number(e.height):0,depth:E2(e.depth)?globalThis.Number(e.depth):0}),toJSON(e){let t={};return 0!==e.width&&(t.width=e.width),0!==e.height&&(t.height=e.height),0!==e.depth&&(t.depth=e.depth),t},create:e=>Eq.fromPartial(null!=e?e:{}),fromPartial(e){var t,i,n;let r=EX();return r.width=null!=(t=e.width)?t:0,r.height=null!=(i=e.height)?i:0,r.depth=null!=(n=e.depth)?n:0,r}};function EY(){return{x:0,y:0,z:0,w:0}}let EK={encode:(e,t=new EF)=>(0!==e.x&&t.uint32(13).float(e.x),0!==e.y&&t.uint32(21).float(e.y),0!==e.z&&t.uint32(29).float(e.z),0!==e.w&&t.uint32(37).float(e.w),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=EY();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(13!==e)break;r.x=i.float();continue;case 2:if(21!==e)break;r.y=i.float();continue;case 3:if(29!==e)break;r.z=i.float();continue;case 4:if(37!==e)break;r.w=i.float();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({x:E2(e.x)?globalThis.Number(e.x):0,y:E2(e.y)?globalThis.Number(e.y):0,z:E2(e.z)?globalThis.Number(e.z):0,w:E2(e.w)?globalThis.Number(e.w):0}),toJSON(e){let t={};return 0!==e.x&&(t.x=e.x),0!==e.y&&(t.y=e.y),0!==e.z&&(t.z=e.z),0!==e.w&&(t.w=e.w),t},create:e=>EK.fromPartial(null!=e?e:{}),fromPartial(e){var t,i,n,r;let a=EY();return a.x=null!=(t=e.x)?t:0,a.y=null!=(i=e.y)?i:0,a.z=null!=(n=e.z)?n:0,a.w=null!=(r=e.w)?r:0,a}};function EZ(){return{offset:void 0,extent:void 0}}let E$={encode:(e,t=new EF)=>(void 0!==e.offset&&EV.encode(e.offset,t.uint32(10).fork()).join(),void 0!==e.extent&&EG.encode(e.extent,t.uint32(18).fork()).join(),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=EZ();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.offset=EV.decode(i,i.uint32());continue;case 2:if(18!==e)break;r.extent=EG.decode(i,i.uint32());continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({offset:E2(e.offset)?EV.fromJSON(e.offset):void 0,extent:E2(e.extent)?EG.fromJSON(e.extent):void 0}),toJSON(e){let t={};return void 0!==e.offset&&(t.offset=EV.toJSON(e.offset)),void 0!==e.extent&&(t.extent=EG.toJSON(e.extent)),t},create:e=>E$.fromPartial(null!=e?e:{}),fromPartial(e){let t=EZ();return t.offset=void 0!==e.offset&&null!==e.offset?EV.fromPartial(e.offset):void 0,t.extent=void 0!==e.extent&&null!==e.extent?EG.fromPartial(e.extent):void 0,t}};function EJ(){return{offset:void 0,extent:void 0}}let EQ={encode:(e,t=new EF)=>(void 0!==e.offset&&Ej.encode(e.offset,t.uint32(10).fork()).join(),void 0!==e.extent&&Eq.encode(e.extent,t.uint32(18).fork()).join(),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=EJ();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.offset=Ej.decode(i,i.uint32());continue;case 2:if(18!==e)break;r.extent=Eq.decode(i,i.uint32());continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({offset:E2(e.offset)?Ej.fromJSON(e.offset):void 0,extent:E2(e.extent)?Eq.fromJSON(e.extent):void 0}),toJSON(e){let t={};return void 0!==e.offset&&(t.offset=Ej.toJSON(e.offset)),void 0!==e.extent&&(t.extent=Eq.toJSON(e.extent)),t},create:e=>EQ.fromPartial(null!=e?e:{}),fromPartial(e){let t=EJ();return t.offset=void 0!==e.offset&&null!==e.offset?Ej.fromPartial(e.offset):void 0,t.extent=void 0!==e.extent&&null!==e.extent?Eq.fromPartial(e.extent):void 0,t}};function E0(){return{orientation:void 0,position:void 0}}let E1={encode:(e,t=new EF)=>(void 0!==e.orientation&&EK.encode(e.orientation,t.uint32(10).fork()).join(),void 0!==e.position&&Ej.encode(e.position,t.uint32(18).fork()).join(),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=E0();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.orientation=EK.decode(i,i.uint32());continue;case 2:if(18!==e)break;r.position=Ej.decode(i,i.uint32());continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({orientation:E2(e.orientation)?EK.fromJSON(e.orientation):void 0,position:E2(e.position)?Ej.fromJSON(e.position):void 0}),toJSON(e){let t={};return void 0!==e.orientation&&(t.orientation=EK.toJSON(e.orientation)),void 0!==e.position&&(t.position=Ej.toJSON(e.position)),t},create:e=>E1.fromPartial(null!=e?e:{}),fromPartial(e){let t=E0();return t.orientation=void 0!==e.orientation&&null!==e.orientation?EK.fromPartial(e.orientation):void 0,t.position=void 0!==e.position&&null!==e.position?Ej.fromPartial(e.position):void 0,t}};function E2(e){return null!=e}function E3(e){switch(e){case 0:case"UNKNOWN":return j.UNKNOWN;case 1:case"FLOOR":return j.FLOOR;case 2:case"CEILING":return j.CEILING;case 3:case"WALL_FACE":return j.WALL_FACE;case 4:case"TABLE":return j.TABLE;case 5:case"COUCH":return j.COUCH;case 6:case"DOOR_FRAME":return j.DOOR_FRAME;case 7:case"WINDOW_FRAME":return j.WINDOW_FRAME;case 8:case"OTHER":return j.OTHER;case 9:case"STORAGE":return j.STORAGE;case 10:case"BED":return j.BED;case 11:case"SCREEN":return j.SCREEN;case 12:case"LAMP":return j.LAMP;case 13:case"PLANT":return j.PLANT;case 14:case"WALL_ART":return j.WALL_ART;case 15:case"GLOBAL_MESH":return j.GLOBAL_MESH;case 16:case"INVISIBLE_WALL_FACE":return j.INVISIBLE_WALL_FACE;case 17:case"CHAIR":return j.CHAIR;case 18:case"INNER_WALL_FACE":return j.INNER_WALL_FACE;case 19:case"OTHER_ROOM_FACE":return j.OTHER_ROOM_FACE;case 20:case"OPENING":return j.OPENING;default:return j.UNRECOGNIZED}}function E5(e){switch(e){case j.UNKNOWN:return"UNKNOWN";case j.FLOOR:return"FLOOR";case j.CEILING:return"CEILING";case j.WALL_FACE:return"WALL_FACE";case j.TABLE:return"TABLE";case j.COUCH:return"COUCH";case j.DOOR_FRAME:return"DOOR_FRAME";case j.WINDOW_FRAME:return"WINDOW_FRAME";case j.OTHER:return"OTHER";case j.STORAGE:return"STORAGE";case j.BED:return"BED";case j.SCREEN:return"SCREEN";case j.LAMP:return"LAMP";case j.PLANT:return"PLANT";case j.WALL_ART:return"WALL_ART";case j.GLOBAL_MESH:return"GLOBAL_MESH";case j.INVISIBLE_WALL_FACE:return"INVISIBLE_WALL_FACE";case j.CHAIR:return"CHAIR";case j.INNER_WALL_FACE:return"INNER_WALL_FACE";case j.OTHER_ROOM_FACE:return"OTHER_ROOM_FACE";case j.OPENING:return"OPENING";case j.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function E4(){return{floorUuid:"",ceilingUuid:"",wallUuids:[]}}(w=W||(W={}))[w.Keyboard=0]="Keyboard",w[w.UNRECOGNIZED=-1]="UNRECOGNIZED",(A=j||(j={}))[A.UNKNOWN=0]="UNKNOWN",A[A.FLOOR=1]="FLOOR",A[A.CEILING=2]="CEILING",A[A.WALL_FACE=3]="WALL_FACE",A[A.TABLE=4]="TABLE",A[A.COUCH=5]="COUCH",A[A.DOOR_FRAME=6]="DOOR_FRAME",A[A.WINDOW_FRAME=7]="WINDOW_FRAME",A[A.OTHER=8]="OTHER",A[A.STORAGE=9]="STORAGE",A[A.BED=10]="BED",A[A.SCREEN=11]="SCREEN",A[A.LAMP=12]="LAMP",A[A.PLANT=13]="PLANT",A[A.WALL_ART=14]="WALL_ART",A[A.GLOBAL_MESH=15]="GLOBAL_MESH",A[A.INVISIBLE_WALL_FACE=16]="INVISIBLE_WALL_FACE",A[A.CHAIR=17]="CHAIR",A[A.INNER_WALL_FACE=18]="INNER_WALL_FACE",A[A.OTHER_ROOM_FACE=19]="OTHER_ROOM_FACE",A[A.OPENING=20]="OPENING",A[A.UNRECOGNIZED=-1]="UNRECOGNIZED";let E6={encode(e,t=new EF){for(let i of(""!==e.floorUuid&&t.uint32(10).string(e.floorUuid),""!==e.ceilingUuid&&t.uint32(18).string(e.ceilingUuid),e.wallUuids))t.uint32(26).string(i);return t},decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=E4();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.floorUuid=i.string();continue;case 2:if(18!==e)break;r.ceilingUuid=i.string();continue;case 3:if(26!==e)break;r.wallUuids.push(i.string());continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({floorUuid:Tc(e.floorUuid)?globalThis.String(e.floorUuid):"",ceilingUuid:Tc(e.ceilingUuid)?globalThis.String(e.ceilingUuid):"",wallUuids:globalThis.Array.isArray(null==e?void 0:e.wallUuids)?e.wallUuids.map(e=>globalThis.String(e)):[]}),toJSON(e){var t;let i={};return""!==e.floorUuid&&(i.floorUuid=e.floorUuid),""!==e.ceilingUuid&&(i.ceilingUuid=e.ceilingUuid),(null==(t=e.wallUuids)?void 0:t.length)&&(i.wallUuids=e.wallUuids),i},create:e=>E6.fromPartial(null!=e?e:{}),fromPartial(e){var t,i,n;let r=E4();return r.floorUuid=null!=(t=e.floorUuid)?t:"",r.ceilingUuid=null!=(i=e.ceilingUuid)?i:"",r.wallUuids=(null==(n=e.wallUuids)?void 0:n.map(e=>e))||[],r}};function E8(){return{uuids:[]}}let E7={encode(e,t=new EF){for(let i of e.uuids)t.uint32(10).string(i);return t},decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=E8();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.uuids.push(i.string());continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({uuids:globalThis.Array.isArray(null==e?void 0:e.uuids)?e.uuids.map(e=>globalThis.String(e)):[]}),toJSON(e){var t;let i={};return(null==(t=e.uuids)?void 0:t.length)&&(i.uuids=e.uuids),i},create:e=>E7.fromPartial(null!=e?e:{}),fromPartial(e){var t;let i=E8();return i.uuids=(null==(t=e.uuids)?void 0:t.map(e=>e))||[],i}};function E9(){return{vertices:new Uint8Array(0)}}let Te={encode:(e,t=new EF)=>(0!==e.vertices.length&&t.uint32(10).bytes(e.vertices),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=E9();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.vertices=i.bytes();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({vertices:Tc(e.vertices)?To(e.vertices):new Uint8Array(0)}),toJSON(e){let t={};return 0!==e.vertices.length&&(t.vertices=Tl(e.vertices)),t},create:e=>Te.fromPartial(null!=e?e:{}),fromPartial(e){var t;let i=E9();return i.vertices=null!=(t=e.vertices)?t:new Uint8Array(0),i}};function Tt(){return{vertices:new Uint8Array(0),indices:new Uint8Array(0)}}let Ti={encode:(e,t=new EF)=>(0!==e.vertices.length&&t.uint32(10).bytes(e.vertices),0!==e.indices.length&&t.uint32(18).bytes(e.indices),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=Tt();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.vertices=i.bytes();continue;case 2:if(18!==e)break;r.indices=i.bytes();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({vertices:Tc(e.vertices)?To(e.vertices):new Uint8Array(0),indices:Tc(e.indices)?To(e.indices):new Uint8Array(0)}),toJSON(e){let t={};return 0!==e.vertices.length&&(t.vertices=Tl(e.vertices)),0!==e.indices.length&&(t.indices=Tl(e.indices)),t},create:e=>Ti.fromPartial(null!=e?e:{}),fromPartial(e){var t,i;let n=Tt();return n.vertices=null!=(t=e.vertices)?t:new Uint8Array(0),n.indices=null!=(i=e.indices)?i:new Uint8Array(0),n}};function Tn(){return{classType:0}}let Tr={encode:(e,t=new EF)=>(0!==e.classType&&t.uint32(8).int32(e.classType),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=Tn();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(8!==e)break;r.classType=i.int32();continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({classType:Tc(e.classType)?function(e){switch(e){case 0:case"Keyboard":return W.Keyboard;default:return W.UNRECOGNIZED}}(e.classType):0}),toJSON(e){let t={};return 0!==e.classType&&(t.classType=function(e){switch(e){case W.Keyboard:return"Keyboard";case W.UNRECOGNIZED:default:return"UNRECOGNIZED"}}(e.classType)),t},create:e=>Tr.fromPartial(null!=e?e:{}),fromPartial(e){var t;let i=Tn();return i.classType=null!=(t=e.classType)?t:0,i}};function Ta(){return{uuid:"",semanticLabel_META:void 0,locatable_META:void 0,boundary2D_META:void 0,bounded2D_META:void 0,bounded3D_META:void 0,roomLayout_META:void 0,spaceContainer_META:void 0,triangleMesh_META:void 0,dynamicObject_META:void 0}}let Ts={encode:(e,t=new EF)=>(""!==e.uuid&&t.uint32(10).string(e.uuid),void 0!==e.semanticLabel_META&&t.uint32(16).int32(e.semanticLabel_META),void 0!==e.locatable_META&&E1.encode(e.locatable_META,t.uint32(26).fork()).join(),void 0!==e.boundary2D_META&&Te.encode(e.boundary2D_META,t.uint32(34).fork()).join(),void 0!==e.bounded2D_META&&E$.encode(e.bounded2D_META,t.uint32(42).fork()).join(),void 0!==e.bounded3D_META&&EQ.encode(e.bounded3D_META,t.uint32(50).fork()).join(),void 0!==e.roomLayout_META&&E6.encode(e.roomLayout_META,t.uint32(58).fork()).join(),void 0!==e.spaceContainer_META&&E7.encode(e.spaceContainer_META,t.uint32(66).fork()).join(),void 0!==e.triangleMesh_META&&Ti.encode(e.triangleMesh_META,t.uint32(74).fork()).join(),void 0!==e.dynamicObject_META&&Tr.encode(e.dynamicObject_META,t.uint32(82).fork()).join(),t),decode(e,t){let i=e instanceof EB?e:new EB(e),n=void 0===t?i.len:i.pos+t,r=Ta();for(;i.pos<n;){let e=i.uint32();switch(e>>>3){case 1:if(10!==e)break;r.uuid=i.string();continue;case 2:if(16!==e)break;r.semanticLabel_META=i.int32();continue;case 3:if(26!==e)break;r.locatable_META=E1.decode(i,i.uint32());continue;case 4:if(34!==e)break;r.boundary2D_META=Te.decode(i,i.uint32());continue;case 5:if(42!==e)break;r.bounded2D_META=E$.decode(i,i.uint32());continue;case 6:if(50!==e)break;r.bounded3D_META=EQ.decode(i,i.uint32());continue;case 7:if(58!==e)break;r.roomLayout_META=E6.decode(i,i.uint32());continue;case 8:if(66!==e)break;r.spaceContainer_META=E7.decode(i,i.uint32());continue;case 9:if(74!==e)break;r.triangleMesh_META=Ti.decode(i,i.uint32());continue;case 10:if(82!==e)break;r.dynamicObject_META=Tr.decode(i,i.uint32());continue}if((7&e)==4||0===e)break;i.skip(7&e)}return r},fromJSON:e=>({uuid:Tc(e.uuid)?globalThis.String(e.uuid):"",semanticLabel_META:Tc(e.semanticLabel_META)?E3(e.semanticLabel_META):void 0,locatable_META:Tc(e.locatable_META)?E1.fromJSON(e.locatable_META):void 0,boundary2D_META:Tc(e.boundary2D_META)?Te.fromJSON(e.boundary2D_META):void 0,bounded2D_META:Tc(e.bounded2D_META)?E$.fromJSON(e.bounded2D_META):void 0,bounded3D_META:Tc(e.bounded3D_META)?EQ.fromJSON(e.bounded3D_META):void 0,roomLayout_META:Tc(e.roomLayout_META)?E6.fromJSON(e.roomLayout_META):void 0,spaceContainer_META:Tc(e.spaceContainer_META)?E7.fromJSON(e.spaceContainer_META):void 0,triangleMesh_META:Tc(e.triangleMesh_META)?Ti.fromJSON(e.triangleMesh_META):void 0,dynamicObject_META:Tc(e.dynamicObject_META)?Tr.fromJSON(e.dynamicObject_META):void 0}),toJSON(e){let t={};return""!==e.uuid&&(t.uuid=e.uuid),void 0!==e.semanticLabel_META&&(t.semanticLabel_META=E5(e.semanticLabel_META)),void 0!==e.locatable_META&&(t.locatable_META=E1.toJSON(e.locatable_META)),void 0!==e.boundary2D_META&&(t.boundary2D_META=Te.toJSON(e.boundary2D_META)),void 0!==e.bounded2D_META&&(t.bounded2D_META=E$.toJSON(e.bounded2D_META)),void 0!==e.bounded3D_META&&(t.bounded3D_META=EQ.toJSON(e.bounded3D_META)),void 0!==e.roomLayout_META&&(t.roomLayout_META=E6.toJSON(e.roomLayout_META)),void 0!==e.spaceContainer_META&&(t.spaceContainer_META=E7.toJSON(e.spaceContainer_META)),void 0!==e.triangleMesh_META&&(t.triangleMesh_META=Ti.toJSON(e.triangleMesh_META)),void 0!==e.dynamicObject_META&&(t.dynamicObject_META=Tr.toJSON(e.dynamicObject_META)),t},create:e=>Ts.fromPartial(null!=e?e:{}),fromPartial(e){var t,i;let n=Ta();return n.uuid=null!=(t=e.uuid)?t:"",n.semanticLabel_META=null!=(i=e.semanticLabel_META)?i:void 0,n.locatable_META=void 0!==e.locatable_META&&null!==e.locatable_META?E1.fromPartial(e.locatable_META):void 0,n.boundary2D_META=void 0!==e.boundary2D_META&&null!==e.boundary2D_META?Te.fromPartial(e.boundary2D_META):void 0,n.bounded2D_META=void 0!==e.bounded2D_META&&null!==e.bounded2D_META?E$.fromPartial(e.bounded2D_META):void 0,n.bounded3D_META=void 0!==e.bounded3D_META&&null!==e.bounded3D_META?EQ.fromPartial(e.bounded3D_META):void 0,n.roomLayout_META=void 0!==e.roomLayout_META&&null!==e.roomLayout_META?E6.fromPartial(e.roomLayout_META):void 0,n.spaceContainer_META=void 0!==e.spaceContainer_META&&null!==e.spaceContainer_META?E7.fromPartial(e.spaceContainer_META):void 0,n.triangleMesh_META=void 0!==e.triangleMesh_META&&null!==e.triangleMesh_META?Ti.fromPartial(e.triangleMesh_META):void 0,n.dynamicObject_META=void 0!==e.dynamicObject_META&&null!==e.dynamicObject_META?Tr.fromPartial(e.dynamicObject_META):void 0,n}};function To(e){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(e,"base64"));{let t=globalThis.atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;++e)i[e]=t.charCodeAt(e);return i}}function Tl(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");{let t=[];return e.forEach(e=>{t.push(globalThis.String.fromCharCode(e))}),globalThis.btoa(t.join(""))}}function Tc(e){return null!=e}(R=X||(X={})).Locatable="locatable",R.Bounded3D="bounded3D",R.Bounded2D="bounded2D",R.TriangleMesh="triangleMesh",R.SemanticLabel="semanticLabel";class Th extends EventTarget{constructor(e){super(),this._spatialEntity=e}}class Tu extends Th{constructor(e,t){super(e),this._offset=new p7,this._extent=new p7,this.type=X.Bounded2D;const{offset:i,extent:n}=t;this._offset.set(i.x,i.y),this._extent.set(n.width,n.height),this.buildGeometry()}buildGeometry(){var e;let t=new gR(this._extent.x,this._extent.y);t.translate(this._offset.x+this._extent.x/2,this._offset.y+this._extent.y/2,0),t.rotateX(Math.PI/2),null==(e=this._spatialEntity.geometry)||e.dispose(),this._spatialEntity.geometry=t}get offset(){return this._offset}get extent(){return this._extent}get initData(){return{offset:this.offset,extent:this.extent}}get pbData(){return{offset:{x:this._offset.x,y:this._offset.y},extent:{width:this._extent.x,height:this._extent.y}}}}class Td extends Th{constructor(e,t){super(e),this._offset=new fb,this._extent=new fb,this.type=X.Bounded3D;const{offset:i,extent:n}=t;this._offset.set(i.x,i.y,i.z),this._extent.set(n.width,n.height,n.depth),this.buildGeometry()}buildGeometry(){var e;let t=new gs(this._extent.x,this._extent.y,this._extent.z);t.translate(this._offset.x+this._extent.x/2,this._offset.y+this._extent.y/2,this._offset.z+this._extent.z/2),null==(e=this._spatialEntity.geometry)||e.dispose(),this._spatialEntity.geometry=t}get offset(){return this._offset}get extent(){return this._extent}get initData(){return{offset:this.offset,extent:this.extent}}get pbData(){return{offset:{x:this._offset.x,y:this._offset.y,z:this._offset.z},extent:{width:this._extent.x,height:this._extent.y,depth:this._extent.z}}}}class Tp extends Th{constructor(e,t){super(e),this.type=X.Locatable,t.position&&this.position.copy(t.position),t.orientation&&this.orientation.copy(t.orientation)}get position(){return this._spatialEntity.position}get rotation(){return this._spatialEntity.rotation}get orientation(){return this._spatialEntity.quaternion}get initData(){return{position:{x:this.position.x,y:this.position.y,z:this.position.z},orientation:{x:this.orientation.x,y:this.orientation.y,z:this.orientation.z,w:this.orientation.w}}}get pbData(){return{position:{x:this._spatialEntity.position.x,y:this._spatialEntity.position.y,z:this._spatialEntity.position.z},orientation:{x:this._spatialEntity.quaternion.x,y:this._spatialEntity.quaternion.y,z:this._spatialEntity.quaternion.z,w:this._spatialEntity.quaternion.w}}}}function Tf(e){return e.toLowerCase().replace(/_/g," ").trim()}class Tm extends Th{constructor(e,t){super(e),this._semanticLabel=t,this.type=X.SemanticLabel,this._spatialEntity.name=Tf(E5(t))}get semanticLabel(){return this._semanticLabel}set semanticLabel(e){Object.values(j).includes(e)?this._semanticLabel=e:this._semanticLabel=j.UNRECOGNIZED,this._spatialEntity.name=Tf(E5(this._semanticLabel))}get initData(){return this._semanticLabel}get pbData(){return this._semanticLabel}}function Tg(e){let t=new Float32Array(3*e.length),i=0;for(let n of e)t[i++]=n.x,t[i++]=n.y,t[i++]=n.z;return t}class Tv extends Th{constructor(e,t){super(e),this._polygonCount=0,this._vertexCount=0,this._dimensions={x:0,y:0,z:0},this.type=X.TriangleMesh;const{vertices:i,indices:n}=t,r=new Float32Array(i.buffer),a=new Uint32Array(n.buffer),s=[];for(let e=0;e<r.length/3;e++)s.push({x:r[3*e],y:r[3*e+1],z:r[3*e+2]});this._vertices=s,this._indices=[...a],this.buildGeometry();const o=e.material;o.polygonOffset=!0,o.polygonOffsetFactor=1,o.polygonOffsetUnits=.005,o.color.setHex(0xd4d4d4),e.renderOrder=999}buildGeometry(){var e;let t=new mZ,i=Tg(this._vertices);t.setAttribute("position",new mz(i,3)),t.setIndex(new mz(new Uint16Array(this._indices),1)),null==(e=this._spatialEntity.geometry)||e.dispose(),this._spatialEntity.geometry=t,t.computeVertexNormals(),this._vertexCount=t.attributes.position.count,this._polygonCount=t.index?t.index.count/3:this._vertexCount/3,t.computeBoundingBox();let n=t.boundingBox;this._dimensions={x:n.max.x-n.min.x,y:n.max.y-n.min.y,z:n.max.z-n.min.z}}get vertexCount(){return this._vertexCount}get polygonCount(){return this._polygonCount}get dimensions(){return this._dimensions}get initData(){return{vertices:this._vertices,indices:this._indices}}get pbData(){let e=Tg(this._vertices),t=new Uint32Array(this._indices);return{vertices:new Uint8Array(e.buffer),indices:new Uint8Array(t.buffer)}}}let T_=["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"];(C=q||(q={})).Plane="plane",C.Box="box",C.Mesh="mesh";let Tx={[j.OTHER]:N.Other,[j.TABLE]:N.Table,[j.COUCH]:N.Couch,[j.FLOOR]:N.Floor,[j.CEILING]:N.Ceiling,[j.WALL_FACE]:N.Wall,[j.INVISIBLE_WALL_FACE]:N.Window,[j.INNER_WALL_FACE]:N.Wall,[j.DOOR_FRAME]:N.Door,[j.WINDOW_FRAME]:N.Window,[j.WALL_ART]:N.WallArt,[j.STORAGE]:N.Shelf,[j.BED]:N.Bed,[j.LAMP]:N.Lamp,[j.SCREEN]:N.Screen,[j.PLANT]:N.Plant,[j.GLOBAL_MESH]:N.GlobalMesh,[j.CHAIR]:N.Couch,[j.UNKNOWN]:N.Other,[j.OTHER_ROOM_FACE]:N.Other,[j.OPENING]:N.Other,[j.UNRECOGNIZED]:N.Other};class Ty extends gr{constructor(e=function(){let e=0xffffffff*Math.random()|0,t=0xffffffff*Math.random()|0,i=0xffffffff*Math.random()|0,n=0xffffffff*Math.random()|0;return(T_[255&e]+T_[e>>8&255]+T_[e>>16&255]+T_[e>>24&255]+"-"+T_[255&t]+T_[t>>8&255]+"-"+T_[t>>16&15|64]+T_[t>>24&255]+"-"+T_[63&i|128]+T_[i>>8&255]+"-"+T_[i>>16&255]+T_[i>>24&255]+T_[255&n]+T_[n>>8&255]+T_[n>>16&255]+T_[n>>24&255]).toLowerCase()}()){super(void 0,new xc({color:0xffffff*Math.random(),flatShading:!0})),this.name="generic spatial entity",this.isSpatialEntity=!0,this._componentMap=new Map,this._spatialUUID=e}get spatialUUID(){return this._spatialUUID}updateMatrixWorld(e){super.updateMatrixWorld(e)}addComponent(e,t){let i=null;switch(e){case X.Locatable:i=new Tp(this,t);break;case X.Bounded3D:i=new Td(this,t);break;case X.Bounded2D:i=new Tu(this,t);break;case X.TriangleMesh:i=new Tv(this,t);break;case X.SemanticLabel:i=new Tm(this,t)}i&&this._componentMap.set(e,i)}getComponent(e){return this._componentMap.get(e)}duplicate(){let e=new Ty;return this._componentMap.forEach((t,i,n)=>{e.addComponent(t.type,t.initData)}),e}get nativeEntity(){if(!this._nativeEntity){let e=new SY({x:this.position.x,y:this.position.y,z:this.position.z,w:1},{x:this.quaternion.x,y:this.quaternion.y,z:this.quaternion.z,w:this.quaternion.w}),t=Tx[this.getComponent(X.SemanticLabel).semanticLabel];if(this.entityType===q.Plane){let{offset:i,extent:n}=this.getComponent(X.Bounded2D),r=[new DOMPointReadOnly(i.x,0,i.y),new DOMPointReadOnly(i.x+n.x,0,i.y),new DOMPointReadOnly(i.x+n.x,0,i.y+n.y),new DOMPointReadOnly(i.x,0,i.y+n.y),new DOMPointReadOnly(i.x,0,i.y)];this._nativeEntity=new SH(e,r,t)}else if(this.entityType===q.Box||this.entityType===q.Mesh){let i=this.geometry.getAttribute("position").array,n=new Uint32Array(this.geometry.index.array);this._nativeEntity=new SB(e,i,n,t)}}return this._nativeEntity}static fromPBJSON(e){let t=Ts.fromJSON(e);if(t.locatable_META){let e=new Ty(t.uuid);return e.addComponent(X.Locatable,t.locatable_META),t.semanticLabel_META&&e.addComponent(X.SemanticLabel,t.semanticLabel_META),t.bounded2D_META?e.addComponent(X.Bounded2D,t.bounded2D_META):t.bounded3D_META?e.addComponent(X.Bounded3D,t.bounded3D_META):t.triangleMesh_META&&e.addComponent(X.TriangleMesh,t.triangleMesh_META),e}}get entityType(){return this.getComponent(X.Bounded2D)?q.Plane:this.getComponent(X.Bounded3D)?q.Box:this.getComponent(X.TriangleMesh)?q.Mesh:void 0}static toPBJSON(e){var t,i,n,r,a;return{uuid:e.spatialUUID,locatable_META:null==(t=e.getComponent(X.Locatable))?void 0:t.pbData,boundary2D_META:void 0,bounded2D_META:null==(i=e.getComponent(X.Bounded2D))?void 0:i.pbData,bounded3D_META:null==(n=e.getComponent(X.Bounded3D))?void 0:n.pbData,semanticLabel_META:null==(r=e.getComponent(X.SemanticLabel))?void 0:r.pbData,roomLayout_META:void 0,spaceContainer_META:void 0,triangleMesh_META:null==(a=e.getComponent(X.TriangleMesh))?void 0:a.pbData,dynamicObject_META:void 0}}}let TM={living_room:()=>e.A(84223),meeting_room:()=>e.A(36408),music_room:()=>e.A(59756),office_large:()=>e.A(3068),office_small:()=>e.A(94806)},TS="0.2.4",Tb=new fb(0,0,-1);class TE extends EventTarget{constructor(e){super(),this.xrDevice=e,this.trackedPlanes=new Set,this.trackedMeshes=new Set,this.version=TS,this.objectMap=new Map,this.planes=new _I,this.boxes=new _I,this.meshes=new _I,this.tempPosition=new fb,this.tempQuaternion=new fS,this.tempDirection=new fb,this.tempScale=new fb,this.tempMatrix=new fQ,this.raycaster=new xR,this.hitTestTarget=new _I,this.hitTestMarker=new mg,this.worldNormal=new fb,this.normalMatrix=new p9,this.scene=new _W,this.scene.background=new mI(4079166),this.camera=new gm(50,window.innerWidth/window.innerHeight,.1,40),this.camera.position.set(0,1.6,5);const t=new xL(50,50);this.scene.add(t),this.scene.add(this.planes,this.boxes,this.meshes),this.planes.renderOrder=1,this.boxes.renderOrder=2,this.meshes.renderOrder=3,this.planes.visible=!1,this.boxes.visible=!1,this.renderer=new _G({antialias:!0,alpha:!0}),this.renderer.setPixelRatio(window.devicePixelRatio),this.renderer.setSize(window.innerWidth,window.innerHeight),this.renderer.domElement.style.position="fixed",this.renderer.domElement.style.top="50vh",this.renderer.domElement.style.left="50vw",this.renderer.domElement.style.transform="translate(-50%, -50%)",this.hitTestTarget.add(this.hitTestMarker),this.hitTestMarker.rotateX(Math.PI/2)}get environmentCanvas(){return this.renderer.domElement}get planesVisible(){return this.planes.visible}set planesVisible(e){this.planes.visible=e}get boundingBoxesVisible(){return this.boxes.visible}set boundingBoxesVisible(e){this.boxes.visible=e}get meshesVisible(){return this.meshes.visible}set meshesVisible(e){this.meshes.visible=e}render(){this.camera.position.copy(this.xrDevice.position),this.camera.quaternion.copy(this.xrDevice.quaternion);let e=this.xrDevice.fovy/Math.PI*180,t=!1;this.camera.fov!==e&&(this.camera.fov=e,t=!0);let i=this.xrDevice.canvasDimensions;if(i){let e=this.renderer.domElement;(e.width!==i.width||e.height!==i.height)&&(this.camera.aspect=i.width/i.height,this.renderer.setSize(i.width,i.height),t=!0)}t&&this.camera.updateProjectionMatrix(),this.renderer.render(this.scene,this.camera)}deleteAll(){[...this.objectMap.values()].forEach(e=>{e.removeFromParent()}),this.objectMap.clear(),this.trackedMeshes.clear(),this.trackedPlanes.clear()}loadEnvironment(e){this.deleteAll(),e.spatialEntities.forEach(e=>{let t=Ty.fromPBJSON(e);if(t){switch(t.entityType){case q.Box:this.boxes.add(t),this.trackedMeshes.add(t.nativeEntity);break;case q.Plane:this.planes.add(t),this.trackedPlanes.add(t.nativeEntity);break;case q.Mesh:this.meshes.add(t),this.trackedMeshes.add(t.nativeEntity)}let i=this.objectMap.get(e.uuid);i&&i.removeFromParent(),this.objectMap.set(e.uuid,t)}})}loadDefaultEnvironment(e){if("u">typeof __IS_UMD__&&__IS_UMD__)fetch(`https://www.unpkg.com/@iwer/sem@${TS}/captures/${e}.json`).then(e=>{if(!e.ok)throw Error(`Network response was not ok: ${e.statusText}`);return e.json()}).then(e=>{this.loadEnvironment(e)}).catch(t=>{console.error(`Error loading environment ${e} from CDN`,t)});else{let t=TM[e];if(!t)return void console.error(`Requested environment ${e} does not exist`);t().then(e=>{let t=e.default;this.loadEnvironment(t)}).catch(t=>{console.error(`Error loading environment ${e} locally`,t)})}}computeHitTestResults(e){return this.tempMatrix.fromArray(e),this.tempMatrix.decompose(this.tempPosition,this.tempQuaternion,this.tempScale),this.tempDirection.copy(Tb).applyQuaternion(this.tempQuaternion).normalize(),this.raycaster.set(this.tempPosition,this.tempDirection),this.raycaster.intersectObject(this.meshes,!0).map(e=>{var t;let i=e.point;if(this.hitTestTarget.position.copy(i),null==(t=e.face)?void 0:t.normal){this.worldNormal.copy(e.face.normal);let t=e.object;this.worldNormal.applyMatrix3(this.normalMatrix.getNormalMatrix(t.matrixWorld)).normalize(),this.hitTestTarget.lookAt(this.tempPosition.addVectors(i,this.worldNormal))}else this.hitTestTarget.quaternion.set(0,0,0,1);return this.hitTestTarget.updateMatrixWorld(!0),this.hitTestMarker.matrixWorld.toArray()})}}let TT={metaQuest3:ES,metaQuest2:Ey,metaQuestPro:EM,oculusQuest1:Ex},Tw=["office_small","meeting_room","living_room","music_room","office_large"],TA=["left","none","right"];function TR(e){let t=new Eg(TT["string"==typeof e?e:e.type??"metaQuest3"],"string"==typeof e?void 0:e);"string"!=typeof e&&(TI(t,e.headset),TL(t.hands,e.hand),TL(t.controllers,e.controller),t.primaryInputMode=e.primaryInputMode??"controller"),t.ipd="string"==typeof e?0:e.ipd??0,t.installRuntime(),t.installDevUI(pG);let i="string"==typeof e||e.syntheticEnvironment;return!1===i||(t.installSEM(TE),null===i||("string"==typeof i&&Tw.includes(i)?t.sem?.loadDefaultEnvironment(i):!0===i||void 0===i?t.sem?.loadDefaultEnvironment(Tw[0]):"object"==typeof i?t.sem?.loadEnvironment(i):fetch(i).then(e=>e.json()).then(e=>t.sem?.loadEnvironment(e)).catch(console.error))),t}let TC=new uR.Euler,TP=new uR.Quaternion;function TL(e,t){if(null!=t)for(let i of TA)TI(e[i],t[i])}function TI(e,t){null!=e&&null!=t&&(TN(e.position,t.position),TN(TC,t.rotation),TD(e.quaternion,TP.setFromEuler(TC)),TD(e.quaternion,t.quaternion))}function TN(e,t){if(null!=t){if(t instanceof uR.Euler&&e instanceof uR.Euler&&e.copy(t),Array.isArray(t)){e.x=t[0],e.y=t[1],e.z=t[2];return}e.x=t.x,e.y=t.y,e.z=t.z}}function TD(e,t){if(null!=t){if(Array.isArray(t)){e.x=t[0],e.y=t[1],e.z=t[2],e.w=t[3];return}e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w}}e.s(["emulate",()=>TR],32504)}]);