@deck.gl/aggregation-layers 9.0.0-beta.1 → 9.0.0-beta.11

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 (362) hide show
  1. package/{typed → dist}/aggregation-layer.d.ts +2 -2
  2. package/dist/aggregation-layer.d.ts.map +1 -0
  3. package/dist/aggregation-layer.js +153 -0
  4. package/{typed → dist}/contour-layer/contour-layer.d.ts +1 -1
  5. package/dist/contour-layer/contour-layer.d.ts.map +1 -0
  6. package/dist/contour-layer/contour-layer.js +240 -0
  7. package/dist/contour-layer/contour-utils.js +64 -0
  8. package/dist/contour-layer/marching-squares-codes.js +337 -0
  9. package/dist/contour-layer/marching-squares.js +147 -0
  10. package/{typed → dist}/cpu-grid-layer/cpu-grid-layer.d.ts +3 -3
  11. package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -0
  12. package/dist/cpu-grid-layer/cpu-grid-layer.js +129 -0
  13. package/dist/cpu-grid-layer/grid-aggregator.js +141 -0
  14. package/dist/dist.dev.js +1442 -10868
  15. package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +30 -0
  16. package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +112 -0
  17. package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer.d.ts +1 -1
  18. package/dist/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -0
  19. package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +145 -0
  20. package/{typed → dist}/gpu-grid-layer/gpu-grid-layer.d.ts +4 -4
  21. package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -0
  22. package/dist/gpu-grid-layer/gpu-grid-layer.js +288 -0
  23. package/{typed → dist}/grid-aggregation-layer.d.ts +3 -3
  24. package/dist/grid-aggregation-layer.d.ts.map +1 -0
  25. package/dist/grid-aggregation-layer.js +172 -0
  26. package/{typed → dist}/grid-layer/grid-layer.d.ts +2 -2
  27. package/dist/grid-layer/grid-layer.d.ts.map +1 -0
  28. package/dist/grid-layer/grid-layer.js +63 -0
  29. package/{typed → dist}/heatmap-layer/heatmap-layer-utils.d.ts +0 -9
  30. package/dist/heatmap-layer/heatmap-layer-utils.d.ts.map +1 -0
  31. package/dist/heatmap-layer/heatmap-layer-utils.js +63 -0
  32. package/{typed → dist}/heatmap-layer/heatmap-layer.d.ts +5 -6
  33. package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -0
  34. package/dist/heatmap-layer/heatmap-layer.js +455 -0
  35. package/dist/heatmap-layer/max-fs.glsl.js +9 -0
  36. package/dist/heatmap-layer/max-vs.glsl.d.ts +3 -0
  37. package/{typed → dist}/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
  38. package/dist/heatmap-layer/max-vs.glsl.js +15 -0
  39. package/dist/heatmap-layer/triangle-layer-fragment.glsl.d.ts +3 -0
  40. package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +51 -0
  41. package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +47 -0
  42. package/{typed → dist}/heatmap-layer/triangle-layer.d.ts +10 -2
  43. package/dist/heatmap-layer/triangle-layer.d.ts.map +1 -0
  44. package/dist/heatmap-layer/triangle-layer.js +59 -0
  45. package/dist/heatmap-layer/weights-fs.glsl.js +17 -0
  46. package/dist/heatmap-layer/weights-vs.glsl.d.ts +3 -0
  47. package/{typed → dist}/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
  48. package/dist/heatmap-layer/weights-vs.glsl.js +21 -0
  49. package/dist/hexagon-layer/hexagon-aggregator.js +112 -0
  50. package/{typed → dist}/hexagon-layer/hexagon-layer.d.ts +4 -4
  51. package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -0
  52. package/dist/hexagon-layer/hexagon-layer.js +173 -0
  53. package/dist/index.cjs +4328 -0
  54. package/dist/index.cjs.map +7 -0
  55. package/dist/index.d.ts +20 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +32 -0
  58. package/{typed → dist}/screen-grid-layer/screen-grid-cell-layer.d.ts +2 -3
  59. package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -0
  60. package/dist/screen-grid-layer/screen-grid-cell-layer.js +164 -0
  61. package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +35 -0
  62. package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +72 -0
  63. package/{typed → dist}/screen-grid-layer/screen-grid-layer.d.ts +1 -4
  64. package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -0
  65. package/dist/screen-grid-layer/screen-grid-layer.js +209 -0
  66. package/dist/types.js +1 -0
  67. package/dist/utils/aggregation-operation-utils.js +94 -0
  68. package/{typed → dist}/utils/bin-sorter.d.ts +1 -1
  69. package/dist/utils/bin-sorter.js +167 -0
  70. package/dist/utils/color-utils.js +53 -0
  71. package/dist/utils/cpu-aggregator.js +421 -0
  72. package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +36 -0
  73. package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +42 -0
  74. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +30 -0
  75. package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +61 -0
  76. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +41 -0
  77. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +1 -0
  78. package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
  79. package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +555 -0
  80. package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +32 -0
  81. package/dist/utils/grid-aggregation-utils.js +114 -0
  82. package/dist/utils/prop-utils.js +28 -0
  83. package/dist/utils/resource-utils.js +38 -0
  84. package/dist/utils/scale-utils.js +184 -0
  85. package/dist.min.js +299 -555
  86. package/package.json +19 -14
  87. package/src/aggregation-layer.ts +3 -2
  88. package/src/contour-layer/contour-layer.ts +2 -3
  89. package/src/cpu-grid-layer/cpu-grid-layer.ts +1 -2
  90. package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +1 -1
  91. package/src/gpu-grid-layer/gpu-grid-layer.ts +2 -2
  92. package/src/heatmap-layer/heatmap-layer-utils.ts +0 -23
  93. package/src/heatmap-layer/heatmap-layer.ts +91 -127
  94. package/src/heatmap-layer/max-vs.glsl.ts +11 -5
  95. package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +2 -2
  96. package/src/heatmap-layer/triangle-layer.ts +17 -23
  97. package/src/heatmap-layer/weights-vs.glsl.ts +4 -2
  98. package/src/hexagon-layer/hexagon-layer.ts +2 -3
  99. package/src/screen-grid-layer/screen-grid-cell-layer.ts +3 -6
  100. package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
  101. package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +16 -30
  102. package/dist/es5/aggregation-layer.js +0 -215
  103. package/dist/es5/aggregation-layer.js.map +0 -1
  104. package/dist/es5/contour-layer/contour-layer.js +0 -353
  105. package/dist/es5/contour-layer/contour-layer.js.map +0 -1
  106. package/dist/es5/contour-layer/contour-utils.js +0 -110
  107. package/dist/es5/contour-layer/contour-utils.js.map +0 -1
  108. package/dist/es5/contour-layer/marching-squares-codes.js +0 -152
  109. package/dist/es5/contour-layer/marching-squares-codes.js.map +0 -1
  110. package/dist/es5/contour-layer/marching-squares.js +0 -168
  111. package/dist/es5/contour-layer/marching-squares.js.map +0 -1
  112. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js +0 -235
  113. package/dist/es5/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  114. package/dist/es5/cpu-grid-layer/grid-aggregator.js +0 -180
  115. package/dist/es5/cpu-grid-layer/grid-aggregator.js.map +0 -1
  116. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -9
  117. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  118. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -9
  119. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  120. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js +0 -247
  121. package/dist/es5/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  122. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js +0 -424
  123. package/dist/es5/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  124. package/dist/es5/grid-aggregation-layer.js +0 -280
  125. package/dist/es5/grid-aggregation-layer.js.map +0 -1
  126. package/dist/es5/grid-layer/grid-layer.js +0 -125
  127. package/dist/es5/grid-layer/grid-layer.js.map +0 -1
  128. package/dist/es5/heatmap-layer/heatmap-layer-utils.js +0 -122
  129. package/dist/es5/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  130. package/dist/es5/heatmap-layer/heatmap-layer.js +0 -672
  131. package/dist/es5/heatmap-layer/heatmap-layer.js.map +0 -1
  132. package/dist/es5/heatmap-layer/max-fs.glsl.js +0 -9
  133. package/dist/es5/heatmap-layer/max-fs.glsl.js.map +0 -1
  134. package/dist/es5/heatmap-layer/max-vs.glsl.js +0 -9
  135. package/dist/es5/heatmap-layer/max-vs.glsl.js.map +0 -1
  136. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +0 -9
  137. package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  138. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +0 -9
  139. package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  140. package/dist/es5/heatmap-layer/triangle-layer.js +0 -122
  141. package/dist/es5/heatmap-layer/triangle-layer.js.map +0 -1
  142. package/dist/es5/heatmap-layer/weights-fs.glsl.js +0 -9
  143. package/dist/es5/heatmap-layer/weights-fs.glsl.js.map +0 -1
  144. package/dist/es5/heatmap-layer/weights-vs.glsl.js +0 -9
  145. package/dist/es5/heatmap-layer/weights-vs.glsl.js.map +0 -1
  146. package/dist/es5/hexagon-layer/hexagon-aggregator.js +0 -118
  147. package/dist/es5/hexagon-layer/hexagon-aggregator.js.map +0 -1
  148. package/dist/es5/hexagon-layer/hexagon-layer.js +0 -289
  149. package/dist/es5/hexagon-layer/hexagon-layer.js.map +0 -1
  150. package/dist/es5/index.js +0 -104
  151. package/dist/es5/index.js.map +0 -1
  152. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +0 -244
  153. package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  154. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -9
  155. package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  156. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -9
  157. package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  158. package/dist/es5/screen-grid-layer/screen-grid-layer.js +0 -317
  159. package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +0 -1
  160. package/dist/es5/types.js +0 -2
  161. package/dist/es5/types.js.map +0 -1
  162. package/dist/es5/utils/aggregation-operation-utils.js +0 -123
  163. package/dist/es5/utils/aggregation-operation-utils.js.map +0 -1
  164. package/dist/es5/utils/bin-sorter.js +0 -248
  165. package/dist/es5/utils/bin-sorter.js.map +0 -1
  166. package/dist/es5/utils/color-utils.js +0 -39
  167. package/dist/es5/utils/color-utils.js.map +0 -1
  168. package/dist/es5/utils/cpu-aggregator.js +0 -496
  169. package/dist/es5/utils/cpu-aggregator.js.map +0 -1
  170. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -9
  171. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  172. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -9
  173. package/dist/es5/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  174. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -9
  175. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  176. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -9
  177. package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  178. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -63
  179. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  180. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  181. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  182. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -732
  183. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  184. package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  185. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -9
  186. package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  187. package/dist/es5/utils/grid-aggregation-utils.js +0 -118
  188. package/dist/es5/utils/grid-aggregation-utils.js.map +0 -1
  189. package/dist/es5/utils/prop-utils.js +0 -19
  190. package/dist/es5/utils/prop-utils.js.map +0 -1
  191. package/dist/es5/utils/resource-utils.js +0 -59
  192. package/dist/es5/utils/resource-utils.js.map +0 -1
  193. package/dist/es5/utils/scale-utils.js +0 -254
  194. package/dist/es5/utils/scale-utils.js.map +0 -1
  195. package/dist/esm/aggregation-layer.js +0 -156
  196. package/dist/esm/aggregation-layer.js.map +0 -1
  197. package/dist/esm/contour-layer/contour-layer.js +0 -316
  198. package/dist/esm/contour-layer/contour-layer.js.map +0 -1
  199. package/dist/esm/contour-layer/contour-utils.js +0 -81
  200. package/dist/esm/contour-layer/contour-utils.js.map +0 -1
  201. package/dist/esm/contour-layer/marching-squares-codes.js +0 -219
  202. package/dist/esm/contour-layer/marching-squares-codes.js.map +0 -1
  203. package/dist/esm/contour-layer/marching-squares.js +0 -151
  204. package/dist/esm/contour-layer/marching-squares.js.map +0 -1
  205. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js +0 -186
  206. package/dist/esm/cpu-grid-layer/cpu-grid-layer.js.map +0 -1
  207. package/dist/esm/cpu-grid-layer/grid-aggregator.js +0 -142
  208. package/dist/esm/cpu-grid-layer/grid-aggregator.js.map +0 -1
  209. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +0 -16
  210. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js.map +0 -1
  211. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +0 -122
  212. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js.map +0 -1
  213. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js +0 -196
  214. package/dist/esm/gpu-grid-layer/gpu-grid-cell-layer.js.map +0 -1
  215. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js +0 -399
  216. package/dist/esm/gpu-grid-layer/gpu-grid-layer.js.map +0 -1
  217. package/dist/esm/grid-aggregation-layer.js +0 -240
  218. package/dist/esm/grid-aggregation-layer.js.map +0 -1
  219. package/dist/esm/grid-layer/grid-layer.js +0 -80
  220. package/dist/esm/grid-layer/grid-layer.js.map +0 -1
  221. package/dist/esm/heatmap-layer/heatmap-layer-utils.js +0 -68
  222. package/dist/esm/heatmap-layer/heatmap-layer-utils.js.map +0 -1
  223. package/dist/esm/heatmap-layer/heatmap-layer.js +0 -626
  224. package/dist/esm/heatmap-layer/heatmap-layer.js.map +0 -1
  225. package/dist/esm/heatmap-layer/max-fs.glsl.js +0 -10
  226. package/dist/esm/heatmap-layer/max-fs.glsl.js.map +0 -1
  227. package/dist/esm/heatmap-layer/max-vs.glsl.js +0 -14
  228. package/dist/esm/heatmap-layer/max-vs.glsl.js.map +0 -1
  229. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +0 -43
  230. package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +0 -1
  231. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +0 -33
  232. package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +0 -1
  233. package/dist/esm/heatmap-layer/triangle-layer.js +0 -80
  234. package/dist/esm/heatmap-layer/triangle-layer.js.map +0 -1
  235. package/dist/esm/heatmap-layer/weights-fs.glsl.js +0 -22
  236. package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +0 -1
  237. package/dist/esm/heatmap-layer/weights-vs.glsl.js +0 -25
  238. package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +0 -1
  239. package/dist/esm/hexagon-layer/hexagon-aggregator.js +0 -87
  240. package/dist/esm/hexagon-layer/hexagon-aggregator.js.map +0 -1
  241. package/dist/esm/hexagon-layer/hexagon-layer.js +0 -232
  242. package/dist/esm/hexagon-layer/hexagon-layer.js.map +0 -1
  243. package/dist/esm/index.js +0 -13
  244. package/dist/esm/index.js.map +0 -1
  245. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +0 -203
  246. package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +0 -1
  247. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +0 -21
  248. package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +0 -1
  249. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +0 -66
  250. package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +0 -1
  251. package/dist/esm/screen-grid-layer/screen-grid-layer.js +0 -285
  252. package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +0 -1
  253. package/dist/esm/types.js +0 -2
  254. package/dist/esm/types.js.map +0 -1
  255. package/dist/esm/utils/aggregation-operation-utils.js +0 -91
  256. package/dist/esm/utils/aggregation-operation-utils.js.map +0 -1
  257. package/dist/esm/utils/bin-sorter.js +0 -165
  258. package/dist/esm/utils/bin-sorter.js.map +0 -1
  259. package/dist/esm/utils/color-utils.js +0 -28
  260. package/dist/esm/utils/color-utils.js.map +0 -1
  261. package/dist/esm/utils/cpu-aggregator.js +0 -487
  262. package/dist/esm/utils/cpu-aggregator.js.map +0 -1
  263. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +0 -21
  264. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js.map +0 -1
  265. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +0 -35
  266. package/dist/esm/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js.map +0 -1
  267. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +0 -16
  268. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +0 -1
  269. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +0 -60
  270. package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +0 -1
  271. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +0 -42
  272. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js.map +0 -1
  273. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js +0 -2
  274. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.js.map +0 -1
  275. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +0 -720
  276. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +0 -1
  277. package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.md +0 -155
  278. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +0 -19
  279. package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +0 -1
  280. package/dist/esm/utils/grid-aggregation-utils.js +0 -109
  281. package/dist/esm/utils/grid-aggregation-utils.js.map +0 -1
  282. package/dist/esm/utils/prop-utils.js +0 -12
  283. package/dist/esm/utils/prop-utils.js.map +0 -1
  284. package/dist/esm/utils/resource-utils.js +0 -44
  285. package/dist/esm/utils/resource-utils.js.map +0 -1
  286. package/dist/esm/utils/scale-utils.js +0 -192
  287. package/dist/esm/utils/scale-utils.js.map +0 -1
  288. package/typed/aggregation-layer.d.ts.map +0 -1
  289. package/typed/contour-layer/contour-layer.d.ts.map +0 -1
  290. package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +0 -1
  291. package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +0 -1
  292. package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +0 -1
  293. package/typed/grid-aggregation-layer.d.ts.map +0 -1
  294. package/typed/grid-layer/grid-layer.d.ts.map +0 -1
  295. package/typed/heatmap-layer/heatmap-layer-utils.d.ts.map +0 -1
  296. package/typed/heatmap-layer/heatmap-layer.d.ts.map +0 -1
  297. package/typed/heatmap-layer/max-vs.glsl.d.ts +0 -3
  298. package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +0 -3
  299. package/typed/heatmap-layer/triangle-layer.d.ts.map +0 -1
  300. package/typed/heatmap-layer/weights-vs.glsl.d.ts +0 -3
  301. package/typed/hexagon-layer/hexagon-layer.d.ts.map +0 -1
  302. package/typed/index.d.ts +0 -20
  303. package/typed/index.d.ts.map +0 -1
  304. package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +0 -1
  305. package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +0 -1
  306. /package/{typed → dist}/contour-layer/contour-utils.d.ts +0 -0
  307. /package/{typed → dist}/contour-layer/contour-utils.d.ts.map +0 -0
  308. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts +0 -0
  309. /package/{typed → dist}/contour-layer/marching-squares-codes.d.ts.map +0 -0
  310. /package/{typed → dist}/contour-layer/marching-squares.d.ts +0 -0
  311. /package/{typed → dist}/contour-layer/marching-squares.d.ts.map +0 -0
  312. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts +0 -0
  313. /package/{typed → dist}/cpu-grid-layer/grid-aggregator.d.ts.map +0 -0
  314. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts +0 -0
  315. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.d.ts.map +0 -0
  316. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts +0 -0
  317. /package/{typed → dist}/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.d.ts.map +0 -0
  318. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts +0 -0
  319. /package/{typed → dist}/heatmap-layer/max-fs.glsl.d.ts.map +0 -0
  320. /package/{typed → dist}/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +0 -0
  321. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts +0 -0
  322. /package/{typed → dist}/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +0 -0
  323. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts +0 -0
  324. /package/{typed → dist}/heatmap-layer/weights-fs.glsl.d.ts.map +0 -0
  325. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts +0 -0
  326. /package/{typed → dist}/hexagon-layer/hexagon-aggregator.d.ts.map +0 -0
  327. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +0 -0
  328. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +0 -0
  329. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +0 -0
  330. /package/{typed → dist}/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +0 -0
  331. /package/{typed → dist}/types.d.ts +0 -0
  332. /package/{typed → dist}/types.d.ts.map +0 -0
  333. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts +0 -0
  334. /package/{typed → dist}/utils/aggregation-operation-utils.d.ts.map +0 -0
  335. /package/{typed → dist}/utils/bin-sorter.d.ts.map +0 -0
  336. /package/{typed → dist}/utils/color-utils.d.ts +0 -0
  337. /package/{typed → dist}/utils/color-utils.d.ts.map +0 -0
  338. /package/{typed → dist}/utils/cpu-aggregator.d.ts +0 -0
  339. /package/{typed → dist}/utils/cpu-aggregator.d.ts.map +0 -0
  340. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts +0 -0
  341. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.d.ts.map +0 -0
  342. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts +0 -0
  343. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.d.ts.map +0 -0
  344. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +0 -0
  345. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +0 -0
  346. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +0 -0
  347. /package/{typed → dist}/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +0 -0
  348. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts +0 -0
  349. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.d.ts.map +0 -0
  350. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts +0 -0
  351. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator-utils.d.ts.map +0 -0
  352. /package/{typed → dist}/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +0 -0
  353. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +0 -0
  354. /package/{typed → dist}/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +0 -0
  355. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts +0 -0
  356. /package/{typed → dist}/utils/grid-aggregation-utils.d.ts.map +0 -0
  357. /package/{typed → dist}/utils/prop-utils.d.ts +0 -0
  358. /package/{typed → dist}/utils/prop-utils.d.ts.map +0 -0
  359. /package/{typed → dist}/utils/resource-utils.d.ts +0 -0
  360. /package/{typed → dist}/utils/resource-utils.d.ts.map +0 -0
  361. /package/{typed → dist}/utils/scale-utils.d.ts +0 -0
  362. /package/{typed → dist}/utils/scale-utils.d.ts.map +0 -0
package/dist.min.js CHANGED
@@ -4,316 +4,140 @@
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 ll=Object.create;var mr=Object.defineProperty;var ul=Object.getOwnPropertyDescriptor;var cl=Object.getOwnPropertyNames;var dl=Object.getPrototypeOf,gl=Object.prototype.hasOwnProperty;var Mn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),hl=(e,t)=>{for(var r in t)mr(e,r,{get:t[r],enumerable:!0})},vr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cl(t))!gl.call(e,i)&&i!==r&&mr(e,i,{get:()=>t[i],enumerable:!(n=ul(t,i))||n.enumerable});return e},Pe=(e,t,r)=>(vr(e,t,"default"),r&&vr(r,t,"default")),P=(e,t,r)=>(r=e!=null?ll(dl(e)):{},vr(t||!e||!e.__esModule?mr(r,"default",{value:e,enumerable:!0}):r,e)),_l=e=>vr(mr({},"__esModule",{value:!0}),e);var nt=Mn((d_,Wi)=>{Wi.exports=globalThis.deck});var $=Mn((h_,Vi)=>{Vi.exports=globalThis.deck});var M=Mn((T_,Xi)=>{Xi.exports=globalThis.luma});var _r={};hl(_r,{AGGREGATION_OPERATION:()=>w,CPUGridLayer:()=>Je,ContourLayer:()=>An,GPUGridLayer:()=>tt,GridLayer:()=>En,HeatmapLayer:()=>In,HexagonLayer:()=>un,ScreenGridLayer:()=>nn,_AggregationLayer:()=>ce,_BinSorter:()=>St,_CPUAggregator:()=>xt,_GPUGridAggregator:()=>ee});var ge={},Hi=P(nt());Pe(ge,P(nt()));if(!Hi.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Pe(_r,ge);var mi=P($());var je=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}(je||{});var Ie=P(M(),1),V=P(M(),1),Ro=P(M(),1);var L=e=>`${e}`;function he(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Dn={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 zi(e){let t={};for(let[r,n]of Object.entries(e))t[r]=pl(n);return t}function ji(e,t,r){let n={};for(let[i,o]of Object.entries(t))e&&i in e&&!o.private?(o.validate&&he(o.validate(e[i],o),`${r}: invalid ${i}`),n[i]=e[i]):n[i]=o.value;return n}function pl(e){let t=Li(e);if(t!=="object")return{value:e,...Dn[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Dn[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=Li(e.value),{...e,...Dn[t],type:t}):{type:"object",value:null};throw new Error("props")}function Li(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var ki=L`\
8
- #ifdef MODULE_LOGDEPTH
9
- logdepth_adjustPosition(gl_Position);
10
- #endif
11
- `,$i=L`\
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 Al={vertex:ki,fragment:$i},Ki=/void\s+main\s*\([^)]*\)\s*\{\n?/,Yi=/}\n?[^{}]*$/,Fn=[],zt="__LUMA_INJECT_DECLARATIONS__";function Zi(e){let t={vertex:{},fragment:{}};for(let r in e){let n=e[r],i=Tl(r);typeof n=="string"&&(n={order:0,injection:n}),t[i][r]=n}return t}function Tl(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function jt(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=t==="vertex";for(let o in r){let a=r[o];a.sort((f,l)=>f.order-l.order),Fn.length=a.length;for(let f=0,l=a.length;f<l;++f)Fn[f]=a[f].injection;let s=`${Fn.join(`
33
- `)}
34
- `;switch(o){case"vs:#decl":i&&(e=e.replace(zt,s));break;case"vs:#main-start":i&&(e=e.replace(Ki,f=>f+s));break;case"vs:#main-end":i&&(e=e.replace(Yi,f=>s+f));break;case"fs:#decl":i||(e=e.replace(zt,s));break;case"fs:#main-start":i||(e=e.replace(Ki,f=>f+s));break;case"fs:#main-end":i||(e=e.replace(Yi,f=>s+f));break;default:e=e.replace(o,f=>f+s)}}return e=e.replace(zt,""),n&&(e=e.replace(/\}\s*$/,o=>o+Al[t])),e}var vl=1,se=class{static instantiateModules(t){return t.map(r=>{if(r instanceof se)return r;he(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-${vl++}`);let n=new se(r);return n.dependencies=se.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:a={},getUniforms:s,deprecations:f=[],defines:l={},inject:u={}}=t;he(typeof r=="string"),this.name=r,this.vs=n,this.fs=i,this.getModuleUniforms=s,this.dependencies=se.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(f),this.defines=l,this.injections=Zi(u),a&&(this.uniforms=zi(a))}getModuleSource(t){let r;switch(t){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:he(!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):ji(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&&he(o.validate(t[i],o),`${this.name}: invalid ${i}`),r[i]=t[i]):r[i]=o.value}return r}};function kt(e){let t=se.instantiateModules(e);return ml(t)}function ml(e){let t={},r={};return qi({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((n,i)=>r[i]-r[n]).map(n=>t[n])}function qi(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&&qi({modules:o.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}function Qi(e){switch(e?.gpu.toLowerCase()){case"apple":return L`\
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 L`\
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 L`\
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 L`\
59
- #define AMD_GPU
60
- `;default:return L`\
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 Ji(e){let t="";return e.features.has("webgl2")&&(t+=L`\
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+=L`\
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+=L`\
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+=L`\
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+=L`\
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 eo(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=$t(e,bl),e;case"fragment":return e=$t(e,Sl),e;default:throw new Error(r)}case 100:switch(r){case"vertex":return e=$t(e,Rl),e;case"fragment":return e=$t(e,no),e=El(e),e;default:throw new Error(r)}default:throw new Error(String(t))}}var to=[[/^(#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("]],bl=[...to,[it("attribute"),"in $1"],[it("varying"),"out $1"]],Sl=[...to,[it("varying"),"in $1"]],ro=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Rl=[...ro,[it("in"),"attribute $1"],[it("out"),"varying $1"]],no=[...ro,[it("in"),"varying $1"]],yl="gl_FragColor",Gi=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function $t(e,t){for(let[r,n]of t)e=e.replace(r,n);return e}function El(e){e=$t(e,no);let t=Gi.exec(e);if(t){let r=t[1];e=e.replace(Gi,"").replace(new RegExp(`\\b${r}\\b`,"g"),yl)}return e}function it(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function wn(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((a,s)=>a.order-s.order);for(let a of o)r+=` ${a.injection}
106
- `}i.footer&&(r+=` ${i.footer}`),r+=`}
107
- `}return r}function Bn(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,a]=i.split(":"),s=i.replace(/\(.+/,""),f=Object.assign(n,{signature:a});switch(o){case"vs":t.vertex[s]=f;break;case"fs":t.fragment[s]=f;break;default:throw new Error(o)}}return t}function io(e,t){return{name:xl(e,t),language:"glsl",version:Ol(e)}}function xl(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return n?n[1]:t}function Ol(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 fo=`
108
-
109
- ${zt}
110
- `,Cl=L`\
111
- precision highp float;
112
- `;function lo(e){let{vs:t,fs:r}=e,n=kt(e.modules||[]);switch(e.platformInfo.shaderLanguage){case"glsl":return{vs:ao(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:ao(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)};case"wgsl":return{vs:oo(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:oo(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)}}}function oo(e,t){let{source:r,stage:n,modules:i,defines:o={},hookFunctions:a=[],inject:s={},log:f}=t;he(typeof r=="string","shader source must be a string");let l=r,u={};i.forEach(_=>{Object.assign(u,_.getDefines())}),Object.assign(u,o);let c="",d=Bn(a),g={},h={},A={};for(let _ in s){let v=typeof s[_]=="string"?{injection:s[_],order:0}:s[_],T=/^(v|f)s:(#)?([\w-]+)$/.exec(_);if(T){let m=T[2],E=T[3];m?E==="decl"?h[_]=[v]:A[_]=[v]:g[_]=[v]}else A[_]=[v]}for(let _ of i){f&&_.checkDeprecations(l,f);let v=_.getModuleSource(n,"wgsl");c+=v;let T=_.injections[n];for(let m in T){let E=/^(v|f)s:#([\w-]+)$/.exec(m);if(E){let C=E[2]==="decl"?h:A;C[m]=C[m]||[],C[m].push(T[m])}else g[m]=g[m]||[],g[m].push(T[m])}}return c+=fo,c=jt(c,n,h),c+=wn(d[n],g),c+=l,c=jt(c,n,A),c}function ao(e,t){let{id:r,source:n,stage:i,language:o="glsl",modules:a,defines:s={},hookFunctions:f=[],inject:l={},prologue:u=!0,log:c}=t;he(typeof n=="string","shader source must be a string");let d=o==="glsl"?io(n).version:-1,g=e.shaderLanguageVersion,h=d===100?"#version 100":"#version 300 es",_=n.split(`
113
- `).slice(1).join(`
114
- `),v={};a.forEach(N=>{Object.assign(v,N.getDefines())}),Object.assign(v,s);let T="";switch(o){case"wgsl":break;case"glsl":T=u?`${h}
115
-
116
- // ----- PROLOGUE -------------------------
117
- ${Pl({id:r,source:n,stage:i})}
118
- ${`#define SHADER_TYPE_${i.toUpperCase()}`}
119
- ${Qi(e)}
120
- ${Ji(e)}
121
- ${i==="fragment"?Cl:""}
122
-
123
- // ----- APPLICATION DEFINES -------------------------
124
-
125
- ${Nl(v)}
126
-
127
- `:`${h}
128
- `;break}let m=Bn(f),E={},O={},C={};for(let N in l){let I=typeof l[N]=="string"?{injection:l[N],order:0}:l[N],U=/^(v|f)s:(#)?([\w-]+)$/.exec(N);if(U){let W=U[2],j=U[3];W?j==="decl"?O[N]=[I]:C[N]=[I]:E[N]=[I]}else C[N]=[I]}for(let N of a){c&&N.checkDeprecations(_,c);let I=N.getModuleSource(i);T+=I;let U=N.injections[i];for(let W in U){let j=/^(v|f)s:#([\w-]+)$/.exec(W);if(j){let oe=j[2]==="decl"?O:C;oe[W]=oe[W]||[],oe[W].push(U[W])}else E[W]=E[W]||[],E[W].push(U[W])}}return T+="// ----- MAIN SHADER SOURCE -------------------------",T+=fo,T=jt(T,i,O),T+=wn(m[i],E),T+=_,T=jt(T,i,C),o==="glsl"&&d!==g&&(T=eo(T,g,i)),T.trim()}function so(e){return function(r){let n={};for(let i of e){let o=i.getUniforms(r,n);Object.assign(n,o)}return n}}function Pl(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 Nl(){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 co(e){if(!e.vs)throw new Error("no vertex shader");let t=uo(e.platformInfo,e.vs),r;return e.fs&&(r=uo(e.platformInfo,e.fs)),{...e,vs:t,fs:r}}function uo(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 fe=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return fe.defaultShaderAssembler=fe.defaultShaderAssembler||new fe,fe.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=co(t);return{...lo({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,a=this._defaultModules.length;o<a;++o){let s=this._defaultModules[o],f=s.name;r[i++]=s,n[f]=!0}for(let o=0,a=t.length;o<a;++o){let s=t[o],f=s.name;n[f]||(r[i++]=s,n[f]=!0)}return r.length=i,se.instantiateModules(r)}};fe.defaultShaderAssembler=void 0;var Il=L`void main() {gl_FragColor = vec4(0);}`,go=L`\
133
- out vec4 transform_output;
134
- void main() {
135
- transform_output = vec4(0);
136
- }`,Ml=`#version 300 es
137
- ${go}`;function Un(e){let{version:t=100,input:r,inputChannels:n,output:i}=e||{};if(!r)return t===300?Ml:t>300?`#version ${t}
138
- ${go}`:Il;if(!n)throw new Error("inputChannels");let o=Dl(n),a=ho(r,n);return t>=300?`#version ${t} ${t===300?"es":""}
139
- in ${o} ${r};
140
- out vec4 ${i};
141
- void main() {
142
- ${i} = ${a};
143
- }`:`varying ${o} ${r};
144
- void main() {
145
- gl_FragColor = ${a};
146
- }`}function Dl(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 ho(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}`)}}function Wn(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 _o(e){return e-Math.fround(e)}function po(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;Wn(e[n*4+r],t,i*2)}return t}var Ao=L`\
147
- uniform float ONE;
148
-
149
- /*
150
- About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
151
-
152
- The purpose of this workaround is to prevent shader compilers from
153
- optimizing away necessary arithmetic operations by swapping their sequences
154
- or transform the equation to some 'equivalent' form.
155
-
156
- The method is to multiply an artifical variable, ONE, which will be known to
157
- the compiler to be 1 only at runtime. The whole expression is then represented
158
- as a polynomial with respective to ONE. In the coefficients of all terms, only one a
159
- and one b should appear
160
-
161
- err = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE
162
- */
163
-
164
- // Divide float number to high and low floats to extend fraction bits
7
+ "use strict";var __exports__=(()=>{var li=Object.create;var Nt=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var gi=Object.getPrototypeOf,fi=Object.prototype.hasOwnProperty;var Qt=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),di=(n,t)=>{for(var e in t)Nt(n,e,{get:t[e],enumerable:!0})},Pt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ui(t))!fi.call(n,i)&&i!==e&&Nt(n,i,{get:()=>t[i],enumerable:!(o=ci(t,i))||o.enumerable});return n},U=(n,t,e)=>(Pt(n,t,"default"),e&&Pt(e,t,"default")),M=(n,t,e)=>(e=n!=null?li(gi(n)):{},Pt(t||!n||!n.__esModule?Nt(e,"default",{value:n,enumerable:!0}):e,n)),pi=n=>Pt(Nt({},"__esModule",{value:!0}),n);var $=Qt((Pr,he)=>{he.exports=globalThis.deck});var E=Qt((Dr,ve)=>{ve.exports=globalThis.deck});var q=Qt((Or,Se)=>{Se.exports=globalThis.luma});var Et={};di(Et,{AGGREGATION_OPERATION:()=>T,CPUGridLayer:()=>H,ContourLayer:()=>_t,GPUGridLayer:()=>V,GridLayer:()=>Mt,HeatmapLayer:()=>Ct,HexagonLayer:()=>At,ScreenGridLayer:()=>St,_AggregationLayer:()=>P,_BinSorter:()=>F,_CPUAggregator:()=>I,_GPUGridAggregator:()=>C});var L={},xe=M($(),1);U(L,M($(),1));if(!xe.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");U(Et,L);var oo=M(E(),1);var vt=M(q(),1);function Zt(n,t=[],e=0){let o=Math.fround(n),i=n-o;return t[e]=o,t[e+1]=i,t}function Ae(n){return n-Math.fround(n)}function ye(n){let t=new Float32Array(32);for(let e=0;e<4;++e)for(let o=0;o<4;++o){let i=e*4+o;Zt(n[o*4+e],t,i*2)}return t}var _e=`uniform float ONE;
165
8
  vec2 split(float a) {
166
- const float SPLIT = 4097.0;
167
- float t = a * SPLIT;
9
+ const float SPLIT = 4097.0;
10
+ float t = a * SPLIT;
168
11
  #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
169
- float a_hi = t * ONE - (t - a);
170
- float a_lo = a * ONE - a_hi;
12
+ float a_hi = t * ONE - (t - a);
13
+ float a_lo = a * ONE - a_hi;
171
14
  #else
172
- float a_hi = t - (t - a);
173
- float a_lo = a - a_hi;
15
+ float a_hi = t - (t - a);
16
+ float a_lo = a - a_hi;
174
17
  #endif
175
- return vec2(a_hi, a_lo);
18
+ return vec2(a_hi, a_lo);
176
19
  }
177
-
178
- // Divide float number again when high float uses too many fraction bits
179
20
  vec2 split2(vec2 a) {
180
- vec2 b = split(a.x);
181
- b.y += a.y;
182
- return b;
21
+ vec2 b = split(a.x);
22
+ b.y += a.y;
23
+ return b;
183
24
  }
184
-
185
- // Special sum operation when a > b
186
25
  vec2 quickTwoSum(float a, float b) {
187
26
  #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
188
- float sum = (a + b) * ONE;
189
- float err = b - (sum - a) * ONE;
27
+ float sum = (a + b) * ONE;
28
+ float err = b - (sum - a) * ONE;
190
29
  #else
191
- float sum = a + b;
192
- float err = b - (sum - a);
30
+ float sum = a + b;
31
+ float err = b - (sum - a);
193
32
  #endif
194
- return vec2(sum, err);
33
+ return vec2(sum, err);
195
34
  }
196
-
197
- // General sum operation
198
35
  vec2 twoSum(float a, float b) {
199
- float s = (a + b);
36
+ float s = (a + b);
200
37
  #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
201
- float v = (s * ONE - a) * ONE;
202
- float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);
38
+ float v = (s * ONE - a) * ONE;
39
+ float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);
203
40
  #else
204
- float v = s - a;
205
- float err = (a - (s - v)) + (b - v);
41
+ float v = s - a;
42
+ float err = (a - (s - v)) + (b - v);
206
43
  #endif
207
- return vec2(s, err);
44
+ return vec2(s, err);
208
45
  }
209
-
210
46
  vec2 twoSub(float a, float b) {
211
- float s = (a - b);
47
+ float s = (a - b);
212
48
  #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
213
- float v = (s * ONE - a) * ONE;
214
- float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);
49
+ float v = (s * ONE - a) * ONE;
50
+ float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);
215
51
  #else
216
- float v = s - a;
217
- float err = (a - (s - v)) - (b + v);
52
+ float v = s - a;
53
+ float err = (a - (s - v)) - (b + v);
218
54
  #endif
219
- return vec2(s, err);
55
+ return vec2(s, err);
220
56
  }
221
-
222
57
  vec2 twoSqr(float a) {
223
- float prod = a * a;
224
- vec2 a_fp64 = split(a);
58
+ float prod = a * a;
59
+ vec2 a_fp64 = split(a);
225
60
  #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
226
- float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *
227
- a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;
61
+ float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *
62
+ a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;
228
63
  #else
229
- float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;
64
+ float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;
230
65
  #endif
231
- return vec2(prod, err);
66
+ return vec2(prod, err);
232
67
  }
233
-
234
68
  vec2 twoProd(float a, float b) {
235
- float prod = a * b;
236
- vec2 a_fp64 = split(a);
237
- vec2 b_fp64 = split(b);
238
- float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +
239
- a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;
240
- return vec2(prod, err);
241
- }
242
-
69
+ float prod = a * b;
70
+ vec2 a_fp64 = split(a);
71
+ vec2 b_fp64 = split(b);
72
+ float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +
73
+ a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;
74
+ return vec2(prod, err);
75
+ }
243
76
  vec2 sum_fp64(vec2 a, vec2 b) {
244
- vec2 s, t;
245
- s = twoSum(a.x, b.x);
246
- t = twoSum(a.y, b.y);
247
- s.y += t.x;
248
- s = quickTwoSum(s.x, s.y);
249
- s.y += t.y;
250
- s = quickTwoSum(s.x, s.y);
251
- return s;
252
- }
253
-
77
+ vec2 s, t;
78
+ s = twoSum(a.x, b.x);
79
+ t = twoSum(a.y, b.y);
80
+ s.y += t.x;
81
+ s = quickTwoSum(s.x, s.y);
82
+ s.y += t.y;
83
+ s = quickTwoSum(s.x, s.y);
84
+ return s;
85
+ }
254
86
  vec2 sub_fp64(vec2 a, vec2 b) {
255
- vec2 s, t;
256
- s = twoSub(a.x, b.x);
257
- t = twoSub(a.y, b.y);
258
- s.y += t.x;
259
- s = quickTwoSum(s.x, s.y);
260
- s.y += t.y;
261
- s = quickTwoSum(s.x, s.y);
262
- return s;
263
- }
264
-
87
+ vec2 s, t;
88
+ s = twoSub(a.x, b.x);
89
+ t = twoSub(a.y, b.y);
90
+ s.y += t.x;
91
+ s = quickTwoSum(s.x, s.y);
92
+ s.y += t.y;
93
+ s = quickTwoSum(s.x, s.y);
94
+ return s;
95
+ }
265
96
  vec2 mul_fp64(vec2 a, vec2 b) {
266
- vec2 prod = twoProd(a.x, b.x);
267
- // y component is for the error
268
- prod.y += a.x * b.y;
97
+ vec2 prod = twoProd(a.x, b.x);
98
+ prod.y += a.x * b.y;
269
99
  #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
270
- prod = split2(prod);
100
+ prod = split2(prod);
271
101
  #endif
272
- prod = quickTwoSum(prod.x, prod.y);
273
- prod.y += a.y * b.x;
102
+ prod = quickTwoSum(prod.x, prod.y);
103
+ prod.y += a.y * b.x;
274
104
  #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
275
- prod = split2(prod);
105
+ prod = split2(prod);
276
106
  #endif
277
- prod = quickTwoSum(prod.x, prod.y);
278
- return prod;
107
+ prod = quickTwoSum(prod.x, prod.y);
108
+ return prod;
279
109
  }
280
-
281
110
  vec2 div_fp64(vec2 a, vec2 b) {
282
- float xn = 1.0 / b.x;
111
+ float xn = 1.0 / b.x;
283
112
  #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
284
- vec2 yn = mul_fp64(a, vec2(xn, 0));
113
+ vec2 yn = mul_fp64(a, vec2(xn, 0));
285
114
  #else
286
- vec2 yn = a * xn;
115
+ vec2 yn = a * xn;
287
116
  #endif
288
- float diff = (sub_fp64(a, mul_fp64(b, yn))).x;
289
- vec2 prod = twoProd(xn, diff);
290
- return sum_fp64(yn, prod);
117
+ float diff = (sub_fp64(a, mul_fp64(b, yn))).x;
118
+ vec2 prod = twoProd(xn, diff);
119
+ return sum_fp64(yn, prod);
291
120
  }
292
-
293
121
  vec2 sqrt_fp64(vec2 a) {
294
- if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);
295
- if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
296
-
297
- float x = 1.0 / sqrt(a.x);
298
- float yn = a.x * x;
122
+ if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);
123
+ if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
124
+ float x = 1.0 / sqrt(a.x);
125
+ float yn = a.x * x;
299
126
  #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
300
- vec2 yn_sqr = twoSqr(yn) * ONE;
127
+ vec2 yn_sqr = twoSqr(yn) * ONE;
301
128
  #else
302
- vec2 yn_sqr = twoSqr(yn);
129
+ vec2 yn_sqr = twoSqr(yn);
303
130
  #endif
304
- float diff = sub_fp64(a, yn_sqr).x;
305
- vec2 prod = twoProd(x * 0.5, diff);
131
+ float diff = sub_fp64(a, yn_sqr).x;
132
+ vec2 prod = twoProd(x * 0.5, diff);
306
133
  #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
307
- return sum_fp64(split(yn), prod);
134
+ return sum_fp64(split(yn), prod);
308
135
  #else
309
- return sum_fp64(vec2(yn, 0.0), prod);
136
+ return sum_fp64(vec2(yn, 0.0), prod);
310
137
  #endif
311
138
  }
312
- `;var Fl={ONE:1};function wl(){return Fl}var ot={name:"fp64-arithmetic",vs:Ao,getUniforms:wl,fp64ify:Wn,fp64LowPart:_o,fp64ifyMatrix4:po};var Hn=P(M(),1);var br=class{constructor(t){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=kt(Object.values(t));Hn.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],a=this.modules[i];if(!a){Hn.log.warn(`Module ${n} not found`)();continue}let s=this.moduleUniforms[i],f=((r=a.getUniforms)===null||r===void 0?void 0:r.call(a,o,this.moduleUniforms[i]))||o;this.moduleUniforms[i]={...s,...f}}}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,a]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(a)}}return t}};var Se=P(M(),1),Sr=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,Se.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,Se.assert)(this.indices.usage===Se.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 To(e,t){if(t instanceof Sr)return t;let r=Bl(e,t),{attributes:n,bufferLayout:i}=Ul(e,t);return new Sr({topology:t.topology||"triangle-list",bufferLayout:i,vertexCount:t.vertexCount,indices:r,attributes:n})}function Bl(e,t){if(!t.indices)return;let r=t.indices.value;return e.createBuffer({usage:Se.Buffer.INDEX,data:r})}function Ul(e,t){let r=[],n={};for(let[o,a]of Object.entries(t.attributes)){let s=o;switch(o){case"POSITION":s="positions";break;case"NORMAL":s="normals";break;case"TEXCOORD_0":s="texCoords";break;case"COLOR_0":s="colors";break}n[s]=e.createBuffer({data:a.value,id:`${o}-buffer`});let{value:f,size:l,normalized:u}=a;r.push({name:s,format:(0,Se.getVertexFormatFromAttribute)(f,l,u)})}let i=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:i}}var vo=P(M(),1),Ne=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new Ne(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={...Ne.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)),a=this._getHash(JSON.stringify(t.bufferLayout));return`${r}/${n}V${i}T${t.topology}P${o}BL${a}}`;default:return`${r}/${n}V${i}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}};Ne.defaultProps={...vo.RenderPipeline.defaultProps,vs:void 0,fs:void 0};function mo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={},n=`Shader Layout for ${t}`;for(let i of e.attributes)if(i){let o=`${i.location} ${i.name}: ${i.type}`;r[`in ${o}`]={[n]:i.stepMode||"vertex"}}for(let i of e.varyings||[]){let o=`${i.location} ${i.name}`;r[`out ${o}`]={[n]:JSON.stringify(i.accessor)}}return r}var at=2,Wl=1e4,Y=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.props={...Y.defaultProps,...r},r=this.props,this.id=r.id||(0,V.uid)("model"),this.device=t,Object.assign(this.userData,r.userData);let a=Object.fromEntries(((n=this.props.modules)===null||n===void 0?void 0:n.map(d=>[d.name,d]))||[]);this.setShaderInputs(r.shaderInputs||new br(a));let s=Hl(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:l,fs:u,getUniforms:c}=this.props.shaderAssembler.assembleShaders({platformInfo:s,...this.props,modules:f});if(this.vs=l,this.fs=u,this._getModuleUniforms=c,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||Ne.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()}}setGeometry(t){let r=t&&To(this.device,t);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=bo(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(t){this.vertexCount=t.vertexCount,this.setAttributes(t.attributes,"ignore-unknown"),this.setIndexBuffer(t.indices)}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){this.bufferLayout=this._gpuGeometry?bo(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 Ie.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}}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(f=>So(f).includes(n));if(!o){V.log.warn(`Model(${this.id}): Missing layout for buffer "${n}".`)();continue}let a=So(o),s=!1;for(let f of a){let l=this._attributeInfos[f];l&&(this.vertexArray.setBuffer(l.location,i),s=!0)}!s&&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(){return this._pipelineNeedsUpdate&&(this.pipeline&&V.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null}),this._attributeInfos=(0,Ro.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline}_logDrawCallStart(){let t=V.log.level>3?0:Wl;Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,V.log.group(at,`>>> DRAWING MODEL ${this.id}`,{collapsed:V.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=mo(this.pipeline.shaderLayout);V.log.table(at,t)();let r=this.shaderInputs.getDebugTable();for(let[i,o]of Object.entries(this.uniforms))r[i]={value:o};V.log.table(at,r)();let n=this._getAttributeDebugTable();V.log.table(at,this._attributeInfos)(),V.log.table(at,n)(),V.log.groupEnd(at)(),this._logOpen=!1}}_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,Ie.getTypedArrayFromDataType)(r);return(t instanceof Ie.Buffer?new n(t.debugData):t).toString()}};Y.defaultProps={...Ie.RenderPipeline.defaultProps,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:fe.getDefaultShaderAssembler()};function bo(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 Hl(e){return{type:e.info.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}function So(e){var t;return e.attributes?(t=e.attributes)===null||t===void 0?void 0:t.map(r=>r.attribute):[e.name]}var Vl="transform_output",Me=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 Y(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Un({version:300,input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:Vl}),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:a,height:s}=o;t.framebuffer&&t.framebuffer.destroy(),t.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:a,height:s,colorAttachments:[o]}),t.framebuffer.resize({width:a,height:s})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let n in r)r[n].sampler=this.sampler}};var st=P(M(),1),Re=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,st.uid)("geometry"),this.topology=t.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[o,a]of Object.entries(r)){let s=ArrayBuffer.isView(a)?{value:a}:a;(0,st.assert)(ArrayBuffer.isView(s.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!s.size&&(s.size=3),o==="indices"?((0,st.assert)(!this.indices),this.indices=s):this.attributes[o]=s}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:a,constant:s}=i;!s&&o&&a>=1&&(n=Math.min(n,o.length/a))}return(0,st.assert)(Number.isFinite(n)),n}};var yo=P(M(),1);var Kt=class extends Re{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=(0,yo.uid)("cube-geometry"),indices:n=!0}=t;super(n?{...t,id:r,topology:"triangle-list",indices:{size:1,value:Xl},attributes:{...Yl,...t.attributes}}:{...t,id:r,topology:"triangle-list",indices:void 0,attributes:{...Zl,...t.attributes}})}},Xl=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]),Ll=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]),zl=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]),jl=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]),kl=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,-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]),$l=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]),Kl=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]),Yl={POSITION:{size:3,value:Ll},NORMAL:{size:3,value:zl},TEXCOORD_0:{size:2,value:jl}},Zl={POSITION:{size:4,value:kl},TEXCOORD_0:{size:2,value:$l},COLOR_0:{size:3,value:Kl}};var ql="Failed to create WebGL context in Node.js, headless gl returned null",Ql=" 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.",Jl={width:1,height:1,debug:!0,throwOnError:!1},Vn=null;function Eo(){return Vn!==null}function xo(e){e={...Jl,...e};let{width:t,height:r,webgl1:n,webgl2:i}=e;if(i&&!n)throw new Error("headless-gl does not support WebGL2");if(!Vn)throw new Error(Ql);let o=Vn(t,r,e);if(!o)throw new Error(ql);return o}var H=P(M(),1);function Yt(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 le(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||Yt()}var Xp=globalThis.self||globalThis.window||globalThis.global,Lp=globalThis.window||globalThis.self||globalThis.global,zp=globalThis.document||{},jp=globalThis.process||{},kp=globalThis.console,Oo=globalThis.navigator||{};var Xn=globalThis;function Rr(e){if(!e&&!le())return"Node";if(Yt(e))return"Electron";let t=e||Oo.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Xn.chrome?"Chrome":Xn.safari?"Safari":Xn.mozInnerScreenX?"Firefox":"Unknown"}var Bo=P(M(),1);var Zt={};function Gl(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function eu(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function tu(e,t){Zt[e]=!0,t!==void 0&&Gl(t)}function ru(e){let t=e.getError;e.getError=function(){let n;do n=t.apply(e),n!==0&&(Zt[n]=!0);while(n!==0);for(n in Zt)if(Zt[n])return delete Zt[n],parseInt(n,10);return 0}}var qt=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};qt.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()};qt.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var ke=function(t){let r=this;this.gl=t,ru(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 a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);let s=a.attribs[o];return s.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(o){let a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);let s=a.attribs[o];return s.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(o,a){switch(o){case 34962:r.currentArrayBuffer=a;break;case 34963:r.currentVertexArrayObject.elementArrayBuffer=a;break;default:}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(o,a){let f=r.currentVertexArrayObject.attribs[o];switch(a){case 34975:return f.buffer;case 34338:return f.enabled;case 34339:return f.size;case 34340:return f.stride;case 34341:return f.type;case 34922:return f.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(o,a,s,f,l,u){let c=r.currentVertexArrayObject;c.maxAttrib=Math.max(c.maxAttrib,o);let d=c.attribs[o];return d.buffer=r.currentArrayBuffer,d.size=a,d.type=s,d.normalized=f,d.stride=l,d.offset=u,d.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{eu("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};ke.prototype.VERTEX_ARRAY_BINDING_OES=34229;ke.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 qt(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};ke.prototype.createVertexArrayOES=function(){let t=new qt(this);return this.vertexArrayObjects.push(t),t};ke.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};ke.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof qt&&t.hasBeenBound&&t.ext===this)};ke.prototype.bindVertexArrayOES=function(t){let r=this.gl;if(t&&!t.isAlive){tu(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 a=this.currentArrayBuffer,s=Math.max(i?i.maxAttrib:0,o.maxAttrib);for(let f=0;f<=s;f++){let l=o.attribs[f],u=i?i.attribs[f]:null;if((!i||l.enabled!==u.enabled)&&(l.enabled?n.enableVertexAttribArray.call(r,f):n.disableVertexAttribArray.call(r,f)),l.enabled){let c=!1;(!i||l.buffer!==u.buffer)&&(a!==l.buffer&&(n.bindBuffer.call(r,34962,l.buffer),a=l.buffer),c=!0),(c||l.cached!==u.cached)&&n.vertexAttribPointer.call(r,f,l.size,l.type,l.normalized,l.stride,l.offset)}}this.currentArrayBuffer!==a&&n.bindBuffer.call(r,34962,this.currentArrayBuffer)};function Co(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 ke(this)),this.__OESVertexArrayObject))}}var $e=P(M(),1);var Po=P(M(),1),nu="Invalid WebGLRenderingContext";function iu(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function D(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Ln(e){return D(e)?e:null}function No(e){return(0,Po.assert)(iu(e),nu),e}var Io="OES_element_index",Mo="WEBGL_draw_buffers",ou="EXT_disjoint_timer_query",au="EXT_disjoint_timer_query_webgl2",su="EXT_texture_filter_anisotropic",Do="WEBGL_debug_renderer_info",fu=35723,lu=4352,uu=36795,cu=34047,du=37445,gu=37446,B=e=>D(e)?void 0:0,hu={[3074]:e=>D(e)?void 0:36064,[fu]:e=>D(e)?void 0:lu,[35977]:B,[32937]:B,[uu]:(e,t)=>{let r=D(e)?e.getExtension(au):e.getExtension(ou);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[du]:(e,t)=>{let r=e.getExtension(Do);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[gu]:(e,t)=>{let r=e.getExtension(Do);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[cu]:(e,t)=>{var r;let n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[su])||e.getExtension("EXT_texture_filter_anisotropic");return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},[32883]:B,[35071]:B,[37447]:B,[36063]:(e,t)=>{if(!D(e)){let r=e.getExtension(Mo);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},[35379]:B,[35374]:B,[35377]:B,[34852]:e=>{if(!D(e)){let t=e.getExtension(Mo);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},[36203]:e=>e.getExtension(Io)?2147483647:65535,[33001]:e=>e.getExtension(Io)?16777216:65535,[33e3]:e=>16777216,[37157]:B,[35373]:B,[35657]:B,[36183]:B,[37137]:B,[34045]:B,[35978]:B,[35979]:B,[35968]:B,[35376]:B,[35375]:B,[35659]:B,[37154]:B,[35371]:B,[35658]:B,[35076]:B,[35077]:B,[35380]:B};function Fo(e,t,r){let n=hu[r],i=typeof n=="function"?n(e,t,r):n;return i!==void 0?i:t(r)}function ft(e){if(!e.luma){let r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var _u="OES_vertex_array_object",wo="ANGLE_instanced_arrays",pu="WEBGL_draw_buffers",Au="EXT_disjoint_timer_query",Tu="EXT_texture_filter_anisotropic",vu="VertexArray requires WebGL2 or OES_vertex_array_object extension";function mu(e,t){return{webgl2:D(e),ext:e.getExtension(t)}}var zn={[_u]:{meta:{suffix:"OES"},createVertexArray:()=>{(0,$e.assert)(!1,vu)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[wo]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){(0,$e.assert)(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[pu]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{(0,$e.assert)(!1)}},[Au]:{meta:{suffix:"EXT"},createQuery:()=>{(0,$e.assert)(!1)},deleteQuery:()=>{(0,$e.assert)(!1)},beginQuery:()=>{(0,$e.assert)(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:(e,t)=>{}}},yr={readBuffer:(e,t,r)=>{D(e)&&t(r)},getVertexAttrib:(e,t,r,n)=>{let{webgl2:i,ext:o}=mu(e,wo),a;switch(n){case 35069:a=i?void 0:!1;break;case 35070:a=!i&&!o?0:void 0;break;default:}return a!==void 0?a:t(r,n)},getProgramParameter:(e,t,r,n)=>{if(!D(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(!D(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=ft(e),{_extensions:o}=i,a=o[Tu];n=a&&a.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,n)},getParameter:Fo,hint(e,t,r,n){return t(r,n)}};function Uo(e){let t=ft(e);return t._polyfilled||(Co(e),bu(e),Su(e,zn),yu(e,{target:t,target2:e}),t._polyfilled=!0),e}function bu(e){let t=ft(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 Su(e,t){let r=ft(e);for(let n of Object.getOwnPropertyNames(t))n!=="overrides"&&Ru(e,{extension:n,target:r,target2:e})}function Ru(e,t){let{extension:r,target:n,target2:i}=t,o=zn[r];(0,Bo.assert)(o);let{meta:a={}}=o,{suffix:s=""}=a,f=e.getExtension(r);for(let l of Object.keys(o)){let u=`${l}${s}`,c=null;l==="meta"||typeof e[l]=="function"||(f&&typeof f[u]=="function"?c=function(){return f[u](...arguments)}:typeof o[l]=="function"&&(c=o[l].bind(n))),c&&(n[l]=c,i[l]=c)}}function yu(e,t){let{target:r,target2:n}=t;Object.keys(yr).forEach(i=>{if(typeof yr[i]=="function"){let o=e[i]?e[i].bind(e):()=>{},a=yr[i].bind(null,e,o);r[i]=a,n[i]=a}})}var Jt=P(M(),1);var Er={[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},_e=(e,t,r)=>t?e.enable(r):e.disable(r),Wo=(e,t,r)=>e.hint(r,t),ne=(e,t,r)=>e.pixelStorei(r,t),Ho=(e,t,r)=>{let n;return r===36006?n=D(e)?36009:36160:n=36008,e.bindFramebuffer(n,t)},Qt=(e,t,r)=>{let i={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];e.bindBuffer(i,t)};function jn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var Vo={[3042]:_e,[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]:_e,[2885]:(e,t)=>e.cullFace(t),[2929]:_e,[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]:_e,[35723]:Wo,[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]:Ho,[36010]:Ho,[34964]:Qt,[36662]:Qt,[36663]:Qt,[35053]:Qt,[35055]:Qt,[2886]:(e,t)=>e.frontFace(t),[33170]:Wo,[2849]:(e,t)=>e.lineWidth(t),[32823]:_e,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:_e,[32926]:_e,[32928]:_e,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:_e,[3088]:(e,t)=>e.scissor(...t),[2960]:_e,[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]:ne,[3317]:ne,[37440]:ne,[37441]:ne,[37443]:ne,[3330]:ne,[3332]:ne,[3331]:ne,[3314]:ne,[32878]:ne,[3316]:ne,[3315]:ne,[32877]:ne,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=jn(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=jn(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,a,s]=t;e.stencilFuncSeparate(1028,r,n,i),e.stencilFuncSeparate(1029,o,a,s)},stencilOp:(e,t)=>{t=jn(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,a,s]=t;e.stencilOpSeparate(1028,r,n,i),e.stencilOpSeparate(1029,o,a,s)},viewport:(e,t)=>e.viewport(...t)};function X(e,t,r){return t[e]!==void 0?t[e]:r[e]}var Xo={blendEquation:(e,t,r)=>e.blendEquationSeparate(X(32777,t,r),X(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(X(32969,t,r),X(32968,t,r),X(32971,t,r),X(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(X(32824,t,r),X(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(X(32938,t,r),X(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,X(2962,t,r),X(2967,t,r),X(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,X(34816,t,r),X(36003,t,r),X(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,X(2964,t,r),X(2965,t,r),X(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,X(34817,t,r),X(34818,t,r),X(34819,t,r))},kn={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]})},pe=(e,t)=>e.isEnabled(t),$n={[3042]:pe,[2884]:pe,[2929]:pe,[3024]:pe,[32823]:pe,[32926]:pe,[32928]:pe,[3089]:pe,[2960]:pe,[35977]:pe},Lo=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 ye(e,t){let n=k.attach(e).gl;if(Eu(t))return;let i={};for(let a in t){let s=Number(a),f=Vo[a];f&&(typeof f=="string"?i[f]=!0:f(n,t[a],s))}let o=n.state&&n.state.cache;if(o)for(let a in i){let s=Xo[a];s(n,t,o)}}function zo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Er,n=k.attach(e).gl;if(typeof t=="number"){let a=t,s=$n[a];return s?s(n,a):n.getParameter(a)}let i=Array.isArray(t)?t:Object.keys(t),o={};for(let a of i){let s=$n[a];o[a]=s?s(n,Number(a)):n.getParameter(Number(a))}return o}function Eu(e){for(let t in e)return!1;return!0}function jo(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 Kn=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?zo(t):Object.assign({},Er),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,Jt.assert)(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];ye(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,Jt.assert)(o!==void 0);let a=t[o],s=this.cache[o];jo(a,s)||(r=!0,n=s,i&&!(o in i)&&(i[o]=s),this.cache[o]=a)}return{valueChanged:r,oldValue:n}}};function Ke(e){return e.state}function Yn(e,t){let{enable:r=!0,copyState:n}=t;if((0,Jt.assert)(n!==void 0),!e.state){e.state=new Kn(e,{copyState:n}),Ou(e);for(let o in kn){let a=kn[o];xu(e,o,a)}ko(e,"getParameter"),ko(e,"isEnabled")}let i=Ke(e);return i.enable=r,e}function De(e){let t=Ke(e);t||(Yn(e,{copyState:!1}),t=Ke(e)),t.push()}function Ee(e){let t=Ke(e);(0,Jt.assert)(t),t.pop()}function ko(e,t){let r=e[t].bind(e);e[t]=function(i){if(i===void 0||Lo.has(i))return r(i);let o=Ke(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 xu(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(){let o=Ke(e);for(var a=arguments.length,s=new Array(a),f=0;f<a;f++)s[f]=arguments[f];let{valueChanged:l,oldValue:u}=r(o._updateCache,...s);return l&&n(...s),u},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function Ou(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let i=Ke(e);i.program!==n&&(t(n),i.program=n)}}var Cu={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function $o(e,t){t={...Cu,...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",a=>o(a),!1)}if(t.onContextRestored){let{onContextRestored:o}=t;e.addEventListener("webglcontextrestored",a=>o(a),!1)}return i}function Ko(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),a=i||t,s=o||r,f=e.getParameter(7938),l=Yo(a,s),u=Pu(a,s),c=Nu(a,s),d="glsl",g=D(e)?300:100;return{type:D(e)?"webgl2":"webgl",gpu:l,gpuType:c,gpuBackend:u,vendor:a,renderer:s,version:f,shadingLanguage:d,shadingLanguageVersion:g}}function Yo(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 Pu(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function Nu(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Yo(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Zo(){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 Qn=P(M(),1);function xr(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 q="texture-compression-bc",F="texture-compression-astc",Ae="texture-compression-etc2",Iu="texture-compression-etc1-webgl",Or="texture-compression-pvrtc-webgl",Zn="texture-compression-atc-webgl",Gt="WEBGL_compressed_texture_s3tc",er="WEBGL_compressed_texture_s3tc_srgb",lt="EXT_texture_compression_rgtc",tr="EXT_texture_compression_bptc",Mu="WEBGL_compressed_texture_etc",Du="WEBGL_compressed_texture_astc",Fu="WEBGL_compressed_texture_etc1",wu="WEBGL_compressed_texture_pvrtc",Bu="WEBGL_compressed_texture_atc",qo="EXT_sRGB",xe="EXT_texture_norm16",Uu="WEBGL_color_buffer_float",Wu="EXT_color_buffer_float",ue=(e,t)=>e.getExtension(t),Ye=(e,t)=>t.every(r=>e.getExtension(r)),qn={"texture-blend-float-webgl1":e=>D(e)?!0:ue(e,"EXT_float_blend"),"texture-formats-srgb-webgl1":e=>D(e)?!0:ue(e,qo),"texture-formats-depth-webgl1":e=>D(e)?!0:ue(e,"WEBGL_depth_texture"),"texture-formats-float32-webgl1":e=>D(e)?!0:ue(e,"OES_texture_float"),"texture-formats-float16-webgl1":e=>D(e)?!0:ue(e,"OES_texture_half_float"),"texture-formats-norm16-webgl":e=>D(e)?ue(e,xe):!1,"texture-filter-linear-float32-webgl":e=>ue(e,"OES_texture_float_linear"),"texture-filter-linear-float16-webgl":e=>ue(e,"OES_texture_half_float_linear"),"texture-filter-anisotropic-webgl":e=>ue(e,"EXT_texture_filter_anisotropic"),"texture-renderable-float32-webgl":e=>ue(e,"EXT_color_buffer_float"),"texture-renderable-float16-webgl":e=>ue(e,"EXT_color_buffer_half_float"),"texture-compression-bc":e=>Ye(e,[Gt,er,lt,tr]),"texture-compression-bc5-webgl":e=>Ye(e,[lt]),"texture-compression-etc2":e=>Ye(e,[Mu]),"texture-compression-astc":e=>Ye(e,[Du]),"texture-compression-etc1-webgl":e=>Ye(e,[Fu]),"texture-compression-pvrtc-webgl":e=>Ye(e,[wu]),"texture-compression-atc-webgl":e=>Ye(e,[Bu])};function Hu(e,t){var r;return((r=qn[t])===null||r===void 0?void 0:r.call(qn,e))||!1}function Qo(e){return Object.keys(qn).filter(r=>Hu(e,r))}var rr={"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:xe},"r16snorm-webgl":{gl:36760,b:2,c:1,f:"texture-formats-norm16-webgl",x:xe},"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:qo,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:xe},"rg16snorm-webgl":{gl:36761,b:2,c:2,f:"texture-formats-norm16-webgl",x:xe},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:xe},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:"texture-formats-norm16-webgl",x:xe},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:xe},"rgba16snorm-webgl":{gl:36763,b:2,c:4,f:"texture-formats-norm16-webgl",x:xe},"rgb32float-webgl":{gl:34837,gl1:6407,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",gl2ext:Wu,gl1ext:Uu,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:Gt,f:q},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:er,f:q},"bc1-rgba-unorm":{gl:33777,x:Gt,f:q},"bc1-rgba-unorm-srgb":{gl:35916,x:er,f:q},"bc2-rgba-unorm":{gl:33778,x:Gt,f:q},"bc2-rgba-unorm-srgb":{gl:35918,x:er,f:q},"bc3-rgba-unorm":{gl:33779,x:Gt,f:q},"bc3-rgba-unorm-srgb":{gl:35919,x:er,f:q},"bc4-r-unorm":{gl:36283,x:lt,f:q},"bc4-r-snorm":{gl:36284,x:lt,f:q},"bc5-rg-unorm":{gl:36285,x:lt,f:q},"bc5-rg-snorm":{gl:36286,x:lt,f:q},"bc6h-rgb-ufloat":{gl:36495,x:tr,f:q},"bc6h-rgb-float":{gl:36494,x:tr,f:q},"bc7-rgba-unorm":{gl:36492,x:tr,f:q},"bc7-rgba-unorm-srgb":{gl:36493,x:tr,f:q},"etc2-rgb8unorm":{gl:37492,f:Ae},"etc2-rgb8unorm-srgb":{gl:37494,f:Ae},"etc2-rgb8a1unorm":{gl:37496,f:Ae},"etc2-rgb8a1unorm-srgb":{gl:37497,f:Ae},"etc2-rgba8unorm":{gl:37493,f:Ae},"etc2-rgba8unorm-srgb":{gl:37495,f:Ae},"eac-r11unorm":{gl:37488,f:Ae},"eac-r11snorm":{gl:37489,f:Ae},"eac-rg11unorm":{gl:37490,f:Ae},"eac-rg11snorm":{gl:37491,f:Ae},"astc-4x4-unorm":{gl:37808,f:F},"astc-4x4-unorm-srgb":{gl:37840,f:F},"astc-5x4-unorm":{gl:37809,f:F},"astc-5x4-unorm-srgb":{gl:37841,f:F},"astc-5x5-unorm":{gl:37810,f:F},"astc-5x5-unorm-srgb":{gl:37842,f:F},"astc-6x5-unorm":{gl:37811,f:F},"astc-6x5-unorm-srgb":{gl:37843,f:F},"astc-6x6-unorm":{gl:37812,f:F},"astc-6x6-unorm-srgb":{gl:37844,f:F},"astc-8x5-unorm":{gl:37813,f:F},"astc-8x5-unorm-srgb":{gl:37845,f:F},"astc-8x6-unorm":{gl:37814,f:F},"astc-8x6-unorm-srgb":{gl:37846,f:F},"astc-8x8-unorm":{gl:37815,f:F},"astc-8x8-unorm-srgb":{gl:37847,f:F},"astc-10x5-unorm":{gl:37819,f:F},"astc-10x5-unorm-srgb":{gl:37851,f:F},"astc-10x6-unorm":{gl:37817,f:F},"astc-10x6-unorm-srgb":{gl:37849,f:F},"astc-10x8-unorm":{gl:37818,f:F},"astc-10x8-unorm-srgb":{gl:37850,f:F},"astc-10x10-unorm":{gl:37819,f:F},"astc-10x10-unorm-srgb":{gl:37851,f:F},"astc-12x10-unorm":{gl:37820,f:F},"astc-12x10-unorm-srgb":{gl:37852,f:F},"astc-12x12-unorm":{gl:37821,f:F},"astc-12x12-unorm-srgb":{gl:37853,f:F},"pvrtc-rgb4unorm-webgl":{gl:35840,f:Or},"pvrtc-rgba4unorm-webgl":{gl:35842,f:Or},"pvrtc-rbg2unorm-webgl":{gl:35841,f:Or},"pvrtc-rgba2unorm-webgl":{gl:35843,f:Or},"etc1-rbg-unorm-webgl":{gl:36196,f:Iu},"atc-rgb-unorm-webgl":{gl:35986,f:Zn},"atc-rgba-unorm-webgl":{gl:35986,f:Zn},"atc-rgbai-unorm-webgl":{gl:34798,f:Zn}},Vu={[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},Xu={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function nr(e,t){let r=ir(t),n=rr[r];if(!n||(D(e)?n.gl===void 0:n.gl1===void 0))return!1;let i=n.x||D(e)&&n.gl2ext||n.gl1ext;return i?Boolean(e.getExtension(i)):!0}function Jo(e,t){var r;return nr(e,t)&&((r=rr[t])===null||r===void 0?void 0:r.renderbuffer)}function ir(e){if(typeof e=="string")return e;let t=Object.entries(rr).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 or(e,t){let r=rr[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error(`Unsupported texture format ${e}`);return n}function Go(e,t){let r=ir(t);if(!nr(e,r))return!1;try{if((0,Qn.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 ea(e,t){let r=ir(t);return!(!nr(e,r)||typeof r=="number")}function ut(e,t){let r=ir(e),n=or(r,t),i=(0,Qn.decodeTextureFormat)(r);return{format:n,dataFormat:Lu(i.format,i.integer,i.normalized,n),type:i.dataType?xr(i.dataType):5121,compressed:i.compressed}}function ta(e){let t=rr[e];if(!(t!=null&&t.attachment))throw new Error(`${e} is not a depth stencil format`);return t.attachment}function ra(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 a=0,s=1,f=1,l=0,u=new Uint8Array([0,0,255,255]);e.texImage2D(3553,a,t,s,f,l,r,n,u),o=e.createFramebuffer(),e.bindFramebuffer(36160,o),e.framebufferTexture2D(36160,36064,3553,i,0);let c=e.checkFramebufferStatus(36160)===36053;return e.bindTexture(3553,null),c}finally{e.deleteTexture(i),e.deleteFramebuffer(o)}}function ar(e,t){let r=ir(e),n=ut(r,t),i=Vu[n.dataFormat]||4,o=Xu[n.type]||1;return i*o}function Lu(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 na(e){let t=zu(e);for(let r of Qo(e))t.add(r);return t}function zu(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(ia))ju(e,r)&&t.add(r);return t}function ju(e,t){let r=ia[t];if(!r)return!1;let[n,i]=r||[],o=D(e)?i:n;if(typeof o=="boolean")return o;switch(t){case"texture-renderable-rgba32float-webgl":return D(e)?Boolean(e.getExtension(o)):ra(e);case"glsl-derivatives":return Gn(e,o);case"glsl-frag-data":return Gn(e,o,{behavior:"require"});case"glsl-frag-depth":return Gn(e,o);default:return Boolean(e.getExtension(o))}}var Jn={};function Gn(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!Zo(r))return!0;if(t in Jn)return Jn[t];let n=r.behavior||"enable",i=`#extension GL_${t} : ${n}
313
- void main(void) {}`,o=e.createShader(35633);if(!o)throw new Error("shader");e.shaderSource(o,i),e.compileShader(o);let a=e.getShaderParameter(o,35713);return e.deleteShader(o),Jn[t]=a,a}var ia={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 oa(e){let t=Ln(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 aa(e){let t=Ln(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 _a=P(M(),1);var wr=P(M(),1);var z=P(M(),1);function Q(e,t,r){let i=k.attach(e).gl;if(ku(t))return r(e);let{nocatch:o=!0}=t;De(i),ye(i,t);let a;if(o)a=r(i),Ee(i);else try{a=r(i)}finally{Ee(i)}return a}function ku(e){for(let t in e)return!1;return!0}var Nr=P(M(),1);function fa(e,t,r,n){if((0,Nr.isObjectEmpty)(t))return n(e);De(e.gl);try{return $u(e,t),ye(e,r),n(e)}finally{Ee(e.gl)}}function $u(e,t){let r=k.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(sr("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(Yu("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(Pr("depthCompare",t.depthCompare))),t.stencilWriteMask){let i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&Nr.log.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let i=t.stencilReadMask||4294967295,o=Pr("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=ei("stencilPassOperation",t.stencilPassOperation),o=ei("stencilFailOperation",t.stencilFailOperation),a=ei("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,a,i),n.stencilOpSeparate(1029,o,a,i)}if(t.blendColorOperation||t.blendAlphaOperation){n.enable(3042);let i=sa("blendColorOperation",t.blendColorOperation||"add"),o=sa("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let a=Cr("blendColorSrcFactor",t.blendColorSrcFactor||"one"),s=Cr("blendColorDstFactor",t.blendColorDstFactor||"zero"),f=Cr("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),l=Cr("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(a,s,f,l)}}function Pr(e,t){return sr(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function ei(e,t){return sr(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function sa(e,t){return sr(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function Cr(e,t){return sr(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 Ku(e,t){return`Illegal parameter ${t} for ${e}`}function sr(e,t,r){if(!(t in r))throw new Error(Ku(e,t));return r[t]}function Yu(e,t){return t}function Ir(e){let t={};return e.addressModeU&&(t[10242]=ti(e.addressModeU)),e.addressModeV&&(t[10243]=ti(e.addressModeV)),e.addressModeW&&(t[32882]=ti(e.addressModeW)),e.magFilter&&(t[10240]=ua(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=Zu(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]=Pr("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function la(e){let t={...e};return e[10241]!==9728&&(t[10241]=9729),t[10242]=33071,t[10243]=33071,t}function ti(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function ua(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function Zu(e,t){if(!t)return ua(e);switch(e){case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var Te=P(M(),1),te=class extends Te.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=qu(this.props.usage),this.glUsage=Qu(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,Te.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 qu(e){return e&Te.Buffer.INDEX?34963:e&Te.Buffer.VERTEX?34962:e&Te.Buffer.UNIFORM?35345:34962}function Qu(e){return e&Te.Buffer.INDEX||e&Te.Buffer.VERTEX?35044:e&Te.Buffer.UNIFORM?35048:35044}var ca=P(M(),1);var Ze=class extends ca.Sampler{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.parameters=void 0,this.device=t,this.parameters=Ir(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 Ju={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},K=class extends z.Texture{constructor(t,r){var n;super(t,{...Ju,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=Gu(this.props),this.loaded=!1,typeof((n=this.props)===null||n===void 0?void 0:n.data)=="string"&&Object.assign(this.props,{data:(0,z.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(_=>this.initialize(Object.assign({},t,{pixels:_,data:_}))),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:a={},textureUnit:s=void 0}=t;r||(r=o);let{width:f,height:l,dataFormat:u,type:c,compressed:d=!1,mipmaps:g=!0}=t,{depth:h=0}=t,A=or(t.format,this.device.isWebGL2);return{width:f,height:l,compressed:d,dataFormat:u,type:c}=this._deduceParameters({format:t.format,type:c,dataFormat:u,compressed:d,data:r,width:f,height:l}),this.width=f,this.height=l,this.glFormat=A,this.type=c,this.dataFormat=u,this.textureUnit=s,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),g&&this.device.isWebGL1&&Mr(this.width,this.height)&&(z.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)(),g=!1),this.mipmaps=g,this.setImageData({data:r,width:f,height:l,depth:h,format:A,type:c,dataFormat:u,parameters:a,compressed:d}),this.setSampler(t.sampler),this._setSamplerParameters(i),g&&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 Ze?(this.sampler=t,r=t.props):(this.sampler=new Ze(this.device,t),r=t);let n=Ir(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&&Mr(this.width,this.height)?(z.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Q(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:a=0,parameters:s={}}=t,{data:f=null,type:l=this.type,width:u=this.width,height:c=this.height,dataFormat:d=this.dataFormat,compressed:g=!1}=t;f||(f=n),{type:l,dataFormat:d,compressed:g,width:u,height:c}=this._deduceParameters({format:this.props.format,type:l,dataFormat:d,compressed:g,data:f,width:u,height:c});let{gl:h}=this;h.bindTexture(this.target,this.handle);let A=null;({data:f,dataType:A}=this._getDataType({data:f,compressed:g}));let _;if(Q(this.gl,s,()=>{switch(A){case"null":h.texImage2D(r,i,o,u,c,0,d,l,f);break;case"typed-array":h.texImage2D(r,i,o,u,c,0,d,l,f,a);break;case"buffer":_=this.device.assertWebGL2(),_.bindBuffer(35052,f.handle||f),_.texImage2D(r,i,o,u,c,0,d,l,a),_.bindBuffer(35052,null);break;case"browser-object":this.device.isWebGL2?h.texImage2D(r,i,o,u,c,0,d,l,f):h.texImage2D(r,i,o,d,l,f);break;case"compressed":for(let[v,T]of f.entries())h.compressedTexImage2D(r,v,T.format,T.width,T.height,0,T.data);break;default:(0,z.assert)(!1,"Unknown image data type")}}),f&&f.byteLength)this.trackAllocatedMemory(f.byteLength,"Texture");else{let v=ar(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*v,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:n=null,data:i=null,x:o=0,y:a=0,width:s=this.width,height:f=this.height,level:l=0,glFormat:u=this.glFormat,type:c=this.type,dataFormat:d=this.dataFormat,compressed:g=!1,offset:h=0,parameters:A={}}=t;if({type:c,dataFormat:d,compressed:g,width:s,height:f}=this._deduceParameters({format:this.props.format,type:c,dataFormat:d,compressed:g,data:i,width:s,height:f}),(0,z.assert)(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){let _=i;i=_.data,s=_.shape[0],f=_.shape[1]}i instanceof te&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Q(this.gl,A,()=>{if(g)this.gl.compressedTexSubImage2D(r,l,o,a,s,f,u,i);else if(i===null)this.gl.texSubImage2D(r,l,o,a,s,f,d,c,null);else if(ArrayBuffer.isView(i))this.gl.texSubImage2D(r,l,o,a,s,f,d,c,i,h);else if(typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer){let _=this.device.assertWebGL2();_.bindBuffer(35052,i),_.texSubImage2D(r,l,o,a,s,f,d,c,h),_.bindBuffer(35052,null)}else this.device.isWebGL2?this.device.assertWebGL2().texSubImage2D(r,l,o,a,s,f,d,c,i):this.gl.texSubImage2D(r,l,o,a,d,c,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return z.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 te?{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:a,type:s,compressed:f}=t,l=ut(r,this.device.isWebGL2);return a=a||l.dataFormat,s=s||l.type,f=f||l.compressed,{width:i,height:o}=this._deduceImageSize(n,i,o),{dataFormat:a,type:s,compressed:f,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,z.assert)(i,"Could not deduced texture size"),(0,z.assert)(r===void 0||i.width===r,"Deduced texture width does not match supplied width"),(0,z.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:a,format:s=6408,type:f=5121}=t,l=o||a,u=await Promise.all(K.FACES.map(c=>{let d=l[c];return Promise.all(Array.isArray(d)?d:[d])}));this.bind(),K.FACES.forEach((c,d)=>{u[d].length>1&&this.props.mipmaps!==!1&&z.log.warn(`${this.id} has mipmap and multiple LODs.`)(),u[d].forEach((g,h)=>{n&&i?r.texImage2D(c,h,s,n,i,0,s,f,g):r.texImage2D(c,h,s,s,f,g)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:a,format:s=6408,type:f=5121}=t,{gl:l}=this,u=o||a;return this.bind(),u instanceof Promise?u.then(c=>this.setImageDataForFace(Object.assign({},t,{face:r,data:c,pixels:c}))):this.width||this.height?l.texImage2D(r,0,s,n,i,0,s,f,u):l.texImage2D(r,0,s,s,f,u),this}setImageData3D(t){let{level:r=0,dataFormat:n,format:i,type:o,width:a,height:s,depth:f=1,offset:l=0,data:u,parameters:c={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let d=ut(i,this.device.isWebGL2);if(Q(this.gl,c,()=>{ArrayBuffer.isView(u)&&this.gl.texImage3D(this.target,r,d.format,a,s,f,0,d.dataFormat,d.type,u),u instanceof te&&(this.gl.bindBuffer(35052,u.handle),this.gl.texImage3D(this.target,r,n,a,s,f,0,i,o,l))}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let g=ar(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*this.depth*g,"Texture")}return this.loaded=!0,this}_setSamplerParameters(t){if(this.device.isWebGL1&&Mr(this.width,this.height)&&(t=la(t)),!(0,z.isObjectEmpty)(t)){ec(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&&Mr(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}};K.FACES=[34069,34070,34071,34072,34073,34074];function Gu(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 Mr(e,t){return!e||!t?!1:!(0,z.isPowerOfTwo)(e)||!(0,z.isPowerOfTwo)(t)}function ec(e){z.log.log(1,"texture sampler parameters",e)()}var ha=P(M(),1);var Oe=P(M(),1);var da=P(M(),1);function Dr(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,da.assert)(n!==void 0,`Accessing undefined constant GL.${t}`),n}var ct="Resource subclass must define virtual methods",Fr=class extends Oe.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=k.attach(t);let i=this.device.gl;No(i);let{id:o}=r||{};this.gl=i,this.gl2=i,this.id=o||(0,Oe.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=Dr(this.gl,t),(0,Oe.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=D(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension)))){let s=i.webgl1,f="webgl2"in i?i.webgl2:i.webgl1;return o?f:s}}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=D(this.gl),a={},s=r||Object.keys(i);for(let f of s){let l=i[f];if(l&&(!("webgl2"in l)||o)&&(!("extension"in l)||this.gl.getExtension(l.extension))){let c=n?this.device.getGLKey(f):f;a[c]=this.getParameter(f,t),n&&l.type==="GLenum"&&(a[c]=this.device.getGLKey(a[c]))}}return a}setParameter(t,r){t=Dr(this.gl,t),(0,Oe.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=D(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=Dr(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,Oe.stubRemovedMethods)(this,t,r,n)}initialize(t){}_createHandle(){throw new Error(ct)}_deleteHandle(){throw new Error(ct)}_bindHandle(t){throw new Error(ct)}_getOptsFromHandle(){throw new Error(ct)}_getParameter(t,r){throw new Error(ct)}_setParameter(t,r){throw new Error(ct)}};var ga;ga=Symbol.toStringTag;var Fe=class extends Fr{get[ga](){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 Jo(t.gl,r)}constructor(t,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(t,r,Fe.defaultProps),this.glFormat=void 0,this.glFormat=or(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,ha.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)*ar(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)}};Fe.defaultProps={id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0};var ve=class extends wr.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],a=36064+i;o&&this._attachOne(a,o)}this.depthStencilAttachment&&this._attachOne(ta(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 ${rc(n)}`)}createDepthStencilTexture(t){return new Fe(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 Fe)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 K)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:a}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:this.device.assertWebGL2(),a?.framebufferTextureLayer(36160,t,r.target,i,n);break;case 34067:let s=tc(n);o.framebufferTexture2D(36160,t,s,r.handle,i);break;case 3553:o.framebufferTexture2D(36160,t,3553,r.handle,i);break;default:(0,wr.assert)(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function tc(e){return e<34069?e+34069:e}function rc(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 Br=class extends _a.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 ve(this.device,{handle:null}),this._framebuffer}update(){let t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t)}resize(t){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 me=P(M(),1),nc={spector:me.log.get("spector")||me.log.get("inspect")},ic="https://spectorcdn.babylonjs.com/spector.bundle.js",oc=1,re=null,pa=!1;async function Aa(e){if(!globalThis.SPECTOR)try{await(0,me.loadScript)(ic)}catch(t){me.log.warn(String(t))}}function Ta(e){var t,r;if(e={...nc,...e},!((t=e)!==null&&t!==void 0&&t.spector)||(!re&&globalThis.SPECTOR&&(me.log.probe(oc,"SPECTOR found and initialized")(),re=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=re)),!re))return null;if(!pa){var n,i;pa=!0,re.spyCanvases(),(n=re)===null||n===void 0||n.onCaptureStarted.add(s=>me.log.info("Spector capture started:",s)()),(i=re)===null||i===void 0||i.onCapture.add(s=>{var f,l,u;me.log.info("Spector capture complete:",s)(),(f=re)===null||f===void 0||f.getResultUI(),(l=re)===null||l===void 0||l.resultView.display(),(u=re)===null||u===void 0||u.resultView.addCapture(s)})}if((r=e)!==null&&r!==void 0&&r.canvas){var o,a;if(typeof e.spector=="string"&&e.spector!==e.canvas.id)return re;(o=re)===null||o===void 0||o.startCapture((a=e)===null||a===void 0?void 0:a.canvas,500),new Promise(s=>setTimeout(s,2e3)).then(s=>{var f;me.log.info("Spector capture stopped after 2 seconds")(),(f=re)===null||f===void 0||f.stopCapture()})}return re}var we=P(M(),1);var ac="https://unpkg.com/webgl-debug@2.0.1/index.js";function va(e){return e.luma=e.luma||{},e.luma}async function ma(){le()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await(0,we.loadScript)(ac))}function ba(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?fc(e,t):sc(e):null}function sc(e){let t=va(e);return t.realContext?t.realContext:e}function fc(e,t){if(!globalThis.WebGLDebugUtils)return we.log.warn("webgl-debug not loaded")(),e;let r=va(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...je,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,lc.bind(null,t),uc.bind(null,t));for(let a in je)!(a in n)&&typeof je[a]=="number"&&(n[a]=je[a]);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 ri(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 lc(e,t,r,n){n=Array.from(n).map(f=>f===void 0?"undefined":f);let i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),a=e.webgl2?"gl2":"gl1",s=`${i} in ${a}.${r}(${o})`;we.log.error(s)();debugger;if(e.throwOnError)throw new Error(s)}function uc(e,t,r){let n="";if(we.log.level>=1&&(n=ri(t,r),we.log.log(1,n)()),e.break&&e.break.length>0&&(n=n||ri(t,r),e.break.every(o=>n.indexOf(o)!==-1)))debugger;for(let i of r)if(i===void 0){if(n=n||ri(t,r),e.throwOnError)throw new Error(`Undefined argument: ${n}`);we.log.error(`Undefined argument: ${n}`)();debugger}}var ya=P(M(),1);function Ra(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[c,d]=i;r.push({message:d.trim(),type:Sa(c),lineNum:0,linePos:0});continue}let[o,a,s,...f]=i,l=parseInt(s,10);isNaN(l)&&(l=0);let u=parseInt(a,10);isNaN(u)&&(u=0),r.push({message:f.join(":").trim(),type:Sa(o),lineNum:l,linePos:u})}return r}function Sa(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var Ur=class extends ya.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 Ra(t)}_compile(t){t=(i=>i.startsWith("#version ")?i:`#version 100
314
- ${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 Ea=P(M(),1);var cc=256,dc=1024,gc=16384,ni=6144,Wr=class extends Ea.RenderPass{constructor(t,r){super(t,r),this.device=void 0,this.glParameters=void 0,this.device=t,De(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){Ee(this.device.gl),this.props.framebuffer&&ye(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,ye(this.device,r)}clear(){let t={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=gc,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=cc,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=dc,t.clearStencil=this.props.clearStencil),r!==0&&Q(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];Q(this.device.gl2,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl2.clearBufferiv(ni,t,r);break;case Uint32Array:this.device.gl2.clearBufferuiv(ni,t,r);break;case Float32Array:default:this.device.gl2.clearBufferfv(ni,t,r);break}})}};var J=P(M(),1),Fa=P(M(),1);var Hr=P(M(),1);function ii(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 hc={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},_c={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},Be=class{static getBytesPerElement(t){return ii(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return(0,Hr.assert)(t.size),ii(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 Be(hc,...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 Be.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return Be.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=(0,Hr.checkProps)("Accessor",t,_c),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 xa(e){return pc.includes(e)}var pc=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],Oa={[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 oi(e){let t=Oa[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function Ca(e){let t=Oa[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function Pa(e,t){let r={attributes:[],bindings:[]};r.attributes=Ac(e,t);let n=mc(e,t);for(let s of n){let f=s.uniforms.map(l=>({name:l.name,format:l.format,byteOffset:l.byteOffset,byteStride:l.byteStride,arrayLength:l.arrayLength}));r.bindings.push({type:"uniform",name:s.name,location:s.location,visibility:(s.vertex?1:0)&(s.fragment?2:0),minBindingSize:s.byteLength,uniforms:f})}let i=vc(e,t),o=0;for(let s of i)if(xa(s.type)){let{viewDimension:f,sampleType:l}=Sc(s.type);r.bindings.push({type:"texture",name:s.name,location:o,viewDimension:f,sampleType:l}),s.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let a=Tc(e,t);return a!=null&&a.length&&(r.varyings=a),r}function Ac(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:a,type:s}=o,f=e.getAttribLocation(t,a);if(f>=0){let{attributeType:l}=Ca(s),u=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:f,stepMode:u,type:l})}}return r.sort((i,o)=>i.location-o.location),r}function Tc(e,t){if(!D(e))return[];let r=e,n=[],i=e.getProgramParameter(t,35971);for(let o=0;o<i;o++){let a=r.getTransformFeedbackVarying(t,o);if(!a)throw new Error("activeInfo");let{name:s,type:f,size:l}=a,{glType:u,components:c}=oi(f),d=new Be({type:u,size:l*c}),g={location:o,name:s,accessor:d};n.push(g)}return n.sort((o,a)=>o.location-a.location),n}function vc(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:a,size:s,type:f}=o,{name:l,isArray:u}=Rc(a),c=e.getUniformLocation(t,l),d={location:c,name:l,size:s,type:f,isArray:u};if(r.push(d),d.size>1)for(let g=0;g<d.size;g++){let h=`${l}[${g}]`;c=e.getUniformLocation(t,h);let A={...d,name:h,location:c};r.push(A)}}return r}function mc(e,t){if(!D(e))return[];let r=e,n=(a,s)=>r.getActiveUniformBlockParameter(t,a,s),i=[],o=r.getProgramParameter(t,35382);for(let a=0;a<o;a++){let s={name:r.getActiveUniformBlockName(t,a)||"",location:n(a,35391),byteLength:n(a,35392),vertex:n(a,35396),fragment:n(a,35398),uniformCount:n(a,35394),uniforms:[]},f=n(a,35395)||[],l=r.getActiveUniforms(t,f,35383),u=r.getActiveUniforms(t,f,35384),c=r.getActiveUniforms(t,f,35387),d=r.getActiveUniforms(t,f,35388);for(let g=0;g<s.uniformCount;++g){let h=r.getActiveUniform(t,f[g]);if(!h)throw new Error("activeInfo");s.uniforms.push({name:h.name,format:oi(l[g]).format,type:l[g],arrayLength:u[g],byteOffset:c[g],byteStride:d[g]})}i.push(s)}return i.sort((a,s)=>a.location-s.location),i}var bc={[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 Sc(e){let t=bc[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function Rc(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 Na(e,t,r,n){let i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);let a=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,a);case 35664:return e.uniform2fv(t,a);case 35665:return e.uniform3fv(t,a);case 35666:return e.uniform4fv(t,a);case 5124:return e.uniform1iv(t,a);case 35667:return e.uniform2iv(t,a);case 35668:return e.uniform3iv(t,a);case 35669:return e.uniform4iv(t,a);case 35670:return e.uniform1iv(t,a);case 35671:return e.uniform2iv(t,a);case 35672:return e.uniform3iv(t,a);case 35673:return e.uniform4iv(t,a);case 5125:return i.uniform1uiv(t,a,1);case 36294:return i.uniform2uiv(t,a,2);case 36295:return i.uniform3uiv(t,a,3);case 36296:return i.uniform4uiv(t,a,4);case 35674:return e.uniformMatrix2fv(t,!1,a);case 35675:return e.uniformMatrix3fv(t,!1,a);case 35676:return e.uniformMatrix4fv(t,!1,a);case 35685:return i.uniformMatrix2x3fv(t,!1,a);case 35686:return i.uniformMatrix2x4fv(t,!1,a);case 35687:return i.uniformMatrix3x2fv(t,!1,a);case 35688:return i.uniformMatrix3x4fv(t,!1,a);case 35689:return i.uniformMatrix4x2fv(t,!1,a);case 35690:return i.uniformMatrix4x3fv(t,!1,a)}throw new Error("Illegal uniform")}function Ia(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 Ma(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 Da=4,Vr=class extends J.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,J.cast)(r.vs),this.fs=(0,J.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)}this._compileAndLink(),this.introspectedLayout=Pa(this.device.gl,this.handle),this.shaderLayout=(0,Fa.mergeShaderLayout)(this.introspectedLayout,r.shaderLayout)}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(a=>`"${a.name}"`).join(", ");J.log.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(n||J.log.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(n instanceof te)&&!(n.buffer instanceof te))throw new Error("buffer value");break;case"texture":if(!(n instanceof K||n instanceof ve))throw new Error("texture value");break;case"sampler":J.log.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(i.type)}this.bindings[r]=n}}setUniforms(t){let{bindings:r}=(0,J.splitUniformsAndBindings)(t);Object.keys(r).forEach(n=>{J.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:a,firstVertex:s=0,transformFeedback:f}=t,l=Ia(this.props.topology),u=Boolean(i.indexBuffer),c=(r=i.indexBuffer)===null||r===void 0?void 0:r.glIndexType,d=Number(a)>0;if(!this._areTexturesRenderable()||o===0)return!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(n),f&&f.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let g=n;return fa(this.device,this.props.parameters,g.glParameters,()=>{if(u&&d){var h;(h=this.device.gl2)===null||h===void 0||h.drawElementsInstanced(l,o||0,c,s,a||0)}else if(u)this.device.gl.drawElements(l,o||0,c,s);else if(d){var A;(A=this.device.gl2)===null||A===void 0||A.drawArraysInstanced(l,s,o||0,a||0)}else this.device.gl.drawArrays(l,s,o||0);f&&f.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),J.log.time(Da,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),J.log.timeEnd(Da,`linkProgram for ${this.id}`)(),!t.debug&&J.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 K&&(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:a}=i,s=t.getUniformBlockIndex(this.handle,a);if(s===4294967295)throw new Error(`Invalid uniform block name ${a}`);t.uniformBlockBinding(this.handle,n,s),o instanceof te?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 K||o instanceof ve))throw new Error("texture");let f;if(o instanceof K)f=o;else if(o instanceof ve&&o.colorAttachments[0]instanceof K)J.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),f=o.colorAttachments[0];else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(f.target,f.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:a}=r,s=(t=this.uniforms[n])!==null&&t!==void 0?t:a;s!==void 0&&Na(this.device.gl,i,o,s)}}};var Ba=P(M(),1);var Lr=P(M(),1);var Xr=class extends Lr.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":yc(this.device,r.options);break;case"copy-buffer-to-texture":Ec(this.device,r.options);break;case"copy-texture-to-buffer":xc(this.device,r.options);break;case"copy-texture-to-texture":Oc(this.device,r.options);break}}};function yc(e,t){let r=t.source,n=t.destination,i=e.assertWebGL2();if(i){var o,a;i.bindBuffer(36662,r.handle),i.bindBuffer(36663,n.handle),i.copyBufferSubData(36662,36663,(o=t.sourceOffset)!==null&&o!==void 0?o:0,(a=t.destinationOffset)!==null&&a!==void 0?a:0,t.size),i.bindBuffer(36662,null),i.bindBuffer(36663,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function Ec(e,t){throw new Error("Not implemented")}function xc(e,t){let{source:r,mipLevel:n=0,aspect:i="all",width:o=t.source.width,height:a=t.source.height,depthOrArrayLayers:s=0,origin:f=[0,0],destination:l,byteOffset:u=0,bytesPerRow:c,rowsPerImage:d}=t;if(i!=="all")throw new Error("not supported");if(n!==0||s!==0||c||d)throw new Error("not implemented");let g=e.assertWebGL2(),{framebuffer:h,destroyFramebuffer:A}=wa(r);try{let _=l,v=o||h.width,T=a||h.height,m=ut(h.texture.format,!0),E=m.dataFormat,O=m.type;g.bindBuffer(35051,_.handle),g.bindFramebuffer(36160,h.handle),g.readPixels(f[0],f[1],v,T,E,O,u)}finally{g.bindBuffer(35051,null),g.bindFramebuffer(36160,null),A&&h.destroy()}}function Oc(e,t){let{source:r,origin:n=[0,0],destination:i}=t,{width:o=t.destination.width,height:a=t.destination.width}=t,s=0,f=6408,{framebuffer:l,destroyFramebuffer:u}=wa(r),[c,d]=n,g=!1;e.gl.bindFramebuffer(36160,l.handle);let h=null,A;if(i instanceof K)h=i,o=Number.isFinite(o)?o:h.width,a=Number.isFinite(a)?a:h.height,h.bind(0),A=h.destination;else throw new Error("whoops");return g||e.gl.copyTexImage2D(A,s,f,c,d,o,a,0),h&&h.unbind(),u&&l.destroy(),h}function wa(e){if(e instanceof Lr.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 zr=class extends Ba.CommandEncoder{constructor(t,r){super(t,r),this.device=void 0,this.commandBuffer=void 0,this.device=t,this.commandBuffer=new Xr(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 gt=P(M(),1);var Ua;Ua=Symbol.toStringTag;var dt=class extends gt.VertexArray{get[Ua](){return"VertexArray"}static isConstantAttributeZeroSupported(t){return t.info.type==="webgl2"||Rr()==="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:a,offset:s,normalized:f,integer:l,divisor:u}=this._getAccessor(t);this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),l?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(t,i,o,a,s)):this.device.gl.vertexAttribPointer(t,i,o,f,a,s),this.device.gl.enableVertexAttribArray(t),this.device.gl2.vertexAttribDivisor(t,u||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=xr(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=Cc(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 a=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),a=a||!Pc(n,this.bufferValue),a){let s=(0,gt.getScratchArray)(r.constructor,o);(0,gt.fillArray)({target:s,source:n,start:0,count:o}),this.buffer.write(s),this.bufferValue=r}return this.buffer}};function Cc(e){return Array.isArray(e)?new Float32Array(e):e}function Pc(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 kr=P(M(),1);var jr=class extends kr.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(Ma(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:a}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=i,kr.log.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:a},this.bindOnUse||this._bindBuffer(n,i,a,o)}getBuffer(t){if(Wa(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 te)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(Wa(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 Wa(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var fr=1,k=class extends H.Device{static isSupported(){return typeof WebGLRenderingContext<"u"||Eo()}get features(){return this._features=this._features||na(this.gl),this._features}get limits(){return this._limits=this._limits||oa(this.gl),this._limits}static attach(t){if(t instanceof k)return t;if(t?.device instanceof H.Device)return t.device;if(!Nc(t))throw new Error("Invalid WebGLRenderingContext");return new k({gl:t})}static async create(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};H.log.groupCollapsed(fr,"WebGLDevice created")(),typeof t.canvas=="string"&&await H.CanvasContext.pageLoaded,(H.log.get("debug")||t.debug)&&await ma();let{spector:r}=t;if((H.log.get("spector")||r)&&await Aa(),H.log.probe(fr+1,"DOM is loaded")(),t.gl&&t.gl.device)return k.attach(t.gl);let n=new k(t),i=`Created ${n.info.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return H.log.probe(fr,i)(),H.log.table(fr,n.info)(),H.log.groupEnd(fr)(),n}constructor(t){var r;super({...t,id:t.id||(0,H.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 n=(r=t.gl)===null||r===void 0?void 0:r.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new Br(this,t),this.lost=new Promise(f=>{this._resolveContextLost=f});let i=f=>{var l;return(l=this._resolveContextLost)===null||l===void 0?void 0:l.call(this,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},o=t.gl||null;if(o=o||(le()?$o(this.canvasContext.canvas,{...t,onContextLost:i}):null),o=o||(le()?null:xo({...t,onContextLost:i})),!o)throw new Error("WebGL context creation failed");this.handle=o,this.gl=this.handle,this.gl2=this.gl,this.isWebGL2=Ic(this.gl),this.isWebGL1=!this.isWebGL2,this.info=Ko(this.gl),this.gl.device=this,this.gl._version=this.isWebGL2?2:1,Uo(this.gl);let{enable:a=!0,copyState:s=!1}=t;if(Yn(this.gl,{enable:a,copyState:s,log:function(){for(var f=arguments.length,l=new Array(f),u=0;u<f;u++)l[u]=arguments[u];return H.log.log(1,...l)()}}),le()&&t.debug&&(this.gl=ba(this.gl,{...t,webgl2:this.isWebGL2,throwOnError:!0}),this.gl2=this.gl,this.debug=!0,H.log.level=Math.max(H.log.level,1),H.log.warn("WebGL debug mode activated. Performance reduced.")()),le()&&t.spector){let f=this.handle.canvas||t.canvas;this.spector=Ta({...this.props,canvas:f})}}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 nr(this.gl,t)}isTextureFormatFilterable(t){return Go(this.gl,t)}isTextureFormatRenderable(t){return ea(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 te(this,r)}_createTexture(t){return new K(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new Ze(this,t)}createShader(t){return new Ur(this,t)}createFramebuffer(t){return new ve(this,t)}createRenderPipeline(t){return new Vr(this,t)}createVertexArray(t){return new dt(this,t)}beginRenderPass(t){return new Wr(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 jr(this,t)}getDefaultRenderPass(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass}createCommandEncoder(t){return new zr(this,t)}submit(){var t;(t=this.renderPass)===null||t===void 0||t.end(),this.renderPass=null}get webglLimits(){return this._webglLimits=this._webglLimits||aa(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(){De(this.gl)}popState(){Ee(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&&wc(n,r)&&H.log.info(1,`setConstantAttribute(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:Mc(this,t,r);break;case Int32Array:Dc(this,t,r);break;case Uint32Array:Fc(this,t,r);break;default:(0,H.assert)(!1)}}};k.type="webgl";function Nc(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function Ic(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Mc(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,H.assert)(!1)}}function Dc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function Fc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function wc(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 Ha=P(M(),1);var Bc=256,Uc=1024,Wc=16384;var Hc="clear: bad arguments";function $r(e,t){let r=k.attach(e),{framebuffer:n=null,color:i=null,depth:o=null,stencil:a=null}=t||{},s={};n&&(s.framebuffer=n);let f=0;i&&(f|=Wc,i!==!0&&(s.clearColor=i)),o&&(f|=Bc,o!==!0&&(s.clearDepth=o)),a&&(f|=Uc,o!==!0&&(s.clearStencil=o)),(0,Ha.assert)(f!==0,Hc),Q(r.gl,s,()=>{r.gl.clear(f)})}var lr=P(M(),1);var ai=P(M(),1);function Va(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,ai.assert)(!1),0}}function Xa(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return(0,ai.assert)(!1),0}}function ht(e,t){let{sourceX:r=0,sourceY:n=0,sourceFormat:i=6408,targetByteOffset:o=0}=t||{},{target:a,sourceWidth:s,sourceHeight:f,sourceType:l}=t||{},{framebuffer:u,deleteFramebuffer:c}=Vc(e);(0,lr.assert)(u),s=s||u.width,f=f||u.height;let d=u;if(l=l||5121,!a){let h=Va(i),A=Xa(l),_=o+s*f*h*A;a=d.device.createBuffer({byteLength:_})}let g=e.device.createCommandEncoder();return g.copyTextureToBuffer({source:e,width:s,height:f,origin:[r,n],destination:a,byteOffset:o}),g.destroy(),c&&u.destroy(),a}function Vc(e){return e instanceof lr.Framebuffer?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:Xc(e),deleteFramebuffer:!0}}function Xc(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]})}var We=P($());var w={SUM:1,MEAN:2,MIN:3,MAX:4};function La(e,t){return e+t}function Lc(e,t){return t>e?t:e}function zc(e,t){return t<e?t:e}function jc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(La,0)/r.length:null}function kc(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(La,0):null}function $c(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Lc,-1/0):null}function Kc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(zc,1/0):null}function _t(e,t,r){var n=w[e]||w.SUM;switch(t=Yc(t,r),n){case w.MIN:return function(i){return Kc(i,t)};case w.SUM:return function(i){return kc(i,t)};case w.MEAN:return function(i){return jc(i,t)};case w.MAX:return function(i){return $c(i,t)};default:return null}}function Yc(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 za(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 pt;function Kr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ja={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},Ue=3402823466e29,si=[32775,32774],fi=[32776,32774],ka=[32776,32775],li=(pt={},Kr(pt,w.SUM,32774),Kr(pt,w.MEAN,32774),Kr(pt,w.MIN,si),Kr(pt,w.MAX,fi),pt);var $a={size:1,operation:w.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Ka=4;var Ya=`#version 300 es
139
+ `;var mi={ONE:1};function hi(){return mi}var K={name:"fp64-arithmetic",vs:_e,getUniforms:hi,fp64ify:Zt,fp64LowPart:Ae,fp64ifyMatrix4:ye};var J=M(E(),1);var T={SUM:1,MEAN:2,MIN:3,MAX:4};function be(n,t){return n+t}function xi(n,t){return t>n?t:n}function vi(n,t){return t<n?t:n}function Si(n,t){if(Number.isFinite(t))return n.length?t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(be,0)/e.length:null}function Ai(n,t){if(Number.isFinite(t))return n.length?n.length*t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(be,0):null}function yi(n,t){if(Number.isFinite(t))return n.length?t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(xi,-1/0):null}function _i(n,t){if(Number.isFinite(t))return n.length?t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(vi,1/0):null}function Q(n,t,e){let o=T[n]||T.SUM;switch(t=bi(t,e),o){case T.MIN:return i=>_i(i,t);case T.SUM:return i=>Ai(i,t);case T.MEAN:return i=>Si(i,t);case T.MAX:return i=>yi(i,t);default:return null}}function bi(n,t={}){return Number.isFinite(n)?n:e=>(t.index=e.index,n(e.source,t))}function Me(n,t={}){return e=>(t.indices=e.map(o=>o.index),n(e.map(o=>o.source),t))}var Te={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},W=3402823466e29,Jt=[32775,32774],te=[32776,32774],Ce=[32776,32775],ee={[T.SUM]:32774,[T.MEAN]:32774,[T.MIN]:Jt,[T.MAX]:te};var Ee={size:1,operation:T.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Pe=4;var Ne=`#version 300 es
315
140
  #define SHADER_NAME gpu-aggregation-to-grid-vs
316
-
317
141
  in vec3 positions;
318
142
  in vec3 positions64Low;
319
143
  in vec3 weights;
@@ -322,124 +146,99 @@ uniform vec2 gridSize;
322
146
  uniform bool projectPoints;
323
147
  uniform vec2 translation;
324
148
  uniform vec3 scaling;
325
-
326
149
  out vec3 vWeights;
327
-
328
150
  vec2 project_to_pixel(vec4 pos) {
329
- vec4 result;
330
- pos.xy = pos.xy/pos.w;
331
- result = pos + vec4(translation, 0., 0.);
332
- result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
333
- return result.xy;
151
+ vec4 result;
152
+ pos.xy = pos.xy/pos.w;
153
+ result = pos + vec4(translation, 0., 0.);
154
+ result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
155
+ return result.xy;
334
156
  }
335
-
336
157
  void main(void) {
337
-
338
- vWeights = weights;
339
-
340
- vec4 windowPos = vec4(positions, 1.);
341
- if (projectPoints) {
342
- windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
343
- }
344
-
345
- vec2 pos = project_to_pixel(windowPos);
346
-
347
- vec2 pixelXY64[2];
348
- pixelXY64[0] = vec2(pos.x, 0.);
349
- pixelXY64[1] = vec2(pos.y, 0.);
350
- vec2 gridXY64[2];
351
- gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
352
- gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
353
- float x = floor(gridXY64[0].x);
354
- float y = floor(gridXY64[1].x);
355
- pos = vec2(x, y);
356
- pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
357
- vec2 offset = 1.0 / gridSize;
358
- pos = pos + offset;
359
-
360
- gl_Position = vec4(pos, 0.0, 1.0);
361
- gl_PointSize = 1.0;
362
- }
363
- `;var Za=`#version 300 es
158
+ vWeights = weights;
159
+ vec4 windowPos = vec4(positions, 1.);
160
+ if (projectPoints) {
161
+ windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
162
+ }
163
+ vec2 pos = project_to_pixel(windowPos);
164
+ vec2 pixelXY64[2];
165
+ pixelXY64[0] = vec2(pos.x, 0.);
166
+ pixelXY64[1] = vec2(pos.y, 0.);
167
+ vec2 gridXY64[2];
168
+ gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
169
+ gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
170
+ float x = floor(gridXY64[0].x);
171
+ float y = floor(gridXY64[1].x);
172
+ pos = vec2(x, y);
173
+ pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
174
+ vec2 offset = 1.0 / gridSize;
175
+ pos = pos + offset;
176
+ gl_Position = vec4(pos, 0.0, 1.0);
177
+ gl_PointSize = 1.0;
178
+ }
179
+ `;var De=`#version 300 es
364
180
  #define SHADER_NAME gpu-aggregation-to-grid-fs
365
-
366
181
  precision highp float;
367
-
368
182
  in vec3 vWeights;
369
-
370
183
  out vec4 fragColor;
371
-
372
184
  void main(void) {
373
- fragColor = vec4(vWeights, 1.0);
374
- DECKGL_FILTER_COLOR(fragColor, geometry);
185
+ fragColor = vec4(vWeights, 1.0);
186
+ DECKGL_FILTER_COLOR(fragColor, geometry);
375
187
  }
376
- `;var qa=`#version 300 es
188
+ `;var Oe=`#version 300 es
377
189
  #define SHADER_NAME gpu-aggregation-all-vs-64
378
-
379
190
  in vec2 position;
380
191
  uniform ivec2 gridSize;
381
192
  out vec2 vTextureCoord;
382
-
383
193
  void main(void) {
384
- vec2 pos = vec2(-1.0, -1.0);
385
- vec2 offset = 1.0 / vec2(gridSize);
386
- pos = pos + offset;
387
-
388
- gl_Position = vec4(pos, 0.0, 1.0);
389
-
390
- int yIndex = gl_InstanceID / gridSize[0];
391
- int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
392
-
393
- vec2 yIndexFP64 = vec2(float(yIndex), 0.);
394
- vec2 xIndexFP64 = vec2(float(xIndex), 0.);
395
- vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
396
- vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
397
-
398
- vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
399
- vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
400
-
401
- vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
402
- gl_PointSize = 1.0;
403
- }
404
- `;var Qa=`#version 300 es
194
+ vec2 pos = vec2(-1.0, -1.0);
195
+ vec2 offset = 1.0 / vec2(gridSize);
196
+ pos = pos + offset;
197
+ gl_Position = vec4(pos, 0.0, 1.0);
198
+ int yIndex = gl_InstanceID / gridSize[0];
199
+ int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
200
+ vec2 yIndexFP64 = vec2(float(yIndex), 0.);
201
+ vec2 xIndexFP64 = vec2(float(xIndex), 0.);
202
+ vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
203
+ vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
204
+ vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
205
+ vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
206
+ vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
207
+ gl_PointSize = 1.0;
208
+ }
209
+ `;var Le=`#version 300 es
405
210
  #define SHADER_NAME gpu-aggregation-all-fs
406
-
407
211
  precision highp float;
408
-
409
212
  in vec2 vTextureCoord;
410
213
  uniform sampler2D uSampler;
411
214
  uniform bool combineMaxMin;
412
215
  out vec4 fragColor;
413
216
  void main(void) {
414
- vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
415
- if (textureColor.a == 0.) {
416
- discard;
417
- }
418
- fragColor.rgb = textureColor.rgb;
419
- fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
420
- }
421
- `;var Ja=`#version 300 es
217
+ vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
218
+ if (textureColor.a == 0.) {
219
+ discard;
220
+ }
221
+ fragColor.rgb = textureColor.rgb;
222
+ fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
223
+ }
224
+ `;var Fe=`#version 300 es
422
225
  #define SHADER_NAME gpu-aggregation-transform-mean-vs
423
226
  in vec4 aggregationValues;
424
227
  out vec4 meanValues;
425
-
426
228
  void main()
427
229
  {
428
- bool isCellValid = bool(aggregationValues.w > 0.);
429
- meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
430
- meanValues.w = aggregationValues.w;
431
- gl_PointSize = 1.0;
230
+ bool isCellValid = bool(aggregationValues.w > 0.);
231
+ meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
232
+ meanValues.w = aggregationValues.w;
233
+ gl_PointSize = 1.0;
432
234
  }
433
- `;var Zc={minFilter:"nearest",magFilter:"nearest"};function At(e,t){var r=t.width,n=r===void 0?1:r,i=t.height,o=i===void 0?1:i,a=t.data,s=a===void 0?null:a,f=t.parameters,l=f===void 0?Zc:f,u=e.createTexture({data:s,format:"rgba32float",mipmaps:!1,sampler:l,width:n,height:o});return u}function ur(e,t){var r=t.id,n=t.width,i=n===void 0?1:n,o=t.height,a=o===void 0?1:o,s=t.texture,f=e.createFramebuffer({id:r,width:i,height:a,colorAttachments:[s]});return f}function qc(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Qc(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
434
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Qc(e,t){if(e){if(typeof e=="string")return Ga(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 Ga(e,t)}}function Ga(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 es(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 G(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?es(Object(r),!0).forEach(function(n){ui(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):es(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ui(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Gc=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],ts={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},ed=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],ee=function(){e.getAggregationData=function(n){var i=n.aggregationData,o=n.maxData,a=n.minData,s=n.maxMinData,f=n.pixelIndex,l=f*Ka,u={};return i&&(u.cellCount=i[l+3],u.cellWeight=i[l]),s?(u.maxCellWieght=s[0],u.minCellWeight=s[3]):(o&&(u.maxCellWieght=o[0],u.totalCount=o[3]),a&&(u.minCellWeight=a[0],u.totalCount=a[3])),u},e.getCellData=function(n){for(var i=n.countsData,o=n.size,a=o===void 0?1:o,s=i.length/4,f=new Float32Array(s*a),l=new Uint32Array(s),u=0;u<s;u++){for(var c=0;c<a;c++)f[u*a+c]=i[u*4+c];l[u]=i[u*4+3]}return{cellCounts:l,cellWeights:f}},e.isSupported=function(n){return ed.every(function(i){return n.features.has(i)})};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Jc(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,a=this.state,s=a.textures,f=a.framebuffers,l=a.maxMinFramebuffers,u=a.minFramebuffers,c=a.maxFramebuffers,d=a.meanTextures,g=a.resources;n?.destroy(),i?.destroy(),o?.destroy(),rd([f,s,l,u,c,d,g])},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||We.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 a in ts){var s=ts[a];(o[n][a]||o[n][s])&&(o[n][a]=o[n][a]||o[n][s].getData(),i[a]=o[n][a])}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=G(G({},ja),n),o=i.weights;return o&&(i.weights=td(o)),i},t.setState=function(n){Object.assign(this.state,n)},t._getAggregateData=function(n){var i={},o=this.state,a=o.textures,s=o.framebuffers,f=o.maxMinFramebuffers,l=o.minFramebuffers,u=o.maxFramebuffers,c=o.resources,d=n.weights;for(var g in d){i[g]={};var h=d[g],A=h.needMin,_=h.needMax,v=h.combineMaxMin;i[g].aggregationTexture=a[g],i[g].aggregationBuffer=ht(s[g],{target:d[g].aggregationBuffer,sourceType:5126}),A&&_&&v?(i[g].maxMinBuffer=ht(f[g],{target:d[g].maxMinBuffer,sourceType:5126}),i[g].maxMinTexture=c["".concat(g,"-maxMinTexture")]):(A&&(i[g].minBuffer=ht(l[g],{target:d[g].minBuffer,sourceType:5126}),i[g].minTexture=c["".concat(g,"-minTexture")]),_&&(i[g].maxBuffer=ht(u[g],{target:d[g].maxBuffer,sourceType:5126}),i[g].maxTexture=c["".concat(g,"-maxTexture")]))}return this._trackGPUResultBuffers(i,d),i},t._renderAggregateData=function(n){var i=n.cellSize,o=n.projectPoints,a=n.attributes,s=n.moduleSettings,f=n.numCol,l=n.numRow,u=n.weights,c=n.translation,d=n.scaling,g=this.state,h=g.maxMinFramebuffers,A=g.minFramebuffers,_=g.maxFramebuffers,v=[f,l],T={blend:!0,depthTest:!1,blendFunc:[1,1]},m={cellSize:i,gridSize:v,projectPoints:o,translation:c,scaling:d};for(var E in u){var O=u[E],C=O.needMin,N=O.needMax,I=C&&N&&u[E].combineMaxMin;this._renderToWeightsTexture({id:E,parameters:T,moduleSettings:s,uniforms:m,gridSize:v,attributes:a,weights:u}),I?this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:ka}),gridSize:v,minOrMaxFb:h[E],clearParams:{clearColor:[0,0,0,Ue]},combineMaxMin:I}):(C&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:si}),gridSize:v,minOrMaxFb:A[E],clearParams:{clearColor:[Ue,Ue,Ue,0]},combineMaxMin:I}),N&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:fi}),gridSize:v,minOrMaxFb:_[E],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:I}))}},t._renderToMaxMinTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.gridSize,f=n.minOrMaxFb,l=n.combineMaxMin,u=n.clearParams,c=u===void 0?{}:u,d=this.state.framebuffers,g=this.allAggregationModel;Q(this.device,G(G({},c),{},{framebuffer:f,viewport:[0,0,s[0],s[1]]}),function(){$r(i.device,{color:!0}),g.setUniforms({gridSize:s,combineMaxMin:l}),g.setBindings({uSampler:d[o].texture}),g.draw()})},t._renderToWeightsTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.moduleSettings,f=n.uniforms,l=n.gridSize,u=n.weights,c=this.state,d=c.framebuffers,g=c.equations,h=c.weightAttributes,A=this.gridAggregationModel,_=u[o].operation,v=_===w.MIN?[Ue,Ue,Ue,0]:[0,0,0,0];if(Q(this.device,{framebuffer:d[o],viewport:[0,0,l[0],l[1]],clearColor:v},function(){$r(i.device,{color:!0});var C={weights:h[o]};A.draw({parameters:G(G({},a),{},{blendEquation:g[o]}),moduleSettings:s,uniforms:f,attributes:C})}),_===w.MEAN){var T=this.state,m=T.meanTextures,E=T.textures,O={_sourceTextures:{aggregationValues:m[o]},_targetTexture:E[o],elementCount:E[o].width*E[o].height};this.meanTransform?this.meanTransform.update(O):this.meanTransform=od(this.device,O),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),d[o].attach(ui({},36064,E[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,a=i.framebuffers,s=i.maxMinFramebuffers,f=i.minFramebuffers,l=i.maxFramebuffers,u=i.meanTextures,c=i.equations,d=n.weights,g=n.numCol,h=n.numRow,A={width:g,height:h};for(var _ in d){var v=d[_],T=v.needMin,m=v.needMax,E=v.combineMaxMin,O=v.operation;o[_]=d[_].aggregationTexture||o[_]||At(this.device,{id:"".concat(_,"-texture"),width:g,height:h}),o[_].resize(A);var C=o[_];O===w.MEAN&&(u[_]=u[_]||At(this.device,{id:"".concat(_,"-mean-texture"),width:g,height:h}),u[_].resize(A),C=u[_]),a[_]?a[_].attach(ui({},36064,C)):a[_]=ur(this.device,{id:"".concat(_,"-fb"),width:g,height:h,texture:C}),a[_].resize(A),c[_]=li[O]||li[w.SUM],(T||m)&&(T&&m&&E?s[_]||(C=d[_].maxMinTexture||this._getMinMaxTexture("".concat(_,"-maxMinTexture")),s[_]=ur(this.device,{id:"".concat(_,"-maxMinFb"),texture:C})):(T&&(f[_]||(C=d[_].minTexture||this._getMinMaxTexture("".concat(_,"-minTexture")),f[_]=ur(this.device,{id:"".concat(_,"-minFb"),texture:C}))),m&&(l[_]||(C=d[_].maxTexture||this._getMinMaxTexture("".concat(_,"-maxTexture")),l[_]=ur(this.device,{id:"".concat(_,"-maxFb"),texture:C})))))}},t._getMinMaxTexture=function(n){var i=this.state.resources;return i[n]||(i[n]=At(this.device,{id:"resourceName"})),i[n]},t._setupModels=function(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=i.numCol,a=o===void 0?0:o,s=i.numRow,f=s===void 0?0:s,l=this.state.shaderOptions;if((n=this.gridAggregationModel)===null||n===void 0||n.destroy(),this.gridAggregationModel=nd(this.device,l),!this.allAggregationModel){var u=a*f;this.allAggregationModel=id(this.device,u)}},t._setupWeightAttributes=function(n){var i=this.state.weightAttributes,o=n.weights;for(var a in o)i[a]=n.attributes[a]},t._trackGPUResultBuffers=function(n,i){var o=this.state.resources;for(var a in n)if(n[a]){var s=qc(Gc),f;try{for(s.s();!(f=s.n()).done;){var l=f.value;if(n[a][l]&&i[a][l]!==n[a][l]){var u="gpu-result-".concat(a,"-").concat(l);o[u]&&o[u].delete(),o[u]=n[a][l]}}}catch(c){s.e(c)}finally{s.f()}}},t._updateModels=function(n){var i=n.vertexCount,o=n.attributes,a=n.numCol,s=n.numRow,f=this.state.modelDirty;f&&(this._setupModels(n),this.setState({modelDirty:!1})),this._setupWeightAttributes(n),this.gridAggregationModel.setVertexCount(i),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(a*s)},e}();function td(e){var t={};for(var r in e)t[r]=G(G({},$a),e[r]);return t}function rd(e){e=Array.isArray(e)?e:[e],e.forEach(function(t){for(var r in t)t[r].delete()})}function nd(e,t){var r=(0,We._mergeShaders)({vs:Ya,fs:Za,modules:[ot,We.project32]},t);return new Y(e,G({id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,We.getShaderAssembler)()},r))}function id(e,t){return new Y(e,{id:"All-Aggregation-Model",vs:qa,fs:Qa,modules:[ot],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function od(e,t){return new Me(e,G({vs:Ja,_targetTextureVarying:"meanValues"},t))}var vt=P($());var ae=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function He(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 a=e[o];n[i++]=a[0],n[i++]=a[1],n[i++]=a[2],n[i++]=Number.isFinite(a[3])?a[3]:255}}if(t)for(var s=0;s<n.length;s++)n[s]/=255;return n}var rs=`#version 300 es
235
+ `;var Mi={minFilter:"nearest",magFilter:"nearest"};function Z(n,t){let{width:e=1,height:o=1,data:i=null,parameters:r=Mi}=t;return n.createTexture({data:i,format:"rgba32float",mipmaps:!1,sampler:r,width:e,height:o})}function xt(n,t){let{id:e,width:o=1,height:i=1,texture:r}=t;return n.createFramebuffer({id:e,width:o,height:i,colorAttachments:[r]})}var Ti=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],we={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ci=["float32-renderable-webgl","texture-blend-float-webgl"],C=class{static getAggregationData({aggregationData:t,maxData:e,minData:o,maxMinData:i,pixelIndex:r}){let s=r*Pe,a={};return t&&(a.cellCount=t[s+3],a.cellWeight=t[s]),i?(a.maxCellWieght=i[0],a.minCellWeight=i[3]):(e&&(a.maxCellWieght=e[0],a.totalCount=e[3]),o&&(a.minCellWeight=o[0],a.totalCount=o[3])),a}static getCellData({countsData:t,size:e=1}){let o=t.length/4,i=new Float32Array(o*e),r=new Uint32Array(o);for(let s=0;s<o;s++){for(let a=0;a<e;a++)i[s*e+a]=t[s*4+a];r[s]=t[s*4+3]}return{cellCounts:r,cellWeights:i}}static isSupported(t){return Ci.every(e=>t.features.has(e))}constructor(t,e={}){this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=e.id||"gpu-grid-aggregator",this.device=t;let o=["float32-renderable-webgl"];this._hasGPUSupport=o.every(i=>t.features.has(i)),this._hasGPUSupport&&this._setupModels()}delete(){let{gridAggregationModel:t,allAggregationModel:e,meanTransform:o}=this,{textures:i,framebuffers:r,maxMinFramebuffers:s,minFramebuffers:a,maxFramebuffers:l,meanTextures:c,resources:g}=this.state;t?.destroy(),e?.destroy(),o?.destroy(),Pi([r,i,s,a,l,c,g])}run(t={}){this.setState({results:{}});let e=this._normalizeAggregationParams(t);return this._runAggregation(e)}getData(t){let e={},o=this.state.results;o[t].aggregationData||(o[t].aggregationData=o[t].aggregationBuffer.getData()),e.aggregationData=o[t].aggregationData;for(let i in we){let r=we[i];(o[t][i]||o[t][r])&&(o[t][i]=o[t][i]||o[t][r].getData(),e[i]=o[t][i])}return e}updateShaders(t={}){this.setState({shaderOptions:t,modelDirty:!0})}_normalizeAggregationParams(t){let e={...Te,...t},{weights:o}=e;return o&&(e.weights=Ei(o)),e}setState(t){Object.assign(this.state,t)}_getAggregateData(t){let e={},{textures:o,framebuffers:i,maxMinFramebuffers:r,minFramebuffers:s,maxFramebuffers:a,resources:l}=this.state,{weights:c}=t;for(let g in c){e[g]={};let{needMin:f,needMax:d,combineMaxMin:p}=c[g];e[g].aggregationTexture=o[g],e[g].aggregationBuffer=this.device.readPixelsToBufferWebGL(i[g],{target:c[g].aggregationBuffer,sourceType:5126}),f&&d&&p?(e[g].maxMinBuffer=this.device.readPixelsToBufferWebGL(r[g],{target:c[g].maxMinBuffer,sourceType:5126}),e[g].maxMinTexture=l[`${g}-maxMinTexture`]):(f&&(e[g].minBuffer=this.device.readPixelsToBufferWebGL(s[g],{target:c[g].minBuffer,sourceType:5126}),e[g].minTexture=l[`${g}-minTexture`]),d&&(e[g].maxBuffer=this.device.readPixelsToBufferWebGL(a[g],{target:c[g].maxBuffer,sourceType:5126}),e[g].maxTexture=l[`${g}-maxTexture`]))}return this._trackGPUResultBuffers(e,c),e}_renderAggregateData(t){let{cellSize:e,projectPoints:o,attributes:i,moduleSettings:r,numCol:s,numRow:a,weights:l,translation:c,scaling:g}=t,{maxMinFramebuffers:f,minFramebuffers:d,maxFramebuffers:p}=this.state,x=[s,a],h={blend:!0,depthTest:!1,blendFunc:[1,1]},A={cellSize:e,gridSize:x,projectPoints:o,translation:c,scaling:g};for(let S in l){let{needMin:y,needMax:_}=l[S],b=y&&_&&l[S].combineMaxMin;this._renderToWeightsTexture({id:S,parameters:h,moduleSettings:r,uniforms:A,gridSize:x,attributes:i,weights:l}),b?this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:Ce},gridSize:x,minOrMaxFb:f[S],clearParams:{clearColor:[0,0,0,W]},combineMaxMin:b}):(y&&this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:Jt},gridSize:x,minOrMaxFb:d[S],clearParams:{clearColor:[W,W,W,0]},combineMaxMin:b}),_&&this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:te},gridSize:x,minOrMaxFb:p[S],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:b}))}}_renderToMaxMinTexture(t){let{id:e,gridSize:o,minOrMaxFb:i,combineMaxMin:r,clearParams:s={}}=t,{framebuffers:a}=this.state,{allAggregationModel:l}=this;this.device.withParametersWebGL({...s,framebuffer:i,viewport:[0,0,o[0],o[1]]},()=>{this.device.clearWebGL({color:!0}),l.setUniforms({gridSize:o,combineMaxMin:r}),l.setBindings({uSampler:a[e].texture}),l.draw()})}_renderToWeightsTexture(t){let{id:e,parameters:o,moduleSettings:i,uniforms:r,gridSize:s,weights:a}=t,{framebuffers:l,equations:c,weightAttributes:g}=this.state,{gridAggregationModel:f}=this,{operation:d}=a[e],p=d===T.MIN?[W,W,W,0]:[0,0,0,0];if(this.device.withParametersWebGL({framebuffer:l[e],viewport:[0,0,s[0],s[1]],clearColor:p},()=>{this.device.clearWebGL({color:!0});let x={weights:g[e]};f.draw({parameters:{...o,blendEquation:c[e]},moduleSettings:i,uniforms:r,attributes:x})}),d===T.MEAN){let{meanTextures:x,textures:h}=this.state,A={_sourceTextures:{aggregationValues:x[e]},_targetTexture:h[e],elementCount:h[e].width*h[e].height};this.meanTransform?this.meanTransform.update(A):this.meanTransform=Oi(this.device,A),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),l[e].attach({[36064]:h[e]})}}_runAggregation(t){this._updateModels(t),this._setupFramebuffers(t),this._renderAggregateData(t);let e=this._getAggregateData(t);return this.setState({results:e}),e}_setupFramebuffers(t){let{textures:e,framebuffers:o,maxMinFramebuffers:i,minFramebuffers:r,maxFramebuffers:s,meanTextures:a,equations:l}=this.state,{weights:c}=t,{numCol:g,numRow:f}=t,d={width:g,height:f};for(let p in c){let{needMin:x,needMax:h,combineMaxMin:A,operation:S}=c[p];e[p]=c[p].aggregationTexture||e[p]||Z(this.device,{id:`${p}-texture`,width:g,height:f}),e[p].resize(d);let y=e[p];S===T.MEAN&&(a[p]=a[p]||Z(this.device,{id:`${p}-mean-texture`,width:g,height:f}),a[p].resize(d),y=a[p]),o[p]?o[p].attach({[36064]:y}):o[p]=xt(this.device,{id:`${p}-fb`,width:g,height:f,texture:y}),o[p].resize(d),l[p]=ee[S]||ee[T.SUM],(x||h)&&(x&&h&&A?i[p]||(y=c[p].maxMinTexture||this._getMinMaxTexture(`${p}-maxMinTexture`),i[p]=xt(this.device,{id:`${p}-maxMinFb`,texture:y})):(x&&(r[p]||(y=c[p].minTexture||this._getMinMaxTexture(`${p}-minTexture`),r[p]=xt(this.device,{id:`${p}-minFb`,texture:y}))),h&&(s[p]||(y=c[p].maxTexture||this._getMinMaxTexture(`${p}-maxTexture`),s[p]=xt(this.device,{id:`${p}-maxFb`,texture:y})))))}}_getMinMaxTexture(t){let{resources:e}=this.state;return e[t]||(e[t]=Z(this.device,{id:"resourceName"})),e[t]}_setupModels({numCol:t=0,numRow:e=0}={}){let{shaderOptions:o}=this.state;if(this.gridAggregationModel?.destroy(),this.gridAggregationModel=Ni(this.device,o),!this.allAggregationModel){let i=t*e;this.allAggregationModel=Di(this.device,i)}}_setupWeightAttributes(t){let{weightAttributes:e}=this.state,{weights:o}=t;for(let i in o)e[i]=t.attributes[i]}_trackGPUResultBuffers(t,e){let{resources:o}=this.state;for(let i in t)if(t[i]){for(let r of Ti)if(t[i][r]&&e[i][r]!==t[i][r]){let s=`gpu-result-${i}-${r}`;o[s]&&o[s].delete(),o[s]=t[i][r]}}}_updateModels(t){let{vertexCount:e,attributes:o,numCol:i,numRow:r}=t,{modelDirty:s}=this.state;s&&(this._setupModels(t),this.setState({modelDirty:!1})),this._setupWeightAttributes(t),this.gridAggregationModel.setVertexCount(e),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(i*r)}};function Ei(n){let t={};for(let e in n)t[e]={...Ee,...n[e]};return t}function Pi(n){n=Array.isArray(n)?n:[n],n.forEach(t=>{for(let e in t)t[e].delete()})}function Ni(n,t){let e=(0,J._mergeShaders)({vs:Ne,fs:De,modules:[K,J.project32]},t);return new vt.Model(n,{id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,J.getShaderAssembler)(),...e})}function Di(n,t){return new vt.Model(n,{id:"All-Aggregation-Model",vs:Oe,fs:Le,modules:[K],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function Oi(n,t){return new vt.TextureTransform(n,{vs:Fe,_targetTextureVarying:"meanValues",...t})}var Ot=M(q(),1),et=M(E(),1);var D=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function z(n,t=!1,e=Float32Array){let o;if(Number.isFinite(n[0]))o=new e(n);else{o=new e(n.length*4);let i=0;for(let r=0;r<n.length;r++){let s=n[r];o[i++]=s[0],o[i++]=s[1],o[i++]=s[2],o[i++]=Number.isFinite(s[3])?s[3]:255}}if(t)for(let i=0;i<o.length;i++)o[i]/=255;return o}var Ie=`#version 300 es
435
236
  #define SHADER_NAME screen-grid-layer-vertex-shader
436
237
  #define RANGE_COUNT 6
437
-
438
238
  in vec3 positions;
439
239
  in vec3 instancePositions;
440
240
  in vec4 instanceCounts;
441
241
  in vec3 instancePickingColors;
442
-
443
242
  uniform float opacity;
444
243
  uniform vec3 cellScale;
445
244
  uniform vec4 minColor;
@@ -448,84 +247,60 @@ uniform vec4 colorRange[RANGE_COUNT];
448
247
  uniform vec2 colorDomain;
449
248
  uniform bool shouldUseMinMax;
450
249
  uniform sampler2D maxTexture;
451
-
452
250
  out vec4 vColor;
453
251
  out float vSampleCount;
454
-
455
252
  vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
456
- vec4 outColor = vec4(0., 0., 0., 0.);
457
- if (value >= domain.x && value <= domain.y) {
458
- float domainRange = domain.y - domain.x;
459
- if (domainRange <= 0.) {
460
- outColor = colorRange[0];
461
- } else {
462
- float rangeCount = float(RANGE_COUNT);
463
- float rangeStep = domainRange / rangeCount;
464
- float idx = floor((value - domain.x) / rangeStep);
465
- idx = clamp(idx, 0., rangeCount - 1.);
466
- int intIdx = int(idx);
467
- outColor = colorRange[intIdx];
468
- }
469
- }
470
- outColor = outColor / 255.;
471
- return outColor;
472
- }
473
-
253
+ vec4 outColor = vec4(0., 0., 0., 0.);
254
+ if (value >= domain.x && value <= domain.y) {
255
+ float domainRange = domain.y - domain.x;
256
+ if (domainRange <= 0.) {
257
+ outColor = colorRange[0];
258
+ } else {
259
+ float rangeCount = float(RANGE_COUNT);
260
+ float rangeStep = domainRange / rangeCount;
261
+ float idx = floor((value - domain.x) / rangeStep);
262
+ idx = clamp(idx, 0., rangeCount - 1.);
263
+ int intIdx = int(idx);
264
+ outColor = colorRange[intIdx];
265
+ }
266
+ }
267
+ outColor = outColor / 255.;
268
+ return outColor;
269
+ }
474
270
  void main(void) {
475
- vSampleCount = instanceCounts.a;
476
-
477
- float weight = instanceCounts.r;
478
- float maxWeight = texture(maxTexture, vec2(0.5)).r;
479
-
480
- float step = weight / maxWeight;
481
- vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
482
-
483
- vec2 domain = colorDomain;
484
- float domainMaxValid = float(colorDomain.y != 0.);
485
- domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
486
- vec4 rangeColor = quantizeScale(domain, colorRange, weight);
487
-
488
- float rangeMinMax = float(shouldUseMinMax);
489
- vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
490
- vColor = vec4(color.rgb, color.a * opacity);
491
- picking_setPickingColor(instancePickingColors);
492
-
493
- gl_Position = vec4(instancePositions + positions * cellScale, 1.);
494
- }
495
- `;var ns=`#version 300 es
271
+ vSampleCount = instanceCounts.a;
272
+ float weight = instanceCounts.r;
273
+ float maxWeight = texture(maxTexture, vec2(0.5)).r;
274
+ float step = weight / maxWeight;
275
+ vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
276
+ vec2 domain = colorDomain;
277
+ float domainMaxValid = float(colorDomain.y != 0.);
278
+ domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
279
+ vec4 rangeColor = quantizeScale(domain, colorRange, weight);
280
+ float rangeMinMax = float(shouldUseMinMax);
281
+ vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
282
+ vColor = vec4(color.rgb, color.a * opacity);
283
+ picking_setPickingColor(instancePickingColors);
284
+ gl_Position = vec4(instancePositions + positions * cellScale, 1.);
285
+ }
286
+ `;var Re=`#version 300 es
496
287
  #define SHADER_NAME screen-grid-layer-fragment-shader
497
-
498
288
  precision highp float;
499
-
500
289
  in vec4 vColor;
501
290
  in float vSampleCount;
502
-
503
291
  out vec4 fragColor;
504
-
505
292
  void main(void) {
506
- if (vSampleCount <= 0.0) {
507
- discard;
508
- }
509
- fragColor = vColor;
510
-
511
- DECKGL_FILTER_COLOR(fragColor, geometry);
512
- }
513
- `;function Yr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yr=function(r){return typeof r}:Yr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Yr(e)}function is(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 ci(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?is(Object(r),!0).forEach(function(n){ad(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):is(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ad(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zr(e,t,r){return typeof Reflect<"u"&&Reflect.get?Zr=Reflect.get:Zr=function(i,o,a){var s=fd(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},Zr(e,t,r||e)}function fd(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Tt(e),e!==null););return e}function ld(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&&di(e,t)}function di(e,t){return di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},di(e,t)}function ud(e){var t=gd();return function(){var n=Tt(e),i;if(t){var o=Tt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cd(this,i)}}function cd(e,t){if(t&&(Yr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dd(e)}function dd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gd(){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 Tt(e){return Tt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Tt(e)}var hd=[0,0,0,0],_d=[0,255,0,255],pd=["minColor","maxColor","colorRange","colorDomain"],Ad={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ae},mt=function(e){ld(r,e);var t=ud(r);function r(){var i;sd(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),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:rs,fs:ns,modules:[vt.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 a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){Zr(Tt(r.prototype),"updateState",this).call(this,o);var a=o.oldProps,s=o.props,f=o.changeFlags,l=this.getAttributeManager();s.numInstances!==a.numInstances?l.invalidateAll():a.cellSizePixels!==s.cellSizePixels&&l.invalidate("instancePositions"),this._updateUniforms(a,s,f)},n.draw=function(o){var a=o.uniforms,s=this.props,f=s.parameters,l=s.maxTexture,u=this.props.minColor||hd,c=this.props.maxColor||_d,d=this.props.colorDomain||[1,0],g=this.state.model;g.setUniforms(a),g.setBindings({maxTexture:l}),g.setUniforms({minColor:u,maxColor:c,colorDomain:d}),g.setParameters(ci({depthWriteEnabled:!1},f)),g.draw(this.context.renderPass)},n.calculateInstancePositions=function(o,a){for(var s=a.numInstances,f=this.context.viewport,l=f.width,u=f.height,c=this.props.cellSizePixels,d=Math.ceil(l/c),g=o.value,h=o.size,A=0;A<s;A++){var _=A%d,v=Math.floor(A/d);g[A*h+0]=_*c/l*2-1,g[A*h+1]=1-v*c/u*2,g[A*h+2]=0}},n._getModel=function(){return new Y(this.context.device,ci(ci({},this.getShaders()),{},{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Re({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,a=o.minColor,s=o.maxColor,f=o.colorDomain,l=o.colorRange;return a||s?(vt.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(f||l)},n._updateUniforms=function(o,a,s){var f=this.state.model;if(pd.some(function(v){return o[v]!==a[v]})&&f.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),o.colorRange!==a.colorRange&&f.setUniforms({colorRange:He(a.colorRange)}),o.cellMarginPixels!==a.cellMarginPixels||o.cellSizePixels!==a.cellSizePixels||s.viewportChanged){var l=this.context.viewport,u=l.width,c=l.height,d=this.props,g=d.cellSizePixels,h=d.cellMarginPixels,A=g>h?h:0,_=new Float32Array([(g-A)/u*2,-(g-A)/c*2,1]);f.setUniforms({cellScale:_})}},r}(vt.Layer);mt.layerName="ScreenGridCellLayer";mt.defaultProps=Ad;var Ms=P($());var bt=P($());function os(e,t){var r={};for(var n in e)t.includes(n)||(r[n]=e[n]);return r}function qr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qr=function(r){return typeof r}:qr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qr(e)}function as(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Td(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
514
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Td(e,t){if(e){if(typeof e=="string")return ss(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 ss(e,t)}}function ss(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 vd(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,a){var s=md(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},cr(e,t,r||e)}function md(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=qe(e),e!==null););return e}function bd(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&&gi(e,t)}function gi(e,t){return gi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},gi(e,t)}function Sd(e){var t=Ed();return function(){var n=qe(e),i;if(t){var o=qe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Rd(this,i)}}function Rd(e,t){if(t&&(qr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yd(e)}function yd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ed(){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 qe(e){return qe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},qe(e)}var ce=function(e){bd(r,e);var t=Sd(r);function r(){var i;vd(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){cr(qe(r.prototype),"initializeState",this).call(this,this.context),this.setState({ignoreProps:os(this.constructor._propTypes,o.data.props),dimensions:o})},n.updateState=function(o){cr(qe(r.prototype),"updateState",this).call(this,o);var a=o.changeFlags;if(a.extensionsChanged){var s=this.getShaders({});s&&s.defines&&(s.defines.NON_INSTANCED_MODEL=1),this.updateShaders(s)}this._updateAttributes()},n.updateAttributes=function(o){this.setState({changedAttributes:o})},n.getAttributes=function(){return this.getAttributeManager().getAttributes()},n.getModuleSettings=function(){var o=this.context,a=o.viewport,s=o.mousePosition,f=o.device,l=Object.assign(Object.create(this.props),{viewport:a,mousePosition:s,picking:{isActive:0},devicePixelRatio:f.canvasContext.cssToDeviceRatio()});return l},n.updateShaders=function(o){},n.isAggregationDirty=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.props,f=o.oldProps,l=o.changeFlags,u=a.compareAll,c=u===void 0?!1:u,d=a.dimension,g=this.state.ignoreProps,h=d.props,A=d.accessors,_=A===void 0?[]:A,v=l.updateTriggersChanged;if(l.dataChanged)return!0;if(v){if(v.all)return!0;var T=as(_),m;try{for(T.s();!(m=T.n()).done;){var E=m.value;if(v[E])return!0}}catch(I){T.e(I)}finally{T.f()}}if(c)return l.extensionsChanged?!0:(0,bt._compareProps)({oldProps:f,newProps:s,ignoreProps:g,propTypes:this.constructor._propTypes});var O=as(h),C;try{for(O.s();!(C=O.n()).done;){var N=C.value;if(s[N]!==f[N])return!0}}catch(I){O.e(I)}finally{O.f()}return!1},n.isAttributeChanged=function(o){var a=this.state.changedAttributes;return o?a&&a[o]!==void 0:!xd(a)},n._getAttributeManager=function(){return new bt.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},r}(bt.CompositeLayer);ce.layerName="AggregationLayer";function xd(e){var t=!0;for(var r in e){t=!1;break}return t}var us=P($());function Od(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Cd(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
515
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Cd(e,t){if(e){if(typeof e=="string")return fs(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 fs(e,t)}}function fs(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 Qr(e,t,r){var n=r;return n.domain=function(){return e},n.range=function(){return t},n}function ls(e,t){var r=function(i){return Bd(e,t,i)};return Qr(e,t,r)}function Pd(e,t){var r=function(i){return Ud(e,t,i)};return Qr(e,t,r)}function Nd(e,t){for(var r=e.sort(cs),n=0,i=Math.max(1,t.length),o=new Array(i-1);++n<i;)o[n-1]=Id(r,n/i);var a=function(f){return Dd(o,t,f)};return a.thresholds=function(){return o},Qr(e,t,a)}function cs(e,t){return e-t}function Id(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],a=e[i+1];return o+(a-o)*(n-i)}function Md(e,t){for(var r=0,n=e.length;r<n;){var i=r+n>>>1;cs(e[i],t)>0?n=i:r=i+1}return r}function Dd(e,t,r){return t[Md(e,r)]}function Fd(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 wd(e,t){var r=new Map,n=[],i=Od(e),o;try{for(i.s();!(o=i.n()).done;){var a=o.value,s="".concat(a);r.has(s)||r.set(s,n.push(a))}}catch(l){i.e(l)}finally{i.f()}var f=function(u){return Fd(n,r,t,u)};return Qr(e,t,f)}function Bd(e,t,r){var n=e[1]-e[0];if(n<=0)return us.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];var i=n/t.length,o=Math.floor((r-e[0])/i),a=Math.max(Math.min(o,t.length-1),0);return t[a]}function Ud(e,t,r){return(r-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function ds(e){return e!=null}function Wd(e){var t=[];return e.forEach(function(r){!t.includes(r)&&ds(r)&&t.push(r)}),t}function gs(e,t){var r=typeof t=="function"?e.map(t):e;return r.filter(ds)}function hs(e,t){return gs(e,t)}function _s(e,t){return Wd(gs(e,t))}function ps(e,t,r){return Math.max(t,Math.min(r,e))}function As(e){switch(e){case"quantize":return ls;case"linear":return Pd;case"quantile":return Nd;case"ordinal":return wd;default:return ls}}function Ts(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=bs(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
516
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function hi(e,t){return Xd(e)||Vd(e,t)||bs(e,t)||Hd()}function Hd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
517
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bs(e,t){if(e){if(typeof e=="string")return vs(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 vs(e,t)}}function vs(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 Vd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(f){o=!0,s=f}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function Xd(e){if(Array.isArray(e))return e}function Ld(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Ss=function(t){return t.length},zd=3402823466e29,Rs=function(t){return t.points},ys=function(t){return t.index},ms=function(t,r){return t<r?-1:t>r?1:t>=r?0:NaN},jd={getValue:Ss,getPoints:Rs,getIndex:ys,filterData:null},St=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jd;Ld(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,a=o===void 0?Ss:o,s=i.getPoints,f=s===void 0?Rs:s,l=i.getIndex,u=l===void 0?ys:l,c=i.filterData,d=typeof c=="function",g=n.length,h=[],A=0,_=0;_<g;_++){var v=n[_],T=f(v),m=u(v),E=d?T.filter(c):T;v.filteredPoints=d?E:null;var O=E.length?a(E):null;O!=null&&(h[A]={i:Number.isFinite(m)?m:_,value:O,counts:E.length},A++)}return h},t._percentileToIndex=function(n){var i=this.sortedBins.length;if(i<2)return[0,0];var o=n.map(function(c){return ps(c,0,100)}),a=hi(o,2),s=a[0],f=a[1],l=Math.ceil(s/100*(i-1)),u=Math.floor(f/100*(i-1));return[l,u]},t.getBinMap=function(){var n={},i=Ts(this.aggregatedBins),o;try{for(i.s();!(o=i.n()).done;){var a=o.value;n[a.i]=a}}catch(s){i.e(s)}finally{i.f()}return n},t._updateMinMaxValues=function(){var n=0,i=0,o=zd,a=0,s=Ts(this.aggregatedBins),f;try{for(s.s();!(f=s.n()).done;){var l=f.value;n=n>l.counts?n:l.counts,i=i>l.value?i:l.value,o=o<l.value?o:l.value,a+=l.counts}}catch(u){s.e(u)}finally{s.f()}this.maxCount=n,this.maxValue=i,this.minValue=o,this.totalCount=a},t.getValueRange=function(n){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(s,f){return ms(s.value,f.value)})),!this.sortedBins.length)return[];var i=0,o=this.sortedBins.length-1;if(Array.isArray(n)){var a=this._percentileToIndex(n);i=a[0],o=a[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=hi(i,2),a=o[0],s=a===void 0?0:a,f=o[1],l=f===void 0?100:f;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(c,d){return ms(c.value,d.value)})),!this.sortedBins.length)return[];var u=this._percentileToIndex([s,l]);return this._getScaleDomain(n,u)},t._getScaleDomain=function(n,i){var o=hi(i,2),a=o[0],s=o[1],f=this.sortedBins;switch(n){case"quantize":case"linear":return[f[a].value,f[s].value];case"quantile":return hs(f.slice(a,s+1),function(l){return l.value});case"ordinal":return _s(f,function(l){return l.value});default:return[f[a].value,f[s].value]}},e}();var Ns=P($());var Ve=P($()),xs=6378e3;function Jr(e){return Number.isFinite(e)?e:0}function Gr(e,t){for(var r=e.positions.value,n=1/0,i=-1/0,o=1/0,a=-1/0,s,f,l=0;l<t;l++)f=r[l*3],s=r[l*3+1],n=s<n?s:n,i=s>i?s:i,o=f<o?f:o,a=f>a?f:a;var u={xMin:Jr(o),xMax:Jr(a),yMin:Jr(n),yMax:Jr(i)};return u}function kd(e,t,r,n){var i=n.width,o=n.height,a=r===Ve.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-o/2]:[-180,-90];Ve.log.assert(r===Ve.COORDINATE_SYSTEM.CARTESIAN||r===Ve.COORDINATE_SYSTEM.LNGLAT||r===Ve.COORDINATE_SYSTEM.DEFAULT);var s=e.xMin,f=e.yMin;return[-1*(Es(s-a[0],t.xOffset)+a[0]),-1*(Es(f-a[1],t.yOffset)+a[1])]}function Es(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 _i(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 $d(t,o)}function en(e,t,r,n){var i=_i(e,t,n!==Ve.COORDINATE_SYSTEM.CARTESIAN),o=kd(e,i,n,r),a=e.xMin,s=e.yMin,f=e.xMax,l=e.yMax,u=f-a+i.xOffset,c=l-s+i.yOffset,d=Math.ceil(u/i.xOffset),g=Math.ceil(c/i.yOffset);return{gridOffset:i,translation:o,width:u,height:c,numCol:d,numRow:g}}function $d(e,t){var r=Kd(e),n=Yd(t,e);return{yOffset:r,xOffset:n}}function Kd(e){return e/xs*(180/Math.PI)}function Yd(e,t){return t/xs*(180/Math.PI)/Math.cos(e*Math.PI/180)}function Os(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 Zd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Os(Object(r),!0).forEach(function(n){qd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Os(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qd(e,t){return eg(e)||Gd(e,t)||Ps(e,t)||Jd()}function Jd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
518
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(f){o=!0,s=f}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function eg(e){if(Array.isArray(e))return e}function tg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ps(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(l){throw l},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,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Ps(e,t){if(e){if(typeof e=="string")return Cs(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 Cs(e,t)}}function Cs(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 Rt(e,t){var r=rg(e,t),n=ng(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:n}}function rg(e,t){var r=e.data,n=r===void 0?[]:r,i=e.cellSize,o=t.attributes,a=t.viewport,s=t.projectPoints,f=t.numInstances,l=o.positions.value,u=o.positions.getAccessor(),c=u.size,d=t.boundingBox||ig(o.positions,f),g=t.posOffset||[180,90],h=t.gridOffset||_i(d,i);if(h.xOffset<=0||h.yOffset<=0)return{gridHash:{},gridOffset:h,offsets:[0,0]};var A=a.width,_=a.height,v=Math.ceil(A/h.xOffset),T=Math.ceil(_/h.yOffset),m={},E=(0,Ns.createIterable)(n),O=E.iterable,C=E.objectInfo,N=new Array(3),I=tg(O),U;try{for(I.s();!(U=I.n()).done;){var W=U.value;C.index++,N[0]=l[C.index*c],N[1]=l[C.index*c+1],N[2]=c>=3?l[C.index*c+2]:0;var j=s?a.project(N):N,Z=Qd(j,2),oe=Z[0],Ui=Z[1];if(Number.isFinite(oe)&&Number.isFinite(Ui)){var pr=Math.floor((Ui+g[1])/h.yOffset),Ar=Math.floor((oe+g[0])/h.xOffset);if(!s||Ar>=0&&Ar<v&&pr>=0&&pr<T){var Tr="".concat(pr,"-").concat(Ar);m[Tr]=m[Tr]||{count:0,points:[],lonIdx:Ar,latIdx:pr},m[Tr].count+=1,m[Tr].points.push({source:W,index:C.index})}}}}catch(fl){I.e(fl)}finally{I.f()}return{gridHash:m,gridOffset:h,offsets:[g[0]*-1,g[1]*-1]}}function ng(e){var t=e.gridHash,r=e.gridOffset,n=e.offsets,i=new Array(Object.keys(t).length),o=0;for(var a in t){var s=a.split("-"),f=parseInt(s[0],10),l=parseInt(s[1],10),u=o++;i[u]=Zd({index:u,position:[n[0]+r.xOffset*l,n[1]+r.yOffset*f]},t[a])}return i}function ig(e,t){for(var r=e.value,n=e.getAccessor(),i=n.size,o=1/0,a=-1/0,s=1/0,f=-1/0,l,u,c=0;c<t;c++)u=r[c*i],l=r[c*i+1],Number.isFinite(u)&&Number.isFinite(l)&&(o=l<o?l:o,a=l>a?l:a,s=u<s?u:s,f=u>f?u:f);return{xMin:s,xMax:f,yMin:o,yMax:a}}function tn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?tn=function(r){return typeof r}:tn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},tn(e)}function og(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ag(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
520
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function ag(e,t){if(e){if(typeof e=="string")return Is(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 Is(e,t)}}function Is(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 sg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function yt(e,t,r){return typeof Reflect<"u"&&Reflect.get?yt=Reflect.get:yt=function(i,o,a){var s=fg(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},yt(e,t,r||e)}function fg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Xe(e),e!==null););return e}function lg(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&&pi(e,t)}function pi(e,t){return pi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},pi(e,t)}function ug(e){var t=gg();return function(){var n=Xe(e),i;if(t){var o=Xe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cg(this,i)}}function cg(e,t){if(t&&(tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dg(e)}function dg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gg(){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 Xe(e){return Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Xe(e)}var Qe=function(e){lg(r,e);var t=ug(r);function r(){var i;sg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){var a=o.dimensions;yt(Xe(r.prototype),"initializeAggregationLayer",this).call(this,a),this.setState({layerData:{},gpuGridAggregator:new ee(this.context.device,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:Rt})},n.updateState=function(o){yt(Xe(r.prototype),"updateState",this).call(this,o),this.updateAggregationState(o);var a=this.state,s=a.aggregationDataDirty,f=a.aggregationWeightsDirty,l=a.gpuAggregation;if(!(this.getNumInstances()<=0)){var u=!1;(s||l&&f)&&(this._updateAggregation(o),u=!0),!l&&(s||f)&&(this._updateWeightBins(),this._uploadAggregationResults(),u=!0),this.setState({aggregationDirty:u})}},n.finalizeState=function(o){var a,s=this.state.weights.count;s&&s.aggregationBuffer&&s.aggregationBuffer.delete(),(a=this.state.gpuGridAggregator)===null||a===void 0||a.delete(),yt(Xe(r.prototype),"finalizeState",this).call(this,o)},n.updateShaders=function(o){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(o)},n.updateAggregationState=function(o){Ms.log.assert(!1)},n.allocateResources=function(o,a){if(this.state.numRow!==o||this.state.numCol!==a){var s=a*o*4*4,f=this.state.weights;for(var l in f){var u=f[l];u.aggregationBuffer&&u.aggregationBuffer.delete(),u.aggregationBuffer=this.context.device.createBuffer({byteLength:s,accessor:{size:4,type:5126,divisor:1}})}}},n.updateResults=function(o){var a=o.aggregationData,s=o.maxMinData,f=o.maxData,l=o.minData,u=this.state.weights.count;u&&(u.aggregationData=a,u.maxMinData=s,u.maxData=f,u.minData=l)},n._updateAggregation=function(o){var a=this.state,s=a.cpuGridAggregator,f=a.gpuGridAggregator,l=a.gridOffset,u=a.posOffset,c=a.translation,d=c===void 0?[0,0]:c,g=a.scaling,h=g===void 0?[0,0,0]:g,A=a.boundingBox,_=a.projectPoints,v=a.gpuAggregation,T=a.numCol,m=a.numRow,E=o.props,O=this.context.viewport,C=this.getAttributes(),N=this.getNumInstances();if(v){var U=this.state.weights;f.run({weights:U,cellSize:[l.xOffset,l.yOffset],numCol:T,numRow:m,translation:d,scaling:h,vertexCount:N,projectPoints:_,attributes:C,moduleSettings:this.getModuleSettings()})}else{var I=s(E,{gridOffset:l,projectPoints:_,attributes:C,viewport:O,posOffset:u,boundingBox:A});this.setState({layerData:I})}},n._updateWeightBins=function(){var o=this.state.getValue,a=new St(this.state.layerData.data||[],{getValue:o});this.setState({sortedBins:a})},n._uploadAggregationResults=function(){var o=this.state,a=o.numCol,s=o.numRow,f=this.state.layerData.data,l=this.state.sortedBins,u=l.aggregatedBins,c=l.minValue,d=l.maxValue,g=l.totalCount,h=4,A=a*s*h,_=new Float32Array(A).fill(0),v=og(u),T;try{for(v.s();!(T=v.n()).done;){var m=T.value,E=f[m.i],O=E.lonIdx,C=E.latIdx,N=m.value,I=m.counts,U=(O+C*a)*h;_[U]=N,_[U+h-1]=I}}catch(oe){v.e(oe)}finally{v.f()}var W=new Float32Array([d,0,0,c]),j=new Float32Array([d,0,0,g]),Z=new Float32Array([c,0,0,g]);this.updateResults({aggregationData:_,maxMinData:W,maxData:j,minData:Z})},r}(ce);Qe.layerName="GridAggregationLayer";function rn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rn=function(r){return typeof r}:rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},rn(e)}function hg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Et(e,t,r){return typeof Reflect<"u"&&Reflect.get?Et=Reflect.get:Et=function(i,o,a){var s=_g(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},Et(e,t,r||e)}function _g(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Le(e),e!==null););return e}function pg(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&&Ai(e,t)}function Ai(e,t){return Ai=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ai(e,t)}function Ag(e){var t=mg();return function(){var n=Le(e),i;if(t){var o=Le(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Tg(this,i)}}function Tg(e,t){if(t&&(rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vg(e)}function vg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mg(){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 Le(e){return Le=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Le(e)}function Ds(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 Ti(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ds(Object(r),!0).forEach(function(n){vi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ds(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bg=Ti(Ti({},mt.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"}),Fs="positions",Sg={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},nn=function(e){pg(r,e);var t=Ag(r);function r(){var i;hg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;if(!mt.isSupported(this.context.device)){this.setState({supported:!1}),mi.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}Et(Le(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Sg,getCellSize:function(l){return l.cellSizePixels}});var a={count:{size:1,operation:w.SUM,needMax:!0,maxTexture:At(this.context.device,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:a,subLayerData:{attributes:{}},maxTexture:a.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var s=this.getAttributeManager();s.add((o={},vi(o,Fs,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),vi(o,"count",{size:3,accessor:"getWeight"}),o))},n.shouldUpdateState=function(o){var a=o.changeFlags;return this.state.supported&&a.somethingChanged},n.updateState=function(o){Et(Le(r.prototype),"updateState",this).call(this,o)},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,a=o.maxTexture,s=o.numRow,f=o.numCol,l=o.weights,u=this.props.updateTriggers,c=l.count.aggregationBuffer,d=this.getSubLayerClass("cells",mt);return new d(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:u}),{data:{attributes:{instanceCounts:c}},maxTexture:a,numInstances:s*f})},n.finalizeState=function(o){Et(Le(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.aggregationBuffer,f=a.maxBuffer,l=a.maxTexture;s?.delete(),f?.delete(),l?.delete()},n.getPickingInfo=function(o){var a=o.info,s=a.index;if(s>=0){var f=this.state,l=f.gpuGridAggregator,u=f.gpuAggregation,c=f.weights,d=u?l.getData("count"):c.count;a.object=ee.getAggregationData(Ti({pixelIndex:s},d))}return a},n.updateResults=function(o){var a=o.aggregationData,s=o.maxData,f=this.state.weights.count;f.aggregationData=a,f.aggregationBuffer.write(a),f.maxData=s,f.maxTexture.setImageData({data:s})},n.updateAggregationState=function(o){var a=o.props.cellSizePixels,s=o.oldProps.cellSizePixels!==a,f=o.changeFlags.viewportChanged,l=o.props.gpuAggregation;this.state.gpuAggregation!==o.props.gpuAggregation&&l&&!ee.isSupported(this.context.device)&&(mi.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),l=!1);var u=l!==this.state.gpuAggregation;this.setState({gpuAggregation:l});var c=this.isAttributeChanged(Fs),d=this.state.dimensions,g=d.data,h=d.weights,A=c||u||f||this.isAggregationDirty(o,{compareAll:l,dimension:g}),_=this.isAggregationDirty(o,{dimension:h});this.setState({aggregationDataDirty:A,aggregationWeightsDirty:_});var v=this.context.viewport;if(f||s){var T=v.width,m=v.height,E=Math.ceil(T/a),O=Math.ceil(m/a);this.allocateResources(O,E),this.setState({scaling:[T/2,-m/2,1],gridOffset:{xOffset:a,yOffset:a},width:T,height:m,numCol:E,numRow:O})}_&&this._updateAccessors(o),(A||_)&&this._resetResults()},n._updateAccessors=function(o){var a=o.props,s=a.getWeight,f=a.aggregation,l=a.data,u=this.state.weights.count;u&&(u.getWeight=s,u.operation=w[f]),this.setState({getValue:_t(f,s,{data:l})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},r}(Qe);nn.layerName="ScreenGridLayer";nn.defaultProps=bg;var Xs=P(nt());function dr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?dr=function(r){return typeof r}:dr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},dr(e)}function ws(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 de(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ws(Object(r),!0).forEach(function(n){Hs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ws(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bs(){}var Us=["getBins","getDomain","getScaleFunc"],Ws=[{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}],yg=function(t){return t.cellSize},xt=function(){function e(r){Rg(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||yg,this._getAggregator=r.getAggregator,this._addDimension(r.dimensions||Ws)}e.defaultDimensions=function(){return Ws};var t=e.prototype;return t.updateState=function(n,i){var o=n.oldProps,a=n.props,s=n.changeFlags;this.updateGetValueFuncs(o,a,s);var f=this.needsReProjectPoints(o,a,s),l=!1;if(s.dataChanged||f)this.getAggregatedData(a,i),l=!0;else{var u=this.getDimensionChanges(o,a,s)||[];u.forEach(function(c){return typeof c=="function"&&c()}),l=!0}return this.setState({aggregationDirty:l}),this.state},t.setState=function(n){this.state=de(de({},this.state),n)},t.setDimensionState=function(n,i){this.setState({dimensions:de(de({},this.state.dimensions),{},Hs({},n,de(de({},this.state.dimensions[n]),i)))})},t.normalizeResult=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n.hexagons?de({data:n.hexagons},n):n.layerData?de({data:n.layerData},n):n},t.getAggregatedData=function(n,i){var o=this._getAggregator(n),a=o(n,i);this.setState({layerData:this.normalizeResult(a)}),this.changeFlags={layerData:!0},this.getSortedBins(n)},t.updateGetValueFuncs=function(n,i,o){for(var a in this.dimensionUpdaters){var s=this.dimensionUpdaters[a].getBins.triggers,f=s.value,l=s.weight,u=s.aggregation,c=i[f.prop],d=this.needUpdateDimensionStep(this.dimensionUpdaters[a].getBins,n,i,o);d&&(c?c=za(c,{data:i.data}):c=_t(i[u.prop],i[l.prop],{data:i.data})),c&&this.setDimensionState(a,{getValue:c})}},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 a=o.key;n.dimensionUpdaters[a]=n.getDimensionUpdaters(o),n.state.dimensions[a]={getValue:null,domain:null,sortedBins:null,scaleFunc:Bs}})},t.getDimensionUpdaters=function(n){var i=n.key,o=n.accessor,a=n.pickingInfo,s=n.getBins,f=n.getDomain,l=n.getScaleFunc,u=n.nullValue;return{key:i,accessor:o,pickingInfo:a,getBins:de({updater:this.getDimensionSortedBins.bind(this)},s),getDomain:de({updater:this.getDimensionValueDomain.bind(this)},f),getScaleFunc:de({updater:this.getDimensionScale.bind(this)},l),attributeAccessor:this.getSubLayerDimensionAttribute(i,u)}},t.needUpdateDimensionStep=function(n,i,o,a){return Object.values(n.triggers).some(function(s){return s.updateTrigger?a.dataChanged||a.updateTriggersChanged&&(a.updateTriggersChanged.all||a.updateTriggersChanged[s.updateTrigger]):i[s.prop]!==o[s.prop]})},t.getDimensionChanges=function(n,i,o){var a=this,s=[],f=function(c){var d=Us.find(function(g){return a.needUpdateDimensionStep(a.dimensionUpdaters[c][g],n,i,o)});d&&s.push(a.dimensionUpdaters[c][d].updater.bind(a,i,a.dimensionUpdaters[c]))};for(var l in this.dimensionUpdaters)f(l);return s.length?s:null},t.getUpdateTriggers=function(n){var i=this,o=n.updateTriggers||{},a={},s=function(u){var c=i.dimensionUpdaters[u].accessor;a[c]={},Us.forEach(function(d){Object.values(i.dimensionUpdaters[u][d].triggers).forEach(function(g){var h=g.prop,A=g.updateTrigger;if(A){var _=o[A];dr(_)==="object"&&!Array.isArray(_)?Object.assign(a[c],_):_!==void 0&&(a[c][h]=_)}else a[c][h]=n[h]})})};for(var f in this.dimensionUpdaters)s(f);return a},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,a=this.state.dimensions[o].getValue,s=new St(this.state.layerData.data||[],{getValue:a,filterData:n._filterData});this.setDimensionState(o,{sortedBins:s}),this.getDimensionValueDomain(n,i)},t.getDimensionValueDomain=function(n,i){var o=i.getDomain,a=i.key,s=o.triggers,f=s.lowerPercentile,l=s.upperPercentile,u=s.scaleType,c=this.state.dimensions[a].sortedBins.getValueDomainByScale(n[u.prop],[n[f.prop],n[l.prop]]);this.setDimensionState(a,{valueDomain:c}),this.getDimensionScale(n,i)},t.getDimensionScale=function(n,i){var o=i.key,a=i.getScaleFunc,s=i.getDomain,f=a.triggers,l=f.domain,u=f.range,c=s.triggers.scaleType,d=a.onSet,g=n[u.prop],h=n[l.prop]||this.state.dimensions[o].valueDomain,A=As(c&&n[c.prop]),_=A(h,g);dr(d)==="object"&&typeof n[d.props]=="function"&&n[d.props](_.domain()),this.setDimensionState(o,{scaleFunc:_})},t.getSubLayerDimensionAttribute=function(n,i){var o=this;return function(a){var s=o.state.dimensions[n],f=s.sortedBins,l=s.scaleFunc,u=f.binMap[a.index];if(u&&u.counts===0)return i;var c=u&&u.value,d=l.domain(),g=c>=d[0]&&c<=d[d.length-1];return g?l(c):i}},t.getSubLayerAccessors=function(n){var i={};for(var o in this.dimensionUpdaters){var a=this.dimensionUpdaters[o].accessor;i[a]=this.getSubLayerDimensionAttribute(n,o)}return i},t.getPickingInfo=function(n){var i=n.info,o=i.picked&&i.index>-1,a=null;if(o){var s=this.state.layerData.data[i.index],f={};for(var l in this.dimensionUpdaters){var u=this.dimensionUpdaters[l].pickingInfo,c=this.state.dimensions[l].sortedBins,d=c.binMap[s.index]&&c.binMap[s.index].value;f[u]=d}a=Object.assign(f,s,{points:s.filteredPoints||s.points})}return i.picked=Boolean(a),i.object=a,i},t.getAccessor=function(n){return this.dimensionUpdaters.hasOwnProperty(n)?this.dimensionUpdaters[n].attributeAccessor:Bs},e}();function on(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?on=function(r){return typeof r}:on=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},on(e)}function Eg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function an(e,t,r){return typeof Reflect<"u"&&Reflect.get?an=Reflect.get:an=function(i,o,a){var s=xg(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},an(e,t,r||e)}function xg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ot(e),e!==null););return e}function Og(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&&bi(e,t)}function bi(e,t){return bi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},bi(e,t)}function Cg(e){var t=Ig();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 Pg(this,i)}}function Pg(e,t){if(t&&(on(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ng(e)}function Ng(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ig(){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)}function Vs(){}var Mg={colorDomain:null,colorRange:ae,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:Vs,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:Vs,gridAggregator:Rt,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}},Je=function(e){Og(r,e);var t=Cg(r);function r(){var i;Eg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new xt({getAggregator:function(f){return f.gridAggregator},getCellSize:function(f){return f.cellSize}});this.state={cpuAggregator:o,aggregatorState:o.state};var a=this.getAttributeManager();a.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){an(Ot(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 a=o.info;return this.state.cpuAggregator.getPickingInfo({info:a})},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,a=o.elevationScale,s=o.extruded,f=o.cellSize,l=o.coverage,u=o.material,c=o.transitions,d=this.state.cpuAggregator,g=this.getSubLayerClass("grid-cell",Xs.GridCellLayer),h=this._getSublayerUpdateTriggers();return new g({cellSize:f,coverage:l,material:u,elevationScale:a,extruded:s,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:"grid-cell",updateTriggers:h}),{data:d.state.layerData.data})},r}(ce);Je.layerName="CPUGridLayer";Je.defaultProps=Mg;var Ks=P($()),Ys=P(nt());var Ct=Math.PI/3,Dg=[0,Ct,2*Ct,3*Ct,4*Ct,5*Ct];function Fg(e){return e[0]}function wg(e){return e[1]}function Si(){var e=0,t=0,r=1,n=1,i=Fg,o=wg,a,s,f;function l(c){var d={},g=[],h,A=c.length;for(h=0;h<A;++h)if(!(isNaN(v=+i.call(null,_=c[h],h,c))||isNaN(T=+o.call(null,_,h,c)))){var _,v,T,m=Math.round(T=T/f),E=Math.round(v=v/s-(m&1)/2),O=T-m;if(Math.abs(O)*3>1){var C=v-E,N=E+(v<E?-1:1)/2,I=m+(T<m?-1:1),U=v-N,W=T-I;C*C+O*O>U*U+W*W&&(E=N+(m&1?1:-1)/2,m=I)}var j=E+"-"+m,Z=d[j];Z?Z.push(_):(g.push(Z=d[j]=[_]),Z.x=(E+(m&1)/2)*s,Z.y=m*f)}return g}function u(c){var d=0,g=0;return Dg.map(function(h){var A=Math.sin(h)*c,_=-Math.cos(h)*c,v=A-d,T=_-g;return d=A,g=_,[v,T]})}return l.hexagon=function(c){return"m"+u(c==null?a:+c).join("l")+"z"},l.centers=function(){for(var c=[],d=Math.round(t/f),g=Math.round(e/s),h=d*f;h<n+a;h+=f,++d)for(var A=g*s+(d&1)*s/2;A<r+s/2;A+=s)c.push([A,h]);return c},l.mesh=function(){var c=u(a).slice(0,4).join("l");return l.centers().map(function(d){return"M"+d+"m"+c}).join("")},l.x=function(c){return arguments.length?(i=c,l):i},l.y=function(c){return arguments.length?(o=c,l):o},l.radius=function(c){return arguments.length?(a=+c,s=a*2*Math.sin(Ct),f=a*1.5,l):a},l.size=function(c){return arguments.length?(e=t=0,r=+c[0],n=+c[1],l):[r-e,n-t]},l.extent=function(c){return arguments.length?(e=+c[0][0],t=+c[0][1],r=+c[1][0],n=+c[1][1],l):[[e,t],[r,n]]},l.radius(1)}var sn=P($());function Bg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ug(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
521
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Ug(e,t){if(e){if(typeof e=="string")return Ls(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 Ls(e,t)}}function Ls(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 zs(e,t){var r=e.data,n=e.radius,i=t.viewport,o=t.attributes,a=r.length?Wg(r,t):null,s=Hg(n,i,a),f=[],l=(0,sn.createIterable)(r),u=l.iterable,c=l.objectInfo,d=o.positions.value,g=o.positions.getAccessor(),h=g.size,A=Bg(u),_;try{for(A.s();!(_=A.n()).done;){var v=_.value;c.index++;var T=c.index*h,m=[d[T],d[T+1]],E=Number.isFinite(m[0])&&Number.isFinite(m[1]);E?f.push({screenCoord:i.projectFlat(m),source:v,index:c.index}):sn.log.warn("HexagonLayer: invalid position")()}}catch(N){A.e(N)}finally{A.f()}var O=Si().radius(s).x(function(N){return N.screenCoord[0]}).y(function(N){return N.screenCoord[1]}),C=O(f);return{hexagons:C.map(function(N,I){return{position:i.unprojectFlat([N.x,N.y]),points:N,index:I}}),radiusCommon:s}}function Wg(e,t){var r=t.attributes,n=r.positions.value,i=r.positions.getAccessor(),o=i.size,a=1/0,s=1/0,f=-1/0,l=-1/0,u;for(u=0;u<o*e.length;u+=o){var c=n[u],d=n[u+1],g=Number.isFinite(c)&&Number.isFinite(d);g&&(a=Math.min(c,a),f=Math.max(c,f),s=Math.min(d,s),l=Math.max(d,l))}return[a,s,f,l].every(Number.isFinite)?[(a+f)/2,(s+l)/2]:null}function Hg(e,t,r){var n=t.getDistanceScales(r),i=n.unitsPerMeter;return e*i[0]}function fn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fn=function(r){return typeof r}:fn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fn(e)}function js(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 ks(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?js(Object(r),!0).forEach(function(n){Vg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):js(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ln(e,t,r){return typeof Reflect<"u"&&Reflect.get?ln=Reflect.get:ln=function(i,o,a){var s=Lg(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},ln(e,t,r||e)}function Lg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Pt(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&&Ri(e,t)}function Ri(e,t){return Ri=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ri(e,t)}function jg(e){var t=Kg();return function(){var n=Pt(e),i;if(t){var o=Pt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return kg(this,i)}}function kg(e,t){if(t&&(fn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $g(e)}function $g(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kg(){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 Pt(e){return Pt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Pt(e)}function $s(){}var Yg={colorDomain:null,colorRange:ae,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:$s,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:$s,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:zs,getPosition:{type:"accessor",value:function(t){return t.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},un=function(e){zg(r,e);var t=jg(r);function r(){var i;Xg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new xt({getAggregator:function(f){return f.hexagonAggregator},getCellSize:function(f){return f.radius}});this.state={cpuAggregator:o,aggregatorState:o.state,vertices:null};var a=this.getAttributeManager();a.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){if(ln(Pt(r.prototype),"updateState",this).call(this,o),o.changeFlags.propsOrDataChanged){var a=this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==a.layerData){var s=a.layerData||{},f=s.hexagonVertices;this.setState({vertices:f&&this.convertLatLngToMeterOffset(f)})}this.setState({aggregatorState:a})}},n.convertLatLngToMeterOffset=function(o){var a=this.context.viewport;if(Array.isArray(o)&&o.length===6){var s=o[0],f=o[3],l=[(s[0]+f[0])/2,(s[1]+f[1])/2],u=a.projectFlat(l),c=a.getDistanceScales(l),d=c.metersPerUnit,g=o.map(function(h){var A=a.projectFlat(h);return[(A[0]-u[0])*d[0],(A[1]-u[1])*d[1]]});return g}return Ks.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null},n.getPickingInfo=function(o){var a=o.info;return this.state.cpuAggregator.getPickingInfo({info:a})},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,a=o.elevationScale,s=o.extruded,f=o.coverage,l=o.material,u=o.transitions,c=this.state,d=c.aggregatorState,g=c.vertices,h=this.getSubLayerClass("hexagon-cell",Ys.ColumnLayer),A=this._getSublayerUpdateTriggers(),_=g?{vertices:g,radius:1}:{radius:d.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new h(ks(ks({},_),{},{diskResolution:6,elevationScale:a,extruded:s,coverage:f,material:l,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:u&&{getFillColor:u.getColorValue||u.getColorWeight,getElevation:u.getElevationValue||u.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:A}),{data:d.layerData.data})},r}(ce);un.layerName="HexagonLayer";un.defaultProps=Yg;var pn=P(nt());var Rf=P($());var S;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}var b=.5,x=1/6,p={N:[0,b],E:[b,0],S:[0,-b],W:[-b,0],NE:[b,b],NW:[-b,b],SE:[b,-b],SW:[-b,-b]},Nt=[p.W,p.SW,p.S],It=[p.S,p.SE,p.E],Mt=[p.E,p.NE,p.N],Dt=[p.NW,p.W,p.N],Ft=[[-b,x],[-b,-x],[-x,-b],[x,-b]],wt=[[-x,-b],[x,-b],[b,-x],[b,x]],Bt=[[b,-x],[b,x],[x,b],[-x,b]],Ut=[[-b,x],[-b,-x],[x,b],[-x,b]],Zs=[p.W,p.SW,p.SE,p.E],qs=[p.S,p.SE,p.NE,p.N],Qs=[p.NW,p.W,p.E,p.NE],Js=[p.NW,p.SW,p.S,p.N],Gs=[[-b,x],[-b,-x],[b,-x],[b,x]],ef=[[-x,-b],[x,-b],[x,b],[-x,b]],Zg=[p.NW,p.SW,p.SE,p.NE],tf=[p.NW,p.SW,p.SE,p.E,p.N],rf=[p.W,p.SW,p.SE,p.NE,p.N],nf=[p.NW,p.W,p.S,p.SE,p.NE],of=[p.NW,p.SW,p.S,p.E,p.NE],af=[p.NW,p.W,[b,-x],[b,x],p.N],sf=[[-x,-b],[x,-b],p.E,p.NE,p.N],ff=[[-b,x],[-b,-x],p.S,p.SE,p.E],lf=[p.W,p.SW,p.S,[x,b],[-x,b]],uf=[p.NW,p.W,[-x,-b],[x,-b],p.N],cf=[[-b,x],[-b,-x],p.E,p.NE,p.N],df=[p.S,p.SE,p.E,[x,b],[-x,b]],gf=[p.W,p.SW,p.S,[b,-x],[b,x]],hf=[p.W,p.SW,p.SE,p.E,[x,b],[-x,b]],_f=[[-b,x],[-b,-x],p.S,p.SE,p.NE,p.N],pf=[p.NW,p.W,[-x,-b],[x,-b],p.E,p.NE],Af=[p.NW,p.SW,p.S,[b,-x],[b,x],p.N],Wt=[p.W,p.SW,p.S,p.E,p.NE,p.N],Ht=[p.NW,p.W,p.S,p.SE,p.E,p.N],cn=[[-b,x],[-b,-x],[-x,-b],[x,-b],p.E,p.NE,p.N],dn=[p.W,p.SW,p.S,[b,-x],[b,x],[x,b],[-x,b]],gn=[p.NW,p.W,[-x,-b],[x,-b],[b,-x],[b,x],p.N],hn=[[-b,x],[-b,-x],p.S,p.SE,p.E,[x,b],[-x,b]],Tf=[[-b,x],[-b,-x],[-x,-b],[x,-b],[b,-x],[b,x],[x,b],[-x,b]],vf={0:[],1:[[p.W,p.S]],2:[[p.S,p.E]],3:[[p.W,p.E]],4:[[p.N,p.E]],5:{0:[[p.W,p.S],[p.N,p.E]],1:[[p.W,p.N],[p.S,p.E]]},6:[[p.N,p.S]],7:[[p.W,p.N]],8:[[p.W,p.N]],9:[[p.N,p.S]],10:{0:[[p.W,p.N],[p.S,p.E]],1:[[p.W,p.S],[p.N,p.E]]},11:[[p.N,p.E]],12:[[p.W,p.E]],13:[[p.S,p.E]],14:[[p.W,p.S]],15:[]};function y(e){return parseInt(e,4)}var mf=(S={},R(S,y("0000"),[]),R(S,y("2222"),[]),R(S,y("2221"),[Nt]),R(S,y("2212"),[It]),R(S,y("2122"),[Mt]),R(S,y("1222"),[Dt]),R(S,y("0001"),[Nt]),R(S,y("0010"),[It]),R(S,y("0100"),[Mt]),R(S,y("1000"),[Dt]),R(S,y("2220"),[Ft]),R(S,y("2202"),[wt]),R(S,y("2022"),[Bt]),R(S,y("0222"),[Ut]),R(S,y("0002"),[Ft]),R(S,y("0020"),[wt]),R(S,y("0200"),[Bt]),R(S,y("2000"),[Ut]),R(S,y("0011"),[Zs]),R(S,y("0110"),[qs]),R(S,y("1100"),[Qs]),R(S,y("1001"),[Js]),R(S,y("2211"),[Zs]),R(S,y("2112"),[qs]),R(S,y("1122"),[Qs]),R(S,y("1221"),[Js]),R(S,y("2200"),[Gs]),R(S,y("2002"),[ef]),R(S,y("0022"),[Gs]),R(S,y("0220"),[ef]),R(S,y("1111"),[Zg]),R(S,y("1211"),[tf]),R(S,y("2111"),[rf]),R(S,y("1112"),[nf]),R(S,y("1121"),[of]),R(S,y("1011"),[tf]),R(S,y("0111"),[rf]),R(S,y("1110"),[nf]),R(S,y("1101"),[of]),R(S,y("1200"),[af]),R(S,y("0120"),[sf]),R(S,y("0012"),[ff]),R(S,y("2001"),[lf]),R(S,y("1022"),[af]),R(S,y("2102"),[sf]),R(S,y("2210"),[ff]),R(S,y("0221"),[lf]),R(S,y("1002"),[uf]),R(S,y("2100"),[cf]),R(S,y("0210"),[df]),R(S,y("0021"),[gf]),R(S,y("1220"),[uf]),R(S,y("0122"),[cf]),R(S,y("2012"),[df]),R(S,y("2201"),[gf]),R(S,y("0211"),[hf]),R(S,y("2110"),[_f]),R(S,y("1102"),[pf]),R(S,y("1021"),[Af]),R(S,y("2011"),[hf]),R(S,y("0112"),[_f]),R(S,y("1120"),[pf]),R(S,y("1201"),[Af]),R(S,y("2101"),[Wt]),R(S,y("0121"),[Wt]),R(S,y("1012"),[Ht]),R(S,y("1210"),[Ht]),R(S,y("0101"),{0:[Nt,Mt],1:[Wt],2:[Wt]}),R(S,y("1010"),{0:[Dt,It],1:[Ht],2:[Ht]}),R(S,y("2121"),{0:[Wt],1:[Wt],2:[Nt,Mt]}),R(S,y("1212"),{0:[Ht],1:[Ht],2:[Dt,It]}),R(S,y("2120"),{0:[cn],1:[cn],2:[Ft,Mt]}),R(S,y("2021"),{0:[dn],1:[dn],2:[Nt,Bt]}),R(S,y("1202"),{0:[gn],1:[gn],2:[Dt,wt]}),R(S,y("0212"),{0:[hn],1:[hn],2:[It,Ut]}),R(S,y("0102"),{0:[Ft,Mt],1:[cn],2:[cn]}),R(S,y("0201"),{0:[Nt,Bt],1:[dn],2:[dn]}),R(S,y("1020"),{0:[Dt,wt],1:[gn],2:[gn]}),R(S,y("2010"),{0:[It,Ut],1:[hn],2:[hn]}),R(S,y("2020"),{0:[Ut,wt],1:[Tf],2:[Ft,Bt]}),R(S,y("0202"),{0:[Bt,Ft],1:[Tf],2:[Ut,wt]}),S);function bf(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 Sf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bf(Object(r),!0).forEach(function(n){qg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ge={ISO_LINES:1,ISO_BANDS:2},Qg={zIndex:0,zOffset:.005};function gr(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function yf(e){var t=e.cellWeights,r=e.x,n=e.y,i=e.width,o=e.height,a=e.threshold;e.thresholdValue&&(Rf.log.deprecated("thresholdValue","threshold")(),a=e.thresholdValue);var s=r<0,f=r>=i-1,l=n<0,u=n>=o-1,c=s||f||l||u,d={},g={};s||u?g.top=0:(d.top=t[(n+1)*i+r],g.top=gr(d.top,a)),f||u?g.topRight=0:(d.topRight=t[(n+1)*i+r+1],g.topRight=gr(d.topRight,a)),f||l?g.right=0:(d.right=t[n*i+r+1],g.right=gr(d.right,a)),s||l?g.current=0:(d.current=t[n*i+r],g.current=gr(d.current,a));var h=g.top,A=g.topRight,_=g.right,v=g.current,T=-1;Number.isFinite(a)&&(T=h<<3|A<<2|_<<1|v),Array.isArray(a)&&(T=h<<6|A<<4|_<<2|v);var m=0;return c||(m=gr((d.top+d.topRight+d.right+d.current)/4,a)),{code:T,meanCode:m}}function yi(e){var t=e.gridOrigin,r=e.cellSize,n=e.x,i=e.y,o=e.code,a=e.meanCode,s=e.type,f=s===void 0?Ge.ISO_LINES:s,l=Sf(Sf({},Qg),e.thresholdData),u=f===Ge.ISO_BANDS?mf[o]:vf[o];Array.isArray(u)||(u=u[a]);var c=l.zIndex*l.zOffset,d=(n+1)*r[0],g=(i+1)*r[1],h=t[0]+d,A=t[1]+g;if(f===Ge.ISO_BANDS){var _=[];return u.forEach(function(T){var m=[];T.forEach(function(E){var O=h+E[0]*r[0],C=A+E[1]*r[1];m.push([O,C,c])}),_.push(m)}),_}var v=[];return u.forEach(function(T){T.forEach(function(m){var E=h+m[0]*r[0],O=A+m[1]*r[1];v.push([E,O,c])})}),v}function Ef(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Jg(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(l){throw l},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,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Jg(e,t){if(e){if(typeof e=="string")return xf(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 xf(e,t)}}function xf(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 Of(e){var t=e.thresholdData,r=e.cellWeights,n=e.gridSize,i=e.gridOrigin,o=e.cellSize,a=[],s=[],f=n[0],l=n[1],u=0,c=0,d=Ef(t),g;try{for(d.s();!(g=d.n()).done;)for(var h=g.value,A=h.contour,_=A.threshold,v=-1;v<f;v++)for(var T=-1;T<l;T++){var m=yf({cellWeights:r,threshold:_,x:v,y:T,width:f,height:l}),E=m.code,O=m.meanCode,C={type:Ge.ISO_BANDS,gridOrigin:i,cellSize:o,x:v,y:T,width:f,height:l,code:E,meanCode:O,thresholdData:h};if(Array.isArray(_)){C.type=Ge.ISO_BANDS;var N=yi(C),I=Ef(N),U;try{for(I.s();!(U=I.n()).done;){var W=U.value;s[c++]={vertices:W,contour:A}}}catch(oe){I.e(oe)}finally{I.f()}}else{C.type=Ge.ISO_LINES;for(var j=yi(C),Z=0;Z<j.length;Z+=2)a[u++]={start:j[Z],end:j[Z+1],contour:A}}}}catch(oe){d.e(oe)}finally{d.f()}return{contourSegments:a,contourPolygons:s}}var If=P($());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 Cf(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hr(e,t,r){return typeof Reflect<"u"&&Reflect.get?hr=Reflect.get:hr=function(i,o,a){var s=eh(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},hr(e,t,r||e)}function eh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=et(e),e!==null););return e}function th(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&&Ei(e,t)}function Ei(e,t){return Ei=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ei(e,t)}function rh(e){var t=oh();return function(){var n=et(e),i;if(t){var o=et(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return nh(this,i)}}function nh(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 ih(e)}function ih(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oh(){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 et(e){return et=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},et(e)}var Pf=[255,255,255,255],ah=1,sh=1,fh={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:sh}],optional:!0,compare:3},zOffset:.005},Nf="positions",lh={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},An=function(e){th(r,e);var t=rh(r);function r(){var i;Gg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;hr(et(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:lh}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:w.SUM}}});var a=this.getAttributeManager();a.add((o={},Cf(o,Nf,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),Cf(o,"count",{size:3,accessor:"getWeight"}),o))},n.updateState=function(o){hr(et(r.prototype),"updateState",this).call(this,o);var a=!1,s=o.oldProps,f=o.props,l=this.state.aggregationDirty;(s.contours!==f.contours||s.zOffset!==f.zOffset)&&(a=!0,this._updateThresholdData(o.props)),this.getNumInstances()>0&&(l||a)&&this._generateContours()},n.renderLayers=function(){var o=this.state.contourData,a=o.contourSegments,s=o.contourPolygons,f=this.getSubLayerClass("lines",pn.LineLayer),l=this.getSubLayerClass("bands",pn.SolidPolygonLayer),u=a&&a.length>0&&new f(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(g){return g.start},getTargetPosition:function(g){return g.end},getColor:function(g){return g.contour.color||Pf},getWidth:function(g){return g.contour.strokeWidth||ah}}),c=s&&s.length>0&&new l(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(g){return g.vertices},getFillColor:function(g){return g.contour.color||Pf}});return[u,c]},n.updateAggregationState=function(o){var a=o.props,s=o.oldProps,f=a.cellSize,l=a.coordinateSystem,u=this.context.viewport,c=s.cellSize!==f,d=a.gpuAggregation;this.state.gpuAggregation!==a.gpuAggregation&&d&&!ee.isSupported(this.context.device)&&(If.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),d=!1);var g=d!==this.state.gpuAggregation;this.setState({gpuAggregation:d});var h=this.state.dimensions,A=this.isAttributeChanged(Nf),_=h.data,v=h.weights,T=this.state.boundingBox;if(A&&(T=Gr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),A||c){var m=en(T,f,u,l),E=m.gridOffset,O=m.translation,C=m.width,N=m.height,I=m.numCol,U=m.numRow;this.allocateResources(U,I),this.setState({gridOffset:E,boundingBox:T,translation:O,posOffset:O.slice(),gridOrigin:[-1*O[0],-1*O[1]],width:C,height:N,numCol:I,numRow:U})}var W=A||g||this.isAggregationDirty(o,{dimension:_,compareAll:d}),j=this.isAggregationDirty(o,{dimension:v});j&&this._updateAccessors(o),(W||j)&&this._resetResults(),this.setState({aggregationDataDirty:W,aggregationWeightsDirty:j})},n._updateAccessors=function(o){var a=o.props,s=a.getWeight,f=a.aggregation,l=a.data,u=this.state.weights.count;u&&(u.getWeight=s,u.operation=w[f]),this.setState({getValue:_t(f,s,{data:l})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},n._generateContours=function(){var o=this.state,a=o.numCol,s=o.numRow,f=o.gridOrigin,l=o.gridOffset,u=o.thresholdData,c=this.state.weights.count,d=c.aggregationData;d||(d=c.aggregationBuffer.readSyncWebGL2(),c.aggregationData=d);var g=ee.getCellData({countsData:d}),h=g.cellWeights,A=Of({thresholdData:u,cellWeights:h,gridSize:[a,s],gridOrigin:f,cellSize:[l.xOffset,l.yOffset]});this.setState({contourData:A})},n._updateThresholdData=function(o){for(var a=o.contours,s=o.zOffset,f=a.length,l=new Array(f),u=0;u<f;u++){var c=a[u];l[u]={contour:c,zIndex:c.zIndex||u,zOffset:s}}this.setState({thresholdData:l})},r}(Qe);An.layerName="ContourLayer";An.defaultProps=fh;var Xf=P($());var Hf=P($());var ie=P($());var Mf=`#version 300 es
293
+ if (vSampleCount <= 0.0) {
294
+ discard;
295
+ }
296
+ fragColor = vColor;
297
+ DECKGL_FILTER_COLOR(fragColor, geometry);
298
+ }
299
+ `;var Li=[0,0,0,0],Fi=[0,255,0,255],wi=["minColor","maxColor","colorRange","colorDomain"],Ii={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:D},Dt=class extends et.Layer{getShaders(){return{vs:Ie,fs:Re,modules:[et.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:e,props:o,changeFlags:i}=t,r=this.getAttributeManager();o.numInstances!==e.numInstances?r.invalidateAll():e.cellSizePixels!==o.cellSizePixels&&r.invalidate("instancePositions"),this._updateUniforms(e,o,i)}draw({uniforms:t}){let{parameters:e,maxTexture:o}=this.props,i=this.props.minColor||Li,r=this.props.maxColor||Fi,s=this.props.colorDomain||[1,0],a=this.state.model;a.setUniforms(t),a.setBindings({maxTexture:o}),a.setUniforms({minColor:i,maxColor:r,colorDomain:s}),a.setParameters({depthWriteEnabled:!1,...e}),a.draw(this.context.renderPass)}calculateInstancePositions(t,{numInstances:e}){let{width:o,height:i}=this.context.viewport,{cellSizePixels:r}=this.props,s=Math.ceil(o/r),{value:a,size:l}=t;for(let c=0;c<e;c++){let g=c%s,f=Math.floor(c/s);a[c*l+0]=g*r/o*2-1,a[c*l+1]=1-f*r/i*2,a[c*l+2]=0}}_getModel(){return new Ot.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ot.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])}}),isInstanced:!0})}_shouldUseMinMax(){let{minColor:t,maxColor:e,colorDomain:o,colorRange:i}=this.props;return t||e?(et.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(o||i)}_updateUniforms(t,e,o){let i=this.state.model;if(wi.some(r=>t[r]!==e[r])&&i.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),t.colorRange!==e.colorRange&&i.setUniforms({colorRange:z(e.colorRange)}),t.cellMarginPixels!==e.cellMarginPixels||t.cellSizePixels!==e.cellSizePixels||o.viewportChanged){let{width:r,height:s}=this.context.viewport,{cellSizePixels:a,cellMarginPixels:l}=this.props,c=a>l?l:0,g=new Float32Array([(a-c)/r*2,-(a-c)/s*2,1]);i.setUniforms({cellScale:g})}}},tt=Dt;(()=>{Dt.layerName="ScreenGridCellLayer"})(),(()=>{Dt.defaultProps=Ii})();var to=M(E(),1);var ot=M(E(),1);function Be(n,t){let e={};for(let o in n)t.includes(o)||(e[o]=n[o]);return e}var oe=class extends ot.CompositeLayer{initializeAggregationLayer(t){super.initializeState(this.context),this.setState({ignoreProps:Be(this.constructor._propTypes,t.data.props),dimensions:t})}updateState(t){super.updateState(t);let{changeFlags:e}=t;if(e.extensionsChanged){let o=this.getShaders({});o&&o.defines&&(o.defines.NON_INSTANCED_MODEL=1),this.updateShaders(o)}this._updateAttributes()}updateAttributes(t){this.setState({changedAttributes:t})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:t,mousePosition:e,device:o}=this.context;return Object.assign(Object.create(this.props),{viewport:t,mousePosition:e,picking:{isActive:0},devicePixelRatio:o.canvasContext.cssToDeviceRatio()})}updateShaders(t){}isAggregationDirty(t,e={}){let{props:o,oldProps:i,changeFlags:r}=t,{compareAll:s=!1,dimension:a}=e,{ignoreProps:l}=this.state,{props:c,accessors:g=[]}=a,{updateTriggersChanged:f}=r;if(r.dataChanged)return!0;if(f){if(f.all)return!0;for(let d of g)if(f[d])return!0}if(s)return r.extensionsChanged?!0:(0,ot._compareProps)({oldProps:i,newProps:o,ignoreProps:l,propTypes:this.constructor._propTypes});for(let d of c)if(o[d]!==i[d])return!0;return!1}isAttributeChanged(t){let{changedAttributes:e}=this.state;return t?e&&e[t]!==void 0:!Ri(e)}_getAttributeManager(){return new ot.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}},P=oe;(()=>{oe.layerName="AggregationLayer"})();function Ri(n){let t=!0;for(let e in n){t=!1;break}return t}var We=M(E(),1);function Lt(n,t,e){let o=e;return o.domain=()=>n,o.range=()=>t,o}function Ue(n,t){return Lt(n,t,o=>ki(n,t,o))}function Bi(n,t){return Lt(n,t,o=>ji(n,t,o))}function Ui(n,t){let e=n.sort(ze),o=0,i=Math.max(1,t.length),r=new Array(i-1);for(;++o<i;)r[o-1]=Wi(e,o/i);let s=a=>Gi(r,t,a);return s.thresholds=()=>r,Lt(n,t,s)}function ze(n,t){return n-t}function Wi(n,t){let e=n.length;if(t<=0||e<2)return n[0];if(t>=1)return n[e-1];let o=(e-1)*t,i=Math.floor(o),r=n[i],s=n[i+1];return r+(s-r)*(o-i)}function zi(n,t){let e=0,o=n.length;for(;e<o;){let i=e+o>>>1;ze(n[i],t)>0?o=i:e=i+1}return e}function Gi(n,t,e){return t[zi(n,e)]}function Hi(n,t,e,o){let i=`${o}`,r=t.get(i);return r===void 0&&(r=n.push(o),t.set(i,r)),e[(r-1)%e.length]}function Vi(n,t){let e=new Map,o=[];for(let r of n){let s=`${r}`;e.has(s)||e.set(s,o.push(r))}return Lt(n,t,r=>Hi(o,e,t,r))}function ki(n,t,e){let o=n[1]-n[0];if(o<=0)return We.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];let i=o/t.length,r=Math.floor((e-n[0])/i),s=Math.max(Math.min(r,t.length-1),0);return t[s]}function ji(n,t,e){return(e-n[0])/(n[1]-n[0])*(t[1]-t[0])+t[0]}function Ge(n){return n!=null}function Xi(n){let t=[];return n.forEach(e=>{!t.includes(e)&&Ge(e)&&t.push(e)}),t}function He(n,t){return(typeof t=="function"?n.map(t):n).filter(Ge)}function Ve(n,t){return He(n,t)}function ke(n,t){return Xi(He(n,t))}function je(n,t,e){return Math.max(t,Math.min(e,n))}function Xe(n){switch(n){case"quantize":return Ue;case"linear":return Bi;case"quantile":return Ui;case"ordinal":return Vi;default:return Ue}}var Ye=n=>n.length,qi=3402823466e29,$e=n=>n.points,Ke=n=>n.index,qe=(n,t)=>n<t?-1:n>t?1:n>=t?0:NaN,Yi={getValue:Ye,getPoints:$e,getIndex:Ke,filterData:null},F=class{constructor(t=[],e=Yi){this.aggregatedBins=this.getAggregatedBins(t,e),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(t,e){let{getValue:o=Ye,getPoints:i=$e,getIndex:r=Ke,filterData:s}=e,a=typeof s=="function",l=t.length,c=[],g=0;for(let f=0;f<l;f++){let d=t[f],p=i(d),x=r(d),h=a?p.filter(s):p;d.filteredPoints=a?h:null;let A=h.length?o(h):null;A!=null&&(c[g]={i:Number.isFinite(x)?x:f,value:A,counts:h.length},g++)}return c}_percentileToIndex(t){let e=this.sortedBins.length;if(e<2)return[0,0];let[o,i]=t.map(a=>je(a,0,100)),r=Math.ceil(o/100*(e-1)),s=Math.floor(i/100*(e-1));return[r,s]}getBinMap(){let t={};for(let e of this.aggregatedBins)t[e.i]=e;return t}_updateMinMaxValues(){let t=0,e=0,o=qi,i=0;for(let r of this.aggregatedBins)t=t>r.counts?t:r.counts,e=e>r.value?e:r.value,o=o<r.value?o:r.value,i+=r.counts;this.maxCount=t,this.maxValue=e,this.minValue=o,this.totalCount=i}getValueRange(t){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((i,r)=>qe(i.value,r.value))),!this.sortedBins.length)return[];let e=0,o=this.sortedBins.length-1;if(Array.isArray(t)){let i=this._percentileToIndex(t);e=i[0],o=i[1]}return[this.sortedBins[e].value,this.sortedBins[o].value]}getValueDomainByScale(t,[e=0,o=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((r,s)=>qe(r.value,s.value))),!this.sortedBins.length)return[];let i=this._percentileToIndex([e,o]);return this._getScaleDomain(t,i)}_getScaleDomain(t,[e,o]){let i=this.sortedBins;switch(t){case"quantize":case"linear":return[i[e].value,i[o].value];case"quantile":return Ve(i.slice(e,o+1),r=>r.value);case"ordinal":return ke(i,r=>r.value);default:return[i[e].value,i[o].value]}}};var Je=M(E(),1);var G=M(E(),1),Ze=6378e3;function Ft(n){return Number.isFinite(n)?n:0}function wt(n,t){let e=n.positions.value,o=1/0,i=-1/0,r=1/0,s=-1/0,a,l;for(let g=0;g<t;g++)l=e[g*3],a=e[g*3+1],o=a<o?a:o,i=a>i?a:i,r=l<r?l:r,s=l>s?l:s;return{xMin:Ft(r),xMax:Ft(s),yMin:Ft(o),yMax:Ft(i)}}function $i(n,t,e,o){let{width:i,height:r}=o,s=e===G.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-r/2]:[-180,-90];G.log.assert(e===G.COORDINATE_SYSTEM.CARTESIAN||e===G.COORDINATE_SYSTEM.LNGLAT||e===G.COORDINATE_SYSTEM.DEFAULT);let{xMin:a,yMin:l}=n;return[-1*(Qe(a-s[0],t.xOffset)+s[0]),-1*(Qe(l-s[1],t.yOffset)+s[1])]}function Qe(n,t){let e=n<0?-1:1,o=e<0?Math.abs(n)+t:Math.abs(n);return o=Math.floor(o/t)*t,o*e}function ie(n,t,e=!0){if(!e)return{xOffset:t,yOffset:t};let{yMin:o,yMax:i}=n,r=(o+i)/2;return Ki(t,r)}function It(n,t,e,o){let i=ie(n,t,o!==G.COORDINATE_SYSTEM.CARTESIAN),r=$i(n,i,o,e),{xMin:s,yMin:a,xMax:l,yMax:c}=n,g=l-s+i.xOffset,f=c-a+i.yOffset,d=Math.ceil(g/i.xOffset),p=Math.ceil(f/i.yOffset);return{gridOffset:i,translation:r,width:g,height:f,numCol:d,numRow:p}}function Ki(n,t){let e=Qi(n),o=Zi(t,n);return{yOffset:e,xOffset:o}}function Qi(n){return n/Ze*(180/Math.PI)}function Zi(n,t){return t/Ze*(180/Math.PI)/Math.cos(n*Math.PI/180)}function it(n,t){let e=Ji(n,t),o=tr(e);return{gridHash:e.gridHash,gridOffset:e.gridOffset,data:o}}function Ji(n,t){let{data:e=[],cellSize:o}=n,{attributes:i,viewport:r,projectPoints:s,numInstances:a}=t,l=i.positions.value,{size:c}=i.positions.getAccessor(),g=t.boundingBox||er(i.positions,a),f=t.posOffset||[180,90],d=t.gridOffset||ie(g,o);if(d.xOffset<=0||d.yOffset<=0)return{gridHash:{},gridOffset:d,offsets:[0,0]};let{width:p,height:x}=r,h=Math.ceil(p/d.xOffset),A=Math.ceil(x/d.yOffset),S={},{iterable:y,objectInfo:_}=(0,Je.createIterable)(e),b=new Array(3);for(let O of y){_.index++,b[0]=l[_.index*c],b[1]=l[_.index*c+1],b[2]=c>=3?l[_.index*c+2]:0;let[B,mt]=s?r.project(b):b;if(Number.isFinite(B)&&Number.isFinite(mt)){let k=Math.floor((mt+f[1])/d.yOffset),j=Math.floor((B+f[0])/d.xOffset);if(!s||j>=0&&j<h&&k>=0&&k<A){let X=`${k}-${j}`;S[X]=S[X]||{count:0,points:[],lonIdx:j,latIdx:k},S[X].count+=1,S[X].points.push({source:O,index:_.index})}}}return{gridHash:S,gridOffset:d,offsets:[f[0]*-1,f[1]*-1]}}function tr({gridHash:n,gridOffset:t,offsets:e}){let o=new Array(Object.keys(n).length),i=0;for(let r in n){let s=r.split("-"),a=parseInt(s[0],10),l=parseInt(s[1],10),c=i++;o[c]={index:c,position:[e[0]+t.xOffset*l,e[1]+t.yOffset*a],...n[r]}}return o}function er(n,t){let e=n.value,{size:o}=n.getAccessor(),i=1/0,r=-1/0,s=1/0,a=-1/0,l,c;for(let g=0;g<t;g++)c=e[g*o],l=e[g*o+1],Number.isFinite(c)&&Number.isFinite(l)&&(i=l<i?l:i,r=l>r?l:r,s=c<s?c:s,a=c>a?c:a);return{xMin:s,xMax:a,yMin:i,yMax:r}}var re=class extends P{initializeAggregationLayer({dimensions:t}){super.initializeAggregationLayer(t),this.setState({layerData:{},gpuGridAggregator:new C(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:it})}updateState(t){super.updateState(t),this.updateAggregationState(t);let{aggregationDataDirty:e,aggregationWeightsDirty:o,gpuAggregation:i}=this.state;if(this.getNumInstances()<=0)return;let r=!1;(e||i&&o)&&(this._updateAggregation(t),r=!0),!i&&(e||o)&&(this._updateWeightBins(),this._uploadAggregationResults(),r=!0),this.setState({aggregationDirty:r})}finalizeState(t){let{count:e}=this.state.weights;e&&e.aggregationBuffer&&e.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(t)}updateShaders(t){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(t)}updateAggregationState(t){to.log.assert(!1)}allocateResources(t,e){if(this.state.numRow!==t||this.state.numCol!==e){let o=e*t*4*4,{weights:i}=this.state;for(let r in i){let s=i[r];s.aggregationBuffer&&s.aggregationBuffer.delete(),s.aggregationBuffer=this.context.device.createBuffer({byteLength:o,accessor:{size:4,type:5126,divisor:1}})}}}updateResults({aggregationData:t,maxMinData:e,maxData:o,minData:i}){let{count:r}=this.state.weights;r&&(r.aggregationData=t,r.maxMinData=e,r.maxData=o,r.minData=i)}_updateAggregation(t){let{cpuGridAggregator:e,gpuGridAggregator:o,gridOffset:i,posOffset:r,translation:s=[0,0],scaling:a=[0,0,0],boundingBox:l,projectPoints:c,gpuAggregation:g,numCol:f,numRow:d}=this.state,{props:p}=t,{viewport:x}=this.context,h=this.getAttributes(),A=this.getNumInstances();if(g){let{weights:S}=this.state;o.run({weights:S,cellSize:[i.xOffset,i.yOffset],numCol:f,numRow:d,translation:s,scaling:a,vertexCount:A,projectPoints:c,attributes:h,moduleSettings:this.getModuleSettings()})}else{let S=e(p,{gridOffset:i,projectPoints:c,attributes:h,viewport:x,posOffset:r,boundingBox:l});this.setState({layerData:S})}}_updateWeightBins(){let{getValue:t}=this.state,e=new F(this.state.layerData.data||[],{getValue:t});this.setState({sortedBins:e})}_uploadAggregationResults(){let{numCol:t,numRow:e}=this.state,{data:o}=this.state.layerData,{aggregatedBins:i,minValue:r,maxValue:s,totalCount:a}=this.state.sortedBins,l=4,c=t*e*l,g=new Float32Array(c).fill(0);for(let x of i){let{lonIdx:h,latIdx:A}=o[x.i],{value:S,counts:y}=x,_=(h+A*t)*l;g[_]=S,g[_+l-1]=y}let f=new Float32Array([s,0,0,r]),d=new Float32Array([s,0,0,a]),p=new Float32Array([r,0,0,a]);this.updateResults({aggregationData:g,maxMinData:f,maxData:d,minData:p})}},w=re;(()=>{re.layerName="GridAggregationLayer"})();var or={...tt.defaultProps,getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},eo="positions",ir={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Rt=class extends w{initializeState(){super.initializeAggregationLayer({dimensions:ir,getCellSize:o=>o.cellSizePixels});let t={count:{size:1,operation:T.SUM,needMax:!0,maxTexture:Z(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({[eo]:{size:3,accessor:"getPosition",type:"float64",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:e,numCol:o,weights:i}=this.state,{updateTriggers:r}=this.props,{aggregationBuffer:s}=i.count,a=this.getSubLayerClass("cells",tt);return new a(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:r}),{data:{attributes:{instanceCounts:s}},maxTexture:t,numInstances:e*o})}finalizeState(t){super.finalizeState(t);let{aggregationBuffer:e,maxBuffer:o,maxTexture:i}=this.state;e?.delete(),o?.delete(),i?.delete()}getPickingInfo({info:t}){let{index:e}=t;if(e>=0){let{gpuGridAggregator:o,gpuAggregation:i,weights:r}=this.state,s=i?o.getData("count"):r.count;t.object=C.getAggregationData({pixelIndex:e,...s})}return t}updateResults({aggregationData:t,maxData:e}){let{count:o}=this.state.weights;o.aggregationData=t,o.aggregationBuffer.write(t),o.maxData=e,o.maxTexture.setImageData({data:e})}updateAggregationState(t){let e=t.props.cellSizePixels,o=t.oldProps.cellSizePixels!==e,{viewportChanged:i}=t.changeFlags,r=t.props.gpuAggregation;this.state.gpuAggregation!==t.props.gpuAggregation&&r&&!C.isSupported(this.context.device)&&(oo.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),r=!1);let s=r!==this.state.gpuAggregation;this.setState({gpuAggregation:r});let a=this.isAttributeChanged(eo),{dimensions:l}=this.state,{data:c,weights:g}=l,f=a||s||i||this.isAggregationDirty(t,{compareAll:r,dimension:c}),d=this.isAggregationDirty(t,{dimension:g});this.setState({aggregationDataDirty:f,aggregationWeightsDirty:d});let{viewport:p}=this.context;if(i||o){let{width:x,height:h}=p,A=Math.ceil(x/e),S=Math.ceil(h/e);this.allocateResources(S,A),this.setState({scaling:[x/2,-h/2,1],gridOffset:{xOffset:e,yOffset:e},width:x,height:h,numCol:A,numRow:S})}d&&this._updateAccessors(t),(f||d)&&this._resetResults()}_updateAccessors(t){let{getWeight:e,aggregation:o,data:i}=t.props,{count:r}=this.state.weights;r&&(r.getWeight=e,r.operation=T[o]),this.setState({getValue:Q(o,e,{data:i})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}},St=Rt;(()=>{Rt.layerName="ScreenGridLayer"})(),(()=>{Rt.defaultProps=or})();var ao=M($(),1);function io(){}var ro=["getBins","getDomain","getScaleFunc"],no=[{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}],rr=n=>n.cellSize,I=class{constructor(t){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=t.getCellSize||rr,this._getAggregator=t.getAggregator,this._addDimension(t.dimensions||no)}static defaultDimensions(){return no}updateState(t,e){let{oldProps:o,props:i,changeFlags:r}=t;this.updateGetValueFuncs(o,i,r);let s=this.needsReProjectPoints(o,i,r),a=!1;return r.dataChanged||s?(this.getAggregatedData(i,e),a=!0):((this.getDimensionChanges(o,i,r)||[]).forEach(c=>typeof c=="function"&&c()),a=!0),this.setState({aggregationDirty:a}),this.state}setState(t){this.state={...this.state,...t}}setDimensionState(t,e){this.setState({dimensions:{...this.state.dimensions,[t]:{...this.state.dimensions[t],...e}}})}normalizeResult(t={}){return t.hexagons?{data:t.hexagons,...t}:t.layerData?{data:t.layerData,...t}:t}getAggregatedData(t,e){let i=this._getAggregator(t)(t,e);this.setState({layerData:this.normalizeResult(i)}),this.changeFlags={layerData:!0},this.getSortedBins(t)}updateGetValueFuncs(t,e,o){for(let i in this.dimensionUpdaters){let{value:r,weight:s,aggregation:a}=this.dimensionUpdaters[i].getBins.triggers,l=e[r.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[i].getBins,t,e,o)&&(l?l=Me(l,{data:e.data}):l=Q(e[a.prop],e[s.prop],{data:e.data})),l&&this.setDimensionState(i,{getValue:l})}}needsReProjectPoints(t,e,o){return this._getCellSize(t)!==this._getCellSize(e)||this._getAggregator(t)!==this._getAggregator(e)||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPosition)}addDimension(t){this._addDimension(t)}_addDimension(t=[]){t.forEach(e=>{let{key:o}=e;this.dimensionUpdaters[o]=this.getDimensionUpdaters(e),this.state.dimensions[o]={getValue:null,domain:null,sortedBins:null,scaleFunc:io}})}getDimensionUpdaters({key:t,accessor:e,pickingInfo:o,getBins:i,getDomain:r,getScaleFunc:s,nullValue:a}){return{key:t,accessor:e,pickingInfo:o,getBins:{updater:this.getDimensionSortedBins.bind(this),...i},getDomain:{updater:this.getDimensionValueDomain.bind(this),...r},getScaleFunc:{updater:this.getDimensionScale.bind(this),...s},attributeAccessor:this.getSubLayerDimensionAttribute(t,a)}}needUpdateDimensionStep(t,e,o,i){return Object.values(t.triggers).some(r=>r.updateTrigger?i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged[r.updateTrigger]):e[r.prop]!==o[r.prop])}getDimensionChanges(t,e,o){let i=[];for(let r in this.dimensionUpdaters){let s=ro.find(a=>this.needUpdateDimensionStep(this.dimensionUpdaters[r][a],t,e,o));s&&i.push(this.dimensionUpdaters[r][s].updater.bind(this,e,this.dimensionUpdaters[r]))}return i.length?i:null}getUpdateTriggers(t){let e=t.updateTriggers||{},o={};for(let i in this.dimensionUpdaters){let{accessor:r}=this.dimensionUpdaters[i];o[r]={},ro.forEach(s=>{Object.values(this.dimensionUpdaters[i][s].triggers).forEach(({prop:a,updateTrigger:l})=>{if(l){let c=e[l];typeof c=="object"&&!Array.isArray(c)?Object.assign(o[r],c):c!==void 0&&(o[r][a]=c)}else o[r][a]=t[a]})})}return o}getSortedBins(t){for(let e in this.dimensionUpdaters)this.getDimensionSortedBins(t,this.dimensionUpdaters[e])}getDimensionSortedBins(t,e){let{key:o}=e,{getValue:i}=this.state.dimensions[o],r=new F(this.state.layerData.data||[],{getValue:i,filterData:t._filterData});this.setDimensionState(o,{sortedBins:r}),this.getDimensionValueDomain(t,e)}getDimensionValueDomain(t,e){let{getDomain:o,key:i}=e,{triggers:{lowerPercentile:r,upperPercentile:s,scaleType:a}}=o,l=this.state.dimensions[i].sortedBins.getValueDomainByScale(t[a.prop],[t[r.prop],t[s.prop]]);this.setDimensionState(i,{valueDomain:l}),this.getDimensionScale(t,e)}getDimensionScale(t,e){let{key:o,getScaleFunc:i,getDomain:r}=e,{domain:s,range:a}=i.triggers,{scaleType:l}=r.triggers,{onSet:c}=i,g=t[a.prop],f=t[s.prop]||this.state.dimensions[o].valueDomain,p=Xe(l&&t[l.prop])(f,g);typeof c=="object"&&typeof t[c.props]=="function"&&t[c.props](p.domain()),this.setDimensionState(o,{scaleFunc:p})}getSubLayerDimensionAttribute(t,e){return o=>{let{sortedBins:i,scaleFunc:r}=this.state.dimensions[t],s=i.binMap[o.index];if(s&&s.counts===0)return e;let a=s&&s.value,l=r.domain();return a>=l[0]&&a<=l[l.length-1]?r(a):e}}getSubLayerAccessors(t){let e={};for(let o in this.dimensionUpdaters){let{accessor:i}=this.dimensionUpdaters[o];e[i]=this.getSubLayerDimensionAttribute(t,o)}return e}getPickingInfo({info:t}){let e=t.picked&&t.index>-1,o=null;if(e){let i=this.state.layerData.data[t.index],r={};for(let s in this.dimensionUpdaters){let{pickingInfo:a}=this.dimensionUpdaters[s],{sortedBins:l}=this.state.dimensions[s],c=l.binMap[i.index]&&l.binMap[i.index].value;r[a]=c}o=Object.assign(r,i,{points:i.filteredPoints||i.points})}return t.picked=Boolean(o),t.object=o,t}getAccessor(t){return this.dimensionUpdaters.hasOwnProperty(t)?this.dimensionUpdaters[t].attributeAccessor:io}};function so(){}var nr={colorDomain:null,colorRange:D,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:so,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:so,gridAggregator:it,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:n=>n.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Bt=class extends P{initializeState(){let t=new I({getAggregator:o=>o.gridAggregator,getCellSize:o=>o.cellSize});this.state={cpuAggregator:t,aggregatorState:t.state},this.getAttributeManager().add({positions:{size:3,type:"float64",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:e,cellSize:o,coverage:i,material:r,transitions:s}=this.props,{cpuAggregator:a}=this.state,l=this.getSubLayerClass("grid-cell",ao.GridCellLayer),c=this._getSublayerUpdateTriggers();return new l({cellSize:o,coverage:i,material:r,elevationScale:t,extruded:e,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:"grid-cell",updateTriggers:c}),{data:a.state.layerData.data})}},H=Bt;(()=>{Bt.layerName="CPUGridLayer"})(),(()=>{Bt.defaultProps=nr})();var uo=M(E(),1),go=M($(),1);var rt=Math.PI/3,sr=[0,rt,2*rt,3*rt,4*rt,5*rt];function ar(n){return n[0]}function lr(n){return n[1]}function ne(){var n=0,t=0,e=1,o=1,i=ar,r=lr,s,a,l;function c(f){var d={},p=[],x,h=f.length;for(x=0;x<h;++x)if(!(isNaN(S=+i.call(null,A=f[x],x,f))||isNaN(y=+r.call(null,A,x,f)))){var A,S,y,_=Math.round(y=y/l),b=Math.round(S=S/a-(_&1)/2),O=y-_;if(Math.abs(O)*3>1){var B=S-b,mt=b+(S<b?-1:1)/2,k=_+(y<_?-1:1),j=S-mt,X=y-k;B*B+O*O>j*j+X*X&&(b=mt+(_&1?1:-1)/2,_=k)}var me=b+"-"+_,ht=d[me];ht?ht.push(A):(p.push(ht=d[me]=[A]),ht.x=(b+(_&1)/2)*a,ht.y=_*l)}return p}function g(f){var d=0,p=0;return sr.map(function(x){var h=Math.sin(x)*f,A=-Math.cos(x)*f,S=h-d,y=A-p;return d=h,p=A,[S,y]})}return c.hexagon=function(f){return"m"+g(f==null?s:+f).join("l")+"z"},c.centers=function(){for(var f=[],d=Math.round(t/l),p=Math.round(n/a),x=d*l;x<o+s;x+=l,++d)for(var h=p*a+(d&1)*a/2;h<e+a/2;h+=a)f.push([h,x]);return f},c.mesh=function(){var f=g(s).slice(0,4).join("l");return c.centers().map(function(d){return"M"+d+"m"+f}).join("")},c.x=function(f){return arguments.length?(i=f,c):i},c.y=function(f){return arguments.length?(r=f,c):r},c.radius=function(f){return arguments.length?(s=+f,a=s*2*Math.sin(rt),l=s*1.5,c):s},c.size=function(f){return arguments.length?(n=t=0,e=+f[0],o=+f[1],c):[e-n,o-t]},c.extent=function(f){return arguments.length?(n=+f[0][0],t=+f[0][1],e=+f[1][0],o=+f[1][1],c):[[n,t],[e,o]]},c.radius(1)}var Ut=M(E(),1);function lo(n,t){let{data:e,radius:o}=n,{viewport:i,attributes:r}=t,s=e.length?cr(e,t):null,a=ur(o,i,s),l=[],{iterable:c,objectInfo:g}=(0,Ut.createIterable)(e),f=r.positions.value,{size:d}=r.positions.getAccessor();for(let h of c){g.index++;let A=g.index*d,S=[f[A],f[A+1]];Number.isFinite(S[0])&&Number.isFinite(S[1])?l.push({screenCoord:i.projectFlat(S),source:h,index:g.index}):Ut.log.warn("HexagonLayer: invalid position")()}return{hexagons:ne().radius(a).x(h=>h.screenCoord[0]).y(h=>h.screenCoord[1])(l).map((h,A)=>({position:i.unprojectFlat([h.x,h.y]),points:h,index:A})),radiusCommon:a}}function cr(n,t){let{attributes:e}=t,o=e.positions.value,{size:i}=e.positions.getAccessor(),r=1/0,s=1/0,a=-1/0,l=-1/0,c;for(c=0;c<i*n.length;c+=i){let g=o[c],f=o[c+1];Number.isFinite(g)&&Number.isFinite(f)&&(r=Math.min(g,r),a=Math.max(g,a),s=Math.min(f,s),l=Math.max(f,l))}return[r,s,a,l].every(Number.isFinite)?[(r+a)/2,(s+l)/2]:null}function ur(n,t,e){let{unitsPerMeter:o}=t.getDistanceScales(e);return n*o[0]}function co(){}var gr={colorDomain:null,colorRange:D,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:co,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:co,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:lo,getPosition:{type:"accessor",value:n=>n.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},Wt=class extends P{initializeState(){let t=new I({getAggregator:o=>o.hexagonAggregator,getCellSize:o=>o.radius});this.state={cpuAggregator:t,aggregatorState:t.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(t){if(super.updateState(t),t.changeFlags.propsOrDataChanged){let e=this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==e.layerData){let{hexagonVertices:o}=e.layerData||{};this.setState({vertices:o&&this.convertLatLngToMeterOffset(o)})}this.setState({aggregatorState:e})}}convertLatLngToMeterOffset(t){let{viewport:e}=this.context;if(Array.isArray(t)&&t.length===6){let o=t[0],i=t[3],r=[(o[0]+i[0])/2,(o[1]+i[1])/2],s=e.projectFlat(r),{metersPerUnit:a}=e.getDistanceScales(r);return t.map(c=>{let g=e.projectFlat(c);return[(g[0]-s[0])*a[0],(g[1]-s[1])*a[1]]})}return uo.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:e,coverage:o,material:i,transitions:r}=this.props,{aggregatorState:s,vertices:a}=this.state,l=this.getSubLayerClass("hexagon-cell",go.ColumnLayer),c=this._getSublayerUpdateTriggers(),g=a?{vertices:a,radius:1}:{radius:s.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new l({...g,diskResolution:6,elevationScale:t,extruded:e,coverage:o,material:i,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:r&&{getFillColor:r.getColorValue||r.getColorWeight,getElevation:r.getElevationValue||r.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:c}),{data:s.layerData.data})}},At=Wt;(()=>{Wt.layerName="HexagonLayer"})(),(()=>{Wt.defaultProps=gr})();var jt=M($(),1);var Uo=M(E(),1);var v=.16666666666666666,u={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},nt=[u.W,u.SW,u.S],st=[u.S,u.SE,u.E],at=[u.E,u.NE,u.N],lt=[u.NW,u.W,u.N],ct=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5]],ut=[[-v,-.5],[v,-.5],[.5,-v],[.5,v]],gt=[[.5,-v],[.5,v],[v,.5],[-v,.5]],ft=[[-.5,v],[-.5,-v],[v,.5],[-v,.5]],fo=[u.W,u.SW,u.SE,u.E],po=[u.S,u.SE,u.NE,u.N],mo=[u.NW,u.W,u.E,u.NE],ho=[u.NW,u.SW,u.S,u.N],xo=[[-.5,v],[-.5,-v],[.5,-v],[.5,v]],vo=[[-v,-.5],[v,-.5],[v,.5],[-v,.5]],fr=[u.NW,u.SW,u.SE,u.NE],So=[u.NW,u.SW,u.SE,u.E,u.N],Ao=[u.W,u.SW,u.SE,u.NE,u.N],yo=[u.NW,u.W,u.S,u.SE,u.NE],_o=[u.NW,u.SW,u.S,u.E,u.NE],bo=[u.NW,u.W,[.5,-v],[.5,v],u.N],Mo=[[-v,-.5],[v,-.5],u.E,u.NE,u.N],To=[[-.5,v],[-.5,-v],u.S,u.SE,u.E],Co=[u.W,u.SW,u.S,[v,.5],[-v,.5]],Eo=[u.NW,u.W,[-v,-.5],[v,-.5],u.N],Po=[[-.5,v],[-.5,-v],u.E,u.NE,u.N],No=[u.S,u.SE,u.E,[v,.5],[-v,.5]],Do=[u.W,u.SW,u.S,[.5,-v],[.5,v]],Oo=[u.W,u.SW,u.SE,u.E,[v,.5],[-v,.5]],Lo=[[-.5,v],[-.5,-v],u.S,u.SE,u.NE,u.N],Fo=[u.NW,u.W,[-v,-.5],[v,-.5],u.E,u.NE],wo=[u.NW,u.SW,u.S,[.5,-v],[.5,v],u.N],dt=[u.W,u.SW,u.S,u.E,u.NE,u.N],pt=[u.NW,u.W,u.S,u.SE,u.E,u.N],zt=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5],u.E,u.NE,u.N],Gt=[u.W,u.SW,u.S,[.5,-v],[.5,v],[v,.5],[-v,.5]],Ht=[u.NW,u.W,[-v,-.5],[v,-.5],[.5,-v],[.5,v],u.N],Vt=[[-.5,v],[-.5,-v],u.S,u.SE,u.E,[v,.5],[-v,.5]],Io=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5],[.5,-v],[.5,v],[v,.5],[-v,.5]],Ro={0:[],1:[[u.W,u.S]],2:[[u.S,u.E]],3:[[u.W,u.E]],4:[[u.N,u.E]],5:{0:[[u.W,u.S],[u.N,u.E]],1:[[u.W,u.N],[u.S,u.E]]},6:[[u.N,u.S]],7:[[u.W,u.N]],8:[[u.W,u.N]],9:[[u.N,u.S]],10:{0:[[u.W,u.N],[u.S,u.E]],1:[[u.W,u.S],[u.N,u.E]]},11:[[u.N,u.E]],12:[[u.W,u.E]],13:[[u.S,u.E]],14:[[u.W,u.S]],15:[]};function m(n){return parseInt(n,4)}var Bo={[m("0000")]:[],[m("2222")]:[],[m("2221")]:[nt],[m("2212")]:[st],[m("2122")]:[at],[m("1222")]:[lt],[m("0001")]:[nt],[m("0010")]:[st],[m("0100")]:[at],[m("1000")]:[lt],[m("2220")]:[ct],[m("2202")]:[ut],[m("2022")]:[gt],[m("0222")]:[ft],[m("0002")]:[ct],[m("0020")]:[ut],[m("0200")]:[gt],[m("2000")]:[ft],[m("0011")]:[fo],[m("0110")]:[po],[m("1100")]:[mo],[m("1001")]:[ho],[m("2211")]:[fo],[m("2112")]:[po],[m("1122")]:[mo],[m("1221")]:[ho],[m("2200")]:[xo],[m("2002")]:[vo],[m("0022")]:[xo],[m("0220")]:[vo],[m("1111")]:[fr],[m("1211")]:[So],[m("2111")]:[Ao],[m("1112")]:[yo],[m("1121")]:[_o],[m("1011")]:[So],[m("0111")]:[Ao],[m("1110")]:[yo],[m("1101")]:[_o],[m("1200")]:[bo],[m("0120")]:[Mo],[m("0012")]:[To],[m("2001")]:[Co],[m("1022")]:[bo],[m("2102")]:[Mo],[m("2210")]:[To],[m("0221")]:[Co],[m("1002")]:[Eo],[m("2100")]:[Po],[m("0210")]:[No],[m("0021")]:[Do],[m("1220")]:[Eo],[m("0122")]:[Po],[m("2012")]:[No],[m("2201")]:[Do],[m("0211")]:[Oo],[m("2110")]:[Lo],[m("1102")]:[Fo],[m("1021")]:[wo],[m("2011")]:[Oo],[m("0112")]:[Lo],[m("1120")]:[Fo],[m("1201")]:[wo],[m("2101")]:[dt],[m("0121")]:[dt],[m("1012")]:[pt],[m("1210")]:[pt],[m("0101")]:{0:[nt,at],1:[dt],2:[dt]},[m("1010")]:{0:[lt,st],1:[pt],2:[pt]},[m("2121")]:{0:[dt],1:[dt],2:[nt,at]},[m("1212")]:{0:[pt],1:[pt],2:[lt,st]},[m("2120")]:{0:[zt],1:[zt],2:[ct,at]},[m("2021")]:{0:[Gt],1:[Gt],2:[nt,gt]},[m("1202")]:{0:[Ht],1:[Ht],2:[lt,ut]},[m("0212")]:{0:[Vt],1:[Vt],2:[st,ft]},[m("0102")]:{0:[ct,at],1:[zt],2:[zt]},[m("0201")]:{0:[nt,gt],1:[Gt],2:[Gt]},[m("1020")]:{0:[lt,ut],1:[Ht],2:[Ht]},[m("2010")]:{0:[st,ft],1:[Vt],2:[Vt]},[m("2020")]:{0:[ft,ut],1:[Io],2:[ct,gt]},[m("0202")]:{0:[gt,ct],1:[Io],2:[ft,ut]}};var Y={ISO_LINES:1,ISO_BANDS:2},dr={zIndex:0,zOffset:.005};function yt(n,t){return Array.isArray(t)?n<t[0]?0:n<t[1]?1:2:n>=t?1:0}function Wo(n){let{cellWeights:t,x:e,y:o,width:i,height:r}=n,s=n.threshold;n.thresholdValue&&(Uo.log.deprecated("thresholdValue","threshold")(),s=n.thresholdValue);let a=e<0,l=e>=i-1,c=o<0,g=o>=r-1,f=a||l||c||g,d={},p={};a||g?p.top=0:(d.top=t[(o+1)*i+e],p.top=yt(d.top,s)),l||g?p.topRight=0:(d.topRight=t[(o+1)*i+e+1],p.topRight=yt(d.topRight,s)),l||c?p.right=0:(d.right=t[o*i+e+1],p.right=yt(d.right,s)),a||c?p.current=0:(d.current=t[o*i+e],p.current=yt(d.current,s));let{top:x,topRight:h,right:A,current:S}=p,y=-1;Number.isFinite(s)&&(y=x<<3|h<<2|A<<1|S),Array.isArray(s)&&(y=x<<6|h<<4|A<<2|S);let _=0;return f||(_=yt((d.top+d.topRight+d.right+d.current)/4,s)),{code:y,meanCode:_}}function se(n){let{gridOrigin:t,cellSize:e,x:o,y:i,code:r,meanCode:s,type:a=Y.ISO_LINES}=n,l={...dr,...n.thresholdData},c=a===Y.ISO_BANDS?Bo[r]:Ro[r];Array.isArray(c)||(c=c[s]);let g=l.zIndex*l.zOffset,f=(o+1)*e[0],d=(i+1)*e[1],p=t[0]+f,x=t[1]+d;if(a===Y.ISO_BANDS){let A=[];return c.forEach(S=>{let y=[];S.forEach(_=>{let b=p+_[0]*e[0],O=x+_[1]*e[1];y.push([b,O,g])}),A.push(y)}),A}let h=[];return c.forEach(A=>{A.forEach(S=>{let y=p+S[0]*e[0],_=x+S[1]*e[1];h.push([y,_,g])})}),h}function zo({thresholdData:n,cellWeights:t,gridSize:e,gridOrigin:o,cellSize:i}){let r=[],s=[],a=e[0],l=e[1],c=0,g=0;for(let f of n){let{contour:d}=f,{threshold:p}=d;for(let x=-1;x<a;x++)for(let h=-1;h<l;h++){let{code:A,meanCode:S}=Wo({cellWeights:t,threshold:p,x,y:h,width:a,height:l}),y={type:Y.ISO_BANDS,gridOrigin:o,cellSize:i,x,y:h,width:a,height:l,code:A,meanCode:S,thresholdData:f};if(Array.isArray(p)){y.type=Y.ISO_BANDS;let _=se(y);for(let b of _)s[g++]={vertices:b,contour:d}}else{y.type=Y.ISO_LINES;let _=se(y);for(let b=0;b<_.length;b+=2)r[c++]={start:_[b],end:_[b+1],contour:d}}}}return{contourSegments:r,contourPolygons:s}}var Vo=M(E(),1);var Go=[255,255,255,255],pr=1,mr=1,hr={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:mr}],optional:!0,compare:3},zOffset:.005},Ho="positions",xr={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},kt=class extends w{initializeState(){super.initializeAggregationLayer({dimensions:xr}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:T.SUM}}}),this.getAttributeManager().add({[Ho]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(t){super.updateState(t);let e=!1,{oldProps:o,props:i}=t,{aggregationDirty:r}=this.state;(o.contours!==i.contours||o.zOffset!==i.zOffset)&&(e=!0,this._updateThresholdData(t.props)),this.getNumInstances()>0&&(r||e)&&this._generateContours()}renderLayers(){let{contourSegments:t,contourPolygons:e}=this.state.contourData,o=this.getSubLayerClass("lines",jt.LineLayer),i=this.getSubLayerClass("bands",jt.SolidPolygonLayer),r=t&&t.length>0&&new o(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:a=>a.start,getTargetPosition:a=>a.end,getColor:a=>a.contour.color||Go,getWidth:a=>a.contour.strokeWidth||pr}),s=e&&e.length>0&&new i(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:a=>a.vertices,getFillColor:a=>a.contour.color||Go});return[r,s]}updateAggregationState(t){let{props:e,oldProps:o}=t,{cellSize:i,coordinateSystem:r}=e,{viewport:s}=this.context,a=o.cellSize!==i,l=e.gpuAggregation;this.state.gpuAggregation!==e.gpuAggregation&&l&&!C.isSupported(this.context.device)&&(Vo.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),l=!1);let c=l!==this.state.gpuAggregation;this.setState({gpuAggregation:l});let{dimensions:g}=this.state,f=this.isAttributeChanged(Ho),{data:d,weights:p}=g,{boundingBox:x}=this.state;if(f&&(x=wt(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:x})),f||a){let{gridOffset:S,translation:y,width:_,height:b,numCol:O,numRow:B}=It(x,i,s,r);this.allocateResources(B,O),this.setState({gridOffset:S,boundingBox:x,translation:y,posOffset:y.slice(),gridOrigin:[-1*y[0],-1*y[1]],width:_,height:b,numCol:O,numRow:B})}let h=f||c||this.isAggregationDirty(t,{dimension:d,compareAll:l}),A=this.isAggregationDirty(t,{dimension:p});A&&this._updateAccessors(t),(h||A)&&this._resetResults(),this.setState({aggregationDataDirty:h,aggregationWeightsDirty:A})}_updateAccessors(t){let{getWeight:e,aggregation:o,data:i}=t.props,{count:r}=this.state.weights;r&&(r.getWeight=e,r.operation=T[o]),this.setState({getValue:Q(o,e,{data:i})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}_generateContours(){let{numCol:t,numRow:e,gridOrigin:o,gridOffset:i,thresholdData:r}=this.state,{count:s}=this.state.weights,{aggregationData:a}=s;a||(a=s.aggregationBuffer.readSyncWebGL(),s.aggregationData=a);let{cellWeights:l}=C.getCellData({countsData:a}),c=zo({thresholdData:r,cellWeights:l,gridSize:[t,e],gridOrigin:o,cellSize:[i.xOffset,i.yOffset]});this.setState({contourData:c})}_updateThresholdData(t){let{contours:e,zOffset:o}=t,i=e.length,r=new Array(i);for(let s=0;s<i;s++){let a=e[s];r[s]={contour:a,zIndex:a.zIndex||s,zOffset:o}}this.setState({thresholdData:r})}},_t=kt;(()=>{kt.layerName="ContourLayer"})(),(()=>{kt.defaultProps=hr})();var Ko=M(E(),1);var $o=M(E(),1);var N=M(E(),1),Xo=M(q(),1);var qo=M(q(),1);var ko=`#version 300 es
523
300
  #define SHADER_NAME gpu-grid-cell-layer-vertex-shader
524
301
  #define RANGE_COUNT 6
525
-
526
302
  in vec3 positions;
527
303
  in vec3 normals;
528
-
529
304
  in vec4 colors;
530
305
  in vec4 elevations;
531
306
  in vec3 instancePickingColors;
@@ -535,7 +310,6 @@ uniform float cellSize;
535
310
  uniform float coverage;
536
311
  uniform float opacity;
537
312
  uniform float elevationScale;
538
-
539
313
  uniform ivec2 gridSize;
540
314
  uniform vec2 gridOrigin;
541
315
  uniform vec2 gridOriginLow;
@@ -547,167 +321,136 @@ uniform vec2 colorDomain;
547
321
  uniform bool colorDomainValid;
548
322
  uniform vec2 elevationDomain;
549
323
  uniform bool elevationDomainValid;
550
-
551
324
  layout(std140) uniform;
552
325
  uniform ColorData
553
326
  {
554
- vec4 maxMinCount;
327
+ vec4 maxMinCount;
555
328
  } colorData;
556
329
  uniform ElevationData
557
330
  {
558
- vec4 maxMinCount;
331
+ vec4 maxMinCount;
559
332
  } elevationData;
560
-
561
333
  #define EPSILON 0.00001
562
334
  out vec4 vColor;
563
-
564
335
  vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
565
- vec4 outColor = vec4(0., 0., 0., 0.);
566
- if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
567
- float domainRange = domain.y - domain.x;
568
- if (domainRange <= 0.) {
569
- outColor = colorRange[0];
570
- } else {
571
- float rangeCount = float(RANGE_COUNT);
572
- float rangeStep = domainRange / rangeCount;
573
- float idx = floor((value - domain.x) / rangeStep);
574
- idx = clamp(idx, 0., rangeCount - 1.);
575
- int intIdx = int(idx);
576
- outColor = colorRange[intIdx];
577
- }
578
- }
579
- return outColor;
580
- }
581
-
336
+ vec4 outColor = vec4(0., 0., 0., 0.);
337
+ if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
338
+ float domainRange = domain.y - domain.x;
339
+ if (domainRange <= 0.) {
340
+ outColor = colorRange[0];
341
+ } else {
342
+ float rangeCount = float(RANGE_COUNT);
343
+ float rangeStep = domainRange / rangeCount;
344
+ float idx = floor((value - domain.x) / rangeStep);
345
+ idx = clamp(idx, 0., rangeCount - 1.);
346
+ int intIdx = int(idx);
347
+ outColor = colorRange[intIdx];
348
+ }
349
+ }
350
+ return outColor;
351
+ }
582
352
  float linearScale(vec2 domain, vec2 range, float value) {
583
- if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
584
- return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
585
- }
586
- return -1.;
353
+ if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
354
+ return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
355
+ }
356
+ return -1.;
587
357
  }
588
-
589
358
  void main(void) {
590
- vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
591
- vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
592
-
593
- float elevation = 0.0;
594
-
595
- if (extruded) {
596
- vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
597
- elevation = linearScale(elvDomain, elevationRange, elevations.r);
598
- elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
599
- }
600
- float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
601
- float dotRadius = cellSize / 2. * coverage * shouldRender;
602
-
603
- int yIndex = (gl_InstanceID / gridSize[0]);
604
- int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
605
-
606
- vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
607
- instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
608
- vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
609
- instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
610
-
611
- vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
612
- vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
613
- geometry.worldPosition = centroidPosition;
614
- vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
615
- picking_setPickingColor(instancePickingColors);
616
-
617
- gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
618
-
619
- vec3 normals_commonspace = project_normal(normals);
620
-
621
- if (extruded) {
622
- vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
623
- vColor = vec4(lightColor, color.a * opacity) / 255.;
624
- } else {
625
- vColor = vec4(color.rgb, color.a * opacity) / 255.;
626
- }
627
- }
628
- `;var Df=`#version 300 es
359
+ vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
360
+ vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
361
+ float elevation = 0.0;
362
+ if (extruded) {
363
+ vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
364
+ elevation = linearScale(elvDomain, elevationRange, elevations.r);
365
+ elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
366
+ }
367
+ float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
368
+ float dotRadius = cellSize / 2. * coverage * shouldRender;
369
+ int yIndex = (gl_InstanceID / gridSize[0]);
370
+ int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
371
+ vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
372
+ instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
373
+ vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
374
+ instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
375
+ vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
376
+ vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
377
+ geometry.worldPosition = centroidPosition;
378
+ vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
379
+ picking_setPickingColor(instancePickingColors);
380
+ gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
381
+ vec3 normals_commonspace = project_normal(normals);
382
+ if (extruded) {
383
+ vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
384
+ vColor = vec4(lightColor, color.a * opacity) / 255.;
385
+ } else {
386
+ vColor = vec4(color.rgb, color.a * opacity) / 255.;
387
+ }
388
+ }
389
+ `;var jo=`#version 300 es
629
390
  #define SHADER_NAME gpu-grid-cell-layer-fragment-shader
630
-
631
391
  precision highp float;
632
-
633
392
  in vec4 vColor;
634
-
635
393
  out vec4 fragColor;
636
-
637
394
  void main(void) {
638
- fragColor = vColor;
639
- fragColor = picking_filterColor(fragColor);
395
+ fragColor = vColor;
396
+ fragColor = picking_filterColor(fragColor);
640
397
  }
641
- `;function Tn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Tn=function(r){return typeof r}:Tn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Tn(e)}function Ff(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 wf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ff(Object(r),!0).forEach(function(n){uh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ff(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ch(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t,r){return typeof Reflect<"u"&&Reflect.get?vn=Reflect.get:vn=function(i,o,a){var s=dh(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},vn(e,t,r||e)}function dh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Vt(e),e!==null););return e}function gh(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&&Ci(e,t)}function Ci(e,t){return Ci=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ci(e,t)}function hh(e){var t=Ah();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 _h(this,i)}}function _h(e,t){if(t&&(Tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ph(e)}function ph(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ah(){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 xi=0,Oi=1,Th={colorDomain:null,colorRange:ae,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},mn=function(e){gh(r,e);var t=hh(r);function r(){var i;ch(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return vn(Vt(r.prototype),"getShaders",this).call(this,{vs:Mf,fs:Df,modules:[ie.project32,ie.gouraudLighting,ie.picking,ot]})},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var a=this._getModel();this._setupUniformBuffer(a),this.setState({model:a})},n._getModel=function(){return new Y(this.context.device,wf(wf({},this.getShaders()),{},{id:this.props.id,geometry:new Kt,isInstanced:!0}))},n.draw=function(o){var a=o.uniforms,s=this.props,f=s.cellSize,l=s.offset,u=s.extruded,c=s.elevationScale,d=s.coverage,g=s.gridSize,h=s.gridOrigin,A=s.gridOffset,_=s.elevationRange,v=s.colorMaxMinBuffer,T=s.elevationMaxMinBuffer,m=this.state.model,E=[(0,ie.fp64LowPart)(h[0]),(0,ie.fp64LowPart)(h[1])],O=[(0,ie.fp64LowPart)(A[0]),(0,ie.fp64LowPart)(A[1])],C=this.getDomainUniforms(),N=He(this.props.colorRange);this.bindUniformBuffers(v,T),m.setUniforms(a),m.setUniforms(C),m.setUniforms({cellSize:f,offset:l,extruded:u,elevationScale:c,coverage:d,gridSize:g,gridOrigin:h,gridOriginLow:E,gridOffset:A,gridOffsetLow:O,colorRange:N,elevationRange:_}),m.draw(this.context.renderPass),this.unbindUniformBuffers(v,T)},n.bindUniformBuffers=function(o,a){o.bind({target:35345,index:xi}),a.bind({target:35345,index:Oi})},n.unbindUniformBuffers=function(o,a){o.unbind({target:35345,index:xi}),a.unbind({target:35345,index:Oi})},n.getDomainUniforms=function(){var o=this.props,a=o.colorDomain,s=o.elevationDomain,f={};return a!==null?(f.colorDomainValid=!0,f.colorDomain=a):f.colorDomainValid=!1,s!==null?(f.elevationDomainValid=!0,f.elevationDomain=s):f.elevationDomainValid=!1,f},n._setupUniformBuffer=function(o){var a=o.pipeline.handle,s=this.context.gl,f=s.getUniformBlockIndex(a,"ColorData"),l=s.getUniformBlockIndex(a,"ElevationData");s.uniformBlockBinding(a,f,xi),s.uniformBlockBinding(a,l,Oi)},r}(ie.Layer);mn.layerName="GPUGridCellLayer";mn.defaultProps=Th;function bn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bn=function(r){return typeof r}:bn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bn(e)}function Bf(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 Uf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bf(Object(r),!0).forEach(function(n){Sn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Xt=Reflect.get:Xt=function(i,o,a){var s=mh(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},Xt(e,t,r||e)}function mh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=ze(e),e!==null););return e}function bh(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&&Pi(e,t)}function Pi(e,t){return Pi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Pi(e,t)}function Sh(e){var t=Eh();return function(){var n=ze(e),i;if(t){var o=ze(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Rh(this,i)}}function Rh(e,t){if(t&&(bn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yh(e)}function yh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Eh(){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 ze(e){return ze=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ze(e)}var xh={colorDomain:null,colorRange:ae,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},Oh={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},Wf="positions",tt=function(e){bh(r,e);var t=Sh(r);function r(){var i;vh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(o){var a,s=o.device,f=ee.isSupported(s);f||Hf.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),Xt(ze(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Oh}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:f,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:s.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:s.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var l=this.getAttributeManager();l.add((a={},Sn(a,Wf,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),Sn(a,"color",{size:3,accessor:"getColorWeight"}),Sn(a,"elevation",{size:3,accessor:"getElevationWeight"}),a))},n.updateState=function(o){if(this.state.isSupported!==!1){Xt(ze(r.prototype),"updateState",this).call(this,o);var a=this.state.aggregationDirty;a&&this.setState({gridHash:null})}},n.getHashKeyForIndex=function(o){var a=this.state,s=a.numRow,f=a.numCol,l=a.boundingBox,u=a.gridOffset,c=[f,s],d=[l.xMin,l.yMin],g=[u.xOffset,u.yOffset],h=Math.floor(o/c[0]),A=o-h*c[0],_=Math.floor((h*g[1]+d[1]+90+g[1]/2)/g[1]),v=Math.floor((A*g[0]+d[0]+180+g[0]/2)/g[0]);return"".concat(_,"-").concat(v)},n.getPositionForIndex=function(o){var a=this.state,s=a.numRow,f=a.numCol,l=a.boundingBox,u=a.gridOffset,c=[f,s],d=[l.xMin,l.yMin],g=[u.xOffset,u.yOffset],h=Math.floor(o/c[0]),A=o-h*c[0],_=h*g[1]+d[1],v=A*g[0]+d[0];return[v,_]},n.getPickingInfo=function(o){var a=o.info,s=o.mode,f=a.index,l=null;if(f>=0){var u=this.state.gpuGridAggregator,c=this.getPositionForIndex(f),d=ee.getAggregationData(Uf({pixelIndex:f},u.getData("color"))),g=ee.getAggregationData(Uf({pixelIndex:f},u.getData("elevation")));if(l={colorValue:d.cellWeight,elevationValue:g.cellWeight,count:d.cellCount||g.cellCount,position:c,totalCount:d.totalCount||g.totalCount},s!=="hover"){var h=this.props,A=this.state.gridHash;if(!A){var _=this.state,v=_.gridOffset,T=_.translation,m=_.boundingBox,E=this.context.viewport,O=this.getAttributes(),C=Rt(h,{gridOffset:v,attributes:O,viewport:E,translation:T,boundingBox:m});A=C.gridHash,this.setState({gridHash:A})}var N=this.getHashKeyForIndex(f),I=A[N];Object.assign(l,I)}}return a.picked=Boolean(l),a.object=l,a},n.renderLayers=function(){if(!this.state.isSupported)return null;var o=this.props,a=o.elevationScale,s=o.extruded,f=o.cellSize,l=o.coverage,u=o.material,c=o.elevationRange,d=o.colorDomain,g=o.elevationDomain,h=this.state,A=h.weights,_=h.numRow,v=h.numCol,T=h.gridOrigin,m=h.gridOffset,E=A.color,O=A.elevation,C=He(this.props.colorRange),N=this.getSubLayerClass("gpu-grid-cell",mn);return new N({gridSize:[v,_],gridOrigin:T,gridOffset:[m.xOffset,m.yOffset],colorRange:C,elevationRange:c,colorDomain:d,elevationDomain:g,cellSize:f,coverage:l,material:u,elevationScale:a,extruded:s},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:E.aggregationBuffer,elevations:O.aggregationBuffer}},colorMaxMinBuffer:E.maxMinBuffer,elevationMaxMinBuffer:O.maxMinBuffer,numInstances:v*_})},n.finalizeState=function(o){var a=this.state.weights,s=a.color,f=a.elevation;[s,f].forEach(function(l){var u=l.aggregationBuffer,c=l.maxMinBuffer;c?.destroy(),u?.destroy()}),Xt(ze(r.prototype),"finalizeState",this).call(this,o)},n.updateAggregationState=function(o){var a=o.props,s=o.oldProps,f=a.cellSize,l=a.coordinateSystem,u=this.context.viewport,c=s.cellSize!==f,d=this.state.dimensions,g=this.isAttributeChanged(Wf),h=g||this.isAttributeChanged(),A=this.state.boundingBox;if(g&&(A=Gr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:A})),g||c){var _=en(A,f,u,l),v=_.gridOffset,T=_.translation,m=_.width,E=_.height,O=_.numCol,C=_.numRow;this.allocateResources(C,O),this.setState({gridOffset:v,translation:T,gridOrigin:[-1*T[0],-1*T[1]],width:m,height:E,numCol:O,numRow:C})}var N=h||this.isAggregationDirty(o,{dimension:d.data,compareAll:!0});N&&this._updateAccessors(o),this.setState({aggregationDataDirty:N})},n._updateAccessors=function(o){var a=o.props,s=a.colorAggregation,f=a.elevationAggregation,l=this.state.weights,u=l.color,c=l.elevation;u.operation=w[s],c.operation=w[f]},r}(Qe);tt.layerName="GPUGridLayer";tt.defaultProps=xh;function Rn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Rn=function(r){return typeof r}:Rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Rn(e)}function Ch(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ph(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&&Ii(e,t)}function Ii(e,t){return Ii=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ii(e,t)}function Nh(e){var t=Dh();return function(){var n=yn(e),i;if(t){var o=yn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ih(this,i)}}function Ih(e,t){if(t&&(Rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Mh(e)}function Mh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dh(){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 yn(e){return yn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},yn(e)}function Vf(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 Ni(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vf(Object(r),!0).forEach(function(n){Fh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vf(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}var wh=Ni(Ni(Ni({},tt.defaultProps),Je.defaultProps),{},{gpuAggregation:!1}),En=function(e){Ph(r,e);var t=Nh(r);function r(){var i;Ch(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){this.state={useGPUAggregation:!1}},n.updateState=function(o){var a=o.props;this.setState({useGPUAggregation:!1})},n.renderLayers=function(){var o=this.props,a=o.data,s=o.updateTriggers,f=this.state.useGPUAggregation?"GPU":"CPU",l=this.state.useGPUAggregation?this.getSubLayerClass("GPU",tt):this.getSubLayerClass("CPU",Je);return new l(this.props,this.getSubLayerProps({id:f,updateTriggers:s}),{data:a})},n.canUseGPUAggregation=function(o){var a=o.gpuAggregation,s=o.lowerPercentile,f=o.upperPercentile,l=o.getColorValue,u=o.getElevationValue,c=o.colorScaleType;return!(!a||!ee.isSupported(this.context.device)||s!==0||f!==100||l!==null||u!==null||c==="quantile"||c==="ordinal")},r}(Xf.CompositeLayer);En.layerName="GridLayer";En.defaultProps=wh;function jf(e,t){return Wh(e)||Uh(e,t)||kf(e,t)||Bh()}function Bh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
642
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uh(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(f){o=!0,s=f}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function Wh(e){if(Array.isArray(e))return e}function Hh(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=kf(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(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
643
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){a=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function kf(e,t){if(e){if(typeof e=="string")return Lf(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 Lf(e,t)}}function Lf(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 $f(e){var t=e.map(function(s){return s[0]}),r=e.map(function(s){return s[1]}),n=Math.min.apply(null,t),i=Math.max.apply(null,t),o=Math.min.apply(null,r),a=Math.max.apply(null,r);return[n,o,i,a]}function Kf(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var zf=new Float32Array(12);function Mi(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=0,n=Hh(e),i;try{for(n.s();!(i=n.n()).done;)for(var o=i.value,a=0;a<t;a++)zf[r++]=o[a]||0}catch(s){n.e(s)}finally{n.f()}return zf}function Yf(e,t,r){var n=jf(e,4),i=n[0],o=n[1],a=n[2],s=n[3],f=a-i,l=s-o,u=f,c=l;f/l<t/r?u=t/r*l:c=r/t*f,u<t&&(u=t,c=r);var d=(a+i)/2,g=(s+o)/2;return[d-u/2,g-c/2,d+u/2,g+c/2]}function Zf(e,t){var r=jf(t,4),n=r[0],i=r[1],o=r[2],a=r[3];return[(e[0]-n)/(o-n),(e[1]-i)/(a-i)]}function qf(e){var t=e.device,r=e.floatTargetSupport;return r?{format:t.info.type==="webgl2"?34836:6408,type:5126}:{format:6408,type:5121}}var be=P($());var Pn=P($());var Qf=`#version 300 es
398
+ `;var ae=0,le=1,vr={colorDomain:null,colorRange:D,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},Xt=class extends N.Layer{getShaders(){return super.getShaders({vs:ko,fs:jo,modules:[N.project32,N.gouraudLighting,N.picking,K]})}initializeState(){this.getAttributeManager().addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});let e=this._getModel();this._setupUniformBuffer(e),this.setState({model:e})}_getModel(){return new qo.Model(this.context.device,{...this.getShaders(),id:this.props.id,geometry:new Xo.CubeGeometry,isInstanced:!0})}draw({uniforms:t}){let{cellSize:e,offset:o,extruded:i,elevationScale:r,coverage:s,gridSize:a,gridOrigin:l,gridOffset:c,elevationRange:g,colorMaxMinBuffer:f,elevationMaxMinBuffer:d}=this.props,p=this.state.model,x=[(0,N.fp64LowPart)(l[0]),(0,N.fp64LowPart)(l[1])],h=[(0,N.fp64LowPart)(c[0]),(0,N.fp64LowPart)(c[1])],A=this.getDomainUniforms(),S=z(this.props.colorRange);this.bindUniformBuffers(f,d),p.setUniforms(t),p.setUniforms(A),p.setUniforms({cellSize:e,offset:o,extruded:i,elevationScale:r,coverage:s,gridSize:a,gridOrigin:l,gridOriginLow:x,gridOffset:c,gridOffsetLow:h,colorRange:S,elevationRange:g}),p.draw(this.context.renderPass),this.unbindUniformBuffers(f,d)}bindUniformBuffers(t,e){t.bind({target:35345,index:ae}),e.bind({target:35345,index:le})}unbindUniformBuffers(t,e){t.unbind({target:35345,index:ae}),e.unbind({target:35345,index:le})}getDomainUniforms(){let{colorDomain:t,elevationDomain:e}=this.props,o={};return t!==null?(o.colorDomainValid=!0,o.colorDomain=t):o.colorDomainValid=!1,e!==null?(o.elevationDomainValid=!0,o.elevationDomain=e):o.elevationDomainValid=!1,o}_setupUniformBuffer(t){let e=t.pipeline.handle,o=this.context.gl,i=o.getUniformBlockIndex(e,"ColorData"),r=o.getUniformBlockIndex(e,"ElevationData");o.uniformBlockBinding(e,i,ae),o.uniformBlockBinding(e,r,le)}},bt=Xt;(()=>{Xt.layerName="GPUGridCellLayer"})(),(()=>{Xt.defaultProps=vr})();var Sr={colorDomain:null,colorRange:D,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:n=>n.position},extruded:!1,material:!0},Ar={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},Yo="positions",qt=class extends w{initializeState({device:t}){let e=C.isSupported(t);e||$o.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),super.initializeAggregationLayer({dimensions:Ar}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:e,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:t.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:t.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"}),this.getAttributeManager().add({[Yo]:{size:3,accessor:"getPosition",type:"float64",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:e}=this.state;e&&this.setState({gridHash:null})}getHashKeyForIndex(t){let{numRow:e,numCol:o,boundingBox:i,gridOffset:r}=this.state,s=[o,e],a=[i.xMin,i.yMin],l=[r.xOffset,r.yOffset],c=Math.floor(t/s[0]),g=t-c*s[0],f=Math.floor((c*l[1]+a[1]+90+l[1]/2)/l[1]),d=Math.floor((g*l[0]+a[0]+180+l[0]/2)/l[0]);return`${f}-${d}`}getPositionForIndex(t){let{numRow:e,numCol:o,boundingBox:i,gridOffset:r}=this.state,s=[o,e],a=[i.xMin,i.yMin],l=[r.xOffset,r.yOffset],c=Math.floor(t/s[0]),g=t-c*s[0],f=c*l[1]+a[1];return[g*l[0]+a[0],f]}getPickingInfo({info:t,mode:e}){let{index:o}=t,i=null;if(o>=0){let r=this.state.gpuGridAggregator,s=this.getPositionForIndex(o),a=C.getAggregationData({pixelIndex:o,...r.getData("color")}),l=C.getAggregationData({pixelIndex:o,...r.getData("elevation")});if(i={colorValue:a.cellWeight,elevationValue:l.cellWeight,count:a.cellCount||l.cellCount,position:s,totalCount:a.totalCount||l.totalCount},e!=="hover"){let{props:c}=this,{gridHash:g}=this.state;if(!g){let{gridOffset:p,translation:x,boundingBox:h}=this.state,{viewport:A}=this.context,S=this.getAttributes();g=it(c,{gridOffset:p,attributes:S,viewport:A,translation:x,boundingBox:h}).gridHash,this.setState({gridHash:g})}let f=this.getHashKeyForIndex(o),d=g[f];Object.assign(i,d)}}return t.picked=Boolean(i),t.object=i,t}renderLayers(){if(!this.state.isSupported)return null;let{elevationScale:t,extruded:e,cellSize:o,coverage:i,material:r,elevationRange:s,colorDomain:a,elevationDomain:l}=this.props,{weights:c,numRow:g,numCol:f,gridOrigin:d,gridOffset:p}=this.state,{color:x,elevation:h}=c,A=z(this.props.colorRange),S=this.getSubLayerClass("gpu-grid-cell",bt);return new S({gridSize:[f,g],gridOrigin:d,gridOffset:[p.xOffset,p.yOffset],colorRange:A,elevationRange:s,colorDomain:a,elevationDomain:l,cellSize:o,coverage:i,material:r,elevationScale:t,extruded:e},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:x.aggregationBuffer,elevations:h.aggregationBuffer}},colorMaxMinBuffer:x.maxMinBuffer,elevationMaxMinBuffer:h.maxMinBuffer,numInstances:f*g})}finalizeState(t){let{color:e,elevation:o}=this.state.weights;[e,o].forEach(i=>{let{aggregationBuffer:r,maxMinBuffer:s}=i;s?.destroy(),r?.destroy()}),super.finalizeState(t)}updateAggregationState(t){let{props:e,oldProps:o}=t,{cellSize:i,coordinateSystem:r}=e,{viewport:s}=this.context,a=o.cellSize!==i,{dimensions:l}=this.state,c=this.isAttributeChanged(Yo),g=c||this.isAttributeChanged(),{boundingBox:f}=this.state;if(c&&(f=wt(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:f})),c||a){let{gridOffset:p,translation:x,width:h,height:A,numCol:S,numRow:y}=It(f,i,s,r);this.allocateResources(y,S),this.setState({gridOffset:p,translation:x,gridOrigin:[-1*x[0],-1*x[1]],width:h,height:A,numCol:S,numRow:y})}let d=g||this.isAggregationDirty(t,{dimension:l.data,compareAll:!0});d&&this._updateAccessors(t),this.setState({aggregationDataDirty:d})}_updateAccessors(t){let{colorAggregation:e,elevationAggregation:o}=t.props,{color:i,elevation:r}=this.state.weights;i.operation=T[e],r.operation=T[o]}},V=qt;(()=>{qt.layerName="GPUGridLayer"})(),(()=>{qt.defaultProps=Sr})();var yr={...V.defaultProps,...H.defaultProps,gpuAggregation:!1},Yt=class extends Ko.CompositeLayer{initializeState(){this.state={useGPUAggregation:!1}}updateState({props:t}){this.setState({useGPUAggregation:!1})}renderLayers(){let{data:t,updateTriggers:e}=this.props,o=this.state.useGPUAggregation?"GPU":"CPU",i=this.state.useGPUAggregation?this.getSubLayerClass("GPU",V):this.getSubLayerClass("CPU",H);return new i(this.props,this.getSubLayerProps({id:o,updateTriggers:e}),{data:t})}canUseGPUAggregation(t){let{gpuAggregation:e,lowerPercentile:o,upperPercentile:i,getColorValue:r,getElevationValue:s,colorScaleType:a}=t;return!(!e||!C.isSupported(this.context.device)||o!==0||i!==100||r!==null||s!==null||a==="quantile"||a==="ordinal")}},Mt=Yt;(()=>{Yt.layerName="GridLayer"})(),(()=>{Yt.defaultProps=yr})();function Zo(n){let t=n.map(a=>a[0]),e=n.map(a=>a[1]),o=Math.min.apply(null,t),i=Math.max.apply(null,t),r=Math.min.apply(null,e),s=Math.max.apply(null,e);return[o,r,i,s]}function Jo(n,t){return t[0]>=n[0]&&t[2]<=n[2]&&t[1]>=n[1]&&t[3]<=n[3]}var Qo=new Float32Array(12);function ce(n,t=2){let e=0;for(let o of n)for(let i=0;i<t;i++)Qo[e++]=o[i]||0;return Qo}function ti(n,t,e){let[o,i,r,s]=n,a=r-o,l=s-i,c=a,g=l;a/l<t/e?c=t/e*l:g=e/t*a,c<t&&(c=t,g=e);let f=(r+o)/2,d=(s+i)/2;return[f-c/2,d-g/2,f+c/2,d+g/2]}function ei(n,t){let[e,o,i,r]=t;return[(n[0]-e)/(i-e),(n[1]-o)/(r-o)]}var pe=M(q(),1),R=M(E(),1);var ri=M(q(),1),$t=M(E(),1);var oi=`#version 300 es
644
399
  #define SHADER_NAME heatp-map-layer-vertex-shader
645
-
646
400
  uniform sampler2D maxTexture;
647
401
  uniform float intensity;
648
402
  uniform vec2 colorDomain;
649
403
  uniform float threshold;
650
404
  uniform float aggregationMode;
651
-
652
405
  in vec3 positions;
653
406
  in vec2 texCoords;
654
-
655
407
  out vec2 vTexCoords;
656
408
  out float vIntensityMin;
657
409
  out float vIntensityMax;
658
-
659
410
  void main(void) {
660
- gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
661
- vTexCoords = texCoords;
662
- vec4 maxTexture = texture(maxTexture, vec2(0.5));
663
- float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
664
- float minValue = maxValue * threshold;
665
- if (colorDomain[1] > 0.) {
666
- maxValue = colorDomain[1];
667
- minValue = colorDomain[0];
668
- }
669
- vIntensityMax = intensity / maxValue;
670
- vIntensityMin = intensity / minValue;
671
- }
672
- `;var Jf=`#version 300 es
411
+ gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
412
+ vTexCoords = texCoords;
413
+ vec4 maxTexture = texture(maxTexture, vec2(0.5));
414
+ float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
415
+ float minValue = maxValue * threshold;
416
+ if (colorDomain[1] > 0.) {
417
+ maxValue = colorDomain[1];
418
+ minValue = colorDomain[0];
419
+ }
420
+ vIntensityMax = intensity / maxValue;
421
+ vIntensityMin = intensity / minValue;
422
+ }
423
+ `;var ii=`#version 300 es
673
424
  #define SHADER_NAME triangle-layer-fragment-shader
674
-
675
425
  precision highp float;
676
-
677
426
  uniform float opacity;
678
- uniform sampler2D texture;
427
+ uniform sampler2D weightsTexture;
679
428
  uniform sampler2D colorTexture;
680
429
  uniform float aggregationMode;
681
-
682
430
  in vec2 vTexCoords;
683
431
  in float vIntensityMin;
684
432
  in float vIntensityMax;
685
-
686
433
  out vec4 fragColor;
687
-
688
434
  vec4 getLinearColor(float value) {
689
- float factor = clamp(value * vIntensityMax, 0., 1.);
690
- vec4 color = texture(colorTexture, vec2(factor, 0.5));
691
- color.a *= min(value * vIntensityMin, 1.0);
692
- return color;
435
+ float factor = clamp(value * vIntensityMax, 0., 1.);
436
+ vec4 color = texture(colorTexture, vec2(factor, 0.5));
437
+ color.a *= min(value * vIntensityMin, 1.0);
438
+ return color;
693
439
  }
694
-
695
440
  void main(void) {
696
- vec4 weights = texture(texture, vTexCoords);
697
- float weight = weights.r;
698
-
699
- if (aggregationMode > 0.5) {
700
- weight /= max(1.0, weights.a);
701
- }
702
- if (weight <= 0.) {
703
- discard;
704
- }
705
-
706
- vec4 linearColor = getLinearColor(weight);
707
- linearColor.a *= opacity;
708
- fragColor = linearColor;
709
- }
710
- `;function On(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?On=function(r){return typeof r}:On=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},On(e)}function Gf(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 xn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gf(Object(r),!0).forEach(function(n){Vh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gf(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lh(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&&Di(e,t)}function Di(e,t){return Di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Di(e,t)}function zh(e){var t=$h();return function(){var n=Cn(e),i;if(t){var o=Cn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return jh(this,i)}}function jh(e,t){if(t&&(On(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kh(e)}function kh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $h(){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 Cn(e){return Cn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Cn(e)}var Fi=function(e){Lh(r,e);var t=zh(r);function r(){var i;Xh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return{vs:Qf,fs:Jf,modules:[Pn.project32]}},n.initializeState=function(o){var a=o.device,s=this.getAttributeManager();s.add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(a)})},n._getModel=function(o){var a=this.props.vertexCount;return new Y(o,xn(xn({},this.getShaders()),{},{id:this.props.id,geometry:new Re({topology:"triangle-fan-webgl",vertexCount:a})}))},n.draw=function(o){var a=o.uniforms,s=this.state.model,f=this.props,l=f.texture,u=f.maxTexture,c=f.colorTexture,d=f.intensity,g=f.threshold,h=f.aggregationMode,A=f.colorDomain;s.setUniforms(xn(xn({},a),{},{texture:l,maxTexture:u,colorTexture:c,intensity:d,threshold:g,aggregationMode:h,colorDomain:A})),s.draw(this.context.renderPass)},r}(Pn.Layer);Fi.layerName="TriangleLayer";var el=`#version 300 es
441
+ vec4 weights = texture(weightsTexture, vTexCoords);
442
+ float weight = weights.r;
443
+ if (aggregationMode > 0.5) {
444
+ weight /= max(1.0, weights.a);
445
+ }
446
+ if (weight <= 0.) {
447
+ discard;
448
+ }
449
+ vec4 linearColor = getLinearColor(weight);
450
+ linearColor.a *= opacity;
451
+ fragColor = linearColor;
452
+ }
453
+ `;var ue=class extends $t.Layer{getShaders(){return{vs:oi,fs:ii,modules:[$t.project32]}}initializeState({device:t}){this.setState({model:this._getModel(t)})}_getModel(t){let{vertexCount:e,data:o,weightsTexture:i,maxTexture:r,colorTexture:s}=this.props;return new ri.Model(t,{...this.getShaders(),id:this.props.id,bindings:{weightsTexture:i,maxTexture:r,colorTexture:s},attributes:o.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-fan-webgl",vertexCount:e})}draw({uniforms:t}){let{model:e}=this.state,{intensity:o,threshold:i,aggregationMode:r,colorDomain:s}=this.props;e.setUniforms({...t,intensity:o,threshold:i,aggregationMode:r,colorDomain:s}),e.draw(this.context.renderPass)}},Tt=ue;(()=>{ue.layerName="TriangleLayer"})();var ge=`#version 300 es
711
454
  in vec3 positions;
712
455
  in vec3 positions64Low;
713
456
  in float weights;
@@ -718,48 +461,49 @@ uniform vec4 commonBounds;
718
461
  uniform float weightsScale;
719
462
  void main()
720
463
  {
721
- weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
722
-
723
- float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
724
- gl_PointSize = radiusTexels * 2.;
725
-
726
- vec3 commonPosition = project_position(positions, positions64Low);
727
- gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
728
- gl_Position.xy = (gl_Position.xy * 2.) - (1.);
729
- }
730
- `;var tl=`#version 300 es
464
+ weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
465
+ float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
466
+ gl_PointSize = radiusTexels * 2.;
467
+ vec3 commonPosition = project_position(positions, positions64Low);
468
+ gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
469
+ gl_Position.xy = (gl_Position.xy * 2.) - (1.);
470
+ gl_Position.w = 1.0;
471
+ }
472
+ `;var fe=`#version 300 es
731
473
  in vec4 weightsTexture;
732
474
  out vec4 fragColor;
733
475
  float gaussianKDE(float u){
734
- return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
476
+ return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
735
477
  }
736
478
  void main()
737
479
  {
738
- float dist = length(gl_PointCoord - vec2(0.5, 0.5));
739
- if (dist > 0.5) {
740
- discard;
741
- }
742
- fragColor = weightsTexture * gaussianKDE(2. * dist);
743
- DECKGL_FILTER_COLOR(fragColor, geometry);
744
- }
745
- `;var rl=`#version 300 es
746
- in vec4 inTexture;
480
+ float dist = length(gl_PointCoord - vec2(0.5, 0.5));
481
+ if (dist > 0.5) {
482
+ discard;
483
+ }
484
+ fragColor = weightsTexture * gaussianKDE(2. * dist);
485
+ DECKGL_FILTER_COLOR(fragColor, geometry);
486
+ }
487
+ `;var ni=`#version 300 es
488
+ uniform sampler2D inTexture;
489
+ uniform float textureSize;
747
490
  out vec4 outTexture;
748
-
749
491
  void main()
750
492
  {
751
- outTexture = inTexture;
752
- gl_Position = vec4(0, 0, 0, 1.);
493
+ int yIndex = gl_VertexID / int(textureSize);
494
+ int xIndex = gl_VertexID - (yIndex * int(textureSize));
495
+ vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
496
+ outTexture = texture(inTexture, uv);
497
+ gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
753
498
  gl_PointSize = 1.0;
754
499
  }
755
- `;var nl=`#version 300 es
500
+ `;var si=`#version 300 es
756
501
  in vec4 outTexture;
757
502
  out vec4 fragColor;
758
503
  void main() {
759
- fragColor = outTexture;
760
- fragColor.g = outTexture.r / max(1.0, outTexture.a);
504
+ fragColor = outTexture;
505
+ fragColor.g = outTexture.r / max(1.0, outTexture.a);
761
506
  }
762
- `;function Nn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nn=function(r){return typeof r}:Nn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nn(e)}function il(e,t){return qh(e)||Zh(e,t)||Yh(e,t)||Kh()}function Kh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
763
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yh(e,t){if(e){if(typeof e=="string")return ol(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 ol(e,t)}}function ol(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 Zh(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(f){o=!0,s=f}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function qh(e){if(Array.isArray(e))return e}function al(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 Lt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?al(Object(r),!0).forEach(function(n){Qh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):al(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rt(e,t,r){return typeof Reflect<"u"&&Reflect.get?rt=Reflect.get:rt=function(i,o,a){var s=Gh(i,o);if(s){var f=Object.getOwnPropertyDescriptor(s,o);return f.get?f.get.call(a):f.value}},rt(e,t,r||e)}function Gh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ce(e),e!==null););return e}function e_(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&&Bi(e,t)}function Bi(e,t){return Bi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Bi(e,t)}function t_(e){var t=i_();return function(){var n=Ce(e),i;if(t){var o=Ce(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return r_(this,i)}}function r_(e,t){if(t&&(Nn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return n_(e)}function n_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i_(){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 Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ce(e)}var o_=2,wi={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},sl=[0,0],a_={SUM:0,MEAN:1},s_={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:ae,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}},f_=["blend-minmax-webgl1","texture-formats-float32-webgl1"],l_=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],u_={data:{props:["radiusPixels"]}},In=function(e){e_(r,e);var t=t_(r);function r(){var i;Jh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=this;if(!f_.every(function(a){return o.context.device.features.has(a)})){this.setState({supported:!1}),be.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}rt(Ce(r.prototype),"initializeAggregationLayer",this).call(this,u_),this.setState({supported:!0,colorDomain:sl}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()},n.shouldUpdateState=function(o){var a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){this.state.supported&&(rt(Ce(r.prototype),"updateState",this).call(this,o),this._updateHeatmapState(o))},n._updateHeatmapState=function(o){var a=o.props,s=o.oldProps,f=this._getChangeFlags(o);(f.dataChanged||f.viewportChanged)&&(f.boundsChanged=this._updateBounds(f.dataChanged),this._updateTextureRenderingBounds()),f.dataChanged||f.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):f.viewportZoomChanged&&this._debouncedUpdateWeightmap(),a.colorRange!==s.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,a=o.weightsTexture,s=o.triPositionBuffer,f=o.triTexCoordBuffer,l=o.maxWeightsTexture,u=o.colorTexture,c=o.colorDomain,d=this.props,g=d.updateTriggers,h=d.intensity,A=d.threshold,_=d.aggregation,v=this.getSubLayerClass("triangle",Fi);return new v(this.getSubLayerProps({id:"triangle-layer",updateTriggers:g}),{coordinateSystem:be.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:s,texCoords:f}},vertexCount:4,maxTexture:l,colorTexture:u,aggregationMode:a_[_]||0,texture:a,intensity:h,threshold:A,colorDomain:c})},n.finalizeState=function(o){rt(Ce(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.weightsTransform,f=a.weightsTexture,l=a.maxWeightTransform,u=a.maxWeightsTexture,c=a.triPositionBuffer,d=a.triTexCoordBuffer,g=a.colorTexture,h=a.updateTimer;s?.destroy(),f?.destroy(),l?.destroy(),u?.destroy(),c?.destroy(),d?.destroy(),g?.destroy(),h&&clearTimeout(h)},n._getAttributeManager=function(){return new be.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},n._getChangeFlags=function(o){var a={},s=this.state.dimensions;a.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(o,{compareAll:!0,dimension:s.data})&&"aggregation is dirty",a.viewportChanged=o.changeFlags.viewportChanged;var f=this.state.zoom;return(!o.context.viewport||o.context.viewport.zoom!==f)&&(a.viewportZoomChanged=!0),a},n._createTextures=function(){var o=this.state,a=o.textureSize,s=o.format,f=o.type;this.setState({weightsTexture:this.context.device.createTexture(Lt({width:a,height:a,format:s,type:f},wi)),maxWeightsTexture:this.context.device.createTexture(Lt({format:s,type:f},wi))})},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,a=this.props.weightsTextureSize,s=Math.min(a,o.limits.maxTextureDimension2D),f=l_.every(function(g){return o.features.has(g)}),l=qf({device:o,floatTargetSupport:f}),u=l.format,c=l.type,d=f?1:1/255;this.setState({textureSize:s,format:u,type:c,weightsScale:d}),f||be.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()},n.getShaders=function(o){return rt(Ce(r.prototype),"getShaders",this).call(this,o==="max-weights-transform"?{vs:rl,_fs:nl}:{vs:el,_fs:tl})},n._createWeightsTransform=function(){var o,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=this.state.weightsTransform;(o=s)===null||o===void 0||o.delete(),s=new Me(this.context.device,Lt({id:"".concat(this.id,"-weights-transform"),vertexCount:1,targetTexture:this.state.weightsTexture,targetTextureVarying:"weightsTexture"},a)),this.setState({weightsTransform:s})},n._setupResources=function(){this._createTextures();var o=this.state,a=o.textureSize,s=o.weightsTexture,f=o.maxWeightsTexture,l=this.getShaders("weights-transform");this._createWeightsTransform(l);var u=this.getShaders("max-weights-transform"),c=new Me(this.context.device,Lt(Lt({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:s},_targetTexture:f,_targetTextureVarying:"outTexture"},u),{},{elementCount:a*a}));this.setState({weightsTexture:s,maxWeightsTexture:f,maxWeightTransform:c,zoom:null,triPositionBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:3}}),triTexCoordBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:2}})})},n.updateShaders=function(o){this._createWeightsTransform(o)},n._updateMaxWeightValue=function(){var o=this.state.maxWeightTransform;o.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})},n._updateBounds=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.context.viewport,s=[a.unproject([0,0]),a.unproject([a.width,0]),a.unproject([a.width,a.height]),a.unproject([0,a.height])].map(function(h){return h.map(Math.fround)}),f=$f(s),l={visibleWorldBounds:f,viewportCorners:s},u=!1;if(o||!this.state.worldBounds||!Kf(this.state.worldBounds,f)){var c=this._worldToCommonBounds(f),d=this._commonToWorldBounds(c);this.props.coordinateSystem===be.COORDINATE_SYSTEM.LNGLAT&&(d[1]=Math.max(d[1],-85.051129),d[3]=Math.min(d[3],85.051129),d[0]=Math.max(d[0],-360),d[2]=Math.min(d[2],360));var g=this._worldToCommonBounds(d);l.worldBounds=d,l.normalizedCommonBounds=g,u=!0}return this.setState(l),u},n._updateTextureRenderingBounds=function(){var o=this.state,a=o.triPositionBuffer,s=o.triTexCoordBuffer,f=o.normalizedCommonBounds,l=o.viewportCorners,u=this.context.viewport;a.write(Mi(l,3));var c=l.map(function(d){return Zf(u.projectPosition(d),f)});s.write(Mi(c,2))},n._updateColorTexture=function(o){var a=o.props.colorRange,s=this.state.colorTexture,f=He(a,!1,Uint8Array);s?s.setImageData({data:f,width:a.length}):s=this.context.device.createTexture(Lt({data:f,width:a.length,height:1},wi)),this.setState({colorTexture:s})},n._updateWeightmap=function(){var o=this,a=this.props,s=a.radiusPixels,f=a.colorDomain,l=a.aggregation,u=this.state,c=u.worldBounds,d=u.textureSize,g=u.weightsScale,h=this.state.weightsTransform;this.state.isWeightMapDirty=!1;var A=this._worldToCommonBounds(c,{useLayerCoordinateSystem:!0});if(f&&l==="SUM"){var _=this.context.viewport,v=_.distanceScales.metersPerUnit[2]*(A[2]-A[0])/d;this.state.colorDomain=f.map(function(m){return m*v*g})}else this.state.colorDomain=f||sl;var T={radiusPixels:s,commonBounds:A,textureWidth:d,weightsScale:g};h.update({elementCount:this.getNumInstances()}),Q(this.context.gl,{clearColor:[0,0,0,0]},function(){h.run({uniforms:T,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:o.getAttributes(),moduleSettings:o.getModuleSettings()})}),this._updateMaxWeightValue()},n._debouncedUpdateWeightmap=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.state.updateTimer,s=this.props.debounceTimeout;o?(a=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(a),a=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),s)),this.setState({updateTimer:a})},n._worldToCommonBounds=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=a.useLayerCoordinateSystem,f=s===void 0?!1:s,l=il(o,4),u=l[0],c=l[1],d=l[2],g=l[3],h=this.context.viewport,A=this.state.textureSize,_=this.props.coordinateSystem,v=f&&(_===be.COORDINATE_SYSTEM.LNGLAT_OFFSETS||_===be.COORDINATE_SYSTEM.METER_OFFSETS),T=v?h.projectPosition(this.props.coordinateOrigin):[0,0],m=A*o_/h.scale,E,O;return f&&!v?(E=this.projectPosition([u,c,0]),O=this.projectPosition([d,g,0])):(E=h.projectPosition([u,c,0]),O=h.projectPosition([d,g,0])),Yf([E[0]-T[0],E[1]-T[1],O[0]-T[0],O[1]-T[1]],m,m)},n._commonToWorldBounds=function(o){var a=il(o,4),s=a[0],f=a[1],l=a[2],u=a[3],c=this.context.viewport,d=c.unprojectPosition([s,f]),g=c.unprojectPosition([l,u]);return d.slice(0,2).concat(g.slice(0,2))},r}(ce);In.layerName="HeatmapLayer";In.defaultProps=s_;return _l(_r);})();
507
+ `;var _r=2,de={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ai=[0,0],br={SUM:0,MEAN:1},Mr={getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:D,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}},Tr=["float32-renderable-webgl","texture-blend-float-webgl"],Cr={data:{props:["radiusPixels"]}},Kt=class extends P{initializeState(){super.initializeAggregationLayer(Cr),this.setState({colorDomain:ai}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){super.updateState(t),this._updateHeatmapState(t)}_updateHeatmapState(t){let{props:e,oldProps:o}=t,i=this._getChangeFlags(t);(i.dataChanged||i.viewportChanged)&&(i.boundsChanged=this._updateBounds(i.dataChanged),this._updateTextureRenderingBounds()),i.dataChanged||i.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):i.viewportZoomChanged&&this._debouncedUpdateWeightmap(),e.colorRange!==o.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}renderLayers(){let{weightsTexture:t,triPositionBuffer:e,triTexCoordBuffer:o,maxWeightsTexture:i,colorTexture:r,colorDomain:s}=this.state,{updateTriggers:a,intensity:l,threshold:c,aggregation:g}=this.props,f=this.getSubLayerClass("triangle",Tt);return new f(this.getSubLayerProps({id:"triangle-layer",updateTriggers:a}),{coordinateSystem:R.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:e,texCoords:o}},vertexCount:4,maxTexture:i,colorTexture:r,aggregationMode:br[g]||0,weightsTexture:t,intensity:l,threshold:c,colorDomain:s})}finalizeState(t){super.finalizeState(t);let{weightsTransform:e,weightsTexture:o,maxWeightTransform:i,maxWeightsTexture:r,triPositionBuffer:s,triTexCoordBuffer:a,colorTexture:l,updateTimer:c}=this.state;e?.destroy(),o?.destroy(),i?.destroy(),r?.destroy(),s?.destroy(),a?.destroy(),l?.destroy(),c&&clearTimeout(c)}_getAttributeManager(){return new R.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(t){let e={},{dimensions:o}=this.state;e.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(t,{compareAll:!0,dimension:o.data})&&"aggregation is dirty",e.viewportChanged=t.changeFlags.viewportChanged;let{zoom:i}=this.state;return(!t.context.viewport||t.context.viewport.zoom!==i)&&(e.viewportZoomChanged=!0),e}_createTextures(){let{textureSize:t,format:e}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...de,width:t,height:t,format:e}),maxWeightsTexture:this.context.device.createTexture({...de,width:1,height:1,format:e})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:t}=this.context,{weightsTextureSize:e}=this.props,o=Math.min(e,t.limits.maxTextureDimension2D),i=Tr.every(a=>t.features.has(a)),r=i?"rgba32float":"rgba8unorm",s=i?1:1/255;this.setState({textureSize:o,format:r,weightsScale:s}),i||R.log.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(t){let{weightsTransform:e}=this.state,{weightsTexture:o}=this.state,i=this.getAttributeManager();e?.destroy(),e=new pe.TextureTransform(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:i.getBufferLayouts(),vertexCount:1,targetTexture:o,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...t}),this.setState({weightsTransform:e})}_setupResources(){this._createTextures();let{device:t}=this.context,{textureSize:e,weightsTexture:o,maxWeightsTexture:i}=this.state,r=this.getShaders({vs:ge,fs:fe});this._createWeightsTransform(r);let s=this.getShaders({vs:ni,fs:si}),a=new pe.TextureTransform(t,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:o},uniforms:{textureSize:e},targetTexture:i,...s,vertexCount:e*e,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:o,maxWeightsTexture:i,maxWeightTransform:a,zoom:null,triPositionBuffer:t.createBuffer({byteLength:48}),triTexCoordBuffer:t.createBuffer({byteLength:48})})}updateShaders(t){this._createWeightsTransform({vs:ge,fs:fe,...t})}_updateMaxWeightValue(){let{maxWeightTransform:t}=this.state;t.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(t=!1){let{viewport:e}=this.context,o=[e.unproject([0,0]),e.unproject([e.width,0]),e.unproject([e.width,e.height]),e.unproject([0,e.height])].map(a=>a.map(Math.fround)),i=Zo(o),r={visibleWorldBounds:i,viewportCorners:o},s=!1;if(t||!this.state.worldBounds||!Jo(this.state.worldBounds,i)){let a=this._worldToCommonBounds(i),l=this._commonToWorldBounds(a);this.props.coordinateSystem===R.COORDINATE_SYSTEM.LNGLAT&&(l[1]=Math.max(l[1],-85.051129),l[3]=Math.min(l[3],85.051129),l[0]=Math.max(l[0],-360),l[2]=Math.min(l[2],360));let c=this._worldToCommonBounds(l);r.worldBounds=l,r.normalizedCommonBounds=c,s=!0}return this.setState(r),s}_updateTextureRenderingBounds(){let{triPositionBuffer:t,triTexCoordBuffer:e,normalizedCommonBounds:o,viewportCorners:i}=this.state,{viewport:r}=this.context;t.write(ce(i,3));let s=i.map(a=>ei(r.projectPosition(a),o));e.write(ce(s,2))}_updateColorTexture(t){let{colorRange:e}=t.props,{colorTexture:o}=this.state,i=z(e,!1,Uint8Array);o&&o?.width===e.length?o.setSubImageData({data:i}):(o?.destroy(),o=this.context.device.createTexture({...de,data:i,width:e.length,height:1})),this.setState({colorTexture:o})}_updateWeightmap(){let{radiusPixels:t,colorDomain:e,aggregation:o}=this.props,{worldBounds:i,textureSize:r,weightsScale:s}=this.state,a=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let l=this._worldToCommonBounds(i,{useLayerCoordinateSystem:!0});if(e&&o==="SUM"){let{viewport:h}=this.context,A=h.distanceScales.metersPerUnit[2]*(l[2]-l[0])/r;this.state.colorDomain=e.map(S=>S*A*s)}else this.state.colorDomain=e||ai;let g=this.getAttributeManager().getAttributes(),f=this.getModuleSettings(),d=g.positions.buffer,p={radiusPixels:t,commonBounds:l,textureWidth:r,weightsScale:s},x=g.weights.buffer;a.model.setAttributes({positions:d,weights:x}),a.model.setVertexCount(this.getNumInstances()),a.model.setUniforms(p),a.model.updateModuleSettings(f),a.run({parameters:{viewport:[0,0,r,r]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(t=!1){let{updateTimer:e}=this.state,{debounceTimeout:o}=this.props;t?(e=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(e),e=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),o)),this.setState({updateTimer:e})}_worldToCommonBounds(t,e={}){let{useLayerCoordinateSystem:o=!1}=e,[i,r,s,a]=t,{viewport:l}=this.context,{textureSize:c}=this.state,{coordinateSystem:g}=this.props,f=o&&(g===R.COORDINATE_SYSTEM.LNGLAT_OFFSETS||g===R.COORDINATE_SYSTEM.METER_OFFSETS),d=f?l.projectPosition(this.props.coordinateOrigin):[0,0],p=c*_r/l.scale,x,h;return o&&!f?(x=this.projectPosition([i,r,0]),h=this.projectPosition([s,a,0])):(x=l.projectPosition([i,r,0]),h=l.projectPosition([s,a,0])),ti([x[0]-d[0],x[1]-d[1],h[0]-d[0],h[1]-d[1]],p,p)}_commonToWorldBounds(t){let[e,o,i,r]=t,{viewport:s}=this.context,a=s.unprojectPosition([e,o]),l=s.unprojectPosition([i,r]);return a.slice(0,2).concat(l.slice(0,2))}},Ct=Kt;(()=>{Kt.layerName="HeatmapLayer"})(),(()=>{Kt.defaultProps=Mr})();return pi(Et);})();
764
508
  return __exports__;
765
509
  });