@deck.gl/aggregation-layers 9.0.0-beta.4 → 9.0.0-beta.6
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.
- package/dist/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +2 -3
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +1 -2
- package/dist/dist.dev.js +265 -314
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +2 -6
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +50 -79
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +4 -4
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +1 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +4 -4
- package/dist/grid-aggregation-layer.js +1 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts +0 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +4 -20
- package/dist/heatmap-layer/max-fs.glsl.js +2 -2
- package/dist/heatmap-layer/max-vs.glsl.js +6 -10
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +15 -25
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +11 -16
- package/dist/heatmap-layer/weights-fs.glsl.js +7 -11
- package/dist/heatmap-layer/weights-vs.glsl.js +7 -12
- package/dist/hexagon-layer/hexagon-layer.d.ts +1 -1
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +1 -2
- package/dist/index.cjs +223 -390
- package/dist/index.cjs.map +3 -3
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -2
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +0 -3
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +5 -10
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +30 -42
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +0 -3
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +1 -8
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +6 -9
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +14 -25
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +2 -6
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +25 -42
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +8 -8
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +13 -24
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +4 -9
- package/dist.min.js +212 -330
- package/package.json +7 -7
- package/src/contour-layer/contour-layer.ts +2 -3
- package/src/cpu-grid-layer/cpu-grid-layer.ts +1 -2
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +1 -1
- package/src/gpu-grid-layer/gpu-grid-layer.ts +2 -2
- package/src/heatmap-layer/heatmap-layer.ts +5 -23
- package/src/hexagon-layer/hexagon-layer.ts +2 -3
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +0 -4
- package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +4 -15
package/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var Ai=Object.create;var Pe=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var Ti=Object.getOwnPropertyNames;var ci=Object.getPrototypeOf,gi=Object.prototype.hasOwnProperty;var Le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Si=(e,t)=>{for(var o in t)Pe(e,o,{get:t[o],enumerable:!0})},Be=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ti(t))!gi.call(e,r)&&r!==o&&Pe(e,r,{get:()=>t[r],enumerable:!(i=Ri(t,r))||i.enumerable});return e},V=(e,t,o)=>(Be(e,t,"default"),o&&Be(o,t,"default")),h=(e,t,o)=>(o=e!=null?Ai(ci(e)):{},Be(t||!e||!e.__esModule?Pe(o,"default",{value:e,enumerable:!0}):o,e)),fi=e=>Be(Pe({},"__esModule",{value:!0}),e);var L=Le((Ur,Et)=>{Et.exports=globalThis.deck});var x=Le((vr,pt)=>{pt.exports=globalThis.deck});var q=Le((Wr,Ct)=>{Ct.exports=globalThis.luma});var xe={};Si(xe,{AGGREGATION_OPERATION:()=>F,CPUGridLayer:()=>k,ContourLayer:()=>Oe,GPUGridLayer:()=>Z,GridLayer:()=>he,HeatmapLayer:()=>De,HexagonLayer:()=>Ce,ScreenGridLayer:()=>pe,_AggregationLayer:()=>B,_BinSorter:()=>H,_CPUAggregator:()=>W,_GPUGridAggregator:()=>D});var v={},Nt=h(L(),1);V(v,h(L(),1));if(!Nt.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");V(xe,v);var at=h(x(),1);var M=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e}(M||{});var Ne=h(q(),1);var Mt=e=>`${e}`;function Ge(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=Math.fround(e),r=e-i;return t[o]=i,t[o+1]=r,t}function Ot(e){return e-Math.fround(e)}function It(e){let t=new Float32Array(32);for(let o=0;o<4;++o)for(let i=0;i<4;++i){let r=o*4+i;Ge(e[i*4+o],t,r*2)}return t}var ht=Mt`\
|
|
7
|
+
"use strict";var __exports__=(()=>{var ci=Object.create;var Ne=Object.defineProperty;var ui=Object.getOwnPropertyDescriptor;var gi=Object.getOwnPropertyNames;var fi=Object.getPrototypeOf,di=Object.prototype.hasOwnProperty;var Qe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),pi=(n,e)=>{for(var t in e)Ne(n,t,{get:e[t],enumerable:!0})},Pe=(n,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gi(e))!di.call(n,i)&&i!==t&&Ne(n,i,{get:()=>e[i],enumerable:!(o=ui(e,i))||o.enumerable});return n},U=(n,e,t)=>(Pe(n,e,"default"),t&&Pe(t,e,"default")),M=(n,e,t)=>(t=n!=null?ci(fi(n)):{},Pe(e||!n||!n.__esModule?Ne(t,"default",{value:n,enumerable:!0}):t,n)),mi=n=>Pe(Ne({},"__esModule",{value:!0}),n);var $=Qe((Nr,ht)=>{ht.exports=globalThis.deck});var E=Qe((Or,vt)=>{vt.exports=globalThis.deck});var q=Qe((Lr,St)=>{St.exports=globalThis.luma});var Ee={};pi(Ee,{AGGREGATION_OPERATION:()=>T,CPUGridLayer:()=>H,ContourLayer:()=>be,GPUGridLayer:()=>V,GridLayer:()=>Me,HeatmapLayer:()=>Ce,HexagonLayer:()=>Ae,ScreenGridLayer:()=>Se,_AggregationLayer:()=>P,_BinSorter:()=>w,_CPUAggregator:()=>I,_GPUGridAggregator:()=>C});var L={},xt=M($(),1);U(L,M($(),1));if(!xt.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");U(Ee,L);var io=M(E(),1);var ve=M(q(),1);var At=n=>`${n}`;function Ze(n,e=[],t=0){let o=Math.fround(n),i=n-o;return e[t]=o,e[t+1]=i,e}function yt(n){return n-Math.fround(n)}function bt(n){let e=new Float32Array(32);for(let t=0;t<4;++t)for(let o=0;o<4;++o){let i=t*4+o;Ze(n[o*4+t],e,i*2)}return e}var _t=At`\
|
|
8
8
|
uniform float ONE;
|
|
9
9
|
|
|
10
10
|
/*
|
|
@@ -170,9 +170,8 @@ vec2 sqrt_fp64(vec2 a) {
|
|
|
170
170
|
return sum_fp64(vec2(yn, 0.0), prod);
|
|
171
171
|
#endif
|
|
172
172
|
}
|
|
173
|
-
`;var
|
|
173
|
+
`;var hi={ONE:1};function xi(){return hi}var K={name:"fp64-arithmetic",vs:_t,getUniforms:xi,fp64ify:Ze,fp64LowPart:yt,fp64ifyMatrix4:bt};var J=M(E(),1);var T={SUM:1,MEAN:2,MIN:3,MAX:4};function Mt(n,e){return n+e}function vi(n,e){return e>n?e:n}function Si(n,e){return e<n?e:n}function Ai(n,e){if(Number.isFinite(e))return n.length?e:null;let t=n.map(e).filter(Number.isFinite);return t.length?t.reduce(Mt,0)/t.length:null}function yi(n,e){if(Number.isFinite(e))return n.length?n.length*e:null;let t=n.map(e).filter(Number.isFinite);return t.length?t.reduce(Mt,0):null}function bi(n,e){if(Number.isFinite(e))return n.length?e:null;let t=n.map(e).filter(Number.isFinite);return t.length?t.reduce(vi,-1/0):null}function _i(n,e){if(Number.isFinite(e))return n.length?e:null;let t=n.map(e).filter(Number.isFinite);return t.length?t.reduce(Si,1/0):null}function Q(n,e,t){let o=T[n]||T.SUM;switch(e=Mi(e,t),o){case T.MIN:return i=>_i(i,e);case T.SUM:return i=>yi(i,e);case T.MEAN:return i=>Ai(i,e);case T.MAX:return i=>bi(i,e);default:return null}}function Mi(n,e={}){return Number.isFinite(n)?n:t=>(e.index=t.index,n(t.source,e))}function Tt(n,e={}){return t=>(e.indices=t.map(o=>o.index),n(t.map(o=>o.source),e))}var Ct={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},W=3402823466e29,Je=[32775,32774],et=[32776,32774],Et=[32776,32775],tt={[T.SUM]:32774,[T.MEAN]:32774,[T.MIN]:Je,[T.MAX]:et};var Pt={size:1,operation:T.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Nt=4;var Dt=`#version 300 es
|
|
174
174
|
#define SHADER_NAME gpu-aggregation-to-grid-vs
|
|
175
|
-
|
|
176
175
|
in vec3 positions;
|
|
177
176
|
in vec3 positions64Low;
|
|
178
177
|
in vec3 weights;
|
|
@@ -181,140 +180,99 @@ uniform vec2 gridSize;
|
|
|
181
180
|
uniform bool projectPoints;
|
|
182
181
|
uniform vec2 translation;
|
|
183
182
|
uniform vec3 scaling;
|
|
184
|
-
|
|
185
183
|
out vec3 vWeights;
|
|
186
|
-
|
|
187
184
|
vec2 project_to_pixel(vec4 pos) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
185
|
+
vec4 result;
|
|
186
|
+
pos.xy = pos.xy/pos.w;
|
|
187
|
+
result = pos + vec4(translation, 0., 0.);
|
|
188
|
+
result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
|
|
189
|
+
return result.xy;
|
|
193
190
|
}
|
|
194
|
-
|
|
195
191
|
void main(void) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// Transform (0,0):gridSize -> (-1, -1):(1,1)
|
|
219
|
-
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
|
|
220
|
-
|
|
221
|
-
// Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
|
|
222
|
-
vec2 offset = 1.0 / gridSize;
|
|
223
|
-
pos = pos + offset;
|
|
224
|
-
|
|
225
|
-
gl_Position = vec4(pos, 0.0, 1.0);
|
|
226
|
-
|
|
227
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
228
|
-
gl_PointSize = 1.0;
|
|
229
|
-
}
|
|
230
|
-
`;var vt=`#version 300 es
|
|
192
|
+
vWeights = weights;
|
|
193
|
+
vec4 windowPos = vec4(positions, 1.);
|
|
194
|
+
if (projectPoints) {
|
|
195
|
+
windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
|
|
196
|
+
}
|
|
197
|
+
vec2 pos = project_to_pixel(windowPos);
|
|
198
|
+
vec2 pixelXY64[2];
|
|
199
|
+
pixelXY64[0] = vec2(pos.x, 0.);
|
|
200
|
+
pixelXY64[1] = vec2(pos.y, 0.);
|
|
201
|
+
vec2 gridXY64[2];
|
|
202
|
+
gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
|
|
203
|
+
gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
|
|
204
|
+
float x = floor(gridXY64[0].x);
|
|
205
|
+
float y = floor(gridXY64[1].x);
|
|
206
|
+
pos = vec2(x, y);
|
|
207
|
+
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
|
|
208
|
+
vec2 offset = 1.0 / gridSize;
|
|
209
|
+
pos = pos + offset;
|
|
210
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
211
|
+
gl_PointSize = 1.0;
|
|
212
|
+
}
|
|
213
|
+
`;var Ot=`#version 300 es
|
|
231
214
|
#define SHADER_NAME gpu-aggregation-to-grid-fs
|
|
232
|
-
|
|
233
215
|
precision highp float;
|
|
234
|
-
|
|
235
216
|
in vec3 vWeights;
|
|
236
|
-
|
|
237
217
|
out vec4 fragColor;
|
|
238
|
-
|
|
239
218
|
void main(void) {
|
|
240
|
-
|
|
241
|
-
|
|
219
|
+
fragColor = vec4(vWeights, 1.0);
|
|
220
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
242
221
|
}
|
|
243
|
-
`;var
|
|
222
|
+
`;var Lt=`#version 300 es
|
|
244
223
|
#define SHADER_NAME gpu-aggregation-all-vs-64
|
|
245
|
-
|
|
246
224
|
in vec2 position;
|
|
247
225
|
uniform ivec2 gridSize;
|
|
248
226
|
out vec2 vTextureCoord;
|
|
249
|
-
|
|
250
227
|
void main(void) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
|
|
269
|
-
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
|
|
270
|
-
|
|
271
|
-
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
272
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
273
|
-
gl_PointSize = 1.0;
|
|
274
|
-
}
|
|
275
|
-
`;var Ht=`#version 300 es
|
|
228
|
+
vec2 pos = vec2(-1.0, -1.0);
|
|
229
|
+
vec2 offset = 1.0 / vec2(gridSize);
|
|
230
|
+
pos = pos + offset;
|
|
231
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
232
|
+
int yIndex = gl_InstanceID / gridSize[0];
|
|
233
|
+
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
|
|
234
|
+
vec2 yIndexFP64 = vec2(float(yIndex), 0.);
|
|
235
|
+
vec2 xIndexFP64 = vec2(float(xIndex), 0.);
|
|
236
|
+
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
|
|
237
|
+
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
|
|
238
|
+
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
|
|
239
|
+
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
|
|
240
|
+
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
241
|
+
gl_PointSize = 1.0;
|
|
242
|
+
}
|
|
243
|
+
`;var wt=`#version 300 es
|
|
276
244
|
#define SHADER_NAME gpu-aggregation-all-fs
|
|
277
|
-
|
|
278
245
|
precision highp float;
|
|
279
|
-
|
|
280
246
|
in vec2 vTextureCoord;
|
|
281
247
|
uniform sampler2D uSampler;
|
|
282
248
|
uniform bool combineMaxMin;
|
|
283
249
|
out vec4 fragColor;
|
|
284
250
|
void main(void) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
`;var bt=`#version 300 es
|
|
251
|
+
vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
|
|
252
|
+
if (textureColor.a == 0.) {
|
|
253
|
+
discard;
|
|
254
|
+
}
|
|
255
|
+
fragColor.rgb = textureColor.rgb;
|
|
256
|
+
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
|
|
257
|
+
}
|
|
258
|
+
`;var Ft=`#version 300 es
|
|
294
259
|
#define SHADER_NAME gpu-aggregation-transform-mean-vs
|
|
295
260
|
in vec4 aggregationValues;
|
|
296
261
|
out vec4 meanValues;
|
|
297
|
-
|
|
298
262
|
void main()
|
|
299
263
|
{
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
meanValues.w = aggregationValues.w;
|
|
305
|
-
|
|
306
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
307
|
-
gl_PointSize = 1.0;
|
|
264
|
+
bool isCellValid = bool(aggregationValues.w > 0.);
|
|
265
|
+
meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
|
|
266
|
+
meanValues.w = aggregationValues.w;
|
|
267
|
+
gl_PointSize = 1.0;
|
|
308
268
|
}
|
|
309
|
-
`;var
|
|
269
|
+
`;var Ti={minFilter:"nearest",magFilter:"nearest"};function Z(n,e){let{width:t=1,height:o=1,data:i=null,parameters:r=Ti}=e;return n.createTexture({data:i,format:"rgba32float",mipmaps:!1,sampler:r,width:t,height:o})}function xe(n,e){let{id:t,width:o=1,height:i=1,texture:r}=e;return n.createFramebuffer({id:t,width:o,height:i,colorAttachments:[r]})}var Ci=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],It={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ei=["float32-renderable-webgl","texture-blend-float-webgl"],C=class{static getAggregationData({aggregationData:e,maxData:t,minData:o,maxMinData:i,pixelIndex:r}){let s=r*Nt,a={};return e&&(a.cellCount=e[s+3],a.cellWeight=e[s]),i?(a.maxCellWieght=i[0],a.minCellWeight=i[3]):(t&&(a.maxCellWieght=t[0],a.totalCount=t[3]),o&&(a.minCellWeight=o[0],a.totalCount=o[3])),a}static getCellData({countsData:e,size:t=1}){let o=e.length/4,i=new Float32Array(o*t),r=new Uint32Array(o);for(let s=0;s<o;s++){for(let a=0;a<t;a++)i[s*t+a]=e[s*4+a];r[s]=e[s*4+3]}return{cellCounts:r,cellWeights:i}}static isSupported(e){return Ei.every(t=>e.features.has(t))}constructor(e,t={}){this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=t.id||"gpu-grid-aggregator",this.device=e;let o=["float32-renderable-webgl"];this._hasGPUSupport=o.every(i=>e.features.has(i)),this._hasGPUSupport&&this._setupModels()}delete(){let{gridAggregationModel:e,allAggregationModel:t,meanTransform:o}=this,{textures:i,framebuffers:r,maxMinFramebuffers:s,minFramebuffers:a,maxFramebuffers:l,meanTextures:c,resources:g}=this.state;e?.destroy(),t?.destroy(),o?.destroy(),Ni([r,i,s,a,l,c,g])}run(e={}){this.setState({results:{}});let t=this._normalizeAggregationParams(e);return this._runAggregation(t)}getData(e){let t={},o=this.state.results;o[e].aggregationData||(o[e].aggregationData=o[e].aggregationBuffer.getData()),t.aggregationData=o[e].aggregationData;for(let i in It){let r=It[i];(o[e][i]||o[e][r])&&(o[e][i]=o[e][i]||o[e][r].getData(),t[i]=o[e][i])}return t}updateShaders(e={}){this.setState({shaderOptions:e,modelDirty:!0})}_normalizeAggregationParams(e){let t={...Ct,...e},{weights:o}=t;return o&&(t.weights=Pi(o)),t}setState(e){Object.assign(this.state,e)}_getAggregateData(e){let t={},{textures:o,framebuffers:i,maxMinFramebuffers:r,minFramebuffers:s,maxFramebuffers:a,resources:l}=this.state,{weights:c}=e;for(let g in c){t[g]={};let{needMin:f,needMax:d,combineMaxMin:p}=c[g];t[g].aggregationTexture=o[g],t[g].aggregationBuffer=this.device.readPixelsToBufferWebGL(i[g],{target:c[g].aggregationBuffer,sourceType:5126}),f&&d&&p?(t[g].maxMinBuffer=this.device.readPixelsToBufferWebGL(r[g],{target:c[g].maxMinBuffer,sourceType:5126}),t[g].maxMinTexture=l[`${g}-maxMinTexture`]):(f&&(t[g].minBuffer=this.device.readPixelsToBufferWebGL(s[g],{target:c[g].minBuffer,sourceType:5126}),t[g].minTexture=l[`${g}-minTexture`]),d&&(t[g].maxBuffer=this.device.readPixelsToBufferWebGL(a[g],{target:c[g].maxBuffer,sourceType:5126}),t[g].maxTexture=l[`${g}-maxTexture`]))}return this._trackGPUResultBuffers(t,c),t}_renderAggregateData(e){let{cellSize:t,projectPoints:o,attributes:i,moduleSettings:r,numCol:s,numRow:a,weights:l,translation:c,scaling:g}=e,{maxMinFramebuffers:f,minFramebuffers:d,maxFramebuffers:p}=this.state,x=[s,a],h={blend:!0,depthTest:!1,blendFunc:[1,1]},A={cellSize:t,gridSize:x,projectPoints:o,translation:c,scaling:g};for(let S in l){let{needMin:y,needMax:b}=l[S],_=y&&b&&l[S].combineMaxMin;this._renderToWeightsTexture({id:S,parameters:h,moduleSettings:r,uniforms:A,gridSize:x,attributes:i,weights:l}),_?this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:Et},gridSize:x,minOrMaxFb:f[S],clearParams:{clearColor:[0,0,0,W]},combineMaxMin:_}):(y&&this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:Je},gridSize:x,minOrMaxFb:d[S],clearParams:{clearColor:[W,W,W,0]},combineMaxMin:_}),b&&this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:et},gridSize:x,minOrMaxFb:p[S],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:_}))}}_renderToMaxMinTexture(e){let{id:t,parameters:o,gridSize:i,minOrMaxFb:r,combineMaxMin:s,clearParams:a={}}=e,{framebuffers:l}=this.state,{allAggregationModel:c}=this;this.device.withParametersWebGL({...a,framebuffer:r,viewport:[0,0,i[0],i[1]]},()=>{this.device.clearWebGL({color:!0}),c.setUniforms({gridSize:i,combineMaxMin:s}),c.setBindings({uSampler:l[t].texture}),c.draw()})}_renderToWeightsTexture(e){let{id:t,parameters:o,moduleSettings:i,uniforms:r,gridSize:s,weights:a}=e,{framebuffers:l,equations:c,weightAttributes:g}=this.state,{gridAggregationModel:f}=this,{operation:d}=a[t],p=d===T.MIN?[W,W,W,0]:[0,0,0,0];if(this.device.withParametersWebGL({framebuffer:l[t],viewport:[0,0,s[0],s[1]],clearColor:p},()=>{this.device.clearWebGL({color:!0});let x={weights:g[t]};f.draw({parameters:{...o,blendEquation:c[t]},moduleSettings:i,uniforms:r,attributes:x})}),d===T.MEAN){let{meanTextures:x,textures:h}=this.state,A={_sourceTextures:{aggregationValues:x[t]},_targetTexture:h[t],elementCount:h[t].width*h[t].height};this.meanTransform?this.meanTransform.update(A):this.meanTransform=Li(this.device,A),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),l[t].attach({[36064]:h[t]})}}_runAggregation(e){this._updateModels(e),this._setupFramebuffers(e),this._renderAggregateData(e);let t=this._getAggregateData(e);return this.setState({results:t}),t}_setupFramebuffers(e){let{textures:t,framebuffers:o,maxMinFramebuffers:i,minFramebuffers:r,maxFramebuffers:s,meanTextures:a,equations:l}=this.state,{weights:c}=e,{numCol:g,numRow:f}=e,d={width:g,height:f};for(let p in c){let{needMin:x,needMax:h,combineMaxMin:A,operation:S}=c[p];t[p]=c[p].aggregationTexture||t[p]||Z(this.device,{id:`${p}-texture`,width:g,height:f}),t[p].resize(d);let y=t[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]=xe(this.device,{id:`${p}-fb`,width:g,height:f,texture:y}),o[p].resize(d),l[p]=tt[S]||tt[T.SUM],(x||h)&&(x&&h&&A?i[p]||(y=c[p].maxMinTexture||this._getMinMaxTexture(`${p}-maxMinTexture`),i[p]=xe(this.device,{id:`${p}-maxMinFb`,texture:y})):(x&&(r[p]||(y=c[p].minTexture||this._getMinMaxTexture(`${p}-minTexture`),r[p]=xe(this.device,{id:`${p}-minFb`,texture:y}))),h&&(s[p]||(y=c[p].maxTexture||this._getMinMaxTexture(`${p}-maxTexture`),s[p]=xe(this.device,{id:`${p}-maxFb`,texture:y})))))}}_getMinMaxTexture(e){let{resources:t}=this.state;return t[e]||(t[e]=Z(this.device,{id:"resourceName"})),t[e]}_setupModels({numCol:e=0,numRow:t=0}={}){let{shaderOptions:o}=this.state;if(this.gridAggregationModel?.destroy(),this.gridAggregationModel=Di(this.device,o),!this.allAggregationModel){let i=e*t;this.allAggregationModel=Oi(this.device,i)}}_setupWeightAttributes(e){let{weightAttributes:t}=this.state,{weights:o}=e;for(let i in o)t[i]=e.attributes[i]}_trackGPUResultBuffers(e,t){let{resources:o}=this.state;for(let i in e)if(e[i]){for(let r of Ci)if(e[i][r]&&t[i][r]!==e[i][r]){let s=`gpu-result-${i}-${r}`;o[s]&&o[s].delete(),o[s]=e[i][r]}}}_updateModels(e){let{vertexCount:t,attributes:o,numCol:i,numRow:r}=e,{modelDirty:s}=this.state;s&&(this._setupModels(e),this.setState({modelDirty:!1})),this._setupWeightAttributes(e),this.gridAggregationModel.setVertexCount(t),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(i*r)}};function Pi(n){let e={};for(let t in n)e[t]={...Pt,...n[t]};return e}function Ni(n){n=Array.isArray(n)?n:[n],n.forEach(e=>{for(let t in e)e[t].delete()})}function Di(n,e){let t=(0,J._mergeShaders)({vs:Dt,fs:Ot,modules:[K,J.project32]},e);return new ve.Model(n,{id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,J.getShaderAssembler)(),...t})}function Oi(n,e){return new ve.Model(n,{id:"All-Aggregation-Model",vs:Lt,fs:wt,modules:[K],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:e,attributes:{position:[0,0]}})}function Li(n,e){return new ve.TextureTransform(n,{vs:Ft,_targetTextureVarying:"meanValues",...e})}var Oe=M(q(),1),te=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,e=!1,t=Float32Array){let o;if(Number.isFinite(n[0]))o=new t(n);else{o=new t(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(e)for(let i=0;i<o.length;i++)o[i]/=255;return o}var Rt=`#version 300 es
|
|
310
270
|
#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
311
271
|
#define RANGE_COUNT 6
|
|
312
|
-
|
|
313
272
|
in vec3 positions;
|
|
314
273
|
in vec3 instancePositions;
|
|
315
274
|
in vec4 instanceCounts;
|
|
316
275
|
in vec3 instancePickingColors;
|
|
317
|
-
|
|
318
276
|
uniform float opacity;
|
|
319
277
|
uniform vec3 cellScale;
|
|
320
278
|
uniform vec4 minColor;
|
|
@@ -323,89 +281,69 @@ uniform vec4 colorRange[RANGE_COUNT];
|
|
|
323
281
|
uniform vec2 colorDomain;
|
|
324
282
|
uniform bool shouldUseMinMax;
|
|
325
283
|
uniform sampler2D maxTexture;
|
|
326
|
-
|
|
327
284
|
out vec4 vColor;
|
|
328
285
|
out float vSampleCount;
|
|
329
|
-
|
|
330
286
|
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
287
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
288
|
+
if (value >= domain.x && value <= domain.y) {
|
|
289
|
+
float domainRange = domain.y - domain.x;
|
|
290
|
+
if (domainRange <= 0.) {
|
|
291
|
+
outColor = colorRange[0];
|
|
292
|
+
} else {
|
|
293
|
+
float rangeCount = float(RANGE_COUNT);
|
|
294
|
+
float rangeStep = domainRange / rangeCount;
|
|
295
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
296
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
297
|
+
int intIdx = int(idx);
|
|
298
|
+
outColor = colorRange[intIdx];
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
outColor = outColor / 255.;
|
|
302
|
+
return outColor;
|
|
347
303
|
}
|
|
348
|
-
|
|
349
304
|
void main(void) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
// Set color to be rendered to picking fbo (also used to check for selection highlight).
|
|
368
|
-
picking_setPickingColor(instancePickingColors);
|
|
369
|
-
|
|
370
|
-
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
371
|
-
}
|
|
372
|
-
`;var Vt=`#version 300 es
|
|
305
|
+
vSampleCount = instanceCounts.a;
|
|
306
|
+
float weight = instanceCounts.r;
|
|
307
|
+
float maxWeight = texture(maxTexture, vec2(0.5)).r;
|
|
308
|
+
float step = weight / maxWeight;
|
|
309
|
+
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
|
|
310
|
+
vec2 domain = colorDomain;
|
|
311
|
+
float domainMaxValid = float(colorDomain.y != 0.);
|
|
312
|
+
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
|
|
313
|
+
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
|
|
314
|
+
float rangeMinMax = float(shouldUseMinMax);
|
|
315
|
+
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
|
|
316
|
+
vColor = vec4(color.rgb, color.a * opacity);
|
|
317
|
+
picking_setPickingColor(instancePickingColors);
|
|
318
|
+
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
319
|
+
}
|
|
320
|
+
`;var Bt=`#version 300 es
|
|
373
321
|
#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
374
|
-
|
|
375
322
|
precision highp float;
|
|
376
|
-
|
|
377
323
|
in vec4 vColor;
|
|
378
324
|
in float vSampleCount;
|
|
379
|
-
|
|
380
325
|
out vec4 fragColor;
|
|
381
|
-
|
|
382
326
|
void main(void) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
}
|
|
386
|
-
fragColor = vColor;
|
|
387
|
-
|
|
388
|
-
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
327
|
+
if (vSampleCount <= 0.0) {
|
|
328
|
+
discard;
|
|
389
329
|
}
|
|
390
|
-
`;var yi=[0,0,0,0],Hi=[0,255,0,255],bi=["minColor","maxColor","colorRange","colorDomain"],Wi={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:U},Ue=class extends oe.Layer{static isSupported(t){return t.features.has("texture-formats-float32-webgl1")}getShaders(){return{vs:Xt,fs:Vt,modules:[oe.picking]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){super.updateState(t);let{oldProps:o,props:i,changeFlags:r}=t,s=this.getAttributeManager();i.numInstances!==o.numInstances?s.invalidateAll():o.cellSizePixels!==i.cellSizePixels&&s.invalidate("instancePositions"),this._updateUniforms(o,i,r)}draw({uniforms:t}){let{parameters:o,maxTexture:i}=this.props,r=this.props.minColor||yi,s=this.props.maxColor||Hi,a=this.props.colorDomain||[1,0],_=this.state.model;_.setUniforms(t),_.setBindings({maxTexture:i}),_.setUniforms({minColor:r,maxColor:s,colorDomain:a}),_.setParameters({depthWriteEnabled:!1,...o}),_.draw(this.context.renderPass)}calculateInstancePositions(t,{numInstances:o}){let{width:i,height:r}=this.context.viewport,{cellSizePixels:s}=this.props,a=Math.ceil(i/s),{value:_,size:n}=t;for(let l=0;l<o;l++){let R=l%a,T=Math.floor(l/a);_[l*n+0]=R*s/i*2-1,_[l*n+1]=1-T*s/r*2,_[l*n+2]=0}}_getModel(){return new ue.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ue.Geometry({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})})}_shouldUseMinMax(){let{minColor:t,maxColor:o,colorDomain:i,colorRange:r}=this.props;return t||o?(oe.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(i||r)}_updateUniforms(t,o,i){let r=this.state.model;if(bi.some(s=>t[s]!==o[s])&&r.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),t.colorRange!==o.colorRange&&r.setUniforms({colorRange:z(o.colorRange)}),t.cellMarginPixels!==o.cellMarginPixels||t.cellSizePixels!==o.cellSizePixels||i.viewportChanged){let{width:s,height:a}=this.context.viewport,{cellSizePixels:_,cellMarginPixels:n}=this.props,l=_>n?n:0,R=new Float32Array([(_-l)/s*2,-(_-l)/a*2,1]);r.setUniforms({cellScale:R})}}},$=Ue;(()=>{Ue.layerName="ScreenGridCellLayer"})(),(()=>{Ue.defaultProps=Wi})();var io=h(x(),1);var ie=h(x(),1);function wt(e,t){let o={};for(let i in e)t.includes(i)||(o[i]=e[i]);return o}var it=class extends ie.CompositeLayer{initializeAggregationLayer(t){super.initializeState(this.context),this.setState({ignoreProps:wt(this.constructor._propTypes,t.data.props),dimensions:t})}updateState(t){super.updateState(t);let{changeFlags:o}=t;if(o.extensionsChanged){let i=this.getShaders({});i&&i.defines&&(i.defines.NON_INSTANCED_MODEL=1),this.updateShaders(i)}this._updateAttributes()}updateAttributes(t){this.setState({changedAttributes:t})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:t,mousePosition:o,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:t,mousePosition:o,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(t){}isAggregationDirty(t,o={}){let{props:i,oldProps:r,changeFlags:s}=t,{compareAll:a=!1,dimension:_}=o,{ignoreProps:n}=this.state,{props:l,accessors:R=[]}=_,{updateTriggersChanged:T}=s;if(s.dataChanged)return!0;if(T){if(T.all)return!0;for(let c of R)if(T[c])return!0}if(a)return s.extensionsChanged?!0:(0,ie._compareProps)({oldProps:r,newProps:i,ignoreProps:n,propTypes:this.constructor._propTypes});for(let c of l)if(i[c]!==r[c])return!0;return!1}isAttributeChanged(t){let{changedAttributes:o}=this.state;return t?o&&o[t]!==void 0:!Xi(o)}_getAttributeManager(){return new ie.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}},B=it;(()=>{it.layerName="AggregationLayer"})();function Xi(e){let t=!0;for(let o in e){t=!1;break}return t}var zt=h(x(),1);function ve(e,t,o){let i=o;return i.domain=()=>e,i.range=()=>t,i}function Kt(e,t){return ve(e,t,i=>ji(e,t,i))}function Vi(e,t){return ve(e,t,i=>mi(e,t,i))}function wi(e,t){let o=e.sort(Yt),i=0,r=Math.max(1,t.length),s=new Array(r-1);for(;++i<r;)s[i-1]=Ki(o,i/r);let a=_=>Yi(s,t,_);return a.thresholds=()=>s,ve(e,t,a)}function Yt(e,t){return e-t}function Ki(e,t){let o=e.length;if(t<=0||o<2)return e[0];if(t>=1)return e[o-1];let i=(o-1)*t,r=Math.floor(i),s=e[r],a=e[r+1];return s+(a-s)*(i-r)}function zi(e,t){let o=0,i=e.length;for(;o<i;){let r=o+i>>>1;Yt(e[r],t)>0?i=r:o=r+1}return o}function Yi(e,t,o){return t[zi(e,o)]}function ki(e,t,o,i){let r=`${i}`,s=t.get(r);return s===void 0&&(s=e.push(i),t.set(r,s)),o[(s-1)%o.length]}function Zi(e,t){let o=new Map,i=[];for(let s of e){let a=`${s}`;o.has(a)||o.set(a,i.push(s))}return ve(e,t,s=>ki(i,o,t,s))}function ji(e,t,o){let i=e[1]-e[0];if(i<=0)return zt.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];let r=i/t.length,s=Math.floor((o-e[0])/r),a=Math.max(Math.min(s,t.length-1),0);return t[a]}function mi(e,t,o){return(o-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function kt(e){return e!=null}function Qi(e){let t=[];return e.forEach(o=>{!t.includes(o)&&kt(o)&&t.push(o)}),t}function Zt(e,t){return(typeof t=="function"?e.map(t):e).filter(kt)}function jt(e,t){return Zt(e,t)}function mt(e,t){return Qi(Zt(e,t))}function Qt(e,t,o){return Math.max(t,Math.min(o,e))}function qt(e){switch(e){case"quantize":return Kt;case"linear":return Vi;case"quantile":return wi;case"ordinal":return Zi;default:return Kt}}var Jt=e=>e.length,qi=3402823466e29,Lt=e=>e.points,Gt=e=>e.index,$t=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN,$i={getValue:Jt,getPoints:Lt,getIndex:Gt,filterData:null},H=class{constructor(t=[],o=$i){this.aggregatedBins=this.getAggregatedBins(t,o),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(t,o){let{getValue:i=Jt,getPoints:r=Lt,getIndex:s=Gt,filterData:a}=o,_=typeof a=="function",n=t.length,l=[],R=0;for(let T=0;T<n;T++){let c=t[T],g=r(c),d=s(c),f=_?g.filter(a):g;c.filteredPoints=_?f:null;let p=f.length?i(f):null;p!=null&&(l[R]={i:Number.isFinite(d)?d:T,value:p,counts:f.length},R++)}return l}_percentileToIndex(t){let o=this.sortedBins.length;if(o<2)return[0,0];let[i,r]=t.map(_=>Qt(_,0,100)),s=Math.ceil(i/100*(o-1)),a=Math.floor(r/100*(o-1));return[s,a]}getBinMap(){let t={};for(let o of this.aggregatedBins)t[o.i]=o;return t}_updateMinMaxValues(){let t=0,o=0,i=qi,r=0;for(let s of this.aggregatedBins)t=t>s.counts?t:s.counts,o=o>s.value?o:s.value,i=i<s.value?i:s.value,r+=s.counts;this.maxCount=t,this.maxValue=o,this.minValue=i,this.totalCount=r}getValueRange(t){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((r,s)=>$t(r.value,s.value))),!this.sortedBins.length)return[];let o=0,i=this.sortedBins.length-1;if(Array.isArray(t)){let r=this._percentileToIndex(t);o=r[0],i=r[1]}return[this.sortedBins[o].value,this.sortedBins[i].value]}getValueDomainByScale(t,[o=0,i=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((s,a)=>$t(s.value,a.value))),!this.sortedBins.length)return[];let r=this._percentileToIndex([o,i]);return this._getScaleDomain(t,r)}_getScaleDomain(t,[o,i]){let r=this.sortedBins;switch(t){case"quantize":case"linear":return[r[o].value,r[i].value];case"quantile":return jt(r.slice(o,i+1),s=>s.value);case"ordinal":return mt(r,s=>s.value);default:return[r[o].value,r[i].value]}}};var oo=h(x(),1);var Y=h(x(),1),to=6378e3;function ye(e){return Number.isFinite(e)?e:0}function He(e,t){let o=e.positions.value,i=1/0,r=-1/0,s=1/0,a=-1/0,_,n;for(let R=0;R<t;R++)n=o[R*3],_=o[R*3+1],i=_<i?_:i,r=_>r?_:r,s=n<s?n:s,a=n>a?n:a;return{xMin:ye(s),xMax:ye(a),yMin:ye(i),yMax:ye(r)}}function Ji(e,t,o,i){let{width:r,height:s}=i,a=o===Y.COORDINATE_SYSTEM.CARTESIAN?[-r/2,-s/2]:[-180,-90];Y.log.assert(o===Y.COORDINATE_SYSTEM.CARTESIAN||o===Y.COORDINATE_SYSTEM.LNGLAT||o===Y.COORDINATE_SYSTEM.DEFAULT);let{xMin:_,yMin:n}=e;return[-1*(eo(_-a[0],t.xOffset)+a[0]),-1*(eo(n-a[1],t.yOffset)+a[1])]}function eo(e,t){let o=e<0?-1:1,i=o<0?Math.abs(e)+t:Math.abs(e);return i=Math.floor(i/t)*t,i*o}function rt(e,t,o=!0){if(!o)return{xOffset:t,yOffset:t};let{yMin:i,yMax:r}=e,s=(i+r)/2;return Li(t,s)}function be(e,t,o,i){let r=rt(e,t,i!==Y.COORDINATE_SYSTEM.CARTESIAN),s=Ji(e,r,i,o),{xMin:a,yMin:_,xMax:n,yMax:l}=e,R=n-a+r.xOffset,T=l-_+r.yOffset,c=Math.ceil(R/r.xOffset),g=Math.ceil(T/r.yOffset);return{gridOffset:r,translation:s,width:R,height:T,numCol:c,numRow:g}}function Li(e,t){let o=Gi(e),i=er(t,e);return{yOffset:o,xOffset:i}}function Gi(e){return e/to*(180/Math.PI)}function er(e,t){return t/to*(180/Math.PI)/Math.cos(e*Math.PI/180)}function re(e,t){let o=tr(e,t),i=or(o);return{gridHash:o.gridHash,gridOffset:o.gridOffset,data:i}}function tr(e,t){let{data:o=[],cellSize:i}=e,{attributes:r,viewport:s,projectPoints:a,numInstances:_}=t,n=r.positions.value,{size:l}=r.positions.getAccessor(),R=t.boundingBox||ir(r.positions,_),T=t.posOffset||[180,90],c=t.gridOffset||rt(R,i);if(c.xOffset<=0||c.yOffset<=0)return{gridHash:{},gridOffset:c,offsets:[0,0]};let{width:g,height:d}=s,f=Math.ceil(g/c.xOffset),p=Math.ceil(d/c.yOffset),N={},{iterable:C,objectInfo:O}=(0,oo.createIterable)(o),I=new Array(3);for(let u of C){O.index++,I[0]=n[O.index*l],I[1]=n[O.index*l+1],I[2]=l>=3?n[O.index*l+2]:0;let[X,fe]=a?s.project(I):I;if(Number.isFinite(X)&&Number.isFinite(fe)){let j=Math.floor((fe+T[1])/c.yOffset),m=Math.floor((X+T[0])/c.xOffset);if(!a||m>=0&&m<f&&j>=0&&j<p){let Q=`${j}-${m}`;N[Q]=N[Q]||{count:0,points:[],lonIdx:m,latIdx:j},N[Q].count+=1,N[Q].points.push({source:u,index:O.index})}}}return{gridHash:N,gridOffset:c,offsets:[T[0]*-1,T[1]*-1]}}function or({gridHash:e,gridOffset:t,offsets:o}){let i=new Array(Object.keys(e).length),r=0;for(let s in e){let a=s.split("-"),_=parseInt(a[0],10),n=parseInt(a[1],10),l=r++;i[l]={index:l,position:[o[0]+t.xOffset*n,o[1]+t.yOffset*_],...e[s]}}return i}function ir(e,t){let o=e.value,{size:i}=e.getAccessor(),r=1/0,s=-1/0,a=1/0,_=-1/0,n,l;for(let R=0;R<t;R++)l=o[R*i],n=o[R*i+1],Number.isFinite(l)&&Number.isFinite(n)&&(r=n<r?n:r,s=n>s?n:s,a=l<a?l:a,_=l>_?l:_);return{xMin:a,xMax:_,yMin:r,yMax:s}}var st=class extends B{initializeAggregationLayer({dimensions:t}){super.initializeAggregationLayer(t),this.setState({layerData:{},gpuGridAggregator:new D(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:re})}updateState(t){super.updateState(t),this.updateAggregationState(t);let{aggregationDataDirty:o,aggregationWeightsDirty:i,gpuAggregation:r}=this.state;if(this.getNumInstances()<=0)return;let s=!1;(o||r&&i)&&(this._updateAggregation(t),s=!0),!r&&(o||i)&&(this._updateWeightBins(),this._uploadAggregationResults(),s=!0),this.setState({aggregationDirty:s})}finalizeState(t){let{count:o}=this.state.weights;o&&o.aggregationBuffer&&o.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(t)}updateShaders(t){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(t)}updateAggregationState(t){io.log.assert(!1)}allocateResources(t,o){if(this.state.numRow!==t||this.state.numCol!==o){let i=o*t*4*4,{weights:r}=this.state;for(let s in r){let a=r[s];a.aggregationBuffer&&a.aggregationBuffer.delete(),a.aggregationBuffer=this.context.device.createBuffer({byteLength:i,accessor:{size:4,type:M.FLOAT,divisor:1}})}}}updateResults({aggregationData:t,maxMinData:o,maxData:i,minData:r}){let{count:s}=this.state.weights;s&&(s.aggregationData=t,s.maxMinData=o,s.maxData=i,s.minData=r)}_updateAggregation(t){let{cpuGridAggregator:o,gpuGridAggregator:i,gridOffset:r,posOffset:s,translation:a=[0,0],scaling:_=[0,0,0],boundingBox:n,projectPoints:l,gpuAggregation:R,numCol:T,numRow:c}=this.state,{props:g}=t,{viewport:d}=this.context,f=this.getAttributes(),p=this.getNumInstances();if(R){let{weights:N}=this.state;i.run({weights:N,cellSize:[r.xOffset,r.yOffset],numCol:T,numRow:c,translation:a,scaling:_,vertexCount:p,projectPoints:l,attributes:f,moduleSettings:this.getModuleSettings()})}else{let N=o(g,{gridOffset:r,projectPoints:l,attributes:f,viewport:d,posOffset:s,boundingBox:n});this.setState({layerData:N})}}_updateWeightBins(){let{getValue:t}=this.state,o=new H(this.state.layerData.data||[],{getValue:t});this.setState({sortedBins:o})}_uploadAggregationResults(){let{numCol:t,numRow:o}=this.state,{data:i}=this.state.layerData,{aggregatedBins:r,minValue:s,maxValue:a,totalCount:_}=this.state.sortedBins,n=4,l=t*o*n,R=new Float32Array(l).fill(0);for(let d of r){let{lonIdx:f,latIdx:p}=i[d.i],{value:N,counts:C}=d,O=(f+p*t)*n;R[O]=N,R[O+n-1]=C}let T=new Float32Array([a,0,0,s]),c=new Float32Array([a,0,0,_]),g=new Float32Array([s,0,0,_]);this.updateResults({aggregationData:R,maxMinData:T,maxData:c,minData:g})}},b=st;(()=>{st.layerName="GridAggregationLayer"})();var rr={...$.defaultProps,getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},ro="positions",sr={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},We=class extends b{initializeState(){if(!$.isSupported(this.context.device)){this.setState({supported:!1}),at.log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();return}super.initializeAggregationLayer({dimensions:sr,getCellSize:i=>i.cellSizePixels});let t={count:{size:1,operation:F.SUM,needMax:!0,maxTexture:te(this.context.device,{id:`${this.id}-max-texture`})}};this.setState({supported:!0,projectPoints:!0,weights:t,subLayerData:{attributes:{}},maxTexture:t.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[ro]:{size:3,accessor:"getPosition",type:M.DOUBLE,fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:t}){return this.state.supported&&t.somethingChanged}updateState(t){super.updateState(t)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:t,numRow:o,numCol:i,weights:r}=this.state,{updateTriggers:s}=this.props,{aggregationBuffer:a}=r.count,_=this.getSubLayerClass("cells",$);return new _(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:s}),{data:{attributes:{instanceCounts:a}},maxTexture:t,numInstances:o*i})}finalizeState(t){super.finalizeState(t);let{aggregationBuffer:o,maxBuffer:i,maxTexture:r}=this.state;o?.delete(),i?.delete(),r?.delete()}getPickingInfo({info:t}){let{index:o}=t;if(o>=0){let{gpuGridAggregator:i,gpuAggregation:r,weights:s}=this.state,a=r?i.getData("count"):s.count;t.object=D.getAggregationData({pixelIndex:o,...a})}return t}updateResults({aggregationData:t,maxData:o}){let{count:i}=this.state.weights;i.aggregationData=t,i.aggregationBuffer.write(t),i.maxData=o,i.maxTexture.setImageData({data:o})}updateAggregationState(t){let o=t.props.cellSizePixels,i=t.oldProps.cellSizePixels!==o,{viewportChanged:r}=t.changeFlags,s=t.props.gpuAggregation;this.state.gpuAggregation!==t.props.gpuAggregation&&s&&!D.isSupported(this.context.device)&&(at.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),s=!1);let a=s!==this.state.gpuAggregation;this.setState({gpuAggregation:s});let _=this.isAttributeChanged(ro),{dimensions:n}=this.state,{data:l,weights:R}=n,T=_||a||r||this.isAggregationDirty(t,{compareAll:s,dimension:l}),c=this.isAggregationDirty(t,{dimension:R});this.setState({aggregationDataDirty:T,aggregationWeightsDirty:c});let{viewport:g}=this.context;if(r||i){let{width:d,height:f}=g,p=Math.ceil(d/o),N=Math.ceil(f/o);this.allocateResources(N,p),this.setState({scaling:[d/2,-f/2,1],gridOffset:{xOffset:o,yOffset:o},width:d,height:f,numCol:p,numRow:N})}c&&this._updateAccessors(t),(T||c)&&this._resetResults()}_updateAccessors(t){let{getWeight:o,aggregation:i,data:r}=t.props,{count:s}=this.state.weights;s&&(s.getWeight=o,s.operation=F[i]),this.setState({getValue:ee(i,o,{data:r})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}},pe=We;(()=>{We.layerName="ScreenGridLayer"})(),(()=>{We.defaultProps=rr})();var lo=h(L(),1);function so(){}var ao=["getBins","getDomain","getScaleFunc"],_o=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],ar=e=>e.cellSize,W=class{constructor(t){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=t.getCellSize||ar,this._getAggregator=t.getAggregator,this._addDimension(t.dimensions||_o)}static defaultDimensions(){return _o}updateState(t,o){let{oldProps:i,props:r,changeFlags:s}=t;this.updateGetValueFuncs(i,r,s);let a=this.needsReProjectPoints(i,r,s),_=!1;return s.dataChanged||a?(this.getAggregatedData(r,o),_=!0):((this.getDimensionChanges(i,r,s)||[]).forEach(l=>typeof l=="function"&&l()),_=!0),this.setState({aggregationDirty:_}),this.state}setState(t){this.state={...this.state,...t}}setDimensionState(t,o){this.setState({dimensions:{...this.state.dimensions,[t]:{...this.state.dimensions[t],...o}}})}normalizeResult(t={}){return t.hexagons?{data:t.hexagons,...t}:t.layerData?{data:t.layerData,...t}:t}getAggregatedData(t,o){let r=this._getAggregator(t)(t,o);this.setState({layerData:this.normalizeResult(r)}),this.changeFlags={layerData:!0},this.getSortedBins(t)}updateGetValueFuncs(t,o,i){for(let r in this.dimensionUpdaters){let{value:s,weight:a,aggregation:_}=this.dimensionUpdaters[r].getBins.triggers,n=o[s.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[r].getBins,t,o,i)&&(n?n=Dt(n,{data:o.data}):n=ee(o[_.prop],o[a.prop],{data:o.data})),n&&this.setDimensionState(r,{getValue:n})}}needsReProjectPoints(t,o,i){return this._getCellSize(t)!==this._getCellSize(o)||this._getAggregator(t)!==this._getAggregator(o)||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPosition)}addDimension(t){this._addDimension(t)}_addDimension(t=[]){t.forEach(o=>{let{key:i}=o;this.dimensionUpdaters[i]=this.getDimensionUpdaters(o),this.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:so}})}getDimensionUpdaters({key:t,accessor:o,pickingInfo:i,getBins:r,getDomain:s,getScaleFunc:a,nullValue:_}){return{key:t,accessor:o,pickingInfo:i,getBins:{updater:this.getDimensionSortedBins.bind(this),...r},getDomain:{updater:this.getDimensionValueDomain.bind(this),...s},getScaleFunc:{updater:this.getDimensionScale.bind(this),...a},attributeAccessor:this.getSubLayerDimensionAttribute(t,_)}}needUpdateDimensionStep(t,o,i,r){return Object.values(t.triggers).some(s=>s.updateTrigger?r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged[s.updateTrigger]):o[s.prop]!==i[s.prop])}getDimensionChanges(t,o,i){let r=[];for(let s in this.dimensionUpdaters){let a=ao.find(_=>this.needUpdateDimensionStep(this.dimensionUpdaters[s][_],t,o,i));a&&r.push(this.dimensionUpdaters[s][a].updater.bind(this,o,this.dimensionUpdaters[s]))}return r.length?r:null}getUpdateTriggers(t){let o=t.updateTriggers||{},i={};for(let r in this.dimensionUpdaters){let{accessor:s}=this.dimensionUpdaters[r];i[s]={},ao.forEach(a=>{Object.values(this.dimensionUpdaters[r][a].triggers).forEach(({prop:_,updateTrigger:n})=>{if(n){let l=o[n];typeof l=="object"&&!Array.isArray(l)?Object.assign(i[s],l):l!==void 0&&(i[s][_]=l)}else i[s][_]=t[_]})})}return i}getSortedBins(t){for(let o in this.dimensionUpdaters)this.getDimensionSortedBins(t,this.dimensionUpdaters[o])}getDimensionSortedBins(t,o){let{key:i}=o,{getValue:r}=this.state.dimensions[i],s=new H(this.state.layerData.data||[],{getValue:r,filterData:t._filterData});this.setDimensionState(i,{sortedBins:s}),this.getDimensionValueDomain(t,o)}getDimensionValueDomain(t,o){let{getDomain:i,key:r}=o,{triggers:{lowerPercentile:s,upperPercentile:a,scaleType:_}}=i,n=this.state.dimensions[r].sortedBins.getValueDomainByScale(t[_.prop],[t[s.prop],t[a.prop]]);this.setDimensionState(r,{valueDomain:n}),this.getDimensionScale(t,o)}getDimensionScale(t,o){let{key:i,getScaleFunc:r,getDomain:s}=o,{domain:a,range:_}=r.triggers,{scaleType:n}=s.triggers,{onSet:l}=r,R=t[_.prop],T=t[a.prop]||this.state.dimensions[i].valueDomain,g=qt(n&&t[n.prop])(T,R);typeof l=="object"&&typeof t[l.props]=="function"&&t[l.props](g.domain()),this.setDimensionState(i,{scaleFunc:g})}getSubLayerDimensionAttribute(t,o){return i=>{let{sortedBins:r,scaleFunc:s}=this.state.dimensions[t],a=r.binMap[i.index];if(a&&a.counts===0)return o;let _=a&&a.value,n=s.domain();return _>=n[0]&&_<=n[n.length-1]?s(_):o}}getSubLayerAccessors(t){let o={};for(let i in this.dimensionUpdaters){let{accessor:r}=this.dimensionUpdaters[i];o[r]=this.getSubLayerDimensionAttribute(t,i)}return o}getPickingInfo({info:t}){let o=t.picked&&t.index>-1,i=null;if(o){let r=this.state.layerData.data[t.index],s={};for(let a in this.dimensionUpdaters){let{pickingInfo:_}=this.dimensionUpdaters[a],{sortedBins:n}=this.state.dimensions[a],l=n.binMap[r.index]&&n.binMap[r.index].value;s[_]=l}i=Object.assign(s,r,{points:r.filteredPoints||r.points})}return t.picked=Boolean(i),t.object=i,t}getAccessor(t){return this.dimensionUpdaters.hasOwnProperty(t)?this.dimensionUpdaters[t].attributeAccessor:so}};function no(){}var _r={colorDomain:null,colorRange:U,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:no,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:no,gridAggregator:re,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:e=>e.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Xe=class extends B{initializeState(){let t=new W({getAggregator:i=>i.gridAggregator,getCellSize:i=>i.cellSize});this.state={cpuAggregator:t,aggregatorState:t.state},this.getAttributeManager().add({positions:{size:3,type:M.DOUBLE,accessor:"getPosition"}})}updateState(t){super.updateState(t),this.setState({aggregatorState:this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:o,cellSize:i,coverage:r,material:s,transitions:a}=this.props,{cpuAggregator:_}=this.state,n=this.getSubLayerClass("grid-cell",lo.GridCellLayer),l=this._getSublayerUpdateTriggers();return new n({cellSize:i,coverage:r,material:s,elevationScale:t,extruded:o,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:a&&{getFillColor:a.getColorValue||a.getColorWeight,getElevation:a.getElevationValue||a.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:l}),{data:_.state.layerData.data})}},k=Xe;(()=>{Xe.layerName="CPUGridLayer"})(),(()=>{Xe.defaultProps=_r})();var To=h(x(),1),co=h(L(),1);var se=Math.PI/3,nr=[0,se,2*se,3*se,4*se,5*se];function lr(e){return e[0]}function Ar(e){return e[1]}function _t(){var e=0,t=0,o=1,i=1,r=lr,s=Ar,a,_,n;function l(T){var c={},g=[],d,f=T.length;for(d=0;d<f;++d)if(!(isNaN(N=+r.call(null,p=T[d],d,T))||isNaN(C=+s.call(null,p,d,T)))){var p,N,C,O=Math.round(C=C/n),I=Math.round(N=N/_-(O&1)/2),u=C-O;if(Math.abs(u)*3>1){var X=N-I,fe=I+(N<I?-1:1)/2,j=O+(C<O?-1:1),m=N-fe,Q=C-j;X*X+u*u>m*m+Q*Q&&(I=fe+(O&1?1:-1)/2,O=j)}var dt=I+"-"+O,de=c[dt];de?de.push(p):(g.push(de=c[dt]=[p]),de.x=(I+(O&1)/2)*_,de.y=O*n)}return g}function R(T){var c=0,g=0;return nr.map(function(d){var f=Math.sin(d)*T,p=-Math.cos(d)*T,N=f-c,C=p-g;return c=f,g=p,[N,C]})}return l.hexagon=function(T){return"m"+R(T==null?a:+T).join("l")+"z"},l.centers=function(){for(var T=[],c=Math.round(t/n),g=Math.round(e/_),d=c*n;d<i+a;d+=n,++c)for(var f=g*_+(c&1)*_/2;f<o+_/2;f+=_)T.push([f,d]);return T},l.mesh=function(){var T=R(a).slice(0,4).join("l");return l.centers().map(function(c){return"M"+c+"m"+T}).join("")},l.x=function(T){return arguments.length?(r=T,l):r},l.y=function(T){return arguments.length?(s=T,l):s},l.radius=function(T){return arguments.length?(a=+T,_=a*2*Math.sin(se),n=a*1.5,l):a},l.size=function(T){return arguments.length?(e=t=0,o=+T[0],i=+T[1],l):[o-e,i-t]},l.extent=function(T){return arguments.length?(e=+T[0][0],t=+T[0][1],o=+T[1][0],i=+T[1][1],l):[[e,t],[o,i]]},l.radius(1)}var Ve=h(x(),1);function Ao(e,t){let{data:o,radius:i}=e,{viewport:r,attributes:s}=t,a=o.length?Rr(o,t):null,_=Tr(i,r,a),n=[],{iterable:l,objectInfo:R}=(0,Ve.createIterable)(o),T=s.positions.value,{size:c}=s.positions.getAccessor();for(let f of l){R.index++;let p=R.index*c,N=[T[p],T[p+1]];Number.isFinite(N[0])&&Number.isFinite(N[1])?n.push({screenCoord:r.projectFlat(N),source:f,index:R.index}):Ve.log.warn("HexagonLayer: invalid position")()}return{hexagons:_t().radius(_).x(f=>f.screenCoord[0]).y(f=>f.screenCoord[1])(n).map((f,p)=>({position:r.unprojectFlat([f.x,f.y]),points:f,index:p})),radiusCommon:_}}function Rr(e,t){let{attributes:o}=t,i=o.positions.value,{size:r}=o.positions.getAccessor(),s=1/0,a=1/0,_=-1/0,n=-1/0,l;for(l=0;l<r*e.length;l+=r){let R=i[l],T=i[l+1];Number.isFinite(R)&&Number.isFinite(T)&&(s=Math.min(R,s),_=Math.max(R,_),a=Math.min(T,a),n=Math.max(T,n))}return[s,a,_,n].every(Number.isFinite)?[(s+_)/2,(a+n)/2]:null}function Tr(e,t,o){let{unitsPerMeter:i}=t.getDistanceScales(o);return e*i[0]}function Ro(){}var cr={colorDomain:null,colorRange:U,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Ro,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Ro,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Ao,getPosition:{type:"accessor",value:e=>e.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},we=class extends B{initializeState(){let t=new W({getAggregator:i=>i.hexagonAggregator,getCellSize:i=>i.radius});this.state={cpuAggregator:t,aggregatorState:t.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:M.DOUBLE,accessor:"getPosition"}})}updateState(t){if(super.updateState(t),t.changeFlags.propsOrDataChanged){let o=this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==o.layerData){let{hexagonVertices:i}=o.layerData||{};this.setState({vertices:i&&this.convertLatLngToMeterOffset(i)})}this.setState({aggregatorState:o})}}convertLatLngToMeterOffset(t){let{viewport:o}=this.context;if(Array.isArray(t)&&t.length===6){let i=t[0],r=t[3],s=[(i[0]+r[0])/2,(i[1]+r[1])/2],a=o.projectFlat(s),{metersPerUnit:_}=o.getDistanceScales(s);return t.map(l=>{let R=o.projectFlat(l);return[(R[0]-a[0])*_[0],(R[1]-a[1])*_[1]]})}return To.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:o,coverage:i,material:r,transitions:s}=this.props,{aggregatorState:a,vertices:_}=this.state,n=this.getSubLayerClass("hexagon-cell",co.ColumnLayer),l=this._getSublayerUpdateTriggers(),R=_?{vertices:_,radius:1}:{radius:a.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new n({...R,diskResolution:6,elevationScale:t,extruded:o,coverage:i,material:r,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:s&&{getFillColor:s.getColorValue||s.getColorWeight,getElevation:s.getElevationValue||s.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:l}),{data:a.layerData.data})}},Ce=we;(()=>{we.layerName="HexagonLayer"})(),(()=>{we.defaultProps=cr})();var je=h(L(),1);var wo=h(x(),1);var E=.16666666666666666,A={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},ae=[A.W,A.SW,A.S],_e=[A.S,A.SE,A.E],ne=[A.E,A.NE,A.N],le=[A.NW,A.W,A.N],Ae=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5]],Re=[[-E,-.5],[E,-.5],[.5,-E],[.5,E]],Te=[[.5,-E],[.5,E],[E,.5],[-E,.5]],ce=[[-.5,E],[-.5,-E],[E,.5],[-E,.5]],go=[A.W,A.SW,A.SE,A.E],So=[A.S,A.SE,A.NE,A.N],fo=[A.NW,A.W,A.E,A.NE],Eo=[A.NW,A.SW,A.S,A.N],No=[[-.5,E],[-.5,-E],[.5,-E],[.5,E]],po=[[-E,-.5],[E,-.5],[E,.5],[-E,.5]],gr=[A.NW,A.SW,A.SE,A.NE],Co=[A.NW,A.SW,A.SE,A.E,A.N],Mo=[A.W,A.SW,A.SE,A.NE,A.N],Oo=[A.NW,A.W,A.S,A.SE,A.NE],Io=[A.NW,A.SW,A.S,A.E,A.NE],ho=[A.NW,A.W,[.5,-E],[.5,E],A.N],Fo=[[-E,-.5],[E,-.5],A.E,A.NE,A.N],Do=[[-.5,E],[-.5,-E],A.S,A.SE,A.E],xo=[A.W,A.SW,A.S,[E,.5],[-E,.5]],Bo=[A.NW,A.W,[-E,-.5],[E,-.5],A.N],Po=[[-.5,E],[-.5,-E],A.E,A.NE,A.N],Uo=[A.S,A.SE,A.E,[E,.5],[-E,.5]],uo=[A.W,A.SW,A.S,[.5,-E],[.5,E]],vo=[A.W,A.SW,A.SE,A.E,[E,.5],[-E,.5]],yo=[[-.5,E],[-.5,-E],A.S,A.SE,A.NE,A.N],Ho=[A.NW,A.W,[-E,-.5],[E,-.5],A.E,A.NE],bo=[A.NW,A.SW,A.S,[.5,-E],[.5,E],A.N],ge=[A.W,A.SW,A.S,A.E,A.NE,A.N],Se=[A.NW,A.W,A.S,A.SE,A.E,A.N],Ke=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5],A.E,A.NE,A.N],ze=[A.W,A.SW,A.S,[.5,-E],[.5,E],[E,.5],[-E,.5]],Ye=[A.NW,A.W,[-E,-.5],[E,-.5],[.5,-E],[.5,E],A.N],ke=[[-.5,E],[-.5,-E],A.S,A.SE,A.E,[E,.5],[-E,.5]],Wo=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5],[.5,-E],[.5,E],[E,.5],[-E,.5]],Xo={0:[],1:[[A.W,A.S]],2:[[A.S,A.E]],3:[[A.W,A.E]],4:[[A.N,A.E]],5:{0:[[A.W,A.S],[A.N,A.E]],1:[[A.W,A.N],[A.S,A.E]]},6:[[A.N,A.S]],7:[[A.W,A.N]],8:[[A.W,A.N]],9:[[A.N,A.S]],10:{0:[[A.W,A.N],[A.S,A.E]],1:[[A.W,A.S],[A.N,A.E]]},11:[[A.N,A.E]],12:[[A.W,A.E]],13:[[A.S,A.E]],14:[[A.W,A.S]],15:[]};function S(e){return parseInt(e,4)}var Vo={[S("0000")]:[],[S("2222")]:[],[S("2221")]:[ae],[S("2212")]:[_e],[S("2122")]:[ne],[S("1222")]:[le],[S("0001")]:[ae],[S("0010")]:[_e],[S("0100")]:[ne],[S("1000")]:[le],[S("2220")]:[Ae],[S("2202")]:[Re],[S("2022")]:[Te],[S("0222")]:[ce],[S("0002")]:[Ae],[S("0020")]:[Re],[S("0200")]:[Te],[S("2000")]:[ce],[S("0011")]:[go],[S("0110")]:[So],[S("1100")]:[fo],[S("1001")]:[Eo],[S("2211")]:[go],[S("2112")]:[So],[S("1122")]:[fo],[S("1221")]:[Eo],[S("2200")]:[No],[S("2002")]:[po],[S("0022")]:[No],[S("0220")]:[po],[S("1111")]:[gr],[S("1211")]:[Co],[S("2111")]:[Mo],[S("1112")]:[Oo],[S("1121")]:[Io],[S("1011")]:[Co],[S("0111")]:[Mo],[S("1110")]:[Oo],[S("1101")]:[Io],[S("1200")]:[ho],[S("0120")]:[Fo],[S("0012")]:[Do],[S("2001")]:[xo],[S("1022")]:[ho],[S("2102")]:[Fo],[S("2210")]:[Do],[S("0221")]:[xo],[S("1002")]:[Bo],[S("2100")]:[Po],[S("0210")]:[Uo],[S("0021")]:[uo],[S("1220")]:[Bo],[S("0122")]:[Po],[S("2012")]:[Uo],[S("2201")]:[uo],[S("0211")]:[vo],[S("2110")]:[yo],[S("1102")]:[Ho],[S("1021")]:[bo],[S("2011")]:[vo],[S("0112")]:[yo],[S("1120")]:[Ho],[S("1201")]:[bo],[S("2101")]:[ge],[S("0121")]:[ge],[S("1012")]:[Se],[S("1210")]:[Se],[S("0101")]:{0:[ae,ne],1:[ge],2:[ge]},[S("1010")]:{0:[le,_e],1:[Se],2:[Se]},[S("2121")]:{0:[ge],1:[ge],2:[ae,ne]},[S("1212")]:{0:[Se],1:[Se],2:[le,_e]},[S("2120")]:{0:[Ke],1:[Ke],2:[Ae,ne]},[S("2021")]:{0:[ze],1:[ze],2:[ae,Te]},[S("1202")]:{0:[Ye],1:[Ye],2:[le,Re]},[S("0212")]:{0:[ke],1:[ke],2:[_e,ce]},[S("0102")]:{0:[Ae,ne],1:[Ke],2:[Ke]},[S("0201")]:{0:[ae,Te],1:[ze],2:[ze]},[S("1020")]:{0:[le,Re],1:[Ye],2:[Ye]},[S("2010")]:{0:[_e,ce],1:[ke],2:[ke]},[S("2020")]:{0:[ce,Re],1:[Wo],2:[Ae,Te]},[S("0202")]:{0:[Te,Ae],1:[Wo],2:[ce,Re]}};var J={ISO_LINES:1,ISO_BANDS:2},Sr={zIndex:0,zOffset:.005};function Me(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function Ko(e){let{cellWeights:t,x:o,y:i,width:r,height:s}=e,a=e.threshold;e.thresholdValue&&(wo.log.deprecated("thresholdValue","threshold")(),a=e.thresholdValue);let _=o<0,n=o>=r-1,l=i<0,R=i>=s-1,T=_||n||l||R,c={},g={};_||R?g.top=0:(c.top=t[(i+1)*r+o],g.top=Me(c.top,a)),n||R?g.topRight=0:(c.topRight=t[(i+1)*r+o+1],g.topRight=Me(c.topRight,a)),n||l?g.right=0:(c.right=t[i*r+o+1],g.right=Me(c.right,a)),_||l?g.current=0:(c.current=t[i*r+o],g.current=Me(c.current,a));let{top:d,topRight:f,right:p,current:N}=g,C=-1;Number.isFinite(a)&&(C=d<<3|f<<2|p<<1|N),Array.isArray(a)&&(C=d<<6|f<<4|p<<2|N);let O=0;return T||(O=Me((c.top+c.topRight+c.right+c.current)/4,a)),{code:C,meanCode:O}}function nt(e){let{gridOrigin:t,cellSize:o,x:i,y:r,code:s,meanCode:a,type:_=J.ISO_LINES}=e,n={...Sr,...e.thresholdData},l=_===J.ISO_BANDS?Vo[s]:Xo[s];Array.isArray(l)||(l=l[a]);let R=n.zIndex*n.zOffset,T=(i+1)*o[0],c=(r+1)*o[1],g=t[0]+T,d=t[1]+c;if(_===J.ISO_BANDS){let p=[];return l.forEach(N=>{let C=[];N.forEach(O=>{let I=g+O[0]*o[0],u=d+O[1]*o[1];C.push([I,u,R])}),p.push(C)}),p}let f=[];return l.forEach(p=>{p.forEach(N=>{let C=g+N[0]*o[0],O=d+N[1]*o[1];f.push([C,O,R])})}),f}function zo({thresholdData:e,cellWeights:t,gridSize:o,gridOrigin:i,cellSize:r}){let s=[],a=[],_=o[0],n=o[1],l=0,R=0;for(let T of e){let{contour:c}=T,{threshold:g}=c;for(let d=-1;d<_;d++)for(let f=-1;f<n;f++){let{code:p,meanCode:N}=Ko({cellWeights:t,threshold:g,x:d,y:f,width:_,height:n}),C={type:J.ISO_BANDS,gridOrigin:i,cellSize:r,x:d,y:f,width:_,height:n,code:p,meanCode:N,thresholdData:T};if(Array.isArray(g)){C.type=J.ISO_BANDS;let O=nt(C);for(let I of O)a[R++]={vertices:I,contour:c}}else{C.type=J.ISO_LINES;let O=nt(C);for(let I=0;I<O.length;I+=2)s[l++]={start:O[I],end:O[I+1],contour:c}}}}return{contourSegments:s,contourPolygons:a}}var Zo=h(x(),1);var Yo=[255,255,255,255],fr=1,dr=1,Er={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:dr}],optional:!0,compare:3},zOffset:.005},ko="positions",Nr={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Ze=class extends b{initializeState(){super.initializeAggregationLayer({dimensions:Nr}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:F.SUM}}}),this.getAttributeManager().add({[ko]:{size:3,accessor:"getPosition",type:M.DOUBLE,fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(t){super.updateState(t);let o=!1,{oldProps:i,props:r}=t,{aggregationDirty:s}=this.state;(i.contours!==r.contours||i.zOffset!==r.zOffset)&&(o=!0,this._updateThresholdData(t.props)),this.getNumInstances()>0&&(s||o)&&this._generateContours()}renderLayers(){let{contourSegments:t,contourPolygons:o}=this.state.contourData,i=this.getSubLayerClass("lines",je.LineLayer),r=this.getSubLayerClass("bands",je.SolidPolygonLayer),s=t&&t.length>0&&new i(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:_=>_.start,getTargetPosition:_=>_.end,getColor:_=>_.contour.color||Yo,getWidth:_=>_.contour.strokeWidth||fr}),a=o&&o.length>0&&new r(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:_=>_.vertices,getFillColor:_=>_.contour.color||Yo});return[s,a]}updateAggregationState(t){let{props:o,oldProps:i}=t,{cellSize:r,coordinateSystem:s}=o,{viewport:a}=this.context,_=i.cellSize!==r,n=o.gpuAggregation;this.state.gpuAggregation!==o.gpuAggregation&&n&&!D.isSupported(this.context.device)&&(Zo.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),n=!1);let l=n!==this.state.gpuAggregation;this.setState({gpuAggregation:n});let{dimensions:R}=this.state,T=this.isAttributeChanged(ko),{data:c,weights:g}=R,{boundingBox:d}=this.state;if(T&&(d=He(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:d})),T||_){let{gridOffset:N,translation:C,width:O,height:I,numCol:u,numRow:X}=be(d,r,a,s);this.allocateResources(X,u),this.setState({gridOffset:N,boundingBox:d,translation:C,posOffset:C.slice(),gridOrigin:[-1*C[0],-1*C[1]],width:O,height:I,numCol:u,numRow:X})}let f=T||l||this.isAggregationDirty(t,{dimension:c,compareAll:n}),p=this.isAggregationDirty(t,{dimension:g});p&&this._updateAccessors(t),(f||p)&&this._resetResults(),this.setState({aggregationDataDirty:f,aggregationWeightsDirty:p})}_updateAccessors(t){let{getWeight:o,aggregation:i,data:r}=t.props,{count:s}=this.state.weights;s&&(s.getWeight=o,s.operation=F[i]),this.setState({getValue:ee(i,o,{data:r})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}_generateContours(){let{numCol:t,numRow:o,gridOrigin:i,gridOffset:r,thresholdData:s}=this.state,{count:a}=this.state.weights,{aggregationData:_}=a;_||(_=a.aggregationBuffer.readSyncWebGL2(),a.aggregationData=_);let{cellWeights:n}=D.getCellData({countsData:_}),l=zo({thresholdData:s,cellWeights:n,gridSize:[t,o],gridOrigin:i,cellSize:[r.xOffset,r.yOffset]});this.setState({contourData:l})}_updateThresholdData(t){let{contours:o,zOffset:i}=t,r=o.length,s=new Array(r);for(let a=0;a<r;a++){let _=o[a];s[a]={contour:_,zIndex:_.zIndex||a,zOffset:i}}this.setState({thresholdData:s})}},Oe=Ze;(()=>{Ze.layerName="ContourLayer"})(),(()=>{Ze.defaultProps=Er})();var Lo=h(x(),1);var Jo=h(x(),1);var P=h(x(),1),Qo=h(q(),1);var qo=h(q(),1);var jo=`#version 300 es
|
|
330
|
+
fragColor = vColor;
|
|
331
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
332
|
+
}
|
|
333
|
+
`;var wi=[0,0,0,0],Fi=[0,255,0,255],Ii=["minColor","maxColor","colorRange","colorDomain"],Ri={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:D},De=class extends te.Layer{getShaders(){return{vs:Rt,fs:Bt,modules:[te.picking]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e);let{oldProps:t,props:o,changeFlags:i}=e,r=this.getAttributeManager();o.numInstances!==t.numInstances?r.invalidateAll():t.cellSizePixels!==o.cellSizePixels&&r.invalidate("instancePositions"),this._updateUniforms(t,o,i)}draw({uniforms:e}){let{parameters:t,maxTexture:o}=this.props,i=this.props.minColor||wi,r=this.props.maxColor||Fi,s=this.props.colorDomain||[1,0],a=this.state.model;a.setUniforms(e),a.setBindings({maxTexture:o}),a.setUniforms({minColor:i,maxColor:r,colorDomain:s}),a.setParameters({depthWriteEnabled:!1,...t}),a.draw(this.context.renderPass)}calculateInstancePositions(e,{numInstances:t}){let{width:o,height:i}=this.context.viewport,{cellSizePixels:r}=this.props,s=Math.ceil(o/r),{value:a,size:l}=e;for(let c=0;c<t;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 Oe.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Oe.Geometry({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})})}_shouldUseMinMax(){let{minColor:e,maxColor:t,colorDomain:o,colorRange:i}=this.props;return e||t?(te.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(o||i)}_updateUniforms(e,t,o){let i=this.state.model;if(Ii.some(r=>e[r]!==t[r])&&i.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),e.colorRange!==t.colorRange&&i.setUniforms({colorRange:z(t.colorRange)}),e.cellMarginPixels!==t.cellMarginPixels||e.cellSizePixels!==t.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})}}},ee=De;(()=>{De.layerName="ScreenGridCellLayer"})(),(()=>{De.defaultProps=Ri})();var to=M(E(),1);var oe=M(E(),1);function Ut(n,e){let t={};for(let o in n)e.includes(o)||(t[o]=n[o]);return t}var ot=class extends oe.CompositeLayer{initializeAggregationLayer(e){super.initializeState(this.context),this.setState({ignoreProps:Ut(this.constructor._propTypes,e.data.props),dimensions:e})}updateState(e){super.updateState(e);let{changeFlags:t}=e;if(t.extensionsChanged){let o=this.getShaders({});o&&o.defines&&(o.defines.NON_INSTANCED_MODEL=1),this.updateShaders(o)}this._updateAttributes()}updateAttributes(e){this.setState({changedAttributes:e})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:e,mousePosition:t,device:o}=this.context;return Object.assign(Object.create(this.props),{viewport:e,mousePosition:t,picking:{isActive:0},devicePixelRatio:o.canvasContext.cssToDeviceRatio()})}updateShaders(e){}isAggregationDirty(e,t={}){let{props:o,oldProps:i,changeFlags:r}=e,{compareAll:s=!1,dimension:a}=t,{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,oe._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(e){let{changedAttributes:t}=this.state;return e?t&&t[e]!==void 0:!Bi(t)}_getAttributeManager(){return new oe.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}},P=ot;(()=>{ot.layerName="AggregationLayer"})();function Bi(n){let e=!0;for(let t in n){e=!1;break}return e}var zt=M(E(),1);function Le(n,e,t){let o=t;return o.domain=()=>n,o.range=()=>e,o}function Wt(n,e){return Le(n,e,o=>ji(n,e,o))}function Ui(n,e){return Le(n,e,o=>Xi(n,e,o))}function Wi(n,e){let t=n.sort(Gt),o=0,i=Math.max(1,e.length),r=new Array(i-1);for(;++o<i;)r[o-1]=zi(t,o/i);let s=a=>Hi(r,e,a);return s.thresholds=()=>r,Le(n,e,s)}function Gt(n,e){return n-e}function zi(n,e){let t=n.length;if(e<=0||t<2)return n[0];if(e>=1)return n[t-1];let o=(t-1)*e,i=Math.floor(o),r=n[i],s=n[i+1];return r+(s-r)*(o-i)}function Gi(n,e){let t=0,o=n.length;for(;t<o;){let i=t+o>>>1;Gt(n[i],e)>0?o=i:t=i+1}return t}function Hi(n,e,t){return e[Gi(n,t)]}function Vi(n,e,t,o){let i=`${o}`,r=e.get(i);return r===void 0&&(r=n.push(o),e.set(i,r)),t[(r-1)%t.length]}function ki(n,e){let t=new Map,o=[];for(let r of n){let s=`${r}`;t.has(s)||t.set(s,o.push(r))}return Le(n,e,r=>Vi(o,t,e,r))}function ji(n,e,t){let o=n[1]-n[0];if(o<=0)return zt.log.warn("quantizeScale: invalid domain, returning range[0]")(),e[0];let i=o/e.length,r=Math.floor((t-n[0])/i),s=Math.max(Math.min(r,e.length-1),0);return e[s]}function Xi(n,e,t){return(t-n[0])/(n[1]-n[0])*(e[1]-e[0])+e[0]}function Ht(n){return n!=null}function qi(n){let e=[];return n.forEach(t=>{!e.includes(t)&&Ht(t)&&e.push(t)}),e}function Vt(n,e){return(typeof e=="function"?n.map(e):n).filter(Ht)}function kt(n,e){return Vt(n,e)}function jt(n,e){return qi(Vt(n,e))}function Xt(n,e,t){return Math.max(e,Math.min(t,n))}function qt(n){switch(n){case"quantize":return Wt;case"linear":return Ui;case"quantile":return Wi;case"ordinal":return ki;default:return Wt}}var $t=n=>n.length,Yi=3402823466e29,Kt=n=>n.points,Qt=n=>n.index,Yt=(n,e)=>n<e?-1:n>e?1:n>=e?0:NaN,$i={getValue:$t,getPoints:Kt,getIndex:Qt,filterData:null},w=class{constructor(e=[],t=$i){this.aggregatedBins=this.getAggregatedBins(e,t),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(e,t){let{getValue:o=$t,getPoints:i=Kt,getIndex:r=Qt,filterData:s}=t,a=typeof s=="function",l=e.length,c=[],g=0;for(let f=0;f<l;f++){let d=e[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(e){let t=this.sortedBins.length;if(t<2)return[0,0];let[o,i]=e.map(a=>Xt(a,0,100)),r=Math.ceil(o/100*(t-1)),s=Math.floor(i/100*(t-1));return[r,s]}getBinMap(){let e={};for(let t of this.aggregatedBins)e[t.i]=t;return e}_updateMinMaxValues(){let e=0,t=0,o=Yi,i=0;for(let r of this.aggregatedBins)e=e>r.counts?e:r.counts,t=t>r.value?t:r.value,o=o<r.value?o:r.value,i+=r.counts;this.maxCount=e,this.maxValue=t,this.minValue=o,this.totalCount=i}getValueRange(e){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((i,r)=>Yt(i.value,r.value))),!this.sortedBins.length)return[];let t=0,o=this.sortedBins.length-1;if(Array.isArray(e)){let i=this._percentileToIndex(e);t=i[0],o=i[1]}return[this.sortedBins[t].value,this.sortedBins[o].value]}getValueDomainByScale(e,[t=0,o=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((r,s)=>Yt(r.value,s.value))),!this.sortedBins.length)return[];let i=this._percentileToIndex([t,o]);return this._getScaleDomain(e,i)}_getScaleDomain(e,[t,o]){let i=this.sortedBins;switch(e){case"quantize":case"linear":return[i[t].value,i[o].value];case"quantile":return kt(i.slice(t,o+1),r=>r.value);case"ordinal":return jt(i,r=>r.value);default:return[i[t].value,i[o].value]}}};var eo=M(E(),1);var G=M(E(),1),Jt=6378e3;function we(n){return Number.isFinite(n)?n:0}function Fe(n,e){let t=n.positions.value,o=1/0,i=-1/0,r=1/0,s=-1/0,a,l;for(let g=0;g<e;g++)l=t[g*3],a=t[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:we(r),xMax:we(s),yMin:we(o),yMax:we(i)}}function Ki(n,e,t,o){let{width:i,height:r}=o,s=t===G.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-r/2]:[-180,-90];G.log.assert(t===G.COORDINATE_SYSTEM.CARTESIAN||t===G.COORDINATE_SYSTEM.LNGLAT||t===G.COORDINATE_SYSTEM.DEFAULT);let{xMin:a,yMin:l}=n;return[-1*(Zt(a-s[0],e.xOffset)+s[0]),-1*(Zt(l-s[1],e.yOffset)+s[1])]}function Zt(n,e){let t=n<0?-1:1,o=t<0?Math.abs(n)+e:Math.abs(n);return o=Math.floor(o/e)*e,o*t}function it(n,e,t=!0){if(!t)return{xOffset:e,yOffset:e};let{yMin:o,yMax:i}=n,r=(o+i)/2;return Qi(e,r)}function Ie(n,e,t,o){let i=it(n,e,o!==G.COORDINATE_SYSTEM.CARTESIAN),r=Ki(n,i,o,t),{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 Qi(n,e){let t=Zi(n),o=Ji(e,n);return{yOffset:t,xOffset:o}}function Zi(n){return n/Jt*(180/Math.PI)}function Ji(n,e){return e/Jt*(180/Math.PI)/Math.cos(n*Math.PI/180)}function ie(n,e){let t=er(n,e),o=tr(t);return{gridHash:t.gridHash,gridOffset:t.gridOffset,data:o}}function er(n,e){let{data:t=[],cellSize:o}=n,{attributes:i,viewport:r,projectPoints:s,numInstances:a}=e,l=i.positions.value,{size:c}=i.positions.getAccessor(),g=e.boundingBox||or(i.positions,a),f=e.posOffset||[180,90],d=e.gridOffset||it(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:b}=(0,eo.createIterable)(t),_=new Array(3);for(let O of y){b.index++,_[0]=l[b.index*c],_[1]=l[b.index*c+1],_[2]=c>=3?l[b.index*c+2]:0;let[B,me]=s?r.project(_):_;if(Number.isFinite(B)&&Number.isFinite(me)){let k=Math.floor((me+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:b.index})}}}return{gridHash:S,gridOffset:d,offsets:[f[0]*-1,f[1]*-1]}}function tr({gridHash:n,gridOffset:e,offsets:t}){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:[t[0]+e.xOffset*l,t[1]+e.yOffset*a],...n[r]}}return o}function or(n,e){let t=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<e;g++)c=t[g*o],l=t[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 rt=class extends P{initializeAggregationLayer({dimensions:e}){super.initializeAggregationLayer(e),this.setState({layerData:{},gpuGridAggregator:new C(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:ie})}updateState(e){super.updateState(e),this.updateAggregationState(e);let{aggregationDataDirty:t,aggregationWeightsDirty:o,gpuAggregation:i}=this.state;if(this.getNumInstances()<=0)return;let r=!1;(t||i&&o)&&(this._updateAggregation(e),r=!0),!i&&(t||o)&&(this._updateWeightBins(),this._uploadAggregationResults(),r=!0),this.setState({aggregationDirty:r})}finalizeState(e){let{count:t}=this.state.weights;t&&t.aggregationBuffer&&t.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(e)}updateShaders(e){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(e)}updateAggregationState(e){to.log.assert(!1)}allocateResources(e,t){if(this.state.numRow!==e||this.state.numCol!==t){let o=t*e*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:e,maxMinData:t,maxData:o,minData:i}){let{count:r}=this.state.weights;r&&(r.aggregationData=e,r.maxMinData=t,r.maxData=o,r.minData=i)}_updateAggregation(e){let{cpuGridAggregator:t,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}=e,{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=t(p,{gridOffset:i,projectPoints:c,attributes:h,viewport:x,posOffset:r,boundingBox:l});this.setState({layerData:S})}}_updateWeightBins(){let{getValue:e}=this.state,t=new w(this.state.layerData.data||[],{getValue:e});this.setState({sortedBins:t})}_uploadAggregationResults(){let{numCol:e,numRow:t}=this.state,{data:o}=this.state.layerData,{aggregatedBins:i,minValue:r,maxValue:s,totalCount:a}=this.state.sortedBins,l=4,c=e*t*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,b=(h+A*e)*l;g[b]=S,g[b+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})}},F=rt;(()=>{rt.layerName="GridAggregationLayer"})();var ir={...ee.defaultProps,getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},oo="positions",rr={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Re=class extends F{initializeState(){super.initializeAggregationLayer({dimensions:rr,getCellSize:o=>o.cellSizePixels});let e={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:e,subLayerData:{attributes:{}},maxTexture:e.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[oo]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:e}){return this.state.supported&&e.somethingChanged}updateState(e){super.updateState(e)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:e,numRow:t,numCol:o,weights:i}=this.state,{updateTriggers:r}=this.props,{aggregationBuffer:s}=i.count,a=this.getSubLayerClass("cells",ee);return new a(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:r}),{data:{attributes:{instanceCounts:s}},maxTexture:e,numInstances:t*o})}finalizeState(e){super.finalizeState(e);let{aggregationBuffer:t,maxBuffer:o,maxTexture:i}=this.state;t?.delete(),o?.delete(),i?.delete()}getPickingInfo({info:e}){let{index:t}=e;if(t>=0){let{gpuGridAggregator:o,gpuAggregation:i,weights:r}=this.state,s=i?o.getData("count"):r.count;e.object=C.getAggregationData({pixelIndex:t,...s})}return e}updateResults({aggregationData:e,maxData:t}){let{count:o}=this.state.weights;o.aggregationData=e,o.aggregationBuffer.write(e),o.maxData=t,o.maxTexture.setImageData({data:t})}updateAggregationState(e){let t=e.props.cellSizePixels,o=e.oldProps.cellSizePixels!==t,{viewportChanged:i}=e.changeFlags,r=e.props.gpuAggregation;this.state.gpuAggregation!==e.props.gpuAggregation&&r&&!C.isSupported(this.context.device)&&(io.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(oo),{dimensions:l}=this.state,{data:c,weights:g}=l,f=a||s||i||this.isAggregationDirty(e,{compareAll:r,dimension:c}),d=this.isAggregationDirty(e,{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/t),S=Math.ceil(h/t);this.allocateResources(S,A),this.setState({scaling:[x/2,-h/2,1],gridOffset:{xOffset:t,yOffset:t},width:x,height:h,numCol:A,numRow:S})}d&&this._updateAccessors(e),(f||d)&&this._resetResults()}_updateAccessors(e){let{getWeight:t,aggregation:o,data:i}=e.props,{count:r}=this.state.weights;r&&(r.getWeight=t,r.operation=T[o]),this.setState({getValue:Q(o,t,{data:i})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}},Se=Re;(()=>{Re.layerName="ScreenGridLayer"})(),(()=>{Re.defaultProps=ir})();var lo=M($(),1);function ro(){}var no=["getBins","getDomain","getScaleFunc"],so=[{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}],nr=n=>n.cellSize,I=class{constructor(e){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=e.getCellSize||nr,this._getAggregator=e.getAggregator,this._addDimension(e.dimensions||so)}static defaultDimensions(){return so}updateState(e,t){let{oldProps:o,props:i,changeFlags:r}=e;this.updateGetValueFuncs(o,i,r);let s=this.needsReProjectPoints(o,i,r),a=!1;return r.dataChanged||s?(this.getAggregatedData(i,t),a=!0):((this.getDimensionChanges(o,i,r)||[]).forEach(c=>typeof c=="function"&&c()),a=!0),this.setState({aggregationDirty:a}),this.state}setState(e){this.state={...this.state,...e}}setDimensionState(e,t){this.setState({dimensions:{...this.state.dimensions,[e]:{...this.state.dimensions[e],...t}}})}normalizeResult(e={}){return e.hexagons?{data:e.hexagons,...e}:e.layerData?{data:e.layerData,...e}:e}getAggregatedData(e,t){let i=this._getAggregator(e)(e,t);this.setState({layerData:this.normalizeResult(i)}),this.changeFlags={layerData:!0},this.getSortedBins(e)}updateGetValueFuncs(e,t,o){for(let i in this.dimensionUpdaters){let{value:r,weight:s,aggregation:a}=this.dimensionUpdaters[i].getBins.triggers,l=t[r.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[i].getBins,e,t,o)&&(l?l=Tt(l,{data:t.data}):l=Q(t[a.prop],t[s.prop],{data:t.data})),l&&this.setDimensionState(i,{getValue:l})}}needsReProjectPoints(e,t,o){return this._getCellSize(e)!==this._getCellSize(t)||this._getAggregator(e)!==this._getAggregator(t)||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPosition)}addDimension(e){this._addDimension(e)}_addDimension(e=[]){e.forEach(t=>{let{key:o}=t;this.dimensionUpdaters[o]=this.getDimensionUpdaters(t),this.state.dimensions[o]={getValue:null,domain:null,sortedBins:null,scaleFunc:ro}})}getDimensionUpdaters({key:e,accessor:t,pickingInfo:o,getBins:i,getDomain:r,getScaleFunc:s,nullValue:a}){return{key:e,accessor:t,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(e,a)}}needUpdateDimensionStep(e,t,o,i){return Object.values(e.triggers).some(r=>r.updateTrigger?i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged[r.updateTrigger]):t[r.prop]!==o[r.prop])}getDimensionChanges(e,t,o){let i=[];for(let r in this.dimensionUpdaters){let s=no.find(a=>this.needUpdateDimensionStep(this.dimensionUpdaters[r][a],e,t,o));s&&i.push(this.dimensionUpdaters[r][s].updater.bind(this,t,this.dimensionUpdaters[r]))}return i.length?i:null}getUpdateTriggers(e){let t=e.updateTriggers||{},o={};for(let i in this.dimensionUpdaters){let{accessor:r}=this.dimensionUpdaters[i];o[r]={},no.forEach(s=>{Object.values(this.dimensionUpdaters[i][s].triggers).forEach(({prop:a,updateTrigger:l})=>{if(l){let c=t[l];typeof c=="object"&&!Array.isArray(c)?Object.assign(o[r],c):c!==void 0&&(o[r][a]=c)}else o[r][a]=e[a]})})}return o}getSortedBins(e){for(let t in this.dimensionUpdaters)this.getDimensionSortedBins(e,this.dimensionUpdaters[t])}getDimensionSortedBins(e,t){let{key:o}=t,{getValue:i}=this.state.dimensions[o],r=new w(this.state.layerData.data||[],{getValue:i,filterData:e._filterData});this.setDimensionState(o,{sortedBins:r}),this.getDimensionValueDomain(e,t)}getDimensionValueDomain(e,t){let{getDomain:o,key:i}=t,{triggers:{lowerPercentile:r,upperPercentile:s,scaleType:a}}=o,l=this.state.dimensions[i].sortedBins.getValueDomainByScale(e[a.prop],[e[r.prop],e[s.prop]]);this.setDimensionState(i,{valueDomain:l}),this.getDimensionScale(e,t)}getDimensionScale(e,t){let{key:o,getScaleFunc:i,getDomain:r}=t,{domain:s,range:a}=i.triggers,{scaleType:l}=r.triggers,{onSet:c}=i,g=e[a.prop],f=e[s.prop]||this.state.dimensions[o].valueDomain,p=qt(l&&e[l.prop])(f,g);typeof c=="object"&&typeof e[c.props]=="function"&&e[c.props](p.domain()),this.setDimensionState(o,{scaleFunc:p})}getSubLayerDimensionAttribute(e,t){return o=>{let{sortedBins:i,scaleFunc:r}=this.state.dimensions[e],s=i.binMap[o.index];if(s&&s.counts===0)return t;let a=s&&s.value,l=r.domain();return a>=l[0]&&a<=l[l.length-1]?r(a):t}}getSubLayerAccessors(e){let t={};for(let o in this.dimensionUpdaters){let{accessor:i}=this.dimensionUpdaters[o];t[i]=this.getSubLayerDimensionAttribute(e,o)}return t}getPickingInfo({info:e}){let t=e.picked&&e.index>-1,o=null;if(t){let i=this.state.layerData.data[e.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 e.picked=Boolean(o),e.object=o,e}getAccessor(e){return this.dimensionUpdaters.hasOwnProperty(e)?this.dimensionUpdaters[e].attributeAccessor:ro}};function ao(){}var sr={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:ao,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:ao,gridAggregator:ie,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}},Be=class extends P{initializeState(){let e=new I({getAggregator:o=>o.gridAggregator,getCellSize:o=>o.cellSize});this.state={cpuAggregator:e,aggregatorState:e.state},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){super.updateState(e),this.setState({aggregatorState:this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:t,cellSize:o,coverage:i,material:r,transitions:s}=this.props,{cpuAggregator:a}=this.state,l=this.getSubLayerClass("grid-cell",lo.GridCellLayer),c=this._getSublayerUpdateTriggers();return new l({cellSize:o,coverage:i,material:r,elevationScale:e,extruded:t,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=Be;(()=>{Be.layerName="CPUGridLayer"})(),(()=>{Be.defaultProps=sr})();var go=M(E(),1),fo=M($(),1);var re=Math.PI/3,ar=[0,re,2*re,3*re,4*re,5*re];function lr(n){return n[0]}function cr(n){return n[1]}function nt(){var n=0,e=0,t=1,o=1,i=lr,r=cr,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,b=Math.round(y=y/l),_=Math.round(S=S/a-(b&1)/2),O=y-b;if(Math.abs(O)*3>1){var B=S-_,me=_+(S<_?-1:1)/2,k=b+(y<b?-1:1),j=S-me,X=y-k;B*B+O*O>j*j+X*X&&(_=me+(b&1?1:-1)/2,b=k)}var mt=_+"-"+b,he=d[mt];he?he.push(A):(p.push(he=d[mt]=[A]),he.x=(_+(b&1)/2)*a,he.y=b*l)}return p}function g(f){var d=0,p=0;return ar.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(e/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<t+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(re),l=s*1.5,c):s},c.size=function(f){return arguments.length?(n=e=0,t=+f[0],o=+f[1],c):[t-n,o-e]},c.extent=function(f){return arguments.length?(n=+f[0][0],e=+f[0][1],t=+f[1][0],o=+f[1][1],c):[[n,e],[t,o]]},c.radius(1)}var Ue=M(E(),1);function co(n,e){let{data:t,radius:o}=n,{viewport:i,attributes:r}=e,s=t.length?ur(t,e):null,a=gr(o,i,s),l=[],{iterable:c,objectInfo:g}=(0,Ue.createIterable)(t),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}):Ue.log.warn("HexagonLayer: invalid position")()}return{hexagons:nt().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 ur(n,e){let{attributes:t}=e,o=t.positions.value,{size:i}=t.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 gr(n,e,t){let{unitsPerMeter:o}=e.getDistanceScales(t);return n*o[0]}function uo(){}var fr={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:uo,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:uo,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:co,getPosition:{type:"accessor",value:n=>n.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},We=class extends P{initializeState(){let e=new I({getAggregator:o=>o.hexagonAggregator,getCellSize:o=>o.radius});this.state={cpuAggregator:e,aggregatorState:e.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(e){if(super.updateState(e),e.changeFlags.propsOrDataChanged){let t=this.state.cpuAggregator.updateState(e,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==t.layerData){let{hexagonVertices:o}=t.layerData||{};this.setState({vertices:o&&this.convertLatLngToMeterOffset(o)})}this.setState({aggregatorState:t})}}convertLatLngToMeterOffset(e){let{viewport:t}=this.context;if(Array.isArray(e)&&e.length===6){let o=e[0],i=e[3],r=[(o[0]+i[0])/2,(o[1]+i[1])/2],s=t.projectFlat(r),{metersPerUnit:a}=t.getDistanceScales(r);return e.map(c=>{let g=t.projectFlat(c);return[(g[0]-s[0])*a[0],(g[1]-s[1])*a[1]]})}return go.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:e}){return this.state.cpuAggregator.getPickingInfo({info:e})}_onGetSublayerColor(e){return this.state.cpuAggregator.getAccessor("fillColor")(e)}_onGetSublayerElevation(e){return this.state.cpuAggregator.getAccessor("elevation")(e)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:e,extruded:t,coverage:o,material:i,transitions:r}=this.props,{aggregatorState:s,vertices:a}=this.state,l=this.getSubLayerClass("hexagon-cell",fo.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:e,extruded:t,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})}},Ae=We;(()=>{We.layerName="HexagonLayer"})(),(()=>{We.defaultProps=fr})();var je=M($(),1);var Wo=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]},ne=[u.W,u.SW,u.S],se=[u.S,u.SE,u.E],ae=[u.E,u.NE,u.N],le=[u.NW,u.W,u.N],ce=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5]],ue=[[-v,-.5],[v,-.5],[.5,-v],[.5,v]],ge=[[.5,-v],[.5,v],[v,.5],[-v,.5]],fe=[[-.5,v],[-.5,-v],[v,.5],[-v,.5]],po=[u.W,u.SW,u.SE,u.E],mo=[u.S,u.SE,u.NE,u.N],ho=[u.NW,u.W,u.E,u.NE],xo=[u.NW,u.SW,u.S,u.N],vo=[[-.5,v],[-.5,-v],[.5,-v],[.5,v]],So=[[-v,-.5],[v,-.5],[v,.5],[-v,.5]],dr=[u.NW,u.SW,u.SE,u.NE],Ao=[u.NW,u.SW,u.SE,u.E,u.N],yo=[u.W,u.SW,u.SE,u.NE,u.N],bo=[u.NW,u.W,u.S,u.SE,u.NE],_o=[u.NW,u.SW,u.S,u.E,u.NE],Mo=[u.NW,u.W,[.5,-v],[.5,v],u.N],To=[[-v,-.5],[v,-.5],u.E,u.NE,u.N],Co=[[-.5,v],[-.5,-v],u.S,u.SE,u.E],Eo=[u.W,u.SW,u.S,[v,.5],[-v,.5]],Po=[u.NW,u.W,[-v,-.5],[v,-.5],u.N],No=[[-.5,v],[-.5,-v],u.E,u.NE,u.N],Do=[u.S,u.SE,u.E,[v,.5],[-v,.5]],Oo=[u.W,u.SW,u.S,[.5,-v],[.5,v]],Lo=[u.W,u.SW,u.SE,u.E,[v,.5],[-v,.5]],wo=[[-.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],Io=[u.NW,u.SW,u.S,[.5,-v],[.5,v],u.N],de=[u.W,u.SW,u.S,u.E,u.NE,u.N],pe=[u.NW,u.W,u.S,u.SE,u.E,u.N],ze=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5],u.E,u.NE,u.N],Ge=[u.W,u.SW,u.S,[.5,-v],[.5,v],[v,.5],[-v,.5]],He=[u.NW,u.W,[-v,-.5],[v,-.5],[.5,-v],[.5,v],u.N],Ve=[[-.5,v],[-.5,-v],u.S,u.SE,u.E,[v,.5],[-v,.5]],Ro=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5],[.5,-v],[.5,v],[v,.5],[-v,.5]],Bo={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 Uo={[m("0000")]:[],[m("2222")]:[],[m("2221")]:[ne],[m("2212")]:[se],[m("2122")]:[ae],[m("1222")]:[le],[m("0001")]:[ne],[m("0010")]:[se],[m("0100")]:[ae],[m("1000")]:[le],[m("2220")]:[ce],[m("2202")]:[ue],[m("2022")]:[ge],[m("0222")]:[fe],[m("0002")]:[ce],[m("0020")]:[ue],[m("0200")]:[ge],[m("2000")]:[fe],[m("0011")]:[po],[m("0110")]:[mo],[m("1100")]:[ho],[m("1001")]:[xo],[m("2211")]:[po],[m("2112")]:[mo],[m("1122")]:[ho],[m("1221")]:[xo],[m("2200")]:[vo],[m("2002")]:[So],[m("0022")]:[vo],[m("0220")]:[So],[m("1111")]:[dr],[m("1211")]:[Ao],[m("2111")]:[yo],[m("1112")]:[bo],[m("1121")]:[_o],[m("1011")]:[Ao],[m("0111")]:[yo],[m("1110")]:[bo],[m("1101")]:[_o],[m("1200")]:[Mo],[m("0120")]:[To],[m("0012")]:[Co],[m("2001")]:[Eo],[m("1022")]:[Mo],[m("2102")]:[To],[m("2210")]:[Co],[m("0221")]:[Eo],[m("1002")]:[Po],[m("2100")]:[No],[m("0210")]:[Do],[m("0021")]:[Oo],[m("1220")]:[Po],[m("0122")]:[No],[m("2012")]:[Do],[m("2201")]:[Oo],[m("0211")]:[Lo],[m("2110")]:[wo],[m("1102")]:[Fo],[m("1021")]:[Io],[m("2011")]:[Lo],[m("0112")]:[wo],[m("1120")]:[Fo],[m("1201")]:[Io],[m("2101")]:[de],[m("0121")]:[de],[m("1012")]:[pe],[m("1210")]:[pe],[m("0101")]:{0:[ne,ae],1:[de],2:[de]},[m("1010")]:{0:[le,se],1:[pe],2:[pe]},[m("2121")]:{0:[de],1:[de],2:[ne,ae]},[m("1212")]:{0:[pe],1:[pe],2:[le,se]},[m("2120")]:{0:[ze],1:[ze],2:[ce,ae]},[m("2021")]:{0:[Ge],1:[Ge],2:[ne,ge]},[m("1202")]:{0:[He],1:[He],2:[le,ue]},[m("0212")]:{0:[Ve],1:[Ve],2:[se,fe]},[m("0102")]:{0:[ce,ae],1:[ze],2:[ze]},[m("0201")]:{0:[ne,ge],1:[Ge],2:[Ge]},[m("1020")]:{0:[le,ue],1:[He],2:[He]},[m("2010")]:{0:[se,fe],1:[Ve],2:[Ve]},[m("2020")]:{0:[fe,ue],1:[Ro],2:[ce,ge]},[m("0202")]:{0:[ge,ce],1:[Ro],2:[fe,ue]}};var Y={ISO_LINES:1,ISO_BANDS:2},pr={zIndex:0,zOffset:.005};function ye(n,e){return Array.isArray(e)?n<e[0]?0:n<e[1]?1:2:n>=e?1:0}function zo(n){let{cellWeights:e,x:t,y:o,width:i,height:r}=n,s=n.threshold;n.thresholdValue&&(Wo.log.deprecated("thresholdValue","threshold")(),s=n.thresholdValue);let a=t<0,l=t>=i-1,c=o<0,g=o>=r-1,f=a||l||c||g,d={},p={};a||g?p.top=0:(d.top=e[(o+1)*i+t],p.top=ye(d.top,s)),l||g?p.topRight=0:(d.topRight=e[(o+1)*i+t+1],p.topRight=ye(d.topRight,s)),l||c?p.right=0:(d.right=e[o*i+t+1],p.right=ye(d.right,s)),a||c?p.current=0:(d.current=e[o*i+t],p.current=ye(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 b=0;return f||(b=ye((d.top+d.topRight+d.right+d.current)/4,s)),{code:y,meanCode:b}}function st(n){let{gridOrigin:e,cellSize:t,x:o,y:i,code:r,meanCode:s,type:a=Y.ISO_LINES}=n,l={...pr,...n.thresholdData},c=a===Y.ISO_BANDS?Uo[r]:Bo[r];Array.isArray(c)||(c=c[s]);let g=l.zIndex*l.zOffset,f=(o+1)*t[0],d=(i+1)*t[1],p=e[0]+f,x=e[1]+d;if(a===Y.ISO_BANDS){let A=[];return c.forEach(S=>{let y=[];S.forEach(b=>{let _=p+b[0]*t[0],O=x+b[1]*t[1];y.push([_,O,g])}),A.push(y)}),A}let h=[];return c.forEach(A=>{A.forEach(S=>{let y=p+S[0]*t[0],b=x+S[1]*t[1];h.push([y,b,g])})}),h}function Go({thresholdData:n,cellWeights:e,gridSize:t,gridOrigin:o,cellSize:i}){let r=[],s=[],a=t[0],l=t[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}=zo({cellWeights:e,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 b=st(y);for(let _ of b)s[g++]={vertices:_,contour:d}}else{y.type=Y.ISO_LINES;let b=st(y);for(let _=0;_<b.length;_+=2)r[c++]={start:b[_],end:b[_+1],contour:d}}}}return{contourSegments:r,contourPolygons:s}}var ko=M(E(),1);var Ho=[255,255,255,255],mr=1,hr=1,xr={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:hr}],optional:!0,compare:3},zOffset:.005},Vo="positions",vr={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},ke=class extends F{initializeState(){super.initializeAggregationLayer({dimensions:vr}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:T.SUM}}}),this.getAttributeManager().add({[Vo]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(e){super.updateState(e);let t=!1,{oldProps:o,props:i}=e,{aggregationDirty:r}=this.state;(o.contours!==i.contours||o.zOffset!==i.zOffset)&&(t=!0,this._updateThresholdData(e.props)),this.getNumInstances()>0&&(r||t)&&this._generateContours()}renderLayers(){let{contourSegments:e,contourPolygons:t}=this.state.contourData,o=this.getSubLayerClass("lines",je.LineLayer),i=this.getSubLayerClass("bands",je.SolidPolygonLayer),r=e&&e.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||Ho,getWidth:a=>a.contour.strokeWidth||mr}),s=t&&t.length>0&&new i(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:a=>a.vertices,getFillColor:a=>a.contour.color||Ho});return[r,s]}updateAggregationState(e){let{props:t,oldProps:o}=e,{cellSize:i,coordinateSystem:r}=t,{viewport:s}=this.context,a=o.cellSize!==i,l=t.gpuAggregation;this.state.gpuAggregation!==t.gpuAggregation&&l&&!C.isSupported(this.context.device)&&(ko.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(Vo),{data:d,weights:p}=g,{boundingBox:x}=this.state;if(f&&(x=Fe(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:x})),f||a){let{gridOffset:S,translation:y,width:b,height:_,numCol:O,numRow:B}=Ie(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:b,height:_,numCol:O,numRow:B})}let h=f||c||this.isAggregationDirty(e,{dimension:d,compareAll:l}),A=this.isAggregationDirty(e,{dimension:p});A&&this._updateAccessors(e),(h||A)&&this._resetResults(),this.setState({aggregationDataDirty:h,aggregationWeightsDirty:A})}_updateAccessors(e){let{getWeight:t,aggregation:o,data:i}=e.props,{count:r}=this.state.weights;r&&(r.getWeight=t,r.operation=T[o]),this.setState({getValue:Q(o,t,{data:i})})}_resetResults(){let{count:e}=this.state.weights;e&&(e.aggregationData=null)}_generateContours(){let{numCol:e,numRow:t,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=Go({thresholdData:r,cellWeights:l,gridSize:[e,t],gridOrigin:o,cellSize:[i.xOffset,i.yOffset]});this.setState({contourData:c})}_updateThresholdData(e){let{contours:t,zOffset:o}=e,i=t.length,r=new Array(i);for(let s=0;s<i;s++){let a=t[s];r[s]={contour:a,zIndex:a.zIndex||s,zOffset:o}}this.setState({thresholdData:r})}},be=ke;(()=>{ke.layerName="ContourLayer"})(),(()=>{ke.defaultProps=xr})();var Qo=M(E(),1);var Ko=M(E(),1);var N=M(E(),1),qo=M(q(),1);var Yo=M(q(),1);var jo=`#version 300 es
|
|
391
334
|
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
392
335
|
#define RANGE_COUNT 6
|
|
393
|
-
|
|
394
336
|
in vec3 positions;
|
|
395
337
|
in vec3 normals;
|
|
396
|
-
|
|
397
338
|
in vec4 colors;
|
|
398
339
|
in vec4 elevations;
|
|
399
340
|
in vec3 instancePickingColors;
|
|
400
|
-
|
|
401
|
-
// Custom uniforms
|
|
402
341
|
uniform vec2 offset;
|
|
403
342
|
uniform bool extruded;
|
|
404
343
|
uniform float cellSize;
|
|
405
344
|
uniform float coverage;
|
|
406
345
|
uniform float opacity;
|
|
407
346
|
uniform float elevationScale;
|
|
408
|
-
|
|
409
347
|
uniform ivec2 gridSize;
|
|
410
348
|
uniform vec2 gridOrigin;
|
|
411
349
|
uniform vec2 gridOriginLow;
|
|
@@ -413,183 +351,140 @@ uniform vec2 gridOffset;
|
|
|
413
351
|
uniform vec2 gridOffsetLow;
|
|
414
352
|
uniform vec4 colorRange[RANGE_COUNT];
|
|
415
353
|
uniform vec2 elevationRange;
|
|
416
|
-
|
|
417
|
-
// Domain uniforms
|
|
418
354
|
uniform vec2 colorDomain;
|
|
419
355
|
uniform bool colorDomainValid;
|
|
420
356
|
uniform vec2 elevationDomain;
|
|
421
357
|
uniform bool elevationDomainValid;
|
|
422
|
-
|
|
423
358
|
layout(std140) uniform;
|
|
424
359
|
uniform ColorData
|
|
425
360
|
{
|
|
426
|
-
|
|
361
|
+
vec4 maxMinCount;
|
|
427
362
|
} colorData;
|
|
428
363
|
uniform ElevationData
|
|
429
364
|
{
|
|
430
|
-
|
|
365
|
+
vec4 maxMinCount;
|
|
431
366
|
} elevationData;
|
|
432
|
-
|
|
433
367
|
#define EPSILON 0.00001
|
|
434
|
-
|
|
435
|
-
// Result
|
|
436
368
|
out vec4 vColor;
|
|
437
|
-
|
|
438
369
|
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
370
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
371
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
372
|
+
float domainRange = domain.y - domain.x;
|
|
373
|
+
if (domainRange <= 0.) {
|
|
374
|
+
outColor = colorRange[0];
|
|
375
|
+
} else {
|
|
376
|
+
float rangeCount = float(RANGE_COUNT);
|
|
377
|
+
float rangeStep = domainRange / rangeCount;
|
|
378
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
379
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
380
|
+
int intIdx = int(idx);
|
|
381
|
+
outColor = colorRange[intIdx];
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return outColor;
|
|
454
385
|
}
|
|
455
|
-
|
|
456
386
|
float linearScale(vec2 domain, vec2 range, float value) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
387
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
388
|
+
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
|
|
389
|
+
}
|
|
390
|
+
return -1.;
|
|
461
391
|
}
|
|
462
|
-
|
|
463
392
|
void main(void) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
496
|
-
|
|
497
|
-
// Light calculations
|
|
498
|
-
// Worldspace is the linear space after Mercator projection
|
|
499
|
-
|
|
500
|
-
vec3 normals_commonspace = project_normal(normals);
|
|
501
|
-
|
|
502
|
-
if (extruded) {
|
|
503
|
-
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
|
|
504
|
-
vColor = vec4(lightColor, color.a * opacity) / 255.;
|
|
505
|
-
} else {
|
|
506
|
-
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
`;var mo=`#version 300 es
|
|
393
|
+
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
|
|
394
|
+
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
|
|
395
|
+
float elevation = 0.0;
|
|
396
|
+
if (extruded) {
|
|
397
|
+
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
|
|
398
|
+
elevation = linearScale(elvDomain, elevationRange, elevations.r);
|
|
399
|
+
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
|
|
400
|
+
}
|
|
401
|
+
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
|
|
402
|
+
float dotRadius = cellSize / 2. * coverage * shouldRender;
|
|
403
|
+
int yIndex = (gl_InstanceID / gridSize[0]);
|
|
404
|
+
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
|
|
405
|
+
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
|
|
406
|
+
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
|
|
407
|
+
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
|
|
408
|
+
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
|
|
409
|
+
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
|
|
410
|
+
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
|
|
411
|
+
geometry.worldPosition = centroidPosition;
|
|
412
|
+
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
|
|
413
|
+
picking_setPickingColor(instancePickingColors);
|
|
414
|
+
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
415
|
+
vec3 normals_commonspace = project_normal(normals);
|
|
416
|
+
if (extruded) {
|
|
417
|
+
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
|
|
418
|
+
vColor = vec4(lightColor, color.a * opacity) / 255.;
|
|
419
|
+
} else {
|
|
420
|
+
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
`;var Xo=`#version 300 es
|
|
510
424
|
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
|
|
511
|
-
|
|
512
425
|
precision highp float;
|
|
513
|
-
|
|
514
426
|
in vec4 vColor;
|
|
515
|
-
|
|
516
427
|
out vec4 fragColor;
|
|
517
|
-
|
|
518
428
|
void main(void) {
|
|
519
|
-
|
|
520
|
-
|
|
429
|
+
fragColor = vColor;
|
|
430
|
+
fragColor = picking_filterColor(fragColor);
|
|
521
431
|
}
|
|
522
|
-
`;var
|
|
432
|
+
`;var at=0,lt=1,Sr={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},Xe=class extends N.Layer{getShaders(){return super.getShaders({vs:jo,fs:Xo,modules:[N.project32,N.gouraudLighting,N.picking,K]})}initializeState(){this.getAttributeManager().addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});let t=this._getModel();this._setupUniformBuffer(t),this.setState({model:t})}_getModel(){return new Yo.Model(this.context.device,{...this.getShaders(),id:this.props.id,geometry:new qo.CubeGeometry,isInstanced:!0})}draw({uniforms:e}){let{cellSize:t,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(e),p.setUniforms(A),p.setUniforms({cellSize:t,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(e,t){e.bind({target:35345,index:at}),t.bind({target:35345,index:lt})}unbindUniformBuffers(e,t){e.unbind({target:35345,index:at}),t.unbind({target:35345,index:lt})}getDomainUniforms(){let{colorDomain:e,elevationDomain:t}=this.props,o={};return e!==null?(o.colorDomainValid=!0,o.colorDomain=e):o.colorDomainValid=!1,t!==null?(o.elevationDomainValid=!0,o.elevationDomain=t):o.elevationDomainValid=!1,o}_setupUniformBuffer(e){let t=e.pipeline.handle,o=this.context.gl,i=o.getUniformBlockIndex(t,"ColorData"),r=o.getUniformBlockIndex(t,"ElevationData");o.uniformBlockBinding(t,i,at),o.uniformBlockBinding(t,r,lt)}},_e=Xe;(()=>{Xe.layerName="GPUGridCellLayer"})(),(()=>{Xe.defaultProps=Sr})();var Ar={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},yr={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},$o="positions",qe=class extends F{initializeState({device:e}){let t=C.isSupported(e);t||Ko.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),super.initializeAggregationLayer({dimensions:yr}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:t,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:e.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:e.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"}),this.getAttributeManager().add({[$o]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},color:{size:3,accessor:"getColorWeight"},elevation:{size:3,accessor:"getElevationWeight"}})}updateState(e){if(this.state.isSupported===!1)return;super.updateState(e);let{aggregationDirty:t}=this.state;t&&this.setState({gridHash:null})}getHashKeyForIndex(e){let{numRow:t,numCol:o,boundingBox:i,gridOffset:r}=this.state,s=[o,t],a=[i.xMin,i.yMin],l=[r.xOffset,r.yOffset],c=Math.floor(e/s[0]),g=e-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(e){let{numRow:t,numCol:o,boundingBox:i,gridOffset:r}=this.state,s=[o,t],a=[i.xMin,i.yMin],l=[r.xOffset,r.yOffset],c=Math.floor(e/s[0]),g=e-c*s[0],f=c*l[1]+a[1];return[g*l[0]+a[0],f]}getPickingInfo({info:e,mode:t}){let{index:o}=e,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},t!=="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=ie(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 e.picked=Boolean(i),e.object=i,e}renderLayers(){if(!this.state.isSupported)return null;let{elevationScale:e,extruded:t,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",_e);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:e,extruded:t},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:x.aggregationBuffer,elevations:h.aggregationBuffer}},colorMaxMinBuffer:x.maxMinBuffer,elevationMaxMinBuffer:h.maxMinBuffer,numInstances:f*g})}finalizeState(e){let{color:t,elevation:o}=this.state.weights;[t,o].forEach(i=>{let{aggregationBuffer:r,maxMinBuffer:s}=i;s?.destroy(),r?.destroy()}),super.finalizeState(e)}updateAggregationState(e){let{props:t,oldProps:o}=e,{cellSize:i,coordinateSystem:r}=t,{viewport:s}=this.context,a=o.cellSize!==i,{dimensions:l}=this.state,c=this.isAttributeChanged($o),g=c||this.isAttributeChanged(),{boundingBox:f}=this.state;if(c&&(f=Fe(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:f})),c||a){let{gridOffset:p,translation:x,width:h,height:A,numCol:S,numRow:y}=Ie(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(e,{dimension:l.data,compareAll:!0});d&&this._updateAccessors(e),this.setState({aggregationDataDirty:d})}_updateAccessors(e){let{colorAggregation:t,elevationAggregation:o}=e.props,{color:i,elevation:r}=this.state.weights;i.operation=T[t],r.operation=T[o]}},V=qe;(()=>{qe.layerName="GPUGridLayer"})(),(()=>{qe.defaultProps=Ar})();var br={...V.defaultProps,...H.defaultProps,gpuAggregation:!1},Ye=class extends Qo.CompositeLayer{initializeState(){this.state={useGPUAggregation:!1}}updateState({props:e}){this.setState({useGPUAggregation:!1})}renderLayers(){let{data:e,updateTriggers:t}=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:t}),{data:e})}canUseGPUAggregation(e){let{gpuAggregation:t,lowerPercentile:o,upperPercentile:i,getColorValue:r,getElevationValue:s,colorScaleType:a}=e;return!(!t||!C.isSupported(this.context.device)||o!==0||i!==100||r!==null||s!==null||a==="quantile"||a==="ordinal")}},Me=Ye;(()=>{Ye.layerName="GridLayer"})(),(()=>{Ye.defaultProps=br})();function Jo(n){let e=n.map(a=>a[0]),t=n.map(a=>a[1]),o=Math.min.apply(null,e),i=Math.max.apply(null,e),r=Math.min.apply(null,t),s=Math.max.apply(null,t);return[o,r,i,s]}function ei(n,e){return e[0]>=n[0]&&e[2]<=n[2]&&e[1]>=n[1]&&e[3]<=n[3]}var Zo=new Float32Array(12);function ct(n,e=2){let t=0;for(let o of n)for(let i=0;i<e;i++)Zo[t++]=o[i]||0;return Zo}function ti(n,e,t){let[o,i,r,s]=n,a=r-o,l=s-i,c=a,g=l;a/l<e/t?c=e/t*l:g=t/e*a,c<e&&(c=e,g=t);let f=(r+o)/2,d=(s+i)/2;return[f-c/2,d-g/2,f+c/2,d+g/2]}function oi(n,e){let[t,o,i,r]=e;return[(n[0]-t)/(i-t),(n[1]-o)/(r-o)]}var pt=M(q(),1),R=M(E(),1);var ni=M(q(),1),$e=M(E(),1);var ii=`#version 300 es
|
|
523
433
|
#define SHADER_NAME heatp-map-layer-vertex-shader
|
|
524
|
-
|
|
525
434
|
uniform sampler2D maxTexture;
|
|
526
435
|
uniform float intensity;
|
|
527
436
|
uniform vec2 colorDomain;
|
|
528
437
|
uniform float threshold;
|
|
529
438
|
uniform float aggregationMode;
|
|
530
|
-
|
|
531
439
|
in vec3 positions;
|
|
532
440
|
in vec2 texCoords;
|
|
533
|
-
|
|
534
441
|
out vec2 vTexCoords;
|
|
535
442
|
out float vIntensityMin;
|
|
536
443
|
out float vIntensityMax;
|
|
537
|
-
|
|
538
444
|
void main(void) {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
`;var si=`#version 300 es
|
|
445
|
+
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
|
|
446
|
+
vTexCoords = texCoords;
|
|
447
|
+
vec4 maxTexture = texture(maxTexture, vec2(0.5));
|
|
448
|
+
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
|
|
449
|
+
float minValue = maxValue * threshold;
|
|
450
|
+
if (colorDomain[1] > 0.) {
|
|
451
|
+
maxValue = colorDomain[1];
|
|
452
|
+
minValue = colorDomain[0];
|
|
453
|
+
}
|
|
454
|
+
vIntensityMax = intensity / maxValue;
|
|
455
|
+
vIntensityMin = intensity / minValue;
|
|
456
|
+
}
|
|
457
|
+
`;var ri=`#version 300 es
|
|
553
458
|
#define SHADER_NAME triangle-layer-fragment-shader
|
|
554
|
-
|
|
555
459
|
precision highp float;
|
|
556
|
-
|
|
557
460
|
uniform float opacity;
|
|
558
461
|
uniform sampler2D weightsTexture;
|
|
559
462
|
uniform sampler2D colorTexture;
|
|
560
463
|
uniform float aggregationMode;
|
|
561
|
-
|
|
562
464
|
in vec2 vTexCoords;
|
|
563
465
|
in float vIntensityMin;
|
|
564
466
|
in float vIntensityMax;
|
|
565
|
-
|
|
566
467
|
out vec4 fragColor;
|
|
567
|
-
|
|
568
468
|
vec4 getLinearColor(float value) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
469
|
+
float factor = clamp(value * vIntensityMax, 0., 1.);
|
|
470
|
+
vec4 color = texture(colorTexture, vec2(factor, 0.5));
|
|
471
|
+
color.a *= min(value * vIntensityMin, 1.0);
|
|
472
|
+
return color;
|
|
573
473
|
}
|
|
574
|
-
|
|
575
474
|
void main(void) {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
weight /= max(1.0, weights.a);
|
|
581
|
-
}
|
|
582
|
-
|
|
583
|
-
// discard pixels with 0 weight.
|
|
584
|
-
if (weight <= 0.) {
|
|
585
|
-
discard;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
vec4 linearColor = getLinearColor(weight);
|
|
589
|
-
linearColor.a *= opacity;
|
|
590
|
-
fragColor = linearColor;
|
|
475
|
+
vec4 weights = texture(weightsTexture, vTexCoords);
|
|
476
|
+
float weight = weights.r;
|
|
477
|
+
if (aggregationMode > 0.5) {
|
|
478
|
+
weight /= max(1.0, weights.a);
|
|
591
479
|
}
|
|
592
|
-
|
|
480
|
+
if (weight <= 0.) {
|
|
481
|
+
discard;
|
|
482
|
+
}
|
|
483
|
+
vec4 linearColor = getLinearColor(weight);
|
|
484
|
+
linearColor.a *= opacity;
|
|
485
|
+
fragColor = linearColor;
|
|
486
|
+
}
|
|
487
|
+
`;var ut=class extends $e.Layer{getShaders(){return{vs:ii,fs:ri,modules:[$e.project32]}}initializeState({device:e}){this.setState({model:this._getModel(e)})}_getModel(e){let{vertexCount:t,data:o,weightsTexture:i,maxTexture:r,colorTexture:s}=this.props;return new ni.Model(e,{...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:t})}draw({uniforms:e}){let{model:t}=this.state,{intensity:o,threshold:i,aggregationMode:r,colorDomain:s}=this.props;t.setUniforms({...e,intensity:o,threshold:i,aggregationMode:r,colorDomain:s}),t.draw(this.context.renderPass)}},Te=ut;(()=>{ut.layerName="TriangleLayer"})();var gt=`#version 300 es
|
|
593
488
|
in vec3 positions;
|
|
594
489
|
in vec3 positions64Low;
|
|
595
490
|
in float weights;
|
|
@@ -598,64 +493,51 @@ uniform float radiusPixels;
|
|
|
598
493
|
uniform float textureWidth;
|
|
599
494
|
uniform vec4 commonBounds;
|
|
600
495
|
uniform float weightsScale;
|
|
601
|
-
|
|
602
496
|
void main()
|
|
603
497
|
{
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
614
|
-
gl_Position.w = 1.0;
|
|
615
|
-
}
|
|
616
|
-
`;var gt=`#version 300 es
|
|
498
|
+
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
|
|
499
|
+
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
|
|
500
|
+
gl_PointSize = radiusTexels * 2.;
|
|
501
|
+
vec3 commonPosition = project_position(positions, positions64Low);
|
|
502
|
+
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
|
|
503
|
+
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
504
|
+
gl_Position.w = 1.0;
|
|
505
|
+
}
|
|
506
|
+
`;var ft=`#version 300 es
|
|
617
507
|
in vec4 weightsTexture;
|
|
618
508
|
out vec4 fragColor;
|
|
619
|
-
// Epanechnikov function, keeping for reference
|
|
620
|
-
// float epanechnikovKDE(float u) {
|
|
621
|
-
// return 0.75 * (1.0 - u * u);
|
|
622
|
-
// }
|
|
623
509
|
float gaussianKDE(float u){
|
|
624
|
-
|
|
510
|
+
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
|
|
625
511
|
}
|
|
626
512
|
void main()
|
|
627
513
|
{
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
635
|
-
`;var
|
|
514
|
+
float dist = length(gl_PointCoord - vec2(0.5, 0.5));
|
|
515
|
+
if (dist > 0.5) {
|
|
516
|
+
discard;
|
|
517
|
+
}
|
|
518
|
+
fragColor = weightsTexture * gaussianKDE(2. * dist);
|
|
519
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
520
|
+
}
|
|
521
|
+
`;var si=`#version 300 es
|
|
636
522
|
uniform sampler2D inTexture;
|
|
637
523
|
uniform float textureSize;
|
|
638
524
|
out vec4 outTexture;
|
|
639
|
-
|
|
640
525
|
void main()
|
|
641
526
|
{
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
gl_PointSize = 1.0;
|
|
651
|
-
}
|
|
652
|
-
`;var ni=`#version 300 es
|
|
527
|
+
int yIndex = gl_VertexID / int(textureSize);
|
|
528
|
+
int xIndex = gl_VertexID - (yIndex * int(textureSize));
|
|
529
|
+
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
|
|
530
|
+
outTexture = texture(inTexture, uv);
|
|
531
|
+
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
532
|
+
gl_PointSize = 1.0;
|
|
533
|
+
}
|
|
534
|
+
`;var ai=`#version 300 es
|
|
653
535
|
in vec4 outTexture;
|
|
654
536
|
out vec4 fragColor;
|
|
655
537
|
void main() {
|
|
656
|
-
|
|
657
|
-
|
|
538
|
+
fragColor = outTexture;
|
|
539
|
+
fragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
658
540
|
}
|
|
659
|
-
`;var
|
|
541
|
+
`;var _r=2,dt={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},li=[0,0],Mr={SUM:0,MEAN:1},Tr={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}},Cr=["float32-renderable-webgl","texture-blend-float-webgl"],Er={data:{props:["radiusPixels"]}},Ke=class extends P{initializeState(){super.initializeAggregationLayer(Er),this.setState({colorDomain:li}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:e}){return e.somethingChanged}updateState(e){super.updateState(e),this._updateHeatmapState(e)}_updateHeatmapState(e){let{props:t,oldProps:o}=e,i=this._getChangeFlags(e);(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(),t.colorRange!==o.colorRange&&this._updateColorTexture(e),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:e.context.viewport.zoom})}renderLayers(){let{weightsTexture:e,triPositionBuffer:t,triTexCoordBuffer:o,maxWeightsTexture:i,colorTexture:r,colorDomain:s}=this.state,{updateTriggers:a,intensity:l,threshold:c,aggregation:g}=this.props,f=this.getSubLayerClass("triangle",Te);return new f(this.getSubLayerProps({id:"triangle-layer",updateTriggers:a}),{coordinateSystem:R.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:t,texCoords:o}},vertexCount:4,maxTexture:i,colorTexture:r,aggregationMode:Mr[g]||0,weightsTexture:e,intensity:l,threshold:c,colorDomain:s})}finalizeState(e){super.finalizeState(e);let{weightsTransform:t,weightsTexture:o,maxWeightTransform:i,maxWeightsTexture:r,triPositionBuffer:s,triTexCoordBuffer:a,colorTexture:l,updateTimer:c}=this.state;t?.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(e){let t={},{dimensions:o}=this.state;t.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(e,{compareAll:!0,dimension:o.data})&&"aggregation is dirty",t.viewportChanged=e.changeFlags.viewportChanged;let{zoom:i}=this.state;return(!e.context.viewport||e.context.viewport.zoom!==i)&&(t.viewportZoomChanged=!0),t}_createTextures(){let{textureSize:e,format:t}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...dt,width:e,height:e,format:t}),maxWeightsTexture:this.context.device.createTexture({...dt,width:1,height:1,format:t})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:e}=this.context,{weightsTextureSize:t}=this.props,o=Math.min(t,e.limits.maxTextureDimension2D),i=Cr.every(a=>e.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(e){let{weightsTransform:t}=this.state,{weightsTexture:o}=this.state,i=this.getAttributeManager();t?.destroy(),t=new pt.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",...e}),this.setState({weightsTransform:t})}_setupResources(){this._createTextures();let{device:e}=this.context,{textureSize:t,weightsTexture:o,maxWeightsTexture:i}=this.state,r=this.getShaders({vs:gt,fs:ft});this._createWeightsTransform(r);let s=this.getShaders({vs:si,fs:ai}),a=new pt.TextureTransform(e,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:o},uniforms:{textureSize:t},targetTexture:i,...s,vertexCount:t*t,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:e.createBuffer({byteLength:48}),triTexCoordBuffer:e.createBuffer({byteLength:48})})}updateShaders(e){this._createWeightsTransform({vs:gt,fs:ft,...e})}_updateMaxWeightValue(){let{maxWeightTransform:e,textureSize:t}=this.state;e.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(e=!1){let{viewport:t}=this.context,o=[t.unproject([0,0]),t.unproject([t.width,0]),t.unproject([t.width,t.height]),t.unproject([0,t.height])].map(a=>a.map(Math.fround)),i=Jo(o),r={visibleWorldBounds:i,viewportCorners:o},s=!1;if(e||!this.state.worldBounds||!ei(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:e,triTexCoordBuffer:t,normalizedCommonBounds:o,viewportCorners:i}=this.state,{viewport:r}=this.context;e.write(ct(i,3));let s=i.map(a=>oi(r.projectPosition(a),o));t.write(ct(s,2))}_updateColorTexture(e){let{colorRange:t}=e.props,{colorTexture:o}=this.state,i=z(t,!1,Uint8Array);o&&o?.width===t.length?o.setSubImageData({data:i}):(o?.destroy(),o=this.context.device.createTexture({...dt,data:i,width:t.length,height:1})),this.setState({colorTexture:o})}_updateWeightmap(){let{radiusPixels:e,colorDomain:t,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(t&&o==="SUM"){let{viewport:h}=this.context,A=h.distanceScales.metersPerUnit[2]*(l[2]-l[0])/r;this.state.colorDomain=t.map(S=>S*A*s)}else this.state.colorDomain=t||li;let g=this.getAttributeManager().getAttributes(),f=this.getModuleSettings(),d=g.positions.buffer,p={radiusPixels:e,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(e=!1){let{updateTimer:t}=this.state,{debounceTimeout:o}=this.props;e?(t=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(t),t=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),o)),this.setState({updateTimer:t})}_worldToCommonBounds(e,t={}){let{useLayerCoordinateSystem:o=!1}=t,[i,r,s,a]=e,{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(e){let[t,o,i,r]=e,{viewport:s}=this.context,a=s.unprojectPosition([t,o]),l=s.unprojectPosition([i,r]);return a.slice(0,2).concat(l.slice(0,2))}},Ce=Ke;(()=>{Ke.layerName="HeatmapLayer"})(),(()=>{Ke.defaultProps=Tr})();return mi(Ee);})();
|
|
660
542
|
return __exports__;
|
|
661
543
|
});
|