@deck.gl/aggregation-layers 9.0.0-beta.2 → 9.0.0-beta.4

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 (335) hide show
  1. package/dist/aggregation-layer.js +153 -0
  2. package/{typed → dist}/contour-layer/contour-layer.d.ts +1 -1
  3. package/dist/contour-layer/contour-layer.d.ts.map +1 -0
  4. package/dist/contour-layer/contour-layer.js +241 -0
  5. package/dist/contour-layer/contour-utils.js +64 -0
  6. package/dist/contour-layer/marching-squares-codes.js +337 -0
  7. package/dist/contour-layer/marching-squares.js +147 -0
  8. package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts +3 -3
  9. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
  10. package/dist/cpu-grid-layer/cpu-grid-layer.js +130 -0
  11. package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
  12. package/dist/dist.dev.js +1296 -13614
  13. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +34 -0
  14. package/dist/{esm/gpu-grid-layer → gpu-grid-layer}/gpu-grid-cell-layer-vertex.glsl.js +20 -1
  15. package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +1 -1
  16. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
  17. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
  18. package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +3 -3
  19. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
  20. package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
  21. package/{typed → dist}/grid-aggregation-layer.d.ts +3 -3
  22. package/dist/grid-aggregation-layer.d.ts.map +1 -0
  23. package/dist/grid-aggregation-layer.js +172 -0
  24. package/{typed → dist}/grid-layer/grid-layer.d.ts +2 -2
  25. package/dist/grid-layer/grid-layer.d.ts.map +1 -0
  26. package/dist/grid-layer/grid-layer.js +63 -0
  27. package/dist/heatmap-layer/heatmap-layer-utils.js +63 -0
  28. package/{typed → dist}/heatmap-layer/heatmap-layer.d.ts +1 -1
  29. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
  30. package/dist/heatmap-layer/heatmap-layer.js +471 -0
  31. package/dist/{esm/heatmap-layer → heatmap-layer}/max-fs.glsl.js +0 -1
  32. package/dist/{esm/heatmap-layer → heatmap-layer}/max-vs.glsl.js +0 -1
  33. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +61 -0
  34. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +52 -0
  35. package/dist/heatmap-layer/triangle-layer.js +59 -0
  36. package/dist/{esm/heatmap-layer → heatmap-layer}/weights-fs.glsl.js +0 -1
  37. package/dist/{esm/heatmap-layer → heatmap-layer}/weights-vs.glsl.js +0 -1
  38. package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
  39. package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts +3 -3
  40. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -0
  41. package/dist/hexagon-layer/hexagon-layer.js +174 -0
  42. package/dist/index.cjs +4494 -0
  43. package/dist/index.cjs.map +7 -0
  44. package/dist/index.d.ts +20 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +32 -0
  47. package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -1
  48. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
  49. package/dist/screen-grid-layer/screen-grid-cell-layer.js +166 -0
  50. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +40 -0
  51. package/dist/{esm/screen-grid-layer → screen-grid-layer}/screen-grid-layer-vertex.glsl.js +19 -1
  52. package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts +1 -1
  53. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
  54. package/dist/screen-grid-layer/screen-grid-layer.js +216 -0
  55. package/dist/types.js +1 -0
  56. package/dist/utils/aggregation-operation-utils.js +94 -0
  57. package/dist/utils/bin-sorter.js +167 -0
  58. package/dist/utils/color-utils.js +53 -0
  59. package/dist/utils/cpu-aggregator.js +421 -0
  60. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +39 -0
  61. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +53 -0
  62. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +34 -0
  63. package/dist/{esm/utils → utils}/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +19 -1
  64. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  65. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  66. package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  67. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +566 -0
  68. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +37 -0
  69. package/dist/utils/grid-aggregation-utils.js +114 -0
  70. package/dist/utils/prop-utils.js +28 -0
  71. package/dist/utils/resource-utils.js +38 -0
  72. package/dist/utils/scale-utils.js +184 -0
  73. package/dist.min.js +60 -174
  74. package/package.json +18 -11
  75. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +10 -13
  76. package/dist/es5/aggregation-layer.js +0 -215
  77. package/dist/es5/aggregation-layer.js.map +0 -1
  78. package/dist/es5/contour-layer/contour-layer.js +0 -353
  79. package/dist/es5/contour-layer/contour-layer.js.map +0 -1
  80. package/dist/es5/contour-layer/contour-utils.js +0 -110
  81. package/dist/es5/contour-layer/contour-utils.js.map +0 -1
  82. package/dist/es5/contour-layer/marching-squares-codes.js +0 -152
  83. package/dist/es5/contour-layer/marching-squares-codes.js.map +0 -1
  84. package/dist/es5/contour-layer/marching-squares.js +0 -168
  85. package/dist/es5/contour-layer/marching-squares.js.map +0 -1
  86. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +0 -235
  87. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  88. package/dist/es5/cpu-grid-layer/grid-aggregator.js +0 -180
  89. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +0 -1
  90. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -9
  91. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  92. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -9
  93. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  94. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +0 -247
  95. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  96. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +0 -424
  97. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  98. package/dist/es5/grid-aggregation-layer.js +0 -280
  99. package/dist/es5/grid-aggregation-layer.js.map +0 -1
  100. package/dist/es5/grid-layer/grid-layer.js +0 -125
  101. package/dist/es5/grid-layer/grid-layer.js.map +0 -1
  102. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -107
  103. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  104. package/dist/es5/heatmap-layer/heatmap-layer.js +0 -678
  105. package/dist/es5/heatmap-layer/heatmap-layer.js.map +0 -1
  106. package/dist/es5/heatmap-layer/max-fs.glsl.js +0 -9
  107. package/dist/es5/heatmap-layer/max-fs.glsl.js.map +0 -1
  108. package/dist/es5/heatmap-layer/max-vs.glsl.js +0 -9
  109. package/dist/es5/heatmap-layer/max-vs.glsl.js.map +0 -1
  110. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +0 -9
  111. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  112. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +0 -9
  113. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  114. package/dist/es5/heatmap-layer/triangle-layer.js +0 -121
  115. package/dist/es5/heatmap-layer/triangle-layer.js.map +0 -1
  116. package/dist/es5/heatmap-layer/weights-fs.glsl.js +0 -9
  117. package/dist/es5/heatmap-layer/weights-fs.glsl.js.map +0 -1
  118. package/dist/es5/heatmap-layer/weights-vs.glsl.js +0 -9
  119. package/dist/es5/heatmap-layer/weights-vs.glsl.js.map +0 -1
  120. package/dist/es5/hexagon-layer/hexagon-aggregator.js +0 -118
  121. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +0 -1
  122. package/dist/es5/hexagon-layer/hexagon-layer.js +0 -289
  123. package/dist/es5/hexagon-layer/hexagon-layer.js.map +0 -1
  124. package/dist/es5/index.js +0 -104
  125. package/dist/es5/index.js.map +0 -1
  126. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +0 -244
  127. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  128. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -9
  129. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  130. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -9
  131. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  132. package/dist/es5/screen-grid-layer/screen-grid-layer.js +0 -317
  133. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +0 -1
  134. package/dist/es5/types.js +0 -2
  135. package/dist/es5/types.js.map +0 -1
  136. package/dist/es5/utils/aggregation-operation-utils.js +0 -123
  137. package/dist/es5/utils/aggregation-operation-utils.js.map +0 -1
  138. package/dist/es5/utils/bin-sorter.js +0 -248
  139. package/dist/es5/utils/bin-sorter.js.map +0 -1
  140. package/dist/es5/utils/color-utils.js +0 -39
  141. package/dist/es5/utils/color-utils.js.map +0 -1
  142. package/dist/es5/utils/cpu-aggregator.js +0 -496
  143. package/dist/es5/utils/cpu-aggregator.js.map +0 -1
  144. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -9
  145. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  146. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -9
  147. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  148. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -9
  149. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  150. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -9
  151. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  152. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -63
  153. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  154. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  155. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  156. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -732
  157. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  158. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  159. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -9
  160. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  161. package/dist/es5/utils/grid-aggregation-utils.js +0 -118
  162. package/dist/es5/utils/grid-aggregation-utils.js.map +0 -1
  163. package/dist/es5/utils/prop-utils.js +0 -19
  164. package/dist/es5/utils/prop-utils.js.map +0 -1
  165. package/dist/es5/utils/resource-utils.js +0 -59
  166. package/dist/es5/utils/resource-utils.js.map +0 -1
  167. package/dist/es5/utils/scale-utils.js +0 -254
  168. package/dist/es5/utils/scale-utils.js.map +0 -1
  169. package/dist/esm/aggregation-layer.js +0 -156
  170. package/dist/esm/aggregation-layer.js.map +0 -1
  171. package/dist/esm/contour-layer/contour-layer.js +0 -316
  172. package/dist/esm/contour-layer/contour-layer.js.map +0 -1
  173. package/dist/esm/contour-layer/contour-utils.js +0 -81
  174. package/dist/esm/contour-layer/contour-utils.js.map +0 -1
  175. package/dist/esm/contour-layer/marching-squares-codes.js +0 -219
  176. package/dist/esm/contour-layer/marching-squares-codes.js.map +0 -1
  177. package/dist/esm/contour-layer/marching-squares.js +0 -151
  178. package/dist/esm/contour-layer/marching-squares.js.map +0 -1
  179. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +0 -186
  180. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  181. package/dist/esm/cpu-grid-layer/grid-aggregator.js +0 -142
  182. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +0 -1
  183. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -16
  184. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  185. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  186. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +0 -196
  187. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  188. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +0 -399
  189. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  190. package/dist/esm/grid-aggregation-layer.js +0 -240
  191. package/dist/esm/grid-aggregation-layer.js.map +0 -1
  192. package/dist/esm/grid-layer/grid-layer.js +0 -80
  193. package/dist/esm/grid-layer/grid-layer.js.map +0 -1
  194. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -55
  195. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  196. package/dist/esm/heatmap-layer/heatmap-layer.js +0 -638
  197. package/dist/esm/heatmap-layer/heatmap-layer.js.map +0 -1
  198. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +0 -1
  199. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +0 -1
  200. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +0 -43
  201. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  202. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +0 -33
  203. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  204. package/dist/esm/heatmap-layer/triangle-layer.js +0 -78
  205. package/dist/esm/heatmap-layer/triangle-layer.js.map +0 -1
  206. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +0 -1
  207. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +0 -1
  208. package/dist/esm/hexagon-layer/hexagon-aggregator.js +0 -87
  209. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +0 -1
  210. package/dist/esm/hexagon-layer/hexagon-layer.js +0 -232
  211. package/dist/esm/hexagon-layer/hexagon-layer.js.map +0 -1
  212. package/dist/esm/index.js +0 -13
  213. package/dist/esm/index.js.map +0 -1
  214. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +0 -203
  215. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  216. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -21
  217. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  218. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  219. package/dist/esm/screen-grid-layer/screen-grid-layer.js +0 -285
  220. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +0 -1
  221. package/dist/esm/types.js +0 -2
  222. package/dist/esm/types.js.map +0 -1
  223. package/dist/esm/utils/aggregation-operation-utils.js +0 -91
  224. package/dist/esm/utils/aggregation-operation-utils.js.map +0 -1
  225. package/dist/esm/utils/bin-sorter.js +0 -165
  226. package/dist/esm/utils/bin-sorter.js.map +0 -1
  227. package/dist/esm/utils/color-utils.js +0 -28
  228. package/dist/esm/utils/color-utils.js.map +0 -1
  229. package/dist/esm/utils/cpu-aggregator.js +0 -487
  230. package/dist/esm/utils/cpu-aggregator.js.map +0 -1
  231. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -21
  232. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  233. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -35
  234. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  235. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -16
  236. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  237. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  238. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -42
  239. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  240. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  241. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  242. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -720
  243. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  244. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  245. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -19
  246. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  247. package/dist/esm/utils/grid-aggregation-utils.js +0 -109
  248. package/dist/esm/utils/grid-aggregation-utils.js.map +0 -1
  249. package/dist/esm/utils/prop-utils.js +0 -12
  250. package/dist/esm/utils/prop-utils.js.map +0 -1
  251. package/dist/esm/utils/resource-utils.js +0 -44
  252. package/dist/esm/utils/resource-utils.js.map +0 -1
  253. package/dist/esm/utils/scale-utils.js +0 -192
  254. package/dist/esm/utils/scale-utils.js.map +0 -1
  255. package/typed/contour-layer/contour-layer.d.ts.map +0 -1
  256. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  257. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  258. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  259. package/typed/grid-aggregation-layer.d.ts.map +0 -1
  260. package/typed/grid-layer/grid-layer.d.ts.map +0 -1
  261. package/typed/heatmap-layer/heatmap-layer.d.ts.map +0 -1
  262. package/typed/hexagon-layer/hexagon-layer.d.ts.map +0 -1
  263. package/typed/index.d.ts +0 -20
  264. package/typed/index.d.ts.map +0 -1
  265. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +0 -1
  266. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +0 -1
  267. /package/{typed → dist}/aggregation-layer.d.ts +0 -0
  268. /package/{typed → dist}/aggregation-layer.d.ts.map +0 -0
  269. /package/{typed → dist}/contour-layer/contour-utils.d.ts +0 -0
  270. /package/{typed → dist}/contour-layer/contour-utils.d.ts.map +0 -0
  271. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts +0 -0
  272. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts.map +0 -0
  273. /package/{typed → dist}/contour-layer/marching-squares.d.ts +0 -0
  274. /package/{typed → dist}/contour-layer/marching-squares.d.ts.map +0 -0
  275. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts +0 -0
  276. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts.map +0 -0
  277. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -0
  278. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -0
  279. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -0
  280. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -0
  281. /package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts +0 -0
  282. /package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts.map +0 -0
  283. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts +0 -0
  284. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts.map +0 -0
  285. /package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts +0 -0
  286. /package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts.map +0 -0
  287. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts +0 -0
  288. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +0 -0
  289. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts +0 -0
  290. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +0 -0
  291. /package/{typed → dist}/heatmap-layer/triangle-layer.d.ts +0 -0
  292. /package/{typed → dist}/heatmap-layer/triangle-layer.d.ts.map +0 -0
  293. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts +0 -0
  294. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts.map +0 -0
  295. /package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts +0 -0
  296. /package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts.map +0 -0
  297. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts +0 -0
  298. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts.map +0 -0
  299. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +0 -0
  300. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +0 -0
  301. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +0 -0
  302. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +0 -0
  303. /package/{typed → dist}/types.d.ts +0 -0
  304. /package/{typed → dist}/types.d.ts.map +0 -0
  305. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts +0 -0
  306. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts.map +0 -0
  307. /package/{typed → dist}/utils/bin-sorter.d.ts +0 -0
  308. /package/{typed → dist}/utils/bin-sorter.d.ts.map +0 -0
  309. /package/{typed → dist}/utils/color-utils.d.ts +0 -0
  310. /package/{typed → dist}/utils/color-utils.d.ts.map +0 -0
  311. /package/{typed → dist}/utils/cpu-aggregator.d.ts +0 -0
  312. /package/{typed → dist}/utils/cpu-aggregator.d.ts.map +0 -0
  313. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -0
  314. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -0
  315. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -0
  316. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -0
  317. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -0
  318. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -0
  319. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -0
  320. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -0
  321. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -0
  322. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -0
  323. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -0
  324. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -0
  325. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -0
  326. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -0
  327. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -0
  328. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts +0 -0
  329. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts.map +0 -0
  330. /package/{typed → dist}/utils/prop-utils.d.ts +0 -0
  331. /package/{typed → dist}/utils/prop-utils.d.ts.map +0 -0
  332. /package/{typed → dist}/utils/resource-utils.d.ts +0 -0
  333. /package/{typed → dist}/utils/resource-utils.d.ts.map +0 -0
  334. /package/{typed → dist}/utils/scale-utils.d.ts +0 -0
  335. /package/{typed → dist}/utils/scale-utils.d.ts.map +0 -0
package/dist.min.js CHANGED
@@ -4,149 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['deck'] = factory();
6
6
  else root['deck'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var Fc=Object.create;var Lr=Object.defineProperty;var Bc=Object.getOwnPropertyDescriptor;var Uc=Object.getOwnPropertyNames;var kc=Object.getPrototypeOf,Wc=Object.prototype.hasOwnProperty;var Ai=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vc=(e,t)=>{for(var r in t)Lr(e,r,{get:t[r],enumerable:!0})},zr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Uc(t))!Wc.call(e,i)&&i!==r&&Lr(e,i,{get:()=>t[i],enumerable:!(n=Bc(t,i))||n.enumerable});return e},Ve=(e,t,r)=>(zr(e,t,"default"),r&&zr(r,t,"default")),M=(e,t,r)=>(r=e!=null?Fc(kc(e)):{},zr(t||!e||!e.__esModule?Lr(r,"default",{value:e,enumerable:!0}):r,e)),Hc=e=>zr(Lr({},"__esModule",{value:!0}),e);var At=Ai((Hp,ds)=>{ds.exports=globalThis.deck});var Q=Ai((zp,_s)=>{_s.exports=globalThis.deck});var B=Ai((Kp,gs)=>{gs.exports=globalThis.luma});var Wr={};Vc(Wr,{AGGREGATION_OPERATION:()=>W,CPUGridLayer:()=>mt,ContourLayer:()=>si,GPUGridLayer:()=>yt,GridLayer:()=>_i,HeatmapLayer:()=>yi,HexagonLayer:()=>Gn,ScreenGridLayer:()=>Kn,_AggregationLayer:()=>ye,_BinSorter:()=>Lt,_CPUAggregator:()=>Yt,_GPUGridAggregator:()=>oe});var Te={},hs=M(At());Ve(Te,M(At()));if(!hs.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Ve(Wr,Te);var $o=M(Q());var st=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e}(st||{});var je=M(B(),1),V=M(B(),1),Js=M(B(),1);var K=e=>`${e}`;function Se(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Ti={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function ms(e){let t={};for(let[r,n]of Object.entries(e))t[r]=Xc(n);return t}function vs(e,t,r){let n={};for(let[i,o]of Object.entries(t))e&&i in e&&!o.private?(o.validate&&Se(o.validate(e[i],o),`${r}: invalid ${i}`),n[i]=e[i]):n[i]=o.value;return n}function Xc(e){let t=ps(e);if(t!=="object")return{value:e,...Ti[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Ti[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=ps(e.value),{...e,...Ti[t],type:t}):{type:"object",value:null};throw new Error("props")}function ps(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var bs=K`\
8
- #ifdef MODULE_LOGDEPTH
9
- logdepth_adjustPosition(gl_Position);
10
- #endif
11
- `,ys=K`\
12
- #ifdef MODULE_MATERIAL
13
- gl_FragColor = material_filterColor(gl_FragColor);
14
- #endif
15
-
16
- #ifdef MODULE_LIGHTING
17
- gl_FragColor = lighting_filterColor(gl_FragColor);
18
- #endif
19
-
20
- #ifdef MODULE_FOG
21
- gl_FragColor = fog_filterColor(gl_FragColor);
22
- #endif
23
-
24
- #ifdef MODULE_PICKING
25
- gl_FragColor = picking_filterHighlightColor(gl_FragColor);
26
- gl_FragColor = picking_filterPickingColor(gl_FragColor);
27
- #endif
28
-
29
- #ifdef MODULE_LOGDEPTH
30
- logdepth_setFragDepth();
31
- #endif
32
- `;var zc={vertex:bs,fragment:ys},As=/void\s+main\s*\([^)]*\)\s*\{\n?/,Ts=/}\n?[^{}]*$/,Si=[],fr="__LUMA_INJECT_DECLARATIONS__";function Ss(e){let t={vertex:{},fragment:{}};for(let r in e){let n=e[r],i=Lc(r);typeof n=="string"&&(n={order:0,injection:n}),t[i][r]=n}return t}function Lc(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function dr(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=t==="vertex";for(let o in r){let s=r[o];s.sort((l,u)=>l.order-u.order),Si.length=s.length;for(let l=0,u=s.length;l<u;++l)Si[l]=s[l].injection;let a=`${Si.join(`
33
- `)}
34
- `;switch(o){case"vs:#decl":i&&(e=e.replace(fr,a));break;case"vs:#main-start":i&&(e=e.replace(As,l=>l+a));break;case"vs:#main-end":i&&(e=e.replace(Ts,l=>a+l));break;case"fs:#decl":i||(e=e.replace(fr,a));break;case"fs:#main-start":i||(e=e.replace(As,l=>l+a));break;case"fs:#main-end":i||(e=e.replace(Ts,l=>a+l));break;default:e=e.replace(o,l=>l+a)}}return e=e.replace(fr,""),n&&(e=e.replace(/\}\s*$/,o=>o+zc[t])),e}var jc=1,pe=class{static instantiateModules(t){return t.map(r=>{if(r instanceof pe)return r;Se(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${jc++}`);let n=new pe(r);return n.dependencies=pe.instantiateModules(r.dependencies||[]),n})}constructor(t){this.name=void 0,this.vs=void 0,this.fs=void 0,this.getModuleUniforms=void 0,this.dependencies=void 0,this.deprecations=void 0,this.defines=void 0,this.injections=void 0,this.uniforms={},this.uniformTypes={};let{name:r,vs:n,fs:i,dependencies:o=[],uniformPropTypes:s={},getUniforms:a,deprecations:l=[],defines:u={},inject:c={}}=t;Se(typeof r=="string"),this.name=r,this.vs=n,this.fs=i,this.getModuleUniforms=a,this.dependencies=pe.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(l),this.defines=u,this.injections=Ss(c),s&&(this.uniforms=ms(s))}getModuleSource(t){let r;switch(t){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:Se(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
35
-
36
- #define MODULE_${n}
37
- ${r}
38
-
39
- `}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):vs(t,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(t,r){this.deprecations.forEach(n=>{var i;(i=n.regex)!==null&&i!==void 0&&i.test(t)&&(n.deprecated?r.deprecated(n.old,n.new)():r.removed(n.old,n.new)())})}_parseDeprecationDefinitions(t){return t.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),t}_defaultGetUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},n=this.uniforms;for(let i in n){let o=n[i];i in t&&!o.private?(o.validate&&Se(o.validate(t[i],o),`${this.name}: invalid ${i}`),r[i]=t[i]):r[i]=o.value}return r}};function hr(e){let t=pe.instantiateModules(e);return $c(t)}function $c(e){let t={},r={};return xs({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((n,i)=>r[i]-r[n]).map(n=>t[n])}function xs(e){let{modules:t,level:r,moduleMap:n,moduleDepth:i}=e;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let o of t)n[o.name]=o,(i[o.name]===void 0||i[o.name]<r)&&(i[o.name]=r);for(let o of t)o.dependencies&&xs({modules:o.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}function Rs(e){switch(e?.gpu.toLowerCase()){case"apple":return K`\
40
- #define APPLE_GPU
41
- // Apple optimizes away the calculation necessary for emulated fp64
42
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
43
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
44
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
45
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
46
- `;case"nvidia":return K`\
47
- #define NVIDIA_GPU
48
- // Nvidia optimizes away the calculation necessary for emulated fp64
49
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
50
- `;case"intel":return K`\
51
- #define INTEL_GPU
52
- // Intel optimizes away the calculation necessary for emulated fp64
53
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
54
- // Intel's built-in 'tan' function doesn't have acceptable precision
55
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
56
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
57
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
58
- `;case"amd":return K`\
59
- #define AMD_GPU
60
- `;default:return K`\
61
- #define DEFAULT_GPU
62
- // Prevent driver from optimizing away the calculation necessary for emulated fp64
63
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
64
- // Headless Chrome's software shader 'tan' function doesn't have acceptable precision
65
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
66
- // If the GPU doesn't have full 32 bits precision, will causes overflow
67
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
68
- `}}function Es(e){let t="";return e.features.has("webgl2")&&(t+=K`\
69
- # define FEATURE_GLSL_DERIVATIVES
70
- # define FEATURE_GLSL_DRAW_BUFFERS
71
- # define FEATURE_GLSL_FRAG_DEPTH
72
- # define FEATURE_GLSL_TEXTURE_LOD
73
- `),e.features.has("webgl2")||(e.features.has("glsl-frag-depth")&&(t+=K`\
74
-
75
- // FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
76
- #ifdef GL_EXT_frag_depth
77
- # extension GL_EXT_frag_depth : enable
78
- # define FEATURE_GLSL_FRAG_DEPTH
79
- # define FRAG_DEPTH
80
- # define gl_FragDepth gl_FragDepthEXT
81
- #endif
82
- `),e!=null&&e.features.has("glsl-derivatives")&&(t+=K`\
83
-
84
- // FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available
85
- #if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
86
- # extension GL_OES_standard_derivatives : enable
87
- # define FEATURE_GLSL_DERIVATIVES
88
- #endif
89
- `),e!=null&&e.features.has("glsl-frag-data")&&(t+=K`\
90
-
91
- // FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available
92
- #ifdef GL_EXT_draw_buffers
93
- # extension GL_EXT_draw_buffers : require
94
- # define FEATURE_GLSL_DRAW_BUFFERS
95
- #endif
96
- `),e!=null&&e.features.has("glsl-texture-lod")&&(t+=K`\
97
- // TEXTURE_LOD => texture2DLod etc are available
98
- #ifdef GL_EXT_shader_texture_lod
99
- # extension GL_EXT_shader_texture_lod : enable
100
- # define FEATURE_GLSL_TEXTURE_LOD
101
- # define TEXTURE_LOD
102
- #endif
103
- `)),t}function ws(e,t,r){var n;if(Number(((n=e.match(/^#version[ \t]+(\d+)/m))===null||n===void 0?void 0:n[1])||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case 300:switch(r){case"vertex":return e=_r(e,Kc),e;case"fragment":return e=_r(e,Yc),e;default:throw new Error(r)}case 100:switch(r){case"vertex":return e=_r(e,qc),e;case"fragment":return e=_r(e,Ps),e=Qc(e),e;default:throw new Error(r)}default:throw new Error(String(t))}}var Cs=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
104
- `],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],Kc=[...Cs,[Tt("attribute"),"in $1"],[Tt("varying"),"out $1"]],Yc=[...Cs,[Tt("varying"),"in $1"]],Ns=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],qc=[...Ns,[Tt("in"),"attribute $1"],[Tt("out"),"varying $1"]],Ps=[...Ns,[Tt("in"),"varying $1"]],Zc="gl_FragColor",Os=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function _r(e,t){for(let[r,n]of t)e=e.replace(r,n);return e}function Qc(e){e=_r(e,Ps);let t=Os.exec(e);if(t){let r=t[1];e=e.replace(Os,"").replace(new RegExp(`\\b${r}\\b`,"g"),Zc)}return e}function Tt(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function xi(e,t){let r="";for(let n in e){let i=e[n];if(r+=`void ${i.signature} {
105
- `,i.header&&(r+=` ${i.header}`),t[n]){let o=t[n];o.sort((s,a)=>s.order-a.order);for(let s of o)r+=` ${s.injection}
106
- `}i.footer&&(r+=` ${i.footer}`),r+=`}
107
- `}return r}function Ri(e){let t={vertex:{},fragment:{}};for(let r of e){let n,i;typeof r!="string"?(n=r,i=n.hook):(n={},i=r),i=i.trim();let[o,s]=i.split(":"),a=i.replace(/\(.+/,""),l=Object.assign(n,{signature:s});switch(o){case"vs":t.vertex[a]=l;break;case"fs":t.fragment[a]=l;break;default:throw new Error(o)}}return t}function Is(e,t){return{name:Jc(e,t),language:"glsl",version:Gc(e)}}function Jc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[^\S\r\n]*SHADER_NAME[^\S\r\n]*([A-Za-z0-9_-]+)\s*/.exec(e);return n?n[1]:t}function Gc(e){let t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}if(t!==100&&t!==300)throw new Error(`Invalid GLSL version ${t}`);return t}var Bs=`
108
-
109
- ${fr}
110
- `,ef=K`\
111
- precision highp float;
112
- `;function Us(e){let{vs:t,fs:r}=e,n=hr(e.modules||[]);switch(e.platformInfo.shaderLanguage){case"glsl":return{vs:Ds(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:Ds(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:Fs(n)};case"wgsl":return{vs:Ms(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:Ms(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:Fs(n)}}}function Ms(e,t){let{source:r,stage:n,modules:i,defines:o={},hookFunctions:s=[],inject:a={},log:l}=t;Se(typeof r=="string","shader source must be a string");let u=r,c={};i.forEach(v=>{Object.assign(c,v.getDefines())}),Object.assign(c,o);let f="",h=Ri(s),_={},m={},y={};for(let v in a){let S=typeof a[v]=="string"?{injection:a[v],order:0}:a[v],T=/^(v|f)s:(#)?([\w-]+)$/.exec(v);if(T){let x=T[2],O=T[3];x?O==="decl"?m[v]=[S]:y[v]=[S]:_[v]=[S]}else y[v]=[S]}for(let v of i){l&&v.checkDeprecations(u,l);let S=v.getModuleSource(n,"wgsl");f+=S;let T=v.injections[n];for(let x in T){let O=/^(v|f)s:#([\w-]+)$/.exec(x);if(O){let I=O[2]==="decl"?m:y;I[x]=I[x]||[],I[x].push(T[x])}else _[x]=_[x]||[],_[x].push(T[x])}}return f+=Bs,f=dr(f,n,m),f+=xi(h[n],_),f+=u,f=dr(f,n,y),f}function Ds(e,t){let{id:r,source:n,stage:i,language:o="glsl",modules:s,defines:a={},hookFunctions:l=[],inject:u={},prologue:c=!0,log:f}=t;Se(typeof n=="string","shader source must be a string");let h=o==="glsl"?Is(n).version:-1,_=e.shaderLanguageVersion,m=h===100?"#version 100":"#version 300 es",v=n.split(`
113
- `).slice(1).join(`
114
- `),S={};s.forEach(D=>{Object.assign(S,D.getDefines())}),Object.assign(S,a);let T="";switch(o){case"wgsl":break;case"glsl":T=c?`${m}
115
-
116
- // ----- PROLOGUE -------------------------
117
- ${tf({id:r,source:n,stage:i})}
118
- ${`#define SHADER_TYPE_${i.toUpperCase()}`}
119
- ${Rs(e)}
120
- ${Es(e)}
121
- ${i==="fragment"?ef:""}
122
-
123
- // ----- APPLICATION DEFINES -------------------------
124
-
125
- ${rf(S)}
126
-
127
- `:`${m}
128
- `;break}let x=Ri(l),O={},P={},I={};for(let D in u){let F=typeof u[D]=="string"?{injection:u[D],order:0}:u[D],X=/^(v|f)s:(#)?([\w-]+)$/.exec(D);if(X){let L=X[2],q=X[3];L?q==="decl"?P[D]=[F]:I[D]=[F]:O[D]=[F]}else I[D]=[F]}for(let D of s){f&&D.checkDeprecations(v,f);let F=D.getModuleSource(i);T+=F;let X=D.injections[i];for(let L in X){let q=/^(v|f)s:#([\w-]+)$/.exec(L);if(q){let fe=q[2]==="decl"?P:I;fe[L]=fe[L]||[],fe[L].push(X[L])}else O[L]=O[L]||[],O[L].push(X[L])}}return T+="// ----- MAIN SHADER SOURCE -------------------------",T+=Bs,T=dr(T,i,P),T+=xi(x[i],O),T+=v,T=dr(T,i,I),o==="glsl"&&h!==_&&(T=ws(T,_,i)),T.trim()}function Fs(e){return function(r){let n={};for(let i of e){let o=i.getUniforms(r,n);Object.assign(n,o)}return n}}function tf(e){let{id:t,source:r,stage:n}=e;return t&&r.indexOf("SHADER_NAME")===-1?`
129
- #define SHADER_NAME ${t}_${n}
130
-
131
- `:""}function rf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t="";for(let r in e){let n=e[r];(n||Number.isFinite(n))&&(t+=`#define ${r.toUpperCase()} ${e[r]}
132
- `)}return t}function Ws(e){if(!e.vs)throw new Error("no vertex shader");let t=ks(e.platformInfo,e.vs),r;return e.fs&&(r=ks(e.platformInfo,e.fs)),{...e,vs:t,fs:r}}function ks(e,t){if(typeof t=="string")return t;switch(e.type){case"webgpu":if(t!=null&&t.wgsl)return t.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(t!=null&&t.glsl)return t.glsl;throw new Error("WebGL does not support WGSL shaders")}}var me=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return me.defaultShaderAssembler=me.defaultShaderAssembler||new me,me.defaultShaderAssembler}addDefaultModule(t){this._defaultModules.find(r=>r.name===(typeof t=="string"?t:t.name))||this._defaultModules.push(t)}removeDefaultModule(t){let r=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==r)}addShaderHook(t,r){r&&(t=Object.assign(r,{hook:t})),this._hookFunctions.push(t)}assembleShaders(t){let r=this._getModuleList(t.modules),n=this._hookFunctions,i=Ws(t);return{...Us({platformInfo:t.platformInfo,...i,modules:r,hookFunctions:n}),modules:r}}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+t.length),n={},i=0;for(let o=0,s=this._defaultModules.length;o<s;++o){let a=this._defaultModules[o],l=a.name;r[i++]=a,n[l]=!0}for(let o=0,s=t.length;o<s;++o){let a=t[o],l=a.name;n[l]||(r[i++]=a,n[l]=!0)}return r.length=i,pe.instantiateModules(r)}};me.defaultShaderAssembler=void 0;var nf=K`void main() {gl_FragColor = vec4(0);}`,Vs=K`\
133
- out vec4 transform_output;
134
- void main() {
135
- transform_output = vec4(0);
136
- }`,of=`#version 300 es
137
- ${Vs}`;function Ei(e){let{version:t=100,input:r,inputChannels:n,output:i}=e||{};if(!r)return t===300?of:t>300?`#version ${t}
138
- ${Vs}`:nf;if(!n)throw new Error("inputChannels");let o=sf(n),s=Hs(r,n);return t>=300?`#version ${t} ${t===300?"es":""}
139
- in ${o} ${r};
140
- out vec4 ${i};
141
- void main() {
142
- ${i} = ${s};
143
- }`:`varying ${o} ${r};
144
- void main() {
145
- gl_FragColor = ${s};
146
- }`}function sf(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${e}`)}}function Hs(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw new Error(`invalid channels: ${t}`)}}var Oi=class{constructor(){this.constants=new Map,this.aliases=new Map,this.structs=new Map}},Me=class{constructor(){}get isAstNode(){return!0}get astNodeType(){return""}evaluate(t){throw new Error("Cannot evaluate node")}evaluateString(t){return this.evaluate(t).toString()}},z=class extends Me{constructor(){super()}},jr=class extends z{constructor(t,r,n,i){super(),this.name=t,this.args=r,this.returnType=n,this.body=i}get astNodeType(){return"function"}},wi=class extends z{constructor(t){super(),this.expression=t}get astNodeType(){return"staticAssert"}},Ci=class extends z{constructor(t,r){super(),this.condition=t,this.body=r}get astNodeType(){return"while"}},Ni=class extends z{constructor(t){super(),this.body=t}get astNodeType(){return"continuing"}},Pi=class extends z{constructor(t,r,n,i){super(),this.init=t,this.condition=r,this.increment=n,this.body=i}get astNodeType(){return"for"}},Xe=class extends z{constructor(t,r,n,i,o){super(),this.name=t,this.type=r,this.storage=n,this.access=i,this.value=o}get astNodeType(){return"var"}},$r=class extends z{constructor(t,r,n){super(),this.name=t,this.type=r,this.value=n}get astNodeType(){return"override"}},Kr=class extends z{constructor(t,r,n,i,o){super(),this.name=t,this.type=r,this.storage=n,this.access=i,this.value=o}get astNodeType(){return"let"}},Yr=class extends z{constructor(t,r,n,i,o){super(),this.name=t,this.type=r,this.storage=n,this.access=i,this.value=o}get astNodeType(){return"const"}evaluate(t){return this.value.evaluate(t)}},Et;(function(e){e.increment="++",e.decrement="--"})(Et||(Et={}));(function(e){function t(r){let n=r;if(n=="parse")throw new Error("Invalid value for IncrementOperator");return e[n]}e.parse=t})(Et||(Et={}));var Ii=class extends z{constructor(t,r){super(),this.operator=t,this.variable=r}get astNodeType(){return"increment"}},pr;(function(e){e.assign="=",e.addAssign="+=",e.subtractAssin="-=",e.multiplyAssign="*=",e.divideAssign="/=",e.moduloAssign="%=",e.andAssign="&=",e.orAssign="|=",e.xorAssign="^=",e.shiftLeftAssign="<<=",e.shiftRightAssign=">>="})(pr||(pr={}));(function(e){function t(r){let n=r;if(n=="parse")throw new Error("Invalid value for AssignOperator");return e[n]}e.parse=t})(pr||(pr={}));var Mi=class extends z{constructor(t,r,n){super(),this.operator=t,this.variable=r,this.value=n}get astNodeType(){return"assign"}},Di=class extends z{constructor(t,r){super(),this.name=t,this.args=r}get astNodeType(){return"call"}},Fi=class extends z{constructor(t,r){super(),this.body=t,this.continuing=r}get astNodeType(){return"loop"}},Bi=class extends z{constructor(t,r){super(),this.condition=t,this.body=r}get astNodeType(){return"body"}},Ui=class extends z{constructor(t,r,n,i){super(),this.condition=t,this.body=r,this.elseif=n,this.else=i}get astNodeType(){return"if"}},ki=class extends z{constructor(t){super(),this.value=t}get astNodeType(){return"return"}},Wi=class extends z{constructor(t){super(),this.name=t}get astNodeType(){return"enable"}},qr=class extends z{constructor(t,r){super(),this.name=t,this.type=r}get astNodeType(){return"alias"}},Vi=class extends z{constructor(){super()}get astNodeType(){return"discard"}},Hi=class extends z{constructor(){super()}get astNodeType(){return"break"}},Xi=class extends z{constructor(){super()}get astNodeType(){return"continue"}},De=class extends z{constructor(t){super(),this.name=t}get astNodeType(){return"type"}get isStruct(){return!1}get isArray(){return!1}},Ie=class extends De{constructor(t,r){super(t),this.members=r}get astNodeType(){return"struct"}get isStruct(){return!0}getMemberIndex(t){for(let r=0;r<this.members.length;r++)if(this.members[r].name==t)return r;return-1}},Zr=class extends De{constructor(t,r,n){super(t),this.format=r,this.access=n}get astNodeType(){return"template"}},zi=class extends De{constructor(t,r,n,i){super(t),this.storage=r,this.type=n,this.access=i}get astNodeType(){return"pointer"}},Qr=class extends De{constructor(t,r,n,i){super(t),this.attributes=r,this.format=n,this.count=i}get astNodeType(){return"array"}get isArray(){return!0}},at=class extends De{constructor(t,r,n){super(t),this.format=r,this.access=n}get astNodeType(){return"sampler"}},_e=class extends Me{constructor(){super()}},Jr=class extends _e{constructor(t){super(),this.value=t}get astNodeType(){return"stringExpr"}toString(){return this.value}evaluateString(){return this.value}},lt=class extends _e{constructor(t,r){super(),this.type=t,this.args=r}get astNodeType(){return"createExpr"}},Li=class extends _e{constructor(t,r){super(),this.name=t,this.args=r}get astNodeType(){return"callExpr"}evaluate(t){switch(this.name){case"abs":return Math.abs(this.args[0].evaluate(t));case"acos":return Math.acos(this.args[0].evaluate(t));case"acosh":return Math.acosh(this.args[0].evaluate(t));case"asin":return Math.asin(this.args[0].evaluate(t));case"asinh":return Math.asinh(this.args[0].evaluate(t));case"atan":return Math.atan(this.args[0].evaluate(t));case"atan2":return Math.atan2(this.args[0].evaluate(t),this.args[1].evaluate(t));case"atanh":return Math.atanh(this.args[0].evaluate(t));case"ceil":return Math.ceil(this.args[0].evaluate(t));case"clamp":return Math.min(Math.max(this.args[0].evaluate(t),this.args[1].evaluate(t)),this.args[2].evaluate(t));case"cos":return Math.cos(this.args[0].evaluate(t));case"degrees":return this.args[0].evaluate(t)*180/Math.PI;case"distance":return Math.sqrt(Math.pow(this.args[0].evaluate(t)-this.args[1].evaluate(t),2));case"dot":case"exp":return Math.exp(this.args[0].evaluate(t));case"exp2":return Math.pow(2,this.args[0].evaluate(t));case"floor":return Math.floor(this.args[0].evaluate(t));case"fma":return this.args[0].evaluate(t)*this.args[1].evaluate(t)+this.args[2].evaluate(t);case"fract":return this.args[0].evaluate(t)-Math.floor(this.args[0].evaluate(t));case"inverseSqrt":return 1/Math.sqrt(this.args[0].evaluate(t));case"log":return Math.log(this.args[0].evaluate(t));case"log2":return Math.log2(this.args[0].evaluate(t));case"max":return Math.max(this.args[0].evaluate(t),this.args[1].evaluate(t));case"min":return Math.min(this.args[0].evaluate(t),this.args[1].evaluate(t));case"mix":return this.args[0].evaluate(t)*(1-this.args[2].evaluate(t))+this.args[1].evaluate(t)*this.args[2].evaluate(t);case"modf":return this.args[0].evaluate(t)-Math.floor(this.args[0].evaluate(t));case"pow":return Math.pow(this.args[0].evaluate(t),this.args[1].evaluate(t));case"radians":return this.args[0].evaluate(t)*Math.PI/180;case"round":return Math.round(this.args[0].evaluate(t));case"sign":return Math.sign(this.args[0].evaluate(t));case"sin":return Math.sin(this.args[0].evaluate(t));case"sinh":return Math.sinh(this.args[0].evaluate(t));case"saturate":return Math.min(Math.max(this.args[0].evaluate(t),0),1);case"smoothstep":return this.args[0].evaluate(t)*this.args[0].evaluate(t)*(3-2*this.args[0].evaluate(t));case"sqrt":return Math.sqrt(this.args[0].evaluate(t));case"step":return this.args[0].evaluate(t)<this.args[1].evaluate(t)?0:1;case"tan":return Math.tan(this.args[0].evaluate(t));case"tanh":return Math.tanh(this.args[0].evaluate(t));case"trunc":return Math.trunc(this.args[0].evaluate(t));default:throw new Error("Non const function: "+this.name)}}},ji=class extends _e{constructor(t){super(),this.name=t}get astNodeType(){return"varExpr"}},Gr=class extends _e{constructor(t,r){super(),this.name=t,this.initializer=r}get astNodeType(){return"constExpr"}evaluate(t){var r,n;if(this.initializer instanceof lt){let i=(r=this.postfix)===null||r===void 0?void 0:r.evaluateString(t),o=(n=this.initializer.type)===null||n===void 0?void 0:n.name,s=t.structs.get(o),a=s?.getMemberIndex(i);if(a!=-1)return this.initializer.args[a].evaluate(t);console.log(a)}return this.initializer.evaluate(t)}},en=class extends _e{constructor(t){super(),this.value=t}get astNodeType(){return"literalExpr"}evaluate(){return this.value}},$i=class extends _e{constructor(t,r){super(),this.type=t,this.value=r}get astNodeType(){return"bitcastExpr"}},Ki=class extends _e{constructor(t,r){super(),this.type=t,this.args=r}get astNodeType(){return"typecastExpr"}evaluate(t){return this.args[0].evaluate(t)}},tn=class extends _e{constructor(t){super(),this.contents=t}get astNodeType(){return"groupExpr"}evaluate(t){return this.contents[0].evaluate(t)}},rn=class extends _e{constructor(){super()}},Yi=class extends rn{constructor(t,r){super(),this.operator=t,this.right=r}get astNodeType(){return"unaryOp"}evaluate(t){switch(this.operator){case"+":return this.right.evaluate(t);case"-":return-this.right.evaluate(t);case"!":return this.right.evaluate(t)?0:1;case"~":return~this.right.evaluate(t);default:throw new Error("Unknown unary operator: "+this.operator)}}},de=class extends rn{constructor(t,r,n){super(),this.operator=t,this.left=r,this.right=n}get astNodeType(){return"binaryOp"}evaluate(t){switch(this.operator){case"+":return this.left.evaluate(t)+this.right.evaluate(t);case"-":return this.left.evaluate(t)-this.right.evaluate(t);case"*":return this.left.evaluate(t)*this.right.evaluate(t);case"/":return this.left.evaluate(t)/this.right.evaluate(t);case"%":return this.left.evaluate(t)%this.right.evaluate(t);case"==":return this.left.evaluate(t)==this.right.evaluate(t)?1:0;case"!=":return this.left.evaluate(t)!=this.right.evaluate(t)?1:0;case"<":return this.left.evaluate(t)<this.right.evaluate(t)?1:0;case">":return this.left.evaluate(t)>this.right.evaluate(t)?1:0;case"<=":return this.left.evaluate(t)<=this.right.evaluate(t)?1:0;case">=":return this.left.evaluate(t)>=this.right.evaluate(t)?1:0;case"&&":return this.left.evaluate(t)&&this.right.evaluate(t)?1:0;case"||":return this.left.evaluate(t)||this.right.evaluate(t)?1:0;default:throw new Error(`Unknown operator ${this.operator}`)}}},nn=class extends Me{constructor(){super()}},qi=class extends nn{constructor(t,r){super(),this.selector=t,this.body=r}get astNodeType(){return"case"}},Zi=class extends nn{constructor(t){super(),this.body=t}get astNodeType(){return"default"}},Qi=class extends Me{constructor(t,r,n){super(),this.name=t,this.type=r,this.attributes=n}get astNodeType(){return"argument"}},Ji=class extends Me{constructor(t,r){super(),this.condition=t,this.body=r}get astNodeType(){return"elseif"}},Gi=class extends Me{constructor(t,r,n){super(),this.name=t,this.type=r,this.attributes=n}get astNodeType(){return"member"}},on=class extends Me{constructor(t,r){super(),this.name=t,this.value=r}get astNodeType(){return"attribute"}},A,p;(function(e){e[e.token=0]="token",e[e.keyword=1]="keyword",e[e.reserved=2]="reserved"})(p||(p={}));var g=class{constructor(t,r,n){this.name=t,this.type=r,this.rule=n}toString(){return this.name}},d=class{};A=d;d.none=new g("",p.reserved,"");d.eof=new g("EOF",p.token,"");d.reserved={asm:new g("asm",p.reserved,"asm"),bf16:new g("bf16",p.reserved,"bf16"),do:new g("do",p.reserved,"do"),enum:new g("enum",p.reserved,"enum"),f16:new g("f16",p.reserved,"f16"),f64:new g("f64",p.reserved,"f64"),handle:new g("handle",p.reserved,"handle"),i8:new g("i8",p.reserved,"i8"),i16:new g("i16",p.reserved,"i16"),i64:new g("i64",p.reserved,"i64"),mat:new g("mat",p.reserved,"mat"),premerge:new g("premerge",p.reserved,"premerge"),regardless:new g("regardless",p.reserved,"regardless"),typedef:new g("typedef",p.reserved,"typedef"),u8:new g("u8",p.reserved,"u8"),u16:new g("u16",p.reserved,"u16"),u64:new g("u64",p.reserved,"u64"),unless:new g("unless",p.reserved,"unless"),using:new g("using",p.reserved,"using"),vec:new g("vec",p.reserved,"vec"),void:new g("void",p.reserved,"void")};d.keywords={array:new g("array",p.keyword,"array"),atomic:new g("atomic",p.keyword,"atomic"),bool:new g("bool",p.keyword,"bool"),f32:new g("f32",p.keyword,"f32"),i32:new g("i32",p.keyword,"i32"),mat2x2:new g("mat2x2",p.keyword,"mat2x2"),mat2x3:new g("mat2x3",p.keyword,"mat2x3"),mat2x4:new g("mat2x4",p.keyword,"mat2x4"),mat3x2:new g("mat3x2",p.keyword,"mat3x2"),mat3x3:new g("mat3x3",p.keyword,"mat3x3"),mat3x4:new g("mat3x4",p.keyword,"mat3x4"),mat4x2:new g("mat4x2",p.keyword,"mat4x2"),mat4x3:new g("mat4x3",p.keyword,"mat4x3"),mat4x4:new g("mat4x4",p.keyword,"mat4x4"),ptr:new g("ptr",p.keyword,"ptr"),sampler:new g("sampler",p.keyword,"sampler"),sampler_comparison:new g("sampler_comparison",p.keyword,"sampler_comparison"),struct:new g("struct",p.keyword,"struct"),texture_1d:new g("texture_1d",p.keyword,"texture_1d"),texture_2d:new g("texture_2d",p.keyword,"texture_2d"),texture_2d_array:new g("texture_2d_array",p.keyword,"texture_2d_array"),texture_3d:new g("texture_3d",p.keyword,"texture_3d"),texture_cube:new g("texture_cube",p.keyword,"texture_cube"),texture_cube_array:new g("texture_cube_array",p.keyword,"texture_cube_array"),texture_multisampled_2d:new g("texture_multisampled_2d",p.keyword,"texture_multisampled_2d"),texture_storage_1d:new g("texture_storage_1d",p.keyword,"texture_storage_1d"),texture_storage_2d:new g("texture_storage_2d",p.keyword,"texture_storage_2d"),texture_storage_2d_array:new g("texture_storage_2d_array",p.keyword,"texture_storage_2d_array"),texture_storage_3d:new g("texture_storage_3d",p.keyword,"texture_storage_3d"),texture_depth_2d:new g("texture_depth_2d",p.keyword,"texture_depth_2d"),texture_depth_2d_array:new g("texture_depth_2d_array",p.keyword,"texture_depth_2d_array"),texture_depth_cube:new g("texture_depth_cube",p.keyword,"texture_depth_cube"),texture_depth_cube_array:new g("texture_depth_cube_array",p.keyword,"texture_depth_cube_array"),texture_depth_multisampled_2d:new g("texture_depth_multisampled_2d",p.keyword,"texture_depth_multisampled_2d"),texture_external:new g("texture_external",p.keyword,"texture_external"),u32:new g("u32",p.keyword,"u32"),vec2:new g("vec2",p.keyword,"vec2"),vec3:new g("vec3",p.keyword,"vec3"),vec4:new g("vec4",p.keyword,"vec4"),bitcast:new g("bitcast",p.keyword,"bitcast"),block:new g("block",p.keyword,"block"),break:new g("break",p.keyword,"break"),case:new g("case",p.keyword,"case"),continue:new g("continue",p.keyword,"continue"),continuing:new g("continuing",p.keyword,"continuing"),default:new g("default",p.keyword,"default"),discard:new g("discard",p.keyword,"discard"),else:new g("else",p.keyword,"else"),enable:new g("enable",p.keyword,"enable"),fallthrough:new g("fallthrough",p.keyword,"fallthrough"),false:new g("false",p.keyword,"false"),fn:new g("fn",p.keyword,"fn"),for:new g("for",p.keyword,"for"),function:new g("function",p.keyword,"function"),if:new g("if",p.keyword,"if"),let:new g("let",p.keyword,"let"),const:new g("const",p.keyword,"const"),loop:new g("loop",p.keyword,"loop"),while:new g("while",p.keyword,"while"),private:new g("private",p.keyword,"private"),read:new g("read",p.keyword,"read"),read_write:new g("read_write",p.keyword,"read_write"),return:new g("return",p.keyword,"return"),storage:new g("storage",p.keyword,"storage"),switch:new g("switch",p.keyword,"switch"),true:new g("true",p.keyword,"true"),alias:new g("alias",p.keyword,"alias"),type:new g("type",p.keyword,"type"),uniform:new g("uniform",p.keyword,"uniform"),var:new g("var",p.keyword,"var"),override:new g("override",p.keyword,"override"),workgroup:new g("workgroup",p.keyword,"workgroup"),write:new g("write",p.keyword,"write"),r8unorm:new g("r8unorm",p.keyword,"r8unorm"),r8snorm:new g("r8snorm",p.keyword,"r8snorm"),r8uint:new g("r8uint",p.keyword,"r8uint"),r8sint:new g("r8sint",p.keyword,"r8sint"),r16uint:new g("r16uint",p.keyword,"r16uint"),r16sint:new g("r16sint",p.keyword,"r16sint"),r16float:new g("r16float",p.keyword,"r16float"),rg8unorm:new g("rg8unorm",p.keyword,"rg8unorm"),rg8snorm:new g("rg8snorm",p.keyword,"rg8snorm"),rg8uint:new g("rg8uint",p.keyword,"rg8uint"),rg8sint:new g("rg8sint",p.keyword,"rg8sint"),r32uint:new g("r32uint",p.keyword,"r32uint"),r32sint:new g("r32sint",p.keyword,"r32sint"),r32float:new g("r32float",p.keyword,"r32float"),rg16uint:new g("rg16uint",p.keyword,"rg16uint"),rg16sint:new g("rg16sint",p.keyword,"rg16sint"),rg16float:new g("rg16float",p.keyword,"rg16float"),rgba8unorm:new g("rgba8unorm",p.keyword,"rgba8unorm"),rgba8unorm_srgb:new g("rgba8unorm_srgb",p.keyword,"rgba8unorm_srgb"),rgba8snorm:new g("rgba8snorm",p.keyword,"rgba8snorm"),rgba8uint:new g("rgba8uint",p.keyword,"rgba8uint"),rgba8sint:new g("rgba8sint",p.keyword,"rgba8sint"),bgra8unorm:new g("bgra8unorm",p.keyword,"bgra8unorm"),bgra8unorm_srgb:new g("bgra8unorm_srgb",p.keyword,"bgra8unorm_srgb"),rgb10a2unorm:new g("rgb10a2unorm",p.keyword,"rgb10a2unorm"),rg11b10float:new g("rg11b10float",p.keyword,"rg11b10float"),rg32uint:new g("rg32uint",p.keyword,"rg32uint"),rg32sint:new g("rg32sint",p.keyword,"rg32sint"),rg32float:new g("rg32float",p.keyword,"rg32float"),rgba16uint:new g("rgba16uint",p.keyword,"rgba16uint"),rgba16sint:new g("rgba16sint",p.keyword,"rgba16sint"),rgba16float:new g("rgba16float",p.keyword,"rgba16float"),rgba32uint:new g("rgba32uint",p.keyword,"rgba32uint"),rgba32sint:new g("rgba32sint",p.keyword,"rgba32sint"),rgba32float:new g("rgba32float",p.keyword,"rgba32float"),static_assert:new g("static_assert",p.keyword,"static_assert")};d.tokens={decimal_float_literal:new g("decimal_float_literal",p.token,/((-?[0-9]*\.[0-9]+|-?[0-9]+\.[0-9]*)((e|E)(\+|-)?[0-9]+)?f?)|(-?[0-9]+(e|E)(\+|-)?[0-9]+f?)|([0-9]+f)/),hex_float_literal:new g("hex_float_literal",p.token,/-?0x((([0-9a-fA-F]*\.[0-9a-fA-F]+|[0-9a-fA-F]+\.[0-9a-fA-F]*)((p|P)(\+|-)?[0-9]+f?)?)|([0-9a-fA-F]+(p|P)(\+|-)?[0-9]+f?))/),int_literal:new g("int_literal",p.token,/-?0x[0-9a-fA-F]+|0i?|-?[1-9][0-9]*i?/),uint_literal:new g("uint_literal",p.token,/0x[0-9a-fA-F]+u|0u|[1-9][0-9]*u/),ident:new g("ident",p.token,/[a-zA-Z][0-9a-zA-Z_]*/),and:new g("and",p.token,"&"),and_and:new g("and_and",p.token,"&&"),arrow:new g("arrow ",p.token,"->"),attr:new g("attr",p.token,"@"),attr_left:new g("attr_left",p.token,"[["),attr_right:new g("attr_right",p.token,"]]"),forward_slash:new g("forward_slash",p.token,"/"),bang:new g("bang",p.token,"!"),bracket_left:new g("bracket_left",p.token,"["),bracket_right:new g("bracket_right",p.token,"]"),brace_left:new g("brace_left",p.token,"{"),brace_right:new g("brace_right",p.token,"}"),colon:new g("colon",p.token,":"),comma:new g("comma",p.token,","),equal:new g("equal",p.token,"="),equal_equal:new g("equal_equal",p.token,"=="),not_equal:new g("not_equal",p.token,"!="),greater_than:new g("greater_than",p.token,">"),greater_than_equal:new g("greater_than_equal",p.token,">="),shift_right:new g("shift_right",p.token,">>"),less_than:new g("less_than",p.token,"<"),less_than_equal:new g("less_than_equal",p.token,"<="),shift_left:new g("shift_left",p.token,"<<"),modulo:new g("modulo",p.token,"%"),minus:new g("minus",p.token,"-"),minus_minus:new g("minus_minus",p.token,"--"),period:new g("period",p.token,"."),plus:new g("plus",p.token,"+"),plus_plus:new g("plus_plus",p.token,"++"),or:new g("or",p.token,"|"),or_or:new g("or_or",p.token,"||"),paren_left:new g("paren_left",p.token,"("),paren_right:new g("paren_right",p.token,")"),semicolon:new g("semicolon",p.token,";"),star:new g("star",p.token,"*"),tilde:new g("tilde",p.token,"~"),underscore:new g("underscore",p.token,"_"),xor:new g("xor",p.token,"^"),plus_equal:new g("plus_equal",p.token,"+="),minus_equal:new g("minus_equal",p.token,"-="),times_equal:new g("times_equal",p.token,"*="),division_equal:new g("division_equal",p.token,"/="),modulo_equal:new g("modulo_equal",p.token,"%="),and_equal:new g("and_equal",p.token,"&="),or_equal:new g("or_equal",p.token,"|="),xor_equal:new g("xor_equal",p.token,"^="),shift_right_equal:new g("shift_right_equal",p.token,">>="),shift_left_equal:new g("shift_left_equal",p.token,"<<=")};d.storage_class=[A.keywords.function,A.keywords.private,A.keywords.workgroup,A.keywords.uniform,A.keywords.storage];d.access_mode=[A.keywords.read,A.keywords.write,A.keywords.read_write];d.sampler_type=[A.keywords.sampler,A.keywords.sampler_comparison];d.sampled_texture_type=[A.keywords.texture_1d,A.keywords.texture_2d,A.keywords.texture_2d_array,A.keywords.texture_3d,A.keywords.texture_cube,A.keywords.texture_cube_array];d.multisampled_texture_type=[A.keywords.texture_multisampled_2d];d.storage_texture_type=[A.keywords.texture_storage_1d,A.keywords.texture_storage_2d,A.keywords.texture_storage_2d_array,A.keywords.texture_storage_3d];d.depth_texture_type=[A.keywords.texture_depth_2d,A.keywords.texture_depth_2d_array,A.keywords.texture_depth_cube,A.keywords.texture_depth_cube_array,A.keywords.texture_depth_multisampled_2d];d.texture_external_type=[A.keywords.texture_external];d.any_texture_type=[...A.sampled_texture_type,...A.multisampled_texture_type,...A.storage_texture_type,...A.depth_texture_type,...A.texture_external_type];d.texel_format=[A.keywords.r8unorm,A.keywords.r8snorm,A.keywords.r8uint,A.keywords.r8sint,A.keywords.r16uint,A.keywords.r16sint,A.keywords.r16float,A.keywords.rg8unorm,A.keywords.rg8snorm,A.keywords.rg8uint,A.keywords.rg8sint,A.keywords.r32uint,A.keywords.r32sint,A.keywords.r32float,A.keywords.rg16uint,A.keywords.rg16sint,A.keywords.rg16float,A.keywords.rgba8unorm,A.keywords.rgba8unorm_srgb,A.keywords.rgba8snorm,A.keywords.rgba8uint,A.keywords.rgba8sint,A.keywords.bgra8unorm,A.keywords.bgra8unorm_srgb,A.keywords.rgb10a2unorm,A.keywords.rg11b10float,A.keywords.rg32uint,A.keywords.rg32sint,A.keywords.rg32float,A.keywords.rgba16uint,A.keywords.rgba16sint,A.keywords.rgba16float,A.keywords.rgba32uint,A.keywords.rgba32sint,A.keywords.rgba32float];d.const_literal=[A.tokens.int_literal,A.tokens.uint_literal,A.tokens.decimal_float_literal,A.tokens.hex_float_literal,A.keywords.true,A.keywords.false];d.literal_or_ident=[A.tokens.ident,A.tokens.int_literal,A.tokens.uint_literal,A.tokens.decimal_float_literal,A.tokens.hex_float_literal];d.element_count_expression=[A.tokens.int_literal,A.tokens.uint_literal,A.tokens.ident];d.template_types=[A.keywords.vec2,A.keywords.vec3,A.keywords.vec4,A.keywords.mat2x2,A.keywords.mat2x3,A.keywords.mat2x4,A.keywords.mat3x2,A.keywords.mat3x3,A.keywords.mat3x4,A.keywords.mat4x2,A.keywords.mat4x3,A.keywords.mat4x4,A.keywords.atomic,A.keywords.bitcast,...A.any_texture_type];d.attribute_name=[A.tokens.ident,A.keywords.block];d.assignment_operators=[A.tokens.equal,A.tokens.plus_equal,A.tokens.minus_equal,A.tokens.times_equal,A.tokens.division_equal,A.tokens.modulo_equal,A.tokens.and_equal,A.tokens.or_equal,A.tokens.xor_equal,A.tokens.shift_right_equal,A.tokens.shift_left_equal];d.increment_operators=[A.tokens.plus_plus,A.tokens.minus_minus];var sn=class{constructor(t,r,n){this.type=t,this.lexeme=r,this.line=n}toString(){return this.lexeme}isTemplateType(){return d.template_types.indexOf(this.type)!=-1}isArrayType(){return this.type==d.keywords.array}isArrayOrTemplateType(){return this.isArrayType()||this.isTemplateType()}},eo=class{constructor(t){this._tokens=[],this._start=0,this._current=0,this._line=1,this._source=t??""}scanTokens(){for(;!this._isAtEnd();)if(this._start=this._current,!this.scanToken())throw`Invalid syntax at line ${this._line}`;return this._tokens.push(new sn(d.eof,"",this._line)),this._tokens}scanToken(){let t=this._advance();if(t==`
147
- `)return this._line++,!0;if(this._isWhitespace(t))return!0;if(t=="/"){if(this._peekAhead()=="/"){for(;t!=`
148
- `;){if(this._isAtEnd())return!0;t=this._advance()}return this._line++,!0}else if(this._peekAhead()=="*"){this._advance();let n=1;for(;n>0;){if(this._isAtEnd())return!0;if(t=this._advance(),t==`
149
- `)this._line++;else if(t=="*"){if(this._peekAhead()=="/"&&(this._advance(),n--,n==0))return!0}else t=="/"&&this._peekAhead()=="*"&&(this._advance(),n++)}return!0}}let r=d.none;for(;;){let n=this._findType(t),i=this._peekAhead();if(t==">"&&(i==">"||i=="=")){let o=!1,s=this._tokens.length-1;for(let a=0;a<5&&s>=0;++a,--s)if(this._tokens[s].type===d.tokens.less_than){s>0&&this._tokens[s-1].isArrayOrTemplateType()&&(o=!0);break}if(o)return this._addToken(n),!0}if(n===d.none){let o=t,s=0,a=2;for(let l=0;l<a;++l)if(o+=this._peekAhead(l),n=this._findType(o),n!==d.none){s=l;break}if(n===d.none)return r===d.none?!1:(this._current--,this._addToken(r),!0);t=o,this._current+=s+1}if(r=n,this._isAtEnd())break;t+=this._advance()}return r===d.none?!1:(this._addToken(r),!0)}_findType(t){for(let r in d.keywords){let n=d.keywords[r];if(this._match(t,n.rule))return n}for(let r in d.tokens){let n=d.tokens[r];if(this._match(t,n.rule))return n}return d.none}_match(t,r){if(typeof r=="string"){if(r==t)return!0}else{let n=r.exec(t);if(n&&n.index==0&&n[0]==t)return!0}return!1}_isAtEnd(){return this._current>=this._source.length}_isWhitespace(t){return t==" "||t==" "||t=="\r"}_advance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=this._source[this._current];return t=t||0,t++,this._current+=t,r}_peekAhead(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return t=t||0,this._current+t>=this._source.length?"\0":this._source[this._current+t]}_addToken(t){let r=this._source.substring(this._start,this._current);this._tokens.push(new sn(t,r,this._line))}},to=class{constructor(){this._tokens=[],this._current=0,this._context=new Oi}parse(t){this._initialize(t);let r=[];for(;!this._isAtEnd();){let n=this._global_decl_or_directive();if(!n)break;r.push(n)}return r}_initialize(t){if(t)if(typeof t=="string"){let r=new eo(t);this._tokens=r.scanTokens()}else this._tokens=t;else this._tokens=[];this._current=0}_error(t,r){return console.error(t,r),{token:t,message:r,toString:function(){return`${r}`}}}_isAtEnd(){return this._current>=this._tokens.length||this._peek().type==d.eof}_match(t){if(t instanceof g)return this._check(t)?(this._advance(),!0):!1;for(let r=0,n=t.length;r<n;++r){let i=t[r];if(this._check(i))return this._advance(),!0}return!1}_consume(t,r){if(this._check(t))return this._advance();throw this._error(this._peek(),r)}_check(t){if(this._isAtEnd())return!1;let r=this._peek();if(t instanceof Array){let n=r.type;return t.indexOf(n)!=-1}return r.type==t}_advance(){return this._isAtEnd()||this._current++,this._previous()}_peek(){return this._tokens[this._current]}_previous(){return this._tokens[this._current-1]}_global_decl_or_directive(){for(;this._match(d.tokens.semicolon)&&!this._isAtEnd(););if(this._match(d.keywords.alias)){let r=this._type_alias();return this._consume(d.tokens.semicolon,"Expected ';'"),r}if(this._match(d.keywords.enable)){let r=this._enable_directive();return this._consume(d.tokens.semicolon,"Expected ';'"),r}let t=this._attribute();if(this._check(d.keywords.var)){let r=this._global_variable_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.override)){let r=this._override_variable_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.let)){let r=this._global_let_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.const)){let r=this._global_const_decl();return r!=null&&(r.attributes=t),this._consume(d.tokens.semicolon,"Expected ';'."),r}if(this._check(d.keywords.struct)){let r=this._struct_decl();return r!=null&&(r.attributes=t),r}if(this._check(d.keywords.fn)){let r=this._function_decl();return r!=null&&(r.attributes=t),r}return null}_function_decl(){if(!this._match(d.keywords.fn))return null;let t=this._consume(d.tokens.ident,"Expected function name.").toString();this._consume(d.tokens.paren_left,"Expected '(' for function arguments.");let r=[];if(!this._check(d.tokens.paren_right))do{if(this._check(d.tokens.paren_right))break;let o=this._attribute(),s=this._consume(d.tokens.ident,"Expected argument name.").toString();this._consume(d.tokens.colon,"Expected ':' for argument type.");let a=this._attribute(),l=this._type_decl();l!=null&&(l.attributes=a,r.push(new Qi(s,l,o)))}while(this._match(d.tokens.comma));this._consume(d.tokens.paren_right,"Expected ')' after function arguments.");let n=null;if(this._match(d.tokens.arrow)){let o=this._attribute();n=this._type_decl(),n!=null&&(n.attributes=o)}let i=this._compound_statement();return new jr(t,r,n,i)}_compound_statement(){let t=[];for(this._consume(d.tokens.brace_left,"Expected '{' for block.");!this._check(d.tokens.brace_right);){let r=this._statement();r!==null&&t.push(r)}return this._consume(d.tokens.brace_right,"Expected '}' for block."),t}_statement(){for(;this._match(d.tokens.semicolon)&&!this._isAtEnd(););if(this._check(d.keywords.if))return this._if_statement();if(this._check(d.keywords.switch))return this._switch_statement();if(this._check(d.keywords.loop))return this._loop_statement();if(this._check(d.keywords.for))return this._for_statement();if(this._check(d.keywords.while))return this._while_statement();if(this._check(d.keywords.continuing))return this._continuing_statement();if(this._check(d.keywords.static_assert))return this._static_assert_statement();if(this._check(d.tokens.brace_left))return this._compound_statement();let t=null;return this._check(d.keywords.return)?t=this._return_statement():this._check([d.keywords.var,d.keywords.let,d.keywords.const])?t=this._variable_statement():this._match(d.keywords.discard)?t=new Vi:this._match(d.keywords.break)?t=new Hi:this._match(d.keywords.continue)?t=new Xi:t=this._increment_decrement_statement()||this._func_call_statement()||this._assignment_statement(),t!=null&&this._consume(d.tokens.semicolon,"Expected ';' after statement."),t}_static_assert_statement(){if(!this._match(d.keywords.static_assert))return null;let t=this._optional_paren_expression();return new wi(t)}_while_statement(){if(!this._match(d.keywords.while))return null;let t=this._optional_paren_expression(),r=this._compound_statement();return new Ci(t,r)}_continuing_statement(){if(!this._match(d.keywords.continuing))return null;let t=this._compound_statement();return new Ni(t)}_for_statement(){if(!this._match(d.keywords.for))return null;this._consume(d.tokens.paren_left,"Expected '('.");let t=this._check(d.tokens.semicolon)?null:this._for_init();this._consume(d.tokens.semicolon,"Expected ';'.");let r=this._check(d.tokens.semicolon)?null:this._short_circuit_or_expression();this._consume(d.tokens.semicolon,"Expected ';'.");let n=this._check(d.tokens.paren_right)?null:this._for_increment();this._consume(d.tokens.paren_right,"Expected ')'.");let i=this._compound_statement();return new Pi(t,r,n,i)}_for_init(){return this._variable_statement()||this._func_call_statement()||this._assignment_statement()}_for_increment(){return this._func_call_statement()||this._increment_decrement_statement()||this._assignment_statement()}_variable_statement(){if(this._check(d.keywords.var)){let t=this._variable_decl();if(t===null)throw this._error(this._peek(),"Variable declaration expected.");let r=null;return this._match(d.tokens.equal)&&(r=this._short_circuit_or_expression()),new Xe(t.name,t.type,t.storage,t.access,r)}if(this._match(d.keywords.let)){let t=this._consume(d.tokens.ident,"Expected name for let.").toString(),r=null;if(this._match(d.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}this._consume(d.tokens.equal,"Expected '=' for let.");let n=this._short_circuit_or_expression();return new Kr(t,r,null,null,n)}if(this._match(d.keywords.const)){let t=this._consume(d.tokens.ident,"Expected name for const.").toString(),r=null;if(this._match(d.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}this._consume(d.tokens.equal,"Expected '=' for const.");let n=this._short_circuit_or_expression();return new Yr(t,r,null,null,n)}return null}_increment_decrement_statement(){let t=this._current,r=this._unary_expression();if(r==null)return null;if(!this._check(d.increment_operators))return this._current=t,null;let n=this._consume(d.increment_operators,"Expected increment operator");return new Ii(n.type===d.tokens.plus_plus?Et.increment:Et.decrement,r)}_assignment_statement(){let t=null;if(this._check(d.tokens.brace_right))return null;let r=this._match(d.tokens.underscore);if(r||(t=this._unary_expression()),!r&&t==null)return null;let n=this._consume(d.assignment_operators,"Expected assignment operator."),i=this._short_circuit_or_expression();return new Mi(pr.parse(n.lexeme),t,i)}_func_call_statement(){if(!this._check(d.tokens.ident))return null;let t=this._current,r=this._consume(d.tokens.ident,"Expected function name."),n=this._argument_expression_list();return n===null?(this._current=t,null):new Di(r.lexeme,n)}_loop_statement(){if(!this._match(d.keywords.loop))return null;this._consume(d.tokens.brace_left,"Expected '{' for loop.");let t=[],r=this._statement();for(;r!==null;){if(Array.isArray(r))for(let i of r)t.push(i);else t.push(r);r=this._statement()}let n=null;return this._match(d.keywords.continuing)&&(n=this._compound_statement()),this._consume(d.tokens.brace_right,"Expected '}' for loop."),new Fi(t,n)}_switch_statement(){if(!this._match(d.keywords.switch))return null;let t=this._optional_paren_expression();this._consume(d.tokens.brace_left,"Expected '{' for switch.");let r=this._switch_body();if(r==null||r.length==0)throw this._error(this._previous(),"Expected 'case' or 'default'.");return this._consume(d.tokens.brace_right,"Expected '}' for switch."),new Bi(t,r)}_switch_body(){let t=[];if(this._match(d.keywords.case)){let r=this._case_selectors();this._match(d.tokens.colon),this._consume(d.tokens.brace_left,"Exected '{' for switch case.");let n=this._case_body();this._consume(d.tokens.brace_right,"Exected '}' for switch case."),t.push(new qi(r,n))}if(this._match(d.keywords.default)){this._match(d.tokens.colon),this._consume(d.tokens.brace_left,"Exected '{' for switch default.");let r=this._case_body();this._consume(d.tokens.brace_right,"Exected '}' for switch default."),t.push(new Zi(r))}if(this._check([d.keywords.default,d.keywords.case])){let r=this._switch_body();t.push(r[0])}return t}_case_selectors(){var t,r,n,i;let o=[(r=(t=this._shift_expression())===null||t===void 0?void 0:t.evaluate(this._context).toString())!==null&&r!==void 0?r:""];for(;this._match(d.tokens.comma);)o.push((i=(n=this._shift_expression())===null||n===void 0?void 0:n.evaluate(this._context).toString())!==null&&i!==void 0?i:"");return o}_case_body(){if(this._match(d.keywords.fallthrough))return this._consume(d.tokens.semicolon,"Expected ';'"),[];let t=this._statement();if(t==null)return[];t instanceof Array||(t=[t]);let r=this._case_body();return r.length==0?t:[...t,r[0]]}_if_statement(){if(!this._match(d.keywords.if))return null;let t=this._optional_paren_expression(),r=this._compound_statement(),n=[];this._match_elseif()&&(n=this._elseif_statement(n));let i=null;return this._match(d.keywords.else)&&(i=this._compound_statement()),new Ui(t,r,n,i)}_match_elseif(){return this._tokens[this._current].type===d.keywords.else&&this._tokens[this._current+1].type===d.keywords.if?(this._advance(),this._advance(),!0):!1}_elseif_statement(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=this._optional_paren_expression(),n=this._compound_statement();return t.push(new Ji(r,n)),this._match_elseif()&&this._elseif_statement(t),t}_return_statement(){if(!this._match(d.keywords.return))return null;let t=this._short_circuit_or_expression();return new ki(t)}_short_circuit_or_expression(){let t=this._short_circuit_and_expr();for(;this._match(d.tokens.or_or);)t=new de(this._previous().toString(),t,this._short_circuit_and_expr());return t}_short_circuit_and_expr(){let t=this._inclusive_or_expression();for(;this._match(d.tokens.and_and);)t=new de(this._previous().toString(),t,this._inclusive_or_expression());return t}_inclusive_or_expression(){let t=this._exclusive_or_expression();for(;this._match(d.tokens.or);)t=new de(this._previous().toString(),t,this._exclusive_or_expression());return t}_exclusive_or_expression(){let t=this._and_expression();for(;this._match(d.tokens.xor);)t=new de(this._previous().toString(),t,this._and_expression());return t}_and_expression(){let t=this._equality_expression();for(;this._match(d.tokens.and);)t=new de(this._previous().toString(),t,this._equality_expression());return t}_equality_expression(){let t=this._relational_expression();return this._match([d.tokens.equal_equal,d.tokens.not_equal])?new de(this._previous().toString(),t,this._relational_expression()):t}_relational_expression(){let t=this._shift_expression();for(;this._match([d.tokens.less_than,d.tokens.greater_than,d.tokens.less_than_equal,d.tokens.greater_than_equal]);)t=new de(this._previous().toString(),t,this._shift_expression());return t}_shift_expression(){let t=this._additive_expression();for(;this._match([d.tokens.shift_left,d.tokens.shift_right]);)t=new de(this._previous().toString(),t,this._additive_expression());return t}_additive_expression(){let t=this._multiplicative_expression();for(;this._match([d.tokens.plus,d.tokens.minus]);)t=new de(this._previous().toString(),t,this._multiplicative_expression());return t}_multiplicative_expression(){let t=this._unary_expression();for(;this._match([d.tokens.star,d.tokens.forward_slash,d.tokens.modulo]);)t=new de(this._previous().toString(),t,this._unary_expression());return t}_unary_expression(){return this._match([d.tokens.minus,d.tokens.bang,d.tokens.tilde,d.tokens.star,d.tokens.and])?new Yi(this._previous().toString(),this._unary_expression()):this._singular_expression()}_singular_expression(){let t=this._primary_expression(),r=this._postfix_expression();return r&&(t.postfix=r),t}_postfix_expression(){if(this._match(d.tokens.bracket_left)){let t=this._short_circuit_or_expression();this._consume(d.tokens.bracket_right,"Expected ']'.");let r=this._postfix_expression();return r&&(t.postfix=r),t}if(this._match(d.tokens.period)){let t=this._consume(d.tokens.ident,"Expected member name."),r=this._postfix_expression(),n=new Jr(t.lexeme);return r&&(n.postfix=r),n}return null}_getStruct(t){return this._context.aliases.has(t)?this._context.aliases.get(t).type:this._context.structs.has(t)?this._context.structs.get(t):null}_primary_expression(){if(this._match(d.tokens.ident)){let n=this._previous().toString();if(this._check(d.tokens.paren_left)){let i=this._argument_expression_list(),o=this._getStruct(n);return o!=null?new lt(o,i):new Li(n,i)}if(this._context.constants.has(n)){let i=this._context.constants.get(n);return new Gr(n,i.value)}return new ji(n)}if(this._match(d.const_literal))return new en(parseFloat(this._previous().toString()));if(this._check(d.tokens.paren_left))return this._paren_expression();if(this._match(d.keywords.bitcast)){this._consume(d.tokens.less_than,"Expected '<'.");let n=this._type_decl();this._consume(d.tokens.greater_than,"Expected '>'.");let i=this._paren_expression();return new $i(n,i)}let t=this._type_decl(),r=this._argument_expression_list();return new Ki(t,r)}_argument_expression_list(){if(!this._match(d.tokens.paren_left))return null;let t=[];do{if(this._check(d.tokens.paren_right))break;let r=this._short_circuit_or_expression();t.push(r)}while(this._match(d.tokens.comma));return this._consume(d.tokens.paren_right,"Expected ')' for agument list"),t}_optional_paren_expression(){this._match(d.tokens.paren_left);let t=this._short_circuit_or_expression();return this._match(d.tokens.paren_right),new tn([t])}_paren_expression(){this._consume(d.tokens.paren_left,"Expected '('.");let t=this._short_circuit_or_expression();return this._consume(d.tokens.paren_right,"Expected ')'."),new tn([t])}_struct_decl(){if(!this._match(d.keywords.struct))return null;let t=this._consume(d.tokens.ident,"Expected name for struct.").toString();this._consume(d.tokens.brace_left,"Expected '{' for struct body.");let r=[];for(;!this._check(d.tokens.brace_right);){let i=this._attribute(),o=this._consume(d.tokens.ident,"Expected variable name.").toString();this._consume(d.tokens.colon,"Expected ':' for struct member type.");let s=this._attribute(),a=this._type_decl();a!=null&&(a.attributes=s),this._check(d.tokens.brace_right)?this._match(d.tokens.comma):this._consume(d.tokens.comma,"Expected ',' for struct member."),r.push(new Gi(o,a,i))}this._consume(d.tokens.brace_right,"Expected '}' after struct body.");let n=new Ie(t,r);return this._context.structs.set(t,n),n}_global_variable_decl(){let t=this._variable_decl();return t&&this._match(d.tokens.equal)&&(t.value=this._const_expression()),t}_override_variable_decl(){let t=this._override_decl();return t&&this._match(d.tokens.equal)&&(t.value=this._const_expression()),t}_global_const_decl(){if(!this._match(d.keywords.const))return null;let t=this._consume(d.tokens.ident,"Expected variable name"),r=null;if(this._match(d.tokens.colon)){let o=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=o)}let n=null;if(this._match(d.tokens.equal)){let o=this._short_circuit_or_expression();if(o instanceof lt)n=o;else if(o instanceof Gr&&o.initializer instanceof lt)n=o.initializer;else try{let s=o.evaluate(this._context);n=new en(s)}catch{n=o}}let i=new Yr(t.toString(),r,"","",n);return this._context.constants.set(i.name,i),i}_global_let_decl(){if(!this._match(d.keywords.let))return null;let t=this._consume(d.tokens.ident,"Expected variable name"),r=null;if(this._match(d.tokens.colon)){let i=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=i)}let n=null;return this._match(d.tokens.equal)&&(n=this._const_expression()),new Kr(t.toString(),r,"","",n)}_const_expression(){if(this._match(d.const_literal))return new Jr(this._previous().toString());let t=this._type_decl();this._consume(d.tokens.paren_left,"Expected '('.");let r=[];for(;!this._check(d.tokens.paren_right)&&(r.push(this._const_expression()),!!this._check(d.tokens.comma));)this._advance();return this._consume(d.tokens.paren_right,"Expected ')'."),new lt(t,r)}_variable_decl(){if(!this._match(d.keywords.var))return null;let t="",r="";this._match(d.tokens.less_than)&&(t=this._consume(d.storage_class,"Expected storage_class.").toString(),this._match(d.tokens.comma)&&(r=this._consume(d.access_mode,"Expected access_mode.").toString()),this._consume(d.tokens.greater_than,"Expected '>'."));let n=this._consume(d.tokens.ident,"Expected variable name"),i=null;if(this._match(d.tokens.colon)){let o=this._attribute();i=this._type_decl(),i!=null&&(i.attributes=o)}return new Xe(n.toString(),i,t,r,null)}_override_decl(){if(!this._match(d.keywords.override))return null;let t=this._consume(d.tokens.ident,"Expected variable name"),r=null;if(this._match(d.tokens.colon)){let n=this._attribute();r=this._type_decl(),r!=null&&(r.attributes=n)}return new $r(t.toString(),r,null)}_enable_directive(){let t=this._consume(d.tokens.ident,"identity expected.");return new Wi(t.toString())}_type_alias(){let t=this._consume(d.tokens.ident,"identity expected.");this._consume(d.tokens.equal,"Expected '=' for type alias.");let r=this._type_decl();if(r===null)throw this._error(this._peek(),"Expected Type for Alias.");this._context.aliases.has(r.name)&&(r=this._context.aliases.get(r.name).type);let n=new qr(t.toString(),r);return this._context.aliases.set(n.name,n),n}_type_decl(){if(this._check([d.tokens.ident,...d.texel_format,d.keywords.bool,d.keywords.f32,d.keywords.i32,d.keywords.u32])){let n=this._advance(),i=n.toString();return this._context.structs.has(i)?this._context.structs.get(i):this._context.aliases.has(i)?this._context.aliases.get(i).type:new De(n.toString())}let t=this._texture_sampler_types();if(t)return t;if(this._check(d.template_types)){let n=this._advance().toString(),i=null,o=null;return this._match(d.tokens.less_than)&&(i=this._type_decl(),o=null,this._match(d.tokens.comma)&&(o=this._consume(d.access_mode,"Expected access_mode for pointer").toString()),this._consume(d.tokens.greater_than,"Expected '>' for type.")),new Zr(n,i,o)}if(this._match(d.keywords.ptr)){let n=this._previous().toString();this._consume(d.tokens.less_than,"Expected '<' for pointer.");let i=this._consume(d.storage_class,"Expected storage_class for pointer");this._consume(d.tokens.comma,"Expected ',' for pointer.");let o=this._type_decl(),s=null;return this._match(d.tokens.comma)&&(s=this._consume(d.access_mode,"Expected access_mode for pointer").toString()),this._consume(d.tokens.greater_than,"Expected '>' for pointer."),new zi(n,i.toString(),o,s)}let r=this._attribute();if(this._match(d.keywords.array)){let n=null,i=-1,o=this._previous();if(this._match(d.tokens.less_than)){n=this._type_decl(),this._context.aliases.has(n.name)&&(n=this._context.aliases.get(n.name).type);let s="";this._match(d.tokens.comma)&&(s=this._shift_expression().evaluate(this._context).toString()),this._consume(d.tokens.greater_than,"Expected '>' for array."),i=s?parseInt(s):0}return new Qr(o.toString(),r,n,i)}return null}_texture_sampler_types(){if(this._match(d.sampler_type))return new at(this._previous().toString(),null,null);if(this._match(d.depth_texture_type))return new at(this._previous().toString(),null,null);if(this._match(d.sampled_texture_type)||this._match(d.multisampled_texture_type)){let t=this._previous();this._consume(d.tokens.less_than,"Expected '<' for sampler type.");let r=this._type_decl();return this._consume(d.tokens.greater_than,"Expected '>' for sampler type."),new at(t.toString(),r,null)}if(this._match(d.storage_texture_type)){let t=this._previous();this._consume(d.tokens.less_than,"Expected '<' for sampler type.");let r=this._consume(d.texel_format,"Invalid texel format.").toString();this._consume(d.tokens.comma,"Expected ',' after texel format.");let n=this._consume(d.access_mode,"Expected access mode for storage texture type.").toString();return this._consume(d.tokens.greater_than,"Expected '>' for sampler type."),new at(t.toString(),r,n)}return null}_attribute(){let t=[];for(;this._match(d.tokens.attr);){let r=this._consume(d.attribute_name,"Expected attribute name"),n=new on(r.toString(),null);if(this._match(d.tokens.paren_left)){if(n.value=this._consume(d.literal_or_ident,"Expected attribute value").toString(),this._check(d.tokens.comma)){this._advance();do{let i=this._consume(d.literal_or_ident,"Expected attribute value").toString();n.value instanceof Array||(n.value=[n.value]),n.value.push(i)}while(this._match(d.tokens.comma))}this._consume(d.tokens.paren_right,"Expected ')'")}t.push(n)}for(;this._match(d.tokens.attr_left);){if(!this._check(d.tokens.attr_right))do{let r=this._consume(d.attribute_name,"Expected attribute name"),n=new on(r.toString(),null);if(this._match(d.tokens.paren_left)){if(n.value=[this._consume(d.literal_or_ident,"Expected attribute value").toString()],this._check(d.tokens.comma)){this._advance();do{let i=this._consume(d.literal_or_ident,"Expected attribute value").toString();n.value.push(i)}while(this._match(d.tokens.comma))}this._consume(d.tokens.paren_right,"Expected ')'")}t.push(n)}while(this._match(d.tokens.comma));this._consume(d.tokens.attr_right,"Expected ']]' after attribute declarations")}return t.length==0?null:t}},ze=class{constructor(t,r){this.name=t,this.attributes=r,this.size=0}get isArray(){return!1}get isStruct(){return!1}get isTemplate(){return!1}},an=class{constructor(t,r,n){this.name=t,this.type=r,this.attributes=n,this.offset=0,this.size=0}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},St=class extends ze{constructor(t,r){super(t,r),this.members=[],this.align=0}get isStruct(){return!0}},gr=class extends ze{constructor(t,r){super(t,r),this.count=0,this.stride=0}get isArray(){return!0}},ln=class extends ze{constructor(t,r,n,i){super(t,n),this.format=r,this.access=i}get isTemplate(){return!0}},He;(function(e){e[e.Uniform=0]="Uniform",e[e.Storage=1]="Storage",e[e.Texture=2]="Texture",e[e.Sampler=3]="Sampler",e[e.StorageTexture=4]="StorageTexture"})(He||(He={}));var xt=class{constructor(t,r,n,i,o,s,a){this.name=t,this.type=r,this.group=n,this.binding=i,this.attributes=o,this.resourceType=s,this.access=a}get isArray(){return this.type.isArray}get isStruct(){return this.type.isStruct}get isTemplate(){return this.type.isTemplate}get size(){return this.type.size}get align(){return this.type.isStruct?this.type.align:0}get members(){return this.type.isStruct?this.type.members:null}get format(){return this.type.isArray?this.type.format:this.type.isTemplate?this.type.format:null}get count(){return this.type.isArray?this.type.count:0}get stride(){return this.type.isArray?this.type.stride:this.size}},ro=class{constructor(t,r){this.name=t,this.type=r}},Rt=class{constructor(t,r){this.align=t,this.size=r}},no=class{constructor(t,r,n,i){this.name=t,this.type=r,this.locationType=n,this.location=i,this.interpolation=null}},un=class{constructor(t,r,n,i){this.name=t,this.type=r,this.locationType=n,this.location=i}},io=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;this.stage=null,this.inputs=[],this.outputs=[],this.name=t,this.stage=r}},oo=class{constructor(){this.vertex=[],this.fragment=[],this.compute=[]}},so=class{constructor(t,r,n,i){this.name=t,this.type=r,this.attributes=n,this.id=i}},he=class{constructor(t){this.uniforms=[],this.storage=[],this.textures=[],this.samplers=[],this.aliases=[],this.overrides=[],this.structs=[],this.entry=new oo,this._types=new Map,t&&this.update(t)}_isStorageTexture(t){return t.name=="texture_storage_1d"||t.name=="texture_storage_2d"||t.name=="texture_storage_2d_array"||t.name=="texture_storage_3d"}update(t){let n=new to().parse(t);for(let i of n){if(i instanceof Ie){let o=this._getTypeInfo(i,null);o instanceof St&&this.structs.push(o);continue}if(i instanceof qr){this.aliases.push(this._getAliasInfo(i));continue}if(i instanceof $r){let o=i,s=this._getAttributeNum(o.attributes,"id",0),a=o.type!=null?this._getTypeInfo(o.type,o.attributes):null;this.overrides.push(new so(o.name,a,o.attributes,s));continue}if(this._isUniformVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=new xt(o.name,l,s,a,o.attributes,He.Uniform,o.access);this.uniforms.push(u);continue}if(this._isStorageVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=this._isStorageTexture(l),c=new xt(o.name,l,s,a,o.attributes,u?He.StorageTexture:He.Storage,o.access);this.storage.push(c);continue}if(this._isTextureVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=this._isStorageTexture(l),c=new xt(o.name,l,s,a,o.attributes,u?He.StorageTexture:He.Texture,o.access);u?this.storage.push(c):this.textures.push(c);continue}if(this._isSamplerVar(i)){let o=i,s=this._getAttributeNum(o.attributes,"group",0),a=this._getAttributeNum(o.attributes,"binding",0),l=this._getTypeInfo(o.type,o.attributes),u=new xt(o.name,l,s,a,o.attributes,He.Sampler,o.access);this.samplers.push(u);continue}if(i instanceof jr){let o=this._getAttribute(i,"vertex"),s=this._getAttribute(i,"fragment"),a=this._getAttribute(i,"compute"),l=o||s||a;if(l){let u=new io(i.name,l.name);u.inputs=this._getInputs(i.args),u.outputs=this._getOutputs(i.returnType),this.entry[l.name].push(u)}continue}}}getBindGroups(){let t=[];function r(n,i){n>=t.length&&(t.length=n+1),t[n]===void 0&&(t[n]=[]),i>=t[n].length&&(t[n].length=i+1)}for(let n of this.uniforms){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}for(let n of this.storage){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}for(let n of this.textures){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}for(let n of this.samplers){r(n.group,n.binding);let i=t[n.group];i[n.binding]=n}return t}_getOutputs(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;if(r===void 0&&(r=[]),t instanceof Ie)this._getStructOutputs(t,r);else{let n=this._getOutputInfo(t);n!==null&&r.push(n)}return r}_getStructOutputs(t,r){for(let n of t.members)if(n.type instanceof Ie)this._getStructOutputs(n.type,r);else{let i=this._getAttribute(n,"location")||this._getAttribute(n,"builtin");if(i!==null){let o=this._getTypeInfo(n.type,n.type.attributes),s=this._parseInt(i.value),a=new un(n.name,o,i.name,s);r.push(a)}}}_getOutputInfo(t){let r=this._getAttribute(t,"location")||this._getAttribute(t,"builtin");if(r!==null){let n=this._getTypeInfo(t,t.attributes),i=this._parseInt(r.value);return new un("",n,r.name,i)}return null}_getInputs(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0;r===void 0&&(r=[]);for(let n of t)if(n.type instanceof Ie)this._getStructInputs(n.type,r);else{let i=this._getInputInfo(n);i!==null&&r.push(i)}return r}_getStructInputs(t,r){for(let n of t.members)if(n.type instanceof Ie)this._getStructInputs(n.type,r);else{let i=this._getInputInfo(n);i!==null&&r.push(i)}}_getInputInfo(t){let r=this._getAttribute(t,"location")||this._getAttribute(t,"builtin");if(r!==null){let n=this._getAttribute(t,"interpolation"),i=this._getTypeInfo(t.type,t.attributes),o=this._parseInt(r.value),s=new no(t.name,i,r.name,o);return n!==null&&(s.interpolation=this._parseString(n.value)),s}return null}_parseString(t){return t instanceof Array&&(t=t[0]),t}_parseInt(t){t instanceof Array&&(t=t[0]);let r=parseInt(t);return isNaN(r)?t:r}_getAlias(t){for(let r of this.aliases)if(r.name==t)return r.type;return null}_getAliasInfo(t){return new ro(t.name,this._getTypeInfo(t.type,null))}_getTypeInfo(t,r){if(this._types.has(t))return this._types.get(t);if(t instanceof Qr){let i=t,o=this._getTypeInfo(i.format,i.attributes),s=new gr(i.name,r);return s.format=o,s.count=i.count,this._types.set(t,s),this._updateTypeInfo(s),s}if(t instanceof Ie){let i=t,o=new St(i.name,r);for(let s of i.members){let a=this._getTypeInfo(s.type,s.attributes);o.members.push(new an(s.name,a,s.attributes))}return this._types.set(t,o),this._updateTypeInfo(o),o}if(t instanceof at){let i=t,o=i.format instanceof De,s=i.format?o?this._getTypeInfo(i.format,null):new ze(i.format,null):null,a=new ln(i.name,s,r,i.access);return this._types.set(t,a),this._updateTypeInfo(a),a}if(t instanceof Zr){let i=t,o=i.format?this._getTypeInfo(i.format,null):null,s=new ln(i.name,o,r,i.access);return this._types.set(t,s),this._updateTypeInfo(s),s}let n=new ze(t.name,r);return this._types.set(t,n),this._updateTypeInfo(n),n}_updateTypeInfo(t){var r,n;let i=this._getTypeSize(t);if(t.size=(r=i?.size)!==null&&r!==void 0?r:0,t instanceof gr){let o=this._getTypeSize(t.format);t.stride=(n=o?.size)!==null&&n!==void 0?n:0,this._updateTypeInfo(t.format)}t instanceof St&&this._updateStructInfo(t)}_updateStructInfo(t){var r;let n=0,i=0,o=0,s=0;for(let a=0,l=t.members.length;a<l;++a){let u=t.members[a],c=this._getTypeSize(u);if(!c)continue;(r=this._getAlias(u.type.name))!==null&&r!==void 0||u.type;let f=c.align,h=c.size;n=this._roundUp(f,n+i),i=h,o=n,s=Math.max(s,f),u.offset=n,u.size=h,this._updateTypeInfo(u.type)}t.size=this._roundUp(s,o+i),t.align=s}_getTypeSize(t){var r;if(t==null)return null;let n=this._getAttributeNum(t.attributes,"size",0),i=this._getAttributeNum(t.attributes,"align",0);if(t instanceof an&&(t=t.type),t instanceof ze){let o=this._getAlias(t.name);o!==null&&(t=o)}{let o=he._typeInfo[t.name];if(o!==void 0){let s=t.format==="f16"?2:1;return new Rt(Math.max(i,o.align/s),Math.max(n,o.size/s))}}{let o=he._typeInfo[t.name.substring(0,t.name.length-1)];if(o){let s=t.name[t.name.length-1]==="h"?2:1;return new Rt(Math.max(i,o.align/s),Math.max(n,o.size/s))}}if(t instanceof gr){let o=t,s=8,a=8,l=this._getTypeSize(o.format);l!==null&&(a=l.size,s=l.align);let u=o.count,c=this._getAttributeNum((r=t?.attributes)!==null&&r!==void 0?r:null,"stride",this._roundUp(s,a));return a=u*c,n&&(a=n),new Rt(Math.max(i,s),Math.max(n,a))}if(t instanceof St){let o=0,s=0,a=0,l=0,u=0;for(let c of t.members){let f=this._getTypeSize(c.type);f!==null&&(o=Math.max(f.align,o),a=this._roundUp(f.align,a+l),l=f.size,u=a)}return s=this._roundUp(o,u+l),new Rt(Math.max(i,o),Math.max(n,s))}return null}_isUniformVar(t){return t instanceof Xe&&t.storage=="uniform"}_isStorageVar(t){return t instanceof Xe&&t.storage=="storage"}_isTextureVar(t){return t instanceof Xe&&t.type!==null&&he._textureTypes.indexOf(t.type.name)!=-1}_isSamplerVar(t){return t instanceof Xe&&t.type!==null&&he._samplerTypes.indexOf(t.type.name)!=-1}_getAttribute(t,r){let n=t;if(!n||!n.attributes)return null;let i=n.attributes;for(let o of i)if(o.name==r)return o;return null}_getAttributeNum(t,r,n){if(t===null)return n;for(let i of t)if(i.name==r){let o=i!==null&&i.value!==null?i.value:n;return o instanceof Array&&(o=o[0]),typeof o=="number"?o:typeof o=="string"?parseInt(o):n}return n}_roundUp(t,r){return Math.ceil(r/t)*t}};he._typeInfo={f16:{align:2,size:2},i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},atomic:{align:4,size:4},vec2:{align:8,size:8},vec3:{align:16,size:12},vec4:{align:16,size:16},mat2x2:{align:8,size:16},mat3x2:{align:8,size:24},mat4x2:{align:8,size:32},mat2x3:{align:16,size:32},mat3x3:{align:16,size:48},mat4x3:{align:16,size:64},mat2x4:{align:16,size:32},mat3x4:{align:16,size:48},mat4x4:{align:16,size:64}};he._textureTypes=d.any_texture_type.map(e=>e.name);he._samplerTypes=d.sampler_type.map(e=>e.name);function cn(e){let t={attributes:[],bindings:[]},r=af(e);for(let o of r.uniforms){let s=[];for(let a of o.type.members)s.push({name:a.name,type:Xs(a.type)});t.bindings.push({type:"uniform",name:o.name,location:o.binding,group:o.group,members:s})}let n=r.entry.vertex[0],i=n.inputs.length;for(let o=0;o<i;o++){let s=n.inputs[o];if(s.locationType==="location"){let a=Xs(s.type);t.attributes.push({name:s.name,location:s.location,type:a})}}return t}function Xs(e){return e.format?`${e.name}<${e.format.name}>`:e.name}function af(e){try{return new he(e)}catch(t){if(t instanceof Error)throw t;let r="WGSL parse error";throw typeof t=="object"&&t!==null&&t!==void 0&&t.message&&(r+=`: ${t.message} `),typeof t=="object"&&t!==null&&t!==void 0&&t.token&&(r+=t.token.line||""),new Error(r,{cause:t})}}function ao(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Math.fround(e),i=e-n;return t[r]=n,t[r+1]=i,t}function zs(e){return e-Math.fround(e)}function Ls(e){let t=new Float32Array(32);for(let r=0;r<4;++r)for(let n=0;n<4;++n){let i=r*4+n;ao(e[n*4+r],t,i*2)}return t}var js=K`\
7
+ "use strict";var __exports__=(()=>{var Ai=Object.create;var Pe=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var Ti=Object.getOwnPropertyNames;var ci=Object.getPrototypeOf,gi=Object.prototype.hasOwnProperty;var Le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Si=(e,t)=>{for(var o in t)Pe(e,o,{get:t[o],enumerable:!0})},Be=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ti(t))!gi.call(e,r)&&r!==o&&Pe(e,r,{get:()=>t[r],enumerable:!(i=Ri(t,r))||i.enumerable});return e},V=(e,t,o)=>(Be(e,t,"default"),o&&Be(o,t,"default")),h=(e,t,o)=>(o=e!=null?Ai(ci(e)):{},Be(t||!e||!e.__esModule?Pe(o,"default",{value:e,enumerable:!0}):o,e)),fi=e=>Be(Pe({},"__esModule",{value:!0}),e);var L=Le((Ur,Et)=>{Et.exports=globalThis.deck});var x=Le((vr,pt)=>{pt.exports=globalThis.deck});var q=Le((Wr,Ct)=>{Ct.exports=globalThis.luma});var xe={};Si(xe,{AGGREGATION_OPERATION:()=>F,CPUGridLayer:()=>k,ContourLayer:()=>Oe,GPUGridLayer:()=>Z,GridLayer:()=>he,HeatmapLayer:()=>De,HexagonLayer:()=>Ce,ScreenGridLayer:()=>pe,_AggregationLayer:()=>B,_BinSorter:()=>H,_CPUAggregator:()=>W,_GPUGridAggregator:()=>D});var v={},Nt=h(L(),1);V(v,h(L(),1));if(!Nt.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");V(xe,v);var at=h(x(),1);var M=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e}(M||{});var Ne=h(q(),1);var Mt=e=>`${e}`;function Ge(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=Math.fround(e),r=e-i;return t[o]=i,t[o+1]=r,t}function Ot(e){return e-Math.fround(e)}function It(e){let t=new Float32Array(32);for(let o=0;o<4;++o)for(let i=0;i<4;++i){let r=o*4+i;Ge(e[i*4+o],t,r*2)}return t}var ht=Mt`\
150
8
  uniform float ONE;
151
9
 
152
10
  /*
@@ -312,9 +170,7 @@ vec2 sqrt_fp64(vec2 a) {
312
170
  return sum_fp64(vec2(yn, 0.0), prod);
313
171
  #endif
314
172
  }
315
- `;var lf={ONE:1};function uf(){return lf}var Ot={name:"fp64-arithmetic",vs:js,getUniforms:uf,fp64ify:ao,fp64LowPart:zs,fp64ifyMatrix4:Ls};var lo=M(B(),1);var fn=class{constructor(t){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=hr(Object.values(t));lo.log.log(1,"Creating ShaderInputs with modules",r.map(n=>n.name))(),this.modules=t,this.moduleUniforms={},this.moduleBindings={};for(let[n,i]of Object.entries(t)){let o=n;this.moduleUniforms[o]=i.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(t){for(let n of Object.keys(t)){var r;let i=n,o=t[i],s=this.modules[i];if(!s){lo.log.warn(`Module ${n} not found`)();continue}let a=this.moduleUniforms[i],l=((r=s.getUniforms)===null||r===void 0?void 0:r.call(s,o,this.moduleUniforms[i]))||o;this.moduleUniforms[i]={...a,...l}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let t={};for(let r of Object.values(this.moduleBindings))Object.assign(t,r);return t}getDebugTable(){let t={};for(let[n,i]of Object.entries(this.moduleUniforms))for(let[o,s]of Object.entries(i)){var r;t[`${n}.${o}`]={type:(r=this.modules[n].uniformTypes)===null||r===void 0?void 0:r[o],value:String(s)}}return t}};var Fe=M(B(),1),dn=class{constructor(t){this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=t.id||(0,Fe.uid)("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&(0,Fe.assert)(this.indices.usage===Fe.Buffer.INDEX)}destroy(){var t;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(t=this.attributes.colors)===null||t===void 0||t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(t){return t.byteLength/12}};function $s(e,t){if(t instanceof dn)return t;let r=cf(e,t),{attributes:n,bufferLayout:i}=ff(e,t);return new dn({topology:t.topology||"triangle-list",bufferLayout:i,vertexCount:t.vertexCount,indices:r,attributes:n})}function cf(e,t){if(!t.indices)return;let r=t.indices.value;return e.createBuffer({usage:Fe.Buffer.INDEX,data:r})}function ff(e,t){let r=[],n={};for(let[o,s]of Object.entries(t.attributes)){let a=o;switch(o){case"POSITION":a="positions";break;case"NORMAL":a="normals";break;case"TEXCOORD_0":a="texCoords";break;case"COLOR_0":a="colors";break}n[a]=e.createBuffer({data:s.value,id:`${o}-buffer`});let{value:l,size:u,normalized:c}=s;r.push({name:a,format:(0,Fe.getVertexFormatFromAttribute)(l,u,c)})}let i=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:i}}var Ks=M(B(),1),Le=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new Le(t),t._lumaData.defaultPipelineFactory}constructor(t){this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=t}createRenderPipeline(t){let r={...Le.defaultProps,...t},n=this._hashRenderPipeline({...r});if(!this._pipelineCache[n]){let i=this.device.createRenderPipeline({...r,vs:this.device.createShader({stage:"vertex",source:r.vs}),fs:r.fs?this.device.createShader({stage:"fragment",source:r.fs}):null});i.hash=n,this._pipelineCache[n]=i,this._useCounts[n]=0}return this._useCounts[n]++,this._pipelineCache[n]}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._pipelineCache[r].destroy(),delete this._pipelineCache[r],delete this._useCounts[r])}_createRenderPipeline(t){if(!t.fs)throw new Error("fs");return this.device.createRenderPipeline({...t,vs:this.device.createShader({stage:"vertex",source:t.vs}),fs:t.fs?this.device.createShader({stage:"fragment",source:t.fs}):null})}_hashRenderPipeline(t){let r=this._getHash(t.vs),n=t.fs?this._getHash(t.fs):0,i="-";switch(this.device.info.type){case"webgpu":let o=this._getHash(JSON.stringify(t.parameters)),s=this._getHash(JSON.stringify(t.bufferLayout));return`${r}/${n}V${i}T${t.topology}P${o}BL${s}}`;default:return`${r}/${n}V${i}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}};Le.defaultProps={...Ks.RenderPipeline.defaultProps,vs:void 0,fs:void 0};function Ys(e,t){var r;let n={},i="Values";if(e.attributes.length===0&&!((r=e.varyings)!==null&&r!==void 0&&r.length))return{"No attributes or varyings":{[i]:"N/A"}};for(let o of e.attributes)if(o){let s=`${o.location} ${o.name}: ${o.type}`;n[`in ${s}`]={[i]:o.stepMode||"vertex"}}for(let o of e.varyings||[]){let s=`${o.location} ${o.name}`;n[`out ${s}`]={[i]:JSON.stringify(o.accessor)}}return n}var J=null,uo=null;function qs(e,t){let{id:r,minimap:n,opaque:i,top:o="0",left:s="0",rgbaScale:a=1}=t;J||(J=document.createElement("canvas"),J.id=r,J.title=r,J.style.zIndex="100",J.style.position="absolute",J.style.top=o,J.style.left=s,J.style.border="blue 1px solid",J.style.transform="scaleY(-1)",document.body.appendChild(J),uo=J.getContext("2d")),(J.width!==e.width||J.height!==e.height)&&(J.width=e.width/2,J.height=e.height/2,J.style.width="400px",J.style.height="400px");let l=e.device.readPixelsToArrayWebGL(e),u=uo.createImageData(e.width,e.height),c=0;for(let f=0;f<l.length;f+=4)u.data[c+f+0]=l[f+0]*a,u.data[c+f+1]=l[f+1]*a,u.data[c+f+2]=l[f+2]*a,u.data[c+f+3]=i?255:l[f+3]*a;uo.putImageData(u,0,0)}var wt=2,df=1e4,ee=class{constructor(t,r){var n,i,o;this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.vertexArray=void 0,this.transformFeedback=null,this.pipeline=void 0,this.shaderInputs=void 0,this._uniformStore=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this._lastLogTime=0,this._logOpen=!1,this._drawCount=0,this.props={...ee.defaultProps,...r},r=this.props,this.id=r.id||(0,V.uid)("model"),this.device=t,Object.assign(this.userData,r.userData);let s=Object.fromEntries(((n=this.props.modules)===null||n===void 0?void 0:n.map(y=>[y.name,y]))||[]);this.setShaderInputs(r.shaderInputs||new fn(s));let a=this.device.info.type==="webgpu";if(this.props.source){if(a){var l;(l=this.props).shaderLayout||(l.shaderLayout=cn(this.props.source))}this.props.fs=this.props.source,this.props.vs=this.props.source}if(a&&typeof this.props.vs!="string"){var u;(u=this.props).shaderLayout||(u.shaderLayout=cn(this.props.vs.wgsl))}let c=hf(t),f=(((i=this.props.modules)===null||i===void 0?void 0:i.length)>0?this.props.modules:(o=this.shaderInputs)===null||o===void 0?void 0:o.getModules())||[],{vs:h,fs:_,getUniforms:m}=this.props.shaderAssembler.assembleShaders({platformInfo:c,...this.props,modules:f});if(this.vs=h,this.fs=_,this._getModuleUniforms=m,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&(this._gpuGeometry=this.setGeometry(r.geometry)),this.pipelineFactory=r.pipelineFactory||Le.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&(V.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")(),this.updateModuleSettings(r.moduleSettings)),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this.pipelineFactory.release(this.pipeline),this._uniformStore.destroy()}predraw(){this.updateShaderInputs()}draw(t){this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,transformFeedback:this.transformFeedback})}finally{this._logDrawCallEnd()}this._logFramebuffer(t)}setGeometry(t){let r=t&&$s(this.device,t);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=Zs(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(t){let r={...t.attributes};for(let[n]of Object.entries(r))!this.pipeline.shaderLayout.attributes.find(i=>i.name===n)&&n!=="positions"&&delete r[n];this.vertexCount=t.vertexCount,this.setIndexBuffer(t.indices),this.setAttributes(t.attributes,"ignore-unknown"),this.setAttributes(r)}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){this.bufferLayout=this._gpuGeometry?Zs(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){(0,V.deepEqual)(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(t){this.vertexCount=t}setInstanceCount(t){this.instanceCount=t}setShaderInputs(t){this.shaderInputs=t,this._uniformStore=new je.UniformStore(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let n=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=n}}setShaderModuleProps(t){let r=this._getModuleUniforms(t),n=Object.keys(r).filter(o=>{let s=r[o];return!(0,V.isNumberArray)(s)&&typeof s!="number"&&typeof s!="boolean"}),i={};for(let o of n)i[o]=r[o],delete r[o]}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues())}updateModuleSettings(t){V.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();let{bindings:r,uniforms:n}=(0,V.splitUniformsAndBindings)(this._getModuleUniforms(t));Object.assign(this.bindings,r),Object.assign(this.uniforms,n)}setBindings(t){Object.assign(this.bindings,t)}setUniforms(t){this.pipeline.setUniforms(t),Object.assign(this.uniforms,t)}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t)}setTransformFeedback(t){this.transformFeedback=t}setAttributes(t,r){t.indices&&V.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[n,i]of Object.entries(t)){let o=this.bufferLayout.find(l=>Qs(l).includes(n));if(!o){V.log.warn(`Model(${this.id}): Missing layout for buffer "${n}".`)();continue}let s=Qs(o),a=!1;for(let l of s){let u=this._attributeInfos[l];u&&(this.vertexArray.setBuffer(u.location,i),a=!0)}!a&&r!=="ignore-unknown"&&V.log.warn(`Model(${this.id}): Ignoring buffer "${i.id}" for unknown attribute "${n}"`)()}}setConstantAttributes(t){for(let[r,n]of Object.entries(t)){let i=this._attributeInfos[r];i?this.vertexArray.setConstant(i.location,n):V.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||t}_updatePipeline(){if(this._pipelineNeedsUpdate){this.pipeline&&V.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1;let t=this.device.createShader({id:`${this.id}-vertex`,stage:"vertex",source:this.vs}),r=this.fs?this.device.createShader({id:`${this.id}-fragment`,stage:"fragment",source:this.fs}):null;this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:t,fs:r}),this._attributeInfos=(0,Js.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)}return this.pipeline}_logDrawCallStart(){let t=V.log.level>3?0:df;V.log.level<2||Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,V.log.group(wt,`>>> DRAWING MODEL ${this.id}`,{collapsed:V.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=Ys(this.pipeline.shaderLayout,this.id);V.log.table(wt,t)();let r=this.shaderInputs.getDebugTable();for(let[i,o]of Object.entries(this.uniforms))r[i]={value:o};V.log.table(wt,r)();let n=this._getAttributeDebugTable();V.log.table(wt,this._attributeInfos)(),V.log.table(wt,n)(),V.log.groupEnd(wt)(),this._logOpen=!1}}_logFramebuffer(t){let r=V.log.get("framebuffer");if(this._drawCount++,!r||this._drawCount++>3&&this._drawCount%60)return;let n=t.props.framebuffer;n&&qs(n,{id:n.id,minimap:!0})}_getAttributeDebugTable(){let t={};for(let[r,n]of Object.entries(this._attributeInfos))t[n.location]={name:r,type:n.shaderType,values:this._getBufferOrConstantValues(this.vertexArray.attributes[n.location],n.bufferDataType)};if(this.vertexArray.indexBuffer){let{indexBuffer:r}=this.vertexArray,n=r.indexType==="uint32"?new Uint32Array(r.debugData):new Uint16Array(r.debugData);t.indices={name:"indices",type:r.indexType,values:n.toString()}}return t}_getBufferOrConstantValues(t,r){let n=(0,je.getTypedArrayFromDataType)(r);return(t instanceof je.Buffer?new n(t.debugData):t).toString()}};ee.defaultProps={...je.RenderPipeline.defaultProps,source:null,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:me.getDefaultShaderAssembler()};function Zs(e,t){let r=[...e];for(let n of t){let i=r.findIndex(o=>o.name===n.name);i<0?r.push(n):r[i]=n}return r}function hf(e){return{type:e.info.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}function Qs(e){var t;return e.attributes?(t=e.attributes)===null||t===void 0?void 0:t.map(r=>r.attribute):[e.name]}var _f="transform_output",$e=class{constructor(t,r){this.device=void 0,this.model=void 0,this.sampler=void 0,this.currentIndex=0,this.samplerTextureMap=null,this.bindings=[],this.resources={},this.device=t,this.sampler=t.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new ee(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Ei({version:300,input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:_f}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(t){let{framebuffer:r}=this.bindings[this.currentIndex],n=this.device.beginRenderPass({framebuffer:r,...t});this.model.draw(n),n.end()}update(){console.warn("TextureTransform#update() not implemented")}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(t){this._updateBindings(t)}_updateBindings(t){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t)}_updateBinding(t,r){let{sourceBuffers:n,sourceTextures:i,targetTexture:o}=r;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,i),Object.assign(t.sourceBuffers,n),o){t.targetTexture=o;let{width:s,height:a}=o;t.framebuffer&&t.framebuffer.destroy(),t.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:s,height:a,colorAttachments:[o]}),t.framebuffer.resize({width:s,height:a})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let n in r)r[n].sampler=this.sampler}};var Ct=M(B(),1),ut=class{constructor(t){this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};let{attributes:r={},indices:n=null,vertexCount:i=null}=t;this.id=t.id||(0,Ct.uid)("geometry"),this.topology=t.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[o,s]of Object.entries(r)){let a=ArrayBuffer.isView(s)?{value:s}:s;(0,Ct.assert)(ArrayBuffer.isView(a.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!a.size&&(a.size=3),o==="indices"?((0,Ct.assert)(!this.indices),this.indices=a):this.attributes[o]=a}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,r){return this}_calculateVertexCount(t,r){if(r)return r.value.length;let n=1/0;for(let i of Object.values(t)){let{value:o,size:s,constant:a}=i;!a&&o&&s>=1&&(n=Math.min(n,o.length/s))}return(0,Ct.assert)(Number.isFinite(n)),n}};var Gs=M(B(),1);var mr=class extends ut{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=(0,Gs.uid)("cube-geometry"),indices:n=!0}=t;super(n?{...t,id:r,topology:"triangle-list",indices:{size:1,value:gf},attributes:{...Tf,...t.attributes}}:{...t,id:r,topology:"triangle-list",indices:void 0,attributes:{...Sf,...t.attributes}})}},gf=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),pf=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),mf=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),vf=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),bf=new Float32Array([1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,-1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,1,1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1]),yf=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),Af=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),Tf={POSITION:{size:3,value:pf},NORMAL:{size:3,value:mf},TEXCOORD_0:{size:2,value:vf}},Sf={POSITION:{size:3,value:bf},TEXCOORD_0:{size:2,value:yf},COLOR_0:{size:3,value:Af}};var xf="Failed to create WebGL context in Node.js, headless gl returned null",Rf=" luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server.",Ef={width:1,height:1,debug:!0,throwOnError:!1},co=null;function ea(){return co!==null}function ta(e){e={...Ef,...e};let{width:t,height:r,webgl1:n,webgl2:i}=e;if(i&&!n)throw new Error("headless-gl does not support WebGL2");if(!co)throw new Error(Rf);let o=co(t,r,e);if(!o)throw new Error(xf);return o}var j=M(B(),1);function vr(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function ve(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||vr()}var Tv=globalThis.self||globalThis.window||globalThis.global,Sv=globalThis.window||globalThis.self||globalThis.global,xv=globalThis.document||{},Rv=globalThis.process||{},Ev=globalThis.console,ra=globalThis.navigator||{};var fo=globalThis;function hn(e){if(!e&&!ve())return"Node";if(vr(e))return"Electron";let t=e||ra.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":fo.chrome?"Chrome":fo.safari?"Safari":fo.mozInnerScreenX?"Firefox":"Unknown"}var fa=M(B(),1);var br={};function Of(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function wf(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function Cf(e,t){br[e]=!0,t!==void 0&&Of(t)}function Nf(e){let t=e.getError;e.getError=function(){let n;do n=t.apply(e),n!==0&&(br[n]=!0);while(n!==0);for(n in br)if(br[n])return delete br[n],parseInt(n,10);return 0}}var yr=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let n=0;n<this.attribs.length;n++){let i=new e.VertexAttrib(r);this.attribs[n]=i}this.maxAttrib=0};yr.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};yr.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var ct=function(t){let r=this;this.gl=t,Nf(t);let n=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(o){return o===r.VERTEX_ARRAY_BINDING_OES?r.currentVertexArrayObject===r.defaultVertexArrayObject?null:r.currentVertexArrayObject:n.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(o){let s=r.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,o);let a=s.attribs[o];return a.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(o){let s=r.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,o);let a=s.attribs[o];return a.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(o,s){switch(o){case 34962:r.currentArrayBuffer=s;break;case 34963:r.currentVertexArrayObject.elementArrayBuffer=s;break;default:}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(o,s){let l=r.currentVertexArrayObject.attribs[o];switch(s){case 34975:return l.buffer;case 34338:return l.enabled;case 34339:return l.size;case 34340:return l.stride;case 34341:return l.type;case 34922:return l.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(o,s,a,l,u,c){let f=r.currentVertexArrayObject;f.maxAttrib=Math.max(f.maxAttrib,o);let h=f.attribs[o];return h.buffer=r.currentArrayBuffer,h.size=s,h.type=a,h.normalized=l,h.stride=u,h.offset=c,h.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{wf("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};ct.prototype.VERTEX_ARRAY_BINDING_OES=34229;ct.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let n=0;n<this.vertexArrayObjects.length;++n)this.vertexArrayObjects.isAlive=!1;let r=this.gl;this.maxVertexAttribs=r.getParameter(34921),this.defaultVertexArrayObject=new yr(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};ct.prototype.createVertexArrayOES=function(){let t=new yr(this);return this.vertexArrayObjects.push(t),t};ct.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};ct.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof yr&&t.hasBeenBound&&t.ext===this)};ct.prototype.bindVertexArrayOES=function(t){let r=this.gl;if(t&&!t.isAlive){Cf(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}let n=this.original,i=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;let o=this.currentVertexArrayObject;if(i===o)return;(!i||o.elementArrayBuffer!==i.elementArrayBuffer)&&n.bindBuffer.call(r,34963,o.elementArrayBuffer);let s=this.currentArrayBuffer,a=Math.max(i?i.maxAttrib:0,o.maxAttrib);for(let l=0;l<=a;l++){let u=o.attribs[l],c=i?i.attribs[l]:null;if((!i||u.enabled!==c.enabled)&&(u.enabled?n.enableVertexAttribArray.call(r,l):n.disableVertexAttribArray.call(r,l)),u.enabled){let f=!1;(!i||u.buffer!==c.buffer)&&(s!==u.buffer&&(n.bindBuffer.call(r,34962,u.buffer),s=u.buffer),f=!0),(f||u.cached!==c.cached)&&n.vertexAttribPointer.call(r,l,u.size,u.type,u.normalized,u.stride,u.offset)}}this.currentArrayBuffer!==s&&n.bindBuffer.call(r,34962,this.currentArrayBuffer)};function na(e){if(typeof e.createVertexArray=="function")return;let t=e.getSupportedExtensions;e.getSupportedExtensions=function(){let i=t.call(this)||[];return i.indexOf("OES_vertex_array_object")<0&&i.push("OES_vertex_array_object"),i};let r=e.getExtension;e.getExtension=function(i){let o=r.call(this,i);return o||(i!=="OES_vertex_array_object"?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new ct(this)),this.__OESVertexArrayObject))}}var ft=M(B(),1);var ia=M(B(),1),Pf="Invalid WebGLRenderingContext";function If(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function U(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function ho(e){return U(e)?e:null}function oa(e){return(0,ia.assert)(If(e),Pf),e}var sa="OES_element_index",aa="WEBGL_draw_buffers",Mf="EXT_disjoint_timer_query",Df="EXT_disjoint_timer_query_webgl2",Ff="EXT_texture_filter_anisotropic",la="WEBGL_debug_renderer_info",Bf=35723,Uf=4352,kf=36795,Wf=34047,Vf=37445,Hf=37446,H=e=>U(e)?void 0:0,Xf={[3074]:e=>U(e)?void 0:36064,[Bf]:e=>U(e)?void 0:Uf,[35977]:H,[32937]:H,[kf]:(e,t)=>{let r=U(e)?e.getExtension(Df):e.getExtension(Mf);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[Vf]:(e,t)=>{let r=e.getExtension(la);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[Hf]:(e,t)=>{let r=e.getExtension(la);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[Wf]:(e,t)=>{var r;let n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[Ff])||e.getExtension("EXT_texture_filter_anisotropic");return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},[32883]:H,[35071]:H,[37447]:H,[36063]:(e,t)=>{if(!U(e)){let r=e.getExtension(aa);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},[35379]:H,[35374]:H,[35377]:H,[34852]:e=>{if(!U(e)){let t=e.getExtension(aa);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},[36203]:e=>e.getExtension(sa)?2147483647:65535,[33001]:e=>e.getExtension(sa)?16777216:65535,[33e3]:e=>16777216,[37157]:H,[35373]:H,[35657]:H,[36183]:H,[37137]:H,[34045]:H,[35978]:H,[35979]:H,[35968]:H,[35376]:H,[35375]:H,[35659]:H,[37154]:H,[35371]:H,[35658]:H,[35076]:H,[35077]:H,[35380]:H};function ua(e,t,r){let n=Xf[r],i=typeof n=="function"?n(e,t,r):n;return i!==void 0?i:t(r)}function Nt(e){if(!e.luma){let r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var zf="OES_vertex_array_object",ca="ANGLE_instanced_arrays",Lf="WEBGL_draw_buffers",jf="EXT_disjoint_timer_query",$f="EXT_texture_filter_anisotropic",Kf="VertexArray requires WebGL2 or OES_vertex_array_object extension";function Yf(e,t){return{webgl2:U(e),ext:e.getExtension(t)}}var _o={[zf]:{meta:{suffix:"OES"},createVertexArray:()=>{(0,ft.assert)(!1,Kf)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[ca]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){(0,ft.assert)(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[Lf]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{(0,ft.assert)(!1)}},[jf]:{meta:{suffix:"EXT"},createQuery:()=>{(0,ft.assert)(!1)},deleteQuery:()=>{(0,ft.assert)(!1)},beginQuery:()=>{(0,ft.assert)(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:(e,t)=>{}}},_n={readBuffer:(e,t,r)=>{U(e)&&t(r)},getVertexAttrib:(e,t,r,n)=>{let{webgl2:i,ext:o}=Yf(e,ca),s;switch(n){case 35069:s=i?void 0:!1;break;case 35070:s=!i&&!o?0:void 0;break;default:}return s!==void 0?s:t(r,n)},getProgramParameter:(e,t,r,n)=>{if(!U(e))switch(n){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return t(r,n)},getInternalformatParameter:(e,t,r,n,i)=>{if(!U(e))switch(i){case 32937:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,n,i)},getTexParameter(e,t,r,n){switch(n){case 34046:let i=Nt(e),{_extensions:o}=i,s=o[$f];n=s&&s.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,n)},getParameter:ua,hint(e,t,r,n){return t(r,n)}};function da(e){let t=Nt(e);return t._polyfilled||(na(e),qf(e),Zf(e,_o),Jf(e,{target:t,target2:e}),t._polyfilled=!0),e}function qf(e){let t=Nt(e),r=e.getSupportedExtensions()||[],n=["WEBGL_polygon_mode"];for(let i of r)if(!n.includes(i)){let o=e.getExtension(i);t._extensions[i]=o}}function Zf(e,t){let r=Nt(e);for(let n of Object.getOwnPropertyNames(t))n!=="overrides"&&Qf(e,{extension:n,target:r,target2:e})}function Qf(e,t){let{extension:r,target:n,target2:i}=t,o=_o[r];(0,fa.assert)(o);let{meta:s={}}=o,{suffix:a=""}=s,l=e.getExtension(r);for(let u of Object.keys(o)){let c=`${u}${a}`,f=null;u==="meta"||typeof e[u]=="function"||(l&&typeof l[c]=="function"?f=function(){return l[c](...arguments)}:typeof o[u]=="function"&&(f=o[u].bind(n))),f&&(n[u]=f,i[u]=f)}}function Jf(e,t){let{target:r,target2:n}=t;Object.keys(_n).forEach(i=>{if(typeof _n[i]=="function"){let o=e[i]?e[i].bind(e):()=>{},s=_n[i].bind(null,e,o);r[i]=s,n[i]=s}})}var Tr=M(B(),1);var gn={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},xe=(e,t,r)=>t?e.enable(r):e.disable(r),ha=(e,t,r)=>e.hint(r,t),ue=(e,t,r)=>e.pixelStorei(r,t),_a=(e,t,r)=>{let n;return r===36006?n=U(e)?36009:36160:n=36008,e.bindFramebuffer(n,t)},Ar=(e,t,r)=>{let i={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];e.bindBuffer(i,t)};function go(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var ga={[3042]:xe,[32773]:(e,t)=>e.blendColor(...t),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(e,t)=>e.clearColor(...t),[3107]:(e,t)=>e.colorMask(...t),[2884]:xe,[2885]:(e,t)=>e.cullFace(t),[2929]:xe,[2931]:(e,t)=>e.clearDepth(t),[2932]:(e,t)=>e.depthFunc(t),[2928]:(e,t)=>e.depthRange(...t),[2930]:(e,t)=>e.depthMask(t),[3024]:xe,[35723]:ha,[35725]:(e,t)=>e.useProgram(t),[36007]:(e,t)=>e.bindRenderbuffer(36161,t),[36389]:(e,t)=>{var r,n;return(r=(n=e).bindTransformFeedback)===null||r===void 0?void 0:r.call(n,36386,t)},[34229]:(e,t)=>e.bindVertexArray(t),[36006]:_a,[36010]:_a,[34964]:Ar,[36662]:Ar,[36663]:Ar,[35053]:Ar,[35055]:Ar,[2886]:(e,t)=>e.frontFace(t),[33170]:ha,[2849]:(e,t)=>e.lineWidth(t),[32823]:xe,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:xe,[32926]:xe,[32928]:xe,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:xe,[3088]:(e,t)=>e.scissor(...t),[2960]:xe,[2961]:(e,t)=>e.clearStencil(t),[2968]:(e,t)=>e.stencilMaskSeparate(1028,t),[36005]:(e,t)=>e.stencilMaskSeparate(1029,t),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(e,t)=>e.viewport(...t),[3333]:ue,[3317]:ue,[37440]:ue,[37441]:ue,[37443]:ue,[3330]:ue,[3332]:ue,[3331]:ue,[3314]:ue,[32878]:ue,[3316]:ue,[3315]:ue,[32877]:ue,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let r=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...r)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=go(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=go(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,s,a]=t;e.stencilFuncSeparate(1028,r,n,i),e.stencilFuncSeparate(1029,o,s,a)},stencilOp:(e,t)=>{t=go(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,s,a]=t;e.stencilOpSeparate(1028,r,n,i),e.stencilOpSeparate(1029,o,s,a)},viewport:(e,t)=>e.viewport(...t)};function $(e,t,r){return t[e]!==void 0?t[e]:r[e]}var pa={blendEquation:(e,t,r)=>e.blendEquationSeparate($(32777,t,r),$(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate($(32969,t,r),$(32968,t,r),$(32971,t,r),$(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset($(32824,t,r),$(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage($(32938,t,r),$(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,$(2962,t,r),$(2967,t,r),$(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,$(34816,t,r),$(36003,t,r),$(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,$(2964,t,r),$(2965,t,r),$(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,$(34817,t,r),$(34818,t,r),$(34819,t,r))},po={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({[35725]:t}),bindRenderbuffer:(e,t,r)=>e({[36007]:r}),bindTransformFeedback:(e,t,r)=>e({[36389]:r}),bindVertexArray:(e,t)=>e({[34229]:t}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({[36006]:r,[36010]:r});case 36009:return e({[36006]:r});case 36008:return e({[36010]:r});default:return null}},bindBuffer:(e,t,r)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[t];return n?e({[n]:r}):{valueChanged:!0}},blendColor:(e,t,r,n,i)=>e({[32773]:new Float32Array([t,r,n,i])}),blendEquation:(e,t)=>e({[32777]:t,[34877]:t}),blendEquationSeparate:(e,t,r)=>e({[32777]:t,[34877]:r}),blendFunc:(e,t,r)=>e({[32969]:t,[32968]:r,[32971]:t,[32970]:r}),blendFuncSeparate:(e,t,r,n,i)=>e({[32969]:t,[32968]:r,[32971]:n,[32970]:i}),clearColor:(e,t,r,n,i)=>e({[3106]:new Float32Array([t,r,n,i])}),clearDepth:(e,t)=>e({[2931]:t}),clearStencil:(e,t)=>e({[2961]:t}),colorMask:(e,t,r,n,i)=>e({[3107]:[t,r,n,i]}),cullFace:(e,t)=>e({[2885]:t}),depthFunc:(e,t)=>e({[2932]:t}),depthRange:(e,t,r)=>e({[2928]:new Float32Array([t,r])}),depthMask:(e,t)=>e({[2930]:t}),frontFace:(e,t)=>e({[2886]:t}),lineWidth:(e,t)=>e({[2849]:t}),polygonOffset:(e,t,r)=>e({[32824]:t,[10752]:r}),sampleCoverage:(e,t,r)=>e({[32938]:t,[32939]:r}),scissor:(e,t,r,n,i)=>e({[3088]:new Int32Array([t,r,n,i])}),stencilMask:(e,t)=>e({[2968]:t,[36005]:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,n)=>e({[2962]:t,[2967]:r,[2963]:n,[34816]:t,[36003]:r,[36004]:n}),stencilFuncSeparate:(e,t,r,n,i)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:n,[t===1028?2963:36004]:i}),stencilOp:(e,t,r,n)=>e({[2964]:t,[2965]:r,[2966]:n,[34817]:t,[34818]:r,[34819]:n}),stencilOpSeparate:(e,t,r,n,i)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:n,[t===1028?2966:34819]:i}),viewport:(e,t,r,n,i)=>e({[2978]:[t,r,n,i]})},Re=(e,t)=>e.isEnabled(t),mo={[3042]:Re,[2884]:Re,[2929]:Re,[3024]:Re,[32823]:Re,[32926]:Re,[32928]:Re,[3089]:Re,[2960]:Re,[35977]:Re},ma=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function Be(e,t){let n=Z.attach(e).gl;if(Gf(t))return;let i={};for(let s in t){let a=Number(s),l=ga[s];l&&(typeof l=="string"?i[l]=!0:l(n,t[s],a))}let o=n.state&&n.state.cache;if(o)for(let s in i){let a=pa[s];a(n,t,o)}}function va(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:gn,n=Z.attach(e).gl;if(typeof t=="number"){let s=t,a=mo[s];return a?a(n,s):n.getParameter(s)}let i=Array.isArray(t)?t:Object.keys(t),o={};for(let s of i){let a=mo[s];o[s]=a?a(n,Number(s)):n.getParameter(Number(s))}return o}function Gf(e){for(let t in e)return!1;return!0}function ba(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}var vo=class{constructor(t){let{copyState:r=!1,log:n=()=>{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=void 0,this.program=null,this.stateStack=[],this.enable=!0,this.cache=void 0,this.log=void 0,this.gl=t,this.cache=r?va(t):Object.assign({},gn),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){(0,Tr.assert)(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];Be(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,n,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in t){(0,Tr.assert)(o!==void 0);let s=t[o],a=this.cache[o];ba(s,a)||(r=!0,n=a,i&&!(o in i)&&(i[o]=a),this.cache[o]=s)}return{valueChanged:r,oldValue:n}}};function dt(e){return e.state}function bo(e,t){let{enable:r=!0,copyState:n}=t;if((0,Tr.assert)(n!==void 0),!e.state){e.state=new vo(e,{copyState:n}),td(e);for(let o in po){let s=po[o];ed(e,o,s)}ya(e,"getParameter"),ya(e,"isEnabled")}let i=dt(e);return i.enable=r,e}function Ke(e){let t=dt(e);t||(bo(e,{copyState:!1}),t=dt(e)),t.push()}function Ue(e){let t=dt(e);(0,Tr.assert)(t),t.pop()}function ya(e,t){let r=e[t].bind(e);e[t]=function(i){if(i===void 0||ma.has(i))return r(i);let o=dt(e);return i in o.cache||(o.cache[i]=r(i)),o.enable?o.cache[i]:r(i)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function ed(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(){let o=dt(e);for(var s=arguments.length,a=new Array(s),l=0;l<s;l++)a[l]=arguments[l];let{valueChanged:u,oldValue:c}=r(o._updateCache,...a);return u&&n(...a),c},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function td(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let i=dt(e);i.program!==n&&(t(n),i.program=n)}}var rd={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function Aa(e,t){t={...rd,...t};let r=null,n=o=>r=o.statusMessage||r;e.addEventListener("webglcontextcreationerror",n,!1);let i=null;if(t.type==="webgl2"&&(t={...t,webgl1:!1}),t.type==="webgl1"&&(t={...t,webgl2:!1}),!i&&t.webgl2&&(i=e.getContext("webgl2",t)),!i&&t.webgl1&&(i=e.getContext("webgl",t)),e.removeEventListener("webglcontextcreationerror",n,!1),!i)throw new Error(`Failed to create ${t.webgl2&&!t.webgl1?"WebGL2":"WebGL"} context: ${r||"Unknown error"}`);if(t.onContextLost){let{onContextLost:o}=t;e.addEventListener("webglcontextlost",s=>o(s),!1)}if(t.onContextRestored){let{onContextRestored:o}=t;e.addEventListener("webglcontextrestored",s=>o(s),!1)}return i}function Ta(e){let t=e.getParameter(7936),r=e.getParameter(7937),n=e.getExtension("WEBGL_debug_renderer_info"),i=e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),o=e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),s=i||t,a=o||r,l=e.getParameter(7938),u=Sa(s,a),c=nd(s,a),f=id(s,a),h="glsl",_=U(e)?300:100;return{type:U(e)?"webgl2":"webgl",gpu:u,gpuType:f,gpuBackend:c,vendor:s,renderer:a,version:l,shadingLanguage:h,shadingLanguageVersion:_}}function Sa(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function nd(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function id(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Sa(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function xa(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<"u"?window.navigator||{}:{},r=e.userAgent||t.userAgent||"",n=r.indexOf("MSIE ")!==-1,i=r.indexOf("Trident/")!==-1;return n||i}var To=M(B(),1);function pn(e){switch(e){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(e))}var ne="texture-compression-bc",k="texture-compression-astc",Ee="texture-compression-etc2",od="texture-compression-etc1-webgl",mn="texture-compression-pvrtc-webgl",yo="texture-compression-atc-webgl",Sr="WEBGL_compressed_texture_s3tc",xr="WEBGL_compressed_texture_s3tc_srgb",Pt="EXT_texture_compression_rgtc",Rr="EXT_texture_compression_bptc",sd="WEBGL_compressed_texture_etc",ad="WEBGL_compressed_texture_astc",ld="WEBGL_compressed_texture_etc1",ud="WEBGL_compressed_texture_pvrtc",cd="WEBGL_compressed_texture_atc",Ra="EXT_sRGB",ke="EXT_texture_norm16",fd="WEBGL_color_buffer_float",dd="EXT_color_buffer_float",be=(e,t)=>e.getExtension(t),ht=(e,t)=>t.every(r=>e.getExtension(r)),Ao={"texture-blend-float-webgl1":e=>U(e)?!0:be(e,"EXT_float_blend"),"texture-formats-srgb-webgl1":e=>U(e)?!0:be(e,Ra),"texture-formats-depth-webgl1":e=>U(e)?!0:be(e,"WEBGL_depth_texture"),"texture-formats-float32-webgl1":e=>U(e)?!0:be(e,"OES_texture_float"),"texture-formats-float16-webgl1":e=>U(e)?!0:be(e,"OES_texture_half_float"),"texture-formats-norm16-webgl":e=>U(e)?be(e,ke):!1,"texture-filter-linear-float32-webgl":e=>be(e,"OES_texture_float_linear"),"texture-filter-linear-float16-webgl":e=>be(e,"OES_texture_half_float_linear"),"texture-filter-anisotropic-webgl":e=>be(e,"EXT_texture_filter_anisotropic"),"texture-renderable-float32-webgl":e=>be(e,"EXT_color_buffer_float"),"texture-renderable-float16-webgl":e=>be(e,"EXT_color_buffer_half_float"),"texture-compression-bc":e=>ht(e,[Sr,xr,Pt,Rr]),"texture-compression-bc5-webgl":e=>ht(e,[Pt]),"texture-compression-etc2":e=>ht(e,[sd]),"texture-compression-astc":e=>ht(e,[ad]),"texture-compression-etc1-webgl":e=>ht(e,[ld]),"texture-compression-pvrtc-webgl":e=>ht(e,[ud]),"texture-compression-atc-webgl":e=>ht(e,[cd])};function hd(e,t){var r;return((r=Ao[t])===null||r===void 0?void 0:r.call(Ao,e))||!1}function Ea(e){return Object.keys(Ao).filter(r=>hd(e,r))}var Er={"rgb8unorm-unsized":{gl:6407,gl1:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,gl1:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,renderbuffer:!0},r8snorm:{gl:36756,b:1,c:1},r8uint:{gl:33330,b:1,c:1,renderbuffer:!0},r8sint:{gl:33329,b:1,c:1,renderbuffer:!0},rg8unorm:{gl:33323,b:2,c:2,renderbuffer:!0},rg8snorm:{gl:36757,b:2,c:2},rg8uint:{gl:33336,b:2,c:2,renderbuffer:!0},rg8sint:{gl:33335,b:2,c:2,renderbuffer:!0},r16uint:{gl:33332,b:2,c:1,renderbuffer:!0},r16sint:{gl:33331,b:2,c:1,renderbuffer:!0},r16float:{gl:33325,b:2,c:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:ke},"r16snorm-webgl":{gl:36760,b:2,c:1,f:"texture-formats-norm16-webgl",x:ke},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,gl1:6408,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,gl1:35906,b:4,c:4,gl1ext:Ra,bpp:4},rgba8snorm:{gl:36759,b:4,c:4},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,f:"texture-formats-norm16-webgl",x:ke},"rg16snorm-webgl":{gl:36761,b:2,c:2,f:"texture-formats-norm16-webgl",x:ke},r32uint:{gl:33334,b:4,c:1,bpp:4,renderbuffer:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,renderbuffer:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl"},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:"texture-renderable-float32-webgl",renderbuffer:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,renderbuffer:!0},"rgb10a2unorm-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,renderbuffer:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:"texture-formats-norm16-webgl",x:ke},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:"texture-formats-norm16-webgl",x:ke},rg32uint:{gl:33340,b:8,c:2,renderbuffer:!0},rg32sint:{gl:33339,b:8,c:2,renderbuffer:!0},rg32float:{gl:33328,b:8,c:2,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},rgba16uint:{gl:36214,b:8,c:4,renderbuffer:!0},rgba16sint:{gl:36232,b:8,c:4,renderbuffer:!0},rgba16float:{gl:34842,gl1:6408,b:8,c:4,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},"rgba16unorm-webgl":{gl:32859,b:2,c:4,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:ke},"rgba16snorm-webgl":{gl:36763,b:2,c:4,f:"texture-formats-norm16-webgl",x:ke},"rgb32float-webgl":{gl:34837,gl1:6407,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",gl2ext:dd,gl1ext:fd,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,renderbuffer:!0},rgba32sint:{gl:36226,b:16,c:4,renderbuffer:!0},rgba32float:{gl:34836,b:16,c:4,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},stencil8:{gl:36168,gl1:36168,b:1,c:1,attachment:36128,renderbuffer:!0},depth16unorm:{gl:33189,gl1:33189,b:2,c:1,attachment:36096,renderbuffer:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096},depth32float:{gl:36012,b:4,c:1,attachment:36096,renderbuffer:!0},"depth24plus-stencil8":{gl:34041,gl1:34041,b:4,c:2,p:1,attachment:33306,renderbuffer:!0,depthTexture:!0},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,renderbuffer:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,renderbuffer:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Sr,f:ne},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:xr,f:ne},"bc1-rgba-unorm":{gl:33777,x:Sr,f:ne},"bc1-rgba-unorm-srgb":{gl:35916,x:xr,f:ne},"bc2-rgba-unorm":{gl:33778,x:Sr,f:ne},"bc2-rgba-unorm-srgb":{gl:35918,x:xr,f:ne},"bc3-rgba-unorm":{gl:33779,x:Sr,f:ne},"bc3-rgba-unorm-srgb":{gl:35919,x:xr,f:ne},"bc4-r-unorm":{gl:36283,x:Pt,f:ne},"bc4-r-snorm":{gl:36284,x:Pt,f:ne},"bc5-rg-unorm":{gl:36285,x:Pt,f:ne},"bc5-rg-snorm":{gl:36286,x:Pt,f:ne},"bc6h-rgb-ufloat":{gl:36495,x:Rr,f:ne},"bc6h-rgb-float":{gl:36494,x:Rr,f:ne},"bc7-rgba-unorm":{gl:36492,x:Rr,f:ne},"bc7-rgba-unorm-srgb":{gl:36493,x:Rr,f:ne},"etc2-rgb8unorm":{gl:37492,f:Ee},"etc2-rgb8unorm-srgb":{gl:37494,f:Ee},"etc2-rgb8a1unorm":{gl:37496,f:Ee},"etc2-rgb8a1unorm-srgb":{gl:37497,f:Ee},"etc2-rgba8unorm":{gl:37493,f:Ee},"etc2-rgba8unorm-srgb":{gl:37495,f:Ee},"eac-r11unorm":{gl:37488,f:Ee},"eac-r11snorm":{gl:37489,f:Ee},"eac-rg11unorm":{gl:37490,f:Ee},"eac-rg11snorm":{gl:37491,f:Ee},"astc-4x4-unorm":{gl:37808,f:k},"astc-4x4-unorm-srgb":{gl:37840,f:k},"astc-5x4-unorm":{gl:37809,f:k},"astc-5x4-unorm-srgb":{gl:37841,f:k},"astc-5x5-unorm":{gl:37810,f:k},"astc-5x5-unorm-srgb":{gl:37842,f:k},"astc-6x5-unorm":{gl:37811,f:k},"astc-6x5-unorm-srgb":{gl:37843,f:k},"astc-6x6-unorm":{gl:37812,f:k},"astc-6x6-unorm-srgb":{gl:37844,f:k},"astc-8x5-unorm":{gl:37813,f:k},"astc-8x5-unorm-srgb":{gl:37845,f:k},"astc-8x6-unorm":{gl:37814,f:k},"astc-8x6-unorm-srgb":{gl:37846,f:k},"astc-8x8-unorm":{gl:37815,f:k},"astc-8x8-unorm-srgb":{gl:37847,f:k},"astc-10x5-unorm":{gl:37819,f:k},"astc-10x5-unorm-srgb":{gl:37851,f:k},"astc-10x6-unorm":{gl:37817,f:k},"astc-10x6-unorm-srgb":{gl:37849,f:k},"astc-10x8-unorm":{gl:37818,f:k},"astc-10x8-unorm-srgb":{gl:37850,f:k},"astc-10x10-unorm":{gl:37819,f:k},"astc-10x10-unorm-srgb":{gl:37851,f:k},"astc-12x10-unorm":{gl:37820,f:k},"astc-12x10-unorm-srgb":{gl:37852,f:k},"astc-12x12-unorm":{gl:37821,f:k},"astc-12x12-unorm-srgb":{gl:37853,f:k},"pvrtc-rgb4unorm-webgl":{gl:35840,f:mn},"pvrtc-rgba4unorm-webgl":{gl:35842,f:mn},"pvrtc-rbg2unorm-webgl":{gl:35841,f:mn},"pvrtc-rgba2unorm-webgl":{gl:35843,f:mn},"etc1-rbg-unorm-webgl":{gl:36196,f:od},"atc-rgb-unorm-webgl":{gl:35986,f:yo},"atc-rgba-unorm-webgl":{gl:35986,f:yo},"atc-rgbai-unorm-webgl":{gl:34798,f:yo}},_d={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},gd={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function Or(e,t){let r=wr(t),n=Er[r];if(!n||(U(e)?n.gl===void 0:n.gl1===void 0))return!1;let i=n.x||U(e)&&n.gl2ext||n.gl1ext;return i?Boolean(e.getExtension(i)):!0}function Oa(e,t){var r;return Or(e,t)&&((r=Er[t])===null||r===void 0?void 0:r.renderbuffer)}function wr(e){if(typeof e=="string")return e;let t=Object.entries(Er).find(r=>{let[,n]=r;return n.gl===e||n.gl1===e});if(!t)throw new Error(`Unknown texture format ${e}`);return t[0]}function Cr(e,t){let r=Er[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error(`Unsupported texture format ${e}`);return n}function wa(e,t){let r=wr(t);if(!Or(e,r))return!1;try{if((0,To.decodeTextureFormat)(r).signed)return!1}catch{return!1}return r.endsWith("32float")?Boolean(e.getExtension("OES_texture_float_linear")):r.endsWith("16float")?Boolean(e.getExtension("OES_texture_half_float_linear")):!0}function Ca(e,t){let r=wr(t);return!(!Or(e,r)||typeof r=="number")}function It(e,t){let r=wr(e),n=Cr(r,t),i=(0,To.decodeTextureFormat)(r);return{format:n,dataFormat:pd(i.format,i.integer,i.normalized,n),type:i.dataType?pn(i.dataType):5121,compressed:i.compressed}}function Na(e){let t=Er[e];if(!(t!=null&&t.attachment))throw new Error(`${e} is not a depth stencil format`);return t.attachment}function Pa(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6408,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6408,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5121,i=null,o=null;try{i=e.createTexture(),e.bindTexture(3553,i);let s=0,a=1,l=1,u=0,c=new Uint8Array([0,0,255,255]);e.texImage2D(3553,s,t,a,l,u,r,n,c),o=e.createFramebuffer(),e.bindFramebuffer(36160,o),e.framebufferTexture2D(36160,36064,3553,i,0);let f=e.checkFramebufferStatus(36160)===36053;return e.bindTexture(3553,null),f}finally{e.deleteTexture(i),e.deleteFramebuffer(o)}}function Nr(e,t){let r=wr(e),n=It(r,t),i=_d[n.dataFormat]||4,o=gd[n.type]||1;return i*o}function pd(e,t,r,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;default:return 6408}}function Ia(e){let t=md(e);for(let r of Ea(e))t.add(r);return t}function md(e){e.getExtension("EXT_color_buffer_float"),e.getExtension("WEBGL_color_buffer_float"),e.getExtension("EXT_float_blend");let t=new Set;for(let r of Object.keys(Ma))vd(e,r)&&t.add(r);return t}function vd(e,t){let r=Ma[t];if(!r)return!1;let[n,i]=r||[],o=U(e)?i:n;if(typeof o=="boolean")return o;switch(t){case"texture-renderable-rgba32float-webgl":return U(e)?Boolean(e.getExtension(o)):Pa(e);case"glsl-derivatives":return xo(e,o);case"glsl-frag-data":return xo(e,o,{behavior:"require"});case"glsl-frag-depth":return xo(e,o);default:return Boolean(e.getExtension(o))}}var So={};function xo(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!xa(r))return!0;if(t in So)return So[t];let n=r.behavior||"enable",i=`#extension GL_${t} : ${n}
316
- void main(void) {}`,o=e.createShader(35633);if(!o)throw new Error("shader");e.shaderSource(o,i),e.compileShader(o);let s=e.getShaderParameter(o,35713);return e.deleteShader(o),So[t]=s,s}var Ma={webgl:[!0,!0],webgl2:[!1,!0],"timer-query-webgl":["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],"transform-feedback-webgl2":[!1,!0],"vertex-array-object-webgl1":["OES_vertex_array_object",!0],"instanced-rendering-webgl1":["ANGLE_instanced_arrays",!0],"multiple-render-targets-webgl1":["WEBGL_draw_buffers",!0],"index-uint32-webgl1":["OES_element_index_uint",!0],"blend-minmax-webgl1":["EXT_blend_minmax",!0],"texture-blend-float-webgl1":["EXT_float_blend","EXT_float_blend"],"texture-formats-srgb-webgl1":["EXT_sRGB",!0],"texture-formats-depth-webgl1":["WEBGL_depth_texture",!0],"texture-formats-float32-webgl1":["OES_texture_float",!0],"texture-formats-float16-webgl1":["OES_texture_half_float",!0],"texture-filter-linear-float32-webgl":["OES_texture_float_linear","OES_texture_float_linear"],"texture-filter-linear-float16-webgl":["OES_texture_half_float_linear","OES_texture_half_float_linear"],"texture-filter-anisotropic-webgl":["EXT_texture_filter_anisotropic","EXT_texture_filter_anisotropic"],"texture-renderable-rgba32float-webgl":["WEBGL_color_buffer_float","EXT_color_buffer_float"],"texture-renderable-float32-webgl":[!1,"EXT_color_buffer_float"],"texture-renderable-float16-webgl":["EXT_color_buffer_half_float","EXT_color_buffer_half_float"],"glsl-frag-data":["WEBGL_draw_buffers",!0],"glsl-frag-depth":["EXT_frag_depth",!0],"glsl-derivatives":["OES_standard_derivatives",!0],"glsl-texture-lod":["EXT_shader_texture_lod",!0]};function Da(e){let t=ho(e);return{maxTextureDimension1D:0,maxTextureDimension2D:e.getParameter(3379),maxTextureDimension3D:t?t.getParameter(32883):0,maxTextureArrayLayers:t?t.getParameter(35071):0,maxBindGroups:1,maxDynamicUniformBuffersPerPipelineLayout:0,maxDynamicStorageBuffersPerPipelineLayout:0,maxSampledTexturesPerShaderStage:e.getParameter(35660),maxSamplersPerShaderStage:e.getParameter(35661),maxStorageBuffersPerShaderStage:0,maxStorageTexturesPerShaderStage:0,maxUniformBuffersPerShaderStage:t?t.getParameter(35375):0,maxUniformBufferBindingSize:t?t.getParameter(35376):0,maxStorageBufferBindingSize:0,minUniformBufferOffsetAlignment:t?t.getParameter(35380):0,minStorageBufferOffsetAlignment:0,maxVertexBuffers:0,maxVertexAttributes:e.getParameter(34921),maxVertexBufferArrayStride:2048,maxInterStageShaderComponents:t?t.getParameter(35659):0,maxComputeWorkgroupStorageSize:0,maxComputeInvocationsPerWorkgroup:0,maxComputeWorkgroupSizeX:0,maxComputeWorkgroupSizeY:0,maxComputeWorkgroupSizeZ:0,maxComputeWorkgroupsPerDimension:0}}function Fa(e){let t=ho(e);function r(i){return e.getParameter(i)}function n(i,o){return t?t.getParameter(i):o||0}return{[33902]:r(33902),[33901]:r(33901),[3379]:r(3379),[34076]:r(34076),[34930]:r(34930),[35661]:r(35661),[35660]:r(35660),[34024]:r(34024),[36348]:r(36348),[34921]:r(34921),[36347]:r(36347),[36349]:r(36349),[3386]:r(3386),[34047]:r(34047),[32883]:n(32883),[35071]:n(35071),[37447]:n(37447),[36063]:n(36063),[35379]:n(35379),[35374]:n(35374),[35377]:n(35377),[34852]:n(34852),[36203]:n(36203),[33001]:n(33001),[33e3]:n(33e3),[37157]:n(37157),[35373]:n(35373),[35657]:n(35657),[36183]:n(36183),[37137]:n(37137),[34045]:n(34045),[35978]:n(35978),[35979]:n(35979),[35968]:n(35968),[35376]:n(35376),[35375]:n(35375),[35659]:n(35659),[37154]:n(37154),[35371]:n(35371),[35658]:n(35658),[35076]:n(35076),[35077]:n(35077),[35380]:n(35380)}}var La=M(B(),1);var Rn=M(B(),1);var Y=M(B(),1);function ae(e,t,r){let i=Z.attach(e).gl;if(bd(t))return r(e);let{nocatch:o=!0}=t;Ke(i),Be(i,t);let s;if(o)s=r(i),Ue(i);else try{s=r(i)}finally{Ue(i)}return s}function bd(e){for(let t in e)return!1;return!0}var yn=M(B(),1);function Ua(e,t,r,n){if((0,yn.isObjectEmpty)(t))return n(e);Ke(e.gl);try{return yd(e,t),Be(e,r),n(e)}finally{Ue(e.gl)}}function yd(e,t){let r=Z.attach(e),{gl:n}=r;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(Pr("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(Td("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(bn("depthCompare",t.depthCompare))),t.stencilWriteMask){let i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&yn.log.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let i=t.stencilReadMask||4294967295,o=bn("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let i=Ro("stencilPassOperation",t.stencilPassOperation),o=Ro("stencilFailOperation",t.stencilFailOperation),s=Ro("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,s,i),n.stencilOpSeparate(1029,o,s,i)}if(t.blendColorOperation||t.blendAlphaOperation){n.enable(3042);let i=Ba("blendColorOperation",t.blendColorOperation||"add"),o=Ba("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let s=vn("blendColorSrcFactor",t.blendColorSrcFactor||"one"),a=vn("blendColorDstFactor",t.blendColorDstFactor||"zero"),l=vn("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),u=vn("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(s,a,l,u)}}function bn(e,t){return Pr(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function Ro(e,t){return Pr(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function Ba(e,t){return Pr(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function vn(e,t){return Pr(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773})}function Ad(e,t){return`Illegal parameter ${t} for ${e}`}function Pr(e,t,r){if(!(t in r))throw new Error(Ad(e,t));return r[t]}function Td(e,t){return t}function An(e){let t={};return e.addressModeU&&(t[10242]=Eo(e.addressModeU)),e.addressModeV&&(t[10243]=Eo(e.addressModeV)),e.addressModeW&&(t[32882]=Eo(e.addressModeW)),e.magFilter&&(t[10240]=Wa(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=Sd(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=bn("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function ka(e){let t={...e};return e[10241]!==9728&&(t[10241]=9729),t[10242]=33071,t[10243]=33071,t}function Eo(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function Wa(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function Sd(e,t){if(!t)return Wa(e);switch(e){case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var Oe=M(B(),1),se=class extends Oe.Buffer{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.glTarget=void 0,this.glUsage=void 0,this.glIndexType=5123,this.byteLength=void 0,this.bytesUsed=void 0,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),t.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=xd(this.props.usage),this.glUsage=Rd(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r,i=this.glTarget;this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,r,t),this.gl.bindBuffer(i,null),this.bytesUsed=n,this.byteLength=n,this._setDebugData(t,r,n),this.trackAllocatedMemory(n)}_initWithByteLength(t){(0,Oe.assert)(t>=0);let r=t;t===0&&(r=new Float32Array(0));let n=this.glTarget;return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.bytesUsed=t,this.byteLength=t,this._setDebugData(null,0,t),this.trackAllocatedMemory(t),this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=0,i=void 0,o=this.device.isWebGL2?36663:this.glTarget;this.gl.bindBuffer(o,this.handle),n!==0||i!==void 0?(this.device.assertWebGL2(),this.gl2.bufferSubData(o,r,t,n,i)):this.gl.bufferSubData(o,r,t),this.gl.bindBuffer(o,null),this._setDebugData(t,r,t.byteLength)}async readAsync(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1?arguments[1]:void 0;return this.readSyncWebGL2(t,r)}readSyncWebGL2(){var t;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0;this.device.assertWebGL2(),n=(t=n)!==null&&t!==void 0?t:this.byteLength-r;let i=new Uint8Array(n),o=0;return this.gl.bindBuffer(36662,this.handle),this.gl2.getBufferSubData(36662,r,i,o,n),this.gl.bindBuffer(36662,null),this._setDebugData(i,r,n),i}};function xd(e){return e&Oe.Buffer.INDEX?34963:e&Oe.Buffer.VERTEX?34962:e&Oe.Buffer.UNIFORM?35345:34962}function Rd(e){return e&Oe.Buffer.INDEX||e&Oe.Buffer.VERTEX?35044:e&Oe.Buffer.UNIFORM?35048:35044}var Va=M(B(),1);var _t=class extends Va.Sampler{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.parameters=void 0,this.device=t,this.parameters=An(r),this.device.isWebGL2&&(this.handle=this.handle||this.device.gl2.createSampler(),this._setSamplerParameters(this.parameters))}destroy(){this.handle&&(this.device.gl2.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[r,n]of Object.entries(t)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl2.samplerParameterf(this.handle,i,n);break;default:this.device.gl2.samplerParameteri(this.handle,i,n);break}}}};var Ed={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},G=class extends Y.Texture{constructor(t,r){var n;super(t,{...Ed,format:"rgba8unorm",...r}),this.MAX_ATTRIBUTES=void 0,this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.sampler=void 0,this.glFormat=void 0,this.type=void 0,this.dataFormat=void 0,this.mipmaps=void 0,this.target=void 0,this.textureUnit=void 0,this.loaded=!1,this._video=void 0,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Od(this.props),this.loaded=!1,typeof((n=this.props)===null||n===void 0?void 0:n.data)=="string"&&Object.assign(this.props,{data:(0,Y.loadImage)(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.props.dimension==="cube")return this.initializeCube(t);let r=t.data;if(r instanceof Promise)return r.then(v=>this.initialize(Object.assign({},t,{pixels:v,data:v}))),this;let n=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(t)),this;let{parameters:i={}}=t,{pixels:o=null,pixelStore:s={},textureUnit:a=void 0}=t;r||(r=o);let{width:l,height:u,dataFormat:c,type:f,compressed:h=!1,mipmaps:_=!0}=t,{depth:m=0}=t,y=Cr(t.format,this.device.isWebGL2);return{width:l,height:u,compressed:h,dataFormat:c,type:f}=this._deduceParameters({format:t.format,type:f,dataFormat:c,compressed:h,data:r,width:l,height:u}),this.width=l,this.height=u,this.glFormat=y,this.type=f,this.dataFormat=c,this.textureUnit=a,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),_&&this.device.isWebGL1&&Tn(this.width,this.height)&&(Y.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)(),_=!1),this.mipmaps=_,this.setImageData({data:r,width:l,height:u,depth:m,format:y,type:f,dataFormat:c,parameters:s,compressed:h}),this.setSampler(t.sampler),this._setSamplerParameters(i),_&&this.generateMipmap(),n&&(this._video={video:r,parameters:i,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(t){let{mipmaps:r=!0,parameters:n={}}=t;return this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setSampler(t.sampler),this._setSamplerParameters(n)}),this}setSampler(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r;t instanceof _t?(this.sampler=t,r=t.props):(this.sampler=new _t(this.device,t),r=t);let n=An(r);return this._setSamplerParameters(n),this}resize(t){let{height:r,width:n,mipmaps:i=!1}=t;return n!==this.width||r!==this.height?this.initialize({width:n,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:i}):this}update(){if(this._video){let{video:t,parameters:r,lastTime:n}=this._video;if(n===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}generateMipmap(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.device.isWebGL1&&Tn(this.width,this.height)?(Y.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),ae(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(t);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:n=null,level:i=0,glFormat:o=this.glFormat,offset:s=0,parameters:a={}}=t,{data:l=null,type:u=this.type,width:c=this.width,height:f=this.height,dataFormat:h=this.dataFormat,compressed:_=!1}=t;l||(l=n),{type:u,dataFormat:h,compressed:_,width:c,height:f}=this._deduceParameters({format:this.props.format,type:u,dataFormat:h,compressed:_,data:l,width:c,height:f});let{gl:m}=this;m.bindTexture(this.target,this.handle);let y=null;({data:l,dataType:y}=this._getDataType({data:l,compressed:_}));let v;if(ae(this.gl,a,()=>{switch(y){case"null":m.texImage2D(r,i,o,c,f,0,h,u,l);break;case"typed-array":m.texImage2D(r,i,o,c,f,0,h,u,l,s);break;case"buffer":v=this.device.assertWebGL2(),v.bindBuffer(35052,l.handle||l),v.texImage2D(r,i,o,c,f,0,h,u,s),v.bindBuffer(35052,null);break;case"browser-object":this.device.isWebGL2?m.texImage2D(r,i,o,c,f,0,h,u,l):m.texImage2D(r,i,o,h,u,l);break;case"compressed":for(let[S,T]of l.entries())m.compressedTexImage2D(r,S,T.format,T.width,T.height,0,T.data);break;default:(0,Y.assert)(!1,"Unknown image data type")}}),l&&l.byteLength)this.trackAllocatedMemory(l.byteLength,"Texture");else{let S=Nr(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*S,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:n=null,data:i=null,x:o=0,y:s=0,width:a=this.width,height:l=this.height,level:u=0,glFormat:c=this.glFormat,type:f=this.type,dataFormat:h=this.dataFormat,compressed:_=!1,offset:m=0,parameters:y={}}=t;if({type:f,dataFormat:h,compressed:_,width:a,height:l}=this._deduceParameters({format:this.props.format,type:f,dataFormat:h,compressed:_,data:i,width:a,height:l}),(0,Y.assert)(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){let v=i;i=v.data,a=v.shape[0],l=v.shape[1]}i instanceof se&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),ae(this.gl,y,()=>{if(_)this.gl.compressedTexSubImage2D(r,u,o,s,a,l,c,i);else if(i===null)this.gl.texSubImage2D(r,u,o,s,a,l,h,f,null);else if(ArrayBuffer.isView(i))this.gl.texSubImage2D(r,u,o,s,a,l,h,f,i,m);else if(typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer){let v=this.device.assertWebGL2();v.bindBuffer(35052,i),v.texSubImage2D(r,u,o,s,a,l,h,f,m),v.bindBuffer(35052,null)}else this.device.isWebGL2?this.device.assertWebGL2().texSubImage2D(r,u,o,s,a,l,h,f,i):this.gl.texSubImage2D(r,u,o,s,h,f,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Y.log.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:n=!1}=t;return n?{data:r,dataType:"compressed"}:r===null?{data:r,dataType:"null"}:ArrayBuffer.isView(r)?{data:r,dataType:"typed-array"}:r instanceof se?{data:r.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&r instanceof WebGLBuffer?{data:r,dataType:"buffer"}:{data:r,dataType:"browser-object"}}_deduceParameters(t){let{format:r,data:n}=t,{width:i,height:o,dataFormat:s,type:a,compressed:l}=t,u=It(r,this.device.isWebGL2);return s=s||u.dataFormat,a=a||u.type,l=l||u.compressed,{width:i,height:o}=this._deduceImageSize(n,i,o),{dataFormat:s,type:a,compressed:l,width:i,height:o,format:r,data:n}}_deduceImageSize(t,r,n){let i;return typeof ImageData<"u"&&t instanceof ImageData?i={width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?i={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?i={width:t.width,height:t.height}:typeof ImageBitmap<"u"&&t instanceof ImageBitmap?i={width:t.width,height:t.height}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?i={width:t.videoWidth,height:t.videoHeight}:t?i={width:r,height:n}:i={width:r>=0?r:1,height:n>=0?n:1},(0,Y.assert)(i,"Could not deduced texture size"),(0,Y.assert)(r===void 0||i.width===r,"Deduced texture width does not match supplied width"),(0,Y.assert)(n===void 0||i.height===n,"Deduced texture height does not match supplied height"),i}async setCubeMapImageData(t){let{gl:r}=this,{width:n,height:i,pixels:o,data:s,format:a=6408,type:l=5121}=t,u=o||s,c=await Promise.all(G.FACES.map(f=>{let h=u[f];return Promise.all(Array.isArray(h)?h:[h])}));this.bind(),G.FACES.forEach((f,h)=>{c[h].length>1&&this.props.mipmaps!==!1&&Y.log.warn(`${this.id} has mipmap and multiple LODs.`)(),c[h].forEach((_,m)=>{n&&i?r.texImage2D(f,m,a,n,i,0,a,l,_):r.texImage2D(f,m,a,a,l,_)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:s,format:a=6408,type:l=5121}=t,{gl:u}=this,c=o||s;return this.bind(),c instanceof Promise?c.then(f=>this.setImageDataForFace(Object.assign({},t,{face:r,data:f,pixels:f}))):this.width||this.height?u.texImage2D(r,0,a,n,i,0,a,l,c):u.texImage2D(r,0,a,a,l,c),this}setImageData3D(t){let{level:r=0,dataFormat:n,format:i,type:o,width:s,height:a,depth:l=1,offset:u=0,data:c,parameters:f={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let h=It(i,this.device.isWebGL2);if(ae(this.gl,f,()=>{ArrayBuffer.isView(c)&&this.gl.texImage3D(this.target,r,h.format,s,a,l,0,h.dataFormat,h.type,c),c instanceof se&&(this.gl.bindBuffer(35052,c.handle),this.gl.texImage3D(this.target,r,n,s,a,l,0,i,o,u))}),c&&c.byteLength)this.trackAllocatedMemory(c.byteLength,"Texture");else{let _=Nr(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*this.depth*_,"Texture")}return this.loaded=!0,this}_setSamplerParameters(t){if(this.device.isWebGL1&&Tn(this.width,this.height)&&(t=ka(t)),!(0,Y.isObjectEmpty)(t)){wd(t),this.gl.bindTexture(this.target,this.handle);for(let[r,n]of Object.entries(t)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.target,i,o);break;default:this.gl.texParameteri(this.target,i,o);break}}this.gl.bindTexture(this.target,null)}}_getWebGL1NPOTParameterOverride(t,r){if(this.device.isWebGL1&&Tn(this.width,this.height))switch(t){case 10241:if(r!==9729&&r!==9728)return 9729;break;case 10242:case 10243:return 33071;default:break}return r}};G.FACES=[34069,34070,34071,34072,34073,34074];function Od(e){switch(e.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(e.dimension)}}function Tn(e,t){return!e||!t?!1:!(0,Y.isPowerOfTwo)(e)||!(0,Y.isPowerOfTwo)(t)}function wd(e){Y.log.log(1,"texture sampler parameters",e)()}var za=M(B(),1);var We=M(B(),1);var Ha=M(B(),1);function Sn(e,t){if(typeof t!="string")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\./,"");let n=e[t];return(0,Ha.assert)(n!==void 0,`Accessing undefined constant GL.${t}`),n}var Mt="Resource subclass must define virtual methods",xn=class extends We.Resource{constructor(t,r,n){super(t,r,n),this.device=void 0,this.gl=void 0,this.gl2=void 0,this._handle=void 0,this._bound=!1,this.byteLength=0,this.device=Z.attach(t);let i=this.device.gl;oa(i);let{id:o}=r||{};this.gl=i,this.gl2=i,this.id=o||(0,We.uid)(this.constructor.name),this._handle=r?.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0}toString(){return`${this.constructor.name}(${this.id})`}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this.removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(n=>n.destroy()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=Sn(this.gl,t),(0,We.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=U(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension)))){let a=i.webgl1,l="webgl2"in i?i.webgl2:i.webgl1;return o?l:a}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:n}=t,i=this.constructor.PARAMETERS||{},o=U(this.gl),s={},a=r||Object.keys(i);for(let l of a){let u=i[l];if(u&&(!("webgl2"in u)||o)&&(!("extension"in u)||this.gl.getExtension(u.extension))){let f=n?this.device.getGLKey(l):l;s[f]=this.getParameter(l,t),n&&u.type==="GLenum"&&(s[f]=this.device.getGLKey(s[f]))}}return s}setParameter(t,r){t=Sn(this.gl,t),(0,We.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=U(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension))))throw new Error("Parameter not available on this platform");i.type==="GLenum"&&(r=Sn(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,n){return(0,We.stubRemovedMethods)(this,t,r,n)}initialize(t){}_createHandle(){throw new Error(Mt)}_deleteHandle(){throw new Error(Mt)}_bindHandle(t){throw new Error(Mt)}_getOptsFromHandle(){throw new Error(Mt)}_getParameter(t,r){throw new Error(Mt)}_setParameter(t,r){throw new Error(Mt)}};var Xa;Xa=Symbol.toStringTag;var Ye=class extends xn{get[Xa](){return"Renderbuffer"}get width(){return this.props.width}get height(){return this.props.height}get format(){return this.props.format}get samples(){return this.props.samples}get attachment(){}static isTextureFormatSupported(t,r){return Oa(t.gl,r)}constructor(t,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(t,r,Ye.defaultProps),this.glFormat=void 0,this.glFormat=Cr(this.props.format,t.isWebGL2),this._initialize(this.props)}resize(t){(t.width!==this.width||t.height!==this.height)&&(Object.assign(this.props,{...t,format:this.format,samples:this.samples}),this._initialize(this.props))}_initialize(t){let{format:r,width:n,height:i,samples:o}=t;(0,za.assert)(r,"Needs format"),this.trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),o!==0&&this.device.isWebGL2?this.gl2.renderbufferStorageMultisample(36161,o,this.glFormat,n,i):this.gl.renderbufferStorage(36161,this.glFormat,n,i),this.gl.bindRenderbuffer(36161,null),this.trackAllocatedMemory(n*i*(o||1)*Nr(this.glFormat,this.device.isWebGL2))}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this.trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}};Ye.defaultProps={id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0};var we=class extends Rn.Framebuffer{get texture(){return this.colorAttachments[0]}constructor(t,r){super(t,r),this.device=void 0,this.gl=void 0,this.handle=void 0;let n=r.handle===null;if(this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),!n){t.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.gl.bindFramebuffer(36160,this.handle);for(let i=0;i<this.colorAttachments.length;++i){let o=this.colorAttachments[i],s=36064+i;o&&this._attachOne(s,o)}this.depthStencilAttachment&&this._attachOne(Na(this.depthStencilAttachment.format),this.depthStencilAttachment),this.gl.bindFramebuffer(36160,null)}r.check!==!1&&this._checkStatus()}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}_checkStatus(){let{gl:t}=this,r=t.bindFramebuffer(36160,this.handle),n=t.checkFramebufferStatus(36160);if(t.bindFramebuffer(36160,r||null),n!==36053)throw new Error(`Framebuffer ${Nd(n)}`)}createDepthStencilTexture(t){return new Ye(this.device,{id:`${this.id}-depth-stencil`,format:t,width:this.width,height:this.height})}resizeAttachments(t,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;t===void 0&&(t=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let n of this.colorAttachments)n.resize({width:t,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.resize({width:t,height:r}),this}_attachOne(t,r){if(r instanceof Ye)return this._attachWEBGLRenderbuffer(t,r),r;if(Array.isArray(r)){let[n,i=0,o=0]=r;return this._attachTexture(t,n,i,o),n}else if(r instanceof G)return this._attachTexture(t,r,0,0),r;throw new Error("attach")}_attachWEBGLRenderbuffer(t,r){this.gl.framebufferRenderbuffer(36160,t,36161,r.handle)}_attachTexture(t,r,n,i){let{gl:o,gl2:s}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:this.device.assertWebGL2(),s?.framebufferTextureLayer(36160,t,r.target,i,n);break;case 34067:let a=Cd(n);o.framebufferTexture2D(36160,t,a,r.handle,i);break;case 3553:o.framebufferTexture2D(36160,t,3553,r.handle,i);break;default:(0,Rn.assert)(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function Cd(e){return e<34069?e+34069:e}function Nd(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}var En=class extends La.CanvasContext{constructor(t,r){super(r),this.device=void 0,this.presentationSize=void 0,this._framebuffer=null,this.device=t,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new we(this.device,{handle:null}),this._framebuffer}update(){let t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t,this.resize())}resize(t){if(!this.device.gl)return;if(this.canvas){let n=this.getDevicePixelRatio(t?.useDevicePixels);this.setDevicePixelRatio(n,t);return}let r=this.device.gl.getExtension("STACKGL_resize_drawingbuffer");r&&t&&"width"in t&&"height"in t&&r.resize(t.width,t.height)}commit(){}};var Ce=M(B(),1),Pd={spector:Ce.log.get("spector")||Ce.log.get("inspect")},Id="https://spectorcdn.babylonjs.com/spector.bundle.js",Md=1,le=null,ja=!1;async function $a(e){if(!globalThis.SPECTOR)try{await(0,Ce.loadScript)(Id)}catch(t){Ce.log.warn(String(t))}}function Ka(e){var t,r;if(e={...Pd,...e},!((t=e)!==null&&t!==void 0&&t.spector)||(!le&&globalThis.SPECTOR&&(Ce.log.probe(Md,"SPECTOR found and initialized")(),le=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=le)),!le))return null;if(!ja){var n,i;ja=!0,le.spyCanvases(),(n=le)===null||n===void 0||n.onCaptureStarted.add(a=>Ce.log.info("Spector capture started:",a)()),(i=le)===null||i===void 0||i.onCapture.add(a=>{var l,u,c;Ce.log.info("Spector capture complete:",a)(),(l=le)===null||l===void 0||l.getResultUI(),(u=le)===null||u===void 0||u.resultView.display(),(c=le)===null||c===void 0||c.resultView.addCapture(a)})}if((r=e)!==null&&r!==void 0&&r.canvas){var o,s;if(typeof e.spector=="string"&&e.spector!==e.canvas.id)return le;(o=le)===null||o===void 0||o.startCapture((s=e)===null||s===void 0?void 0:s.canvas,500),new Promise(a=>setTimeout(a,2e3)).then(a=>{var l;Ce.log.info("Spector capture stopped after 2 seconds")(),(l=le)===null||l===void 0||l.stopCapture()})}return le}var qe=M(B(),1);var Dd="https://unpkg.com/webgl-debug@2.0.1/index.js";function Ya(e){return e.luma=e.luma||{},e.luma}async function qa(){ve()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await(0,qe.loadScript)(Dd))}function Za(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?Bd(e,t):Fd(e):null}function Fd(e){let t=Ya(e);return t.realContext?t.realContext:e}function Bd(e,t){if(!globalThis.WebGLDebugUtils)return qe.log.warn("webgl-debug not loaded")(),e;let r=Ya(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...st,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,Ud.bind(null,t),kd.bind(null,t));for(let s in st)!(s in n)&&typeof st[s]=="number"&&(n[s]=st[s]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(i,n);let o=Object.create(i);return r.realContext=e,r.debugContext=o,o.debug=!0,o}function Oo(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function Ud(e,t,r,n){n=Array.from(n).map(l=>l===void 0?"undefined":l);let i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),s=e.webgl2?"gl2":"gl1",a=`${i} in ${s}.${r}(${o})`;qe.log.error(a)();debugger;if(e.throwOnError)throw new Error(a)}function kd(e,t,r){let n="";if(qe.log.level>=1&&(n=Oo(t,r),qe.log.log(1,n)()),e.break&&e.break.length>0&&(n=n||Oo(t,r),e.break.every(o=>n.indexOf(o)!==-1)))debugger;for(let i of r)if(i===void 0){if(n=n||Oo(t,r),e.throwOnError)throw new Error(`Undefined argument: ${n}`);qe.log.error(`Undefined argument: ${n}`)();debugger}}var Ga=M(B(),1);function Ja(e){let t=e.split(/\r?\n/),r=[];for(let n of t){if(n.length<=1)continue;let i=n.split(":");if(i.length===2){let[f,h]=i;r.push({message:h.trim(),type:Qa(f),lineNum:0,linePos:0});continue}let[o,s,a,...l]=i,u=parseInt(a,10);isNaN(u)&&(u=0);let c=parseInt(s,10);isNaN(c)&&(c=0),r.push({message:l.join(":").trim(),type:Qa(o),lineNum:u,linePos:c})}return r}function Qa(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var On=class extends Ga.Shader{constructor(t,r){switch(super(t,r),this.device=void 0,this.handle=void 0,this.device=t,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return this.getCompilationInfoSync()}getCompilationInfoSync(){let t=this.device.gl.getShaderInfoLog(this.handle);return Ja(t)}_compile(t){t=(i=>i.startsWith("#version ")?i:`#version 100
317
- ${i}`)(t);let{gl:n}=this.device;if(n.shaderSource(this.handle,t),n.compileShader(this.handle),this.compilationStatus=n.getShaderParameter(this.handle,35713)?"success":"error",this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`)}};var el=M(B(),1);var Wd=256,Vd=1024,Hd=16384,wo=6144,wn=class extends el.RenderPass{constructor(t,r){super(t,r),this.device=void 0,this.glParameters=void 0,this.device=t,Ke(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){Ue(this.device.gl),this.props.framebuffer&&Be(this.device,{framebuffer:null})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),r.scissorTest=Boolean(t.scissorRect),t.scissorRect&&(r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=t.stencilReference),this.glParameters=r,Be(this.device,r)}clear(){let t={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=Hd,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=Wd,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=Vd,t.clearStencil=this.props.clearStencil),r!==0&&ae(this.device,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];ae(this.device.gl2,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl2.clearBufferiv(wo,t,r);break;case Uint32Array:this.device.gl2.clearBufferuiv(wo,t,r);break;case Float32Array:default:this.device.gl2.clearBufferfv(wo,t,r);break}})}};var te=M(B(),1),cl=M(B(),1);var Cn=M(B(),1);var Xd="Failed to deduce GL constant from typed array";function tl(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return 5126;case Uint16Array:return 5123;case Uint32Array:return 5125;case Uint8Array:return 5121;case Uint8ClampedArray:return 5121;case Int8Array:return 5120;case Int16Array:return 5122;case Int32Array:return 5124;default:throw new Error(Xd)}}function Ir(e,t){let{clamped:r=!0}=t||{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var zd={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},Ld={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Ze=class{static getBytesPerElement(t){return Ir(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return(0,Cn.assert)(t.size),Ir(t.type||5126).BYTES_PER_ELEMENT*t.size}static resolve(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return new Ze(zd,...r)}constructor(){this.offset=void 0,this.stride=void 0,this.type=void 0,this.size=void 0,this.divisor=void 0,this.normalized=void 0,this.integer=void 0,this.buffer=void 0,this.index=void 0;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(i=>this._assign(i)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return Ze.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Ze.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=(0,Cn.checkProps)("Accessor",t,Ld),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalize!==void 0&&(this.normalized=t.normalize),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index=="boolean"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function rl(e){return jd.includes(e)}var jd=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],nl={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function Co(e){let t=nl[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function il(e){let t=nl[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function ol(e,t){let r={attributes:[],bindings:[]};r.attributes=$d(e,t);let n=qd(e,t);for(let a of n){let l=a.uniforms.map(u=>({name:u.name,format:u.format,byteOffset:u.byteOffset,byteStride:u.byteStride,arrayLength:u.arrayLength}));r.bindings.push({type:"uniform",name:a.name,location:a.location,visibility:(a.vertex?1:0)&(a.fragment?2:0),minBindingSize:a.byteLength,uniforms:l})}let i=Yd(e,t),o=0;for(let a of i)if(rl(a.type)){let{viewDimension:l,sampleType:u}=Qd(a.type);r.bindings.push({type:"texture",name:a.name,location:o,viewDimension:l,sampleType:u}),a.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let s=Kd(e,t);return s!=null&&s.length&&(r.varyings=s),r}function $d(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let i=0;i<n;i++){let o=e.getActiveAttrib(t,i);if(!o)throw new Error("activeInfo");let{name:s,type:a}=o,l=e.getAttribLocation(t,s);if(l>=0){let{attributeType:u}=il(a),c=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:l,stepMode:c,type:u})}}return r.sort((i,o)=>i.location-o.location),r}function Kd(e,t){if(!U(e))return[];let r=e,n=[],i=e.getProgramParameter(t,35971);for(let o=0;o<i;o++){let s=r.getTransformFeedbackVarying(t,o);if(!s)throw new Error("activeInfo");let{name:a,type:l,size:u}=s,{glType:c,components:f}=Co(l),h=new Ze({type:c,size:u*f}),_={location:o,name:a,accessor:h};n.push(_)}return n.sort((o,s)=>o.location-s.location),n}function Yd(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let i=0;i<n;i++){let o=e.getActiveUniform(t,i);if(!o)throw new Error("activeInfo");let{name:s,size:a,type:l}=o,{name:u,isArray:c}=Jd(s),f=e.getUniformLocation(t,u),h={location:f,name:u,size:a,type:l,isArray:c};if(r.push(h),h.size>1)for(let _=0;_<h.size;_++){let m=`${u}[${_}]`;f=e.getUniformLocation(t,m);let y={...h,name:m,location:f};r.push(y)}}return r}function qd(e,t){if(!U(e))return[];let r=e,n=(s,a)=>r.getActiveUniformBlockParameter(t,s,a),i=[],o=r.getProgramParameter(t,35382);for(let s=0;s<o;s++){let a={name:r.getActiveUniformBlockName(t,s)||"",location:n(s,35391),byteLength:n(s,35392),vertex:n(s,35396),fragment:n(s,35398),uniformCount:n(s,35394),uniforms:[]},l=n(s,35395)||[],u=r.getActiveUniforms(t,l,35383),c=r.getActiveUniforms(t,l,35384),f=r.getActiveUniforms(t,l,35387),h=r.getActiveUniforms(t,l,35388);for(let _=0;_<a.uniformCount;++_){let m=r.getActiveUniform(t,l[_]);if(!m)throw new Error("activeInfo");a.uniforms.push({name:m.name,format:Co(u[_]).format,type:u[_],arrayLength:c[_],byteOffset:f[_],byteStride:h[_]})}i.push(a)}return i.sort((s,a)=>s.location-a.location),i}var Zd={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function Qd(e){let t=Zd[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function Jd(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function sl(e,t,r,n){let i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);let s=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,s);case 35664:return e.uniform2fv(t,s);case 35665:return e.uniform3fv(t,s);case 35666:return e.uniform4fv(t,s);case 5124:return e.uniform1iv(t,s);case 35667:return e.uniform2iv(t,s);case 35668:return e.uniform3iv(t,s);case 35669:return e.uniform4iv(t,s);case 35670:return e.uniform1iv(t,s);case 35671:return e.uniform2iv(t,s);case 35672:return e.uniform3iv(t,s);case 35673:return e.uniform4iv(t,s);case 5125:return i.uniform1uiv(t,s,1);case 36294:return i.uniform2uiv(t,s,2);case 36295:return i.uniform3uiv(t,s,3);case 36296:return i.uniform4uiv(t,s,4);case 35674:return e.uniformMatrix2fv(t,!1,s);case 35675:return e.uniformMatrix3fv(t,!1,s);case 35676:return e.uniformMatrix4fv(t,!1,s);case 35685:return i.uniformMatrix2x3fv(t,!1,s);case 35686:return i.uniformMatrix2x4fv(t,!1,s);case 35687:return i.uniformMatrix3x2fv(t,!1,s);case 35688:return i.uniformMatrix3x4fv(t,!1,s);case 35689:return i.uniformMatrix4x2fv(t,!1,s);case 35690:return i.uniformMatrix4x3fv(t,!1,s)}throw new Error("Illegal uniform")}function al(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(e)}}function ll(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(e)}}var ul=4,Nn=class extends te.RenderPipeline{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.vs=void 0,this.fs=void 0,this.introspectedLayout=void 0,this.uniforms={},this.bindings={},this.varyings=null,this._uniformCount=0,this._uniformSetters={},this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=(0,te.cast)(r.vs),this.fs=(0,te.cast)(r.fs);let{varyings:n,bufferMode:i=35981}=r;if(n&&n.length>0){var o;this.device.assertWebGL2(),this.varyings=n,(o=this.device.gl2)===null||o===void 0||o.transformFeedbackVaryings(this.handle,n,i)}switch(this._compileAndLink(),this.introspectedLayout=ol(this.device.gl,this.handle),this.shaderLayout=(0,cl.mergeShaderLayout)(this.introspectedLayout,r.shaderLayout),this.props.topology){case"triangle-fan-webgl":case"line-loop-webgl":te.log.warn(`Primitive topology ${this.props.topology} is deprecated and will be removed in v9.1`);break;default:}}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t){for(let[r,n]of Object.entries(t)){let i=this.shaderLayout.bindings.find(o=>o.name===r)||this.shaderLayout.bindings.find(o=>o.name===`${r}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(s=>`"${s.name}"`).join(", ");te.log.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(n||te.log.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(n instanceof se)&&!(n.buffer instanceof se))throw new Error("buffer value");break;case"texture":if(!(n instanceof G||n instanceof we))throw new Error("texture value");break;case"sampler":te.log.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(i.type)}this.bindings[r]=n}}setUniforms(t){let{bindings:r}=(0,te.splitUniformsAndBindings)(t);Object.keys(r).forEach(n=>{te.log.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,t)}draw(t){var r;let{renderPass:n,vertexArray:i,vertexCount:o,instanceCount:s,firstVertex:a=0,transformFeedback:l}=t,u=al(this.props.topology),c=Boolean(i.indexBuffer),f=(r=i.indexBuffer)===null||r===void 0?void 0:r.glIndexType,h=Number(s)>0;if(!this._areTexturesRenderable()||o===0)return!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(n),l&&l.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let _=n;return Ua(this.device,this.props.parameters,_.glParameters,()=>{if(c&&h){var m;(m=this.device.gl2)===null||m===void 0||m.drawElementsInstanced(u,o||0,f,a,s||0)}else if(c)this.device.gl.drawElements(u,o||0,f,a);else if(h){var y;(y=this.device.gl2)===null||y===void 0||y.drawArraysInstanced(u,a,o||0,s||0)}else this.device.gl.drawArrays(u,a,o||0);l&&l.end()}),i.unbindAfterRender(n),!0}_compileAndLink(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),te.log.time(ul,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),te.log.timeEnd(ul,`linkProgram for ${this.id}`)(),!t.debug&&te.log.level,!t.getProgramParameter(this.handle,35714))throw new Error(`Error linking: ${t.getProgramInfoLog(this.handle)}`);if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(`Error validating: ${t.getProgramInfoLog(this.handle)}`)}_areTexturesRenderable(){let t=!0;for(let[,r]of Object.entries(this.bindings))r instanceof G&&(r.update(),t=t&&r.loaded);return t}_applyBindings(){this.device.gl.useProgram(this.handle);let{gl2:t}=this.device;if(!t)throw new Error("bindings");let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:s}=i,a=t.getUniformBlockIndex(this.handle,s);if(a===4294967295)throw new Error(`Invalid uniform block name ${s}`);t.uniformBlockBinding(this.handle,n,a),o instanceof se?t.bindBufferBase(35345,n,o.handle):t.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof G||o instanceof we))throw new Error("texture");let l;if(o instanceof G)l=o;else if(o instanceof we&&o.colorAttachments[0]instanceof G)te.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0];else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(l.target,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let r of this.shaderLayout.uniforms||[]){var t;let{name:n,location:i,type:o,textureUnit:s}=r,a=(t=this.uniforms[n])!==null&&t!==void 0?t:s;a!==void 0&&sl(this.device.gl,i,o,a)}}};var dl=M(B(),1);var In=M(B(),1);var Pn=class extends In.CommandBuffer{constructor(t){super(t,{}),this.device=void 0,this.commands=[],this.device=t}submitCommands(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.commands;for(let r of t)switch(r.name){case"copy-buffer-to-buffer":Gd(this.device,r.options);break;case"copy-buffer-to-texture":eh(this.device,r.options);break;case"copy-texture-to-buffer":th(this.device,r.options);break;case"copy-texture-to-texture":rh(this.device,r.options);break}}};function Gd(e,t){let r=t.source,n=t.destination,i=e.assertWebGL2();if(i){var o,s;i.bindBuffer(36662,r.handle),i.bindBuffer(36663,n.handle),i.copyBufferSubData(36662,36663,(o=t.sourceOffset)!==null&&o!==void 0?o:0,(s=t.destinationOffset)!==null&&s!==void 0?s:0,t.size),i.bindBuffer(36662,null),i.bindBuffer(36663,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function eh(e,t){throw new Error("Not implemented")}function th(e,t){let{source:r,mipLevel:n=0,aspect:i="all",width:o=t.source.width,height:s=t.source.height,depthOrArrayLayers:a=0,origin:l=[0,0],destination:u,byteOffset:c=0,bytesPerRow:f,rowsPerImage:h}=t;if(i!=="all")throw new Error("not supported");if(n!==0||a!==0||f||h)throw new Error("not implemented");let _=e.assertWebGL2(),{framebuffer:m,destroyFramebuffer:y}=fl(r);try{let v=u,S=o||m.width,T=s||m.height,x=It(m.texture.format,!0),O=x.dataFormat,P=x.type;_.bindBuffer(35051,v.handle),_.bindFramebuffer(36160,m.handle),_.readPixels(l[0],l[1],S,T,O,P,c)}finally{_.bindBuffer(35051,null),_.bindFramebuffer(36160,null),y&&m.destroy()}}function rh(e,t){let{source:r,origin:n=[0,0],destination:i}=t,{width:o=t.destination.width,height:s=t.destination.width}=t,a=0,l=6408,{framebuffer:u,destroyFramebuffer:c}=fl(r),[f,h]=n,_=!1;e.gl.bindFramebuffer(36160,u.handle);let m=null,y;if(i instanceof G)m=i,o=Number.isFinite(o)?o:m.width,s=Number.isFinite(s)?s:m.height,m.bind(0),y=m.destination;else throw new Error("whoops");return _||e.gl.copyTexImage2D(y,a,l,f,h,o,s,0),m&&m.unbind(),c&&u.destroy(),m}function fl(e){if(e instanceof In.Texture){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var Mn=class extends dl.CommandEncoder{constructor(t,r){super(t,r),this.device=void 0,this.commandBuffer=void 0,this.device=t,this.commandBuffer=new Pn(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}};var Ft=M(B(),1);var hl;hl=Symbol.toStringTag;var Dt=class extends Ft.VertexArray{get[hl](){return"VertexArray"}static isConstantAttributeZeroSupported(t){return t.info.type==="webgl2"||hn()==="Chrome"}constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.buffer=null,this.bufferValue=null,this.init=!1,this.device=t,this.handle=this.device.gl2.createVertexArray()}destroy(){if(super.destroy(),this.buffer){var t;(t=this.buffer)===null||t===void 0||t.destroy()}this.handle&&(this.device.gl2.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let r=t;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl2.bindVertexArray(this.handle),this.device.gl2.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r}setBuffer(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:s,offset:a,normalized:l,integer:u,divisor:c}=this._getAccessor(t);this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),u?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(t,i,o,s,a)):this.device.gl.vertexAttribPointer(t,i,o,l,s,a),this.device.gl.enableVertexAttribArray(t),this.device.gl2.vertexAttribDivisor(t,c||0),this.attributes[t]=n}setConstant(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){if(this.device.gl2.bindVertexArray(this.handle),!this.init){let t=this.indexBuffer;this.device.gl2.bindBuffer(34963,t?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl2.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttribute(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=pn(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=Dt.isConstantAttributeZeroSupported(this.device)||t!==0;(r||i)&&(t=Number(t),this.device.gl2.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl2.bindVertexArray(null))}getConstantBuffer(t,r){let n=nh(r),i=n.byteLength*t,o=n.length*t;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),s=s||!ih(n,this.bufferValue),s){let a=(0,Ft.getScratchArray)(r.constructor,o);(0,Ft.fillArray)({target:a,source:n,start:0,count:o}),this.buffer.write(a),this.bufferValue=r}return this.buffer}};function nh(e){return Array.isArray(e)?new Float32Array(e):e}function ih(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Fn=M(B(),1);var Dn=class extends Fn.TransformFeedback{constructor(t,r){super(t,r),this.device=void 0,this.gl2=void 0,this.handle=void 0,this.layout=void 0,this.buffers={},this.unusedBuffers={},this.bindOnUse=!0,this._bound=!1,t.assertWebGL2(),this.device=t,this.gl2=t.gl2,this.handle=this.props.handle||this.gl2.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl2.deleteTransformFeedback(this.handle),super.destroy()}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"point-list";this.gl2.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl2.beginTransformFeedback(ll(t))}end(){this.gl2.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl2.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:i,byteLength:o,byteOffset:s}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=i,Fn.log.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:s},this.bindOnUse||this._bindBuffer(n,i,s,o)}getBuffer(t){if(_l(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this.gl2.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl2.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl2.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof se)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(t){if(_l(t))return Number(t);for(let r of this.layout.varyings)if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,i,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl2.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,o=r&&r.handle;!o||i===void 0?this.gl2.bindBufferBase(35982,t,o):this.gl2.bindBufferRange(35982,t,o,n,i)}};function _l(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var Bt=M(B(),1);var No=M(B(),1);function Po(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return(0,No.assert)(!1),0}}function gl(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return(0,No.assert)(!1),0}}function Io(e,t){var r;let{sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,sourceAttachment:s=36064}=t||{},{target:a=null,sourceWidth:l,sourceHeight:u,sourceType:c}=t||{},{framebuffer:f,deleteFramebuffer:h}=pl(e);(0,Bt.assert)(f);let{gl:_,handle:m}=f;l=l||f.width,u=u||f.height;let y=s-36064;c=c||((r=f.colorAttachments[y])===null||r===void 0?void 0:r.type)||5121,a=sh(a,c,o,l,u),c=c||tl(a);let v=_.bindFramebuffer(36160,m);return _.readPixels(n,i,l,u,o,c,a),_.bindFramebuffer(36160,v||null),h&&f.destroy(),a}function Qe(e,t){let{target:r,sourceX:n=0,sourceY:i=0,sourceFormat:o=6408,targetByteOffset:s=0}=t||{},{sourceWidth:a,sourceHeight:l,sourceType:u}=t||{},{framebuffer:c,deleteFramebuffer:f}=pl(e);(0,Bt.assert)(c),a=a||c.width,l=l||c.height;let h=c;u=u||5121;let _=r;if(!_){let y=Po(o),v=gl(u),S=s+a*l*y*v;_=h.device.createBuffer({byteLength:S})}let m=e.device.createCommandEncoder();return m.copyTextureToBuffer({source:e,width:a,height:l,origin:[n,i],destination:_,byteOffset:s}),m.destroy(),f&&c.destroy(),_}function pl(e){return e instanceof Bt.Framebuffer?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:oh(e),deleteFramebuffer:!0}}function oh(e,t){let{device:r,width:n,height:i,id:o}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[e]})}function sh(e,t,r,n,i){if(e)return e;t=t||5121;let o=Ir(t,{clamped:!1}),s=Po(r);return new o(n*i*s)}var Mr=1,Z=class extends j.Device{static isSupported(){return typeof WebGLRenderingContext<"u"||ea()}get features(){return this._features=this._features||Ia(this.gl),this._features}get limits(){return this._limits=this._limits||Da(this.gl),this._limits}static attach(t){if(t instanceof Z)return t;if(t?.device instanceof j.Device)return t.device;if(!ah(t))throw new Error("Invalid WebGLRenderingContext");return new Z({gl:t})}static async create(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};j.log.groupCollapsed(Mr,"WebGLDevice created")(),typeof t.canvas=="string"&&await j.CanvasContext.pageLoaded,(j.log.get("debug")||t.debug)&&await qa();let{spector:r}=t;if((j.log.get("spector")||r)&&await $a(),j.log.probe(Mr+1,"DOM is loaded")(),t.gl&&t.gl.device)return Z.attach(t.gl);let n=new Z(t),i=`Created ${n.info.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return j.log.probe(Mr,i)(),j.log.table(Mr,n.info)(),j.log.groupEnd(Mr)(),n}constructor(t){var r,n;super({...t,id:t.id||(0,j.uid)("webgl-device")}),this.info=void 0,this.canvasContext=void 0,this.handle=void 0,this.lost=void 0,this._resolveContextLost=void 0,this._features=void 0,this._limits=void 0,this.renderPass=null,this.gl=void 0,this.gl2=null,this.debug=!1,this.isWebGL1=void 0,this.isWebGL2=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this._extensions={},this._polyfilled=!1,this.spector=void 0,this._webglLimits=void 0,this._constants=void 0;let i=(r=t.gl)===null||r===void 0?void 0:r.device;if(i)throw new Error(`WebGL context already attached to device ${i.id}`);let o=t.canvas||((n=t.gl)===null||n===void 0?void 0:n.canvas);this.canvasContext=new En(this,{...t,canvas:o}),this.lost=new Promise(c=>{this._resolveContextLost=c});let s=c=>{var f;return(f=this._resolveContextLost)===null||f===void 0?void 0:f.call(this,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},a=t.gl||null;if(a=a||(ve()?Aa(this.canvasContext.canvas,{...t,onContextLost:s}):null),a=a||(ve()?null:ta({...t,onContextLost:s})),!a)throw new Error("WebGL context creation failed");this.handle=a,this.gl=this.handle,this.gl2=this.gl,this.isWebGL2=lh(this.gl),this.isWebGL1=!this.isWebGL2,this.canvasContext.resize(),this.info=Ta(this.gl),this.gl.device=this,this.gl._version=this.isWebGL2?2:1,da(this.gl);let{enable:l=!0,copyState:u=!1}=t;if(bo(this.gl,{enable:l,copyState:u,log:function(){for(var c=arguments.length,f=new Array(c),h=0;h<c;h++)f[h]=arguments[h];return j.log.log(1,...f)()}}),ve()&&t.debug&&(this.gl=Za(this.gl,{...t,webgl2:this.isWebGL2,throwOnError:!0}),this.gl2=this.gl,this.debug=!0,j.log.level=Math.max(j.log.level,1),j.log.warn("WebGL debug mode activated. Performance reduced.")()),ve()&&t.spector){let c=this.handle.canvas||t.canvas;this.spector=Ka({...this.props,canvas:c})}}destroy(){let t=this.gl.getExtension("STACKGL_destroy_context");t&&t.destroy()}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(t){return Or(this.gl,t)}isTextureFormatFilterable(t){return wa(this.gl,t)}isTextureFormatRenderable(t){return Ca(this.gl,t)}assertWebGL2(){if(!this.gl2)throw new Error("Requires WebGL2");return this.gl2}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._getBufferProps(t);return new se(this,r)}_createTexture(t){return new G(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new _t(this,t)}createShader(t){return new On(this,t)}createFramebuffer(t){return new we(this,t)}createRenderPipeline(t){return new Nn(this,t)}createVertexArray(t){return new Dt(this,t)}beginRenderPass(t){return new wn(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}createTransformFeedback(t){return new Dn(this,t)}getDefaultRenderPass(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass}createCommandEncoder(t){return new Mn(this,t)}submit(){var t;(t=this.renderPass)===null||t===void 0||t.end(),this.renderPass=null}readPixelsToArrayWebGL(t,r){return Io(t,r)}readPixelsToBufferWebGL2(t,r){return Qe(t,r)}get webglLimits(){return this._webglLimits=this._webglLimits||Fa(this.gl),this._webglLimits}loseDevice(){var t;let r=!1,n=this.gl.getExtension("WEBGL_lose_context");return n&&(r=!0,n.loseContext()),(t=this._resolveContextLost)===null||t===void 0||t.call(this,{reason:"destroyed",message:"Application triggered context loss"}),r}pushState(){Ke(this.gl)}popState(){Ue(this.gl)}setSpectorMetadata(t,r){t.__SPECTOR_Metadata=r}getGLKey(t,r){r=r||this.gl2||this.gl;let n=Number(t);for(let i in r)if(r[i]===n)return`GL.${i}`;return String(t)}setConstantAttribute(t,r){this._constants=this._constants||new Array(this.limits.maxVertexAttributes).fill(null);let n=this._constants[t];switch(n&&dh(n,r)&&j.log.info(1,`setConstantAttribute(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:uh(this,t,r);break;case Int32Array:ch(this,t,r);break;case Uint32Array:fh(this,t,r);break;default:(0,j.assert)(!1)}}};Z.type="webgl";function ah(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function lh(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function uh(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:(0,j.assert)(!1)}}function ch(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function fh(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function dh(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var ml=M(B(),1);var hh=256,_h=1024,gh=16384;var ph="clear: bad arguments";function Bn(e,t){let r=Z.attach(e),{framebuffer:n=null,color:i=null,depth:o=null,stencil:s=null}=t||{},a={};n&&(a.framebuffer=n);let l=0;i&&(l|=gh,i!==!0&&(a.clearColor=i)),o&&(l|=hh,o!==!0&&(a.clearDepth=o)),s&&(l|=_h,o!==!0&&(a.clearStencil=o)),(0,ml.assert)(l!==0,ph),ae(r.gl,a,()=>{r.gl.clear(l)})}var Ge=M(Q());var W={SUM:1,MEAN:2,MIN:3,MAX:4};function vl(e,t){return e+t}function mh(e,t){return t>e?t:e}function vh(e,t){return t<e?t:e}function bh(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(vl,0)/r.length:null}function yh(e,t){if(Number.isFinite(t))return e.length?e.length*t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(vl,0):null}function Ah(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(mh,-1/0):null}function Th(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(vh,1/0):null}function Ut(e,t,r){var n=W[e]||W.SUM;switch(t=Sh(t,r),n){case W.MIN:return function(i){return Th(i,t)};case W.SUM:return function(i){return yh(i,t)};case W.MEAN:return function(i){return bh(i,t)};case W.MAX:return function(i){return Ah(i,t)};default:return null}}function Sh(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Number.isFinite(e)?e:function(r){return t.index=r.index,e(r.source,t)}}function bl(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function(r){return t.indices=r.map(function(n){return n.index}),e(r.map(function(n){return n.source}),t)}}var kt;function Un(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var yl={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},Je=3402823466e29,Mo=[32775,32774],Do=[32776,32774],Al=[32776,32775],Fo=(kt={},Un(kt,W.SUM,32774),Un(kt,W.MEAN,32774),Un(kt,W.MIN,Mo),Un(kt,W.MAX,Do),kt);var Tl={size:1,operation:W.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Sl=4;var xl=`#version 300 es
173
+ `;var di={ONE:1};function Ei(){return di}var G={name:"fp64-arithmetic",vs:ht,getUniforms:Ei,fp64ify:Ge,fp64LowPart:Ot,fp64ifyMatrix4:It};var K=h(x(),1);var F={SUM:1,MEAN:2,MIN:3,MAX:4};function Ft(e,t){return e+t}function Ni(e,t){return t>e?t:e}function pi(e,t){return t<e?t:e}function Ci(e,t){if(Number.isFinite(t))return e.length?t:null;let o=e.map(t).filter(Number.isFinite);return o.length?o.reduce(Ft,0)/o.length:null}function Mi(e,t){if(Number.isFinite(t))return e.length?e.length*t:null;let o=e.map(t).filter(Number.isFinite);return o.length?o.reduce(Ft,0):null}function Oi(e,t){if(Number.isFinite(t))return e.length?t:null;let o=e.map(t).filter(Number.isFinite);return o.length?o.reduce(Ni,-1/0):null}function Ii(e,t){if(Number.isFinite(t))return e.length?t:null;let o=e.map(t).filter(Number.isFinite);return o.length?o.reduce(pi,1/0):null}function ee(e,t,o){let i=F[e]||F.SUM;switch(t=hi(t,o),i){case F.MIN:return r=>Ii(r,t);case F.SUM:return r=>Mi(r,t);case F.MEAN:return r=>Ci(r,t);case F.MAX:return r=>Oi(r,t);default:return null}}function hi(e,t={}){return Number.isFinite(e)?e:o=>(t.index=o.index,e(o.source,t))}function Dt(e,t={}){return o=>(t.indices=o.map(i=>i.index),e(o.map(i=>i.source),t))}var xt={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},w=3402823466e29,et=[M.MIN,M.FUNC_ADD],tt=[M.MAX,M.FUNC_ADD],Bt=[M.MAX,M.MIN],ot={[F.SUM]:M.FUNC_ADD,[F.MEAN]:M.FUNC_ADD,[F.MIN]:et,[F.MAX]:tt};var Pt={size:1,operation:F.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Ut=4;var Jr={format:M.RGBA32F,type:M.FLOAT,border:0,mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest"},dataFormat:M.RGBA,width:1,height:1};var ut=`#version 300 es
318
174
  #define SHADER_NAME gpu-aggregation-to-grid-vs
319
175
 
320
176
  in vec3 positions;
@@ -350,20 +206,28 @@ void main(void) {
350
206
  vec2 pixelXY64[2];
351
207
  pixelXY64[0] = vec2(pos.x, 0.);
352
208
  pixelXY64[1] = vec2(pos.y, 0.);
209
+
210
+ // Transform (0,0):windowSize -> (0, 0): gridSize
353
211
  vec2 gridXY64[2];
354
212
  gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
355
213
  gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
356
214
  float x = floor(gridXY64[0].x);
357
215
  float y = floor(gridXY64[1].x);
358
216
  pos = vec2(x, y);
217
+
218
+ // Transform (0,0):gridSize -> (-1, -1):(1,1)
359
219
  pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
220
+
221
+ // Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
360
222
  vec2 offset = 1.0 / gridSize;
361
223
  pos = pos + offset;
362
224
 
363
225
  gl_Position = vec4(pos, 0.0, 1.0);
226
+
227
+ // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
364
228
  gl_PointSize = 1.0;
365
229
  }
366
- `;var Rl=`#version 300 es
230
+ `;var vt=`#version 300 es
367
231
  #define SHADER_NAME gpu-aggregation-to-grid-fs
368
232
 
369
233
  precision highp float;
@@ -376,7 +240,7 @@ void main(void) {
376
240
  fragColor = vec4(vWeights, 1.0);
377
241
  DECKGL_FILTER_COLOR(fragColor, geometry);
378
242
  }
379
- `;var El=`#version 300 es
243
+ `;var yt=`#version 300 es
380
244
  #define SHADER_NAME gpu-aggregation-all-vs-64
381
245
 
382
246
  in vec2 position;
@@ -384,7 +248,10 @@ uniform ivec2 gridSize;
384
248
  out vec2 vTextureCoord;
385
249
 
386
250
  void main(void) {
251
+ // Map each position to single pixel
387
252
  vec2 pos = vec2(-1.0, -1.0);
253
+
254
+ // Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
388
255
  vec2 offset = 1.0 / vec2(gridSize);
389
256
  pos = pos + offset;
390
257
 
@@ -402,9 +269,10 @@ void main(void) {
402
269
  vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
403
270
 
404
271
  vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
272
+ // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
405
273
  gl_PointSize = 1.0;
406
274
  }
407
- `;var Ol=`#version 300 es
275
+ `;var Ht=`#version 300 es
408
276
  #define SHADER_NAME gpu-aggregation-all-fs
409
277
 
410
278
  precision highp float;
@@ -419,22 +287,26 @@ void main(void) {
419
287
  discard;
420
288
  }
421
289
  fragColor.rgb = textureColor.rgb;
290
+ // if combineMinMax is true, use Alpha channel for first weights min value.
422
291
  fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
423
292
  }
424
- `;var wl=`#version 300 es
293
+ `;var bt=`#version 300 es
425
294
  #define SHADER_NAME gpu-aggregation-transform-mean-vs
426
295
  in vec4 aggregationValues;
427
296
  out vec4 meanValues;
428
297
 
429
298
  void main()
430
299
  {
300
+ // TODO: Use 64-bit division ?? not needed given this is aggregation ??
431
301
  bool isCellValid = bool(aggregationValues.w > 0.);
302
+ // aggregationValues: XYZ contain aggregated values, W contains count
432
303
  meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
433
304
  meanValues.w = aggregationValues.w;
305
+
306
+ // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
434
307
  gl_PointSize = 1.0;
435
308
  }
436
- `;var xh={minFilter:"nearest",magFilter:"nearest"};function Wt(e,t){var r=t.width,n=r===void 0?1:r,i=t.height,o=i===void 0?1:i,s=t.data,a=s===void 0?null:s,l=t.parameters,u=l===void 0?xh:l,c=e.createTexture({data:a,format:"rgba32float",mipmaps:!1,sampler:u,width:n,height:o});return c}function Dr(e,t){var r=t.id,n=t.width,i=n===void 0?1:n,o=t.height,s=o===void 0?1:o,a=t.texture,l=e.createFramebuffer({id:r,width:i,height:s,colorAttachments:[a]});return l}function Rh(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Eh(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
437
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Eh(e,t){if(e){if(typeof e=="string")return Cl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Cl(e,t)}}function Cl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Nl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ie(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nl(Object(r),!0).forEach(function(n){Bo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Bo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var wh=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],Pl={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ch=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],oe=function(){e.getAggregationData=function(n){var i=n.aggregationData,o=n.maxData,s=n.minData,a=n.maxMinData,l=n.pixelIndex,u=l*Sl,c={};return i&&(c.cellCount=i[u+3],c.cellWeight=i[u]),a?(c.maxCellWieght=a[0],c.minCellWeight=a[3]):(o&&(c.maxCellWieght=o[0],c.totalCount=o[3]),s&&(c.minCellWeight=s[0],c.totalCount=s[3])),c},e.getCellData=function(n){for(var i=n.countsData,o=n.size,s=o===void 0?1:o,a=i.length/4,l=new Float32Array(a*s),u=new Uint32Array(a),c=0;c<a;c++){for(var f=0;f<s;f++)l[c*s+f]=i[c*4+f];u[c]=i[c*4+3]}return{cellCounts:u,cellWeights:l}},e.isSupported=function(n){return Ch.every(function(i){return n.features.has(i)})};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Oh(this,e),this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=void 0,this.device=void 0,this._hasGPUSupport=void 0,this.gridAggregationModel=void 0,this.allAggregationModel=void 0,this.meanTransform=void 0,this.id=n.id||"gpu-grid-aggregator",this.device=r;var i=["blend-minmax-webgl1","texture-renderable-float32-webgl","texture-formats-float32-webgl1"];this._hasGPUSupport=this.device.info.type==="webgl2"&&i.every(function(o){return r.features.has(o)}),this._hasGPUSupport&&this._setupModels()}var t=e.prototype;return t.delete=function(){var n=this.gridAggregationModel,i=this.allAggregationModel,o=this.meanTransform,s=this.state,a=s.textures,l=s.framebuffers,u=s.maxMinFramebuffers,c=s.minFramebuffers,f=s.maxFramebuffers,h=s.meanTextures,_=s.resources;n?.destroy(),i?.destroy(),o?.destroy(),Ph([l,a,u,c,f,h,_])},t.run=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({results:{}});var i=this._normalizeAggregationParams(n);return this._hasGPUSupport||Ge.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(i)},t.getData=function(n){var i={},o=this.state.results;o[n].aggregationData||(o[n].aggregationData=o[n].aggregationBuffer.getData()),i.aggregationData=o[n].aggregationData;for(var s in Pl){var a=Pl[s];(o[n][s]||o[n][a])&&(o[n][s]=o[n][s]||o[n][a].getData(),i[s]=o[n][s])}return i},t.updateShaders=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({shaderOptions:n,modelDirty:!0})},t._normalizeAggregationParams=function(n){var i=ie(ie({},yl),n),o=i.weights;return o&&(i.weights=Nh(o)),i},t.setState=function(n){Object.assign(this.state,n)},t._getAggregateData=function(n){var i={},o=this.state,s=o.textures,a=o.framebuffers,l=o.maxMinFramebuffers,u=o.minFramebuffers,c=o.maxFramebuffers,f=o.resources,h=n.weights;for(var _ in h){i[_]={};var m=h[_],y=m.needMin,v=m.needMax,S=m.combineMaxMin;i[_].aggregationTexture=s[_],i[_].aggregationBuffer=Qe(a[_],{target:h[_].aggregationBuffer,sourceType:5126}),y&&v&&S?(i[_].maxMinBuffer=Qe(l[_],{target:h[_].maxMinBuffer,sourceType:5126}),i[_].maxMinTexture=f["".concat(_,"-maxMinTexture")]):(y&&(i[_].minBuffer=Qe(u[_],{target:h[_].minBuffer,sourceType:5126}),i[_].minTexture=f["".concat(_,"-minTexture")]),v&&(i[_].maxBuffer=Qe(c[_],{target:h[_].maxBuffer,sourceType:5126}),i[_].maxTexture=f["".concat(_,"-maxTexture")]))}return this._trackGPUResultBuffers(i,h),i},t._renderAggregateData=function(n){var i=n.cellSize,o=n.projectPoints,s=n.attributes,a=n.moduleSettings,l=n.numCol,u=n.numRow,c=n.weights,f=n.translation,h=n.scaling,_=this.state,m=_.maxMinFramebuffers,y=_.minFramebuffers,v=_.maxFramebuffers,S=[l,u],T={blend:!0,depthTest:!1,blendFunc:[1,1]},x={cellSize:i,gridSize:S,projectPoints:o,translation:f,scaling:h};for(var O in c){var P=c[O],I=P.needMin,D=P.needMax,F=I&&D&&c[O].combineMaxMin;this._renderToWeightsTexture({id:O,parameters:T,moduleSettings:a,uniforms:x,gridSize:S,attributes:s,weights:c}),F?this._renderToMaxMinTexture({id:O,parameters:ie(ie({},T),{},{blendEquation:Al}),gridSize:S,minOrMaxFb:m[O],clearParams:{clearColor:[0,0,0,Je]},combineMaxMin:F}):(I&&this._renderToMaxMinTexture({id:O,parameters:ie(ie({},T),{},{blendEquation:Mo}),gridSize:S,minOrMaxFb:y[O],clearParams:{clearColor:[Je,Je,Je,0]},combineMaxMin:F}),D&&this._renderToMaxMinTexture({id:O,parameters:ie(ie({},T),{},{blendEquation:Do}),gridSize:S,minOrMaxFb:v[O],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:F}))}},t._renderToMaxMinTexture=function(n){var i=this,o=n.id,s=n.parameters,a=n.gridSize,l=n.minOrMaxFb,u=n.combineMaxMin,c=n.clearParams,f=c===void 0?{}:c,h=this.state.framebuffers,_=this.allAggregationModel;ae(this.device,ie(ie({},f),{},{framebuffer:l,viewport:[0,0,a[0],a[1]]}),function(){Bn(i.device,{color:!0}),_.setUniforms({gridSize:a,combineMaxMin:u}),_.setBindings({uSampler:h[o].texture}),_.draw()})},t._renderToWeightsTexture=function(n){var i=this,o=n.id,s=n.parameters,a=n.moduleSettings,l=n.uniforms,u=n.gridSize,c=n.weights,f=this.state,h=f.framebuffers,_=f.equations,m=f.weightAttributes,y=this.gridAggregationModel,v=c[o].operation,S=v===W.MIN?[Je,Je,Je,0]:[0,0,0,0];if(ae(this.device,{framebuffer:h[o],viewport:[0,0,u[0],u[1]],clearColor:S},function(){Bn(i.device,{color:!0});var I={weights:m[o]};y.draw({parameters:ie(ie({},s),{},{blendEquation:_[o]}),moduleSettings:a,uniforms:l,attributes:I})}),v===W.MEAN){var T=this.state,x=T.meanTextures,O=T.textures,P={_sourceTextures:{aggregationValues:x[o]},_targetTexture:O[o],elementCount:O[o].width*O[o].height};this.meanTransform?this.meanTransform.update(P):this.meanTransform=Dh(this.device,P),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),h[o].attach(Bo({},36064,O[o]))}},t._runAggregation=function(n){this._updateModels(n),this._setupFramebuffers(n),this._renderAggregateData(n);var i=this._getAggregateData(n);return this.setState({results:i}),i},t._setupFramebuffers=function(n){var i=this.state,o=i.textures,s=i.framebuffers,a=i.maxMinFramebuffers,l=i.minFramebuffers,u=i.maxFramebuffers,c=i.meanTextures,f=i.equations,h=n.weights,_=n.numCol,m=n.numRow,y={width:_,height:m};for(var v in h){var S=h[v],T=S.needMin,x=S.needMax,O=S.combineMaxMin,P=S.operation;o[v]=h[v].aggregationTexture||o[v]||Wt(this.device,{id:"".concat(v,"-texture"),width:_,height:m}),o[v].resize(y);var I=o[v];P===W.MEAN&&(c[v]=c[v]||Wt(this.device,{id:"".concat(v,"-mean-texture"),width:_,height:m}),c[v].resize(y),I=c[v]),s[v]?s[v].attach(Bo({},36064,I)):s[v]=Dr(this.device,{id:"".concat(v,"-fb"),width:_,height:m,texture:I}),s[v].resize(y),f[v]=Fo[P]||Fo[W.SUM],(T||x)&&(T&&x&&O?a[v]||(I=h[v].maxMinTexture||this._getMinMaxTexture("".concat(v,"-maxMinTexture")),a[v]=Dr(this.device,{id:"".concat(v,"-maxMinFb"),texture:I})):(T&&(l[v]||(I=h[v].minTexture||this._getMinMaxTexture("".concat(v,"-minTexture")),l[v]=Dr(this.device,{id:"".concat(v,"-minFb"),texture:I}))),x&&(u[v]||(I=h[v].maxTexture||this._getMinMaxTexture("".concat(v,"-maxTexture")),u[v]=Dr(this.device,{id:"".concat(v,"-maxFb"),texture:I})))))}},t._getMinMaxTexture=function(n){var i=this.state.resources;return i[n]||(i[n]=Wt(this.device,{id:"resourceName"})),i[n]},t._setupModels=function(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=i.numCol,s=o===void 0?0:o,a=i.numRow,l=a===void 0?0:a,u=this.state.shaderOptions;if((n=this.gridAggregationModel)===null||n===void 0||n.destroy(),this.gridAggregationModel=Ih(this.device,u),!this.allAggregationModel){var c=s*l;this.allAggregationModel=Mh(this.device,c)}},t._setupWeightAttributes=function(n){var i=this.state.weightAttributes,o=n.weights;for(var s in o)i[s]=n.attributes[s]},t._trackGPUResultBuffers=function(n,i){var o=this.state.resources;for(var s in n)if(n[s]){var a=Rh(wh),l;try{for(a.s();!(l=a.n()).done;){var u=l.value;if(n[s][u]&&i[s][u]!==n[s][u]){var c="gpu-result-".concat(s,"-").concat(u);o[c]&&o[c].delete(),o[c]=n[s][u]}}}catch(f){a.e(f)}finally{a.f()}}},t._updateModels=function(n){var i=n.vertexCount,o=n.attributes,s=n.numCol,a=n.numRow,l=this.state.modelDirty;l&&(this._setupModels(n),this.setState({modelDirty:!1})),this._setupWeightAttributes(n),this.gridAggregationModel.setVertexCount(i),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(s*a)},e}();function Nh(e){var t={};for(var r in e)t[r]=ie(ie({},Tl),e[r]);return t}function Ph(e){e=Array.isArray(e)?e:[e],e.forEach(function(t){for(var r in t)t[r].delete()})}function Ih(e,t){var r=(0,Ge._mergeShaders)({vs:xl,fs:Rl,modules:[Ot,Ge.project32]},t);return new ee(e,ie({id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,Ge.getShaderAssembler)()},r))}function Mh(e,t){return new ee(e,{id:"All-Aggregation-Model",vs:El,fs:Ol,modules:[Ot],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function Dh(e,t){return new $e(e,ie({vs:wl,_targetTextureVarying:"meanValues"},t))}var Ht=M(Q());var ge=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function et(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array,n;if(Number.isFinite(e[0]))n=new r(e);else{n=new r(e.length*4);for(var i=0,o=0;o<e.length;o++){var s=e[o];n[i++]=s[0],n[i++]=s[1],n[i++]=s[2],n[i++]=Number.isFinite(s[3])?s[3]:255}}if(t)for(var a=0;a<n.length;a++)n[a]/=255;return n}var Il=`#version 300 es
309
+ `;var Fi={minFilter:"nearest",magFilter:"nearest"};function te(e,t){let{width:o=1,height:i=1,data:r=null,parameters:s=Fi}=t;return e.createTexture({data:r,format:"rgba32float",mipmaps:!1,sampler:s,width:o,height:i})}function Ee(e,t){let{id:o,width:i=1,height:r=1,texture:s}=t;return e.createFramebuffer({id:o,width:i,height:r,colorAttachments:[s]})}var Di=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],Wt={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},xi=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],D=class{static getAggregationData({aggregationData:t,maxData:o,minData:i,maxMinData:r,pixelIndex:s}){let a=s*Ut,_={};return t&&(_.cellCount=t[a+3],_.cellWeight=t[a]),r?(_.maxCellWieght=r[0],_.minCellWeight=r[3]):(o&&(_.maxCellWieght=o[0],_.totalCount=o[3]),i&&(_.minCellWeight=i[0],_.totalCount=i[3])),_}static getCellData({countsData:t,size:o=1}){let i=t.length/4,r=new Float32Array(i*o),s=new Uint32Array(i);for(let a=0;a<i;a++){for(let _=0;_<o;_++)r[a*o+_]=t[a*4+_];s[a]=t[a*4+3]}return{cellCounts:s,cellWeights:r}}static isSupported(t){return xi.every(o=>t.features.has(o))}constructor(t,o={}){this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=o.id||"gpu-grid-aggregator",this.device=t;let i=["blend-minmax-webgl1","texture-renderable-float32-webgl","texture-formats-float32-webgl1"];this._hasGPUSupport=this.device.info.type==="webgl2"&&i.every(r=>t.features.has(r)),this._hasGPUSupport&&this._setupModels()}delete(){let{gridAggregationModel:t,allAggregationModel:o,meanTransform:i}=this,{textures:r,framebuffers:s,maxMinFramebuffers:a,minFramebuffers:_,maxFramebuffers:n,meanTextures:l,resources:R}=this.state;t?.destroy(),o?.destroy(),i?.destroy(),Pi([s,r,a,_,n,l,R])}run(t={}){this.setState({results:{}});let o=this._normalizeAggregationParams(t);return this._hasGPUSupport||K.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(o)}getData(t){let o={},i=this.state.results;i[t].aggregationData||(i[t].aggregationData=i[t].aggregationBuffer.getData()),o.aggregationData=i[t].aggregationData;for(let r in Wt){let s=Wt[r];(i[t][r]||i[t][s])&&(i[t][r]=i[t][r]||i[t][s].getData(),o[r]=i[t][r])}return o}updateShaders(t={}){this.setState({shaderOptions:t,modelDirty:!0})}_normalizeAggregationParams(t){let o={...xt,...t},{weights:i}=o;return i&&(o.weights=Bi(i)),o}setState(t){Object.assign(this.state,t)}_getAggregateData(t){let o={},{textures:i,framebuffers:r,maxMinFramebuffers:s,minFramebuffers:a,maxFramebuffers:_,resources:n}=this.state,{weights:l}=t;for(let R in l){o[R]={};let{needMin:T,needMax:c,combineMaxMin:g}=l[R];o[R].aggregationTexture=i[R],o[R].aggregationBuffer=this.device.readPixelsToBufferWebGL(r[R],{target:l[R].aggregationBuffer,sourceType:M.FLOAT}),T&&c&&g?(o[R].maxMinBuffer=this.device.readPixelsToBufferWebGL(s[R],{target:l[R].maxMinBuffer,sourceType:M.FLOAT}),o[R].maxMinTexture=n[`${R}-maxMinTexture`]):(T&&(o[R].minBuffer=this.device.readPixelsToBufferWebGL(a[R],{target:l[R].minBuffer,sourceType:M.FLOAT}),o[R].minTexture=n[`${R}-minTexture`]),c&&(o[R].maxBuffer=this.device.readPixelsToBufferWebGL(_[R],{target:l[R].maxBuffer,sourceType:M.FLOAT}),o[R].maxTexture=n[`${R}-maxTexture`]))}return this._trackGPUResultBuffers(o,l),o}_renderAggregateData(t){let{cellSize:o,projectPoints:i,attributes:r,moduleSettings:s,numCol:a,numRow:_,weights:n,translation:l,scaling:R}=t,{maxMinFramebuffers:T,minFramebuffers:c,maxFramebuffers:g}=this.state,d=[a,_],f={blend:!0,depthTest:!1,blendFunc:[M.ONE,M.ONE]},p={cellSize:o,gridSize:d,projectPoints:i,translation:l,scaling:R};for(let N in n){let{needMin:C,needMax:O}=n[N],I=C&&O&&n[N].combineMaxMin;this._renderToWeightsTexture({id:N,parameters:f,moduleSettings:s,uniforms:p,gridSize:d,attributes:r,weights:n}),I?this._renderToMaxMinTexture({id:N,parameters:{...f,blendEquation:Bt},gridSize:d,minOrMaxFb:T[N],clearParams:{clearColor:[0,0,0,w]},combineMaxMin:I}):(C&&this._renderToMaxMinTexture({id:N,parameters:{...f,blendEquation:et},gridSize:d,minOrMaxFb:c[N],clearParams:{clearColor:[w,w,w,0]},combineMaxMin:I}),O&&this._renderToMaxMinTexture({id:N,parameters:{...f,blendEquation:tt},gridSize:d,minOrMaxFb:g[N],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:I}))}}_renderToMaxMinTexture(t){let{id:o,parameters:i,gridSize:r,minOrMaxFb:s,combineMaxMin:a,clearParams:_={}}=t,{framebuffers:n}=this.state,{allAggregationModel:l}=this;this.device.withParametersWebGL({..._,framebuffer:s,viewport:[0,0,r[0],r[1]]},()=>{this.device.clearWebGL({color:!0}),l.setUniforms({gridSize:r,combineMaxMin:a}),l.setBindings({uSampler:n[o].texture}),l.draw()})}_renderToWeightsTexture(t){let{id:o,parameters:i,moduleSettings:r,uniforms:s,gridSize:a,weights:_}=t,{framebuffers:n,equations:l,weightAttributes:R}=this.state,{gridAggregationModel:T}=this,{operation:c}=_[o],g=c===F.MIN?[w,w,w,0]:[0,0,0,0];if(this.device.withParametersWebGL({framebuffer:n[o],viewport:[0,0,a[0],a[1]],clearColor:g},()=>{this.device.clearWebGL({color:!0});let d={weights:R[o]};T.draw({parameters:{...i,blendEquation:l[o]},moduleSettings:r,uniforms:s,attributes:d})}),c===F.MEAN){let{meanTextures:d,textures:f}=this.state,p={_sourceTextures:{aggregationValues:d[o]},_targetTexture:f[o],elementCount:f[o].width*f[o].height};this.meanTransform?this.meanTransform.update(p):this.meanTransform=vi(this.device,p),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),n[o].attach({[M.COLOR_ATTACHMENT0]:f[o]})}}_runAggregation(t){this._updateModels(t),this._setupFramebuffers(t),this._renderAggregateData(t);let o=this._getAggregateData(t);return this.setState({results:o}),o}_setupFramebuffers(t){let{textures:o,framebuffers:i,maxMinFramebuffers:r,minFramebuffers:s,maxFramebuffers:a,meanTextures:_,equations:n}=this.state,{weights:l}=t,{numCol:R,numRow:T}=t,c={width:R,height:T};for(let g in l){let{needMin:d,needMax:f,combineMaxMin:p,operation:N}=l[g];o[g]=l[g].aggregationTexture||o[g]||te(this.device,{id:`${g}-texture`,width:R,height:T}),o[g].resize(c);let C=o[g];N===F.MEAN&&(_[g]=_[g]||te(this.device,{id:`${g}-mean-texture`,width:R,height:T}),_[g].resize(c),C=_[g]),i[g]?i[g].attach({[M.COLOR_ATTACHMENT0]:C}):i[g]=Ee(this.device,{id:`${g}-fb`,width:R,height:T,texture:C}),i[g].resize(c),n[g]=ot[N]||ot[F.SUM],(d||f)&&(d&&f&&p?r[g]||(C=l[g].maxMinTexture||this._getMinMaxTexture(`${g}-maxMinTexture`),r[g]=Ee(this.device,{id:`${g}-maxMinFb`,texture:C})):(d&&(s[g]||(C=l[g].minTexture||this._getMinMaxTexture(`${g}-minTexture`),s[g]=Ee(this.device,{id:`${g}-minFb`,texture:C}))),f&&(a[g]||(C=l[g].maxTexture||this._getMinMaxTexture(`${g}-maxTexture`),a[g]=Ee(this.device,{id:`${g}-maxFb`,texture:C})))))}}_getMinMaxTexture(t){let{resources:o}=this.state;return o[t]||(o[t]=te(this.device,{id:"resourceName"})),o[t]}_setupModels({numCol:t=0,numRow:o=0}={}){let{shaderOptions:i}=this.state;if(this.gridAggregationModel?.destroy(),this.gridAggregationModel=Ui(this.device,i),!this.allAggregationModel){let r=t*o;this.allAggregationModel=ui(this.device,r)}}_setupWeightAttributes(t){let{weightAttributes:o}=this.state,{weights:i}=t;for(let r in i)o[r]=t.attributes[r]}_trackGPUResultBuffers(t,o){let{resources:i}=this.state;for(let r in t)if(t[r]){for(let s of Di)if(t[r][s]&&o[r][s]!==t[r][s]){let a=`gpu-result-${r}-${s}`;i[a]&&i[a].delete(),i[a]=t[r][s]}}}_updateModels(t){let{vertexCount:o,attributes:i,numCol:r,numRow:s}=t,{modelDirty:a}=this.state;a&&(this._setupModels(t),this.setState({modelDirty:!1})),this._setupWeightAttributes(t),this.gridAggregationModel.setVertexCount(o),this.gridAggregationModel.setAttributes(i),this.allAggregationModel.setInstanceCount(r*s)}};function Bi(e){let t={};for(let o in e)t[o]={...Pt,...e[o]};return t}function Pi(e){e=Array.isArray(e)?e:[e],e.forEach(t=>{for(let o in t)t[o].delete()})}function Ui(e,t){let o=(0,K._mergeShaders)({vs:ut,fs:vt,modules:[G,K.project32]},t);return new Ne.Model(e,{id:"Grid-Aggregation-Model",vertexCount:1,drawMode:M.POINTS,shaderAssembler:(0,K.getShaderAssembler)(),...o})}function ui(e,t){return new Ne.Model(e,{id:"All-Aggregation-Model",vs:yt,fs:Ht,modules:[G],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function vi(e,t){return new Ne.TextureTransform(e,{vs:bt,_targetTextureVarying:"meanValues",...t})}var ue=h(q(),1),oe=h(x(),1);var U=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function z(e,t=!1,o=Float32Array){let i;if(Number.isFinite(e[0]))i=new o(e);else{i=new o(e.length*4);let r=0;for(let s=0;s<e.length;s++){let a=e[s];i[r++]=a[0],i[r++]=a[1],i[r++]=a[2],i[r++]=Number.isFinite(a[3])?a[3]:255}}if(t)for(let r=0;r<i.length;r++)i[r]/=255;return i}var Xt=`#version 300 es
438
310
  #define SHADER_NAME screen-grid-layer-vertex-shader
439
311
  #define RANGE_COUNT 6
440
312
 
@@ -491,11 +363,13 @@ void main(void) {
491
363
  float rangeMinMax = float(shouldUseMinMax);
492
364
  vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
493
365
  vColor = vec4(color.rgb, color.a * opacity);
366
+
367
+ // Set color to be rendered to picking fbo (also used to check for selection highlight).
494
368
  picking_setPickingColor(instancePickingColors);
495
369
 
496
370
  gl_Position = vec4(instancePositions + positions * cellScale, 1.);
497
371
  }
498
- `;var Ml=`#version 300 es
372
+ `;var Vt=`#version 300 es
499
373
  #define SHADER_NAME screen-grid-layer-fragment-shader
500
374
 
501
375
  precision highp float;
@@ -513,16 +387,7 @@ void main(void) {
513
387
 
514
388
  DECKGL_FILTER_COLOR(fragColor, geometry);
515
389
  }
516
- `;function kn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?kn=function(r){return typeof r}:kn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},kn(e)}function Dl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Uo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Dl(Object(r),!0).forEach(function(n){Fh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Dl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Bh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wn(e,t,r){return typeof Reflect<"u"&&Reflect.get?Wn=Reflect.get:Wn=function(i,o,s){var a=Uh(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Wn(e,t,r||e)}function Uh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Vt(e),e!==null););return e}function kh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ko(e,t)}function ko(e,t){return ko=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ko(e,t)}function Wh(e){var t=Xh();return function(){var n=Vt(e),i;if(t){var o=Vt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Vh(this,i)}}function Vh(e,t){if(t&&(kn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Hh(e)}function Hh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Xh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Vt(e){return Vt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Vt(e)}var zh=[0,0,0,0],Lh=[0,255,0,255],jh=["minColor","maxColor","colorRange","colorDomain"],$h={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ge},Xt=function(e){kh(r,e);var t=Wh(r);function r(){var i;Bh(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}r.isSupported=function(o){return o.features.has("texture-formats-float32-webgl1")};var n=r.prototype;return n.getShaders=function(){return{vs:Il,fs:Ml,modules:[Ht.picking]}},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})},n.shouldUpdateState=function(o){var s=o.changeFlags;return s.somethingChanged},n.updateState=function(o){Wn(Vt(r.prototype),"updateState",this).call(this,o);var s=o.oldProps,a=o.props,l=o.changeFlags,u=this.getAttributeManager();a.numInstances!==s.numInstances?u.invalidateAll():s.cellSizePixels!==a.cellSizePixels&&u.invalidate("instancePositions"),this._updateUniforms(s,a,l)},n.draw=function(o){var s=o.uniforms,a=this.props,l=a.parameters,u=a.maxTexture,c=this.props.minColor||zh,f=this.props.maxColor||Lh,h=this.props.colorDomain||[1,0],_=this.state.model;_.setUniforms(s),_.setBindings({maxTexture:u}),_.setUniforms({minColor:c,maxColor:f,colorDomain:h}),_.setParameters(Uo({depthWriteEnabled:!1},l)),_.draw(this.context.renderPass)},n.calculateInstancePositions=function(o,s){for(var a=s.numInstances,l=this.context.viewport,u=l.width,c=l.height,f=this.props.cellSizePixels,h=Math.ceil(u/f),_=o.value,m=o.size,y=0;y<a;y++){var v=y%h,S=Math.floor(y/h);_[y*m+0]=v*f/u*2-1,_[y*m+1]=1-S*f/c*2,_[y*m+2]=0}},n._getModel=function(){return new ee(this.context.device,Uo(Uo({},this.getShaders()),{},{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ut({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})}))},n._shouldUseMinMax=function(){var o=this.props,s=o.minColor,a=o.maxColor,l=o.colorDomain,u=o.colorRange;return s||a?(Ht.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(l||u)},n._updateUniforms=function(o,s,a){var l=this.state.model;if(jh.some(function(S){return o[S]!==s[S]})&&l.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),o.colorRange!==s.colorRange&&l.setUniforms({colorRange:et(s.colorRange)}),o.cellMarginPixels!==s.cellMarginPixels||o.cellSizePixels!==s.cellSizePixels||a.viewportChanged){var u=this.context.viewport,c=u.width,f=u.height,h=this.props,_=h.cellSizePixels,m=h.cellMarginPixels,y=_>m?m:0,v=new Float32Array([(_-y)/c*2,-(_-y)/f*2,1]);l.setUniforms({cellScale:v})}},r}(Ht.Layer);Xt.layerName="ScreenGridCellLayer";Xt.defaultProps=$h;var lu=M(Q());var zt=M(Q());function Fl(e,t){var r={};for(var n in e)t.includes(n)||(r[n]=e[n]);return r}function Vn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vn=function(r){return typeof r}:Vn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Vn(e)}function Bl(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Kh(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
517
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Kh(e,t){if(e){if(typeof e=="string")return Ul(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ul(e,t)}}function Ul(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Yh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fr(e,t,r){return typeof Reflect<"u"&&Reflect.get?Fr=Reflect.get:Fr=function(i,o,s){var a=qh(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Fr(e,t,r||e)}function qh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=gt(e),e!==null););return e}function Zh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wo(e,t)}function Wo(e,t){return Wo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Wo(e,t)}function Qh(e){var t=e_();return function(){var n=gt(e),i;if(t){var o=gt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Jh(this,i)}}function Jh(e,t){if(t&&(Vn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gh(e)}function Gh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function e_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gt(e){return gt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},gt(e)}var ye=function(e){Zh(r,e);var t=Qh(r);function r(){var i;Yh(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){Fr(gt(r.prototype),"initializeState",this).call(this,this.context),this.setState({ignoreProps:Fl(this.constructor._propTypes,o.data.props),dimensions:o})},n.updateState=function(o){Fr(gt(r.prototype),"updateState",this).call(this,o);var s=o.changeFlags;if(s.extensionsChanged){var a=this.getShaders({});a&&a.defines&&(a.defines.NON_INSTANCED_MODEL=1),this.updateShaders(a)}this._updateAttributes()},n.updateAttributes=function(o){this.setState({changedAttributes:o})},n.getAttributes=function(){return this.getAttributeManager().getAttributes()},n.getModuleSettings=function(){var o=this.context,s=o.viewport,a=o.mousePosition,l=o.device,u=Object.assign(Object.create(this.props),{viewport:s,mousePosition:a,picking:{isActive:0},devicePixelRatio:l.canvasContext.cssToDeviceRatio()});return u},n.updateShaders=function(o){},n.isAggregationDirty=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=o.props,l=o.oldProps,u=o.changeFlags,c=s.compareAll,f=c===void 0?!1:c,h=s.dimension,_=this.state.ignoreProps,m=h.props,y=h.accessors,v=y===void 0?[]:y,S=u.updateTriggersChanged;if(u.dataChanged)return!0;if(S){if(S.all)return!0;var T=Bl(v),x;try{for(T.s();!(x=T.n()).done;){var O=x.value;if(S[O])return!0}}catch(F){T.e(F)}finally{T.f()}}if(f)return u.extensionsChanged?!0:(0,zt._compareProps)({oldProps:l,newProps:a,ignoreProps:_,propTypes:this.constructor._propTypes});var P=Bl(m),I;try{for(P.s();!(I=P.n()).done;){var D=I.value;if(a[D]!==l[D])return!0}}catch(F){P.e(F)}finally{P.f()}return!1},n.isAttributeChanged=function(o){var s=this.state.changedAttributes;return o?s&&s[o]!==void 0:!t_(s)},n._getAttributeManager=function(){return new zt.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},r}(zt.CompositeLayer);ye.layerName="AggregationLayer";function t_(e){var t=!0;for(var r in e){t=!1;break}return t}var Vl=M(Q());function r_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=n_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
518
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function n_(e,t){if(e){if(typeof e=="string")return kl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kl(e,t)}}function kl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Hn(e,t,r){var n=r;return n.domain=function(){return e},n.range=function(){return t},n}function Wl(e,t){var r=function(i){return f_(e,t,i)};return Hn(e,t,r)}function i_(e,t){var r=function(i){return d_(e,t,i)};return Hn(e,t,r)}function o_(e,t){for(var r=e.sort(Hl),n=0,i=Math.max(1,t.length),o=new Array(i-1);++n<i;)o[n-1]=s_(r,n/i);var s=function(l){return l_(o,t,l)};return s.thresholds=function(){return o},Hn(e,t,s)}function Hl(e,t){return e-t}function s_(e,t){var r=e.length;if(t<=0||r<2)return e[0];if(t>=1)return e[r-1];var n=(r-1)*t,i=Math.floor(n),o=e[i],s=e[i+1];return o+(s-o)*(n-i)}function a_(e,t){for(var r=0,n=e.length;r<n;){var i=r+n>>>1;Hl(e[i],t)>0?n=i:r=i+1}return r}function l_(e,t,r){return t[a_(e,r)]}function u_(e,t,r,n){var i="".concat(n),o=t.get(i);return o===void 0&&(o=e.push(n),t.set(i,o)),r[(o-1)%r.length]}function c_(e,t){var r=new Map,n=[],i=r_(e),o;try{for(i.s();!(o=i.n()).done;){var s=o.value,a="".concat(s);r.has(a)||r.set(a,n.push(s))}}catch(u){i.e(u)}finally{i.f()}var l=function(c){return u_(n,r,t,c)};return Hn(e,t,l)}function f_(e,t,r){var n=e[1]-e[0];if(n<=0)return Vl.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];var i=n/t.length,o=Math.floor((r-e[0])/i),s=Math.max(Math.min(o,t.length-1),0);return t[s]}function d_(e,t,r){return(r-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function Xl(e){return e!=null}function h_(e){var t=[];return e.forEach(function(r){!t.includes(r)&&Xl(r)&&t.push(r)}),t}function zl(e,t){var r=typeof t=="function"?e.map(t):e;return r.filter(Xl)}function Ll(e,t){return zl(e,t)}function jl(e,t){return h_(zl(e,t))}function $l(e,t,r){return Math.max(t,Math.min(r,e))}function Kl(e){switch(e){case"quantize":return Wl;case"linear":return i_;case"quantile":return o_;case"ordinal":return c_;default:return Wl}}function Yl(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ql(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
519
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Vo(e,t){return p_(e)||g_(e,t)||Ql(e,t)||__()}function __(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
520
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ql(e,t){if(e){if(typeof e=="string")return ql(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ql(e,t)}}function ql(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function g_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function p_(e){if(Array.isArray(e))return e}function m_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Jl=function(t){return t.length},v_=3402823466e29,Gl=function(t){return t.points},eu=function(t){return t.index},Zl=function(t,r){return t<r?-1:t>r?1:t>=r?0:NaN},b_={getValue:Jl,getPoints:Gl,getIndex:eu,filterData:null},Lt=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:b_;m_(this,e),this.maxCount=void 0,this.maxValue=void 0,this.minValue=void 0,this.totalCount=void 0,this.aggregatedBins=void 0,this.sortedBins=void 0,this.binMap=void 0,this.aggregatedBins=this.getAggregatedBins(r,n),this._updateMinMaxValues(),this.binMap=this.getBinMap()}var t=e.prototype;return t.getAggregatedBins=function(n,i){for(var o=i.getValue,s=o===void 0?Jl:o,a=i.getPoints,l=a===void 0?Gl:a,u=i.getIndex,c=u===void 0?eu:u,f=i.filterData,h=typeof f=="function",_=n.length,m=[],y=0,v=0;v<_;v++){var S=n[v],T=l(S),x=c(S),O=h?T.filter(f):T;S.filteredPoints=h?O:null;var P=O.length?s(O):null;P!=null&&(m[y]={i:Number.isFinite(x)?x:v,value:P,counts:O.length},y++)}return m},t._percentileToIndex=function(n){var i=this.sortedBins.length;if(i<2)return[0,0];var o=n.map(function(f){return $l(f,0,100)}),s=Vo(o,2),a=s[0],l=s[1],u=Math.ceil(a/100*(i-1)),c=Math.floor(l/100*(i-1));return[u,c]},t.getBinMap=function(){var n={},i=Yl(this.aggregatedBins),o;try{for(i.s();!(o=i.n()).done;){var s=o.value;n[s.i]=s}}catch(a){i.e(a)}finally{i.f()}return n},t._updateMinMaxValues=function(){var n=0,i=0,o=v_,s=0,a=Yl(this.aggregatedBins),l;try{for(a.s();!(l=a.n()).done;){var u=l.value;n=n>u.counts?n:u.counts,i=i>u.value?i:u.value,o=o<u.value?o:u.value,s+=u.counts}}catch(c){a.e(c)}finally{a.f()}this.maxCount=n,this.maxValue=i,this.minValue=o,this.totalCount=s},t.getValueRange=function(n){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(a,l){return Zl(a.value,l.value)})),!this.sortedBins.length)return[];var i=0,o=this.sortedBins.length-1;if(Array.isArray(n)){var s=this._percentileToIndex(n);i=s[0],o=s[1]}return[this.sortedBins[i].value,this.sortedBins[o].value]},t.getValueDomainByScale=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=Vo(i,2),s=o[0],a=s===void 0?0:s,l=o[1],u=l===void 0?100:l;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(f,h){return Zl(f.value,h.value)})),!this.sortedBins.length)return[];var c=this._percentileToIndex([a,u]);return this._getScaleDomain(n,c)},t._getScaleDomain=function(n,i){var o=Vo(i,2),s=o[0],a=o[1],l=this.sortedBins;switch(n){case"quantize":case"linear":return[l[s].value,l[a].value];case"quantile":return Ll(l.slice(s,a+1),function(u){return u.value});case"ordinal":return jl(l,function(u){return u.value});default:return[l[s].value,l[a].value]}},e}();var su=M(Q());var tt=M(Q()),ru=6378e3;function Xn(e){return Number.isFinite(e)?e:0}function zn(e,t){for(var r=e.positions.value,n=1/0,i=-1/0,o=1/0,s=-1/0,a,l,u=0;u<t;u++)l=r[u*3],a=r[u*3+1],n=a<n?a:n,i=a>i?a:i,o=l<o?l:o,s=l>s?l:s;var c={xMin:Xn(o),xMax:Xn(s),yMin:Xn(n),yMax:Xn(i)};return c}function y_(e,t,r,n){var i=n.width,o=n.height,s=r===tt.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-o/2]:[-180,-90];tt.log.assert(r===tt.COORDINATE_SYSTEM.CARTESIAN||r===tt.COORDINATE_SYSTEM.LNGLAT||r===tt.COORDINATE_SYSTEM.DEFAULT);var a=e.xMin,l=e.yMin;return[-1*(tu(a-s[0],t.xOffset)+s[0]),-1*(tu(l-s[1],t.yOffset)+s[1])]}function tu(e,t){var r=e<0?-1:1,n=r<0?Math.abs(e)+t:Math.abs(e);return n=Math.floor(n/t)*t,n*r}function Ho(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!r)return{xOffset:t,yOffset:t};var n=e.yMin,i=e.yMax,o=(n+i)/2;return A_(t,o)}function Ln(e,t,r,n){var i=Ho(e,t,n!==tt.COORDINATE_SYSTEM.CARTESIAN),o=y_(e,i,n,r),s=e.xMin,a=e.yMin,l=e.xMax,u=e.yMax,c=l-s+i.xOffset,f=u-a+i.yOffset,h=Math.ceil(c/i.xOffset),_=Math.ceil(f/i.yOffset);return{gridOffset:i,translation:o,width:c,height:f,numCol:h,numRow:_}}function A_(e,t){var r=T_(e),n=S_(t,e);return{yOffset:r,xOffset:n}}function T_(e){return e/ru*(180/Math.PI)}function S_(e,t){return t/ru*(180/Math.PI)/Math.cos(e*Math.PI/180)}function nu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function x_(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nu(Object(r),!0).forEach(function(n){R_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function R_(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E_(e,t){return C_(e)||w_(e,t)||ou(e,t)||O_()}function O_(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
521
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w_(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function C_(e){if(Array.isArray(e))return e}function N_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ou(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
522
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function ou(e,t){if(e){if(typeof e=="string")return iu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return iu(e,t)}}function iu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function jt(e,t){var r=P_(e,t),n=I_(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:n}}function P_(e,t){var r=e.data,n=r===void 0?[]:r,i=e.cellSize,o=t.attributes,s=t.viewport,a=t.projectPoints,l=t.numInstances,u=o.positions.value,c=o.positions.getAccessor(),f=c.size,h=t.boundingBox||M_(o.positions,l),_=t.posOffset||[180,90],m=t.gridOffset||Ho(h,i);if(m.xOffset<=0||m.yOffset<=0)return{gridHash:{},gridOffset:m,offsets:[0,0]};var y=s.width,v=s.height,S=Math.ceil(y/m.xOffset),T=Math.ceil(v/m.yOffset),x={},O=(0,su.createIterable)(n),P=O.iterable,I=O.objectInfo,D=new Array(3),F=N_(P),X;try{for(F.s();!(X=F.n()).done;){var L=X.value;I.index++,D[0]=u[I.index*f],D[1]=u[I.index*f+1],D[2]=f>=3?u[I.index*f+2]:0;var q=a?s.project(D):D,re=E_(q,2),fe=re[0],fs=re[1];if(Number.isFinite(fe)&&Number.isFinite(fs)){var Vr=Math.floor((fs+_[1])/m.yOffset),Hr=Math.floor((fe+_[0])/m.xOffset);if(!a||Hr>=0&&Hr<S&&Vr>=0&&Vr<T){var Xr="".concat(Vr,"-").concat(Hr);x[Xr]=x[Xr]||{count:0,points:[],lonIdx:Hr,latIdx:Vr},x[Xr].count+=1,x[Xr].points.push({source:L,index:I.index})}}}}catch(Dc){F.e(Dc)}finally{F.f()}return{gridHash:x,gridOffset:m,offsets:[_[0]*-1,_[1]*-1]}}function I_(e){var t=e.gridHash,r=e.gridOffset,n=e.offsets,i=new Array(Object.keys(t).length),o=0;for(var s in t){var a=s.split("-"),l=parseInt(a[0],10),u=parseInt(a[1],10),c=o++;i[c]=x_({index:c,position:[n[0]+r.xOffset*u,n[1]+r.yOffset*l]},t[s])}return i}function M_(e,t){for(var r=e.value,n=e.getAccessor(),i=n.size,o=1/0,s=-1/0,a=1/0,l=-1/0,u,c,f=0;f<t;f++)c=r[f*i],u=r[f*i+1],Number.isFinite(c)&&Number.isFinite(u)&&(o=u<o?u:o,s=u>s?u:s,a=c<a?c:a,l=c>l?c:l);return{xMin:a,xMax:l,yMin:o,yMax:s}}function jn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?jn=function(r){return typeof r}:jn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},jn(e)}function D_(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=F_(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
523
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function F_(e,t){if(e){if(typeof e=="string")return au(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return au(e,t)}}function au(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function B_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $t(e,t,r){return typeof Reflect<"u"&&Reflect.get?$t=Reflect.get:$t=function(i,o,s){var a=U_(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},$t(e,t,r||e)}function U_(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=rt(e),e!==null););return e}function k_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xo(e,t)}function Xo(e,t){return Xo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Xo(e,t)}function W_(e){var t=X_();return function(){var n=rt(e),i;if(t){var o=rt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return V_(this,i)}}function V_(e,t){if(t&&(jn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return H_(e)}function H_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function X_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function rt(e){return rt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},rt(e)}var pt=function(e){k_(r,e);var t=W_(r);function r(){var i;B_(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){var s=o.dimensions;$t(rt(r.prototype),"initializeAggregationLayer",this).call(this,s),this.setState({layerData:{},gpuGridAggregator:new oe(this.context.device,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:jt})},n.updateState=function(o){$t(rt(r.prototype),"updateState",this).call(this,o),this.updateAggregationState(o);var s=this.state,a=s.aggregationDataDirty,l=s.aggregationWeightsDirty,u=s.gpuAggregation;if(!(this.getNumInstances()<=0)){var c=!1;(a||u&&l)&&(this._updateAggregation(o),c=!0),!u&&(a||l)&&(this._updateWeightBins(),this._uploadAggregationResults(),c=!0),this.setState({aggregationDirty:c})}},n.finalizeState=function(o){var s,a=this.state.weights.count;a&&a.aggregationBuffer&&a.aggregationBuffer.delete(),(s=this.state.gpuGridAggregator)===null||s===void 0||s.delete(),$t(rt(r.prototype),"finalizeState",this).call(this,o)},n.updateShaders=function(o){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(o)},n.updateAggregationState=function(o){lu.log.assert(!1)},n.allocateResources=function(o,s){if(this.state.numRow!==o||this.state.numCol!==s){var a=s*o*4*4,l=this.state.weights;for(var u in l){var c=l[u];c.aggregationBuffer&&c.aggregationBuffer.delete(),c.aggregationBuffer=this.context.device.createBuffer({byteLength:a,accessor:{size:4,type:5126,divisor:1}})}}},n.updateResults=function(o){var s=o.aggregationData,a=o.maxMinData,l=o.maxData,u=o.minData,c=this.state.weights.count;c&&(c.aggregationData=s,c.maxMinData=a,c.maxData=l,c.minData=u)},n._updateAggregation=function(o){var s=this.state,a=s.cpuGridAggregator,l=s.gpuGridAggregator,u=s.gridOffset,c=s.posOffset,f=s.translation,h=f===void 0?[0,0]:f,_=s.scaling,m=_===void 0?[0,0,0]:_,y=s.boundingBox,v=s.projectPoints,S=s.gpuAggregation,T=s.numCol,x=s.numRow,O=o.props,P=this.context.viewport,I=this.getAttributes(),D=this.getNumInstances();if(S){var X=this.state.weights;l.run({weights:X,cellSize:[u.xOffset,u.yOffset],numCol:T,numRow:x,translation:h,scaling:m,vertexCount:D,projectPoints:v,attributes:I,moduleSettings:this.getModuleSettings()})}else{var F=a(O,{gridOffset:u,projectPoints:v,attributes:I,viewport:P,posOffset:c,boundingBox:y});this.setState({layerData:F})}},n._updateWeightBins=function(){var o=this.state.getValue,s=new Lt(this.state.layerData.data||[],{getValue:o});this.setState({sortedBins:s})},n._uploadAggregationResults=function(){var o=this.state,s=o.numCol,a=o.numRow,l=this.state.layerData.data,u=this.state.sortedBins,c=u.aggregatedBins,f=u.minValue,h=u.maxValue,_=u.totalCount,m=4,y=s*a*m,v=new Float32Array(y).fill(0),S=D_(c),T;try{for(S.s();!(T=S.n()).done;){var x=T.value,O=l[x.i],P=O.lonIdx,I=O.latIdx,D=x.value,F=x.counts,X=(P+I*s)*m;v[X]=D,v[X+m-1]=F}}catch(fe){S.e(fe)}finally{S.f()}var L=new Float32Array([h,0,0,f]),q=new Float32Array([h,0,0,_]),re=new Float32Array([f,0,0,_]);this.updateResults({aggregationData:v,maxMinData:L,maxData:q,minData:re})},r}(ye);pt.layerName="GridAggregationLayer";function $n(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$n=function(r){return typeof r}:$n=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},$n(e)}function z_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Kt=Reflect.get:Kt=function(i,o,s){var a=L_(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Kt(e,t,r||e)}function L_(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=nt(e),e!==null););return e}function j_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zo(e,t)}function zo(e,t){return zo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},zo(e,t)}function $_(e){var t=q_();return function(){var n=nt(e),i;if(t){var o=nt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return K_(this,i)}}function K_(e,t){if(t&&($n(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Y_(e)}function Y_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function q_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function nt(e){return nt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},nt(e)}function uu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Lo(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uu(Object(r),!0).forEach(function(n){jo(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jo(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Z_=Lo(Lo({},Xt.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"}),cu="positions",Q_={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Kn=function(e){j_(r,e);var t=$_(r);function r(){var i;z_(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;if(!Xt.isSupported(this.context.device)){this.setState({supported:!1}),$o.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}Kt(nt(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Q_,getCellSize:function(u){return u.cellSizePixels}});var s={count:{size:1,operation:W.SUM,needMax:!0,maxTexture:Wt(this.context.device,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:s,subLayerData:{attributes:{}},maxTexture:s.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var a=this.getAttributeManager();a.add((o={},jo(o,cu,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),jo(o,"count",{size:3,accessor:"getWeight"}),o))},n.shouldUpdateState=function(o){var s=o.changeFlags;return this.state.supported&&s.somethingChanged},n.updateState=function(o){Kt(nt(r.prototype),"updateState",this).call(this,o)},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,s=o.maxTexture,a=o.numRow,l=o.numCol,u=o.weights,c=this.props.updateTriggers,f=u.count.aggregationBuffer,h=this.getSubLayerClass("cells",Xt);return new h(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:c}),{data:{attributes:{instanceCounts:f}},maxTexture:s,numInstances:a*l})},n.finalizeState=function(o){Kt(nt(r.prototype),"finalizeState",this).call(this,o);var s=this.state,a=s.aggregationBuffer,l=s.maxBuffer,u=s.maxTexture;a?.delete(),l?.delete(),u?.delete()},n.getPickingInfo=function(o){var s=o.info,a=s.index;if(a>=0){var l=this.state,u=l.gpuGridAggregator,c=l.gpuAggregation,f=l.weights,h=c?u.getData("count"):f.count;s.object=oe.getAggregationData(Lo({pixelIndex:a},h))}return s},n.updateResults=function(o){var s=o.aggregationData,a=o.maxData,l=this.state.weights.count;l.aggregationData=s,l.aggregationBuffer.write(s),l.maxData=a,l.maxTexture.setImageData({data:a})},n.updateAggregationState=function(o){var s=o.props.cellSizePixels,a=o.oldProps.cellSizePixels!==s,l=o.changeFlags.viewportChanged,u=o.props.gpuAggregation;this.state.gpuAggregation!==o.props.gpuAggregation&&u&&!oe.isSupported(this.context.device)&&($o.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),u=!1);var c=u!==this.state.gpuAggregation;this.setState({gpuAggregation:u});var f=this.isAttributeChanged(cu),h=this.state.dimensions,_=h.data,m=h.weights,y=f||c||l||this.isAggregationDirty(o,{compareAll:u,dimension:_}),v=this.isAggregationDirty(o,{dimension:m});this.setState({aggregationDataDirty:y,aggregationWeightsDirty:v});var S=this.context.viewport;if(l||a){var T=S.width,x=S.height,O=Math.ceil(T/s),P=Math.ceil(x/s);this.allocateResources(P,O),this.setState({scaling:[T/2,-x/2,1],gridOffset:{xOffset:s,yOffset:s},width:T,height:x,numCol:O,numRow:P})}v&&this._updateAccessors(o),(y||v)&&this._resetResults()},n._updateAccessors=function(o){var s=o.props,a=s.getWeight,l=s.aggregation,u=s.data,c=this.state.weights.count;c&&(c.getWeight=a,c.operation=W[l]),this.setState({getValue:Ut(l,a,{data:u})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},r}(pt);Kn.layerName="ScreenGridLayer";Kn.defaultProps=Z_;var mu=M(At());function Br(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Br=function(r){return typeof r}:Br=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Br(e)}function fu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ae(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fu(Object(r),!0).forEach(function(n){gu(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gu(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J_(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function du(){}var hu=["getBins","getDomain","getScaleFunc"],_u=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],G_=function(t){return t.cellSize},Yt=function(){function e(r){J_(this,e),this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=void 0,this._getAggregator=void 0,this._getCellSize=r.getCellSize||G_,this._getAggregator=r.getAggregator,this._addDimension(r.dimensions||_u)}e.defaultDimensions=function(){return _u};var t=e.prototype;return t.updateState=function(n,i){var o=n.oldProps,s=n.props,a=n.changeFlags;this.updateGetValueFuncs(o,s,a);var l=this.needsReProjectPoints(o,s,a),u=!1;if(a.dataChanged||l)this.getAggregatedData(s,i),u=!0;else{var c=this.getDimensionChanges(o,s,a)||[];c.forEach(function(f){return typeof f=="function"&&f()}),u=!0}return this.setState({aggregationDirty:u}),this.state},t.setState=function(n){this.state=Ae(Ae({},this.state),n)},t.setDimensionState=function(n,i){this.setState({dimensions:Ae(Ae({},this.state.dimensions),{},gu({},n,Ae(Ae({},this.state.dimensions[n]),i)))})},t.normalizeResult=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n.hexagons?Ae({data:n.hexagons},n):n.layerData?Ae({data:n.layerData},n):n},t.getAggregatedData=function(n,i){var o=this._getAggregator(n),s=o(n,i);this.setState({layerData:this.normalizeResult(s)}),this.changeFlags={layerData:!0},this.getSortedBins(n)},t.updateGetValueFuncs=function(n,i,o){for(var s in this.dimensionUpdaters){var a=this.dimensionUpdaters[s].getBins.triggers,l=a.value,u=a.weight,c=a.aggregation,f=i[l.prop],h=this.needUpdateDimensionStep(this.dimensionUpdaters[s].getBins,n,i,o);h&&(f?f=bl(f,{data:i.data}):f=Ut(i[c.prop],i[u.prop],{data:i.data})),f&&this.setDimensionState(s,{getValue:f})}},t.needsReProjectPoints=function(n,i,o){return this._getCellSize(n)!==this._getCellSize(i)||this._getAggregator(n)!==this._getAggregator(i)||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPosition)},t.addDimension=function(n){this._addDimension(n)},t._addDimension=function(){var n=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(o){var s=o.key;n.dimensionUpdaters[s]=n.getDimensionUpdaters(o),n.state.dimensions[s]={getValue:null,domain:null,sortedBins:null,scaleFunc:du}})},t.getDimensionUpdaters=function(n){var i=n.key,o=n.accessor,s=n.pickingInfo,a=n.getBins,l=n.getDomain,u=n.getScaleFunc,c=n.nullValue;return{key:i,accessor:o,pickingInfo:s,getBins:Ae({updater:this.getDimensionSortedBins.bind(this)},a),getDomain:Ae({updater:this.getDimensionValueDomain.bind(this)},l),getScaleFunc:Ae({updater:this.getDimensionScale.bind(this)},u),attributeAccessor:this.getSubLayerDimensionAttribute(i,c)}},t.needUpdateDimensionStep=function(n,i,o,s){return Object.values(n.triggers).some(function(a){return a.updateTrigger?s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged[a.updateTrigger]):i[a.prop]!==o[a.prop]})},t.getDimensionChanges=function(n,i,o){var s=this,a=[],l=function(f){var h=hu.find(function(_){return s.needUpdateDimensionStep(s.dimensionUpdaters[f][_],n,i,o)});h&&a.push(s.dimensionUpdaters[f][h].updater.bind(s,i,s.dimensionUpdaters[f]))};for(var u in this.dimensionUpdaters)l(u);return a.length?a:null},t.getUpdateTriggers=function(n){var i=this,o=n.updateTriggers||{},s={},a=function(c){var f=i.dimensionUpdaters[c].accessor;s[f]={},hu.forEach(function(h){Object.values(i.dimensionUpdaters[c][h].triggers).forEach(function(_){var m=_.prop,y=_.updateTrigger;if(y){var v=o[y];Br(v)==="object"&&!Array.isArray(v)?Object.assign(s[f],v):v!==void 0&&(s[f][m]=v)}else s[f][m]=n[m]})})};for(var l in this.dimensionUpdaters)a(l);return s},t.getSortedBins=function(n){for(var i in this.dimensionUpdaters)this.getDimensionSortedBins(n,this.dimensionUpdaters[i])},t.getDimensionSortedBins=function(n,i){var o=i.key,s=this.state.dimensions[o].getValue,a=new Lt(this.state.layerData.data||[],{getValue:s,filterData:n._filterData});this.setDimensionState(o,{sortedBins:a}),this.getDimensionValueDomain(n,i)},t.getDimensionValueDomain=function(n,i){var o=i.getDomain,s=i.key,a=o.triggers,l=a.lowerPercentile,u=a.upperPercentile,c=a.scaleType,f=this.state.dimensions[s].sortedBins.getValueDomainByScale(n[c.prop],[n[l.prop],n[u.prop]]);this.setDimensionState(s,{valueDomain:f}),this.getDimensionScale(n,i)},t.getDimensionScale=function(n,i){var o=i.key,s=i.getScaleFunc,a=i.getDomain,l=s.triggers,u=l.domain,c=l.range,f=a.triggers.scaleType,h=s.onSet,_=n[c.prop],m=n[u.prop]||this.state.dimensions[o].valueDomain,y=Kl(f&&n[f.prop]),v=y(m,_);Br(h)==="object"&&typeof n[h.props]=="function"&&n[h.props](v.domain()),this.setDimensionState(o,{scaleFunc:v})},t.getSubLayerDimensionAttribute=function(n,i){var o=this;return function(s){var a=o.state.dimensions[n],l=a.sortedBins,u=a.scaleFunc,c=l.binMap[s.index];if(c&&c.counts===0)return i;var f=c&&c.value,h=u.domain(),_=f>=h[0]&&f<=h[h.length-1];return _?u(f):i}},t.getSubLayerAccessors=function(n){var i={};for(var o in this.dimensionUpdaters){var s=this.dimensionUpdaters[o].accessor;i[s]=this.getSubLayerDimensionAttribute(n,o)}return i},t.getPickingInfo=function(n){var i=n.info,o=i.picked&&i.index>-1,s=null;if(o){var a=this.state.layerData.data[i.index],l={};for(var u in this.dimensionUpdaters){var c=this.dimensionUpdaters[u].pickingInfo,f=this.state.dimensions[u].sortedBins,h=f.binMap[a.index]&&f.binMap[a.index].value;l[c]=h}s=Object.assign(l,a,{points:a.filteredPoints||a.points})}return i.picked=Boolean(s),i.object=s,i},t.getAccessor=function(n){return this.dimensionUpdaters.hasOwnProperty(n)?this.dimensionUpdaters[n].attributeAccessor:du},e}();function Yn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yn=function(r){return typeof r}:Yn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Yn(e)}function eg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qn(e,t,r){return typeof Reflect<"u"&&Reflect.get?qn=Reflect.get:qn=function(i,o,s){var a=tg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},qn(e,t,r||e)}function tg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=qt(e),e!==null););return e}function rg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ko(e,t)}function Ko(e,t){return Ko=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ko(e,t)}function ng(e){var t=sg();return function(){var n=qt(e),i;if(t){var o=qt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ig(this,i)}}function ig(e,t){if(t&&(Yn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return og(e)}function og(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function qt(e){return qt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},qt(e)}function pu(){}var ag={colorDomain:null,colorRange:ge,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:pu,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:pu,gridAggregator:jt,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},mt=function(e){rg(r,e);var t=ng(r);function r(){var i;eg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new Yt({getAggregator:function(l){return l.gridAggregator},getCellSize:function(l){return l.cellSize}});this.state={cpuAggregator:o,aggregatorState:o.state};var s=this.getAttributeManager();s.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){qn(qt(r.prototype),"updateState",this).call(this,o),this.setState({aggregatorState:this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})},n.getPickingInfo=function(o){var s=o.info;return this.state.cpuAggregator.getPickingInfo({info:s})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,s=o.elevationScale,a=o.extruded,l=o.cellSize,u=o.coverage,c=o.material,f=o.transitions,h=this.state.cpuAggregator,_=this.getSubLayerClass("grid-cell",mu.GridCellLayer),m=this._getSublayerUpdateTriggers();return new _({cellSize:l,coverage:u,material:c,elevationScale:s,extruded:a,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:f&&{getFillColor:f.getColorValue||f.getColorWeight,getElevation:f.getElevationValue||f.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:m}),{data:h.state.layerData.data})},r}(ye);mt.layerName="CPUGridLayer";mt.defaultProps=ag;var Su=M(Q()),xu=M(At());var Zt=Math.PI/3,lg=[0,Zt,2*Zt,3*Zt,4*Zt,5*Zt];function ug(e){return e[0]}function cg(e){return e[1]}function Yo(){var e=0,t=0,r=1,n=1,i=ug,o=cg,s,a,l;function u(f){var h={},_=[],m,y=f.length;for(m=0;m<y;++m)if(!(isNaN(S=+i.call(null,v=f[m],m,f))||isNaN(T=+o.call(null,v,m,f)))){var v,S,T,x=Math.round(T=T/l),O=Math.round(S=S/a-(x&1)/2),P=T-x;if(Math.abs(P)*3>1){var I=S-O,D=O+(S<O?-1:1)/2,F=x+(T<x?-1:1),X=S-D,L=T-F;I*I+P*P>X*X+L*L&&(O=D+(x&1?1:-1)/2,x=F)}var q=O+"-"+x,re=h[q];re?re.push(v):(_.push(re=h[q]=[v]),re.x=(O+(x&1)/2)*a,re.y=x*l)}return _}function c(f){var h=0,_=0;return lg.map(function(m){var y=Math.sin(m)*f,v=-Math.cos(m)*f,S=y-h,T=v-_;return h=y,_=v,[S,T]})}return u.hexagon=function(f){return"m"+c(f==null?s:+f).join("l")+"z"},u.centers=function(){for(var f=[],h=Math.round(t/l),_=Math.round(e/a),m=h*l;m<n+s;m+=l,++h)for(var y=_*a+(h&1)*a/2;y<r+a/2;y+=a)f.push([y,m]);return f},u.mesh=function(){var f=c(s).slice(0,4).join("l");return u.centers().map(function(h){return"M"+h+"m"+f}).join("")},u.x=function(f){return arguments.length?(i=f,u):i},u.y=function(f){return arguments.length?(o=f,u):o},u.radius=function(f){return arguments.length?(s=+f,a=s*2*Math.sin(Zt),l=s*1.5,u):s},u.size=function(f){return arguments.length?(e=t=0,r=+f[0],n=+f[1],u):[r-e,n-t]},u.extent=function(f){return arguments.length?(e=+f[0][0],t=+f[0][1],r=+f[1][0],n=+f[1][1],u):[[e,t],[r,n]]},u.radius(1)}var Zn=M(Q());function fg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=dg(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
524
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function dg(e,t){if(e){if(typeof e=="string")return vu(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return vu(e,t)}}function vu(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function bu(e,t){var r=e.data,n=e.radius,i=t.viewport,o=t.attributes,s=r.length?hg(r,t):null,a=_g(n,i,s),l=[],u=(0,Zn.createIterable)(r),c=u.iterable,f=u.objectInfo,h=o.positions.value,_=o.positions.getAccessor(),m=_.size,y=fg(c),v;try{for(y.s();!(v=y.n()).done;){var S=v.value;f.index++;var T=f.index*m,x=[h[T],h[T+1]],O=Number.isFinite(x[0])&&Number.isFinite(x[1]);O?l.push({screenCoord:i.projectFlat(x),source:S,index:f.index}):Zn.log.warn("HexagonLayer: invalid position")()}}catch(D){y.e(D)}finally{y.f()}var P=Yo().radius(a).x(function(D){return D.screenCoord[0]}).y(function(D){return D.screenCoord[1]}),I=P(l);return{hexagons:I.map(function(D,F){return{position:i.unprojectFlat([D.x,D.y]),points:D,index:F}}),radiusCommon:a}}function hg(e,t){var r=t.attributes,n=r.positions.value,i=r.positions.getAccessor(),o=i.size,s=1/0,a=1/0,l=-1/0,u=-1/0,c;for(c=0;c<o*e.length;c+=o){var f=n[c],h=n[c+1],_=Number.isFinite(f)&&Number.isFinite(h);_&&(s=Math.min(f,s),l=Math.max(f,l),a=Math.min(h,a),u=Math.max(h,u))}return[s,a,l,u].every(Number.isFinite)?[(s+l)/2,(a+u)/2]:null}function _g(e,t,r){var n=t.getDistanceScales(r),i=n.unitsPerMeter;return e*i[0]}function Qn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Qn=function(r){return typeof r}:Qn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Qn(e)}function yu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Au(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yu(Object(r),!0).forEach(function(n){gg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Jn(e,t,r){return typeof Reflect<"u"&&Reflect.get?Jn=Reflect.get:Jn=function(i,o,s){var a=mg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},Jn(e,t,r||e)}function mg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Qt(e),e!==null););return e}function vg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&qo(e,t)}function qo(e,t){return qo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},qo(e,t)}function bg(e){var t=Tg();return function(){var n=Qt(e),i;if(t){var o=Qt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return yg(this,i)}}function yg(e,t){if(t&&(Qn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ag(e)}function Ag(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Tg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Qt(e){return Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Qt(e)}function Tu(){}var Sg={colorDomain:null,colorRange:ge,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Tu,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Tu,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:bu,getPosition:{type:"accessor",value:function(t){return t.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},Gn=function(e){vg(r,e);var t=bg(r);function r(){var i;pg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new Yt({getAggregator:function(l){return l.hexagonAggregator},getCellSize:function(l){return l.radius}});this.state={cpuAggregator:o,aggregatorState:o.state,vertices:null};var s=this.getAttributeManager();s.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){if(Jn(Qt(r.prototype),"updateState",this).call(this,o),o.changeFlags.propsOrDataChanged){var s=this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==s.layerData){var a=s.layerData||{},l=a.hexagonVertices;this.setState({vertices:l&&this.convertLatLngToMeterOffset(l)})}this.setState({aggregatorState:s})}},n.convertLatLngToMeterOffset=function(o){var s=this.context.viewport;if(Array.isArray(o)&&o.length===6){var a=o[0],l=o[3],u=[(a[0]+l[0])/2,(a[1]+l[1])/2],c=s.projectFlat(u),f=s.getDistanceScales(u),h=f.metersPerUnit,_=o.map(function(m){var y=s.projectFlat(m);return[(y[0]-c[0])*h[0],(y[1]-c[1])*h[1]]});return _}return Su.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null},n.getPickingInfo=function(o){var s=o.info;return this.state.cpuAggregator.getPickingInfo({info:s})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,s=o.elevationScale,a=o.extruded,l=o.coverage,u=o.material,c=o.transitions,f=this.state,h=f.aggregatorState,_=f.vertices,m=this.getSubLayerClass("hexagon-cell",xu.ColumnLayer),y=this._getSublayerUpdateTriggers(),v=_?{vertices:_,radius:1}:{radius:h.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new m(Au(Au({},v),{},{diskResolution:6,elevationScale:s,extruded:a,coverage:l,material:u,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:c&&{getFillColor:c.getColorValue||c.getColorWeight,getElevation:c.getElevationValue||c.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:y}),{data:h.layerData.data})},r}(ye);Gn.layerName="HexagonLayer";Gn.defaultProps=Sg;var oi=M(At());var Ju=M(Q());var E;function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R=.5,N=1/6,b={N:[0,R],E:[R,0],S:[0,-R],W:[-R,0],NE:[R,R],NW:[-R,R],SE:[R,-R],SW:[-R,-R]},Jt=[b.W,b.SW,b.S],Gt=[b.S,b.SE,b.E],er=[b.E,b.NE,b.N],tr=[b.NW,b.W,b.N],rr=[[-R,N],[-R,-N],[-N,-R],[N,-R]],nr=[[-N,-R],[N,-R],[R,-N],[R,N]],ir=[[R,-N],[R,N],[N,R],[-N,R]],or=[[-R,N],[-R,-N],[N,R],[-N,R]],Ru=[b.W,b.SW,b.SE,b.E],Eu=[b.S,b.SE,b.NE,b.N],Ou=[b.NW,b.W,b.E,b.NE],wu=[b.NW,b.SW,b.S,b.N],Cu=[[-R,N],[-R,-N],[R,-N],[R,N]],Nu=[[-N,-R],[N,-R],[N,R],[-N,R]],xg=[b.NW,b.SW,b.SE,b.NE],Pu=[b.NW,b.SW,b.SE,b.E,b.N],Iu=[b.W,b.SW,b.SE,b.NE,b.N],Mu=[b.NW,b.W,b.S,b.SE,b.NE],Du=[b.NW,b.SW,b.S,b.E,b.NE],Fu=[b.NW,b.W,[R,-N],[R,N],b.N],Bu=[[-N,-R],[N,-R],b.E,b.NE,b.N],Uu=[[-R,N],[-R,-N],b.S,b.SE,b.E],ku=[b.W,b.SW,b.S,[N,R],[-N,R]],Wu=[b.NW,b.W,[-N,-R],[N,-R],b.N],Vu=[[-R,N],[-R,-N],b.E,b.NE,b.N],Hu=[b.S,b.SE,b.E,[N,R],[-N,R]],Xu=[b.W,b.SW,b.S,[R,-N],[R,N]],zu=[b.W,b.SW,b.SE,b.E,[N,R],[-N,R]],Lu=[[-R,N],[-R,-N],b.S,b.SE,b.NE,b.N],ju=[b.NW,b.W,[-N,-R],[N,-R],b.E,b.NE],$u=[b.NW,b.SW,b.S,[R,-N],[R,N],b.N],sr=[b.W,b.SW,b.S,b.E,b.NE,b.N],ar=[b.NW,b.W,b.S,b.SE,b.E,b.N],ei=[[-R,N],[-R,-N],[-N,-R],[N,-R],b.E,b.NE,b.N],ti=[b.W,b.SW,b.S,[R,-N],[R,N],[N,R],[-N,R]],ri=[b.NW,b.W,[-N,-R],[N,-R],[R,-N],[R,N],b.N],ni=[[-R,N],[-R,-N],b.S,b.SE,b.E,[N,R],[-N,R]],Ku=[[-R,N],[-R,-N],[-N,-R],[N,-R],[R,-N],[R,N],[N,R],[-N,R]],Yu={0:[],1:[[b.W,b.S]],2:[[b.S,b.E]],3:[[b.W,b.E]],4:[[b.N,b.E]],5:{0:[[b.W,b.S],[b.N,b.E]],1:[[b.W,b.N],[b.S,b.E]]},6:[[b.N,b.S]],7:[[b.W,b.N]],8:[[b.W,b.N]],9:[[b.N,b.S]],10:{0:[[b.W,b.N],[b.S,b.E]],1:[[b.W,b.S],[b.N,b.E]]},11:[[b.N,b.E]],12:[[b.W,b.E]],13:[[b.S,b.E]],14:[[b.W,b.S]],15:[]};function C(e){return parseInt(e,4)}var qu=(E={},w(E,C("0000"),[]),w(E,C("2222"),[]),w(E,C("2221"),[Jt]),w(E,C("2212"),[Gt]),w(E,C("2122"),[er]),w(E,C("1222"),[tr]),w(E,C("0001"),[Jt]),w(E,C("0010"),[Gt]),w(E,C("0100"),[er]),w(E,C("1000"),[tr]),w(E,C("2220"),[rr]),w(E,C("2202"),[nr]),w(E,C("2022"),[ir]),w(E,C("0222"),[or]),w(E,C("0002"),[rr]),w(E,C("0020"),[nr]),w(E,C("0200"),[ir]),w(E,C("2000"),[or]),w(E,C("0011"),[Ru]),w(E,C("0110"),[Eu]),w(E,C("1100"),[Ou]),w(E,C("1001"),[wu]),w(E,C("2211"),[Ru]),w(E,C("2112"),[Eu]),w(E,C("1122"),[Ou]),w(E,C("1221"),[wu]),w(E,C("2200"),[Cu]),w(E,C("2002"),[Nu]),w(E,C("0022"),[Cu]),w(E,C("0220"),[Nu]),w(E,C("1111"),[xg]),w(E,C("1211"),[Pu]),w(E,C("2111"),[Iu]),w(E,C("1112"),[Mu]),w(E,C("1121"),[Du]),w(E,C("1011"),[Pu]),w(E,C("0111"),[Iu]),w(E,C("1110"),[Mu]),w(E,C("1101"),[Du]),w(E,C("1200"),[Fu]),w(E,C("0120"),[Bu]),w(E,C("0012"),[Uu]),w(E,C("2001"),[ku]),w(E,C("1022"),[Fu]),w(E,C("2102"),[Bu]),w(E,C("2210"),[Uu]),w(E,C("0221"),[ku]),w(E,C("1002"),[Wu]),w(E,C("2100"),[Vu]),w(E,C("0210"),[Hu]),w(E,C("0021"),[Xu]),w(E,C("1220"),[Wu]),w(E,C("0122"),[Vu]),w(E,C("2012"),[Hu]),w(E,C("2201"),[Xu]),w(E,C("0211"),[zu]),w(E,C("2110"),[Lu]),w(E,C("1102"),[ju]),w(E,C("1021"),[$u]),w(E,C("2011"),[zu]),w(E,C("0112"),[Lu]),w(E,C("1120"),[ju]),w(E,C("1201"),[$u]),w(E,C("2101"),[sr]),w(E,C("0121"),[sr]),w(E,C("1012"),[ar]),w(E,C("1210"),[ar]),w(E,C("0101"),{0:[Jt,er],1:[sr],2:[sr]}),w(E,C("1010"),{0:[tr,Gt],1:[ar],2:[ar]}),w(E,C("2121"),{0:[sr],1:[sr],2:[Jt,er]}),w(E,C("1212"),{0:[ar],1:[ar],2:[tr,Gt]}),w(E,C("2120"),{0:[ei],1:[ei],2:[rr,er]}),w(E,C("2021"),{0:[ti],1:[ti],2:[Jt,ir]}),w(E,C("1202"),{0:[ri],1:[ri],2:[tr,nr]}),w(E,C("0212"),{0:[ni],1:[ni],2:[Gt,or]}),w(E,C("0102"),{0:[rr,er],1:[ei],2:[ei]}),w(E,C("0201"),{0:[Jt,ir],1:[ti],2:[ti]}),w(E,C("1020"),{0:[tr,nr],1:[ri],2:[ri]}),w(E,C("2010"),{0:[Gt,or],1:[ni],2:[ni]}),w(E,C("2020"),{0:[or,nr],1:[Ku],2:[rr,ir]}),w(E,C("0202"),{0:[ir,rr],1:[Ku],2:[or,nr]}),E);function Zu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Qu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(r),!0).forEach(function(n){Rg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var vt={ISO_LINES:1,ISO_BANDS:2},Eg={zIndex:0,zOffset:.005};function Ur(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function Gu(e){var t=e.cellWeights,r=e.x,n=e.y,i=e.width,o=e.height,s=e.threshold;e.thresholdValue&&(Ju.log.deprecated("thresholdValue","threshold")(),s=e.thresholdValue);var a=r<0,l=r>=i-1,u=n<0,c=n>=o-1,f=a||l||u||c,h={},_={};a||c?_.top=0:(h.top=t[(n+1)*i+r],_.top=Ur(h.top,s)),l||c?_.topRight=0:(h.topRight=t[(n+1)*i+r+1],_.topRight=Ur(h.topRight,s)),l||u?_.right=0:(h.right=t[n*i+r+1],_.right=Ur(h.right,s)),a||u?_.current=0:(h.current=t[n*i+r],_.current=Ur(h.current,s));var m=_.top,y=_.topRight,v=_.right,S=_.current,T=-1;Number.isFinite(s)&&(T=m<<3|y<<2|v<<1|S),Array.isArray(s)&&(T=m<<6|y<<4|v<<2|S);var x=0;return f||(x=Ur((h.top+h.topRight+h.right+h.current)/4,s)),{code:T,meanCode:x}}function Zo(e){var t=e.gridOrigin,r=e.cellSize,n=e.x,i=e.y,o=e.code,s=e.meanCode,a=e.type,l=a===void 0?vt.ISO_LINES:a,u=Qu(Qu({},Eg),e.thresholdData),c=l===vt.ISO_BANDS?qu[o]:Yu[o];Array.isArray(c)||(c=c[s]);var f=u.zIndex*u.zOffset,h=(n+1)*r[0],_=(i+1)*r[1],m=t[0]+h,y=t[1]+_;if(l===vt.ISO_BANDS){var v=[];return c.forEach(function(T){var x=[];T.forEach(function(O){var P=m+O[0]*r[0],I=y+O[1]*r[1];x.push([P,I,f])}),v.push(x)}),v}var S=[];return c.forEach(function(T){T.forEach(function(x){var O=m+x[0]*r[0],P=y+x[1]*r[1];S.push([O,P,f])})}),S}function ec(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Og(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
525
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function Og(e,t){if(e){if(typeof e=="string")return tc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return tc(e,t)}}function tc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function rc(e){var t=e.thresholdData,r=e.cellWeights,n=e.gridSize,i=e.gridOrigin,o=e.cellSize,s=[],a=[],l=n[0],u=n[1],c=0,f=0,h=ec(t),_;try{for(h.s();!(_=h.n()).done;)for(var m=_.value,y=m.contour,v=y.threshold,S=-1;S<l;S++)for(var T=-1;T<u;T++){var x=Gu({cellWeights:r,threshold:v,x:S,y:T,width:l,height:u}),O=x.code,P=x.meanCode,I={type:vt.ISO_BANDS,gridOrigin:i,cellSize:o,x:S,y:T,width:l,height:u,code:O,meanCode:P,thresholdData:m};if(Array.isArray(v)){I.type=vt.ISO_BANDS;var D=Zo(I),F=ec(D),X;try{for(F.s();!(X=F.n()).done;){var L=X.value;a[f++]={vertices:L,contour:y}}}catch(fe){F.e(fe)}finally{F.f()}}else{I.type=vt.ISO_LINES;for(var q=Zo(I),re=0;re<q.length;re+=2)s[c++]={start:q[re],end:q[re+1],contour:y}}}}catch(fe){h.e(fe)}finally{h.f()}return{contourSegments:s,contourPolygons:a}}var sc=M(Q());function ii(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ii=function(r){return typeof r}:ii=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ii(e)}function nc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kr(e,t,r){return typeof Reflect<"u"&&Reflect.get?kr=Reflect.get:kr=function(i,o,s){var a=Cg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},kr(e,t,r||e)}function Cg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=bt(e),e!==null););return e}function Ng(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qo(e,t)}function Qo(e,t){return Qo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Qo(e,t)}function Pg(e){var t=Dg();return function(){var n=bt(e),i;if(t){var o=bt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ig(this,i)}}function Ig(e,t){if(t&&(ii(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mg(e)}function Mg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function bt(e){return bt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},bt(e)}var ic=[255,255,255,255],Fg=1,Bg=1,Ug={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:Bg}],optional:!0,compare:3},zOffset:.005},oc="positions",kg={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},si=function(e){Ng(r,e);var t=Pg(r);function r(){var i;wg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;kr(bt(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:kg}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:W.SUM}}});var s=this.getAttributeManager();s.add((o={},nc(o,oc,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),nc(o,"count",{size:3,accessor:"getWeight"}),o))},n.updateState=function(o){kr(bt(r.prototype),"updateState",this).call(this,o);var s=!1,a=o.oldProps,l=o.props,u=this.state.aggregationDirty;(a.contours!==l.contours||a.zOffset!==l.zOffset)&&(s=!0,this._updateThresholdData(o.props)),this.getNumInstances()>0&&(u||s)&&this._generateContours()},n.renderLayers=function(){var o=this.state.contourData,s=o.contourSegments,a=o.contourPolygons,l=this.getSubLayerClass("lines",oi.LineLayer),u=this.getSubLayerClass("bands",oi.SolidPolygonLayer),c=s&&s.length>0&&new l(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(_){return _.start},getTargetPosition:function(_){return _.end},getColor:function(_){return _.contour.color||ic},getWidth:function(_){return _.contour.strokeWidth||Fg}}),f=a&&a.length>0&&new u(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(_){return _.vertices},getFillColor:function(_){return _.contour.color||ic}});return[c,f]},n.updateAggregationState=function(o){var s=o.props,a=o.oldProps,l=s.cellSize,u=s.coordinateSystem,c=this.context.viewport,f=a.cellSize!==l,h=s.gpuAggregation;this.state.gpuAggregation!==s.gpuAggregation&&h&&!oe.isSupported(this.context.device)&&(sc.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),h=!1);var _=h!==this.state.gpuAggregation;this.setState({gpuAggregation:h});var m=this.state.dimensions,y=this.isAttributeChanged(oc),v=m.data,S=m.weights,T=this.state.boundingBox;if(y&&(T=zn(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),y||f){var x=Ln(T,l,c,u),O=x.gridOffset,P=x.translation,I=x.width,D=x.height,F=x.numCol,X=x.numRow;this.allocateResources(X,F),this.setState({gridOffset:O,boundingBox:T,translation:P,posOffset:P.slice(),gridOrigin:[-1*P[0],-1*P[1]],width:I,height:D,numCol:F,numRow:X})}var L=y||_||this.isAggregationDirty(o,{dimension:v,compareAll:h}),q=this.isAggregationDirty(o,{dimension:S});q&&this._updateAccessors(o),(L||q)&&this._resetResults(),this.setState({aggregationDataDirty:L,aggregationWeightsDirty:q})},n._updateAccessors=function(o){var s=o.props,a=s.getWeight,l=s.aggregation,u=s.data,c=this.state.weights.count;c&&(c.getWeight=a,c.operation=W[l]),this.setState({getValue:Ut(l,a,{data:u})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},n._generateContours=function(){var o=this.state,s=o.numCol,a=o.numRow,l=o.gridOrigin,u=o.gridOffset,c=o.thresholdData,f=this.state.weights.count,h=f.aggregationData;h||(h=f.aggregationBuffer.readSyncWebGL2(),f.aggregationData=h);var _=oe.getCellData({countsData:h}),m=_.cellWeights,y=rc({thresholdData:c,cellWeights:m,gridSize:[s,a],gridOrigin:l,cellSize:[u.xOffset,u.yOffset]});this.setState({contourData:y})},n._updateThresholdData=function(o){for(var s=o.contours,a=o.zOffset,l=s.length,u=new Array(l),c=0;c<l;c++){var f=s[c];u[c]={contour:f,zIndex:f.zIndex||c,zOffset:a}}this.setState({thresholdData:u})},r}(pt);si.layerName="ContourLayer";si.defaultProps=Ug;var pc=M(Q());var _c=M(Q());var ce=M(Q());var ac=`#version 300 es
390
+ `;var yi=[0,0,0,0],Hi=[0,255,0,255],bi=["minColor","maxColor","colorRange","colorDomain"],Wi={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:U},Ue=class extends oe.Layer{static isSupported(t){return t.features.has("texture-formats-float32-webgl1")}getShaders(){return{vs:Xt,fs:Vt,modules:[oe.picking]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){super.updateState(t);let{oldProps:o,props:i,changeFlags:r}=t,s=this.getAttributeManager();i.numInstances!==o.numInstances?s.invalidateAll():o.cellSizePixels!==i.cellSizePixels&&s.invalidate("instancePositions"),this._updateUniforms(o,i,r)}draw({uniforms:t}){let{parameters:o,maxTexture:i}=this.props,r=this.props.minColor||yi,s=this.props.maxColor||Hi,a=this.props.colorDomain||[1,0],_=this.state.model;_.setUniforms(t),_.setBindings({maxTexture:i}),_.setUniforms({minColor:r,maxColor:s,colorDomain:a}),_.setParameters({depthWriteEnabled:!1,...o}),_.draw(this.context.renderPass)}calculateInstancePositions(t,{numInstances:o}){let{width:i,height:r}=this.context.viewport,{cellSizePixels:s}=this.props,a=Math.ceil(i/s),{value:_,size:n}=t;for(let l=0;l<o;l++){let R=l%a,T=Math.floor(l/a);_[l*n+0]=R*s/i*2-1,_[l*n+1]=1-T*s/r*2,_[l*n+2]=0}}_getModel(){return new ue.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ue.Geometry({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})})}_shouldUseMinMax(){let{minColor:t,maxColor:o,colorDomain:i,colorRange:r}=this.props;return t||o?(oe.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(i||r)}_updateUniforms(t,o,i){let r=this.state.model;if(bi.some(s=>t[s]!==o[s])&&r.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),t.colorRange!==o.colorRange&&r.setUniforms({colorRange:z(o.colorRange)}),t.cellMarginPixels!==o.cellMarginPixels||t.cellSizePixels!==o.cellSizePixels||i.viewportChanged){let{width:s,height:a}=this.context.viewport,{cellSizePixels:_,cellMarginPixels:n}=this.props,l=_>n?n:0,R=new Float32Array([(_-l)/s*2,-(_-l)/a*2,1]);r.setUniforms({cellScale:R})}}},$=Ue;(()=>{Ue.layerName="ScreenGridCellLayer"})(),(()=>{Ue.defaultProps=Wi})();var io=h(x(),1);var ie=h(x(),1);function wt(e,t){let o={};for(let i in e)t.includes(i)||(o[i]=e[i]);return o}var it=class extends ie.CompositeLayer{initializeAggregationLayer(t){super.initializeState(this.context),this.setState({ignoreProps:wt(this.constructor._propTypes,t.data.props),dimensions:t})}updateState(t){super.updateState(t);let{changeFlags:o}=t;if(o.extensionsChanged){let i=this.getShaders({});i&&i.defines&&(i.defines.NON_INSTANCED_MODEL=1),this.updateShaders(i)}this._updateAttributes()}updateAttributes(t){this.setState({changedAttributes:t})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:t,mousePosition:o,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:t,mousePosition:o,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(t){}isAggregationDirty(t,o={}){let{props:i,oldProps:r,changeFlags:s}=t,{compareAll:a=!1,dimension:_}=o,{ignoreProps:n}=this.state,{props:l,accessors:R=[]}=_,{updateTriggersChanged:T}=s;if(s.dataChanged)return!0;if(T){if(T.all)return!0;for(let c of R)if(T[c])return!0}if(a)return s.extensionsChanged?!0:(0,ie._compareProps)({oldProps:r,newProps:i,ignoreProps:n,propTypes:this.constructor._propTypes});for(let c of l)if(i[c]!==r[c])return!0;return!1}isAttributeChanged(t){let{changedAttributes:o}=this.state;return t?o&&o[t]!==void 0:!Xi(o)}_getAttributeManager(){return new ie.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}},B=it;(()=>{it.layerName="AggregationLayer"})();function Xi(e){let t=!0;for(let o in e){t=!1;break}return t}var zt=h(x(),1);function ve(e,t,o){let i=o;return i.domain=()=>e,i.range=()=>t,i}function Kt(e,t){return ve(e,t,i=>ji(e,t,i))}function Vi(e,t){return ve(e,t,i=>mi(e,t,i))}function wi(e,t){let o=e.sort(Yt),i=0,r=Math.max(1,t.length),s=new Array(r-1);for(;++i<r;)s[i-1]=Ki(o,i/r);let a=_=>Yi(s,t,_);return a.thresholds=()=>s,ve(e,t,a)}function Yt(e,t){return e-t}function Ki(e,t){let o=e.length;if(t<=0||o<2)return e[0];if(t>=1)return e[o-1];let i=(o-1)*t,r=Math.floor(i),s=e[r],a=e[r+1];return s+(a-s)*(i-r)}function zi(e,t){let o=0,i=e.length;for(;o<i;){let r=o+i>>>1;Yt(e[r],t)>0?i=r:o=r+1}return o}function Yi(e,t,o){return t[zi(e,o)]}function ki(e,t,o,i){let r=`${i}`,s=t.get(r);return s===void 0&&(s=e.push(i),t.set(r,s)),o[(s-1)%o.length]}function Zi(e,t){let o=new Map,i=[];for(let s of e){let a=`${s}`;o.has(a)||o.set(a,i.push(s))}return ve(e,t,s=>ki(i,o,t,s))}function ji(e,t,o){let i=e[1]-e[0];if(i<=0)return zt.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];let r=i/t.length,s=Math.floor((o-e[0])/r),a=Math.max(Math.min(s,t.length-1),0);return t[a]}function mi(e,t,o){return(o-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function kt(e){return e!=null}function Qi(e){let t=[];return e.forEach(o=>{!t.includes(o)&&kt(o)&&t.push(o)}),t}function Zt(e,t){return(typeof t=="function"?e.map(t):e).filter(kt)}function jt(e,t){return Zt(e,t)}function mt(e,t){return Qi(Zt(e,t))}function Qt(e,t,o){return Math.max(t,Math.min(o,e))}function qt(e){switch(e){case"quantize":return Kt;case"linear":return Vi;case"quantile":return wi;case"ordinal":return Zi;default:return Kt}}var Jt=e=>e.length,qi=3402823466e29,Lt=e=>e.points,Gt=e=>e.index,$t=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN,$i={getValue:Jt,getPoints:Lt,getIndex:Gt,filterData:null},H=class{constructor(t=[],o=$i){this.aggregatedBins=this.getAggregatedBins(t,o),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(t,o){let{getValue:i=Jt,getPoints:r=Lt,getIndex:s=Gt,filterData:a}=o,_=typeof a=="function",n=t.length,l=[],R=0;for(let T=0;T<n;T++){let c=t[T],g=r(c),d=s(c),f=_?g.filter(a):g;c.filteredPoints=_?f:null;let p=f.length?i(f):null;p!=null&&(l[R]={i:Number.isFinite(d)?d:T,value:p,counts:f.length},R++)}return l}_percentileToIndex(t){let o=this.sortedBins.length;if(o<2)return[0,0];let[i,r]=t.map(_=>Qt(_,0,100)),s=Math.ceil(i/100*(o-1)),a=Math.floor(r/100*(o-1));return[s,a]}getBinMap(){let t={};for(let o of this.aggregatedBins)t[o.i]=o;return t}_updateMinMaxValues(){let t=0,o=0,i=qi,r=0;for(let s of this.aggregatedBins)t=t>s.counts?t:s.counts,o=o>s.value?o:s.value,i=i<s.value?i:s.value,r+=s.counts;this.maxCount=t,this.maxValue=o,this.minValue=i,this.totalCount=r}getValueRange(t){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((r,s)=>$t(r.value,s.value))),!this.sortedBins.length)return[];let o=0,i=this.sortedBins.length-1;if(Array.isArray(t)){let r=this._percentileToIndex(t);o=r[0],i=r[1]}return[this.sortedBins[o].value,this.sortedBins[i].value]}getValueDomainByScale(t,[o=0,i=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((s,a)=>$t(s.value,a.value))),!this.sortedBins.length)return[];let r=this._percentileToIndex([o,i]);return this._getScaleDomain(t,r)}_getScaleDomain(t,[o,i]){let r=this.sortedBins;switch(t){case"quantize":case"linear":return[r[o].value,r[i].value];case"quantile":return jt(r.slice(o,i+1),s=>s.value);case"ordinal":return mt(r,s=>s.value);default:return[r[o].value,r[i].value]}}};var oo=h(x(),1);var Y=h(x(),1),to=6378e3;function ye(e){return Number.isFinite(e)?e:0}function He(e,t){let o=e.positions.value,i=1/0,r=-1/0,s=1/0,a=-1/0,_,n;for(let R=0;R<t;R++)n=o[R*3],_=o[R*3+1],i=_<i?_:i,r=_>r?_:r,s=n<s?n:s,a=n>a?n:a;return{xMin:ye(s),xMax:ye(a),yMin:ye(i),yMax:ye(r)}}function Ji(e,t,o,i){let{width:r,height:s}=i,a=o===Y.COORDINATE_SYSTEM.CARTESIAN?[-r/2,-s/2]:[-180,-90];Y.log.assert(o===Y.COORDINATE_SYSTEM.CARTESIAN||o===Y.COORDINATE_SYSTEM.LNGLAT||o===Y.COORDINATE_SYSTEM.DEFAULT);let{xMin:_,yMin:n}=e;return[-1*(eo(_-a[0],t.xOffset)+a[0]),-1*(eo(n-a[1],t.yOffset)+a[1])]}function eo(e,t){let o=e<0?-1:1,i=o<0?Math.abs(e)+t:Math.abs(e);return i=Math.floor(i/t)*t,i*o}function rt(e,t,o=!0){if(!o)return{xOffset:t,yOffset:t};let{yMin:i,yMax:r}=e,s=(i+r)/2;return Li(t,s)}function be(e,t,o,i){let r=rt(e,t,i!==Y.COORDINATE_SYSTEM.CARTESIAN),s=Ji(e,r,i,o),{xMin:a,yMin:_,xMax:n,yMax:l}=e,R=n-a+r.xOffset,T=l-_+r.yOffset,c=Math.ceil(R/r.xOffset),g=Math.ceil(T/r.yOffset);return{gridOffset:r,translation:s,width:R,height:T,numCol:c,numRow:g}}function Li(e,t){let o=Gi(e),i=er(t,e);return{yOffset:o,xOffset:i}}function Gi(e){return e/to*(180/Math.PI)}function er(e,t){return t/to*(180/Math.PI)/Math.cos(e*Math.PI/180)}function re(e,t){let o=tr(e,t),i=or(o);return{gridHash:o.gridHash,gridOffset:o.gridOffset,data:i}}function tr(e,t){let{data:o=[],cellSize:i}=e,{attributes:r,viewport:s,projectPoints:a,numInstances:_}=t,n=r.positions.value,{size:l}=r.positions.getAccessor(),R=t.boundingBox||ir(r.positions,_),T=t.posOffset||[180,90],c=t.gridOffset||rt(R,i);if(c.xOffset<=0||c.yOffset<=0)return{gridHash:{},gridOffset:c,offsets:[0,0]};let{width:g,height:d}=s,f=Math.ceil(g/c.xOffset),p=Math.ceil(d/c.yOffset),N={},{iterable:C,objectInfo:O}=(0,oo.createIterable)(o),I=new Array(3);for(let u of C){O.index++,I[0]=n[O.index*l],I[1]=n[O.index*l+1],I[2]=l>=3?n[O.index*l+2]:0;let[X,fe]=a?s.project(I):I;if(Number.isFinite(X)&&Number.isFinite(fe)){let j=Math.floor((fe+T[1])/c.yOffset),m=Math.floor((X+T[0])/c.xOffset);if(!a||m>=0&&m<f&&j>=0&&j<p){let Q=`${j}-${m}`;N[Q]=N[Q]||{count:0,points:[],lonIdx:m,latIdx:j},N[Q].count+=1,N[Q].points.push({source:u,index:O.index})}}}return{gridHash:N,gridOffset:c,offsets:[T[0]*-1,T[1]*-1]}}function or({gridHash:e,gridOffset:t,offsets:o}){let i=new Array(Object.keys(e).length),r=0;for(let s in e){let a=s.split("-"),_=parseInt(a[0],10),n=parseInt(a[1],10),l=r++;i[l]={index:l,position:[o[0]+t.xOffset*n,o[1]+t.yOffset*_],...e[s]}}return i}function ir(e,t){let o=e.value,{size:i}=e.getAccessor(),r=1/0,s=-1/0,a=1/0,_=-1/0,n,l;for(let R=0;R<t;R++)l=o[R*i],n=o[R*i+1],Number.isFinite(l)&&Number.isFinite(n)&&(r=n<r?n:r,s=n>s?n:s,a=l<a?l:a,_=l>_?l:_);return{xMin:a,xMax:_,yMin:r,yMax:s}}var st=class extends B{initializeAggregationLayer({dimensions:t}){super.initializeAggregationLayer(t),this.setState({layerData:{},gpuGridAggregator:new D(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:re})}updateState(t){super.updateState(t),this.updateAggregationState(t);let{aggregationDataDirty:o,aggregationWeightsDirty:i,gpuAggregation:r}=this.state;if(this.getNumInstances()<=0)return;let s=!1;(o||r&&i)&&(this._updateAggregation(t),s=!0),!r&&(o||i)&&(this._updateWeightBins(),this._uploadAggregationResults(),s=!0),this.setState({aggregationDirty:s})}finalizeState(t){let{count:o}=this.state.weights;o&&o.aggregationBuffer&&o.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(t)}updateShaders(t){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(t)}updateAggregationState(t){io.log.assert(!1)}allocateResources(t,o){if(this.state.numRow!==t||this.state.numCol!==o){let i=o*t*4*4,{weights:r}=this.state;for(let s in r){let a=r[s];a.aggregationBuffer&&a.aggregationBuffer.delete(),a.aggregationBuffer=this.context.device.createBuffer({byteLength:i,accessor:{size:4,type:M.FLOAT,divisor:1}})}}}updateResults({aggregationData:t,maxMinData:o,maxData:i,minData:r}){let{count:s}=this.state.weights;s&&(s.aggregationData=t,s.maxMinData=o,s.maxData=i,s.minData=r)}_updateAggregation(t){let{cpuGridAggregator:o,gpuGridAggregator:i,gridOffset:r,posOffset:s,translation:a=[0,0],scaling:_=[0,0,0],boundingBox:n,projectPoints:l,gpuAggregation:R,numCol:T,numRow:c}=this.state,{props:g}=t,{viewport:d}=this.context,f=this.getAttributes(),p=this.getNumInstances();if(R){let{weights:N}=this.state;i.run({weights:N,cellSize:[r.xOffset,r.yOffset],numCol:T,numRow:c,translation:a,scaling:_,vertexCount:p,projectPoints:l,attributes:f,moduleSettings:this.getModuleSettings()})}else{let N=o(g,{gridOffset:r,projectPoints:l,attributes:f,viewport:d,posOffset:s,boundingBox:n});this.setState({layerData:N})}}_updateWeightBins(){let{getValue:t}=this.state,o=new H(this.state.layerData.data||[],{getValue:t});this.setState({sortedBins:o})}_uploadAggregationResults(){let{numCol:t,numRow:o}=this.state,{data:i}=this.state.layerData,{aggregatedBins:r,minValue:s,maxValue:a,totalCount:_}=this.state.sortedBins,n=4,l=t*o*n,R=new Float32Array(l).fill(0);for(let d of r){let{lonIdx:f,latIdx:p}=i[d.i],{value:N,counts:C}=d,O=(f+p*t)*n;R[O]=N,R[O+n-1]=C}let T=new Float32Array([a,0,0,s]),c=new Float32Array([a,0,0,_]),g=new Float32Array([s,0,0,_]);this.updateResults({aggregationData:R,maxMinData:T,maxData:c,minData:g})}},b=st;(()=>{st.layerName="GridAggregationLayer"})();var rr={...$.defaultProps,getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},ro="positions",sr={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},We=class extends b{initializeState(){if(!$.isSupported(this.context.device)){this.setState({supported:!1}),at.log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();return}super.initializeAggregationLayer({dimensions:sr,getCellSize:i=>i.cellSizePixels});let t={count:{size:1,operation:F.SUM,needMax:!0,maxTexture:te(this.context.device,{id:`${this.id}-max-texture`})}};this.setState({supported:!0,projectPoints:!0,weights:t,subLayerData:{attributes:{}},maxTexture:t.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[ro]:{size:3,accessor:"getPosition",type:M.DOUBLE,fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:t}){return this.state.supported&&t.somethingChanged}updateState(t){super.updateState(t)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:t,numRow:o,numCol:i,weights:r}=this.state,{updateTriggers:s}=this.props,{aggregationBuffer:a}=r.count,_=this.getSubLayerClass("cells",$);return new _(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:s}),{data:{attributes:{instanceCounts:a}},maxTexture:t,numInstances:o*i})}finalizeState(t){super.finalizeState(t);let{aggregationBuffer:o,maxBuffer:i,maxTexture:r}=this.state;o?.delete(),i?.delete(),r?.delete()}getPickingInfo({info:t}){let{index:o}=t;if(o>=0){let{gpuGridAggregator:i,gpuAggregation:r,weights:s}=this.state,a=r?i.getData("count"):s.count;t.object=D.getAggregationData({pixelIndex:o,...a})}return t}updateResults({aggregationData:t,maxData:o}){let{count:i}=this.state.weights;i.aggregationData=t,i.aggregationBuffer.write(t),i.maxData=o,i.maxTexture.setImageData({data:o})}updateAggregationState(t){let o=t.props.cellSizePixels,i=t.oldProps.cellSizePixels!==o,{viewportChanged:r}=t.changeFlags,s=t.props.gpuAggregation;this.state.gpuAggregation!==t.props.gpuAggregation&&s&&!D.isSupported(this.context.device)&&(at.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),s=!1);let a=s!==this.state.gpuAggregation;this.setState({gpuAggregation:s});let _=this.isAttributeChanged(ro),{dimensions:n}=this.state,{data:l,weights:R}=n,T=_||a||r||this.isAggregationDirty(t,{compareAll:s,dimension:l}),c=this.isAggregationDirty(t,{dimension:R});this.setState({aggregationDataDirty:T,aggregationWeightsDirty:c});let{viewport:g}=this.context;if(r||i){let{width:d,height:f}=g,p=Math.ceil(d/o),N=Math.ceil(f/o);this.allocateResources(N,p),this.setState({scaling:[d/2,-f/2,1],gridOffset:{xOffset:o,yOffset:o},width:d,height:f,numCol:p,numRow:N})}c&&this._updateAccessors(t),(T||c)&&this._resetResults()}_updateAccessors(t){let{getWeight:o,aggregation:i,data:r}=t.props,{count:s}=this.state.weights;s&&(s.getWeight=o,s.operation=F[i]),this.setState({getValue:ee(i,o,{data:r})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}},pe=We;(()=>{We.layerName="ScreenGridLayer"})(),(()=>{We.defaultProps=rr})();var lo=h(L(),1);function so(){}var ao=["getBins","getDomain","getScaleFunc"],_o=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],ar=e=>e.cellSize,W=class{constructor(t){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=t.getCellSize||ar,this._getAggregator=t.getAggregator,this._addDimension(t.dimensions||_o)}static defaultDimensions(){return _o}updateState(t,o){let{oldProps:i,props:r,changeFlags:s}=t;this.updateGetValueFuncs(i,r,s);let a=this.needsReProjectPoints(i,r,s),_=!1;return s.dataChanged||a?(this.getAggregatedData(r,o),_=!0):((this.getDimensionChanges(i,r,s)||[]).forEach(l=>typeof l=="function"&&l()),_=!0),this.setState({aggregationDirty:_}),this.state}setState(t){this.state={...this.state,...t}}setDimensionState(t,o){this.setState({dimensions:{...this.state.dimensions,[t]:{...this.state.dimensions[t],...o}}})}normalizeResult(t={}){return t.hexagons?{data:t.hexagons,...t}:t.layerData?{data:t.layerData,...t}:t}getAggregatedData(t,o){let r=this._getAggregator(t)(t,o);this.setState({layerData:this.normalizeResult(r)}),this.changeFlags={layerData:!0},this.getSortedBins(t)}updateGetValueFuncs(t,o,i){for(let r in this.dimensionUpdaters){let{value:s,weight:a,aggregation:_}=this.dimensionUpdaters[r].getBins.triggers,n=o[s.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[r].getBins,t,o,i)&&(n?n=Dt(n,{data:o.data}):n=ee(o[_.prop],o[a.prop],{data:o.data})),n&&this.setDimensionState(r,{getValue:n})}}needsReProjectPoints(t,o,i){return this._getCellSize(t)!==this._getCellSize(o)||this._getAggregator(t)!==this._getAggregator(o)||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPosition)}addDimension(t){this._addDimension(t)}_addDimension(t=[]){t.forEach(o=>{let{key:i}=o;this.dimensionUpdaters[i]=this.getDimensionUpdaters(o),this.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:so}})}getDimensionUpdaters({key:t,accessor:o,pickingInfo:i,getBins:r,getDomain:s,getScaleFunc:a,nullValue:_}){return{key:t,accessor:o,pickingInfo:i,getBins:{updater:this.getDimensionSortedBins.bind(this),...r},getDomain:{updater:this.getDimensionValueDomain.bind(this),...s},getScaleFunc:{updater:this.getDimensionScale.bind(this),...a},attributeAccessor:this.getSubLayerDimensionAttribute(t,_)}}needUpdateDimensionStep(t,o,i,r){return Object.values(t.triggers).some(s=>s.updateTrigger?r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged[s.updateTrigger]):o[s.prop]!==i[s.prop])}getDimensionChanges(t,o,i){let r=[];for(let s in this.dimensionUpdaters){let a=ao.find(_=>this.needUpdateDimensionStep(this.dimensionUpdaters[s][_],t,o,i));a&&r.push(this.dimensionUpdaters[s][a].updater.bind(this,o,this.dimensionUpdaters[s]))}return r.length?r:null}getUpdateTriggers(t){let o=t.updateTriggers||{},i={};for(let r in this.dimensionUpdaters){let{accessor:s}=this.dimensionUpdaters[r];i[s]={},ao.forEach(a=>{Object.values(this.dimensionUpdaters[r][a].triggers).forEach(({prop:_,updateTrigger:n})=>{if(n){let l=o[n];typeof l=="object"&&!Array.isArray(l)?Object.assign(i[s],l):l!==void 0&&(i[s][_]=l)}else i[s][_]=t[_]})})}return i}getSortedBins(t){for(let o in this.dimensionUpdaters)this.getDimensionSortedBins(t,this.dimensionUpdaters[o])}getDimensionSortedBins(t,o){let{key:i}=o,{getValue:r}=this.state.dimensions[i],s=new H(this.state.layerData.data||[],{getValue:r,filterData:t._filterData});this.setDimensionState(i,{sortedBins:s}),this.getDimensionValueDomain(t,o)}getDimensionValueDomain(t,o){let{getDomain:i,key:r}=o,{triggers:{lowerPercentile:s,upperPercentile:a,scaleType:_}}=i,n=this.state.dimensions[r].sortedBins.getValueDomainByScale(t[_.prop],[t[s.prop],t[a.prop]]);this.setDimensionState(r,{valueDomain:n}),this.getDimensionScale(t,o)}getDimensionScale(t,o){let{key:i,getScaleFunc:r,getDomain:s}=o,{domain:a,range:_}=r.triggers,{scaleType:n}=s.triggers,{onSet:l}=r,R=t[_.prop],T=t[a.prop]||this.state.dimensions[i].valueDomain,g=qt(n&&t[n.prop])(T,R);typeof l=="object"&&typeof t[l.props]=="function"&&t[l.props](g.domain()),this.setDimensionState(i,{scaleFunc:g})}getSubLayerDimensionAttribute(t,o){return i=>{let{sortedBins:r,scaleFunc:s}=this.state.dimensions[t],a=r.binMap[i.index];if(a&&a.counts===0)return o;let _=a&&a.value,n=s.domain();return _>=n[0]&&_<=n[n.length-1]?s(_):o}}getSubLayerAccessors(t){let o={};for(let i in this.dimensionUpdaters){let{accessor:r}=this.dimensionUpdaters[i];o[r]=this.getSubLayerDimensionAttribute(t,i)}return o}getPickingInfo({info:t}){let o=t.picked&&t.index>-1,i=null;if(o){let r=this.state.layerData.data[t.index],s={};for(let a in this.dimensionUpdaters){let{pickingInfo:_}=this.dimensionUpdaters[a],{sortedBins:n}=this.state.dimensions[a],l=n.binMap[r.index]&&n.binMap[r.index].value;s[_]=l}i=Object.assign(s,r,{points:r.filteredPoints||r.points})}return t.picked=Boolean(i),t.object=i,t}getAccessor(t){return this.dimensionUpdaters.hasOwnProperty(t)?this.dimensionUpdaters[t].attributeAccessor:so}};function no(){}var _r={colorDomain:null,colorRange:U,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:no,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:no,gridAggregator:re,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:e=>e.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Xe=class extends B{initializeState(){let t=new W({getAggregator:i=>i.gridAggregator,getCellSize:i=>i.cellSize});this.state={cpuAggregator:t,aggregatorState:t.state},this.getAttributeManager().add({positions:{size:3,type:M.DOUBLE,accessor:"getPosition"}})}updateState(t){super.updateState(t),this.setState({aggregatorState:this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:o,cellSize:i,coverage:r,material:s,transitions:a}=this.props,{cpuAggregator:_}=this.state,n=this.getSubLayerClass("grid-cell",lo.GridCellLayer),l=this._getSublayerUpdateTriggers();return new n({cellSize:i,coverage:r,material:s,elevationScale:t,extruded:o,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:a&&{getFillColor:a.getColorValue||a.getColorWeight,getElevation:a.getElevationValue||a.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:l}),{data:_.state.layerData.data})}},k=Xe;(()=>{Xe.layerName="CPUGridLayer"})(),(()=>{Xe.defaultProps=_r})();var To=h(x(),1),co=h(L(),1);var se=Math.PI/3,nr=[0,se,2*se,3*se,4*se,5*se];function lr(e){return e[0]}function Ar(e){return e[1]}function _t(){var e=0,t=0,o=1,i=1,r=lr,s=Ar,a,_,n;function l(T){var c={},g=[],d,f=T.length;for(d=0;d<f;++d)if(!(isNaN(N=+r.call(null,p=T[d],d,T))||isNaN(C=+s.call(null,p,d,T)))){var p,N,C,O=Math.round(C=C/n),I=Math.round(N=N/_-(O&1)/2),u=C-O;if(Math.abs(u)*3>1){var X=N-I,fe=I+(N<I?-1:1)/2,j=O+(C<O?-1:1),m=N-fe,Q=C-j;X*X+u*u>m*m+Q*Q&&(I=fe+(O&1?1:-1)/2,O=j)}var dt=I+"-"+O,de=c[dt];de?de.push(p):(g.push(de=c[dt]=[p]),de.x=(I+(O&1)/2)*_,de.y=O*n)}return g}function R(T){var c=0,g=0;return nr.map(function(d){var f=Math.sin(d)*T,p=-Math.cos(d)*T,N=f-c,C=p-g;return c=f,g=p,[N,C]})}return l.hexagon=function(T){return"m"+R(T==null?a:+T).join("l")+"z"},l.centers=function(){for(var T=[],c=Math.round(t/n),g=Math.round(e/_),d=c*n;d<i+a;d+=n,++c)for(var f=g*_+(c&1)*_/2;f<o+_/2;f+=_)T.push([f,d]);return T},l.mesh=function(){var T=R(a).slice(0,4).join("l");return l.centers().map(function(c){return"M"+c+"m"+T}).join("")},l.x=function(T){return arguments.length?(r=T,l):r},l.y=function(T){return arguments.length?(s=T,l):s},l.radius=function(T){return arguments.length?(a=+T,_=a*2*Math.sin(se),n=a*1.5,l):a},l.size=function(T){return arguments.length?(e=t=0,o=+T[0],i=+T[1],l):[o-e,i-t]},l.extent=function(T){return arguments.length?(e=+T[0][0],t=+T[0][1],o=+T[1][0],i=+T[1][1],l):[[e,t],[o,i]]},l.radius(1)}var Ve=h(x(),1);function Ao(e,t){let{data:o,radius:i}=e,{viewport:r,attributes:s}=t,a=o.length?Rr(o,t):null,_=Tr(i,r,a),n=[],{iterable:l,objectInfo:R}=(0,Ve.createIterable)(o),T=s.positions.value,{size:c}=s.positions.getAccessor();for(let f of l){R.index++;let p=R.index*c,N=[T[p],T[p+1]];Number.isFinite(N[0])&&Number.isFinite(N[1])?n.push({screenCoord:r.projectFlat(N),source:f,index:R.index}):Ve.log.warn("HexagonLayer: invalid position")()}return{hexagons:_t().radius(_).x(f=>f.screenCoord[0]).y(f=>f.screenCoord[1])(n).map((f,p)=>({position:r.unprojectFlat([f.x,f.y]),points:f,index:p})),radiusCommon:_}}function Rr(e,t){let{attributes:o}=t,i=o.positions.value,{size:r}=o.positions.getAccessor(),s=1/0,a=1/0,_=-1/0,n=-1/0,l;for(l=0;l<r*e.length;l+=r){let R=i[l],T=i[l+1];Number.isFinite(R)&&Number.isFinite(T)&&(s=Math.min(R,s),_=Math.max(R,_),a=Math.min(T,a),n=Math.max(T,n))}return[s,a,_,n].every(Number.isFinite)?[(s+_)/2,(a+n)/2]:null}function Tr(e,t,o){let{unitsPerMeter:i}=t.getDistanceScales(o);return e*i[0]}function Ro(){}var cr={colorDomain:null,colorRange:U,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Ro,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Ro,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Ao,getPosition:{type:"accessor",value:e=>e.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},we=class extends B{initializeState(){let t=new W({getAggregator:i=>i.hexagonAggregator,getCellSize:i=>i.radius});this.state={cpuAggregator:t,aggregatorState:t.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:M.DOUBLE,accessor:"getPosition"}})}updateState(t){if(super.updateState(t),t.changeFlags.propsOrDataChanged){let o=this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==o.layerData){let{hexagonVertices:i}=o.layerData||{};this.setState({vertices:i&&this.convertLatLngToMeterOffset(i)})}this.setState({aggregatorState:o})}}convertLatLngToMeterOffset(t){let{viewport:o}=this.context;if(Array.isArray(t)&&t.length===6){let i=t[0],r=t[3],s=[(i[0]+r[0])/2,(i[1]+r[1])/2],a=o.projectFlat(s),{metersPerUnit:_}=o.getDistanceScales(s);return t.map(l=>{let R=o.projectFlat(l);return[(R[0]-a[0])*_[0],(R[1]-a[1])*_[1]]})}return To.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:o,coverage:i,material:r,transitions:s}=this.props,{aggregatorState:a,vertices:_}=this.state,n=this.getSubLayerClass("hexagon-cell",co.ColumnLayer),l=this._getSublayerUpdateTriggers(),R=_?{vertices:_,radius:1}:{radius:a.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new n({...R,diskResolution:6,elevationScale:t,extruded:o,coverage:i,material:r,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:s&&{getFillColor:s.getColorValue||s.getColorWeight,getElevation:s.getElevationValue||s.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:l}),{data:a.layerData.data})}},Ce=we;(()=>{we.layerName="HexagonLayer"})(),(()=>{we.defaultProps=cr})();var je=h(L(),1);var wo=h(x(),1);var E=.16666666666666666,A={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},ae=[A.W,A.SW,A.S],_e=[A.S,A.SE,A.E],ne=[A.E,A.NE,A.N],le=[A.NW,A.W,A.N],Ae=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5]],Re=[[-E,-.5],[E,-.5],[.5,-E],[.5,E]],Te=[[.5,-E],[.5,E],[E,.5],[-E,.5]],ce=[[-.5,E],[-.5,-E],[E,.5],[-E,.5]],go=[A.W,A.SW,A.SE,A.E],So=[A.S,A.SE,A.NE,A.N],fo=[A.NW,A.W,A.E,A.NE],Eo=[A.NW,A.SW,A.S,A.N],No=[[-.5,E],[-.5,-E],[.5,-E],[.5,E]],po=[[-E,-.5],[E,-.5],[E,.5],[-E,.5]],gr=[A.NW,A.SW,A.SE,A.NE],Co=[A.NW,A.SW,A.SE,A.E,A.N],Mo=[A.W,A.SW,A.SE,A.NE,A.N],Oo=[A.NW,A.W,A.S,A.SE,A.NE],Io=[A.NW,A.SW,A.S,A.E,A.NE],ho=[A.NW,A.W,[.5,-E],[.5,E],A.N],Fo=[[-E,-.5],[E,-.5],A.E,A.NE,A.N],Do=[[-.5,E],[-.5,-E],A.S,A.SE,A.E],xo=[A.W,A.SW,A.S,[E,.5],[-E,.5]],Bo=[A.NW,A.W,[-E,-.5],[E,-.5],A.N],Po=[[-.5,E],[-.5,-E],A.E,A.NE,A.N],Uo=[A.S,A.SE,A.E,[E,.5],[-E,.5]],uo=[A.W,A.SW,A.S,[.5,-E],[.5,E]],vo=[A.W,A.SW,A.SE,A.E,[E,.5],[-E,.5]],yo=[[-.5,E],[-.5,-E],A.S,A.SE,A.NE,A.N],Ho=[A.NW,A.W,[-E,-.5],[E,-.5],A.E,A.NE],bo=[A.NW,A.SW,A.S,[.5,-E],[.5,E],A.N],ge=[A.W,A.SW,A.S,A.E,A.NE,A.N],Se=[A.NW,A.W,A.S,A.SE,A.E,A.N],Ke=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5],A.E,A.NE,A.N],ze=[A.W,A.SW,A.S,[.5,-E],[.5,E],[E,.5],[-E,.5]],Ye=[A.NW,A.W,[-E,-.5],[E,-.5],[.5,-E],[.5,E],A.N],ke=[[-.5,E],[-.5,-E],A.S,A.SE,A.E,[E,.5],[-E,.5]],Wo=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5],[.5,-E],[.5,E],[E,.5],[-E,.5]],Xo={0:[],1:[[A.W,A.S]],2:[[A.S,A.E]],3:[[A.W,A.E]],4:[[A.N,A.E]],5:{0:[[A.W,A.S],[A.N,A.E]],1:[[A.W,A.N],[A.S,A.E]]},6:[[A.N,A.S]],7:[[A.W,A.N]],8:[[A.W,A.N]],9:[[A.N,A.S]],10:{0:[[A.W,A.N],[A.S,A.E]],1:[[A.W,A.S],[A.N,A.E]]},11:[[A.N,A.E]],12:[[A.W,A.E]],13:[[A.S,A.E]],14:[[A.W,A.S]],15:[]};function S(e){return parseInt(e,4)}var Vo={[S("0000")]:[],[S("2222")]:[],[S("2221")]:[ae],[S("2212")]:[_e],[S("2122")]:[ne],[S("1222")]:[le],[S("0001")]:[ae],[S("0010")]:[_e],[S("0100")]:[ne],[S("1000")]:[le],[S("2220")]:[Ae],[S("2202")]:[Re],[S("2022")]:[Te],[S("0222")]:[ce],[S("0002")]:[Ae],[S("0020")]:[Re],[S("0200")]:[Te],[S("2000")]:[ce],[S("0011")]:[go],[S("0110")]:[So],[S("1100")]:[fo],[S("1001")]:[Eo],[S("2211")]:[go],[S("2112")]:[So],[S("1122")]:[fo],[S("1221")]:[Eo],[S("2200")]:[No],[S("2002")]:[po],[S("0022")]:[No],[S("0220")]:[po],[S("1111")]:[gr],[S("1211")]:[Co],[S("2111")]:[Mo],[S("1112")]:[Oo],[S("1121")]:[Io],[S("1011")]:[Co],[S("0111")]:[Mo],[S("1110")]:[Oo],[S("1101")]:[Io],[S("1200")]:[ho],[S("0120")]:[Fo],[S("0012")]:[Do],[S("2001")]:[xo],[S("1022")]:[ho],[S("2102")]:[Fo],[S("2210")]:[Do],[S("0221")]:[xo],[S("1002")]:[Bo],[S("2100")]:[Po],[S("0210")]:[Uo],[S("0021")]:[uo],[S("1220")]:[Bo],[S("0122")]:[Po],[S("2012")]:[Uo],[S("2201")]:[uo],[S("0211")]:[vo],[S("2110")]:[yo],[S("1102")]:[Ho],[S("1021")]:[bo],[S("2011")]:[vo],[S("0112")]:[yo],[S("1120")]:[Ho],[S("1201")]:[bo],[S("2101")]:[ge],[S("0121")]:[ge],[S("1012")]:[Se],[S("1210")]:[Se],[S("0101")]:{0:[ae,ne],1:[ge],2:[ge]},[S("1010")]:{0:[le,_e],1:[Se],2:[Se]},[S("2121")]:{0:[ge],1:[ge],2:[ae,ne]},[S("1212")]:{0:[Se],1:[Se],2:[le,_e]},[S("2120")]:{0:[Ke],1:[Ke],2:[Ae,ne]},[S("2021")]:{0:[ze],1:[ze],2:[ae,Te]},[S("1202")]:{0:[Ye],1:[Ye],2:[le,Re]},[S("0212")]:{0:[ke],1:[ke],2:[_e,ce]},[S("0102")]:{0:[Ae,ne],1:[Ke],2:[Ke]},[S("0201")]:{0:[ae,Te],1:[ze],2:[ze]},[S("1020")]:{0:[le,Re],1:[Ye],2:[Ye]},[S("2010")]:{0:[_e,ce],1:[ke],2:[ke]},[S("2020")]:{0:[ce,Re],1:[Wo],2:[Ae,Te]},[S("0202")]:{0:[Te,Ae],1:[Wo],2:[ce,Re]}};var J={ISO_LINES:1,ISO_BANDS:2},Sr={zIndex:0,zOffset:.005};function Me(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function Ko(e){let{cellWeights:t,x:o,y:i,width:r,height:s}=e,a=e.threshold;e.thresholdValue&&(wo.log.deprecated("thresholdValue","threshold")(),a=e.thresholdValue);let _=o<0,n=o>=r-1,l=i<0,R=i>=s-1,T=_||n||l||R,c={},g={};_||R?g.top=0:(c.top=t[(i+1)*r+o],g.top=Me(c.top,a)),n||R?g.topRight=0:(c.topRight=t[(i+1)*r+o+1],g.topRight=Me(c.topRight,a)),n||l?g.right=0:(c.right=t[i*r+o+1],g.right=Me(c.right,a)),_||l?g.current=0:(c.current=t[i*r+o],g.current=Me(c.current,a));let{top:d,topRight:f,right:p,current:N}=g,C=-1;Number.isFinite(a)&&(C=d<<3|f<<2|p<<1|N),Array.isArray(a)&&(C=d<<6|f<<4|p<<2|N);let O=0;return T||(O=Me((c.top+c.topRight+c.right+c.current)/4,a)),{code:C,meanCode:O}}function nt(e){let{gridOrigin:t,cellSize:o,x:i,y:r,code:s,meanCode:a,type:_=J.ISO_LINES}=e,n={...Sr,...e.thresholdData},l=_===J.ISO_BANDS?Vo[s]:Xo[s];Array.isArray(l)||(l=l[a]);let R=n.zIndex*n.zOffset,T=(i+1)*o[0],c=(r+1)*o[1],g=t[0]+T,d=t[1]+c;if(_===J.ISO_BANDS){let p=[];return l.forEach(N=>{let C=[];N.forEach(O=>{let I=g+O[0]*o[0],u=d+O[1]*o[1];C.push([I,u,R])}),p.push(C)}),p}let f=[];return l.forEach(p=>{p.forEach(N=>{let C=g+N[0]*o[0],O=d+N[1]*o[1];f.push([C,O,R])})}),f}function zo({thresholdData:e,cellWeights:t,gridSize:o,gridOrigin:i,cellSize:r}){let s=[],a=[],_=o[0],n=o[1],l=0,R=0;for(let T of e){let{contour:c}=T,{threshold:g}=c;for(let d=-1;d<_;d++)for(let f=-1;f<n;f++){let{code:p,meanCode:N}=Ko({cellWeights:t,threshold:g,x:d,y:f,width:_,height:n}),C={type:J.ISO_BANDS,gridOrigin:i,cellSize:r,x:d,y:f,width:_,height:n,code:p,meanCode:N,thresholdData:T};if(Array.isArray(g)){C.type=J.ISO_BANDS;let O=nt(C);for(let I of O)a[R++]={vertices:I,contour:c}}else{C.type=J.ISO_LINES;let O=nt(C);for(let I=0;I<O.length;I+=2)s[l++]={start:O[I],end:O[I+1],contour:c}}}}return{contourSegments:s,contourPolygons:a}}var Zo=h(x(),1);var Yo=[255,255,255,255],fr=1,dr=1,Er={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:dr}],optional:!0,compare:3},zOffset:.005},ko="positions",Nr={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Ze=class extends b{initializeState(){super.initializeAggregationLayer({dimensions:Nr}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:F.SUM}}}),this.getAttributeManager().add({[ko]:{size:3,accessor:"getPosition",type:M.DOUBLE,fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(t){super.updateState(t);let o=!1,{oldProps:i,props:r}=t,{aggregationDirty:s}=this.state;(i.contours!==r.contours||i.zOffset!==r.zOffset)&&(o=!0,this._updateThresholdData(t.props)),this.getNumInstances()>0&&(s||o)&&this._generateContours()}renderLayers(){let{contourSegments:t,contourPolygons:o}=this.state.contourData,i=this.getSubLayerClass("lines",je.LineLayer),r=this.getSubLayerClass("bands",je.SolidPolygonLayer),s=t&&t.length>0&&new i(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:_=>_.start,getTargetPosition:_=>_.end,getColor:_=>_.contour.color||Yo,getWidth:_=>_.contour.strokeWidth||fr}),a=o&&o.length>0&&new r(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:_=>_.vertices,getFillColor:_=>_.contour.color||Yo});return[s,a]}updateAggregationState(t){let{props:o,oldProps:i}=t,{cellSize:r,coordinateSystem:s}=o,{viewport:a}=this.context,_=i.cellSize!==r,n=o.gpuAggregation;this.state.gpuAggregation!==o.gpuAggregation&&n&&!D.isSupported(this.context.device)&&(Zo.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),n=!1);let l=n!==this.state.gpuAggregation;this.setState({gpuAggregation:n});let{dimensions:R}=this.state,T=this.isAttributeChanged(ko),{data:c,weights:g}=R,{boundingBox:d}=this.state;if(T&&(d=He(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:d})),T||_){let{gridOffset:N,translation:C,width:O,height:I,numCol:u,numRow:X}=be(d,r,a,s);this.allocateResources(X,u),this.setState({gridOffset:N,boundingBox:d,translation:C,posOffset:C.slice(),gridOrigin:[-1*C[0],-1*C[1]],width:O,height:I,numCol:u,numRow:X})}let f=T||l||this.isAggregationDirty(t,{dimension:c,compareAll:n}),p=this.isAggregationDirty(t,{dimension:g});p&&this._updateAccessors(t),(f||p)&&this._resetResults(),this.setState({aggregationDataDirty:f,aggregationWeightsDirty:p})}_updateAccessors(t){let{getWeight:o,aggregation:i,data:r}=t.props,{count:s}=this.state.weights;s&&(s.getWeight=o,s.operation=F[i]),this.setState({getValue:ee(i,o,{data:r})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}_generateContours(){let{numCol:t,numRow:o,gridOrigin:i,gridOffset:r,thresholdData:s}=this.state,{count:a}=this.state.weights,{aggregationData:_}=a;_||(_=a.aggregationBuffer.readSyncWebGL2(),a.aggregationData=_);let{cellWeights:n}=D.getCellData({countsData:_}),l=zo({thresholdData:s,cellWeights:n,gridSize:[t,o],gridOrigin:i,cellSize:[r.xOffset,r.yOffset]});this.setState({contourData:l})}_updateThresholdData(t){let{contours:o,zOffset:i}=t,r=o.length,s=new Array(r);for(let a=0;a<r;a++){let _=o[a];s[a]={contour:_,zIndex:_.zIndex||a,zOffset:i}}this.setState({thresholdData:s})}},Oe=Ze;(()=>{Ze.layerName="ContourLayer"})(),(()=>{Ze.defaultProps=Er})();var Lo=h(x(),1);var Jo=h(x(),1);var P=h(x(),1),Qo=h(q(),1);var qo=h(q(),1);var jo=`#version 300 es
526
391
  #define SHADER_NAME gpu-grid-cell-layer-vertex-shader
527
392
  #define RANGE_COUNT 6
528
393
 
@@ -532,6 +397,8 @@ in vec3 normals;
532
397
  in vec4 colors;
533
398
  in vec4 elevations;
534
399
  in vec3 instancePickingColors;
400
+
401
+ // Custom uniforms
535
402
  uniform vec2 offset;
536
403
  uniform bool extruded;
537
404
  uniform float cellSize;
@@ -546,6 +413,8 @@ uniform vec2 gridOffset;
546
413
  uniform vec2 gridOffsetLow;
547
414
  uniform vec4 colorRange[RANGE_COUNT];
548
415
  uniform vec2 elevationRange;
416
+
417
+ // Domain uniforms
549
418
  uniform vec2 colorDomain;
550
419
  uniform bool colorDomainValid;
551
420
  uniform vec2 elevationDomain;
@@ -562,6 +431,8 @@ uniform ElevationData
562
431
  } elevationData;
563
432
 
564
433
  #define EPSILON 0.00001
434
+
435
+ // Result
565
436
  out vec4 vColor;
566
437
 
567
438
  vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
@@ -600,6 +471,8 @@ void main(void) {
600
471
  elevation = linearScale(elvDomain, elevationRange, elevations.r);
601
472
  elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
602
473
  }
474
+
475
+ // if aggregated color or elevation is 0 do not render
603
476
  float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
604
477
  float dotRadius = cellSize / 2. * coverage * shouldRender;
605
478
 
@@ -615,10 +488,15 @@ void main(void) {
615
488
  vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
616
489
  geometry.worldPosition = centroidPosition;
617
490
  vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
491
+
492
+ // Set color to be rendered to picking fbo (also used to check for selection highlight).
618
493
  picking_setPickingColor(instancePickingColors);
619
494
 
620
495
  gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
621
496
 
497
+ // Light calculations
498
+ // Worldspace is the linear space after Mercator projection
499
+
622
500
  vec3 normals_commonspace = project_normal(normals);
623
501
 
624
502
  if (extruded) {
@@ -628,7 +506,7 @@ void main(void) {
628
506
  vColor = vec4(color.rgb, color.a * opacity) / 255.;
629
507
  }
630
508
  }
631
- `;var lc=`#version 300 es
509
+ `;var mo=`#version 300 es
632
510
  #define SHADER_NAME gpu-grid-cell-layer-fragment-shader
633
511
 
634
512
  precision highp float;
@@ -641,9 +519,7 @@ void main(void) {
641
519
  fragColor = vColor;
642
520
  fragColor = picking_filterColor(fragColor);
643
521
  }
644
- `;function ai(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ai=function(r){return typeof r}:ai=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ai(e)}function uc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function cc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uc(Object(r),!0).forEach(function(n){Wg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Wg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Vg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function li(e,t,r){return typeof Reflect<"u"&&Reflect.get?li=Reflect.get:li=function(i,o,s){var a=Hg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},li(e,t,r||e)}function Hg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=lr(e),e!==null););return e}function Xg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&es(e,t)}function es(e,t){return es=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},es(e,t)}function zg(e){var t=$g();return function(){var n=lr(e),i;if(t){var o=lr(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Lg(this,i)}}function Lg(e,t){if(t&&(ai(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jg(e)}function jg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $g(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function lr(e){return lr=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},lr(e)}var Jo=0,Go=1,Kg={colorDomain:null,colorRange:ge,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},ui=function(e){Xg(r,e);var t=zg(r);function r(){var i;Vg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return li(lr(r.prototype),"getShaders",this).call(this,{vs:ac,fs:lc,modules:[ce.project32,ce.gouraudLighting,ce.picking,Ot]})},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var s=this._getModel();this._setupUniformBuffer(s),this.setState({model:s})},n._getModel=function(){return new ee(this.context.device,cc(cc({},this.getShaders()),{},{id:this.props.id,geometry:new mr,isInstanced:!0}))},n.draw=function(o){var s=o.uniforms,a=this.props,l=a.cellSize,u=a.offset,c=a.extruded,f=a.elevationScale,h=a.coverage,_=a.gridSize,m=a.gridOrigin,y=a.gridOffset,v=a.elevationRange,S=a.colorMaxMinBuffer,T=a.elevationMaxMinBuffer,x=this.state.model,O=[(0,ce.fp64LowPart)(m[0]),(0,ce.fp64LowPart)(m[1])],P=[(0,ce.fp64LowPart)(y[0]),(0,ce.fp64LowPart)(y[1])],I=this.getDomainUniforms(),D=et(this.props.colorRange);this.bindUniformBuffers(S,T),x.setUniforms(s),x.setUniforms(I),x.setUniforms({cellSize:l,offset:u,extruded:c,elevationScale:f,coverage:h,gridSize:_,gridOrigin:m,gridOriginLow:O,gridOffset:y,gridOffsetLow:P,colorRange:D,elevationRange:v}),x.draw(this.context.renderPass),this.unbindUniformBuffers(S,T)},n.bindUniformBuffers=function(o,s){o.bind({target:35345,index:Jo}),s.bind({target:35345,index:Go})},n.unbindUniformBuffers=function(o,s){o.unbind({target:35345,index:Jo}),s.unbind({target:35345,index:Go})},n.getDomainUniforms=function(){var o=this.props,s=o.colorDomain,a=o.elevationDomain,l={};return s!==null?(l.colorDomainValid=!0,l.colorDomain=s):l.colorDomainValid=!1,a!==null?(l.elevationDomainValid=!0,l.elevationDomain=a):l.elevationDomainValid=!1,l},n._setupUniformBuffer=function(o){var s=o.pipeline.handle,a=this.context.gl,l=a.getUniformBlockIndex(s,"ColorData"),u=a.getUniformBlockIndex(s,"ElevationData");a.uniformBlockBinding(s,l,Jo),a.uniformBlockBinding(s,u,Go)},r}(ce.Layer);ui.layerName="GPUGridCellLayer";ui.defaultProps=Kg;function ci(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ci=function(r){return typeof r}:ci=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ci(e)}function fc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function dc(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?fc(Object(r),!0).forEach(function(n){fi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Yg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ur(e,t,r){return typeof Reflect<"u"&&Reflect.get?ur=Reflect.get:ur=function(i,o,s){var a=qg(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},ur(e,t,r||e)}function qg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=it(e),e!==null););return e}function Zg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ts(e,t)}function ts(e,t){return ts=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ts(e,t)}function Qg(e){var t=ep();return function(){var n=it(e),i;if(t){var o=it(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Jg(this,i)}}function Jg(e,t){if(t&&(ci(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Gg(e)}function Gg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ep(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function it(e){return it=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},it(e)}var tp={colorDomain:null,colorRange:ge,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0},rp={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},hc="positions",yt=function(e){Zg(r,e);var t=Qg(r);function r(){var i;Yg(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(o){var s,a=o.device,l=oe.isSupported(a);l||_c.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),ur(it(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:rp}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:l,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:a.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:a.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var u=this.getAttributeManager();u.add((s={},fi(s,hc,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),fi(s,"color",{size:3,accessor:"getColorWeight"}),fi(s,"elevation",{size:3,accessor:"getElevationWeight"}),s))},n.updateState=function(o){if(this.state.isSupported!==!1){ur(it(r.prototype),"updateState",this).call(this,o);var s=this.state.aggregationDirty;s&&this.setState({gridHash:null})}},n.getHashKeyForIndex=function(o){var s=this.state,a=s.numRow,l=s.numCol,u=s.boundingBox,c=s.gridOffset,f=[l,a],h=[u.xMin,u.yMin],_=[c.xOffset,c.yOffset],m=Math.floor(o/f[0]),y=o-m*f[0],v=Math.floor((m*_[1]+h[1]+90+_[1]/2)/_[1]),S=Math.floor((y*_[0]+h[0]+180+_[0]/2)/_[0]);return"".concat(v,"-").concat(S)},n.getPositionForIndex=function(o){var s=this.state,a=s.numRow,l=s.numCol,u=s.boundingBox,c=s.gridOffset,f=[l,a],h=[u.xMin,u.yMin],_=[c.xOffset,c.yOffset],m=Math.floor(o/f[0]),y=o-m*f[0],v=m*_[1]+h[1],S=y*_[0]+h[0];return[S,v]},n.getPickingInfo=function(o){var s=o.info,a=o.mode,l=s.index,u=null;if(l>=0){var c=this.state.gpuGridAggregator,f=this.getPositionForIndex(l),h=oe.getAggregationData(dc({pixelIndex:l},c.getData("color"))),_=oe.getAggregationData(dc({pixelIndex:l},c.getData("elevation")));if(u={colorValue:h.cellWeight,elevationValue:_.cellWeight,count:h.cellCount||_.cellCount,position:f,totalCount:h.totalCount||_.totalCount},a!=="hover"){var m=this.props,y=this.state.gridHash;if(!y){var v=this.state,S=v.gridOffset,T=v.translation,x=v.boundingBox,O=this.context.viewport,P=this.getAttributes(),I=jt(m,{gridOffset:S,attributes:P,viewport:O,translation:T,boundingBox:x});y=I.gridHash,this.setState({gridHash:y})}var D=this.getHashKeyForIndex(l),F=y[D];Object.assign(u,F)}}return s.picked=Boolean(u),s.object=u,s},n.renderLayers=function(){if(!this.state.isSupported)return null;var o=this.props,s=o.elevationScale,a=o.extruded,l=o.cellSize,u=o.coverage,c=o.material,f=o.elevationRange,h=o.colorDomain,_=o.elevationDomain,m=this.state,y=m.weights,v=m.numRow,S=m.numCol,T=m.gridOrigin,x=m.gridOffset,O=y.color,P=y.elevation,I=et(this.props.colorRange),D=this.getSubLayerClass("gpu-grid-cell",ui);return new D({gridSize:[S,v],gridOrigin:T,gridOffset:[x.xOffset,x.yOffset],colorRange:I,elevationRange:f,colorDomain:h,elevationDomain:_,cellSize:l,coverage:u,material:c,elevationScale:s,extruded:a},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:O.aggregationBuffer,elevations:P.aggregationBuffer}},colorMaxMinBuffer:O.maxMinBuffer,elevationMaxMinBuffer:P.maxMinBuffer,numInstances:S*v})},n.finalizeState=function(o){var s=this.state.weights,a=s.color,l=s.elevation;[a,l].forEach(function(u){var c=u.aggregationBuffer,f=u.maxMinBuffer;f?.destroy(),c?.destroy()}),ur(it(r.prototype),"finalizeState",this).call(this,o)},n.updateAggregationState=function(o){var s=o.props,a=o.oldProps,l=s.cellSize,u=s.coordinateSystem,c=this.context.viewport,f=a.cellSize!==l,h=this.state.dimensions,_=this.isAttributeChanged(hc),m=_||this.isAttributeChanged(),y=this.state.boundingBox;if(_&&(y=zn(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:y})),_||f){var v=Ln(y,l,c,u),S=v.gridOffset,T=v.translation,x=v.width,O=v.height,P=v.numCol,I=v.numRow;this.allocateResources(I,P),this.setState({gridOffset:S,translation:T,gridOrigin:[-1*T[0],-1*T[1]],width:x,height:O,numCol:P,numRow:I})}var D=m||this.isAggregationDirty(o,{dimension:h.data,compareAll:!0});D&&this._updateAccessors(o),this.setState({aggregationDataDirty:D})},n._updateAccessors=function(o){var s=o.props,a=s.colorAggregation,l=s.elevationAggregation,u=this.state.weights,c=u.color,f=u.elevation;c.operation=W[a],f.operation=W[l]},r}(pt);yt.layerName="GPUGridLayer";yt.defaultProps=tp;function di(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?di=function(r){return typeof r}:di=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},di(e)}function np(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ip(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ns(e,t)}function ns(e,t){return ns=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ns(e,t)}function op(e){var t=lp();return function(){var n=hi(e),i;if(t){var o=hi(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return sp(this,i)}}function sp(e,t){if(t&&(di(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ap(e)}function ap(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function lp(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function hi(e){return hi=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},hi(e)}function gc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function rs(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?gc(Object(r),!0).forEach(function(n){up(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):gc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function up(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var cp=rs(rs(rs({},yt.defaultProps),mt.defaultProps),{},{gpuAggregation:!1}),_i=function(e){ip(r,e);var t=op(r);function r(){var i;np(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){this.state={useGPUAggregation:!1}},n.updateState=function(o){var s=o.props;this.setState({useGPUAggregation:!1})},n.renderLayers=function(){var o=this.props,s=o.data,a=o.updateTriggers,l=this.state.useGPUAggregation?"GPU":"CPU",u=this.state.useGPUAggregation?this.getSubLayerClass("GPU",yt):this.getSubLayerClass("CPU",mt);return new u(this.props,this.getSubLayerProps({id:l,updateTriggers:a}),{data:s})},n.canUseGPUAggregation=function(o){var s=o.gpuAggregation,a=o.lowerPercentile,l=o.upperPercentile,u=o.getColorValue,c=o.getElevationValue,f=o.colorScaleType;return!(!s||!oe.isSupported(this.context.device)||a!==0||l!==100||u!==null||c!==null||f==="quantile"||f==="ordinal")},r}(pc.CompositeLayer);_i.layerName="GridLayer";_i.defaultProps=cp;function bc(e,t){return hp(e)||dp(e,t)||yc(e,t)||fp()}function fp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
645
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dp(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function hp(e){if(Array.isArray(e))return e}function _p(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=yc(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
646
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}function yc(e,t){if(e){if(typeof e=="string")return mc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return mc(e,t)}}function mc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ac(e){var t=e.map(function(a){return a[0]}),r=e.map(function(a){return a[1]}),n=Math.min.apply(null,t),i=Math.max.apply(null,t),o=Math.min.apply(null,r),s=Math.max.apply(null,r);return[n,o,i,s]}function Tc(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var vc=new Float32Array(12);function is(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=0,n=_p(e),i;try{for(n.s();!(i=n.n()).done;)for(var o=i.value,s=0;s<t;s++)vc[r++]=o[s]||0}catch(a){n.e(a)}finally{n.f()}return vc}function Sc(e,t,r){var n=bc(e,4),i=n[0],o=n[1],s=n[2],a=n[3],l=s-i,u=a-o,c=l,f=u;l/u<t/r?c=t/r*u:f=r/t*l,c<t&&(c=t,f=r);var h=(s+i)/2,_=(a+o)/2;return[h-c/2,_-f/2,h+c/2,_+f/2]}function xc(e,t){var r=bc(t,4),n=r[0],i=r[1],o=r[2],s=r[3];return[(e[0]-n)/(o-n),(e[1]-i)/(s-i)]}var Pe=M(Q());var vi=M(Q());var Rc=`#version 300 es
522
+ `;var lt=0,At=1,pr={colorDomain:null,colorRange:U,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},me=class extends P.Layer{getShaders(){return super.getShaders({vs:jo,fs:mo,modules:[P.project32,P.gouraudLighting,P.picking,G]})}initializeState(){this.getAttributeManager().addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});let o=this._getModel();this._setupUniformBuffer(o),this.setState({model:o})}_getModel(){return new qo.Model(this.context.device,{...this.getShaders(),id:this.props.id,geometry:new Qo.CubeGeometry,isInstanced:!0})}draw({uniforms:t}){let{cellSize:o,offset:i,extruded:r,elevationScale:s,coverage:a,gridSize:_,gridOrigin:n,gridOffset:l,elevationRange:R,colorMaxMinBuffer:T,elevationMaxMinBuffer:c}=this.props,g=this.state.model,d=[(0,P.fp64LowPart)(n[0]),(0,P.fp64LowPart)(n[1])],f=[(0,P.fp64LowPart)(l[0]),(0,P.fp64LowPart)(l[1])],p=this.getDomainUniforms(),N=z(this.props.colorRange);this.bindUniformBuffers(T,c),g.setUniforms(t),g.setUniforms(p),g.setUniforms({cellSize:o,offset:i,extruded:r,elevationScale:s,coverage:a,gridSize:_,gridOrigin:n,gridOriginLow:d,gridOffset:l,gridOffsetLow:f,colorRange:N,elevationRange:R}),g.draw(this.context.renderPass),this.unbindUniformBuffers(T,c)}bindUniformBuffers(t,o){t.bind({target:M.UNIFORM_BUFFER,index:lt}),o.bind({target:M.UNIFORM_BUFFER,index:At})}unbindUniformBuffers(t,o){t.unbind({target:M.UNIFORM_BUFFER,index:lt}),o.unbind({target:M.UNIFORM_BUFFER,index:At})}getDomainUniforms(){let{colorDomain:t,elevationDomain:o}=this.props,i={};return t!==null?(i.colorDomainValid=!0,i.colorDomain=t):i.colorDomainValid=!1,o!==null?(i.elevationDomainValid=!0,i.elevationDomain=o):i.elevationDomainValid=!1,i}_setupUniformBuffer(t){let o=t.pipeline.handle,i=this.context.gl,r=i.getUniformBlockIndex(o,"ColorData"),s=i.getUniformBlockIndex(o,"ElevationData");i.uniformBlockBinding(o,r,lt),i.uniformBlockBinding(o,s,At)}},Ie=me;(()=>{me.layerName="GPUGridCellLayer"})(),(()=>{me.defaultProps=pr})();var Cr={colorDomain:null,colorRange:U,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:e=>e.position},extruded:!1,material:!0},Mr={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},$o="positions",Qe=class extends b{initializeState({device:t}){let o=D.isSupported(t);o||Jo.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),super.initializeAggregationLayer({dimensions:Mr}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:o,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:t.createBuffer({byteLength:4*4,accessor:{size:4,type:M.FLOAT,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:t.createBuffer({byteLength:4*4,accessor:{size:4,type:M.FLOAT,divisor:1}})}},positionAttributeName:"positions"}),this.getAttributeManager().add({[$o]:{size:3,accessor:"getPosition",type:M.DOUBLE,fp64:this.use64bitPositions()},color:{size:3,accessor:"getColorWeight"},elevation:{size:3,accessor:"getElevationWeight"}})}updateState(t){if(this.state.isSupported===!1)return;super.updateState(t);let{aggregationDirty:o}=this.state;o&&this.setState({gridHash:null})}getHashKeyForIndex(t){let{numRow:o,numCol:i,boundingBox:r,gridOffset:s}=this.state,a=[i,o],_=[r.xMin,r.yMin],n=[s.xOffset,s.yOffset],l=Math.floor(t/a[0]),R=t-l*a[0],T=Math.floor((l*n[1]+_[1]+90+n[1]/2)/n[1]),c=Math.floor((R*n[0]+_[0]+180+n[0]/2)/n[0]);return`${T}-${c}`}getPositionForIndex(t){let{numRow:o,numCol:i,boundingBox:r,gridOffset:s}=this.state,a=[i,o],_=[r.xMin,r.yMin],n=[s.xOffset,s.yOffset],l=Math.floor(t/a[0]),R=t-l*a[0],T=l*n[1]+_[1];return[R*n[0]+_[0],T]}getPickingInfo({info:t,mode:o}){let{index:i}=t,r=null;if(i>=0){let s=this.state.gpuGridAggregator,a=this.getPositionForIndex(i),_=D.getAggregationData({pixelIndex:i,...s.getData("color")}),n=D.getAggregationData({pixelIndex:i,...s.getData("elevation")});if(r={colorValue:_.cellWeight,elevationValue:n.cellWeight,count:_.cellCount||n.cellCount,position:a,totalCount:_.totalCount||n.totalCount},o!=="hover"){let{props:l}=this,{gridHash:R}=this.state;if(!R){let{gridOffset:g,translation:d,boundingBox:f}=this.state,{viewport:p}=this.context,N=this.getAttributes();R=re(l,{gridOffset:g,attributes:N,viewport:p,translation:d,boundingBox:f}).gridHash,this.setState({gridHash:R})}let T=this.getHashKeyForIndex(i),c=R[T];Object.assign(r,c)}}return t.picked=Boolean(r),t.object=r,t}renderLayers(){if(!this.state.isSupported)return null;let{elevationScale:t,extruded:o,cellSize:i,coverage:r,material:s,elevationRange:a,colorDomain:_,elevationDomain:n}=this.props,{weights:l,numRow:R,numCol:T,gridOrigin:c,gridOffset:g}=this.state,{color:d,elevation:f}=l,p=z(this.props.colorRange),N=this.getSubLayerClass("gpu-grid-cell",Ie);return new N({gridSize:[T,R],gridOrigin:c,gridOffset:[g.xOffset,g.yOffset],colorRange:p,elevationRange:a,colorDomain:_,elevationDomain:n,cellSize:i,coverage:r,material:s,elevationScale:t,extruded:o},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:d.aggregationBuffer,elevations:f.aggregationBuffer}},colorMaxMinBuffer:d.maxMinBuffer,elevationMaxMinBuffer:f.maxMinBuffer,numInstances:T*R})}finalizeState(t){let{color:o,elevation:i}=this.state.weights;[o,i].forEach(r=>{let{aggregationBuffer:s,maxMinBuffer:a}=r;a?.destroy(),s?.destroy()}),super.finalizeState(t)}updateAggregationState(t){let{props:o,oldProps:i}=t,{cellSize:r,coordinateSystem:s}=o,{viewport:a}=this.context,_=i.cellSize!==r,{dimensions:n}=this.state,l=this.isAttributeChanged($o),R=l||this.isAttributeChanged(),{boundingBox:T}=this.state;if(l&&(T=He(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),l||_){let{gridOffset:g,translation:d,width:f,height:p,numCol:N,numRow:C}=be(T,r,a,s);this.allocateResources(C,N),this.setState({gridOffset:g,translation:d,gridOrigin:[-1*d[0],-1*d[1]],width:f,height:p,numCol:N,numRow:C})}let c=R||this.isAggregationDirty(t,{dimension:n.data,compareAll:!0});c&&this._updateAccessors(t),this.setState({aggregationDataDirty:c})}_updateAccessors(t){let{colorAggregation:o,elevationAggregation:i}=t.props,{color:r,elevation:s}=this.state.weights;r.operation=F[o],s.operation=F[i]}},Z=Qe;(()=>{Qe.layerName="GPUGridLayer"})(),(()=>{Qe.defaultProps=Cr})();var Or={...Z.defaultProps,...k.defaultProps,gpuAggregation:!1},qe=class extends Lo.CompositeLayer{initializeState(){this.state={useGPUAggregation:!1}}updateState({props:t}){this.setState({useGPUAggregation:!1})}renderLayers(){let{data:t,updateTriggers:o}=this.props,i=this.state.useGPUAggregation?"GPU":"CPU",r=this.state.useGPUAggregation?this.getSubLayerClass("GPU",Z):this.getSubLayerClass("CPU",k);return new r(this.props,this.getSubLayerProps({id:i,updateTriggers:o}),{data:t})}canUseGPUAggregation(t){let{gpuAggregation:o,lowerPercentile:i,upperPercentile:r,getColorValue:s,getElevationValue:a,colorScaleType:_}=t;return!(!o||!D.isSupported(this.context.device)||i!==0||r!==100||s!==null||a!==null||_==="quantile"||_==="ordinal")}},he=qe;(()=>{qe.layerName="GridLayer"})(),(()=>{qe.defaultProps=Or})();function ei(e){let t=e.map(_=>_[0]),o=e.map(_=>_[1]),i=Math.min.apply(null,t),r=Math.max.apply(null,t),s=Math.min.apply(null,o),a=Math.max.apply(null,o);return[i,s,r,a]}function ti(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var Go=new Float32Array(12);function Rt(e,t=2){let o=0;for(let i of e)for(let r=0;r<t;r++)Go[o++]=i[r]||0;return Go}function oi(e,t,o){let[i,r,s,a]=e,_=s-i,n=a-r,l=_,R=n;_/n<t/o?l=t/o*n:R=o/t*_,l<t&&(l=t,R=o);let T=(s+i)/2,c=(a+r)/2;return[T-l/2,c-R/2,T+l/2,c+R/2]}function ii(e,t){let[o,i,r,s]=t;return[(e[0]-o)/(r-o),(e[1]-i)/(s-i)]}var ft=h(q(),1),y=h(x(),1);var ai=h(q(),1),$e=h(x(),1);var ri=`#version 300 es
647
523
  #define SHADER_NAME heatp-map-layer-vertex-shader
648
524
 
649
525
  uniform sampler2D maxTexture;
@@ -666,13 +542,14 @@ void main(void) {
666
542
  float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
667
543
  float minValue = maxValue * threshold;
668
544
  if (colorDomain[1] > 0.) {
545
+ // if user specified custom domain use it.
669
546
  maxValue = colorDomain[1];
670
547
  minValue = colorDomain[0];
671
548
  }
672
549
  vIntensityMax = intensity / maxValue;
673
550
  vIntensityMin = intensity / minValue;
674
551
  }
675
- `;var Ec=`#version 300 es
552
+ `;var si=`#version 300 es
676
553
  #define SHADER_NAME triangle-layer-fragment-shader
677
554
 
678
555
  precision highp float;
@@ -702,6 +579,8 @@ void main(void) {
702
579
  if (aggregationMode > 0.5) {
703
580
  weight /= max(1.0, weights.a);
704
581
  }
582
+
583
+ // discard pixels with 0 weight.
705
584
  if (weight <= 0.) {
706
585
  discard;
707
586
  }
@@ -710,7 +589,7 @@ void main(void) {
710
589
  linearColor.a *= opacity;
711
590
  fragColor = linearColor;
712
591
  }
713
- `;function pi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pi=function(r){return typeof r}:pi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},pi(e)}function Oc(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function gi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Oc(Object(r),!0).forEach(function(n){gp(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oc(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function gp(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pp(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&os(e,t)}function os(e,t){return os=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},os(e,t)}function vp(e){var t=Ap();return function(){var n=mi(e),i;if(t){var o=mi(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return bp(this,i)}}function bp(e,t){if(t&&(pi(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yp(e)}function yp(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ap(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function mi(e){return mi=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},mi(e)}var ss=function(e){mp(r,e);var t=vp(r);function r(){var i;pp(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return{vs:Rc,fs:Ec,modules:[vi.project32]}},n.initializeState=function(o){var s=o.device;this.setState({model:this._getModel(s)})},n._getModel=function(o){var s=this.props,a=s.vertexCount,l=s.data,u=s.weightsTexture,c=s.maxTexture,f=s.colorTexture;return new ee(o,gi(gi({},this.getShaders()),{},{id:this.props.id,bindings:{weightsTexture:u,maxTexture:c,colorTexture:f},attributes:l.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-fan-webgl",vertexCount:a}))},n.draw=function(o){var s=o.uniforms,a=this.state.model,l=this.props,u=l.intensity,c=l.threshold,f=l.aggregationMode,h=l.colorDomain;a.setUniforms(gi(gi({},s),{},{intensity:u,threshold:c,aggregationMode:f,colorDomain:h})),a.draw(this.context.renderPass)},r}(vi.Layer);ss.layerName="TriangleLayer";var as=`#version 300 es
592
+ `;var Tt=class extends $e.Layer{getShaders(){return{vs:ri,fs:si,modules:[$e.project32]}}initializeState({device:t}){this.setState({model:this._getModel(t)})}_getModel(t){let{vertexCount:o,data:i,weightsTexture:r,maxTexture:s,colorTexture:a}=this.props;return new ai.Model(t,{...this.getShaders(),id:this.props.id,bindings:{weightsTexture:r,maxTexture:s,colorTexture:a},attributes:i.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-fan-webgl",vertexCount:o})}draw({uniforms:t}){let{model:o}=this.state,{intensity:i,threshold:r,aggregationMode:s,colorDomain:a}=this.props;o.setUniforms({...t,intensity:i,threshold:r,aggregationMode:s,colorDomain:a}),o.draw(this.context.renderPass)}},Fe=Tt;(()=>{Tt.layerName="TriangleLayer"})();var ct=`#version 300 es
714
593
  in vec3 positions;
715
594
  in vec3 positions64Low;
716
595
  in float weights;
@@ -728,13 +607,19 @@ void main()
728
607
  gl_PointSize = radiusTexels * 2.;
729
608
 
730
609
  vec3 commonPosition = project_position(positions, positions64Low);
610
+
611
+ // // map xy from commonBounds to [-1, 1]
731
612
  gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
732
613
  gl_Position.xy = (gl_Position.xy * 2.) - (1.);
733
614
  gl_Position.w = 1.0;
734
615
  }
735
- `;var ls=`#version 300 es
616
+ `;var gt=`#version 300 es
736
617
  in vec4 weightsTexture;
737
618
  out vec4 fragColor;
619
+ // Epanechnikov function, keeping for reference
620
+ // float epanechnikovKDE(float u) {
621
+ // return 0.75 * (1.0 - u * u);
622
+ // }
738
623
  float gaussianKDE(float u){
739
624
  return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
740
625
  }
@@ -747,29 +632,30 @@ void main()
747
632
  fragColor = weightsTexture * gaussianKDE(2. * dist);
748
633
  DECKGL_FILTER_COLOR(fragColor, geometry);
749
634
  }
750
- `;var wc=`#version 300 es
635
+ `;var _i=`#version 300 es
751
636
  uniform sampler2D inTexture;
752
637
  uniform float textureSize;
753
638
  out vec4 outTexture;
754
639
 
755
640
  void main()
756
641
  {
642
+ // Sample every pixel in texture
757
643
  int yIndex = gl_VertexID / int(textureSize);
758
644
  int xIndex = gl_VertexID - (yIndex * int(textureSize));
759
645
  vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
760
646
  outTexture = texture(inTexture, uv);
761
647
 
762
648
  gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
649
+ // Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
763
650
  gl_PointSize = 1.0;
764
651
  }
765
- `;var Cc=`#version 300 es
652
+ `;var ni=`#version 300 es
766
653
  in vec4 outTexture;
767
654
  out vec4 fragColor;
768
655
  void main() {
769
656
  fragColor = outTexture;
770
657
  fragColor.g = outTexture.r / max(1.0, outTexture.a);
771
658
  }
772
- `;function bi(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bi=function(r){return typeof r}:bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bi(e)}function Nc(e,t){return Rp(e)||xp(e,t)||Sp(e,t)||Tp()}function Tp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
773
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Sp(e,t){if(e){if(typeof e=="string")return Pc(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pc(e,t)}}function Pc(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xp(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,a;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,a=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw a}}return n}}function Rp(e){if(Array.isArray(e))return e}function Ic(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ne(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ic(Object(r),!0).forEach(function(n){Ep(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ic(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ep(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Op(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function cr(e,t,r){return typeof Reflect<"u"&&Reflect.get?cr=Reflect.get:cr=function(i,o,s){var a=wp(i,o);if(a){var l=Object.getOwnPropertyDescriptor(a,o);return l.get?l.get.call(s):l.value}},cr(e,t,r||e)}function wp(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=ot(e),e!==null););return e}function Cp(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&cs(e,t)}function cs(e,t){return cs=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},cs(e,t)}function Np(e){var t=Mp();return function(){var n=ot(e),i;if(t){var o=ot(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pp(this,i)}}function Pp(e,t){if(t&&(bi(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ip(e)}function Ip(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mp(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ot(e){return ot=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ot(e)}var Dp=2,us={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},Mc=[0,0],Fp={SUM:0,MEAN:1},Bp={getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ge,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},Up=["blend-minmax-webgl1","texture-formats-float32-webgl1"],kp=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],Wp={data:{props:["radiusPixels"]}},yi=function(e){Cp(r,e);var t=Np(r);function r(){var i;Op(this,r);for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return i=t.call.apply(t,[this].concat(s)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=this;if(!Up.every(function(s){return o.context.device.features.has(s)})){this.setState({supported:!1}),Pe.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}cr(ot(r.prototype),"initializeAggregationLayer",this).call(this,Wp),this.setState({supported:!0,colorDomain:Mc}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()},n.shouldUpdateState=function(o){var s=o.changeFlags;return s.somethingChanged},n.updateState=function(o){this.state.supported&&(cr(ot(r.prototype),"updateState",this).call(this,o),this._updateHeatmapState(o))},n._updateHeatmapState=function(o){var s=o.props,a=o.oldProps,l=this._getChangeFlags(o);(l.dataChanged||l.viewportChanged)&&(l.boundsChanged=this._updateBounds(l.dataChanged),this._updateTextureRenderingBounds()),l.dataChanged||l.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):l.viewportZoomChanged&&this._debouncedUpdateWeightmap(),s.colorRange!==a.colorRange&&this._updateColorTexture(o),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:o.context.viewport.zoom})},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,s=o.weightsTexture,a=o.triPositionBuffer,l=o.triTexCoordBuffer,u=o.maxWeightsTexture,c=o.colorTexture,f=o.colorDomain,h=this.props,_=h.updateTriggers,m=h.intensity,y=h.threshold,v=h.aggregation,S=this.getSubLayerClass("triangle",ss);return new S(this.getSubLayerProps({id:"triangle-layer",updateTriggers:_}),{coordinateSystem:Pe.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:a,texCoords:l}},vertexCount:4,maxTexture:u,colorTexture:c,aggregationMode:Fp[v]||0,weightsTexture:s,intensity:m,threshold:y,colorDomain:f})},n.finalizeState=function(o){cr(ot(r.prototype),"finalizeState",this).call(this,o);var s=this.state,a=s.weightsTransform,l=s.weightsTexture,u=s.maxWeightTransform,c=s.maxWeightsTexture,f=s.triPositionBuffer,h=s.triTexCoordBuffer,_=s.colorTexture,m=s.updateTimer;a?.destroy(),l?.destroy(),u?.destroy(),c?.destroy(),f?.destroy(),h?.destroy(),_?.destroy(),m&&clearTimeout(m)},n._getAttributeManager=function(){return new Pe.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},n._getChangeFlags=function(o){var s={},a=this.state.dimensions;s.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(o,{compareAll:!0,dimension:a.data})&&"aggregation is dirty",s.viewportChanged=o.changeFlags.viewportChanged;var l=this.state.zoom;return(!o.context.viewport||o.context.viewport.zoom!==l)&&(s.viewportZoomChanged=!0),s},n._createTextures=function(){var o=this.state,s=o.textureSize,a=o.format;this.setState({weightsTexture:this.context.device.createTexture(Ne(Ne({},us),{},{width:s,height:s,format:a})),maxWeightsTexture:this.context.device.createTexture(Ne(Ne({},us),{},{width:1,height:1,format:a}))})},n._setupAttributes=function(){var o=this.getAttributeManager();o.add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})},n._setupTextureParams=function(){var o=this.context.device,s=this.props.weightsTextureSize,a=Math.min(s,o.limits.maxTextureDimension2D),l=kp.every(function(f){return o.features.has(f)}),u=l?"rgba32float":"rgba8unorm",c=l?1:1/255;this.setState({textureSize:a,format:u,weightsScale:c}),l||Pe.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, falling back to low precision format"))()},n._createWeightsTransform=function(o){var s,a=this.state.weightsTransform,l=this.state.weightsTexture,u=this.getAttributeManager();(s=a)===null||s===void 0||s.destroy(),a=new $e(this.context.device,Ne({id:"".concat(this.id,"-weights-transform"),bufferLayout:u.getBufferLayouts(),vertexCount:1,targetTexture:l,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list"},o)),this.setState({weightsTransform:a})},n._setupResources=function(){this._createTextures();var o=this.context.device,s=this.state,a=s.textureSize,l=s.weightsTexture,u=s.maxWeightsTexture,c=this.getShaders({vs:as,fs:ls});this._createWeightsTransform(c);var f=this.getShaders({vs:wc,fs:Cc}),h=new $e(o,Ne(Ne({id:"".concat(this.id,"-max-weights-transform"),bindings:{inTexture:l},uniforms:{textureSize:a},targetTexture:u},f),{},{vertexCount:a*a,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}}));this.setState({weightsTexture:l,maxWeightsTexture:u,maxWeightTransform:h,zoom:null,triPositionBuffer:o.createBuffer({byteLength:48}),triTexCoordBuffer:o.createBuffer({byteLength:48})})},n.updateShaders=function(o){this._createWeightsTransform(Ne({vs:as,fs:ls},o))},n._updateMaxWeightValue=function(){var o=this.state,s=o.maxWeightTransform,a=o.textureSize;s.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})},n._updateBounds=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.context.viewport,a=[s.unproject([0,0]),s.unproject([s.width,0]),s.unproject([s.width,s.height]),s.unproject([0,s.height])].map(function(m){return m.map(Math.fround)}),l=Ac(a),u={visibleWorldBounds:l,viewportCorners:a},c=!1;if(o||!this.state.worldBounds||!Tc(this.state.worldBounds,l)){var f=this._worldToCommonBounds(l),h=this._commonToWorldBounds(f);this.props.coordinateSystem===Pe.COORDINATE_SYSTEM.LNGLAT&&(h[1]=Math.max(h[1],-85.051129),h[3]=Math.min(h[3],85.051129),h[0]=Math.max(h[0],-360),h[2]=Math.min(h[2],360));var _=this._worldToCommonBounds(h);u.worldBounds=h,u.normalizedCommonBounds=_,c=!0}return this.setState(u),c},n._updateTextureRenderingBounds=function(){var o=this.state,s=o.triPositionBuffer,a=o.triTexCoordBuffer,l=o.normalizedCommonBounds,u=o.viewportCorners,c=this.context.viewport;s.write(is(u,3));var f=u.map(function(h){return xc(c.projectPosition(h),l)});a.write(is(f,2))},n._updateColorTexture=function(o){var s,a=o.props.colorRange,l=this.state.colorTexture,u=et(a,!1,Uint8Array);if(l&&((s=l)===null||s===void 0?void 0:s.width)===a.length)l.setSubImageData({data:u});else{var c;(c=l)===null||c===void 0||c.destroy(),l=this.context.device.createTexture(Ne(Ne({},us),{},{data:u,width:a.length,height:1}))}this.setState({colorTexture:l})},n._updateWeightmap=function(){var o=this.props,s=o.radiusPixels,a=o.colorDomain,l=o.aggregation,u=this.state,c=u.worldBounds,f=u.textureSize,h=u.weightsScale,_=this.state.weightsTransform;this.state.isWeightMapDirty=!1;var m=this._worldToCommonBounds(c,{useLayerCoordinateSystem:!0});if(a&&l==="SUM"){var y=this.context.viewport,v=y.distanceScales.metersPerUnit[2]*(m[2]-m[0])/f;this.state.colorDomain=a.map(function(D){return D*v*h})}else this.state.colorDomain=a||Mc;var S=this.getAttributeManager(),T=S.getAttributes(),x=this.getModuleSettings(),O=T.positions.buffer,P={radiusPixels:s,commonBounds:m,textureWidth:f,weightsScale:h},I=T.weights.buffer;_.model.setAttributes({positions:O,weights:I}),_.model.setVertexCount(this.getNumInstances()),_.model.setUniforms(P),_.model.updateModuleSettings(x),_.run({parameters:{viewport:[0,0,f,f]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()},n._debouncedUpdateWeightmap=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.state.updateTimer,a=this.props.debounceTimeout;o?(s=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(s),s=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),a)),this.setState({updateTimer:s})},n._worldToCommonBounds=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.useLayerCoordinateSystem,l=a===void 0?!1:a,u=Nc(o,4),c=u[0],f=u[1],h=u[2],_=u[3],m=this.context.viewport,y=this.state.textureSize,v=this.props.coordinateSystem,S=l&&(v===Pe.COORDINATE_SYSTEM.LNGLAT_OFFSETS||v===Pe.COORDINATE_SYSTEM.METER_OFFSETS),T=S?m.projectPosition(this.props.coordinateOrigin):[0,0],x=y*Dp/m.scale,O,P;return l&&!S?(O=this.projectPosition([c,f,0]),P=this.projectPosition([h,_,0])):(O=m.projectPosition([c,f,0]),P=m.projectPosition([h,_,0])),Sc([O[0]-T[0],O[1]-T[1],P[0]-T[0],P[1]-T[1]],x,x)},n._commonToWorldBounds=function(o){var s=Nc(o,4),a=s[0],l=s[1],u=s[2],c=s[3],f=this.context.viewport,h=f.unprojectPosition([a,l]),_=f.unprojectPosition([u,c]);return h.slice(0,2).concat(_.slice(0,2))},r}(ye);yi.layerName="HeatmapLayer";yi.defaultProps=Bp;return Hc(Wr);})();
659
+ `;var Ir=2,St={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},li=[0,0],hr={SUM:0,MEAN:1},Fr={getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:U,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},Dr=["blend-minmax-webgl1","texture-formats-float32-webgl1"],xr=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],Br={data:{props:["radiusPixels"]}},Je=class extends B{initializeState(){if(!Dr.every(t=>this.context.device.features.has(t))){this.setState({supported:!1}),y.log.error(`HeatmapLayer: ${this.id} is not supported on this browser`)();return}super.initializeAggregationLayer(Br),this.setState({supported:!0,colorDomain:li}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){this.state.supported&&(super.updateState(t),this._updateHeatmapState(t))}_updateHeatmapState(t){let{props:o,oldProps:i}=t,r=this._getChangeFlags(t);(r.dataChanged||r.viewportChanged)&&(r.boundsChanged=this._updateBounds(r.dataChanged),this._updateTextureRenderingBounds()),r.dataChanged||r.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):r.viewportZoomChanged&&this._debouncedUpdateWeightmap(),o.colorRange!==i.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}renderLayers(){if(!this.state.supported)return[];let{weightsTexture:t,triPositionBuffer:o,triTexCoordBuffer:i,maxWeightsTexture:r,colorTexture:s,colorDomain:a}=this.state,{updateTriggers:_,intensity:n,threshold:l,aggregation:R}=this.props,T=this.getSubLayerClass("triangle",Fe);return new T(this.getSubLayerProps({id:"triangle-layer",updateTriggers:_}),{coordinateSystem:y.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:o,texCoords:i}},vertexCount:4,maxTexture:r,colorTexture:s,aggregationMode:hr[R]||0,weightsTexture:t,intensity:n,threshold:l,colorDomain:a})}finalizeState(t){super.finalizeState(t);let{weightsTransform:o,weightsTexture:i,maxWeightTransform:r,maxWeightsTexture:s,triPositionBuffer:a,triTexCoordBuffer:_,colorTexture:n,updateTimer:l}=this.state;o?.destroy(),i?.destroy(),r?.destroy(),s?.destroy(),a?.destroy(),_?.destroy(),n?.destroy(),l&&clearTimeout(l)}_getAttributeManager(){return new y.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(t){let o={},{dimensions:i}=this.state;o.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(t,{compareAll:!0,dimension:i.data})&&"aggregation is dirty",o.viewportChanged=t.changeFlags.viewportChanged;let{zoom:r}=this.state;return(!t.context.viewport||t.context.viewport.zoom!==r)&&(o.viewportZoomChanged=!0),o}_createTextures(){let{textureSize:t,format:o}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...St,width:t,height:t,format:o}),maxWeightsTexture:this.context.device.createTexture({...St,width:1,height:1,format:o})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:M.DOUBLE,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:t}=this.context,{weightsTextureSize:o}=this.props,i=Math.min(o,t.limits.maxTextureDimension2D),r=xr.every(_=>t.features.has(_)),s=r?"rgba32float":"rgba8unorm",a=r?1:1/255;this.setState({textureSize:i,format:s,weightsScale:a}),r||y.log.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(t){let{weightsTransform:o}=this.state,{weightsTexture:i}=this.state,r=this.getAttributeManager();o?.destroy(),o=new ft.TextureTransform(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:r.getBufferLayouts(),vertexCount:1,targetTexture:i,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...t}),this.setState({weightsTransform:o})}_setupResources(){this._createTextures();let{device:t}=this.context,{textureSize:o,weightsTexture:i,maxWeightsTexture:r}=this.state,s=this.getShaders({vs:ct,fs:gt});this._createWeightsTransform(s);let a=this.getShaders({vs:_i,fs:ni}),_=new ft.TextureTransform(t,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:i},uniforms:{textureSize:o},targetTexture:r,...a,vertexCount:o*o,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:i,maxWeightsTexture:r,maxWeightTransform:_,zoom:null,triPositionBuffer:t.createBuffer({byteLength:48}),triTexCoordBuffer:t.createBuffer({byteLength:48})})}updateShaders(t){this._createWeightsTransform({vs:ct,fs:gt,...t})}_updateMaxWeightValue(){let{maxWeightTransform:t,textureSize:o}=this.state;t.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(t=!1){let{viewport:o}=this.context,i=[o.unproject([0,0]),o.unproject([o.width,0]),o.unproject([o.width,o.height]),o.unproject([0,o.height])].map(_=>_.map(Math.fround)),r=ei(i),s={visibleWorldBounds:r,viewportCorners:i},a=!1;if(t||!this.state.worldBounds||!ti(this.state.worldBounds,r)){let _=this._worldToCommonBounds(r),n=this._commonToWorldBounds(_);this.props.coordinateSystem===y.COORDINATE_SYSTEM.LNGLAT&&(n[1]=Math.max(n[1],-85.051129),n[3]=Math.min(n[3],85.051129),n[0]=Math.max(n[0],-360),n[2]=Math.min(n[2],360));let l=this._worldToCommonBounds(n);s.worldBounds=n,s.normalizedCommonBounds=l,a=!0}return this.setState(s),a}_updateTextureRenderingBounds(){let{triPositionBuffer:t,triTexCoordBuffer:o,normalizedCommonBounds:i,viewportCorners:r}=this.state,{viewport:s}=this.context;t.write(Rt(r,3));let a=r.map(_=>ii(s.projectPosition(_),i));o.write(Rt(a,2))}_updateColorTexture(t){let{colorRange:o}=t.props,{colorTexture:i}=this.state,r=z(o,!1,Uint8Array);i&&i?.width===o.length?i.setSubImageData({data:r}):(i?.destroy(),i=this.context.device.createTexture({...St,data:r,width:o.length,height:1})),this.setState({colorTexture:i})}_updateWeightmap(){let{radiusPixels:t,colorDomain:o,aggregation:i}=this.props,{worldBounds:r,textureSize:s,weightsScale:a}=this.state,_=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let n=this._worldToCommonBounds(r,{useLayerCoordinateSystem:!0});if(o&&i==="SUM"){let{viewport:f}=this.context,p=f.distanceScales.metersPerUnit[2]*(n[2]-n[0])/s;this.state.colorDomain=o.map(N=>N*p*a)}else this.state.colorDomain=o||li;let R=this.getAttributeManager().getAttributes(),T=this.getModuleSettings(),c=R.positions.buffer,g={radiusPixels:t,commonBounds:n,textureWidth:s,weightsScale:a},d=R.weights.buffer;_.model.setAttributes({positions:c,weights:d}),_.model.setVertexCount(this.getNumInstances()),_.model.setUniforms(g),_.model.updateModuleSettings(T),_.run({parameters:{viewport:[0,0,s,s]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(t=!1){let{updateTimer:o}=this.state,{debounceTimeout:i}=this.props;t?(o=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(o),o=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),i)),this.setState({updateTimer:o})}_worldToCommonBounds(t,o={}){let{useLayerCoordinateSystem:i=!1}=o,[r,s,a,_]=t,{viewport:n}=this.context,{textureSize:l}=this.state,{coordinateSystem:R}=this.props,T=i&&(R===y.COORDINATE_SYSTEM.LNGLAT_OFFSETS||R===y.COORDINATE_SYSTEM.METER_OFFSETS),c=T?n.projectPosition(this.props.coordinateOrigin):[0,0],g=l*Ir/n.scale,d,f;return i&&!T?(d=this.projectPosition([r,s,0]),f=this.projectPosition([a,_,0])):(d=n.projectPosition([r,s,0]),f=n.projectPosition([a,_,0])),oi([d[0]-c[0],d[1]-c[1],f[0]-c[0],f[1]-c[1]],g,g)}_commonToWorldBounds(t){let[o,i,r,s]=t,{viewport:a}=this.context,_=a.unprojectPosition([o,i]),n=a.unprojectPosition([r,s]);return _.slice(0,2).concat(n.slice(0,2))}},De=Je;(()=>{Je.layerName="HeatmapLayer"})(),(()=>{Je.defaultProps=Fr})();return fi(xe);})();
774
660
  return __exports__;
775
661
  });