@deck.gl/aggregation-layers 9.0.0-alpha.5 → 9.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +4529 -4307
- package/dist/es5/heatmap-layer/heatmap-layer.js +7 -8
- package/dist/es5/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/es5/heatmap-layer/max-fs.glsl.js +1 -1
- package/dist/es5/heatmap-layer/max-vs.glsl.js +1 -1
- package/dist/es5/heatmap-layer/triangle-layer-fragment.glsl.js +1 -1
- package/dist/es5/heatmap-layer/triangle-layer-vertex.glsl.js +1 -1
- package/dist/es5/heatmap-layer/weights-fs.glsl.js +1 -1
- package/dist/es5/heatmap-layer/weights-vs.glsl.js +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js +4 -4
- package/dist/es5/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer-fragment.glsl.js +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer-vertex.glsl.js +1 -1
- package/dist/es5/screen-grid-layer/screen-grid-layer.js +1 -3
- package/dist/es5/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
- package/dist/es5/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +1 -1
- package/dist/esm/heatmap-layer/heatmap-layer.js +8 -11
- package/dist/esm/heatmap-layer/heatmap-layer.js.map +1 -1
- package/dist/esm/heatmap-layer/max-fs.glsl.js +5 -3
- package/dist/esm/heatmap-layer/max-fs.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/max-vs.glsl.js +3 -2
- package/dist/esm/heatmap-layer/max-vs.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js +9 -6
- package/dist/esm/heatmap-layer/triangle-layer-fragment.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js +7 -6
- package/dist/esm/heatmap-layer/triangle-layer-vertex.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/weights-fs.glsl.js +5 -3
- package/dist/esm/heatmap-layer/weights-fs.glsl.js.map +1 -1
- package/dist/esm/heatmap-layer/weights-vs.glsl.js +5 -4
- package/dist/esm/heatmap-layer/weights-vs.glsl.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js +4 -4
- package/dist/esm/screen-grid-layer/screen-grid-cell-layer.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js +7 -4
- package/dist/esm/screen-grid-layer/screen-grid-layer-fragment.glsl.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js +8 -7
- package/dist/esm/screen-grid-layer/screen-grid-layer-vertex.glsl.js.map +1 -1
- package/dist/esm/screen-grid-layer/screen-grid-layer.js +1 -3
- package/dist/esm/screen-grid-layer/screen-grid-layer.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +6 -3
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +5 -4
- package/dist/esm/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +2 -2
- package/dist/esm/utils/gpu-grid-aggregation/gpu-grid-aggregator.js.map +1 -1
- package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +3 -2
- package/dist/esm/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js.map +1 -1
- package/dist.min.js +152 -122
- package/package.json +7 -7
- package/src/heatmap-layer/heatmap-layer.ts +17 -17
- package/src/heatmap-layer/max-fs.glsl.ts +5 -3
- package/src/heatmap-layer/max-vs.glsl.ts +3 -2
- package/src/heatmap-layer/triangle-layer-fragment.glsl.ts +9 -6
- package/src/heatmap-layer/triangle-layer-vertex.glsl.ts +7 -6
- package/src/heatmap-layer/weights-fs.glsl.ts +5 -3
- package/src/heatmap-layer/weights-vs.glsl.ts +5 -4
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +16 -8
- package/src/screen-grid-layer/screen-grid-layer-fragment.glsl.ts +7 -4
- package/src/screen-grid-layer/screen-grid-layer-vertex.glsl.ts +8 -7
- package/src/screen-grid-layer/screen-grid-layer.ts +1 -1
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.ts +6 -3
- package/src/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.ts +5 -4
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +2 -2
- package/src/utils/gpu-grid-aggregation/transform-mean-vs.glsl.ts +3 -2
- package/typed/aggregation-layer.d.ts +1 -1
- package/typed/aggregation-layer.d.ts.map +1 -1
- package/typed/contour-layer/contour-layer.d.ts +2 -2
- package/typed/contour-layer/contour-layer.d.ts.map +1 -1
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts +2 -2
- package/typed/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
- package/typed/cpu-grid-layer/grid-aggregator.d.ts +1 -1
- package/typed/cpu-grid-layer/grid-aggregator.d.ts.map +1 -1
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts +1 -1
- package/typed/gpu-grid-layer/gpu-grid-cell-layer.d.ts.map +1 -1
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts +2 -2
- package/typed/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
- package/typed/grid-aggregation-layer.d.ts +1 -1
- package/typed/grid-aggregation-layer.d.ts.map +1 -1
- package/typed/grid-layer/grid-layer.d.ts +2 -2
- package/typed/grid-layer/grid-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/heatmap-layer.d.ts +8 -9
- package/typed/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/max-fs.glsl.d.ts +1 -1
- package/typed/heatmap-layer/max-fs.glsl.d.ts.map +1 -1
- package/typed/heatmap-layer/max-vs.glsl.d.ts +1 -1
- package/typed/heatmap-layer/max-vs.glsl.d.ts.map +1 -1
- package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts +1 -1
- package/typed/heatmap-layer/triangle-layer-fragment.glsl.d.ts.map +1 -1
- package/typed/heatmap-layer/triangle-layer-vertex.glsl.d.ts +1 -1
- package/typed/heatmap-layer/triangle-layer-vertex.glsl.d.ts.map +1 -1
- package/typed/heatmap-layer/triangle-layer.d.ts +2 -2
- package/typed/heatmap-layer/triangle-layer.d.ts.map +1 -1
- package/typed/heatmap-layer/weights-fs.glsl.d.ts +1 -1
- package/typed/heatmap-layer/weights-fs.glsl.d.ts.map +1 -1
- package/typed/heatmap-layer/weights-vs.glsl.d.ts +1 -1
- package/typed/heatmap-layer/weights-vs.glsl.d.ts.map +1 -1
- package/typed/hexagon-layer/hexagon-layer.d.ts +2 -2
- package/typed/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts +4 -8
- package/typed/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts +1 -1
- package/typed/screen-grid-layer/screen-grid-layer-fragment.glsl.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts +1 -1
- package/typed/screen-grid-layer/screen-grid-layer-vertex.glsl.d.ts.map +1 -1
- package/typed/screen-grid-layer/screen-grid-layer.d.ts +2 -2
- package/typed/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/typed/types.d.ts +1 -1
- package/typed/types.d.ts.map +1 -1
- package/typed/utils/aggregation-operation-utils.d.ts +1 -1
- package/typed/utils/aggregation-operation-utils.d.ts.map +1 -1
- package/typed/utils/bin-sorter.d.ts +1 -1
- package/typed/utils/bin-sorter.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts +1 -1
- package/typed/utils/gpu-grid-aggregation/transform-mean-vs.glsl.d.ts.map +1 -1
- package/typed/utils/resource-utils.d.ts +1 -1
- package/typed/utils/resource-utils.d.ts.map +1 -1
package/dist.min.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
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 Ju=Object.create;var Ar=Object.defineProperty;var el=Object.getOwnPropertyDescriptor;var tl=Object.getOwnPropertyNames;var rl=Object.getPrototypeOf,nl=Object.prototype.hasOwnProperty;var Pn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),il=(e,t)=>{for(var r in t)Ar(e,r,{get:t[r],enumerable:!0})},hr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of tl(t))!nl.call(e,o)&&o!==r&&Ar(e,o,{get:()=>t[o],enumerable:!(n=el(t,o))||n.enumerable});return e},xe=(e,t,r)=>(hr(e,t,"default"),r&&hr(r,t,"default")),x=(e,t,r)=>(r=e!=null?Ju(rl(e)):{},hr(t||!e||!e.__esModule?Ar(r,"default",{value:e,enumerable:!0}):r,e)),ol=e=>hr(Ar({},"__esModule",{value:!0}),e);var it=Pn((ag,Xi)=>{Xi.exports=globalThis.deck});var j=Pn((ug,Hi)=>{Hi.exports=globalThis.deck});var F=Pn((_g,Vi)=>{Vi.exports=globalThis.luma});var Er={};il(Er,{AGGREGATION_OPERATION:()=>w,CPUGridLayer:()=>Je,ContourLayer:()=>gn,GPUGridLayer:()=>rt,GridLayer:()=>On,HeatmapLayer:()=>In,HexagonLayer:()=>un,ScreenGridLayer:()=>tn,_AggregationLayer:()=>ge,_BinSorter:()=>vt,_CPUAggregator:()=>yt,_GPUGridAggregator:()=>Q});var Ae={},Wi=x(it());xe(Ae,x(it()));if(!Wi.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");xe(Er,Ae);var Si=x(j());var i=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}({});var ne=x(F(),1),go=x(F(),1);var $=e=>`${e}`;function fe(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Mn={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function Gi(e){let t={};for(let[r,n]of Object.entries(e))t[r]=al(n);return t}function zi(e,t,r){let n={};for(let[o,a]of Object.entries(t))e&&o in e&&!a.private?(a.validate&&fe(a.validate(e[o],a),`${r}: invalid ${o}`),n[o]=e[o]):n[o]=a.value;return n}function al(e){let t=Ki(e);if(t!=="object")return{value:e,...Mn[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Mn[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=Ki(e.value),{...e,...Mn[t],type:t}):{type:"object",value:null};throw new Error("props")}function Ki(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var ji=$`\
|
|
7
|
+
"use strict";var __exports__=(()=>{var lf=Object.create;var Tr=Object.defineProperty;var ff=Object.getOwnPropertyDescriptor;var uf=Object.getOwnPropertyNames;var cf=Object.getPrototypeOf,df=Object.prototype.hasOwnProperty;var In=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gf=(e,t)=>{for(var r in t)Tr(e,r,{get:t[r],enumerable:!0})},Ar=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of uf(t))!df.call(e,i)&&i!==r&&Tr(e,i,{get:()=>t[i],enumerable:!(n=ff(t,i))||n.enumerable});return e},Pe=(e,t,r)=>(Ar(e,t,"default"),r&&Ar(r,t,"default")),P=(e,t,r)=>(r=e!=null?lf(cf(e)):{},Ar(t||!e||!e.__esModule?Tr(r,"default",{value:e,enumerable:!0}):r,e)),hf=e=>Ar(Tr({},"__esModule",{value:!0}),e);var rt=In((d_,Wi)=>{Wi.exports=globalThis.deck});var $=In((h_,Vi)=>{Vi.exports=globalThis.deck});var I=In((T_,Xi)=>{Xi.exports=globalThis.luma});var gr={};gf(gr,{AGGREGATION_OPERATION:()=>w,CPUGridLayer:()=>Qe,ContourLayer:()=>An,GPUGridLayer:()=>et,GridLayer:()=>En,HeatmapLayer:()=>Mn,HexagonLayer:()=>un,ScreenGridLayer:()=>nn,_AggregationLayer:()=>de,_BinSorter:()=>mt,_CPUAggregator:()=>yt,_GPUGridAggregator:()=>ee});var he={},Hi=P(rt());Pe(he,P(rt()));if(!Hi.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Pe(gr,he);var mi=P($());var ze=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}(ze||{});var Sr=P(I(),1),z=P(I(),1),So=P(I(),1);var X=e=>`${e}`;function _e(e,t){if(!e)throw new Error(t||"shadertools: assertion failed.")}var Dn={number:{type:"number",validate(e,t){return Number.isFinite(e)&&typeof t=="object"&&(t.max===void 0||e<=t.max)&&(t.min===void 0||e>=t.min)}},array:{type:"array",validate(e,t){return Array.isArray(e)||ArrayBuffer.isView(e)}}};function zi(e){let t={};for(let[r,n]of Object.entries(e))t[r]=_f(n);return t}function ji(e,t,r){let n={};for(let[i,o]of Object.entries(t))e&&i in e&&!o.private?(o.validate&&_e(o.validate(e[i],o),`${r}: invalid ${i}`),n[i]=e[i]):n[i]=o.value;return n}function _f(e){let t=Li(e);if(t!=="object")return{value:e,...Dn[t],type:t};if(typeof e=="object")return e?e.type!==void 0?{...e,...Dn[e.type],type:e.type}:e.value===void 0?{type:"object",value:e}:(t=Li(e.value),{...e,...Dn[t],type:t}):{type:"object",value:null};throw new Error("props")}function Li(e){return Array.isArray(e)||ArrayBuffer.isView(e)?"array":typeof e}var ki=X`\
|
|
8
8
|
#ifdef MODULE_LOGDEPTH
|
|
9
9
|
logdepth_adjustPosition(gl_Position);
|
|
10
10
|
#endif
|
|
11
|
-
|
|
11
|
+
`,$i=X`\
|
|
12
12
|
#ifdef MODULE_MATERIAL
|
|
13
13
|
gl_FragColor = material_filterColor(gl_FragColor);
|
|
14
14
|
#endif
|
|
@@ -29,23 +29,25 @@
|
|
|
29
29
|
#ifdef MODULE_LOGDEPTH
|
|
30
30
|
logdepth_setFragDepth();
|
|
31
31
|
#endif
|
|
32
|
-
`;var
|
|
32
|
+
`;var pf={vertex:ki,fragment:$i},Ki=/void\s+main\s*\([^)]*\)\s*\{\n?/,Yi=/}\n?[^{}]*$/,Fn=[],Xt="__LUMA_INJECT_DECLARATIONS__";function Zi(e){let t={vertex:{},fragment:{}};for(let r in e){let n=e[r],i=Af(r);typeof n=="string"&&(n={order:0,injection:n}),t[i][r]=n}return t}function Af(e){let t=e.slice(0,2);switch(t){case"vs":return"vertex";case"fs":return"fragment";default:throw new Error(t)}}function Lt(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=t==="vertex";for(let o in r){let a=r[o];a.sort((l,f)=>l.order-f.order),Fn.length=a.length;for(let l=0,f=a.length;l<f;++l)Fn[l]=a[l].injection;let s=`${Fn.join(`
|
|
33
33
|
`)}
|
|
34
|
-
`;switch(
|
|
35
|
-
${r}// END MODULE_${this.name}
|
|
34
|
+
`;switch(o){case"vs:#decl":i&&(e=e.replace(Xt,s));break;case"vs:#main-start":i&&(e=e.replace(Ki,l=>l+s));break;case"vs:#main-end":i&&(e=e.replace(Yi,l=>s+l));break;case"fs:#decl":i||(e=e.replace(Xt,s));break;case"fs:#main-start":i||(e=e.replace(Ki,l=>l+s));break;case"fs:#main-end":i||(e=e.replace(Yi,l=>s+l));break;default:e=e.replace(o,l=>l+s)}}return e=e.replace(Xt,""),n&&(e=e.replace(/\}\s*$/,o=>o+pf[t])),e}var Tf=1,se=class{static instantiateModules(t){return t.map(r=>{if(r instanceof se)return r;_e(typeof r!="string",`Shader module use by name is deprecated. Import shader module '${JSON.stringify(r)}' and use it directly.`),r.name||(console.warn("shader module has no name"),r.name=`shader-module-${Tf++}`);let n=new se(r);return n.dependencies=se.instantiateModules(r.dependencies||[]),n})}constructor(t){this.name=void 0,this.vs=void 0,this.fs=void 0,this.getModuleUniforms=void 0,this.dependencies=void 0,this.deprecations=void 0,this.defines=void 0,this.injections=void 0,this.uniforms={},this.uniformTypes={};let{name:r,vs:n,fs:i,dependencies:o=[],uniformPropTypes:a={},getUniforms:s,deprecations:l=[],defines:f={},inject:u={}}=t;_e(typeof r=="string"),this.name=r,this.vs=n,this.fs=i,this.getModuleUniforms=s,this.dependencies=se.instantiateModules(o),this.deprecations=this._parseDeprecationDefinitions(l),this.defines=f,this.injections=Zi(u),a&&(this.uniforms=zi(a))}getModuleSource(t){let r;switch(t){case"vertex":r=this.vs||"";break;case"fragment":r=this.fs||"";break;default:_e(!1)}let n=this.name.toUpperCase().replace(/[^0-9a-z]/gi,"_");return`// ----- MODULE ${this.name} ---------------
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
#define MODULE_${n}
|
|
37
|
+
${r}
|
|
38
|
+
|
|
39
|
+
`}getUniforms(t,r){return this.getModuleUniforms?this.getModuleUniforms(t,r):ji(t,this.uniforms,this.name)}getDefines(){return this.defines}checkDeprecations(t,r){this.deprecations.forEach(n=>{var i;(i=n.regex)!==null&&i!==void 0&&i.test(t)&&(n.deprecated?r.deprecated(n.old,n.new)():r.removed(n.old,n.new)())})}_parseDeprecationDefinitions(t){return t.forEach(r=>{switch(r.type){case"function":r.regex=new RegExp(`\\b${r.old}\\(`);break;default:r.regex=new RegExp(`${r.type} ${r.old};`)}}),t}_defaultGetUniforms(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={},n=this.uniforms;for(let i in n){let o=n[i];i in t&&!o.private?(o.validate&&_e(o.validate(t[i],o),`${this.name}: invalid ${i}`),r[i]=t[i]):r[i]=o.value}return r}};function zt(e){let t=se.instantiateModules(e);return vf(t)}function vf(e){let t={},r={};return qi({modules:e,level:0,moduleMap:t,moduleDepth:r}),Object.keys(r).sort((n,i)=>r[i]-r[n]).map(n=>t[n])}function qi(e){let{modules:t,level:r,moduleMap:n,moduleDepth:i}=e;if(r>=5)throw new Error("Possible loop in shader dependency graph");for(let o of t)n[o.name]=o,(i[o.name]===void 0||i[o.name]<r)&&(i[o.name]=r);for(let o of t)o.dependencies&&qi({modules:o.dependencies,level:r+1,moduleMap:n,moduleDepth:i})}function Qi(e){switch(e?.gpu.toLowerCase()){case"apple":return X`\
|
|
38
40
|
#define APPLE_GPU
|
|
39
41
|
// Apple optimizes away the calculation necessary for emulated fp64
|
|
40
42
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
41
43
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
42
44
|
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
43
45
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
44
|
-
`;case"nvidia":return
|
|
46
|
+
`;case"nvidia":return X`\
|
|
45
47
|
#define NVIDIA_GPU
|
|
46
48
|
// Nvidia optimizes away the calculation necessary for emulated fp64
|
|
47
49
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
48
|
-
`;case"intel":return
|
|
50
|
+
`;case"intel":return X`\
|
|
49
51
|
#define INTEL_GPU
|
|
50
52
|
// Intel optimizes away the calculation necessary for emulated fp64
|
|
51
53
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
@@ -53,9 +55,9 @@ ${r}// END MODULE_${this.name}
|
|
|
53
55
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
54
56
|
// Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
|
|
55
57
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
56
|
-
`;case"amd":return
|
|
58
|
+
`;case"amd":return X`\
|
|
57
59
|
#define AMD_GPU
|
|
58
|
-
`;default:return
|
|
60
|
+
`;default:return X`\
|
|
59
61
|
#define DEFAULT_GPU
|
|
60
62
|
// Prevent driver from optimizing away the calculation necessary for emulated fp64
|
|
61
63
|
#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
|
|
@@ -63,75 +65,85 @@ ${r}// END MODULE_${this.name}
|
|
|
63
65
|
#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
|
|
64
66
|
// If the GPU doesn't have full 32 bits precision, will causes overflow
|
|
65
67
|
#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
|
|
66
|
-
`}}function
|
|
67
|
-
#if (__VERSION__ > 120)
|
|
68
|
+
`}}function Ji(e){let t="";return e.features.has("webgl2")&&(t+=X`\
|
|
68
69
|
# define FEATURE_GLSL_DERIVATIVES
|
|
69
70
|
# define FEATURE_GLSL_DRAW_BUFFERS
|
|
70
71
|
# define FEATURE_GLSL_FRAG_DEPTH
|
|
71
72
|
# define FEATURE_GLSL_TEXTURE_LOD
|
|
72
|
-
|
|
73
|
-
`;return!e.features.has("webgl2")&&e.features.has("glsl-frag-depth")&&(t+=$`\
|
|
73
|
+
`),e.features.has("webgl2")||(e.features.has("glsl-frag-depth")&&(t+=X`\
|
|
74
74
|
|
|
75
|
-
//
|
|
75
|
+
// FEATURE_GLSL_FRAG_DEPTH => gl_FragDepth is available
|
|
76
76
|
#ifdef GL_EXT_frag_depth
|
|
77
77
|
# extension GL_EXT_frag_depth : enable
|
|
78
78
|
# define FEATURE_GLSL_FRAG_DEPTH
|
|
79
79
|
# define FRAG_DEPTH
|
|
80
80
|
# define gl_FragDepth gl_FragDepthEXT
|
|
81
81
|
#endif
|
|
82
|
-
`)
|
|
82
|
+
`),e!=null&&e.features.has("glsl-derivatives")&&(t+=X`\
|
|
83
83
|
|
|
84
|
-
//
|
|
84
|
+
// FEATURE_GLSL_DERIVATIVES => dxdF, dxdY and fwidth are available
|
|
85
85
|
#if defined(GL_OES_standard_derivatives) || defined(FEATURE_GLSL_DERIVATIVES)
|
|
86
86
|
# extension GL_OES_standard_derivatives : enable
|
|
87
87
|
# define FEATURE_GLSL_DERIVATIVES
|
|
88
|
-
# define DERIVATIVES
|
|
89
88
|
#endif
|
|
90
|
-
`)
|
|
89
|
+
`),e!=null&&e.features.has("glsl-frag-data")&&(t+=X`\
|
|
91
90
|
|
|
92
|
-
//
|
|
91
|
+
// FEATURE_GLSL_DRAW_BUFFERS => gl_FragData[] is available
|
|
93
92
|
#ifdef GL_EXT_draw_buffers
|
|
94
93
|
# extension GL_EXT_draw_buffers : require
|
|
95
94
|
# define FEATURE_GLSL_DRAW_BUFFERS
|
|
96
|
-
# define DRAW_BUFFERS
|
|
97
95
|
#endif
|
|
98
|
-
`)
|
|
96
|
+
`),e!=null&&e.features.has("glsl-texture-lod")&&(t+=X`\
|
|
99
97
|
// TEXTURE_LOD => texture2DLod etc are available
|
|
100
98
|
#ifdef GL_EXT_shader_texture_lod
|
|
101
99
|
# extension GL_EXT_shader_texture_lod : enable
|
|
102
100
|
# define FEATURE_GLSL_TEXTURE_LOD
|
|
103
101
|
# define TEXTURE_LOD
|
|
104
102
|
#endif
|
|
105
|
-
`),t}function
|
|
106
|
-
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
`}o.
|
|
110
|
-
|
|
103
|
+
`)),t}function eo(e,t,r){var n;if(Number(((n=e.match(/^#version[ \t]+(\d+)/m))===null||n===void 0?void 0:n[1])||100)!==300)throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");switch(t){case 300:switch(r){case"vertex":return e=jt(e,mf),e;case"fragment":return e=jt(e,bf),e;default:throw new Error(r)}case 100:switch(r){case"vertex":return e=jt(e,Sf),e;case"fragment":return e=jt(e,no),e=yf(e),e;default:throw new Error(r)}default:throw new Error(String(t))}}var to=[[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/,`#version 300 es
|
|
104
|
+
`],[/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g,"textureLod("],[/\btexture(2D|2DProj|Cube)(EXT)?\(/g,"texture("]],mf=[...to,[nt("attribute"),"in $1"],[nt("varying"),"out $1"]],bf=[...to,[nt("varying"),"in $1"]],ro=[[/^#version[ \t]+300[ \t]+es/,"#version 100"],[/\btexture(2D|2DProj|Cube)Lod\(/g,"texture$1LodEXT("],[/\btexture\(/g,"texture2D("],[/\btextureLod\(/g,"texture2DLodEXT("]],Sf=[...ro,[nt("in"),"attribute $1"],[nt("out"),"varying $1"]],no=[...ro,[nt("in"),"varying $1"]],Rf="gl_FragColor",Gi=/\bout[ \t]+vec4[ \t]+(\w+)[ \t]*;\n?/;function jt(e,t){for(let[r,n]of t)e=e.replace(r,n);return e}function yf(e){e=jt(e,no);let t=Gi.exec(e);if(t){let r=t[1];e=e.replace(Gi,"").replace(new RegExp(`\\b${r}\\b`,"g"),Rf)}return e}function nt(e){return new RegExp(`\\b${e}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`,"g")}function wn(e,t){let r="";for(let n in e){let i=e[n];if(r+=`void ${i.signature} {
|
|
105
|
+
`,i.header&&(r+=` ${i.header}`),t[n]){let o=t[n];o.sort((a,s)=>a.order-s.order);for(let a of o)r+=` ${a.injection}
|
|
106
|
+
`}i.footer&&(r+=` ${i.footer}`),r+=`}
|
|
107
|
+
`}return r}function Bn(e){let t={vertex:{},fragment:{}};for(let r of e){let n,i;typeof r!="string"?(n=r,i=n.hook):(n={},i=r),i=i.trim();let[o,a]=i.split(":"),s=i.replace(/\(.+/,""),l=Object.assign(n,{signature:a});switch(o){case"vs":t.vertex[s]=l;break;case"fs":t.fragment[s]=l;break;default:throw new Error(o)}}return t}function io(e,t){return{name:Ef(e,t),language:"glsl",version:xf(e)}}function Ef(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return n?n[1]:t}function xf(e){let t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}if(t!==100&&t!==300)throw new Error(`Invalid GLSL version ${t}`);return t}var lo=`
|
|
108
|
+
|
|
109
|
+
${Xt}
|
|
110
|
+
`,Of=X`\
|
|
111
|
+
precision highp float;
|
|
112
|
+
`;function fo(e){let{vs:t,fs:r}=e,n=zt(e.modules||[]);switch(e.platformInfo.shaderLanguage){case"glsl":return{vs:ao(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:ao(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)};case"wgsl":return{vs:oo(e.platformInfo,{...e,source:t,stage:"vertex",modules:n}),fs:oo(e.platformInfo,{...e,source:r,stage:"fragment",modules:n}),getUniforms:so(n)}}}function oo(e,t){let{source:r,stage:n,modules:i,defines:o={},hookFunctions:a=[],inject:s={},log:l}=t;_e(typeof r=="string","shader source must be a string");let f=r,u={};i.forEach(_=>{Object.assign(u,_.getDefines())}),Object.assign(u,o);let c="",d=Bn(a),g={},h={},A={};for(let _ in s){let v=typeof s[_]=="string"?{injection:s[_],order:0}:s[_],T=/^(v|f)s:(#)?([\w-]+)$/.exec(_);if(T){let m=T[2],E=T[3];m?E==="decl"?h[_]=[v]:A[_]=[v]:g[_]=[v]}else A[_]=[v]}for(let _ of i){l&&_.checkDeprecations(f,l);let v=_.getModuleSource(n,"wgsl");c+=v;let T=_.injections[n];for(let m in T){let E=/^(v|f)s:#([\w-]+)$/.exec(m);if(E){let C=E[2]==="decl"?h:A;C[m]=C[m]||[],C[m].push(T[m])}else g[m]=g[m]||[],g[m].push(T[m])}}return c+=lo,c=Lt(c,n,h),c+=wn(d[n],g),c+=f,c=Lt(c,n,A),c}function ao(e,t){let{id:r,source:n,stage:i,language:o="glsl",modules:a,defines:s={},hookFunctions:l=[],inject:f={},prologue:u=!0,log:c}=t;_e(typeof n=="string","shader source must be a string");let d=o==="glsl"?io(n).version:-1,g=e.shaderLanguageVersion,h=d===100?"#version 100":"#version 300 es",_=n.split(`
|
|
113
|
+
`).slice(1).join(`
|
|
114
|
+
`),v={};a.forEach(N=>{Object.assign(v,N.getDefines())}),Object.assign(v,s);let T="";switch(o){case"wgsl":break;case"glsl":T=u?`${h}
|
|
115
|
+
|
|
116
|
+
// ----- PROLOGUE -------------------------
|
|
117
|
+
${Cf({id:r,source:n,stage:i})}
|
|
118
|
+
${`#define SHADER_TYPE_${i.toUpperCase()}`}
|
|
119
|
+
${Qi(e)}
|
|
120
|
+
${Ji(e)}
|
|
121
|
+
${i==="fragment"?Of:""}
|
|
111
122
|
|
|
112
|
-
|
|
123
|
+
// ----- APPLICATION DEFINES -------------------------
|
|
113
124
|
|
|
114
|
-
|
|
115
|
-
precision highp float;
|
|
125
|
+
${Pf(v)}
|
|
116
126
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
`)):g=`#version ${p}`;let m=_?100:p,R={};u.forEach(B=>{Object.assign(R,B.getDefines())}),Object.assign(R,l);let S="";switch(s){case"wgsl":break;case"glsl":S=E?`${g}
|
|
120
|
-
${pl({id:n,source:o,stage:a})}
|
|
121
|
-
${`#define SHADER_TYPE_${a.toUpperCase()}`}
|
|
122
|
-
${Ji(e)}
|
|
123
|
-
${eo(e)}
|
|
124
|
-
${Tl(R)}
|
|
125
|
-
${a==="fragment"?Al:""}
|
|
126
|
-
`:`${g}
|
|
127
|
-
`;break}let y=wn(f),I={},P={},M={};for(let B in c){let z=typeof c[B]=="string"?{injection:c[B],order:0}:c[B],W=/^(v|f)s:(#)?([\w-]+)$/.exec(B);if(W){let L=W[2],re=W[3];L?re==="decl"?P[B]=[z]:M[B]=[z]:I[B]=[z]}else M[B]=[z]}for(let B of u){d&&B.checkDeprecations(T,d);let z=B.getModuleSource(a);S+=z;let W=B.injections[a];for(let L in W){let re=/^(v|f)s:#([\w-]+)$/.exec(L);if(re){let Ie=re[2]==="decl"?P:M;Ie[L]=Ie[L]||[],Ie[L].push(W[L])}else I[L]=I[L]||[],I[L].push(W[L])}}return S+=so,S=jt(S,a,P),S+=Un(y[a],I),S+=T,S=jt(S,a,M),S=to(S,m,a),S.trim()}function ao(e){return function(r){let n={};for(let o of e){let a=o.getUniforms(r,n);Object.assign(n,a)}return n}}function pl(e){let{id:t,source:r,stage:n}=e;return t&&r.indexOf("SHADER_NAME")===-1?`
|
|
127
|
+
`:`${h}
|
|
128
|
+
`;break}let m=Bn(l),E={},O={},C={};for(let N in f){let M=typeof f[N]=="string"?{injection:f[N],order:0}:f[N],U=/^(v|f)s:(#)?([\w-]+)$/.exec(N);if(U){let W=U[2],j=U[3];W?j==="decl"?O[N]=[M]:C[N]=[M]:E[N]=[M]}else C[N]=[M]}for(let N of a){c&&N.checkDeprecations(_,c);let M=N.getModuleSource(i);T+=M;let U=N.injections[i];for(let W in U){let j=/^(v|f)s:#([\w-]+)$/.exec(W);if(j){let oe=j[2]==="decl"?O:C;oe[W]=oe[W]||[],oe[W].push(U[W])}else E[W]=E[W]||[],E[W].push(U[W])}}return T+="// ----- MAIN SHADER SOURCE -------------------------",T+=lo,T=Lt(T,i,O),T+=wn(m[i],E),T+=_,T=Lt(T,i,C),o==="glsl"&&d!==g&&(T=eo(T,g,i)),T.trim()}function so(e){return function(r){let n={};for(let i of e){let o=i.getUniforms(r,n);Object.assign(n,o)}return n}}function Cf(e){let{id:t,source:r,stage:n}=e;return t&&r.indexOf("SHADER_NAME")===-1?`
|
|
128
129
|
#define SHADER_NAME ${t}_${n}
|
|
129
130
|
|
|
130
|
-
`:""}function
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`),r}function fo(e,t){if(!t.vs)throw new Error("no vertex shader");let r=lo(e,t.vs),n;return t.fs&&(n=lo(e,t.fs)),{...t,vs:r,fs:n}}function lo(e,t){if(typeof t=="string")return t;switch(e.type){case"webgpu":if(t!=null&&t.wgsl)return t.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(t!=null&&t.glsl)return t.glsl;throw new Error("WebGL does not support WGSL shaders")}}var ce=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return ce.defaultShaderAssembler=ce.defaultShaderAssembler||new ce,ce.defaultShaderAssembler}addDefaultModule(t){this._defaultModules.find(r=>r.name===(typeof t=="string"?t:t.name))||this._defaultModules.push(t)}removeDefaultModule(t){let r=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==r)}addShaderHook(t,r){r&&(t=Object.assign(r,{hook:t})),this._hookFunctions.push(t)}assembleShaders(t,r){let n=this._getModuleList(r.modules),o=this._hookFunctions,a=fo(t,r);return uo(t,{...a,modules:n,hookFunctions:o})}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+t.length),n={},o=0;for(let a=0,s=this._defaultModules.length;a<s;++a){let u=this._defaultModules[a],l=u.name;r[o++]=u,n[l]=!0}for(let a=0,s=t.length;a<s;++a){let u=t[a],l=u.name;n[l]||(r[o++]=u,n[l]=!0)}return r.length=o,r}};ce.defaultShaderAssembler=void 0;var Ge=x(F(),1),Tr=class{constructor(t){this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=t.id||(0,Ge.uid)("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&(0,Ge.assert)(this.indices.usage===Ge.Buffer.INDEX)}destroy(){var t;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(t=this.attributes.colors)===null||t===void 0||t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(t){return t.byteLength/12}};function co(e,t){if(t instanceof Tr)return t;let r=Rl(e,t),{attributes:n,bufferLayout:o}=ml(e,t);return new Tr({topology:t.topology||"triangle-list",bufferLayout:o,vertexCount:t.vertexCount,indices:r,attributes:n})}function Rl(e,t){if(!t.indices)return;let r=t.indices.value;return e.createBuffer({usage:Ge.Buffer.INDEX,data:r})}function ml(e,t){let r=[],n={};for(let[a,s]of Object.entries(t.attributes)){let u=a;switch(a){case"POSITION":u="positions";break;case"NORMAL":u="normals";break;case"TEXCOORD_0":u="texCoords";break}n[u]=e.createBuffer({data:s.value,id:`${a}-buffer`}),r.push({name:u,format:`float32x${s.size}`})}let o=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:o}}var _o=x(F(),1),Pe=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new Pe(t),t._lumaData.defaultPipelineFactory}constructor(t){this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=t}createRenderPipeline(t){let r={...Pe.defaultProps,...t},n=this._hashRenderPipeline({...r});if(!this._pipelineCache[n]){let o=this.device.createRenderPipeline({...r,vs:this.device.createShader({stage:"vertex",source:r.vs}),fs:r.fs?this.device.createShader({stage:"fragment",source:r.fs}):null});o.hash=n,this._pipelineCache[n]=o,this._useCounts[n]=0}return this._useCounts[n]++,this._pipelineCache[n]}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._pipelineCache[r].destroy(),delete this._pipelineCache[r],delete this._useCounts[r])}_createRenderPipeline(t){if(!t.fs)throw new Error("fs");return this.device.createRenderPipeline({...t,vs:this.device.createShader({stage:"vertex",source:t.vs}),fs:t.fs?this.device.createShader({stage:"fragment",source:t.fs}):null})}_hashRenderPipeline(t){let r=this._getHash(t.vs),n=t.fs?this._getHash(t.fs):0,o="-";switch(this.device.info.type){case"webgpu":let a=this._getHash(JSON.stringify(t.parameters)),s=this._getHash(JSON.stringify(t.bufferLayout));return`${r}/${n}V${o}T${t.topology}P${a}BL${s}}`;default:return`${r}/${n}V${o}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}};Pe.defaultProps={..._o.RenderPipeline.defaultProps,vs:void 0,fs:void 0};var J=class{constructor(t,r){this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.pipeline=void 0,this.vertexArray=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this.props={...J.defaultProps,...r},r=this.props,this.id=r.id||(0,ne.uid)("model"),this.device=t,Object.assign(this.userData,r.userData);let n={type:t.info.type,shaderLanguage:t.info.shadingLanguages[0],gpu:t.info.gpu,features:t.features},{vs:o,fs:a,getUniforms:s}=this.props.shaderAssembler.assembleShaders(n,this.props);if(this.vs=o,this.fs=a,this._getModuleUniforms=s,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&(this._gpuGeometry=this.setGeometry(r.geometry)),this.pipelineFactory=r.pipelineFactory||Pe.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&this.updateModuleSettings(r.moduleSettings),this.setUniforms(this._getModuleUniforms()),Object.seal(this)}destroy(){this.pipelineFactory.release(this.pipeline)}draw(t){this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount})}setGeometry(t){let r=t&&co(this.device,t);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=Eo(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(t){this.vertexCount=t.vertexCount,this.setAttributes(t.attributes),this.setIndexBuffer(t.indices)}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){this.bufferLayout=this._gpuGeometry?Eo(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){(0,ne.deepEqual)(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(t){this.vertexCount=t}setInstanceCount(t){this.instanceCount=t}setShaderModuleProps(t){let r=this._getModuleUniforms(t),n=Object.keys(r).filter(a=>{let s=r[a];return!(0,ne.isNumberArray)(s)&&typeof s!="number"&&typeof s!="boolean"}),o={};for(let a of n)o[a]=r[a],delete r[a];Object.assign(this.uniforms,r),Object.assign(this.bindings,o)}updateModuleSettings(t){this.setShaderModuleProps(t)}setBindings(t){Object.assign(this.bindings,t)}setUniforms(t){this.pipeline.setUniforms(t),Object.assign(this.uniforms,t)}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t)}setAttributes(t){t.indices&&ne.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`);for(let[n,o]of Object.entries(t)){var r;let a=this.bufferLayout.find(l=>l.name===n);if(!a)continue;let s=a.attributes?(r=a.attributes)===null||r===void 0?void 0:r.map(l=>l.attribute):[a.name],u=!1;for(let l of s){let f=this._attributeInfos[l];f&&(this.vertexArray.setBuffer(f.location,o),u=!0)}u||ne.log.warn(`Model(${this.id}): Ignoring buffer "${o.id}" for unknown attribute "${n}"`)()}}setConstantAttributes(t){for(let[r,n]of Object.entries(t)){let o=this._attributeInfos[r];o?this.vertexArray.setConstant(o.location,n):ne.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||t}_updatePipeline(){return this._pipelineNeedsUpdate&&(this.pipeline&&ne.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null}),this._attributeInfos=(0,go.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline}};J.defaultProps={...ne.RenderPipeline.defaultProps,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:{},geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},pipelineFactory:void 0,shaderAssembler:ce.getDefaultShaderAssembler()};function Eo(e,t){let r=[...e];for(let n of t){let o=r.findIndex(a=>a.name===n.name);o<0?r.push(n):r[o]=n}return r}var Me=class{static isSupported(t){return!1}constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.device=void 0,this.gl=void 0,this.elementCount=0,this.elementIDBuffer=null}destroy(){}delete(){this.destroy()}run(t){let{clearRenderTarget:r=!0}=t||{},n=this._updateDrawOptions(t);r&&n.framebuffer}swap(){}getBuffer(t){return null}getData(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}}getFramebuffer(){return null}update(t){}_updateModelProps(t){return{...t}}_buildResourceTransforms(t){}_updateDrawOptions(t){return{...t}}};var at=x(F(),1),be=class{constructor(t){this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};let{attributes:r={},indices:n=null,vertexCount:o=null}=t;this.id=t.id||(0,at.uid)("geometry"),this.topology=t.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[a,s]of Object.entries(r)){let u=ArrayBuffer.isView(s)?{value:s}:s;(0,at.assert)(ArrayBuffer.isView(u.value),`${this._print(a)}: must be typed array or object with value as typed array`),(a==="POSITION"||a==="positions")&&!u.size&&(u.size=3),a==="indices"?((0,at.assert)(!this.indices),this.indices=u):this.attributes[a]=u}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=o||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,r){return this}_calculateVertexCount(t,r){if(r)return r.value.length;let n=1/0;for(let o of Object.values(t)){let{value:a,size:s,constant:u}=o;!u&&a&&s>=1&&(n=Math.min(n,a.length/s))}return(0,at.assert)(Number.isFinite(n)),n}};var ho=x(F(),1);var Yt=class extends be{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=(0,ho.uid)("cube-geometry"),indices:n=!0}=t;super(n?{...t,id:r,topology:"triangle-list",indices:{size:1,value:Sl},attributes:{...Il,...t.attributes}}:{...t,id:r,topology:"triangle-list",indices:void 0,attributes:{...xl,...t.attributes}})}},Sl=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Ol=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),vl=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),bl=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),Nl=new Float32Array([1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1]),Cl=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),yl=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),Il={POSITION:{size:3,value:Ol},NORMAL:{size:3,value:vl},TEXCOORD_0:{size:2,value:bl}},xl={POSITION:{size:4,value:Nl},TEXCOORD_0:{size:2,value:Cl},COLOR_0:{size:3,value:yl}};var Ao=e=>`${e}`;function Ln(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Math.fround(e),o=e-n;return t[r]=n,t[r+1]=o,t}function po(e){return e-Math.fround(e)}function To(e){let t=new Float32Array(32);for(let r=0;r<4;++r)for(let n=0;n<4;++n){let o=r*4+n;Ln(e[n*4+r],t,o*2)}return t}var Ro=Ao`\
|
|
131
|
+
`:""}function Pf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t="";for(let r in e){let n=e[r];(n||Number.isFinite(n))&&(t+=`#define ${r.toUpperCase()} ${e[r]}
|
|
132
|
+
`)}return t}function co(e){if(!e.vs)throw new Error("no vertex shader");let t=uo(e.platformInfo,e.vs),r;return e.fs&&(r=uo(e.platformInfo,e.fs)),{...e,vs:t,fs:r}}function uo(e,t){if(typeof t=="string")return t;switch(e.type){case"webgpu":if(t!=null&&t.wgsl)return t.wgsl;throw new Error("WebGPU does not support GLSL shaders");default:if(t!=null&&t.glsl)return t.glsl;throw new Error("WebGL does not support WGSL shaders")}}var le=class{constructor(){this._hookFunctions=[],this._defaultModules=[]}static getDefaultShaderAssembler(){return le.defaultShaderAssembler=le.defaultShaderAssembler||new le,le.defaultShaderAssembler}addDefaultModule(t){this._defaultModules.find(r=>r.name===(typeof t=="string"?t:t.name))||this._defaultModules.push(t)}removeDefaultModule(t){let r=typeof t=="string"?t:t.name;this._defaultModules=this._defaultModules.filter(n=>n.name!==r)}addShaderHook(t,r){r&&(t=Object.assign(r,{hook:t})),this._hookFunctions.push(t)}assembleShaders(t){let r=this._getModuleList(t.modules),n=this._hookFunctions,i=co(t);return{...fo({platformInfo:t.platformInfo,...i,modules:r,hookFunctions:n}),modules:r}}_getModuleList(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=new Array(this._defaultModules.length+t.length),n={},i=0;for(let o=0,a=this._defaultModules.length;o<a;++o){let s=this._defaultModules[o],l=s.name;r[i++]=s,n[l]=!0}for(let o=0,a=t.length;o<a;++o){let s=t[o],l=s.name;n[l]||(r[i++]=s,n[l]=!0)}return r.length=i,se.instantiateModules(r)}};le.defaultShaderAssembler=void 0;var Nf=X`void main() {gl_FragColor = vec4(0);}`,go=X`\
|
|
133
|
+
out vec4 transform_output;
|
|
134
|
+
void main() {
|
|
135
|
+
transform_output = vec4(0);
|
|
136
|
+
}`,Mf=`#version 300 es
|
|
137
|
+
${go}`;function Un(e){let{version:t=100,input:r,inputChannels:n,output:i}=e||{};if(!r)return t===300?Mf:t>300?`#version ${t}
|
|
138
|
+
${go}`:Nf;if(!n)throw new Error("inputChannels");let o=If(n),a=ho(r,n);return t>=300?`#version ${t} ${t===300?"es":""}
|
|
139
|
+
in ${o} ${r};
|
|
140
|
+
out vec4 ${i};
|
|
141
|
+
void main() {
|
|
142
|
+
${i} = ${a};
|
|
143
|
+
}`:`varying ${o} ${r};
|
|
144
|
+
void main() {
|
|
145
|
+
gl_FragColor = ${a};
|
|
146
|
+
}`}function If(e){switch(e){case 1:return"float";case 2:return"vec2";case 3:return"vec3";case 4:return"vec4";default:throw new Error(`invalid channels: ${e}`)}}function ho(e,t){switch(t){case 1:return`vec4(${e}, 0.0, 0.0, 1.0)`;case 2:return`vec4(${e}, 0.0, 1.0)`;case 3:return`vec4(${e}, 1.0)`;case 4:return e;default:throw new Error(`invalid channels: ${t}`)}}function Wn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Math.fround(e),i=e-n;return t[r]=n,t[r+1]=i,t}function _o(e){return e-Math.fround(e)}function po(e){let t=new Float32Array(32);for(let r=0;r<4;++r)for(let n=0;n<4;++n){let i=r*4+n;Wn(e[n*4+r],t,i*2)}return t}var Ao=X`\
|
|
135
147
|
uniform float ONE;
|
|
136
148
|
|
|
137
149
|
/*
|
|
@@ -139,7 +151,7 @@ About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
|
139
151
|
|
|
140
152
|
The purpose of this workaround is to prevent shader compilers from
|
|
141
153
|
optimizing away necessary arithmetic operations by swapping their sequences
|
|
142
|
-
or transform the equation to some 'equivalent'
|
|
154
|
+
or transform the equation to some 'equivalent' form.
|
|
143
155
|
|
|
144
156
|
The method is to multiply an artifical variable, ONE, which will be known to
|
|
145
157
|
the compiler to be 1 only at runtime. The whole expression is then represented
|
|
@@ -297,21 +309,21 @@ vec2 sqrt_fp64(vec2 a) {
|
|
|
297
309
|
return sum_fp64(vec2(yn, 0.0), prod);
|
|
298
310
|
#endif
|
|
299
311
|
}
|
|
300
|
-
`;var Pl={ONE:1};function Ml(){return Pl}var st={name:"fp64-arithmetic",vs:Ro,getUniforms:Ml,fp64ify:Ln,fp64LowPart:po,fp64ifyMatrix4:To};var Fl="Failed to create WebGL context in Node.js, headless gl returned null",Dl=" luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server.",Bl={width:1,height:1,debug:!0,throwOnError:!1},Xn=null;function mo(){return Xn!==null}function So(e){e={...Bl,...e};let{width:t,height:r,webgl1:n,webgl2:o}=e;if(o&&!n)throw new Error("headless-gl does not support WebGL2");if(!Xn)throw new Error(Dl);let a=Xn(t,r,e);if(!a)throw new Error(Fl);return a}var V=x(F(),1);function kt(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function _e(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||kt()}var Rh=globalThis.self||globalThis.window||globalThis.global,mh=globalThis.window||globalThis.self||globalThis.global,Sh=globalThis.document||{},Oh=globalThis.process||{},vh=globalThis.console,Oo=globalThis.navigator||{};var Wn=globalThis;function Rr(e){if(!e&&!_e())return"Node";if(kt(e))return"Electron";let t=e||Oo.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Wn.chrome?"Chrome":Wn.safari?"Safari":Wn.mozInnerScreenX?"Firefox":"Unknown"}var Po=x(F(),1);var $t={};function Ul(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function wl(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function Ll(e,t){$t[e]=!0,t!==void 0&&Ul(t)}function Xl(e){let t=e.getError;e.getError=function(){let n;do n=t.apply(e),n!==e.NO_ERROR&&($t[n]=!0);while(n!==e.NO_ERROR);for(n in $t)if($t[n])return delete $t[n],parseInt(n,10);return e.NO_ERROR}}var Zt=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let n=0;n<this.attribs.length;n++){let o=new e.VertexAttrib(r);this.attribs[n]=o}this.maxAttrib=0};Zt.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=t.FLOAT,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};Zt.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var ze=function(t){let r=this;this.gl=t,Xl(t);let n=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(a){return a===r.VERTEX_ARRAY_BINDING_OES?r.currentVertexArrayObject===r.defaultVertexArrayObject?null:r.currentVertexArrayObject:n.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(a){let s=r.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,a);let u=s.attribs[a];return u.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(a){let s=r.currentVertexArrayObject;s.maxAttrib=Math.max(s.maxAttrib,a);let u=s.attribs[a];return u.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(a,s){switch(a){case t.ARRAY_BUFFER:r.currentArrayBuffer=s;break;case t.ELEMENT_ARRAY_BUFFER:r.currentVertexArrayObject.elementArrayBuffer=s;break;default:}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(a,s){let l=r.currentVertexArrayObject.attribs[a];switch(s){case t.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:return l.buffer;case t.VERTEX_ATTRIB_ARRAY_ENABLED:return l.enabled;case t.VERTEX_ATTRIB_ARRAY_SIZE:return l.size;case t.VERTEX_ATTRIB_ARRAY_STRIDE:return l.stride;case t.VERTEX_ATTRIB_ARRAY_TYPE:return l.type;case t.VERTEX_ATTRIB_ARRAY_NORMALIZED:return l.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(a,s,u,l,f,c){let _=r.currentVertexArrayObject;_.maxAttrib=Math.max(_.maxAttrib,a);let E=_.attribs[a];return E.buffer=r.currentArrayBuffer,E.size=s,E.type=u,E.normalized=l,E.stride=f,E.offset=c,E.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{wl("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};ze.prototype.VERTEX_ARRAY_BINDING_OES=34229;ze.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let n=0;n<this.vertexArrayObjects.length;++n)this.vertexArrayObjects.isAlive=!1;let r=this.gl;this.maxVertexAttribs=r.getParameter(r.MAX_VERTEX_ATTRIBS),this.defaultVertexArrayObject=new Zt(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};ze.prototype.createVertexArrayOES=function(){let t=new Zt(this);return this.vertexArrayObjects.push(t),t};ze.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};ze.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof Zt&&t.hasBeenBound&&t.ext===this)};ze.prototype.bindVertexArrayOES=function(t){let r=this.gl;if(t&&!t.isAlive){Ll(r.INVALID_OPERATION,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}let n=this.original,o=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;let a=this.currentVertexArrayObject;if(o===a)return;(!o||a.elementArrayBuffer!==o.elementArrayBuffer)&&n.bindBuffer.call(r,r.ELEMENT_ARRAY_BUFFER,a.elementArrayBuffer);let s=this.currentArrayBuffer,u=Math.max(o?o.maxAttrib:0,a.maxAttrib);for(let l=0;l<=u;l++){let f=a.attribs[l],c=o?o.attribs[l]:null;if((!o||f.enabled!==c.enabled)&&(f.enabled?n.enableVertexAttribArray.call(r,l):n.disableVertexAttribArray.call(r,l)),f.enabled){let _=!1;(!o||f.buffer!==c.buffer)&&(s!==f.buffer&&(n.bindBuffer.call(r,r.ARRAY_BUFFER,f.buffer),s=f.buffer),_=!0),(_||f.cached!==c.cached)&&n.vertexAttribPointer.call(r,l,f.size,f.type,f.normalized,f.stride,f.offset)}}this.currentArrayBuffer!==s&&n.bindBuffer.call(r,r.ARRAY_BUFFER,this.currentArrayBuffer)};function vo(e){if(typeof e.createVertexArray=="function")return;let t=e.getSupportedExtensions;e.getSupportedExtensions=function(){let o=t.call(this)||[];return o.indexOf("OES_vertex_array_object")<0&&o.push("OES_vertex_array_object"),o};let r=e.getExtension;e.getExtension=function(o){let a=r.call(this,o);return a||(o!=="OES_vertex_array_object"?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new ze(this)),this.__OESVertexArrayObject))}}var je=x(F(),1);var Hn=x(F(),1),Wl="Invalid WebGLRenderingContext";var Hl="Requires WebGL2";function Vl(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function D(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Vn(e){return D(e)?e:null}function bo(e){return(0,Hn.assert)(Vl(e),Wl),e}function mr(e){return(0,Hn.assert)(D(e),Hl),e}var No="OES_element_index",Co="WEBGL_draw_buffers",Kl="EXT_disjoint_timer_query",Gl="EXT_disjoint_timer_query_webgl2",zl="EXT_texture_filter_anisotropic",yo="WEBGL_debug_renderer_info",jl=35723,Yl=4352,kl=36795,$l=34047,Zl=37445,ql=37446,X=e=>D(e)?void 0:0,Ql={[i.READ_BUFFER]:e=>D(e)?void 0:i.COLOR_ATTACHMENT0,[jl]:e=>D(e)?void 0:Yl,[i.RASTERIZER_DISCARD]:X,[i.SAMPLES]:X,[kl]:(e,t)=>{let r=D(e)?e.getExtension(Gl):e.getExtension(Kl);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[Zl]:(e,t)=>{let r=e.getExtension(yo);return t(r&&r.UNMASKED_VENDOR_WEBGL||i.VENDOR)},[ql]:(e,t)=>{let r=e.getExtension(yo);return t(r&&r.UNMASKED_RENDERER_WEBGL||i.RENDERER)},[$l]:(e,t)=>{var r;let n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[zl])||e.getExtension("EXT_texture_filter_anisotropic");return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},[i.MAX_3D_TEXTURE_SIZE]:X,[i.MAX_ARRAY_TEXTURE_LAYERS]:X,[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]:X,[i.MAX_COLOR_ATTACHMENTS]:(e,t)=>{if(!D(e)){let r=e.getExtension(Co);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]:X,[i.MAX_COMBINED_UNIFORM_BLOCKS]:X,[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]:X,[i.MAX_DRAW_BUFFERS]:e=>{if(!D(e)){let t=e.getExtension(Co);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},[i.MAX_ELEMENT_INDEX]:e=>e.getExtension(No)?2147483647:65535,[i.MAX_ELEMENTS_INDICES]:e=>e.getExtension(No)?16777216:65535,[i.MAX_ELEMENTS_VERTICES]:e=>16777216,[i.MAX_FRAGMENT_INPUT_COMPONENTS]:X,[i.MAX_FRAGMENT_UNIFORM_BLOCKS]:X,[i.MAX_FRAGMENT_UNIFORM_COMPONENTS]:X,[i.MAX_SAMPLES]:X,[i.MAX_SERVER_WAIT_TIMEOUT]:X,[i.MAX_TEXTURE_LOD_BIAS]:X,[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]:X,[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]:X,[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]:X,[i.MAX_UNIFORM_BLOCK_SIZE]:X,[i.MAX_UNIFORM_BUFFER_BINDINGS]:X,[i.MAX_VARYING_COMPONENTS]:X,[i.MAX_VERTEX_OUTPUT_COMPONENTS]:X,[i.MAX_VERTEX_UNIFORM_BLOCKS]:X,[i.MAX_VERTEX_UNIFORM_COMPONENTS]:X,[i.MIN_PROGRAM_TEXEL_OFFSET]:X,[i.MAX_PROGRAM_TEXEL_OFFSET]:X,[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT]:X};function Io(e,t,r){let n=Ql[r],o=typeof n=="function"?n(e,t,r):n;return o!==void 0?o:t(r)}function ut(e){if(!e.luma){let r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var Jl="OES_vertex_array_object",xo="ANGLE_instanced_arrays",ef="WEBGL_draw_buffers",tf="EXT_disjoint_timer_query",rf="EXT_texture_filter_anisotropic",nf="VertexArray requires WebGL2 or OES_vertex_array_object extension";function of(e,t){return{webgl2:D(e),ext:e.getExtension(t)}}var Kn={[Jl]:{meta:{suffix:"OES"},createVertexArray:()=>{(0,je.assert)(!1,nf)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[xo]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){(0,je.assert)(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[ef]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{(0,je.assert)(!1)}},[tf]:{meta:{suffix:"EXT"},createQuery:()=>{(0,je.assert)(!1)},deleteQuery:()=>{(0,je.assert)(!1)},beginQuery:()=>{(0,je.assert)(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:(e,t)=>{}}},Sr={readBuffer:(e,t,r)=>{D(e)&&t(r)},getVertexAttrib:(e,t,r,n)=>{let{webgl2:o,ext:a}=of(e,xo),s;switch(n){case i.VERTEX_ATTRIB_ARRAY_INTEGER:s=o?void 0:!1;break;case i.VERTEX_ATTRIB_ARRAY_DIVISOR:s=!o&&!a?0:void 0;break;default:}return s!==void 0?s:t(r,n)},getProgramParameter:(e,t,r,n)=>{if(!D(e))switch(n){case i.TRANSFORM_FEEDBACK_BUFFER_MODE:return i.SEPARATE_ATTRIBS;case i.TRANSFORM_FEEDBACK_VARYINGS:return 0;case i.ACTIVE_UNIFORM_BLOCKS:return 0;default:}return t(r,n)},getInternalformatParameter:(e,t,r,n,o)=>{if(!D(e))switch(o){case i.SAMPLES:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,n,o)},getTexParameter(e,t,r,n){switch(n){case i.TEXTURE_MAX_ANISOTROPY_EXT:let o=ut(e),{_extensions:a}=o,s=a[rf];n=s&&s.TEXTURE_MAX_ANISOTROPY_EXT||i.TEXTURE_MAX_ANISOTROPY_EXT;break;default:}return t(r,n)},getParameter:Io,hint(e,t,r,n){return t(r,n)}};function Mo(e){let t=ut(e);return t._polyfilled||(vo(e),af(e),sf(e,Kn),lf(e,{target:t,target2:e}),t._polyfilled=!0),e}function af(e){let t=ut(e),r=e.getSupportedExtensions()||[];for(let n of r){let o=e.getExtension(n);t._extensions[n]=o}}function sf(e,t){let r=ut(e);for(let n of Object.getOwnPropertyNames(t))n!=="overrides"&&uf(e,{extension:n,target:r,target2:e})}function uf(e,t){let{extension:r,target:n,target2:o}=t,a=Kn[r];(0,Po.assert)(a);let{meta:s={}}=a,{suffix:u=""}=s,l=e.getExtension(r);for(let f of Object.keys(a)){let c=`${f}${u}`,_=null;f==="meta"||typeof e[f]=="function"||(l&&typeof l[c]=="function"?_=function(){return l[c](...arguments)}:typeof a[f]=="function"&&(_=a[f].bind(n))),_&&(n[f]=_,o[f]=_)}}function lf(e,t){let{target:r,target2:n}=t;Object.keys(Sr).forEach(o=>{if(typeof Sr[o]=="function"){let a=e[o]?e[o].bind(e):()=>{},s=Sr[o].bind(null,e,a);r[o]=s,n[o]=s}})}var Qt=x(F(),1);var Or={[i.BLEND]:!1,[i.BLEND_COLOR]:new Float32Array([0,0,0,0]),[i.BLEND_EQUATION_RGB]:i.FUNC_ADD,[i.BLEND_EQUATION_ALPHA]:i.FUNC_ADD,[i.BLEND_SRC_RGB]:i.ONE,[i.BLEND_DST_RGB]:i.ZERO,[i.BLEND_SRC_ALPHA]:i.ONE,[i.BLEND_DST_ALPHA]:i.ZERO,[i.COLOR_CLEAR_VALUE]:new Float32Array([0,0,0,0]),[i.COLOR_WRITEMASK]:[!0,!0,!0,!0],[i.CULL_FACE]:!1,[i.CULL_FACE_MODE]:i.BACK,[i.DEPTH_TEST]:!1,[i.DEPTH_CLEAR_VALUE]:1,[i.DEPTH_FUNC]:i.LESS,[i.DEPTH_RANGE]:new Float32Array([0,1]),[i.DEPTH_WRITEMASK]:!0,[i.DITHER]:!0,[i.CURRENT_PROGRAM]:null,[i.FRAMEBUFFER_BINDING]:null,[i.RENDERBUFFER_BINDING]:null,[i.VERTEX_ARRAY_BINDING]:null,[i.ARRAY_BUFFER_BINDING]:null,[i.FRONT_FACE]:i.CCW,[i.GENERATE_MIPMAP_HINT]:i.DONT_CARE,[i.LINE_WIDTH]:1,[i.POLYGON_OFFSET_FILL]:!1,[i.POLYGON_OFFSET_FACTOR]:0,[i.POLYGON_OFFSET_UNITS]:0,[i.SAMPLE_ALPHA_TO_COVERAGE]:!1,[i.SAMPLE_COVERAGE]:!1,[i.SAMPLE_COVERAGE_VALUE]:1,[i.SAMPLE_COVERAGE_INVERT]:!1,[i.SCISSOR_TEST]:!1,[i.SCISSOR_BOX]:new Int32Array([0,0,1024,1024]),[i.STENCIL_TEST]:!1,[i.STENCIL_CLEAR_VALUE]:0,[i.STENCIL_WRITEMASK]:4294967295,[i.STENCIL_BACK_WRITEMASK]:4294967295,[i.STENCIL_FUNC]:i.ALWAYS,[i.STENCIL_REF]:0,[i.STENCIL_VALUE_MASK]:4294967295,[i.STENCIL_BACK_FUNC]:i.ALWAYS,[i.STENCIL_BACK_REF]:0,[i.STENCIL_BACK_VALUE_MASK]:4294967295,[i.STENCIL_FAIL]:i.KEEP,[i.STENCIL_PASS_DEPTH_FAIL]:i.KEEP,[i.STENCIL_PASS_DEPTH_PASS]:i.KEEP,[i.STENCIL_BACK_FAIL]:i.KEEP,[i.STENCIL_BACK_PASS_DEPTH_FAIL]:i.KEEP,[i.STENCIL_BACK_PASS_DEPTH_PASS]:i.KEEP,[i.VIEWPORT]:[0,0,1024,1024],[i.PACK_ALIGNMENT]:4,[i.UNPACK_ALIGNMENT]:4,[i.UNPACK_FLIP_Y_WEBGL]:!1,[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL]:!1,[i.UNPACK_COLORSPACE_CONVERSION_WEBGL]:i.BROWSER_DEFAULT_WEBGL,[i.TRANSFORM_FEEDBACK_BINDING]:null,[i.COPY_READ_BUFFER_BINDING]:null,[i.COPY_WRITE_BUFFER_BINDING]:null,[i.PIXEL_PACK_BUFFER_BINDING]:null,[i.PIXEL_UNPACK_BUFFER_BINDING]:null,[i.FRAGMENT_SHADER_DERIVATIVE_HINT]:i.DONT_CARE,[i.READ_FRAMEBUFFER_BINDING]:null,[i.RASTERIZER_DISCARD]:!1,[i.PACK_ROW_LENGTH]:0,[i.PACK_SKIP_PIXELS]:0,[i.PACK_SKIP_ROWS]:0,[i.UNPACK_ROW_LENGTH]:0,[i.UNPACK_IMAGE_HEIGHT]:0,[i.UNPACK_SKIP_PIXELS]:0,[i.UNPACK_SKIP_ROWS]:0,[i.UNPACK_SKIP_IMAGES]:0},pe=(e,t,r)=>t?e.enable(r):e.disable(r),Fo=(e,t,r)=>e.hint(r,t),ie=(e,t,r)=>e.pixelStorei(r,t),Do=(e,t,r)=>{let n;return r===i.FRAMEBUFFER_BINDING?n=D(e)?i.DRAW_FRAMEBUFFER:i.FRAMEBUFFER:n=i.READ_FRAMEBUFFER,e.bindFramebuffer(n,t)},qt=(e,t,r)=>{let o={[i.ARRAY_BUFFER_BINDING]:i.ARRAY_BUFFER,[i.COPY_READ_BUFFER_BINDING]:i.COPY_READ_BUFFER,[i.COPY_WRITE_BUFFER_BINDING]:i.COPY_WRITE_BUFFER,[i.PIXEL_PACK_BUFFER_BINDING]:i.PIXEL_PACK_BUFFER,[i.PIXEL_UNPACK_BUFFER_BINDING]:i.PIXEL_UNPACK_BUFFER}[r];e.bindBuffer(o,t)};function Gn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var Bo={[i.BLEND]:pe,[i.BLEND_COLOR]:(e,t)=>e.blendColor(...t),[i.BLEND_EQUATION_RGB]:"blendEquation",[i.BLEND_EQUATION_ALPHA]:"blendEquation",[i.BLEND_SRC_RGB]:"blendFunc",[i.BLEND_DST_RGB]:"blendFunc",[i.BLEND_SRC_ALPHA]:"blendFunc",[i.BLEND_DST_ALPHA]:"blendFunc",[i.COLOR_CLEAR_VALUE]:(e,t)=>e.clearColor(...t),[i.COLOR_WRITEMASK]:(e,t)=>e.colorMask(...t),[i.CULL_FACE]:pe,[i.CULL_FACE_MODE]:(e,t)=>e.cullFace(t),[i.DEPTH_TEST]:pe,[i.DEPTH_CLEAR_VALUE]:(e,t)=>e.clearDepth(t),[i.DEPTH_FUNC]:(e,t)=>e.depthFunc(t),[i.DEPTH_RANGE]:(e,t)=>e.depthRange(...t),[i.DEPTH_WRITEMASK]:(e,t)=>e.depthMask(t),[i.DITHER]:pe,[i.FRAGMENT_SHADER_DERIVATIVE_HINT]:Fo,[i.CURRENT_PROGRAM]:(e,t)=>e.useProgram(t),[i.RENDERBUFFER_BINDING]:(e,t)=>e.bindRenderbuffer(i.RENDERBUFFER,t),[i.TRANSFORM_FEEDBACK_BINDING]:(e,t)=>{var r,n;return(r=(n=e).bindTransformFeedback)===null||r===void 0?void 0:r.call(n,i.TRANSFORM_FEEDBACK,t)},[i.VERTEX_ARRAY_BINDING]:(e,t)=>e.bindVertexArray(t),[i.FRAMEBUFFER_BINDING]:Do,[i.READ_FRAMEBUFFER_BINDING]:Do,[i.ARRAY_BUFFER_BINDING]:qt,[i.COPY_READ_BUFFER_BINDING]:qt,[i.COPY_WRITE_BUFFER_BINDING]:qt,[i.PIXEL_PACK_BUFFER_BINDING]:qt,[i.PIXEL_UNPACK_BUFFER_BINDING]:qt,[i.FRONT_FACE]:(e,t)=>e.frontFace(t),[i.GENERATE_MIPMAP_HINT]:Fo,[i.LINE_WIDTH]:(e,t)=>e.lineWidth(t),[i.POLYGON_OFFSET_FILL]:pe,[i.POLYGON_OFFSET_FACTOR]:"polygonOffset",[i.POLYGON_OFFSET_UNITS]:"polygonOffset",[i.RASTERIZER_DISCARD]:pe,[i.SAMPLE_ALPHA_TO_COVERAGE]:pe,[i.SAMPLE_COVERAGE]:pe,[i.SAMPLE_COVERAGE_VALUE]:"sampleCoverage",[i.SAMPLE_COVERAGE_INVERT]:"sampleCoverage",[i.SCISSOR_TEST]:pe,[i.SCISSOR_BOX]:(e,t)=>e.scissor(...t),[i.STENCIL_TEST]:pe,[i.STENCIL_CLEAR_VALUE]:(e,t)=>e.clearStencil(t),[i.STENCIL_WRITEMASK]:(e,t)=>e.stencilMaskSeparate(i.FRONT,t),[i.STENCIL_BACK_WRITEMASK]:(e,t)=>e.stencilMaskSeparate(i.BACK,t),[i.STENCIL_FUNC]:"stencilFuncFront",[i.STENCIL_REF]:"stencilFuncFront",[i.STENCIL_VALUE_MASK]:"stencilFuncFront",[i.STENCIL_BACK_FUNC]:"stencilFuncBack",[i.STENCIL_BACK_REF]:"stencilFuncBack",[i.STENCIL_BACK_VALUE_MASK]:"stencilFuncBack",[i.STENCIL_FAIL]:"stencilOpFront",[i.STENCIL_PASS_DEPTH_FAIL]:"stencilOpFront",[i.STENCIL_PASS_DEPTH_PASS]:"stencilOpFront",[i.STENCIL_BACK_FAIL]:"stencilOpBack",[i.STENCIL_BACK_PASS_DEPTH_FAIL]:"stencilOpBack",[i.STENCIL_BACK_PASS_DEPTH_PASS]:"stencilOpBack",[i.VIEWPORT]:(e,t)=>e.viewport(...t),[i.PACK_ALIGNMENT]:ie,[i.UNPACK_ALIGNMENT]:ie,[i.UNPACK_FLIP_Y_WEBGL]:ie,[i.UNPACK_PREMULTIPLY_ALPHA_WEBGL]:ie,[i.UNPACK_COLORSPACE_CONVERSION_WEBGL]:ie,[i.PACK_ROW_LENGTH]:ie,[i.PACK_SKIP_PIXELS]:ie,[i.PACK_SKIP_ROWS]:ie,[i.UNPACK_ROW_LENGTH]:ie,[i.UNPACK_IMAGE_HEIGHT]:ie,[i.UNPACK_SKIP_PIXELS]:ie,[i.UNPACK_SKIP_ROWS]:ie,[i.UNPACK_SKIP_IMAGES]:ie,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(i.FRAMEBUFFER,r)},blend:(e,t)=>t?e.enable(i.BLEND):e.disable(i.BLEND),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let r=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...r)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(i.CULL_FACE):e.disable(i.CULL_FACE),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(i.DEPTH_TEST):e.disable(i.DEPTH_TEST),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(i.DITHER):e.disable(i.DITHER),derivativeHint:(e,t)=>{e.hint(i.FRAGMENT_SHADER_DERIVATIVE_HINT,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(i.GENERATE_MIPMAP_HINT,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(i.POLYGON_OFFSET_FILL):e.disable(i.POLYGON_OFFSET_FILL),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(i.SCISSOR_TEST):e.disable(i.SCISSOR_TEST),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(i.STENCIL_TEST):e.disable(i.STENCIL_TEST),stencilMask:(e,t)=>{t=Gn(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(i.FRONT,r),e.stencilMaskSeparate(i.BACK,n)},stencilFunc:(e,t)=>{t=Gn(t)&&t.length===3?[...t,...t]:t;let[r,n,o,a,s,u]=t;e.stencilFuncSeparate(i.FRONT,r,n,o),e.stencilFuncSeparate(i.BACK,a,s,u)},stencilOp:(e,t)=>{t=Gn(t)&&t.length===3?[...t,...t]:t;let[r,n,o,a,s,u]=t;e.stencilOpSeparate(i.FRONT,r,n,o),e.stencilOpSeparate(i.BACK,a,s,u)},viewport:(e,t)=>e.viewport(...t)};function H(e,t,r){return t[e]!==void 0?t[e]:r[e]}var Uo={blendEquation:(e,t,r)=>e.blendEquationSeparate(H(i.BLEND_EQUATION_RGB,t,r),H(i.BLEND_EQUATION_ALPHA,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(H(i.BLEND_SRC_RGB,t,r),H(i.BLEND_DST_RGB,t,r),H(i.BLEND_SRC_ALPHA,t,r),H(i.BLEND_DST_ALPHA,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(H(i.POLYGON_OFFSET_FACTOR,t,r),H(i.POLYGON_OFFSET_UNITS,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(H(i.SAMPLE_COVERAGE_VALUE,t,r),H(i.SAMPLE_COVERAGE_INVERT,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(i.FRONT,H(i.STENCIL_FUNC,t,r),H(i.STENCIL_REF,t,r),H(i.STENCIL_VALUE_MASK,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(i.BACK,H(i.STENCIL_BACK_FUNC,t,r),H(i.STENCIL_BACK_REF,t,r),H(i.STENCIL_BACK_VALUE_MASK,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(i.FRONT,H(i.STENCIL_FAIL,t,r),H(i.STENCIL_PASS_DEPTH_FAIL,t,r),H(i.STENCIL_PASS_DEPTH_PASS,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(i.BACK,H(i.STENCIL_BACK_FAIL,t,r),H(i.STENCIL_BACK_PASS_DEPTH_FAIL,t,r),H(i.STENCIL_BACK_PASS_DEPTH_PASS,t,r))},zn={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({[i.CURRENT_PROGRAM]:t}),bindRenderbuffer:(e,t,r)=>e({[i.RENDERBUFFER_BINDING]:r}),bindTransformFeedback:(e,t,r)=>e({[i.TRANSFORM_FEEDBACK_BINDING]:r}),bindVertexArray:(e,t)=>e({[i.VERTEX_ARRAY_BINDING]:t}),bindFramebuffer:(e,t,r)=>{switch(t){case i.FRAMEBUFFER:return e({[i.DRAW_FRAMEBUFFER_BINDING]:r,[i.READ_FRAMEBUFFER_BINDING]:r});case i.DRAW_FRAMEBUFFER:return e({[i.DRAW_FRAMEBUFFER_BINDING]:r});case i.READ_FRAMEBUFFER:return e({[i.READ_FRAMEBUFFER_BINDING]:r});default:return null}},bindBuffer:(e,t,r)=>{let n={[i.ARRAY_BUFFER]:[i.ARRAY_BUFFER_BINDING],[i.COPY_READ_BUFFER]:[i.COPY_READ_BUFFER_BINDING],[i.COPY_WRITE_BUFFER]:[i.COPY_WRITE_BUFFER_BINDING],[i.PIXEL_PACK_BUFFER]:[i.PIXEL_PACK_BUFFER_BINDING],[i.PIXEL_UNPACK_BUFFER]:[i.PIXEL_UNPACK_BUFFER_BINDING]}[t];return n?e({[n]:r}):{valueChanged:!0}},blendColor:(e,t,r,n,o)=>e({[i.BLEND_COLOR]:new Float32Array([t,r,n,o])}),blendEquation:(e,t)=>e({[i.BLEND_EQUATION_RGB]:t,[i.BLEND_EQUATION_ALPHA]:t}),blendEquationSeparate:(e,t,r)=>e({[i.BLEND_EQUATION_RGB]:t,[i.BLEND_EQUATION_ALPHA]:r}),blendFunc:(e,t,r)=>e({[i.BLEND_SRC_RGB]:t,[i.BLEND_DST_RGB]:r,[i.BLEND_SRC_ALPHA]:t,[i.BLEND_DST_ALPHA]:r}),blendFuncSeparate:(e,t,r,n,o)=>e({[i.BLEND_SRC_RGB]:t,[i.BLEND_DST_RGB]:r,[i.BLEND_SRC_ALPHA]:n,[i.BLEND_DST_ALPHA]:o}),clearColor:(e,t,r,n,o)=>e({[i.COLOR_CLEAR_VALUE]:new Float32Array([t,r,n,o])}),clearDepth:(e,t)=>e({[i.DEPTH_CLEAR_VALUE]:t}),clearStencil:(e,t)=>e({[i.STENCIL_CLEAR_VALUE]:t}),colorMask:(e,t,r,n,o)=>e({[i.COLOR_WRITEMASK]:[t,r,n,o]}),cullFace:(e,t)=>e({[i.CULL_FACE_MODE]:t}),depthFunc:(e,t)=>e({[i.DEPTH_FUNC]:t}),depthRange:(e,t,r)=>e({[i.DEPTH_RANGE]:new Float32Array([t,r])}),depthMask:(e,t)=>e({[i.DEPTH_WRITEMASK]:t}),frontFace:(e,t)=>e({[i.FRONT_FACE]:t}),lineWidth:(e,t)=>e({[i.LINE_WIDTH]:t}),polygonOffset:(e,t,r)=>e({[i.POLYGON_OFFSET_FACTOR]:t,[i.POLYGON_OFFSET_UNITS]:r}),sampleCoverage:(e,t,r)=>e({[i.SAMPLE_COVERAGE_VALUE]:t,[i.SAMPLE_COVERAGE_INVERT]:r}),scissor:(e,t,r,n,o)=>e({[i.SCISSOR_BOX]:new Int32Array([t,r,n,o])}),stencilMask:(e,t)=>e({[i.STENCIL_WRITEMASK]:t,[i.STENCIL_BACK_WRITEMASK]:t}),stencilMaskSeparate:(e,t,r)=>e({[t===i.FRONT?i.STENCIL_WRITEMASK:i.STENCIL_BACK_WRITEMASK]:r}),stencilFunc:(e,t,r,n)=>e({[i.STENCIL_FUNC]:t,[i.STENCIL_REF]:r,[i.STENCIL_VALUE_MASK]:n,[i.STENCIL_BACK_FUNC]:t,[i.STENCIL_BACK_REF]:r,[i.STENCIL_BACK_VALUE_MASK]:n}),stencilFuncSeparate:(e,t,r,n,o)=>e({[t===i.FRONT?i.STENCIL_FUNC:i.STENCIL_BACK_FUNC]:r,[t===i.FRONT?i.STENCIL_REF:i.STENCIL_BACK_REF]:n,[t===i.FRONT?i.STENCIL_VALUE_MASK:i.STENCIL_BACK_VALUE_MASK]:o}),stencilOp:(e,t,r,n)=>e({[i.STENCIL_FAIL]:t,[i.STENCIL_PASS_DEPTH_FAIL]:r,[i.STENCIL_PASS_DEPTH_PASS]:n,[i.STENCIL_BACK_FAIL]:t,[i.STENCIL_BACK_PASS_DEPTH_FAIL]:r,[i.STENCIL_BACK_PASS_DEPTH_PASS]:n}),stencilOpSeparate:(e,t,r,n,o)=>e({[t===i.FRONT?i.STENCIL_FAIL:i.STENCIL_BACK_FAIL]:r,[t===i.FRONT?i.STENCIL_PASS_DEPTH_FAIL:i.STENCIL_BACK_PASS_DEPTH_FAIL]:n,[t===i.FRONT?i.STENCIL_PASS_DEPTH_PASS:i.STENCIL_BACK_PASS_DEPTH_PASS]:o}),viewport:(e,t,r,n,o)=>e({[i.VIEWPORT]:[t,r,n,o]})},Te=(e,t)=>e.isEnabled(t),jn={[i.BLEND]:Te,[i.CULL_FACE]:Te,[i.DEPTH_TEST]:Te,[i.DITHER]:Te,[i.POLYGON_OFFSET_FILL]:Te,[i.SAMPLE_ALPHA_TO_COVERAGE]:Te,[i.SAMPLE_COVERAGE]:Te,[i.SCISSOR_TEST]:Te,[i.STENCIL_TEST]:Te,[i.RASTERIZER_DISCARD]:Te},wo=new Set([i.ACTIVE_TEXTURE,i.TRANSFORM_FEEDBACK_ACTIVE,i.TRANSFORM_FEEDBACK_PAUSED,i.TRANSFORM_FEEDBACK_BUFFER_BINDING,i.UNIFORM_BUFFER_BINDING,i.ELEMENT_ARRAY_BUFFER_BINDING,i.IMPLEMENTATION_COLOR_READ_FORMAT,i.IMPLEMENTATION_COLOR_READ_TYPE,i.READ_BUFFER,i.DRAW_BUFFER0,i.DRAW_BUFFER1,i.DRAW_BUFFER2,i.DRAW_BUFFER3,i.DRAW_BUFFER4,i.DRAW_BUFFER5,i.DRAW_BUFFER6,i.DRAW_BUFFER7,i.DRAW_BUFFER8,i.DRAW_BUFFER9,i.DRAW_BUFFER10,i.DRAW_BUFFER11,i.DRAW_BUFFER12,i.DRAW_BUFFER13,i.DRAW_BUFFER14,i.DRAW_BUFFER15,i.SAMPLER_BINDING,i.TEXTURE_BINDING_2D,i.TEXTURE_BINDING_2D_ARRAY,i.TEXTURE_BINDING_3D,i.TEXTURE_BINDING_CUBE_MAP]);function Fe(e,t){let n=K.attach(e).gl;if(ff(t))return;let o={};for(let s in t){let u=Number(s),l=Bo[s];l&&(typeof l=="string"?o[l]=!0:l(n,t[s],u))}let a=n.state&&n.state.cache;if(a)for(let s in o){let u=Uo[s];u(n,t,a)}}function Lo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Or,n=K.attach(e).gl;if(typeof t=="number"){let s=t,u=jn[s];return u?u(n,s):n.getParameter(s)}let o=Array.isArray(t)?t:Object.keys(t),a={};for(let s of o){let u=jn[s];a[s]=u?u(n,Number(s)):n.getParameter(Number(s))}return a}function ff(e){for(let t in e)return!1;return!0}function Xo(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(let o=0;o<e.length;++o)if(e[o]!==t[o])return!1;return!0}return!1}var Yn=class{constructor(t){let{copyState:r=!1,log:n=()=>{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=void 0,this.program=null,this.stateStack=[],this.enable=!0,this.cache=void 0,this.log=void 0,this.gl=t,this.cache=r?Lo(t):Object.assign({},Or),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){(0,Qt.assert)(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];Fe(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,n,o=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let a in t){(0,Qt.assert)(a!==void 0);let s=t[a],u=this.cache[a];Xo(s,u)||(r=!0,n=u,o&&!(a in o)&&(o[a]=u),this.cache[a]=s)}return{valueChanged:r,oldValue:n}}};function Ye(e){return e.state}function kn(e,t){let{enable:r=!0,copyState:n}=t;if((0,Qt.assert)(n!==void 0),!e.state){e.state=new Yn(e,{copyState:n}),_f(e);for(let a in zn){let s=zn[a];cf(e,a,s)}Wo(e,"getParameter"),Wo(e,"isEnabled")}let o=Ye(e);return o.enable=r,e}function lt(e){let t=Ye(e);t||(kn(e,{copyState:!1}),t=Ye(e)),t.push()}function ke(e){let t=Ye(e);(0,Qt.assert)(t),t.pop()}function Wo(e,t){let r=e[t].bind(e);e[t]=function(o){if(o===void 0||wo.has(o))return r(o);let a=Ye(e);return o in a.cache||(a.cache[o]=r(o)),a.enable?a.cache[o]:r(o)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function cf(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(){let a=Ye(e);for(var s=arguments.length,u=new Array(s),l=0;l<s;l++)u[l]=arguments[l];let{valueChanged:f,oldValue:c}=r(a._updateCache,...u);return f&&n(...u),c},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function _f(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let o=Ye(e);o.program!==n&&(t(n),o.program=n)}}var Ef={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function Ho(e,t){t={...Ef,...t};let r=null,n=a=>r=a.statusMessage||r;e.addEventListener("webglcontextcreationerror",n,!1);let o=null;if(t.type==="webgl2"&&(t={...t,webgl1:!1}),t.type==="webgl1"&&(t={...t,webgl2:!1}),!o&&t.webgl2&&(o=e.getContext("webgl2",t)),!o&&t.webgl1&&(o=e.getContext("webgl",t)),e.removeEventListener("webglcontextcreationerror",n,!1),!o)throw new Error(`Failed to create ${t.webgl2&&!t.webgl1?"WebGL2":"WebGL"} context: ${r||"Unknown error"}`);if(t.onContextLost){let{onContextLost:a}=t;e.addEventListener("webglcontextlost",s=>a(s),!1)}if(t.onContextRestored){let{onContextRestored:a}=t;e.addEventListener("webglcontextrestored",s=>a(s),!1)}return o}function Vo(e){let t=e.getParameter(i.VENDOR),r=e.getParameter(i.RENDERER),n=e.getExtension("WEBGL_debug_renderer_info"),o=e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:i.VENDOR),a=e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:i.RENDERER),l=df(o||t,a||r);return{type:D(e)?"webgl2":"webgl",gpu:l,vendor:o||t,renderer:a||r,version:e.getParameter(i.VERSION),shadingLanguages:["glsl"],shadingLanguageVersions:{glsl:e.getParameter(i.SHADING_LANGUAGE_VERSION)}}}function df(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function Ko(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<"u"?window.navigator||{}:{},r=e.userAgent||t.userAgent||"",n=r.indexOf("MSIE ")!==-1,o=r.indexOf("Trident/")!==-1;return n||o}var qn=x(F(),1);function vr(e){switch(e){case"uint8":return i.UNSIGNED_BYTE;case"sint8":return i.BYTE;case"unorm8":return i.UNSIGNED_BYTE;case"snorm8":return i.BYTE;case"uint16":return i.UNSIGNED_SHORT;case"sint16":return i.SHORT;case"unorm16":return i.UNSIGNED_SHORT;case"snorm16":return i.SHORT;case"uint32":return i.UNSIGNED_INT;case"sint32":return i.INT;case"float16":return i.HALF_FLOAT;case"float32":return i.FLOAT}throw new Error(String(e))}var Z="texture-compression-bc",U="texture-compression-astc",Re="texture-compression-etc2",gf="texture-compression-etc1-webgl",br="texture-compression-pvrtc-webgl",$n="texture-compression-atc-webgl",Jt="WEBGL_compressed_texture_s3tc",er="WEBGL_compressed_texture_s3tc_srgb",ft="EXT_texture_compression_rgtc",tr="EXT_texture_compression_bptc",hf="WEBGL_compressed_texture_etc",Af="WEBGL_compressed_texture_astc",pf="WEBGL_compressed_texture_etc1",Tf="WEBGL_compressed_texture_pvrtc",Rf="WEBGL_compressed_texture_atc",Go="EXT_sRGB",Ne="EXT_texture_norm16",mf="WEBGL_color_buffer_float",Sf="EXT_color_buffer_float",Ee=(e,t)=>e.getExtension(t),$e=(e,t)=>t.every(r=>e.getExtension(r)),Zn={"texture-blend-float-webgl1":e=>D(e)?!0:Ee(e,"EXT_float_blend"),"texture-formats-srgb-webgl1":e=>D(e)?!0:Ee(e,Go),"texture-formats-depth-webgl1":e=>D(e)?!0:Ee(e,"WEBGL_depth_texture"),"texture-formats-float32-webgl1":e=>D(e)?!0:Ee(e,"OES_texture_float"),"texture-formats-float16-webgl1":e=>D(e)?!0:Ee(e,"OES_texture_half_float"),"texture-formats-norm16-webgl":e=>D(e)?Ee(e,Ne):!1,"texture-filter-linear-float32-webgl":e=>Ee(e,"OES_texture_float_linear"),"texture-filter-linear-float16-webgl":e=>Ee(e,"OES_texture_half_float_linear"),"texture-filter-anisotropic-webgl":e=>Ee(e,"EXT_texture_filter_anisotropic"),"texture-renderable-float32-webgl":e=>Ee(e,"EXT_color_buffer_float"),"texture-renderable-float16-webgl":e=>Ee(e,"EXT_color_buffer_half_float"),"texture-compression-bc":e=>$e(e,[Jt,er,ft,tr]),"texture-compression-bc5-webgl":e=>$e(e,[ft]),"texture-compression-etc2":e=>$e(e,[hf]),"texture-compression-astc":e=>$e(e,[Af]),"texture-compression-etc1-webgl":e=>$e(e,[pf]),"texture-compression-pvrtc-webgl":e=>$e(e,[Tf]),"texture-compression-atc-webgl":e=>$e(e,[Rf])};function Of(e,t){var r;return((r=Zn[t])===null||r===void 0?void 0:r.call(Zn,e))||!1}function zo(e){return Object.keys(Zn).filter(r=>Of(e,r))}var rr={"rgb8unorm-unsized":{gl:i.RGB,gl1:i.RGB,b:4,c:2,bpp:4,dataFormat:i.RGB,types:[i.UNSIGNED_BYTE,i.UNSIGNED_SHORT_5_6_5]},"rgba8unorm-unsized":{gl:i.RGBA,gl1:i.RGBA,b:4,c:2,bpp:4,dataFormat:i.RGBA,types:[i.UNSIGNED_BYTE,i.UNSIGNED_SHORT_4_4_4_4,i.UNSIGNED_SHORT_5_5_5_1]},r8unorm:{gl:i.R8,b:1,c:1,renderbuffer:!0},r8snorm:{gl:i.R8_SNORM,b:1,c:1},r8uint:{gl:i.R8UI,b:1,c:1,renderbuffer:!0},r8sint:{gl:i.R8I,b:1,c:1,renderbuffer:!0},rg8unorm:{gl:i.RG8,b:2,c:2,renderbuffer:!0},rg8snorm:{gl:i.RG8_SNORM,b:2,c:2},rg8uint:{gl:i.RG8UI,b:2,c:2,renderbuffer:!0},rg8sint:{gl:i.RG8I,b:2,c:2,renderbuffer:!0},r16uint:{gl:i.R16UI,b:2,c:1,renderbuffer:!0},r16sint:{gl:i.R16I,b:2,c:1,renderbuffer:!0},r16float:{gl:i.R16F,b:2,c:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"r16unorm-webgl":{gl:i.R16_EXT,b:2,c:1,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:Ne},"r16snorm-webgl":{gl:i.R16_SNORM_EXT,b:2,c:1,f:"texture-formats-norm16-webgl",x:Ne},"rgba4unorm-webgl":{gl:i.RGBA4,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb565unorm-webgl":{gl:i.RGB565,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb5a1unorm-webgl":{gl:i.RGB5_A1,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb8unorm-webgl":{gl:i.RGB8,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:i.RGB8_SNORM,b:3,c:3,wgpu:!1},rgba8unorm:{gl:i.RGBA8,gl1:i.RGBA,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:i.SRGB8_ALPHA8,gl1:i.SRGB_ALPHA_EXT,b:4,c:4,gl1ext:Go,bpp:4},rgba8snorm:{gl:i.RGBA8_SNORM,b:4,c:4},rgba8uint:{gl:i.RGBA8UI,b:4,c:4,bpp:4},rgba8sint:{gl:i.RGBA8I,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:i.RG16UI,b:4,c:1,bpp:4},rg16sint:{gl:i.RG16I,b:4,c:2,bpp:4},rg16float:{gl:i.RG16F,bpp:4,b:4,c:2,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"rg16unorm-webgl":{gl:i.RG16_EXT,b:2,c:2,f:"texture-formats-norm16-webgl",x:Ne},"rg16snorm-webgl":{gl:i.RG16_SNORM_EXT,b:2,c:2,f:"texture-formats-norm16-webgl",x:Ne},r32uint:{gl:i.R32UI,b:4,c:1,bpp:4,renderbuffer:!0},r32sint:{gl:i.R32I,b:4,c:1,bpp:4,renderbuffer:!0},r32float:{gl:i.R32F,bpp:4,b:4,c:1,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl"},rgb9e5ufloat:{gl:i.RGB9_E5,b:4,c:3,p:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},rg11b10ufloat:{gl:i.R11F_G11F_B10F,b:4,c:3,p:1,render:"texture-renderable-float32-webgl",renderbuffer:!0},rgb10a2unorm:{gl:i.RGB10_A2,b:4,c:4,p:1,renderbuffer:!0},"rgb10a2unorm-webgl":{b:4,c:4,gl:i.RGB10_A2UI,p:1,wgpu:!1,bpp:4,renderbuffer:!0},"rgb16unorm-webgl":{gl:i.RGB16_EXT,b:2,c:3,f:"texture-formats-norm16-webgl",x:Ne},"rgb16snorm-webgl":{gl:i.RGB16_SNORM_EXT,b:2,c:3,f:"texture-formats-norm16-webgl",x:Ne},rg32uint:{gl:i.RG32UI,b:8,c:2,renderbuffer:!0},rg32sint:{gl:i.RG32I,b:8,c:2,renderbuffer:!0},rg32float:{gl:i.RG32F,b:8,c:2,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},rgba16uint:{gl:i.RGBA16UI,b:8,c:4,renderbuffer:!0},rgba16sint:{gl:i.RGBA16I,b:8,c:4,renderbuffer:!0},rgba16float:{gl:i.RGBA16F,gl1:i.RGBA,b:8,c:4,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},"rgba16unorm-webgl":{gl:i.RGBA16_EXT,b:2,c:4,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:Ne},"rgba16snorm-webgl":{gl:i.RGBA16_SNORM_EXT,b:2,c:4,f:"texture-formats-norm16-webgl",x:Ne},"rgb32float-webgl":{gl:i.RGB32F,gl1:i.RGB,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",gl2ext:Sf,gl1ext:mf,dataFormat:i.RGB,types:[i.FLOAT]},rgba32uint:{gl:i.RGBA32UI,b:16,c:4,renderbuffer:!0},rgba32sint:{gl:i.RGBA32I,b:16,c:4,renderbuffer:!0},rgba32float:{gl:i.RGBA32F,b:16,c:4,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},stencil8:{gl:i.STENCIL_INDEX8,gl1:i.STENCIL_INDEX8,b:1,c:1,attachment:i.STENCIL_ATTACHMENT,renderbuffer:!0},depth16unorm:{gl:i.DEPTH_COMPONENT16,gl1:i.DEPTH_COMPONENT16,b:2,c:1,attachment:i.DEPTH_ATTACHMENT,renderbuffer:!0},depth24plus:{gl:i.DEPTH_COMPONENT24,b:3,c:1,attachment:i.DEPTH_ATTACHMENT},depth32float:{gl:i.DEPTH_COMPONENT32F,b:4,c:1,attachment:i.DEPTH_ATTACHMENT,renderbuffer:!0},"depth24plus-stencil8":{gl:i.DEPTH_STENCIL,gl1:i.DEPTH_STENCIL,b:4,c:2,p:1,attachment:i.DEPTH_STENCIL_ATTACHMENT,renderbuffer:!0,depthTexture:!0},"depth24unorm-stencil8":{gl:i.DEPTH24_STENCIL8,b:4,c:2,p:1,attachment:i.DEPTH_STENCIL_ATTACHMENT,renderbuffer:!0},"depth32float-stencil8":{gl:i.DEPTH32F_STENCIL8,b:5,c:2,p:1,attachment:i.DEPTH_STENCIL_ATTACHMENT,renderbuffer:!0},"bc1-rgb-unorm-webgl":{gl:i.COMPRESSED_RGB_S3TC_DXT1_EXT,x:Jt,f:Z},"bc1-rgb-unorm-srgb-webgl":{gl:i.COMPRESSED_SRGB_S3TC_DXT1_EXT,x:er,f:Z},"bc1-rgba-unorm":{gl:i.COMPRESSED_RGBA_S3TC_DXT1_EXT,x:Jt,f:Z},"bc1-rgba-unorm-srgb":{gl:i.COMPRESSED_SRGB_S3TC_DXT1_EXT,x:er,f:Z},"bc2-rgba-unorm":{gl:i.COMPRESSED_RGBA_S3TC_DXT3_EXT,x:Jt,f:Z},"bc2-rgba-unorm-srgb":{gl:i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,x:er,f:Z},"bc3-rgba-unorm":{gl:i.COMPRESSED_RGBA_S3TC_DXT5_EXT,x:Jt,f:Z},"bc3-rgba-unorm-srgb":{gl:i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,x:er,f:Z},"bc4-r-unorm":{gl:i.COMPRESSED_RED_RGTC1_EXT,x:ft,f:Z},"bc4-r-snorm":{gl:i.COMPRESSED_SIGNED_RED_RGTC1_EXT,x:ft,f:Z},"bc5-rg-unorm":{gl:i.COMPRESSED_RED_GREEN_RGTC2_EXT,x:ft,f:Z},"bc5-rg-snorm":{gl:i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,x:ft,f:Z},"bc6h-rgb-ufloat":{gl:i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,x:tr,f:Z},"bc6h-rgb-float":{gl:i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,x:tr,f:Z},"bc7-rgba-unorm":{gl:i.COMPRESSED_RGBA_BPTC_UNORM_EXT,x:tr,f:Z},"bc7-rgba-unorm-srgb":{gl:i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,x:tr,f:Z},"etc2-rgb8unorm":{gl:i.COMPRESSED_RGB8_ETC2,f:Re},"etc2-rgb8unorm-srgb":{gl:i.COMPRESSED_SRGB8_ETC2,f:Re},"etc2-rgb8a1unorm":{gl:i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,f:Re},"etc2-rgb8a1unorm-srgb":{gl:i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,f:Re},"etc2-rgba8unorm":{gl:i.COMPRESSED_RGBA8_ETC2_EAC,f:Re},"etc2-rgba8unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,f:Re},"eac-r11unorm":{gl:i.COMPRESSED_R11_EAC,f:Re},"eac-r11snorm":{gl:i.COMPRESSED_SIGNED_R11_EAC,f:Re},"eac-rg11unorm":{gl:i.COMPRESSED_RG11_EAC,f:Re},"eac-rg11snorm":{gl:i.COMPRESSED_SIGNED_RG11_EAC,f:Re},"astc-4x4-unorm":{gl:i.COMPRESSED_RGBA_ASTC_4x4_KHR,f:U},"astc-4x4-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,f:U},"astc-5x4-unorm":{gl:i.COMPRESSED_RGBA_ASTC_5x4_KHR,f:U},"astc-5x4-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,f:U},"astc-5x5-unorm":{gl:i.COMPRESSED_RGBA_ASTC_5x5_KHR,f:U},"astc-5x5-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,f:U},"astc-6x5-unorm":{gl:i.COMPRESSED_RGBA_ASTC_6x5_KHR,f:U},"astc-6x5-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,f:U},"astc-6x6-unorm":{gl:i.COMPRESSED_RGBA_ASTC_6x6_KHR,f:U},"astc-6x6-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,f:U},"astc-8x5-unorm":{gl:i.COMPRESSED_RGBA_ASTC_8x5_KHR,f:U},"astc-8x5-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,f:U},"astc-8x6-unorm":{gl:i.COMPRESSED_RGBA_ASTC_8x6_KHR,f:U},"astc-8x6-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,f:U},"astc-8x8-unorm":{gl:i.COMPRESSED_RGBA_ASTC_8x8_KHR,f:U},"astc-8x8-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,f:U},"astc-10x5-unorm":{gl:i.COMPRESSED_RGBA_ASTC_10x10_KHR,f:U},"astc-10x5-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,f:U},"astc-10x6-unorm":{gl:i.COMPRESSED_RGBA_ASTC_10x6_KHR,f:U},"astc-10x6-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,f:U},"astc-10x8-unorm":{gl:i.COMPRESSED_RGBA_ASTC_10x8_KHR,f:U},"astc-10x8-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,f:U},"astc-10x10-unorm":{gl:i.COMPRESSED_RGBA_ASTC_10x10_KHR,f:U},"astc-10x10-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,f:U},"astc-12x10-unorm":{gl:i.COMPRESSED_RGBA_ASTC_12x10_KHR,f:U},"astc-12x10-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,f:U},"astc-12x12-unorm":{gl:i.COMPRESSED_RGBA_ASTC_12x12_KHR,f:U},"astc-12x12-unorm-srgb":{gl:i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,f:U},"pvrtc-rgb4unorm-webgl":{gl:i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,f:br},"pvrtc-rgba4unorm-webgl":{gl:i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,f:br},"pvrtc-rbg2unorm-webgl":{gl:i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,f:br},"pvrtc-rgba2unorm-webgl":{gl:i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,f:br},"etc1-rbg-unorm-webgl":{gl:i.COMPRESSED_RGB_ETC1_WEBGL,f:gf},"atc-rgb-unorm-webgl":{gl:i.COMPRESSED_RGB_ATC_WEBGL,f:$n},"atc-rgba-unorm-webgl":{gl:i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,f:$n},"atc-rgbai-unorm-webgl":{gl:i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,f:$n}},vf={[i.RED]:1,[i.RED_INTEGER]:1,[i.RG]:2,[i.RG_INTEGER]:2,[i.RGB]:3,[i.RGB_INTEGER]:3,[i.RGBA]:4,[i.RGBA_INTEGER]:4,[i.DEPTH_COMPONENT]:1,[i.DEPTH_STENCIL]:1,[i.ALPHA]:1,[i.LUMINANCE]:1,[i.LUMINANCE_ALPHA]:2},bf={[i.FLOAT]:4,[i.UNSIGNED_INT]:4,[i.INT]:4,[i.UNSIGNED_SHORT]:2,[i.SHORT]:2,[i.HALF_FLOAT]:2,[i.BYTE]:1,[i.UNSIGNED_BYTE]:1};function nr(e,t){let r=ir(t),n=rr[r];if(!n||(D(e)?n.gl===void 0:n.gl1===void 0))return!1;let o=n.x||D(e)&&n.gl2ext||n.gl1ext;return o?Boolean(e.getExtension(o)):!0}function jo(e,t){var r;return nr(e,t)&&((r=rr[t])===null||r===void 0?void 0:r.renderbuffer)}function ir(e){if(typeof e=="string")return e;let t=Object.entries(rr).find(r=>{let[,n]=r;return n.gl===e||n.gl1===e});if(!t)throw new Error(`Unknown texture format ${e}`);return t[0]}function or(e,t){let r=rr[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error(`Unsupported texture format ${e}`);return n}function Yo(e,t){let r=ir(t);if(!nr(e,r))return!1;try{if((0,qn.decodeTextureFormat)(r).signed)return!1}catch{return!1}return r.endsWith("32float")?Boolean(e.getExtension("OES_texture_float_linear")):r.endsWith("16float")?Boolean(e.getExtension("OES_texture_half_float_linear")):!0}function ko(e,t){let r=ir(t);return!(!nr(e,r)||typeof r=="number")}function Nr(e,t){let r=ir(e),n=or(r,t),o=(0,qn.decodeTextureFormat)(r);return{format:n,dataFormat:Nf(o.format,o.integer,o.normalized,n),type:o.dataType?vr(o.dataType):i.UNSIGNED_BYTE,compressed:o.compressed}}function $o(e){let t=rr[e];if(!(t!=null&&t.attachment))throw new Error(`${e} is not a depth stencil format`);return t.attachment}function Zo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e.RGBA,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:i.RGBA,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:i.UNSIGNED_BYTE,o=null,a=null;try{o=e.createTexture(),e.bindTexture(i.TEXTURE_2D,o);let s=0,u=1,l=1,f=0,c=new Uint8Array([0,0,255,255]);e.texImage2D(e.TEXTURE_2D,s,t,u,l,f,r,n,c),a=e.createFramebuffer(),e.bindFramebuffer(i.FRAMEBUFFER,a),e.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,o,0);let _=e.checkFramebufferStatus(i.FRAMEBUFFER)===i.FRAMEBUFFER_COMPLETE;return e.bindTexture(i.TEXTURE_2D,null),_}finally{e.deleteTexture(o),e.deleteFramebuffer(a)}}function ar(e,t){let r=ir(e),n=Nr(r,t),o=vf[n.dataFormat]||4,a=bf[n.type]||1;return o*a}function Nf(e,t,r,n){if(n===i.RGBA||n===i.RGB)return n;switch(e){case"r":return t&&!r?i.RED_INTEGER:i.RED;case"rg":return t&&!r?i.RG_INTEGER:i.RG;case"rgb":return t&&!r?i.RGB_INTEGER:i.RGB;case"rgba":return t&&!r?i.RGBA_INTEGER:i.RGBA;default:return i.RGBA}}function qo(e){let t=Cf(e);for(let r of zo(e))t.add(r);return t}function Cf(e){e.getExtension("EXT_color_buffer_float"),e.getExtension("WEBGL_color_buffer_float"),e.getExtension("EXT_float_blend");let t=new Set;for(let r of Object.keys(Qo))yf(e,r)&&t.add(r);return t}function yf(e,t){let r=Qo[t];if(!r)return!1;let[n,o]=r||[],a=D(e)?o:n;if(typeof a=="boolean")return a;switch(t){case"texture-renderable-rgba32float-webgl":return D(e)?Boolean(e.getExtension(a)):Zo(e);case"glsl-derivatives":return Jn(e,a);case"glsl-frag-data":return Jn(e,a,{behavior:"require"});case"glsl-frag-depth":return Jn(e,a);default:return Boolean(e.getExtension(a))}}var Qn={};function Jn(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!Ko(r))return!0;if(t in Qn)return Qn[t];let n=r.behavior||"enable",o=`#extension GL_${t} : ${n}
|
|
301
|
-
void main(void) {}`,a=e.createShader(e.VERTEX_SHADER);if(!a)throw new Error("shader");e.shaderSource(a,o),e.compileShader(a);let s=e.getShaderParameter(a,e.COMPILE_STATUS);return e.deleteShader(a),Qn[t]=s,s}var Qo={webgl:[!0,!0],webgl2:[!1,!0],"timer-query-webgl":["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],"vertex-array-object-webgl1":["OES_vertex_array_object",!0],"instanced-rendering-webgl1":["ANGLE_instanced_arrays",!0],"multiple-render-targets-webgl1":["WEBGL_draw_buffers",!0],"index-uint32-webgl1":["OES_element_index_uint",!0],"blend-minmax-webgl1":["EXT_blend_minmax",!0],"texture-blend-float-webgl1":["EXT_float_blend","EXT_float_blend"],"texture-formats-srgb-webgl1":["EXT_sRGB",!0],"texture-formats-depth-webgl1":["WEBGL_depth_texture",!0],"texture-formats-float32-webgl1":["OES_texture_float",!0],"texture-formats-float16-webgl1":["OES_texture_half_float",!0],"texture-filter-linear-float32-webgl":["OES_texture_float_linear","OES_texture_float_linear"],"texture-filter-linear-float16-webgl":["OES_texture_half_float_linear","OES_texture_half_float_linear"],"texture-filter-anisotropic-webgl":["EXT_texture_filter_anisotropic","EXT_texture_filter_anisotropic"],"texture-renderable-rgba32float-webgl":["WEBGL_color_buffer_float","EXT_color_buffer_float"],"texture-renderable-float32-webgl":[!1,"EXT_color_buffer_float"],"texture-renderable-float16-webgl":["EXT_color_buffer_half_float","EXT_color_buffer_half_float"],"glsl-frag-data":["WEBGL_draw_buffers",!0],"glsl-frag-depth":["EXT_frag_depth",!0],"glsl-derivatives":["OES_standard_derivatives",!0],"glsl-texture-lod":["EXT_shader_texture_lod",!0]};function Jo(e){let t=Vn(e);return{maxTextureDimension1D:0,maxTextureDimension2D:e.getParameter(i.MAX_TEXTURE_SIZE),maxTextureDimension3D:t?t.getParameter(i.MAX_3D_TEXTURE_SIZE):0,maxTextureArrayLayers:t?t.getParameter(i.MAX_ARRAY_TEXTURE_LAYERS):0,maxBindGroups:1,maxDynamicUniformBuffersPerPipelineLayout:0,maxDynamicStorageBuffersPerPipelineLayout:0,maxSampledTexturesPerShaderStage:e.getParameter(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxSamplersPerShaderStage:e.getParameter(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxStorageBuffersPerShaderStage:0,maxStorageTexturesPerShaderStage:0,maxUniformBuffersPerShaderStage:t?t.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS):0,maxUniformBufferBindingSize:t?t.getParameter(i.MAX_UNIFORM_BLOCK_SIZE):0,maxStorageBufferBindingSize:0,minUniformBufferOffsetAlignment:t?t.getParameter(i.UNIFORM_BUFFER_OFFSET_ALIGNMENT):0,minStorageBufferOffsetAlignment:0,maxVertexBuffers:0,maxVertexAttributes:e.getParameter(i.MAX_VERTEX_ATTRIBS),maxVertexBufferArrayStride:2048,maxInterStageShaderComponents:t?t.getParameter(i.MAX_VARYING_COMPONENTS):0,maxComputeWorkgroupStorageSize:0,maxComputeInvocationsPerWorkgroup:0,maxComputeWorkgroupSizeX:0,maxComputeWorkgroupSizeY:0,maxComputeWorkgroupSizeZ:0,maxComputeWorkgroupsPerDimension:0}}function ea(e){let t=Vn(e);function r(o){return e.getParameter(o)}function n(o,a){return t?t.getParameter(o):a||0}return{[i.ALIASED_LINE_WIDTH_RANGE]:r(i.ALIASED_LINE_WIDTH_RANGE),[i.ALIASED_POINT_SIZE_RANGE]:r(i.ALIASED_POINT_SIZE_RANGE),[i.MAX_TEXTURE_SIZE]:r(i.MAX_TEXTURE_SIZE),[i.MAX_CUBE_MAP_TEXTURE_SIZE]:r(i.MAX_CUBE_MAP_TEXTURE_SIZE),[i.MAX_TEXTURE_IMAGE_UNITS]:r(i.MAX_TEXTURE_IMAGE_UNITS),[i.MAX_COMBINED_TEXTURE_IMAGE_UNITS]:r(i.MAX_COMBINED_TEXTURE_IMAGE_UNITS),[i.MAX_VERTEX_TEXTURE_IMAGE_UNITS]:r(i.MAX_VERTEX_TEXTURE_IMAGE_UNITS),[i.MAX_RENDERBUFFER_SIZE]:r(i.MAX_RENDERBUFFER_SIZE),[i.MAX_VARYING_VECTORS]:r(i.MAX_VARYING_VECTORS),[i.MAX_VERTEX_ATTRIBS]:r(i.MAX_VERTEX_ATTRIBS),[i.MAX_VERTEX_UNIFORM_VECTORS]:r(i.MAX_VERTEX_UNIFORM_VECTORS),[i.MAX_FRAGMENT_UNIFORM_VECTORS]:r(i.MAX_FRAGMENT_UNIFORM_VECTORS),[i.MAX_VIEWPORT_DIMS]:r(i.MAX_VIEWPORT_DIMS),[i.MAX_TEXTURE_MAX_ANISOTROPY_EXT]:r(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT),[i.MAX_3D_TEXTURE_SIZE]:n(i.MAX_3D_TEXTURE_SIZE),[i.MAX_ARRAY_TEXTURE_LAYERS]:n(i.MAX_ARRAY_TEXTURE_LAYERS),[i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]:n(i.MAX_CLIENT_WAIT_TIMEOUT_WEBGL),[i.MAX_COLOR_ATTACHMENTS]:n(i.MAX_COLOR_ATTACHMENTS),[i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]:n(i.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS),[i.MAX_COMBINED_UNIFORM_BLOCKS]:n(i.MAX_COMBINED_UNIFORM_BLOCKS),[i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]:n(i.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS),[i.MAX_DRAW_BUFFERS]:n(i.MAX_DRAW_BUFFERS),[i.MAX_ELEMENT_INDEX]:n(i.MAX_ELEMENT_INDEX),[i.MAX_ELEMENTS_INDICES]:n(i.MAX_ELEMENTS_INDICES),[i.MAX_ELEMENTS_VERTICES]:n(i.MAX_ELEMENTS_VERTICES),[i.MAX_FRAGMENT_INPUT_COMPONENTS]:n(i.MAX_FRAGMENT_INPUT_COMPONENTS),[i.MAX_FRAGMENT_UNIFORM_BLOCKS]:n(i.MAX_FRAGMENT_UNIFORM_BLOCKS),[i.MAX_FRAGMENT_UNIFORM_COMPONENTS]:n(i.MAX_FRAGMENT_UNIFORM_COMPONENTS),[i.MAX_SAMPLES]:n(i.MAX_SAMPLES),[i.MAX_SERVER_WAIT_TIMEOUT]:n(i.MAX_SERVER_WAIT_TIMEOUT),[i.MAX_TEXTURE_LOD_BIAS]:n(i.MAX_TEXTURE_LOD_BIAS),[i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]:n(i.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS),[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]:n(i.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS),[i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]:n(i.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS),[i.MAX_UNIFORM_BLOCK_SIZE]:n(i.MAX_UNIFORM_BLOCK_SIZE),[i.MAX_UNIFORM_BUFFER_BINDINGS]:n(i.MAX_UNIFORM_BUFFER_BINDINGS),[i.MAX_VARYING_COMPONENTS]:n(i.MAX_VARYING_COMPONENTS),[i.MAX_VERTEX_OUTPUT_COMPONENTS]:n(i.MAX_VERTEX_OUTPUT_COMPONENTS),[i.MAX_VERTEX_UNIFORM_BLOCKS]:n(i.MAX_VERTEX_UNIFORM_BLOCKS),[i.MAX_VERTEX_UNIFORM_COMPONENTS]:n(i.MAX_VERTEX_UNIFORM_COMPONENTS),[i.MIN_PROGRAM_TEXEL_OFFSET]:n(i.MIN_PROGRAM_TEXEL_OFFSET),[i.MAX_PROGRAM_TEXEL_OFFSET]:n(i.MAX_PROGRAM_TEXEL_OFFSET),[i.UNIFORM_BUFFER_OFFSET_ALIGNMENT]:n(i.UNIFORM_BUFFER_OFFSET_ALIGNMENT)}}var la=x(F(),1);var Fr=x(F(),1);var oa=x(F(),1),G=x(F(),1);function Y(e,t,r){let o=K.attach(e).gl;if(If(t))return r(e);let{nocatch:a=!0}=t;lt(o),Fe(o,t);let s;if(a)s=r(o),ke(o);else try{s=r(o)}finally{ke(o)}return s}function If(e){for(let t in e)return!1;return!0}var yr=x(F(),1);function ta(e,t,r,n){if((0,yr.isObjectEmpty)(t))return n(e);lt(e.gl);try{return xf(e,t),Fe(e,r),n(e)}finally{ke(e.gl)}}function xf(e,t){let r=K.attach(e),{gl:n}=r;if(t.cullMode)switch(t.cullMode){case"none":n.disable(i.CULL_FACE);break;case"front":n.enable(i.CULL_FACE),n.cullFace(i.FRONT);break;case"back":n.enable(i.CULL_FACE),n.cullFace(i.BACK);break}if(t.frontFace&&n.frontFace(ti("frontFace",t.frontFace,{ccw:i.CCW,cw:i.CW})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(Mf("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(i.DEPTH_TEST):n.disable(i.DEPTH_TEST),n.depthFunc(Cr("depthCompare",t.depthCompare))),t.stencilWriteMask){let o=t.stencilWriteMask;n.stencilMaskSeparate(i.FRONT,o),n.stencilMaskSeparate(i.BACK,o)}if(t.stencilReadMask&&yr.log.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let o=t.stencilReadMask||4294967295,a=Cr("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(i.STENCIL_TEST):n.disable(i.STENCIL_TEST),n.stencilFuncSeparate(i.FRONT,a,0,o),n.stencilFuncSeparate(i.BACK,a,0,o)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let o=ei("stencilPassOperation",t.stencilPassOperation),a=ei("stencilFailOperation",t.stencilFailOperation),s=ei("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(i.FRONT,a,s,o),n.stencilOpSeparate(i.BACK,a,s,o)}}function Cr(e,t){return ti(e,t,{never:i.NEVER,less:i.LESS,equal:i.EQUAL,"less-equal":i.LEQUAL,greater:i.GREATER,"not-equal":i.NOTEQUAL,"greater-equal":i.GEQUAL,always:i.ALWAYS})}function ei(e,t){return ti(e,t,{keep:i.KEEP,zero:i.ZERO,replace:i.REPLACE,invert:i.INVERT,"increment-clamp":i.INCR,"decrement-clamp":i.DECR,"increment-wrap":i.INCR_WRAP,"decrement-wrap":i.DECR_WRAP})}function Pf(e,t){return`Illegal parameter ${t} for ${e}`}function ti(e,t,r){if(!(t in r))throw new Error(Pf(e,t));return r[t]}function Mf(e,t){return t}function Ir(e){let t={};return e.addressModeU&&(t[i.TEXTURE_WRAP_S]=ri(e.addressModeU)),e.addressModeV&&(t[i.TEXTURE_WRAP_T]=ri(e.addressModeV)),e.addressModeW&&(t[i.TEXTURE_WRAP_R]=ri(e.addressModeW)),e.magFilter&&(t[i.TEXTURE_MAG_FILTER]=ra(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[i.TEXTURE_MIN_FILTER]=Ff(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[i.TEXTURE_MIN_LOD]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[i.TEXTURE_MAX_LOD]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[i.TEXTURE_COMPARE_MODE]=i.COMPARE_REF_TO_TEXTURE),e.compare&&(t[i.TEXTURE_COMPARE_FUNC]=Cr("compare",e.compare)),e.maxAnisotropy&&(t[i.TEXTURE_MAX_ANISOTROPY_EXT]=e.maxAnisotropy),t}function ri(e){switch(e){case"clamp-to-edge":return i.CLAMP_TO_EDGE;case"repeat":return i.REPEAT;case"mirror-repeat":return i.MIRRORED_REPEAT}}function ra(e){switch(e){case"nearest":return i.NEAREST;case"linear":return i.LINEAR}}function Ff(e,t){if(!t)return ra(e);switch(e){case"nearest":return t==="nearest"?i.NEAREST_MIPMAP_NEAREST:i.NEAREST_MIPMAP_LINEAR;case"linear":return t==="nearest"?i.LINEAR_MIPMAP_NEAREST:i.LINEAR_MIPMAP_LINEAR}}function na(e){let t={...e};return e[i.TEXTURE_MIN_FILTER]!==i.NEAREST&&(t[i.TEXTURE_MIN_FILTER]=i.LINEAR),t[i.TEXTURE_WRAP_S]=i.CLAMP_TO_EDGE,t[i.TEXTURE_WRAP_T]=i.CLAMP_TO_EDGE,t}var de=x(F(),1);var Df=10,se=class extends de.Buffer{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.glTarget=void 0,this.glUsage=void 0,this.glIndexType=i.UNSIGNED_SHORT,this.byteLength=void 0,this.bytesUsed=void 0,this.debugData=null,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),t.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=Bf(this.props.usage),this.glUsage=Uf(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?i.UNSIGNED_INT:i.UNSIGNED_SHORT,this.debugData=null,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r;(0,de.assert)(ArrayBuffer.isView(t));let o=this._getWriteTarget();return this.gl.bindBuffer(o,this.handle),this.gl.bufferData(o,n,this.glUsage),this.gl.bufferSubData(o,r,t),this.gl.bindBuffer(o,null),this.debugData=t.slice(0,Df),this.bytesUsed=n,this.byteLength=n,this.trackAllocatedMemory(n),this}_initWithByteLength(t){(0,de.assert)(t>=0);let r=t;t===0&&(r=new Float32Array(0));let n=this._getWriteTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.debugData=null,this.bytesUsed=t,this.byteLength=t,this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=0,o=void 0,a=this.device.isWebGL2?i.COPY_WRITE_BUFFER:this.glTarget;this.gl.bindBuffer(a,this.handle),n!==0||o!==void 0?(this.device.assertWebGL2(),this.gl2.bufferSubData(a,r,t,n,o)):this.gl.bufferSubData(a,r,t),this.gl.bindBuffer(a,null)}async readAsync(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1?arguments[1]:void 0;this.device.assertWebGL2();let n=new Uint8Array(r),o=0;return this.gl.bindBuffer(i.COPY_READ_BUFFER,this.handle),this.gl2.getBufferSubData(i.COPY_READ_BUFFER,t,n,o,r),this.gl.bindBuffer(i.COPY_READ_BUFFER,null),n}_invalidateDebugData(){this.debugData=null}_getWriteTarget(){return this.glTarget}_getReadTarget(){return this.glTarget}};function Bf(e){return e&de.Buffer.INDEX?i.ELEMENT_ARRAY_BUFFER:e&de.Buffer.VERTEX?i.ARRAY_BUFFER:e&de.Buffer.UNIFORM?i.UNIFORM_BUFFER:i.ARRAY_BUFFER}function Uf(e){return e&de.Buffer.INDEX?i.STATIC_DRAW:e&de.Buffer.VERTEX?i.STATIC_DRAW:e&de.Buffer.UNIFORM?i.DYNAMIC_DRAW:i.STATIC_DRAW}var ia=x(F(),1);var Ze=class extends ia.Sampler{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.parameters=void 0,this.device=t,this.parameters=Ir(r),this.device.isWebGL2&&(this.handle=this.handle||this.device.gl2.createSampler(),this._setSamplerParameters(this.parameters))}destroy(){this.handle&&(this.device.gl2.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[r,n]of Object.entries(t)){let o=Number(r);switch(o){case i.TEXTURE_MIN_LOD:case i.TEXTURE_MAX_LOD:this.device.gl2.samplerParameterf(this.handle,o,n);break;default:this.device.gl2.samplerParameteri(this.handle,o,n);break}}}};var wf={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},k=class extends G.Texture{constructor(t,r){var n;super(t,{...wf,format:"rgba8unorm",...r}),this.MAX_ATTRIBUTES=void 0,this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.sampler=void 0,this.glFormat=void 0,this.type=void 0,this.dataFormat=void 0,this.mipmaps=void 0,this.target=void 0,this.textureUnit=void 0,this.loaded=!1,this._video=void 0,this.device=(0,G.cast)(t),this.gl=this.device.gl,this.gl2=this.device.gl2,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=i.RGBA,this.target=Lf(this.props),this.loaded=!1,typeof((n=this.props)===null||n===void 0?void 0:n.data)=="string"&&Object.assign(this.props,{data:(0,G.loadImage)(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.props.dimension==="cube")return this.initializeCube(t);let r=t.data;if(r instanceof Promise)return r.then(g=>this.initialize(Object.assign({},t,{pixels:g,data:g}))),this;let n=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(t)),this;let{parameters:o={}}=t,{pixels:a=null,pixelStore:s={},textureUnit:u=void 0}=t;r||(r=a);let{width:l,height:f,dataFormat:c,type:_,compressed:E=!1,mipmaps:d=!0}=t,{depth:h=0}=t,p=or(t.format,this.device.isWebGL2);return{width:l,height:f,compressed:E,dataFormat:c,type:_}=this._deduceParameters({format:t.format,type:_,dataFormat:c,compressed:E,data:r,width:l,height:f}),this.width=l,this.height=f,this.glFormat=p,this.type=_,this.dataFormat=c,this.textureUnit=u,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(i.TEXTURE0+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),d&&this.device.isWebGL1&&xr(this.width,this.height)&&(G.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)(),d=!1),this.mipmaps=d,this.setImageData({data:r,width:l,height:f,depth:h,format:p,type:_,dataFormat:c,parameters:s,compressed:E}),this.setSampler(t.sampler),this._setSamplerParameters(o),d&&this.generateMipmap(),n&&(this._video={video:r,parameters:o,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(t){let{mipmaps:r=!0,parameters:n={}}=t;return this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setSampler(t.sampler),this._setSamplerParameters(n)}),this}setSampler(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r;t instanceof Ze?(this.sampler=t,r=t.props):(this.sampler=new Ze(this.device,t),r=t);let n=Ir(r);return this._setSamplerParameters(n),this}resize(t){let{height:r,width:n,mipmaps:o=!1}=t;return n!==this.width||r!==this.height?this.initialize({width:n,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:o}):this}update(){if(this._video){let{video:t,parameters:r,lastTime:n}=this._video;if(n===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}generateMipmap(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.device.isWebGL1&&xr(this.width,this.height)?(G.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Y(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(t);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:n=null,level:o=0,glFormat:a=this.glFormat,offset:s=0,parameters:u={}}=t,{data:l=null,type:f=this.type,width:c=this.width,height:_=this.height,dataFormat:E=this.dataFormat,compressed:d=!1}=t;l||(l=n),{type:f,dataFormat:E,compressed:d,width:c,height:_}=this._deduceParameters({format:this.props.format,type:f,dataFormat:E,compressed:d,data:l,width:c,height:_});let{gl:h}=this;h.bindTexture(this.target,this.handle);let p=null;({data:l,dataType:p}=this._getDataType({data:l,compressed:d}));let g;if(Y(this.gl,u,()=>{switch(p){case"null":h.texImage2D(r,o,a,c,_,0,E,f,l);break;case"typed-array":h.texImage2D(r,o,a,c,_,0,E,f,l,s);break;case"buffer":g=this.device.assertWebGL2(),g.bindBuffer(i.PIXEL_UNPACK_BUFFER,l.handle||l),g.texImage2D(r,o,a,c,_,0,E,f,s),g.bindBuffer(i.PIXEL_UNPACK_BUFFER,null);break;case"browser-object":this.device.isWebGL2?h.texImage2D(r,o,a,c,_,0,E,f,l):h.texImage2D(r,o,a,E,f,l);break;case"compressed":for(let[T,m]of l.entries())h.compressedTexImage2D(r,T,m.format,m.width,m.height,0,m.data);break;default:(0,G.assert)(!1,"Unknown image data type")}}),l&&l.byteLength)this.trackAllocatedMemory(l.byteLength,"Texture");else{let T=ar(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*T,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:n=null,data:o=null,x:a=0,y:s=0,width:u=this.width,height:l=this.height,level:f=0,glFormat:c=this.glFormat,type:_=this.type,dataFormat:E=this.dataFormat,compressed:d=!1,offset:h=0,parameters:p={}}=t;if({type:_,dataFormat:E,compressed:d,width:u,height:l}=this._deduceParameters({format:this.props.format,type:_,dataFormat:E,compressed:d,data:o,width:u,height:l}),(0,G.assert)(this.depth===1,"texSubImage not supported for 3D textures"),o||(o=n),o&&o.data){let g=o;o=g.data,u=g.shape[0],l=g.shape[1]}o instanceof se&&(o=o.handle),this.gl.bindTexture(this.target,this.handle),Y(this.gl,p,()=>{if(d)this.gl.compressedTexSubImage2D(r,f,a,s,u,l,c,o);else if(o===null)this.gl.texSubImage2D(r,f,a,s,u,l,E,_,null);else if(ArrayBuffer.isView(o))this.gl.texSubImage2D(r,f,a,s,u,l,E,_,o,h);else if(typeof WebGLBuffer<"u"&&o instanceof WebGLBuffer){let g=this.device.assertWebGL2();g.bindBuffer(i.PIXEL_UNPACK_BUFFER,o),g.texSubImage2D(r,f,a,s,u,l,E,_,h),g.bindBuffer(i.PIXEL_UNPACK_BUFFER,null)}else this.device.isWebGL2?this.device.assertWebGL2().texSubImage2D(r,f,a,s,u,l,E,_,o):this.gl.texSubImage2D(r,f,a,s,E,_,o)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return G.log.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(i.ACTIVE_TEXTURE)-i.TEXTURE0}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(r.TEXTURE0+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(r.TEXTURE0+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:n=!1}=t;return n?{data:r,dataType:"compressed"}:r===null?{data:r,dataType:"null"}:ArrayBuffer.isView(r)?{data:r,dataType:"typed-array"}:r instanceof se?{data:r.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&r instanceof WebGLBuffer?{data:r,dataType:"buffer"}:{data:r,dataType:"browser-object"}}_deduceParameters(t){let{format:r,data:n}=t,{width:o,height:a,dataFormat:s,type:u,compressed:l}=t,f=Nr(r,this.device.isWebGL2);return s=s||f.dataFormat,u=u||f.type,l=l||f.compressed,{width:o,height:a}=this._deduceImageSize(n,o,a),{dataFormat:s,type:u,compressed:l,width:o,height:a,format:r,data:n}}_deduceImageSize(t,r,n){let o;return typeof ImageData<"u"&&t instanceof ImageData?o={width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?o={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?o={width:t.width,height:t.height}:typeof ImageBitmap<"u"&&t instanceof ImageBitmap?o={width:t.width,height:t.height}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?o={width:t.videoWidth,height:t.videoHeight}:t?o={width:r,height:n}:o={width:r>=0?r:1,height:n>=0?n:1},(0,G.assert)(o,"Could not deduced texture size"),(0,G.assert)(r===void 0||o.width===r,"Deduced texture width does not match supplied width"),(0,G.assert)(n===void 0||o.height===n,"Deduced texture height does not match supplied height"),o}async setCubeMapImageData(t){let{gl:r}=this,{width:n,height:o,pixels:a,data:s,format:u=i.RGBA,type:l=i.UNSIGNED_BYTE}=t,f=a||s,c=await Promise.all(k.FACES.map(_=>{let E=f[_];return Promise.all(Array.isArray(E)?E:[E])}));this.bind(),k.FACES.forEach((_,E)=>{c[E].length>1&&this.props.mipmaps!==!1&&G.log.warn(`${this.id} has mipmap and multiple LODs.`)(),c[E].forEach((d,h)=>{n&&o?r.texImage2D(_,h,u,n,o,0,u,l,d):r.texImage2D(_,h,u,u,l,d)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:n,height:o,pixels:a,data:s,format:u=i.RGBA,type:l=i.UNSIGNED_BYTE}=t,{gl:f}=this,c=a||s;return this.bind(),c instanceof Promise?c.then(_=>this.setImageDataForFace(Object.assign({},t,{face:r,data:_,pixels:_}))):this.width||this.height?f.texImage2D(r,0,u,n,o,0,u,l,c):f.texImage2D(r,0,u,u,l,c),this}setImageData3D(t){let{level:r=0,dataFormat:n,format:o,type:a,width:s,height:u,depth:l=1,offset:f=0,data:c,parameters:_={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let E=Nr(o,this.device.isWebGL2);if(Y(this.gl,_,()=>{ArrayBuffer.isView(c)&&this.gl.texImage3D(this.target,r,E.format,s,u,l,0,E.dataFormat,E.type,c),c instanceof se&&(this.gl.bindBuffer(i.PIXEL_UNPACK_BUFFER,c.handle),this.gl.texImage3D(this.target,r,n,s,u,l,0,o,a,f))}),c&&c.byteLength)this.trackAllocatedMemory(c.byteLength,"Texture");else{let d=ar(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*this.depth*d,"Texture")}return this.loaded=!0,this}_setSamplerParameters(t){if(this.device.isWebGL1&&xr(this.width,this.height)&&(t=na(t)),!(0,oa.isObjectEmpty)(t)){Xf(t),this.gl.bindTexture(this.target,this.handle);for(let[r,n]of Object.entries(t)){let o=Number(r),a=n;switch(o){case i.TEXTURE_MIN_LOD:case i.TEXTURE_MAX_LOD:this.gl.texParameterf(this.target,o,a);break;default:this.gl.texParameteri(this.target,o,a);break}}this.gl.bindTexture(this.target,null)}}_getWebGL1NPOTParameterOverride(t,r){if(this.device.isWebGL1&&xr(this.width,this.height))switch(t){case i.TEXTURE_MIN_FILTER:if(r!==i.LINEAR&&r!==i.NEAREST)return i.LINEAR;break;case i.TEXTURE_WRAP_S:case i.TEXTURE_WRAP_T:return i.CLAMP_TO_EDGE;default:break}return r}};k.FACES=[i.TEXTURE_CUBE_MAP_POSITIVE_X,i.TEXTURE_CUBE_MAP_NEGATIVE_X,i.TEXTURE_CUBE_MAP_POSITIVE_Y,i.TEXTURE_CUBE_MAP_NEGATIVE_Y,i.TEXTURE_CUBE_MAP_POSITIVE_Z,i.TEXTURE_CUBE_MAP_NEGATIVE_Z];function Lf(e){switch(e.dimension){case"2d":return i.TEXTURE_2D;case"cube":return i.TEXTURE_CUBE_MAP;case"2d-array":return i.TEXTURE_2D_ARRAY;case"3d":return i.TEXTURE_3D;case"1d":case"cube-array":default:throw new Error(e.dimension)}}function xr(e,t){return!e||!t?!1:!(0,G.isPowerOfTwo)(e)||!(0,G.isPowerOfTwo)(t)}function Xf(e){G.log.log(1,"texture sampler parameters",e)()}var ua=x(F(),1);var Ce=x(F(),1);var aa=x(F(),1);function Pr(e,t){if(typeof t!="string")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\./,"");let n=e[t];return(0,aa.assert)(n!==void 0,`Accessing undefined constant GL.${t}`),n}var ct="Resource subclass must define virtual methods",Mr=class extends Ce.Resource{constructor(t,r,n){super(t,r,n),this.device=void 0,this.gl=void 0,this.gl2=void 0,this._handle=void 0,this._bound=!1,this.byteLength=0,this.device=K.attach(t);let o=this.device.gl;bo(o);let{id:a}=r||{};this.gl=o,this.gl2=o,this.id=a||(0,Ce.uid)(this.constructor.name),this._handle=r?.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0}toString(){return`${this.constructor.name}(${this.id})`}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this.removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(n=>n.destroy()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=Pr(this.gl,t),(0,Ce.assert)(t);let o=(this.constructor.PARAMETERS||{})[t];if(o){let a=D(this.gl);if(!((!("webgl2"in o)||a)&&(!("extension"in o)||this.gl.getExtension(o.extension)))){let u=o.webgl1,l="webgl2"in o?o.webgl2:o.webgl1;return a?l:u}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:n}=t,o=this.constructor.PARAMETERS||{},a=D(this.gl),s={},u=r||Object.keys(o);for(let l of u){let f=o[l];if(f&&(!("webgl2"in f)||a)&&(!("extension"in f)||this.gl.getExtension(f.extension))){let _=n?this.device.getGLKey(l):l;s[_]=this.getParameter(l,t),n&&f.type==="GLenum"&&(s[_]=this.device.getGLKey(s[_]))}}return s}setParameter(t,r){t=Pr(this.gl,t),(0,Ce.assert)(t);let o=(this.constructor.PARAMETERS||{})[t];if(o){let a=D(this.gl);if(!((!("webgl2"in o)||a)&&(!("extension"in o)||this.gl.getExtension(o.extension))))throw new Error("Parameter not available on this platform");o.type==="GLenum"&&(r=Pr(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,n){return(0,Ce.stubRemovedMethods)(this,t,r,n)}initialize(t){}_createHandle(){throw new Error(ct)}_deleteHandle(){throw new Error(ct)}_bindHandle(t){throw new Error(ct)}_getOptsFromHandle(){throw new Error(ct)}_getParameter(t,r){throw new Error(ct)}_setParameter(t,r){throw new Error(ct)}};var sa;sa=Symbol.toStringTag;var De=class extends Mr{get[sa](){return"Renderbuffer"}get width(){return this.props.width}get height(){return this.props.height}get format(){return this.props.format}get samples(){return this.props.samples}get attachment(){}static isTextureFormatSupported(t,r){return jo(t.gl,r)}constructor(t,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(t,r,De.defaultProps),this.glFormat=void 0,this.glFormat=or(this.props.format,t.isWebGL2),this._initialize(this.props)}resize(t){(t.width!==this.width||t.height!==this.height)&&(Object.assign(this.props,{...t,format:this.format,samples:this.samples}),this._initialize(this.props))}_initialize(t){let{format:r,width:n,height:o,samples:a}=t;(0,ua.assert)(r,"Needs format"),this.trackDeallocatedMemory(),this.gl.bindRenderbuffer(i.RENDERBUFFER,this.handle),a!==0&&this.device.isWebGL2?this.gl2.renderbufferStorageMultisample(i.RENDERBUFFER,a,this.glFormat,n,o):this.gl.renderbufferStorage(i.RENDERBUFFER,this.glFormat,n,o),this.gl.bindRenderbuffer(i.RENDERBUFFER,null),this.trackAllocatedMemory(n*o*(a||1)*ar(this.glFormat,this.device.isWebGL2))}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this.trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(i.RENDERBUFFER,t)}};De.defaultProps={id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0};var me=class extends Fr.Framebuffer{get texture(){return this.colorAttachments[0]}constructor(t,r){super(t,r),this.device=void 0,this.gl=void 0,this.handle=void 0;let n=r.handle===null;if(this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),!n){t.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.gl.bindFramebuffer(i.FRAMEBUFFER,this.handle);for(let o=0;o<this.colorAttachments.length;++o){let a=this.colorAttachments[o],s=i.COLOR_ATTACHMENT0+o;a&&this._attachOne(s,a)}this.depthStencilAttachment&&this._attachOne($o(this.depthStencilAttachment.format),this.depthStencilAttachment),this.gl.bindFramebuffer(i.FRAMEBUFFER,null)}r.check!==!1&&this._checkStatus()}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}_checkStatus(){let{gl:t}=this,r=t.bindFramebuffer(i.FRAMEBUFFER,this.handle),n=t.checkFramebufferStatus(i.FRAMEBUFFER);if(t.bindFramebuffer(i.FRAMEBUFFER,r||null),n!==t.FRAMEBUFFER_COMPLETE)throw new Error(`Framebuffer ${Hf(n)}`)}createDepthStencilTexture(t){return new De(this.device,{id:`${this.id}-depth-stencil`,format:t,width:this.width,height:this.height})}resizeAttachments(t,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;t===void 0&&(t=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let n of this.colorAttachments)n.resize({width:t,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.resize({width:t,height:r}),this}_attachOne(t,r){if(r instanceof De)return this._attachWEBGLRenderbuffer(t,r),r;if(Array.isArray(r)){let[n,o=0,a=0]=r;return this._attachTexture(t,n,o,a),n}else if(r instanceof k)return this._attachTexture(t,r,0,0),r;throw new Error("attach")}_attachWEBGLRenderbuffer(t,r){this.gl.framebufferRenderbuffer(i.FRAMEBUFFER,t,i.RENDERBUFFER,r.handle)}_attachTexture(t,r,n,o){let{gl:a,gl2:s}=this.device;switch(a.bindTexture(r.target,r.handle),r.target){case i.TEXTURE_2D_ARRAY:case i.TEXTURE_3D:this.device.assertWebGL2(),s?.framebufferTextureLayer(i.FRAMEBUFFER,t,r.target,o,n);break;case i.TEXTURE_CUBE_MAP:let u=Wf(n);a.framebufferTexture2D(i.FRAMEBUFFER,t,u,r.handle,o);break;case i.TEXTURE_2D:a.framebufferTexture2D(i.FRAMEBUFFER,t,i.TEXTURE_2D,r.handle,o);break;default:(0,Fr.assert)(!1,"Illegal texture type")}a.bindTexture(r.target,null)}};function Wf(e){return e<i.TEXTURE_CUBE_MAP_POSITIVE_X?e+i.TEXTURE_CUBE_MAP_POSITIVE_X:e}function Hf(e){switch(e){case i.FRAMEBUFFER_COMPLETE:return"success";case i.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"Mismatched attachments";case i.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"No attachments";case i.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"Height/width mismatch";case i.FRAMEBUFFER_UNSUPPORTED:return"Unsupported or split attachments";case i.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:return"Samples mismatch";default:return`${e}`}}var Dr=class extends la.CanvasContext{constructor(t,r){super(r),this.device=void 0,this.presentationSize=void 0,this._framebuffer=null,this.device=t,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new me(this.device,{handle:null}),this._framebuffer}update(){let t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t)}resize(t){if(this.canvas){let n=this.getDevicePixelRatio(t?.useDevicePixels);this.setDevicePixelRatio(n,t);return}let r=this.device.gl.getExtension("STACKGL_resize_drawingbuffer");r&&t&&"width"in t&&"height"in t&&r.resize(t.width,t.height)}commit(){}};var Se=x(F(),1),Vf={spector:Se.log.get("spector")||Se.log.get("inspect")},Kf="https://spectorcdn.babylonjs.com/spector.bundle.js",Gf=1,te=null,fa=!1;async function ca(e){if(!globalThis.SPECTOR)try{await(0,Se.loadScript)(Kf)}catch(t){Se.log.warn(String(t))}}function _a(e){var t,r;if(e={...Vf,...e},!((t=e)!==null&&t!==void 0&&t.spector)||(!te&&globalThis.SPECTOR&&(Se.log.probe(Gf,"SPECTOR found and initialized")(),te=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=te)),!te))return null;if(!fa){var n,o;fa=!0,te.spyCanvases(),(n=te)===null||n===void 0||n.onCaptureStarted.add(u=>Se.log.info("Spector capture started:",u)()),(o=te)===null||o===void 0||o.onCapture.add(u=>{var l,f,c;Se.log.info("Spector capture complete:",u)(),(l=te)===null||l===void 0||l.getResultUI(),(f=te)===null||f===void 0||f.resultView.display(),(c=te)===null||c===void 0||c.resultView.addCapture(u)})}if((r=e)!==null&&r!==void 0&&r.canvas){var a,s;if(typeof e.spector=="string"&&e.spector!==e.canvas.id)return te;(a=te)===null||a===void 0||a.startCapture((s=e)===null||s===void 0?void 0:s.canvas,500),new Promise(u=>setTimeout(u,2e3)).then(u=>{var l;Se.log.info("Spector capture stopped after 2 seconds")(),(l=te)===null||l===void 0||l.stopCapture()})}return te}var Be=x(F(),1);var zf="https://unpkg.com/webgl-debug@2.0.1/index.js";function Ea(e){return e.luma=e.luma||{},e.luma}async function da(){_e()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await(0,Be.loadScript)(zf))}function ga(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?Yf(e,t):jf(e):null}function jf(e){let t=Ea(e);return t.realContext?t.realContext:e}function Yf(e,t){if(!globalThis.WebGLDebugUtils)return Be.log.warn("webgl-debug not loaded")(),e;let r=Ea(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...i,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,kf.bind(null,t),$f.bind(null,t));for(let s in i)!(s in n)&&typeof i[s]=="number"&&(n[s]=i[s]);class o{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(o,n);let a=Object.create(o);return r.realContext=e,r.debugContext=a,a.debug=!0,a}function ni(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function kf(e,t,r,n){n=Array.from(n).map(l=>l===void 0?"undefined":l);let o=globalThis.WebGLDebugUtils.glEnumToString(t),a=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),s=e.webgl2?"gl2":"gl1",u=`${o} in ${s}.${r}(${a})`;Be.log.error(u)();debugger;if(e.throwOnError)throw new Error(u)}function $f(e,t,r){let n="";if(Be.log.level>=1&&(n=ni(t,r),Be.log.log(1,n)()),e.break&&e.break.length>0&&(n=n||ni(t,r),e.break.every(a=>n.indexOf(a)!==-1)))debugger;for(let o of r)if(o===void 0){if(n=n||ni(t,r),e.throwOnError)throw new Error(`Undefined argument: ${n}`);Be.log.error(`Undefined argument: ${n}`)();debugger}}var ue=x(F(),1);var Ur=x(F(),1);var Zf="Failed to deduce GL constant from typed array";function Br(e){switch(ArrayBuffer.isView(e)?e.constructor:e){case Float32Array:return i.FLOAT;case Uint16Array:return i.UNSIGNED_SHORT;case Uint32Array:return i.UNSIGNED_INT;case Uint8Array:return i.UNSIGNED_BYTE;case Uint8ClampedArray:return i.UNSIGNED_BYTE;case Int8Array:return i.BYTE;case Int16Array:return i.SHORT;case Int32Array:return i.INT;default:throw new Error(Zf)}}function _t(e,t){let{clamped:r=!0}=t||{};switch(e){case i.FLOAT:return Float32Array;case i.UNSIGNED_SHORT:case i.UNSIGNED_SHORT_5_6_5:case i.UNSIGNED_SHORT_4_4_4_4:case i.UNSIGNED_SHORT_5_5_5_1:return Uint16Array;case i.UNSIGNED_INT:return Uint32Array;case i.UNSIGNED_BYTE:return r?Uint8ClampedArray:Uint8Array;case i.BYTE:return Int8Array;case i.SHORT:return Int16Array;case i.INT:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var qf={offset:0,stride:0,type:i.FLOAT,size:1,divisor:0,normalized:!1,integer:!1},Qf={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},ee=class{static getBytesPerElement(t){return _t(t.type||i.FLOAT).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return(0,Ur.assert)(t.size),_t(t.type||i.FLOAT).BYTES_PER_ELEMENT*t.size}static resolve(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return new ee(qf,...r)}constructor(){this.offset=void 0,this.stride=void 0,this.type=void 0,this.size=void 0,this.divisor=void 0,this.normalized=void 0,this.integer=void 0,this.buffer=void 0,this.index=void 0;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(o=>this._assign(o)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return ee.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return ee.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=(0,Ur.checkProps)("Accessor",t,Qf),t.type!==void 0&&(this.type=t.type,(t.type===i.INT||t.type===i.UNSIGNED_INT)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalize!==void 0&&(this.normalized=t.normalize),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index=="boolean"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};var ha=10,Aa={offset:"accessor.offset",stride:"accessor.stride",type:"accessor.type",size:"accessor.size",divisor:"accessor.divisor",normalized:"accessor.normalized",integer:"accessor.integer",instanced:"accessor.divisor",isInstanced:"accessor.divisor"},pa={removedProps:{},replacedProps:{bytes:"byteLength"},deprecatedProps:Aa},Jf={removedProps:Aa};function ec(e){return ArrayBuffer.isView(e)?{data:e}:typeof e=="number"?{byteLength:e}:(e=(0,ue.checkProps)("Buffer",e,pa),{...e})}var Et=class extends se{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(super(K.attach(t),ec(r)),this.accessor=void 0,this.setAccessor(Object.assign({},r,r.accessor)),this.props.data){let n=Br(this.props.data);(0,ue.assert)(n),this.setAccessor(new ee(this.accessor,{type:n}))}Object.seal(this)}getElementCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/ee.getBytesPerElement(t))}getVertexCount(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.accessor;return Math.round(this.byteLength/ee.getBytesPerVertex(t))}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return ArrayBuffer.isView(t)&&(t={data:t}),Number.isFinite(t)&&(t={byteLength:t}),t=(0,ue.checkProps)("Buffer",t,pa),this.glUsage=t.glUsage||i.STATIC_DRAW,this.debugData=null,this.setAccessor(Object.assign({},t,t.accessor)),t.data?this._setData(t.data,t.byteOffset,t.byteLength):this._setByteLength(t.byteLength||0),this}setProps(t){return t=(0,ue.checkProps)("Buffer",t,Jf),"accessor"in t&&this.setAccessor(t.accessor),this}setAccessor(t){return t=Object.assign({},t),delete t.buffer,this.accessor=new ee(t),this}reallocate(t){return t>this.byteLength?(this._setByteLength(t),!0):(this.bytesUsed=t,!1)}setData(t){return this.initialize(t)}subData(t){ArrayBuffer.isView(t)&&(t={data:t});let{data:r,offset:n=0,srcOffset:o=0}=t,a=t.byteLength||t.length;(0,ue.assert)(r);let s=this.gl.webgl2?i.COPY_WRITE_BUFFER:this.glTarget;return this.gl.bindBuffer(s,this.handle),o!==0||a!==void 0?(mr(this.gl),this.gl.bufferSubData(this.glTarget,n,r,o,a)):this.gl.bufferSubData(s,n,r),this.gl.bindBuffer(s,null),this.debugData=null,this._inferType(r),this}copyData(t){let{sourceBuffer:r,readOffset:n=0,writeOffset:o=0,size:a}=t,{gl:s,gl2:u}=this;return mr(s),s.bindBuffer(i.COPY_READ_BUFFER,r.handle),s.bindBuffer(i.COPY_WRITE_BUFFER,this.handle),u?.copyBufferSubData(i.COPY_READ_BUFFER,i.COPY_WRITE_BUFFER,n,o,a),s.bindBuffer(i.COPY_READ_BUFFER,null),s.bindBuffer(i.COPY_WRITE_BUFFER,null),this.debugData=null,this}getData(t){var r;let{dstData:n=null,length:o=0}=t||{},{srcByteOffset:a=0,dstOffset:s=0}=t||{};mr(this.gl);let u=_t(this.accessor.type||i.FLOAT,{clamped:!1}),l=this._getAvailableElementCount(a),f=s,c,_;n?(_=n.length,c=_-f):(c=Math.min(l,o||l),_=f+c);let E=Math.min(l,c);return o=o||E,(0,ue.assert)(o<=E),n=n||new u(_),this.gl.bindBuffer(i.COPY_READ_BUFFER,this.handle),(r=this.gl2)===null||r===void 0||r.getBufferSubData(i.COPY_READ_BUFFER,a,n,s,o),this.gl.bindBuffer(i.COPY_READ_BUFFER,null),n}bind(t){let{glTarget:r=this.glTarget,index:n=this.accessor&&this.accessor.index,offset:o=0,size:a}=t||{};if(r===i.UNIFORM_BUFFER||r===i.TRANSFORM_FEEDBACK_BUFFER)if(a!==void 0){var s;(s=this.gl2)===null||s===void 0||s.bindBufferRange(r,n,this.handle,o,a)}else{var u;(0,ue.assert)(o===0),(u=this.gl2)===null||u===void 0||u.bindBufferBase(r,n,this.handle)}else this.gl.bindBuffer(r,this.handle);return this}unbind(t){let{glTarget:r=this.glTarget,index:n=this.accessor&&this.accessor.index}=t||{};if(r===i.UNIFORM_BUFFER||r===i.TRANSFORM_FEEDBACK_BUFFER){var a;(a=this.gl2)===null||a===void 0||a.bindBufferBase(r,n,null)}else this.gl.bindBuffer(r,null);return this}getDebugData(){return this.debugData?{data:this.debugData,changed:!1}:(this.debugData=this.getData({length:Math.min(ha,this.byteLength)}),{data:this.debugData,changed:!0})}invalidateDebugData(){this.debugData=null}_setData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r;(0,ue.assert)(ArrayBuffer.isView(t)),this.trackDeallocatedMemory();let o=this._getTarget();this.gl.bindBuffer(o,this.handle),this.gl.bufferData(o,n,this.glUsage),this.gl.bufferSubData(o,r,t),this.gl.bindBuffer(o,null),this.debugData=t.slice(0,ha),this.bytesUsed=n,this.byteLength=n,this.trackAllocatedMemory(n);let a=Br(t);return(0,ue.assert)(a),this.setAccessor(new ee(this.accessor,{type:a})),this}_setByteLength(t){(0,ue.assert)(t>=0),this.trackDeallocatedMemory();let r=t;t===0&&(r=new Float32Array(0));let n=this._getTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.debugData=null,this.bytesUsed=t,this.byteLength=t,this.trackAllocatedMemory(t),this}_getTarget(){return this.gl.webgl2?i.COPY_WRITE_BUFFER:this.glTarget}_getAvailableElementCount(t){let r=_t(this.accessor.type||i.FLOAT,{clamped:!1}),n=t/r.BYTES_PER_ELEMENT;return this.getElementCount()-n}_inferType(t){this.accessor.type||this.setAccessor(new ee(this.accessor,{type:Br(t)}))}getParameter(t){this.gl.bindBuffer(this.glTarget,this.handle);let r=this.gl.getBufferParameter(this.glTarget,t);return this.gl.bindBuffer(this.glTarget,null),r}get type(){return this.accessor.type}};var Ue=x(F(),1);function ii(e,t){return{name:tc(e,t),language:"glsl",version:rc(e)}}function tc(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"unnamed",n=/#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/.exec(e);return n?n[1]:t}function rc(e){let t=100,r=e.match(/[^\s]+/g);if(r&&r.length>=2&&r[0]==="#version"){let n=parseInt(r[1],10);Number.isFinite(n)&&(t=n)}return t}var nc=["warning","error","info"];function oi(e){let t=e.split(/\r?\n/),r=[];for(let n of t){if(n.length<=1)continue;let o=n.split(":"),[a,s,u,...l]=o,f=parseInt(u,10);isNaN(f)&&(f=0);let c=parseInt(s,10);isNaN(c)&&(c=0);let _=a.toLowerCase(),E=nc.includes(_)?_:"info";r.push({message:l.join(":").trim(),type:E,lineNum:f,linePos:c})}return r}var wr=class extends Ue.Shader{constructor(t,r){switch(super(t,{id:ic(r),...r}),this.device=void 0,this.handle=void 0,this.device=t,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(i.VERTEX_SHADER);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(i.FRAGMENT_SHADER);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async compilationInfo(){let t=this.device.gl.getShaderInfoLog(this.handle);return t?oi(t):[]}_compile(t){t=(a=>a.startsWith("#version ")?a:`#version 100
|
|
302
|
-
${a}`)(t);let{gl:n}=this.device;if(n.shaderSource(this.handle,t),n.compileShader(this.handle),!n.getShaderParameter(this.handle,i.COMPILE_STATUS)){let a=n.getShaderInfoLog(this.handle),u=(a?oi(a):[]).filter(_=>_.type==="error"),l=(0,Ue.formatCompilerLog)(u,t,{showSourceCode:!0}),f=ii(t).name,c=`${this.stage} shader ${f}`;throw Ue.log.error(`GLSL compilation errors in ${c}
|
|
303
|
-
${l}`)(),new Error(`GLSL compilation errors in ${f}`)}}};function ic(e){return ii(e.source).name||e.id||(0,Ue.uid)(`unnamed ${e.stage}-shader`)}var Ta=x(F(),1);var oc=256,ac=1024,sc=16384,ai=6144,Lr=class extends Ta.RenderPass{constructor(t,r){super(t,r),this.device=void 0,this.glParameters=void 0,this.device=t,this.setParameters(this.props.parameters),this.clear()}end(){}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[i.RASTERIZER_DISCARD]=this.props.discard,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),r.scissorTest=Boolean(t.scissorRect),t.scissorRect&&(r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[i.STENCIL_REF]=t.stencilReference),this.glParameters=r,Fe(this.device,r)}clear(){let t={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=sc,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=oc,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=ac,t.clearStencil=this.props.clearStencil),r!==0&&Y(this.device,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];Y(this.device.gl2,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl2.clearBufferiv(ai,t,r);break;case Uint32Array:this.device.gl2.clearBufferuiv(ai,t,r);break;case Float32Array:default:this.device.gl2.clearBufferfv(ai,t,r);break}})}};var oe=x(F(),1),Na=x(F(),1);function Ra(e){return uc.includes(e)}var uc=[i.SAMPLER_2D,i.SAMPLER_CUBE,i.SAMPLER_3D,i.SAMPLER_2D_SHADOW,i.SAMPLER_2D_ARRAY,i.SAMPLER_2D_ARRAY_SHADOW,i.SAMPLER_CUBE_SHADOW,i.INT_SAMPLER_2D,i.INT_SAMPLER_3D,i.INT_SAMPLER_CUBE,i.INT_SAMPLER_2D_ARRAY,i.UNSIGNED_INT_SAMPLER_2D,i.UNSIGNED_INT_SAMPLER_3D,i.UNSIGNED_INT_SAMPLER_CUBE,i.UNSIGNED_INT_SAMPLER_2D_ARRAY],ma={[i.FLOAT]:[i.FLOAT,1,"float","f32","float32"],[i.FLOAT_VEC2]:[i.FLOAT,2,"vec2","vec2<f32>","float32x2"],[i.FLOAT_VEC3]:[i.FLOAT,3,"vec3","vec3<f32>","float32x3"],[i.FLOAT_VEC4]:[i.FLOAT,4,"vec4","vec4<f32>","float32x4"],[i.INT]:[i.INT,1,"int","i32","sint32"],[i.INT_VEC2]:[i.INT,2,"ivec2","vec2<i32>","sint32x2"],[i.INT_VEC3]:[i.INT,3,"ivec3","vec3<i32>","sint32x3"],[i.INT_VEC4]:[i.INT,4,"ivec4","vec4<i32>","sint32x4"],[i.UNSIGNED_INT]:[i.UNSIGNED_INT,1,"uint","u32","uint32"],[i.UNSIGNED_INT_VEC2]:[i.UNSIGNED_INT,2,"uvec2","vec2<u32>","uint32x2"],[i.UNSIGNED_INT_VEC3]:[i.UNSIGNED_INT,3,"uvec3","vec3<u32>","uint32x3"],[i.UNSIGNED_INT_VEC4]:[i.UNSIGNED_INT,4,"uvec4","vec4<u32>","uint32x4"],[i.BOOL]:[i.FLOAT,1,"bool","f32","float32"],[i.BOOL_VEC2]:[i.FLOAT,2,"bvec2","vec2<f32>","float32x2"],[i.BOOL_VEC3]:[i.FLOAT,3,"bvec3","vec3<f32>","float32x3"],[i.BOOL_VEC4]:[i.FLOAT,4,"bvec4","vec4<f32>","float32x4"],[i.FLOAT_MAT2]:[i.FLOAT,8,"mat2","mat2x2<f32>"],[i.FLOAT_MAT2x3]:[i.FLOAT,8,"mat2x3","mat2x3<f32>"],[i.FLOAT_MAT2x4]:[i.FLOAT,8,"mat2x4","mat2x4<f32>"],[i.FLOAT_MAT3x2]:[i.FLOAT,12,"mat3x2","mat3x2<f32>"],[i.FLOAT_MAT3]:[i.FLOAT,12,"mat3","mat3x3<f32>"],[i.FLOAT_MAT3x4]:[i.FLOAT,12,"mat3x4","mat3x4<f32>"],[i.FLOAT_MAT4x2]:[i.FLOAT,16,"mat4x2","mat4x2<f32>"],[i.FLOAT_MAT4x3]:[i.FLOAT,16,"mat4x3","mat4x3<f32>"],[i.FLOAT_MAT4]:[i.FLOAT,16,"mat4","mat4x4<f32>"]};function si(e){let t=ma[e];if(!t)throw new Error("uniform");let[r,n,,o]=t;return{format:o,components:n,glType:r}}function Sa(e){let t=ma[e];if(!t)throw new Error("attribute");let[,r,,n,o]=t;return{attributeType:n,vertexFormat:o,components:r}}function Oa(e,t){let r={attributes:[],bindings:[]};r.attributes=lc(e,t);let n=_c(e,t);for(let u of n){let l=u.uniforms.map(f=>({name:f.name,format:f.format,byteOffset:f.byteOffset,byteStride:f.byteStride,arrayLength:f.arrayLength}));r.bindings.push({type:"uniform",name:u.name,location:u.location,visibility:(u.vertex?1:0)&(u.fragment?2:0),minBindingSize:u.byteLength,uniforms:l})}let o=cc(e,t),a=0;for(let u of o)if(Ra(u.type)){let{viewDimension:l,sampleType:f}=dc(u.type);r.bindings.push({type:"texture",name:u.name,location:a,viewDimension:l,sampleType:f}),u.textureUnit=a,a+=1}o.length&&(r.uniforms=o);let s=fc(e,t);return s!=null&&s.length&&(r.varyings=s),r}function lc(e,t){let r=[],n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let o=0;o<n;o++){let a=e.getActiveAttrib(t,o);if(!a)throw new Error("activeInfo");let{name:s,type:u}=a,l=e.getAttribLocation(t,s);if(l>=0){let{attributeType:f}=Sa(u),c=/instance/i.test(s)?"instance":"vertex";r.push({name:s,location:l,stepMode:c,type:f})}}return r.sort((o,a)=>o.location-a.location),r}function fc(e,t){if(!D(e))return[];let r=e,n=[],o=e.getProgramParameter(t,i.TRANSFORM_FEEDBACK_VARYINGS);for(let a=0;a<o;a++){let s=r.getTransformFeedbackVarying(t,a);if(!s)throw new Error("activeInfo");let{name:u,type:l,size:f}=s,{glType:c,components:_}=si(l),E=new ee({type:c,size:f*_}),d={location:a,name:u,accessor:E};n.push(d)}return n.sort((a,s)=>a.location-s.location),n}function cc(e,t){let r=[],n=e.getProgramParameter(t,i.ACTIVE_UNIFORMS);for(let o=0;o<n;o++){let a=e.getActiveUniform(t,o);if(!a)throw new Error("activeInfo");let{name:s,size:u,type:l}=a,{name:f,isArray:c}=gc(s),_=e.getUniformLocation(t,f),E={location:_,name:f,size:u,type:l,isArray:c};if(r.push(E),E.size>1)for(let d=0;d<E.size;d++){let h=`${f}[${d}]`;_=e.getUniformLocation(t,h);let p={...E,name:h,location:_};r.push(p)}}return r}function _c(e,t){if(!D(e))return[];let r=e,n=(s,u)=>r.getActiveUniformBlockParameter(t,s,u),o=[],a=r.getProgramParameter(t,i.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<a;s++){let u={name:r.getActiveUniformBlockName(t,s)||"",location:n(s,i.UNIFORM_BLOCK_BINDING),byteLength:n(s,i.UNIFORM_BLOCK_DATA_SIZE),vertex:n(s,i.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),fragment:n(s,i.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),uniformCount:n(s,i.UNIFORM_BLOCK_ACTIVE_UNIFORMS),uniforms:[]},l=n(s,i.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)||[],f=r.getActiveUniforms(t,l,i.UNIFORM_TYPE),c=r.getActiveUniforms(t,l,i.UNIFORM_SIZE),_=r.getActiveUniforms(t,l,i.UNIFORM_OFFSET),E=r.getActiveUniforms(t,l,i.UNIFORM_ARRAY_STRIDE);for(let d=0;d<u.uniformCount;++d){let h=r.getActiveUniform(t,l[d]);if(!h)throw new Error("activeInfo");u.uniforms.push({name:h.name,format:si(f[d]).format,type:f[d],arrayLength:c[d],byteOffset:_[d],byteStride:E[d]})}o.push(u)}return o.sort((s,u)=>s.location-u.location),o}var Ec={[i.SAMPLER_2D]:["2d","float"],[i.SAMPLER_CUBE]:["cube","float"],[i.SAMPLER_3D]:["3d","float"],[i.SAMPLER_2D_SHADOW]:["3d","depth"],[i.SAMPLER_2D_ARRAY]:["2d-array","float"],[i.SAMPLER_2D_ARRAY_SHADOW]:["2d-array","depth"],[i.SAMPLER_CUBE_SHADOW]:["cube","float"],[i.INT_SAMPLER_2D]:["2d","sint"],[i.INT_SAMPLER_3D]:["3d","sint"],[i.INT_SAMPLER_CUBE]:["cube","sint"],[i.INT_SAMPLER_2D_ARRAY]:["2d-array","uint"],[i.UNSIGNED_INT_SAMPLER_2D]:["2d","uint"],[i.UNSIGNED_INT_SAMPLER_3D]:["3d","uint"],[i.UNSIGNED_INT_SAMPLER_CUBE]:["cube","uint"],[i.UNSIGNED_INT_SAMPLER_2D_ARRAY]:["2d-array","uint"]};function dc(e){let t=Ec[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function gc(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function va(e,t,r,n){let o=e,a=n;a===!0&&(a=1),a===!1&&(a=0);let s=typeof a=="number"?[a]:a;switch(r){case i.SAMPLER_2D:case i.SAMPLER_CUBE:case i.SAMPLER_3D:case i.SAMPLER_2D_SHADOW:case i.SAMPLER_2D_ARRAY:case i.SAMPLER_2D_ARRAY_SHADOW:case i.SAMPLER_CUBE_SHADOW:case i.INT_SAMPLER_2D:case i.INT_SAMPLER_3D:case i.INT_SAMPLER_CUBE:case i.INT_SAMPLER_2D_ARRAY:case i.UNSIGNED_INT_SAMPLER_2D:case i.UNSIGNED_INT_SAMPLER_3D:case i.UNSIGNED_INT_SAMPLER_CUBE:case i.UNSIGNED_INT_SAMPLER_2D_ARRAY:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case i.FLOAT:return e.uniform1fv(t,s);case i.FLOAT_VEC2:return e.uniform2fv(t,s);case i.FLOAT_VEC3:return e.uniform3fv(t,s);case i.FLOAT_VEC4:return e.uniform4fv(t,s);case i.INT:return e.uniform1iv(t,s);case i.INT_VEC2:return e.uniform2iv(t,s);case i.INT_VEC3:return e.uniform3iv(t,s);case i.INT_VEC4:return e.uniform4iv(t,s);case i.BOOL:return e.uniform1iv(t,s);case i.BOOL_VEC2:return e.uniform2iv(t,s);case i.BOOL_VEC3:return e.uniform3iv(t,s);case i.BOOL_VEC4:return e.uniform4iv(t,s);case i.UNSIGNED_INT:return o.uniform1uiv(t,s,1);case i.UNSIGNED_INT_VEC2:return o.uniform2uiv(t,s,2);case i.UNSIGNED_INT_VEC3:return o.uniform3uiv(t,s,3);case i.UNSIGNED_INT_VEC4:return o.uniform4uiv(t,s,4);case i.FLOAT_MAT2:return e.uniformMatrix2fv(t,!1,s);case i.FLOAT_MAT3:return e.uniformMatrix3fv(t,!1,s);case i.FLOAT_MAT4:return e.uniformMatrix4fv(t,!1,s);case i.FLOAT_MAT2x3:return o.uniformMatrix2x3fv(t,!1,s);case i.FLOAT_MAT2x4:return o.uniformMatrix2x4fv(t,!1,s);case i.FLOAT_MAT3x2:return o.uniformMatrix3x2fv(t,!1,s);case i.FLOAT_MAT3x4:return o.uniformMatrix3x4fv(t,!1,s);case i.FLOAT_MAT4x2:return o.uniformMatrix4x2fv(t,!1,s);case i.FLOAT_MAT4x3:return o.uniformMatrix4x3fv(t,!1,s)}throw new Error("Illegal uniform")}var ba=4,Xr=class extends oe.RenderPipeline{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.vs=void 0,this.fs=void 0,this.introspectedLayout=void 0,this.uniforms={},this.bindings={},this.varyings=null,this._textureUniforms={},this._textureIndexCounter=0,this._uniformCount=0,this._uniformSetters={},this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=(0,oe.cast)(r.vs),this.fs=(0,oe.cast)(r.fs);let{varyings:n,bufferMode:o=i.SEPARATE_ATTRIBS}=r;if(n&&n.length>0){var a;this.device.assertWebGL2(),this.varyings=n,(a=this.device.gl2)===null||a===void 0||a.transformFeedbackVaryings(this.handle,n,o)}this._compileAndLink(),this.introspectedLayout=Oa(this.device.gl,this.handle),this.shaderLayout=(0,Na.mergeShaderLayout)(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t){for(let[r,n]of Object.entries(t)){let o=this.shaderLayout.bindings.find(a=>a.name===r);if(!o){let a=this.shaderLayout.bindings.map(s=>`"${s.name}"`).join(", ");oe.log.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${a}`)();continue}switch(n||oe.log.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),o.type){case"uniform":if(!(n instanceof se)&&!(n.buffer instanceof se))throw new Error("buffer value");break;case"texture":if(!(n instanceof k||n instanceof me))throw new Error("texture value");break;case"sampler":oe.log.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(o.type)}this.bindings[r]=n}}setUniforms(t){Object.assign(this.uniforms,t)}draw(t){var r;let{renderPass:n,vertexArray:o,vertexCount:a,instanceCount:s,firstVertex:u=0}=t,l=hc(this.props.topology),f=Boolean(o.indexBuffer),c=(r=o.indexBuffer)===null||r===void 0?void 0:r.glIndexType,_=Number(s)>0;if(!this._areTexturesRenderable()||a===0)return!1;this.device.gl.useProgram(this.handle),o.bindBeforeRender(n);let E=Ac(this.props.topology),d=null;d&&d.begin(E),this._applyBindings(),this._applyUniforms();let h=n;return ta(this.device,this.props.parameters,h.glParameters,()=>{if(f&&_){var p;(p=this.device.gl2)===null||p===void 0||p.drawElementsInstanced(l,a||0,c,u,s||0)}else if(f)this.device.gl.drawElements(l,a||0,c,u);else if(_){var g;(g=this.device.gl2)===null||g===void 0||g.drawArraysInstanced(l,u,a||0,s||0)}else this.device.gl.drawArrays(l,u,a||0);d&&d.end()}),o.unbindAfterRender(n),!0}_compileAndLink(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),oe.log.time(ba,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),oe.log.timeEnd(ba,`linkProgram for ${this.id}`)(),!t.debug&&oe.log.level,!t.getProgramParameter(this.handle,t.LINK_STATUS))throw new Error(`Error linking: ${t.getProgramInfoLog(this.handle)}`);if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,t.VALIDATE_STATUS))throw new Error(`Error validating: ${t.getProgramInfoLog(this.handle)}`)}_areTexturesRenderable(){let t=!0;for(let[,r]of Object.entries(this._textureUniforms))r.update(),t=t&&r.loaded;for(let[,r]of Object.entries(this.bindings))r.loaded!==void 0&&(t=t&&r.loaded);return t}_applyBindings(){this.device.gl.useProgram(this.handle);let{gl2:t}=this.device;if(!t)throw new Error("bindings");let r=0,n=0;for(let o of this.shaderLayout.bindings){let a=this.bindings[o.name];if(!a)throw new Error(`No value for binding ${o.name} in ${this.id}`);switch(o.type){case"uniform":let{name:s}=o,u=t.getUniformBlockIndex(this.handle,s);if(u===i.INVALID_INDEX)throw new Error(`Invalid uniform block name ${s}`);t.uniformBlockBinding(this.handle,n,u),a instanceof se?t.bindBufferBase(i.UNIFORM_BUFFER,n,a.handle):t.bindBufferRange(i.UNIFORM_BUFFER,n,a.buffer.handle,a.offset||0,a.size||a.buffer.byteLength-a.offset),n+=1;break;case"texture":if(!(a instanceof k||a instanceof me))throw new Error("texture");let l;if(a instanceof k)l=a;else if(a instanceof me&&a.colorAttachments[0]instanceof k)oe.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=a.colorAttachments[0];else throw new Error("No texture");t.activeTexture(i.TEXTURE0+r),t.bindTexture(l.target,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${o.type}' not supported in WebGL`)}}}_applyUniforms(){for(let r of this.shaderLayout.uniforms||[]){var t;let{name:n,location:o,type:a,textureUnit:s}=r,u=(t=this.uniforms[n])!==null&&t!==void 0?t:s;u!==void 0&&va(this.device.gl,o,a,u)}}};function hc(e){switch(e){case"point-list":return i.POINTS;case"line-list":return i.LINES;case"line-strip":return i.LINE_STRIP;case"line-loop-webgl":return i.LINE_LOOP;case"triangle-list":return i.TRIANGLES;case"triangle-strip":return i.TRIANGLE_STRIP;case"triangle-fan-webgl":return i.TRIANGLE_FAN;default:throw new Error(e)}}function Ac(e){switch(e){case"point-list":return i.POINTS;case"line-list":return i.LINES;case"line-strip":return i.LINES;case"line-loop-webgl":return i.LINES;case"triangle-list":return i.TRIANGLES;case"triangle-strip":return i.TRIANGLES;case"triangle-fan-webgl":return i.TRIANGLES;default:throw new Error(e)}}var ya=x(F(),1);var Hr=x(F(),1);var Wr=class extends Hr.CommandBuffer{constructor(t){super({}),this.device=void 0,this.commands=[],this.device=t}submitCommands(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.commands;for(let r of t)switch(r.name){case"copy-buffer-to-buffer":pc(this.device,r.options);break;case"copy-buffer-to-texture":Tc(this.device,r.options);break;case"copy-texture-to-buffer":Rc(this.device,r.options);break;case"copy-texture-to-texture":mc(this.device,r.options);break}}};function pc(e,t){let r=t.source,n=t.destination,o=e.assertWebGL2();if(o){var a,s;o.bindBuffer(i.COPY_READ_BUFFER,r.handle),o.bindBuffer(i.COPY_WRITE_BUFFER,n.handle),o.copyBufferSubData(i.COPY_READ_BUFFER,i.COPY_WRITE_BUFFER,(a=t.sourceOffset)!==null&&a!==void 0?a:0,(s=t.destinationOffset)!==null&&s!==void 0?s:0,t.size),o.bindBuffer(i.COPY_READ_BUFFER,null),o.bindBuffer(i.COPY_WRITE_BUFFER,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function Tc(e,t){throw new Error("Not implemented")}function Rc(e,t){let{source:r,mipLevel:n=0,aspect:o="all",width:a=t.source.width,height:s=t.source.height,depthOrArrayLayers:u=0,origin:l=[0,0],destination:f,byteOffset:c=0,bytesPerRow:_,rowsPerImage:E}=t;if(o!=="all")throw new Error("not supported");if(n!==0||u!==void 0||_||E)throw new Error("not implemented");let d=e.assertWebGL2(),{framebuffer:h,destroyFramebuffer:p}=Ca(r);try{let g=f,T=a||h.width,m=s||h.height,R=i.RGBA,S=i.UNSIGNED_BYTE;d.bindBuffer(i.PIXEL_PACK_BUFFER,g.handle),d.bindFramebuffer(i.FRAMEBUFFER,h.handle),d.readPixels(l[0],l[1],T,m,R,S,c)}finally{d.bindBuffer(i.PIXEL_PACK_BUFFER,null),d.bindFramebuffer(i.FRAMEBUFFER,null),p&&h.destroy()}}function mc(e,t){let{source:r,origin:n=[0,0],destination:o}=t,{width:a=t.destination.width,height:s=t.destination.width}=t,u=0,l=i.RGBA,{framebuffer:f,destroyFramebuffer:c}=Ca(r),[_,E]=n,d=!1;e.gl.bindFramebuffer(i.FRAMEBUFFER,f.handle);let h=null,p;if(o instanceof k)h=o,a=Number.isFinite(a)?a:h.width,s=Number.isFinite(s)?s:h.height,h.bind(0),p=h.destination;else throw new Error("whoops");return d||e.gl.copyTexImage2D(p,u,l,_,E,a,s,0),h&&h.unbind(),c&&f.destroy(),h}function Ca(e){if(e instanceof Hr.Texture){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var Vr=class extends ya.CommandEncoder{constructor(t,r){super(t,r),this.device=void 0,this.commandBuffer=void 0,this.device=t,this.commandBuffer=new Wr(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}};var gt=x(F(),1);var Ia;Ia=Symbol.toStringTag;var dt=class extends gt.VertexArray{get[Ia](){return"VertexArray"}static isConstantAttributeZeroSupported(t){return t.info.type==="webgl2"||Rr()==="Chrome"}constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.buffer=null,this.bufferValue=null,this.init=!1,this.device=t,this.handle=this.device.gl2.createVertexArray()}destroy(){if(super.destroy(),this.buffer){var t;(t=this.buffer)===null||t===void 0||t.destroy()}this.handle&&(this.device.gl2.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let r=t;if(r&&r.glTarget!==i.ELEMENT_ARRAY_BUFFER)throw new Error("Use .setBuffer()");this.device.gl2.bindVertexArray(this.handle),this.device.gl2.bindBuffer(i.ELEMENT_ARRAY_BUFFER,r?r.handle:null),this.indexBuffer=r}setBuffer(t,r){let n=r;if(n.glTarget===i.ELEMENT_ARRAY_BUFFER)throw new Error("Use .setIndexBuffer()");let{size:o,type:a,stride:s,offset:u,normalized:l,integer:f,divisor:c}=this._getAccessor(t);this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(i.ARRAY_BUFFER,n.handle),f?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(t,o,a,s,u)):this.device.gl.vertexAttribPointer(t,o,a,l,s,u),this.device.gl.enableVertexAttribArray(t),this.device.gl2.vertexAttribDivisor(t,c||0),this.attributes[t]=n}setConstant(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){if(this.device.gl2.bindVertexArray(this.handle),!this.init){let t=this.indexBuffer;this.device.gl2.bindBuffer(i.ELEMENT_ARRAY_BUFFER,t?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl2.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttribute(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=vr(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,o=dt.isConstantAttributeZeroSupported(this.device)||t!==0;(r||o)&&(t=Number(t),this.device.gl2.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl2.bindVertexArray(null))}getConstantBuffer(t,r){let n=Sc(r),o=n.byteLength*t,a=n.length*t,s=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:o}),s=s||this.buffer.reallocate(o),s=s||!Oc(n,this.bufferValue),s){let u=(0,gt.getScratchArray)(r.constructor,a);(0,gt.fillArray)({target:u,source:n,start:0,count:a}),this.buffer.subData(u),this.bufferValue=r}return this.buffer}};function Sc(e){return Array.isArray(e)?new Float32Array(e):e}function Oc(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Kr=1,K=class extends V.Device{static isSupported(){return typeof WebGLRenderingContext<"u"||mo()}get features(){return this._features=this._features||qo(this.gl),this._features}get limits(){return this._limits=this._limits||Jo(this.gl),this._limits}static attach(t){if(t instanceof K)return t;if(t?.device instanceof V.Device)return t.device;if(!vc(t))throw new Error("Invalid WebGLRenderingContext");return new K({gl:t})}static async create(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};V.log.groupCollapsed(Kr,"WebGLDevice created"),typeof t.canvas=="string"&&await V.CanvasContext.pageLoaded,(V.log.get("debug")||t.debug)&&await da();let{spector:r}=t;return(V.log.get("spector")||r)&&await ca(),V.log.probe(Kr+1,"DOM is loaded")(),t.gl&&t.gl.device?K.attach(t.gl):new K(t)}constructor(t){var r;super({...t,id:t.id||(0,V.uid)("webgl-device")}),this.info=void 0,this.canvasContext=void 0,this.handle=void 0,this.lost=void 0,this._resolveContextLost=void 0,this._features=void 0,this._limits=void 0,this.renderPass=null,this.gl=void 0,this.gl2=null,this.debug=!1,this.isWebGL1=void 0,this.isWebGL2=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this._extensions={},this._polyfilled=!1,this.spector=void 0,this._webglLimits=void 0,this._constants=void 0;let n=(r=t.gl)===null||r===void 0?void 0:r.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new Dr(this,t),this.lost=new Promise(f=>{this._resolveContextLost=f});let o=f=>{var c;return(c=this._resolveContextLost)===null||c===void 0?void 0:c.call(this,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},a=t.gl||null;if(a=a||(_e()?Ho(this.canvasContext.canvas,{...t,onContextLost:o}):null),a=a||(_e()?null:So({...t,onContextLost:o})),!a)throw new Error("WebGL context creation failed");this.handle=a,this.gl=this.handle,this.gl2=this.gl,this.isWebGL2=bc(this.gl),this.isWebGL1=!this.isWebGL2,this.info=Vo(this.gl),this.gl.device=this,this.gl._version=this.isWebGL2?2:1,Mo(this.gl);let{enable:s=!0,copyState:u=!1}=t;if(kn(this.gl,{enable:s,copyState:u,log:function(){for(var f=arguments.length,c=new Array(f),_=0;_<f;_++)c[_]=arguments[_];return V.log.log(1,...c)()}}),_e()&&t.debug&&(this.gl=ga(this.gl,{...t,webgl2:this.isWebGL2,throwOnError:!0}),this.gl2=this.gl,this.debug=!0,V.log.level=Math.max(V.log.level,1),V.log.warn("WebGL debug mode activated. Performance reduced.")()),_e()&&t.spector){let f=this.handle.canvas||t.canvas;this.spector=_a({...this.props,canvas:f})}let l=`Created ${this.info.type}${this.debug?" debug":""} context: ${this.info.vendor}, ${this.info.renderer} for canvas: ${this.canvasContext.id}`;V.log.probe(Kr,l)(),V.log.groupEnd(Kr)()}destroy(){let t=this.gl.getExtension("STACKGL_destroy_context");t&&t.destroy()}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(t){return nr(this.gl,t)}isTextureFormatFilterable(t){return Yo(this.gl,t)}isTextureFormatRenderable(t){return ko(this.gl,t)}assertWebGL2(){if(!this.gl2)throw new Error("Requires WebGL2");return this.gl2}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._getBufferProps(t);return new Et(this,r)}_createTexture(t){return new k(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new Ze(this,t)}createShader(t){return new wr(this,t)}createFramebuffer(t){return new me(this,t)}createRenderPipeline(t){return new Xr(this,t)}createVertexArray(t){return new dt(this,t)}beginRenderPass(t){return new Lr(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("compute shaders not supported in WebGL")}getDefaultRenderPass(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass}createCommandEncoder(t){return new Vr(this,t)}submit(){var t;(t=this.renderPass)===null||t===void 0||t.end(),this.renderPass=null}get webglLimits(){return this._webglLimits=this._webglLimits||ea(this.gl),this._webglLimits}loseDevice(){var t;let r=!1,n=this.gl.getExtension("WEBGL_lose_context");return n&&(r=!0,n.loseContext()),(t=this._resolveContextLost)===null||t===void 0||t.call(this,{reason:"destroyed",message:"Application triggered context loss"}),r}pushState(){lt(this.gl)}popState(){ke(this.gl)}setSpectorMetadata(t,r){t.__SPECTOR_Metadata=r}getGLKey(t,r){r=r||this.gl2||this.gl;let n=Number(t);for(let o in r)if(r[o]===n)return`GL.${o}`;return String(t)}setConstantAttribute(t,r){this._constants=this._constants||new Array(this.limits.maxVertexAttributes).fill(null);let n=this._constants[t];switch(n&&Ic(n,r)&&V.log.info(1,`setConstantAttribute(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:Nc(this,t,r);break;case Int32Array:Cc(this,t,r);break;case Uint32Array:yc(this,t,r);break;default:(0,V.assert)(!1)}}};K.type="webgl";function vc(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function bc(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Nc(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:(0,V.assert)(!1)}}function Cc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function yc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function Ic(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var xa=x(F(),1);var xc=256,Pc=1024,Mc=16384;var Fc="clear: bad arguments";function Gr(e,t){let r=K.attach(e),{framebuffer:n=null,color:o=null,depth:a=null,stencil:s=null}=t||{},u={};n&&(u.framebuffer=n);let l=0;o&&(l|=Mc,o!==!0&&(u.clearColor=o)),a&&(l|=xc,a!==!0&&(u.clearDepth=a)),s&&(l|=Pc,a!==!0&&(u.clearStencil=a)),(0,xa.assert)(l!==0,Fc),Y(r.gl,u,()=>{r.gl.clear(l)})}var sr=x(F(),1);var ui=x(F(),1);function Pa(e){switch(e){case i.ALPHA:case i.R32F:case i.RED:return 1;case i.RG32F:case i.RG:return 2;case i.RGB:case i.RGB32F:return 3;case i.RGBA:case i.RGBA32F:return 4;default:return(0,ui.assert)(!1),0}}function Ma(e){switch(e){case i.UNSIGNED_BYTE:return 1;case i.UNSIGNED_SHORT_5_6_5:case i.UNSIGNED_SHORT_4_4_4_4:case i.UNSIGNED_SHORT_5_5_5_1:return 2;case i.FLOAT:return 4;default:return(0,ui.assert)(!1),0}}function ht(e,t){let{sourceX:r=0,sourceY:n=0,sourceFormat:o=i.RGBA,targetByteOffset:a=0}=t||{},{target:s,sourceWidth:u,sourceHeight:l,sourceType:f}=t||{},{framebuffer:c,deleteFramebuffer:_}=Dc(e);(0,sr.assert)(c),u=u||c.width,l=l||c.height;let d=c.device.assertWebGL2();if(f=f||(s?s.type:i.UNSIGNED_BYTE),!s){let h=Pa(o),p=Ma(f),g=a+u*l*h*p;s=new Et(d,{byteLength:g,accessor:{type:f,size:h}})}return s.bind({glTarget:i.PIXEL_PACK_BUFFER}),Y(d,{framebuffer:c},()=>{d.readPixels(r,n,u,l,o,f,a)}),s.unbind({glTarget:i.PIXEL_PACK_BUFFER}),_&&c.destroy(),s}function Dc(e){return e instanceof sr.Framebuffer?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:Bc(e),deleteFramebuffer:!0}}function Bc(e,t){let{device:r,width:n,height:o,id:a}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${a}`,width:n,height:o,colorAttachments:[e]})}var Le=x(j());var w={SUM:1,MEAN:2,MIN:3,MAX:4};function Fa(e,t){return e+t}function Uc(e,t){return t>e?t:e}function wc(e,t){return t<e?t:e}function Lc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Fa,0)/r.length:null}function Xc(e,t){if(Number.isFinite(t))return e.length?e.length*t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Fa,0):null}function Wc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Uc,-1/0):null}function Hc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(wc,1/0):null}function At(e,t,r){var n=w[e]||w.SUM;switch(t=Vc(t,r),n){case w.MIN:return function(o){return Hc(o,t)};case w.SUM:return function(o){return Xc(o,t)};case w.MEAN:return function(o){return Lc(o,t)};case w.MAX:return function(o){return Wc(o,t)};default:return null}}function Vc(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Number.isFinite(e)?e:function(r){return t.index=r.index,e(r.source,t)}}function Da(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function(r){return t.indices=r.map(function(n){return n.index}),e(r.map(function(n){return n.source}),t)}}var pt;function zr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ba={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},we=3402823466e29,li=[32775,32774],fi=[32776,32774],Ua=[32776,32775],ci=(pt={},zr(pt,w.SUM,32774),zr(pt,w.MEAN,32774),zr(pt,w.MIN,li),zr(pt,w.MAX,fi),pt);var wa={size:1,operation:w.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},La=4;var Xa=`#define SHADER_NAME gpu-aggregation-to-grid-vs
|
|
312
|
+
`;var Df={ONE:1};function Ff(){return Df}var it={name:"fp64-arithmetic",vs:Ao,getUniforms:Ff,fp64ify:Wn,fp64LowPart:_o,fp64ifyMatrix4:po};var Hn=P(I(),1);var vr=class{constructor(t){this.modules=void 0,this.moduleUniforms=void 0,this.moduleBindings=void 0,this.moduleUniformsChanged=void 0;let r=zt(Object.values(t));Hn.log.log(1,"Creating ShaderInputs with modules",r.map(n=>n.name))(),this.modules=t,this.moduleUniforms={},this.moduleBindings={};for(let[n,i]of Object.entries(t)){let o=n;this.moduleUniforms[o]=i.defaultUniforms||{},this.moduleBindings[o]={}}}destroy(){}setProps(t){for(let n of Object.keys(t)){var r;let i=n,o=t[i],a=this.modules[i];if(!a){Hn.log.warn(`Module ${n} not found`)();continue}let s=this.moduleUniforms[i],l=((r=a.getUniforms)===null||r===void 0?void 0:r.call(a,o,this.moduleUniforms[i]))||o;this.moduleUniforms[i]={...s,...l}}}getModules(){return Object.values(this.modules)}getUniformValues(){return this.moduleUniforms}getBindings(){let t={};for(let r of Object.values(this.moduleBindings))Object.assign(t,r);return t}getDebugTable(){let t={};for(let[n,i]of Object.entries(this.moduleUniforms))for(let[o,a]of Object.entries(i)){var r;t[`${n}.${o}`]={type:(r=this.modules[n].uniformTypes)===null||r===void 0?void 0:r[o],value:String(a)}}return t}};var Se=P(I(),1),mr=class{constructor(t){this.id=void 0,this.userData={},this.topology=void 0,this.bufferLayout=[],this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.id=t.id||(0,Se.uid)("geometry"),this.topology=t.topology,this.indices=t.indices||null,this.attributes=t.attributes,this.vertexCount=t.vertexCount,this.bufferLayout=t.bufferLayout||[],this.indices&&(0,Se.assert)(this.indices.usage===Se.Buffer.INDEX)}destroy(){var t;this.indices.destroy(),this.attributes.positions.destroy(),this.attributes.normals.destroy(),this.attributes.texCoords.destroy(),(t=this.attributes.colors)===null||t===void 0||t.destroy()}getVertexCount(){return this.vertexCount}getAttributes(){return this.attributes}getIndexes(){return this.indices}_calculateVertexCount(t){return t.byteLength/12}};function To(e,t){if(t instanceof mr)return t;let r=wf(e,t),{attributes:n,bufferLayout:i}=Bf(e,t);return new mr({topology:t.topology||"triangle-list",bufferLayout:i,vertexCount:t.vertexCount,indices:r,attributes:n})}function wf(e,t){if(!t.indices)return;let r=t.indices.value;return e.createBuffer({usage:Se.Buffer.INDEX,data:r})}function Bf(e,t){let r=[],n={};for(let[o,a]of Object.entries(t.attributes)){let s=o;switch(o){case"POSITION":s="positions";break;case"NORMAL":s="normals";break;case"TEXCOORD_0":s="texCoords";break;case"COLOR_0":s="colors";break}n[s]=e.createBuffer({data:a.value,id:`${o}-buffer`});let{value:l,size:f,normalized:u}=a;r.push({name:s,format:(0,Se.getVertexFormatFromAttribute)(l,f,u)})}let i=t._calculateVertexCount(t.attributes,t.indices);return{attributes:n,bufferLayout:r,vertexCount:i}}var vo=P(I(),1),Ne=class{static getDefaultPipelineFactory(t){return t._lumaData.defaultPipelineFactory=t._lumaData.defaultPipelineFactory||new Ne(t),t._lumaData.defaultPipelineFactory}constructor(t){this.device=void 0,this._hashCounter=0,this._hashes={},this._useCounts={},this._pipelineCache={},this.device=t}createRenderPipeline(t){let r={...Ne.defaultProps,...t},n=this._hashRenderPipeline({...r});if(!this._pipelineCache[n]){let i=this.device.createRenderPipeline({...r,vs:this.device.createShader({stage:"vertex",source:r.vs}),fs:r.fs?this.device.createShader({stage:"fragment",source:r.fs}):null});i.hash=n,this._pipelineCache[n]=i,this._useCounts[n]=0}return this._useCounts[n]++,this._pipelineCache[n]}release(t){let r=t.hash;this._useCounts[r]--,this._useCounts[r]===0&&(this._pipelineCache[r].destroy(),delete this._pipelineCache[r],delete this._useCounts[r])}_createRenderPipeline(t){if(!t.fs)throw new Error("fs");return this.device.createRenderPipeline({...t,vs:this.device.createShader({stage:"vertex",source:t.vs}),fs:t.fs?this.device.createShader({stage:"fragment",source:t.fs}):null})}_hashRenderPipeline(t){let r=this._getHash(t.vs),n=t.fs?this._getHash(t.fs):0,i="-";switch(this.device.info.type){case"webgpu":let o=this._getHash(JSON.stringify(t.parameters)),a=this._getHash(JSON.stringify(t.bufferLayout));return`${r}/${n}V${i}T${t.topology}P${o}BL${a}}`;default:return`${r}/${n}V${i}`}}_getHash(t){return this._hashes[t]===void 0&&(this._hashes[t]=this._hashCounter++),this._hashes[t]}};Ne.defaultProps={...vo.RenderPipeline.defaultProps,vs:void 0,fs:void 0};function mo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r={},n=`Shader Layout for ${t}`;for(let i of e.attributes)if(i){let o=`${i.location} ${i.name}: ${i.type}`;r[`in ${o}`]={[n]:i.stepMode||"vertex"}}for(let i of e.varyings||[]){let o=`${i.location} ${i.name}`;r[`out ${o}`]={[n]:JSON.stringify(i.accessor)}}return r}var br=2,Uf=1e4,Y=class{constructor(t,r){var n,i,o;this.device=void 0,this.id=void 0,this.vs=void 0,this.fs=void 0,this.pipelineFactory=void 0,this.userData={},this.parameters=void 0,this.topology=void 0,this.bufferLayout=void 0,this.vertexCount=void 0,this.instanceCount=0,this.indexBuffer=null,this.bufferAttributes={},this.constantAttributes={},this.bindings={},this.uniforms={},this.vertexArray=void 0,this.transformFeedback=null,this.pipeline=void 0,this.shaderInputs=void 0,this._uniformStore=void 0,this._pipelineNeedsUpdate="newly created",this._attributeInfos={},this._gpuGeometry=null,this._getModuleUniforms=void 0,this.props=void 0,this._lastLogTime=0,this._logOpen=!1,this.props={...Y.defaultProps,...r},r=this.props,this.id=r.id||(0,z.uid)("model"),this.device=t,Object.assign(this.userData,r.userData);let a=Object.fromEntries(((n=this.props.modules)===null||n===void 0?void 0:n.map(d=>[d.name,d]))||[]);this.setShaderInputs(r.shaderInputs||new vr(a));let s=Wf(t),l=(((i=this.props.modules)===null||i===void 0?void 0:i.length)>0?this.props.modules:(o=this.shaderInputs)===null||o===void 0?void 0:o.getModules())||[],{vs:f,fs:u,getUniforms:c}=this.props.shaderAssembler.assembleShaders({platformInfo:s,...this.props,modules:l});if(this.vs=f,this.fs=u,this._getModuleUniforms=c,this.vertexCount=this.props.vertexCount,this.instanceCount=this.props.instanceCount,this.topology=this.props.topology,this.bufferLayout=this.props.bufferLayout,this.parameters=this.props.parameters,r.geometry&&(this._gpuGeometry=this.setGeometry(r.geometry)),this.pipelineFactory=r.pipelineFactory||Ne.getDefaultPipelineFactory(this.device),this.pipeline=this._updatePipeline(),this.vertexArray=t.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry),r.vertexCount&&this.setVertexCount(r.vertexCount),r.instanceCount&&this.setInstanceCount(r.instanceCount),r.indices)throw new Error("Model.props.indices removed. Use props.indexBuffer");r.indexBuffer&&this.setIndexBuffer(r.indexBuffer),r.attributes&&this.setAttributes(r.attributes),r.constantAttributes&&this.setConstantAttributes(r.constantAttributes),r.bindings&&this.setBindings(r.bindings),r.uniforms&&this.setUniforms(r.uniforms),r.moduleSettings&&(z.log.warn("Model.props.moduleSettings is deprecated. Use Model.shaderInputs.setProps()")(),this.updateModuleSettings(r.moduleSettings)),r.transformFeedback&&(this.transformFeedback=r.transformFeedback),Object.seal(this)}destroy(){this.pipelineFactory.release(this.pipeline),this._uniformStore.destroy()}predraw(){this.updateShaderInputs()}draw(t){this.predraw();try{this._logDrawCallStart(),this.pipeline=this._updatePipeline(),this.pipeline.setBindings(this.bindings),this.pipeline.setUniforms(this.uniforms),this.pipeline.draw({renderPass:t,vertexArray:this.vertexArray,vertexCount:this.vertexCount,instanceCount:this.instanceCount,transformFeedback:this.transformFeedback})}finally{this._logDrawCallEnd()}}setGeometry(t){let r=t&&To(this.device,t);return this.setTopology(r.topology||"triangle-list"),this.bufferLayout=bo(this.bufferLayout,r.bufferLayout),this.vertexArray&&this._setGeometryAttributes(r),r}_setGeometryAttributes(t){this.vertexCount=t.vertexCount,this.setAttributes(t.attributes,"ignore-unknown"),this.setIndexBuffer(t.indices)}setTopology(t){t!==this.topology&&(this.topology=t,this._setPipelineNeedsUpdate("topology"))}setBufferLayout(t){this.bufferLayout=this._gpuGeometry?bo(t,this._gpuGeometry.bufferLayout):t,this._setPipelineNeedsUpdate("bufferLayout"),this.pipeline=this._updatePipeline(),this.vertexArray=this.device.createVertexArray({renderPipeline:this.pipeline}),this._gpuGeometry&&this._setGeometryAttributes(this._gpuGeometry)}setParameters(t){(0,z.deepEqual)(t,this.parameters,2)||(this.parameters=t,this._setPipelineNeedsUpdate("parameters"))}setVertexCount(t){this.vertexCount=t}setInstanceCount(t){this.instanceCount=t}setShaderInputs(t){this.shaderInputs=t,this._uniformStore=new Sr.UniformStore(this.shaderInputs.modules);for(let r of Object.keys(this.shaderInputs.modules)){let n=this._uniformStore.getManagedUniformBuffer(this.device,r);this.bindings[`${r}Uniforms`]=n}}updateShaderInputs(){this._uniformStore.setUniforms(this.shaderInputs.getUniformValues())}updateModuleSettings(t){z.log.warn("Model.updateModuleSettings is deprecated. Use Model.shaderInputs.setProps()")();let{bindings:r,uniforms:n}=(0,z.splitUniformsAndBindings)(this._getModuleUniforms(t));Object.assign(this.bindings,r),Object.assign(this.uniforms,n)}setBindings(t){Object.assign(this.bindings,t)}setUniforms(t){this.pipeline.setUniforms(t),Object.assign(this.uniforms,t)}setIndexBuffer(t){this.vertexArray.setIndexBuffer(t)}setTransformFeedback(t){this.transformFeedback=t}setAttributes(t,r){t.indices&&z.log.warn(`Model:${this.id} setAttributes() - indexBuffer should be set using setIndexBuffer()`)();for(let[i,o]of Object.entries(t)){var n;let a=this.bufferLayout.find(f=>f.name===i);if(!a){z.log.warn(`Model(${this.id}): Missing layout for buffer "${i}".`)();continue}let s=a.attributes?(n=a.attributes)===null||n===void 0?void 0:n.map(f=>f.attribute):[a.name],l=!1;for(let f of s){let u=this._attributeInfos[f];u&&(this.vertexArray.setBuffer(u.location,o),l=!0)}!l&&r!=="ignore-unknown"&&z.log.warn(`Model(${this.id}): Ignoring buffer "${o.id}" for unknown attribute "${i}"`)()}}setConstantAttributes(t){for(let[r,n]of Object.entries(t)){let i=this._attributeInfos[r];i?this.vertexArray.setConstant(i.location,n):z.log.warn(`Model "${this.id}: Ignoring constant supplied for unknown attribute "${r}"`)()}}_setPipelineNeedsUpdate(t){this._pipelineNeedsUpdate=this._pipelineNeedsUpdate||t}_updatePipeline(){return this._pipelineNeedsUpdate&&(this.pipeline&&z.log.log(1,`Model ${this.id}: Recreating pipeline because "${this._pipelineNeedsUpdate}".`)(),this._pipelineNeedsUpdate=!1,this.pipeline=this.device.createRenderPipeline({...this.props,bufferLayout:this.bufferLayout,topology:this.topology,parameters:this.parameters,vs:this.device.createShader({id:"{$this.id}-vertex",stage:"vertex",source:this.vs}),fs:this.fs?this.device.createShader({id:"{$this.id}-fragment",stage:"fragment",source:this.fs}):null}),this._attributeInfos=(0,So.getAttributeInfosFromLayouts)(this.pipeline.shaderLayout,this.bufferLayout)),this.pipeline}_logDrawCallStart(){let t=z.log.level>3?0:Uf;Date.now()-this._lastLogTime<t||(this._lastLogTime=Date.now(),this._logOpen=!0,z.log.group(br,`>>> DRAWING MODEL ${this.id}`,{collapsed:z.log.level<=2})())}_logDrawCallEnd(){if(this._logOpen){let t=mo(this.pipeline.shaderLayout);z.log.table(br,t)();let r=this.shaderInputs.getDebugTable();for(let[n,i]of Object.entries(this.uniforms))r[n]={value:i};z.log.table(br,r)(),z.log.groupEnd(br)(),this._logOpen=!1}}};Y.defaultProps={...Sr.RenderPipeline.defaultProps,vs:null,fs:null,id:"unnamed",handle:void 0,userData:{},defines:{},modules:[],moduleSettings:void 0,geometry:null,indexBuffer:null,attributes:{},constantAttributes:{},varyings:[],shaderInputs:void 0,pipelineFactory:void 0,transformFeedback:void 0,shaderAssembler:le.getDefaultShaderAssembler()};function bo(e,t){let r=[...e];for(let n of t){let i=r.findIndex(o=>o.name===n.name);i<0?r.push(n):r[i]=n}return r}function Wf(e){return{type:e.info.type,shaderLanguage:e.info.shadingLanguage,shaderLanguageVersion:e.info.shadingLanguageVersion,gpu:e.info.gpu,features:e.features}}var Hf="transform_output",Me=class{constructor(t,r){this.device=void 0,this.model=void 0,this.sampler=void 0,this.currentIndex=0,this.samplerTextureMap=null,this.bindings=[],this.resources={},this.device=t,this.sampler=t.createSampler({addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge",minFilter:"nearest",magFilter:"nearest",mipmapFilter:"nearest"}),this.model=new Y(this.device,{id:r.id||"texture-transform-model",fs:r.fs||Un({version:300,input:r.targetTextureVarying,inputChannels:r.targetTextureChannels,output:Hf}),vertexCount:r.vertexCount,...r}),this._initialize(r),Object.seal(this)}destroy(){}delete(){this.destroy()}run(t){let{framebuffer:r}=this.bindings[this.currentIndex],n=this.device.beginRenderPass({framebuffer:r,...t});this.model.draw(n),n.end()}update(){console.warn("TextureTransform#update() not implemented")}getData(){let{packed:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};throw new Error("getData() not implemented")}getTargetTexture(){let{targetTexture:t}=this.bindings[this.currentIndex];return t}getFramebuffer(){return this.bindings[this.currentIndex].framebuffer}_initialize(t){this._updateBindings(t)}_updateBindings(t){this.bindings[this.currentIndex]=this._updateBinding(this.bindings[this.currentIndex],t)}_updateBinding(t,r){let{sourceBuffers:n,sourceTextures:i,targetTexture:o}=r;if(t||(t={sourceBuffers:{},sourceTextures:{},targetTexture:null}),Object.assign(t.sourceTextures,i),Object.assign(t.sourceBuffers,n),o){t.targetTexture=o;let{width:a,height:s}=o;t.framebuffer&&t.framebuffer.destroy(),t.framebuffer=this.device.createFramebuffer({id:"transform-framebuffer",width:a,height:s,colorAttachments:[o]}),t.framebuffer.resize({width:a,height:s})}return t}_setSourceTextureParameters(){let t=this.currentIndex,{sourceTextures:r}=this.bindings[t];for(let n in r)r[n].sampler=this.sampler}};var ot=P(I(),1),Re=class{constructor(t){this.id=void 0,this.topology=void 0,this.vertexCount=void 0,this.indices=void 0,this.attributes=void 0,this.userData={};let{attributes:r={},indices:n=null,vertexCount:i=null}=t;this.id=t.id||(0,ot.uid)("geometry"),this.topology=t.topology,n&&(this.indices=ArrayBuffer.isView(n)?{value:n,size:1}:n),this.attributes={};for(let[o,a]of Object.entries(r)){let s=ArrayBuffer.isView(a)?{value:a}:a;(0,ot.assert)(ArrayBuffer.isView(s.value),`${this._print(o)}: must be typed array or object with value as typed array`),(o==="POSITION"||o==="positions")&&!s.size&&(s.size=3),o==="indices"?((0,ot.assert)(!this.indices),this.indices=s):this.attributes[o]=s}this.indices&&this.indices.isIndexed!==void 0&&(this.indices=Object.assign({},this.indices),delete this.indices.isIndexed),this.vertexCount=i||this._calculateVertexCount(this.attributes,this.indices)}getVertexCount(){return this.vertexCount}getAttributes(){return this.indices?{indices:this.indices,...this.attributes}:this.attributes}_print(t){return`Geometry ${this.id} attribute ${t}`}_setAttributes(t,r){return this}_calculateVertexCount(t,r){if(r)return r.value.length;let n=1/0;for(let i of Object.values(t)){let{value:o,size:a,constant:s}=i;!s&&o&&a>=1&&(n=Math.min(n,o.length/a))}return(0,ot.assert)(Number.isFinite(n)),n}};var Ro=P(I(),1);var kt=class extends Re{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{id:r=(0,Ro.uid)("cube-geometry"),indices:n=!0}=t;super(n?{...t,id:r,topology:"triangle-list",indices:{size:1,value:Vf},attributes:{...Kf,...t.attributes}}:{...t,id:r,topology:"triangle-list",indices:void 0,attributes:{...Yf,...t.attributes}})}},Vf=new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]),Xf=new Float32Array([-1,-1,1,1,-1,1,1,1,1,-1,1,1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,1,1,1,1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,1,-1,1,1,-1,1,-1]),Lf=new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,1,0,0,1,0,0,1,0,0,1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0]),zf=new Float32Array([0,0,1,0,1,1,0,1,1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,0,1,1,0,1,0,0,0,0,1,0,1,1,0,1]),jf=new Float32Array([1,-1,1,1,-1,-1,1,1,-1,-1,-1,1,1,-1,-1,1,1,-1,1,1,-1,-1,-1,1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,-1,-1,1,-1,1,1,1,1,1,1,1,1,1,-1,1,-1,1,-1,1,-1,1,1,1,1,1,-1,1,-1,-1,1,1,-1,1,1,1,-1,1,-1,1,-1,-1,-1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,-1,1,1,1,-1,-1,1,1,-1,-1,1,1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,1,-1,1,-1,1,1,1,-1,1,1,-1,-1,1,-1,1,-1,1]),kf=new Float32Array([1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,1,1,1,1,0,1,0,0,1,0,1,1,0,0]),$f=new Float32Array([1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,0,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1,1,1,1,1,0,0,1,0,0,0,1,0,1,0,1,1,1,0,1,1,0,0,1,0,1,0,1]),Kf={POSITION:{size:3,value:Xf},NORMAL:{size:3,value:Lf},TEXCOORD_0:{size:2,value:zf}},Yf={POSITION:{size:4,value:jf},TEXCOORD_0:{size:2,value:kf},COLOR_0:{size:3,value:$f}};var Zf="Failed to create WebGL context in Node.js, headless gl returned null",qf=" luma.gl: loaded under Node.js without headless gl installed, meaning that WebGL contexts can not be created. This may not be an error. For example, this is a typical configuration for isorender applications running on the server.",Qf={width:1,height:1,debug:!0,throwOnError:!1},Vn=null;function yo(){return Vn!==null}function Eo(e){e={...Qf,...e};let{width:t,height:r,webgl1:n,webgl2:i}=e;if(i&&!n)throw new Error("headless-gl does not support WebGL2");if(!Vn)throw new Error(qf);let o=Vn(t,r,e);if(!o)throw new Error(Zf);return o}var H=P(I(),1);function $t(e){if(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof process<"u"&&typeof process.versions=="object"&&Boolean(process.versions.electron))return!0;let t=typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}function fe(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process.browser)||$t()}var Xp=globalThis.self||globalThis.window||globalThis.global,Lp=globalThis.window||globalThis.self||globalThis.global,zp=globalThis.document||{},jp=globalThis.process||{},kp=globalThis.console,xo=globalThis.navigator||{};var Xn=globalThis;function Rr(e){if(!e&&!fe())return"Node";if($t(e))return"Electron";let t=e||xo.userAgent||"";if(t.indexOf("Edge")>-1)return"Edge";let r=t.indexOf("MSIE ")!==-1,n=t.indexOf("Trident/")!==-1;return r||n?"IE":Xn.chrome?"Chrome":Xn.safari?"Safari":Xn.mozInnerScreenX?"Firefox":"Unknown"}var wo=P(I(),1);var Kt={};function Jf(e){globalThis.console&&globalThis.console.error&&globalThis.console.error(e)}function Gf(e){globalThis.console&&globalThis.console.log&&globalThis.console.log(e)}function eu(e,t){Kt[e]=!0,t!==void 0&&Jf(t)}function tu(e){let t=e.getError;e.getError=function(){let n;do n=t.apply(e),n!==0&&(Kt[n]=!0);while(n!==0);for(n in Kt)if(Kt[n])return delete Kt[n],parseInt(n,10);return 0}}var Yt=function e(t){let r=t.gl;this.ext=t,this.isAlive=!0,this.hasBeenBound=!1,this.elementArrayBuffer=null,this.attribs=new Array(t.maxVertexAttribs);for(let n=0;n<this.attribs.length;n++){let i=new e.VertexAttrib(r);this.attribs[n]=i}this.maxAttrib=0};Yt.VertexAttrib=function(t){this.enabled=!1,this.buffer=null,this.size=4,this.type=5126,this.normalized=!1,this.stride=16,this.offset=0,this.cached="",this.recache()};Yt.VertexAttrib.prototype.recache=function(){this.cached=[this.size,this.type,this.normalized,this.stride,this.offset].join(":")};var je=function(t){let r=this;this.gl=t,tu(t);let n=this.original={getParameter:t.getParameter,enableVertexAttribArray:t.enableVertexAttribArray,disableVertexAttribArray:t.disableVertexAttribArray,bindBuffer:t.bindBuffer,getVertexAttrib:t.getVertexAttrib,vertexAttribPointer:t.vertexAttribPointer};t.getParameter=function(o){return o===r.VERTEX_ARRAY_BINDING_OES?r.currentVertexArrayObject===r.defaultVertexArrayObject?null:r.currentVertexArrayObject:n.getParameter.apply(this,arguments)},t.enableVertexAttribArray=function(o){let a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);let s=a.attribs[o];return s.enabled=!0,n.enableVertexAttribArray.apply(this,arguments)},t.disableVertexAttribArray=function(o){let a=r.currentVertexArrayObject;a.maxAttrib=Math.max(a.maxAttrib,o);let s=a.attribs[o];return s.enabled=!1,n.disableVertexAttribArray.apply(this,arguments)},t.bindBuffer=function(o,a){switch(o){case 34962:r.currentArrayBuffer=a;break;case 34963:r.currentVertexArrayObject.elementArrayBuffer=a;break;default:}return n.bindBuffer.apply(this,arguments)},t.getVertexAttrib=function(o,a){let l=r.currentVertexArrayObject.attribs[o];switch(a){case 34975:return l.buffer;case 34338:return l.enabled;case 34339:return l.size;case 34340:return l.stride;case 34341:return l.type;case 34922:return l.normalized;default:return n.getVertexAttrib.apply(this,arguments)}},t.vertexAttribPointer=function(o,a,s,l,f,u){let c=r.currentVertexArrayObject;c.maxAttrib=Math.max(c.maxAttrib,o);let d=c.attribs[o];return d.buffer=r.currentArrayBuffer,d.size=a,d.type=s,d.normalized=l,d.stride=f,d.offset=u,d.recache(),n.vertexAttribPointer.apply(this,arguments)},t.instrumentExtension&&t.instrumentExtension(this,"OES_vertex_array_object"),t.canvas&&t.canvas.addEventListener("webglcontextrestored",()=>{Gf("OESVertexArrayObject emulation library context restored"),r.reset_()},!0),this.reset_()};je.prototype.VERTEX_ARRAY_BINDING_OES=34229;je.prototype.reset_=function(){if(this.vertexArrayObjects!==void 0)for(let n=0;n<this.vertexArrayObjects.length;++n)this.vertexArrayObjects.isAlive=!1;let r=this.gl;this.maxVertexAttribs=r.getParameter(34921),this.defaultVertexArrayObject=new Yt(this),this.currentVertexArrayObject=null,this.currentArrayBuffer=null,this.vertexArrayObjects=[this.defaultVertexArrayObject],this.bindVertexArrayOES(null)};je.prototype.createVertexArrayOES=function(){let t=new Yt(this);return this.vertexArrayObjects.push(t),t};je.prototype.deleteVertexArrayOES=function(t){t.isAlive=!1,this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(t),1),this.currentVertexArrayObject===t&&this.bindVertexArrayOES(null)};je.prototype.isVertexArrayOES=function(t){return!!(t&&t instanceof Yt&&t.hasBeenBound&&t.ext===this)};je.prototype.bindVertexArrayOES=function(t){let r=this.gl;if(t&&!t.isAlive){eu(1282,"bindVertexArrayOES: attempt to bind deleted arrayObject");return}let n=this.original,i=this.currentVertexArrayObject;this.currentVertexArrayObject=t||this.defaultVertexArrayObject,this.currentVertexArrayObject.hasBeenBound=!0;let o=this.currentVertexArrayObject;if(i===o)return;(!i||o.elementArrayBuffer!==i.elementArrayBuffer)&&n.bindBuffer.call(r,34963,o.elementArrayBuffer);let a=this.currentArrayBuffer,s=Math.max(i?i.maxAttrib:0,o.maxAttrib);for(let l=0;l<=s;l++){let f=o.attribs[l],u=i?i.attribs[l]:null;if((!i||f.enabled!==u.enabled)&&(f.enabled?n.enableVertexAttribArray.call(r,l):n.disableVertexAttribArray.call(r,l)),f.enabled){let c=!1;(!i||f.buffer!==u.buffer)&&(a!==f.buffer&&(n.bindBuffer.call(r,34962,f.buffer),a=f.buffer),c=!0),(c||f.cached!==u.cached)&&n.vertexAttribPointer.call(r,l,f.size,f.type,f.normalized,f.stride,f.offset)}}this.currentArrayBuffer!==a&&n.bindBuffer.call(r,34962,this.currentArrayBuffer)};function Oo(e){if(typeof e.createVertexArray=="function")return;let t=e.getSupportedExtensions;e.getSupportedExtensions=function(){let i=t.call(this)||[];return i.indexOf("OES_vertex_array_object")<0&&i.push("OES_vertex_array_object"),i};let r=e.getExtension;e.getExtension=function(i){let o=r.call(this,i);return o||(i!=="OES_vertex_array_object"?null:(e.__OESVertexArrayObject||(this.__OESVertexArrayObject=new je(this)),this.__OESVertexArrayObject))}}var ke=P(I(),1);var Co=P(I(),1),ru="Invalid WebGLRenderingContext";function nu(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function D(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Ln(e){return D(e)?e:null}function Po(e){return(0,Co.assert)(nu(e),ru),e}var No="OES_element_index",Mo="WEBGL_draw_buffers",iu="EXT_disjoint_timer_query",ou="EXT_disjoint_timer_query_webgl2",au="EXT_texture_filter_anisotropic",Io="WEBGL_debug_renderer_info",su=35723,lu=4352,fu=36795,uu=34047,cu=37445,du=37446,B=e=>D(e)?void 0:0,gu={[3074]:e=>D(e)?void 0:36064,[su]:e=>D(e)?void 0:lu,[35977]:B,[32937]:B,[fu]:(e,t)=>{let r=D(e)?e.getExtension(ou):e.getExtension(iu);return r&&r.GPU_DISJOINT_EXT?t(r.GPU_DISJOINT_EXT):0},[cu]:(e,t)=>{let r=e.getExtension(Io);return t(r&&r.UNMASKED_VENDOR_WEBGL||7936)},[du]:(e,t)=>{let r=e.getExtension(Io);return t(r&&r.UNMASKED_RENDERER_WEBGL||7937)},[uu]:(e,t)=>{var r;let n=((r=e.luma)===null||r===void 0||(r=r.extensions)===null||r===void 0?void 0:r[au])||e.getExtension("EXT_texture_filter_anisotropic");return n?t(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):1},[32883]:B,[35071]:B,[37447]:B,[36063]:(e,t)=>{if(!D(e)){let r=e.getExtension(Mo);return r?t(r.MAX_COLOR_ATTACHMENTS_WEBGL):0}},[35379]:B,[35374]:B,[35377]:B,[34852]:e=>{if(!D(e)){let t=e.getExtension(Mo);return t?t.MAX_DRAW_BUFFERS_WEBGL:0}},[36203]:e=>e.getExtension(No)?2147483647:65535,[33001]:e=>e.getExtension(No)?16777216:65535,[33e3]:e=>16777216,[37157]:B,[35373]:B,[35657]:B,[36183]:B,[37137]:B,[34045]:B,[35978]:B,[35979]:B,[35968]:B,[35376]:B,[35375]:B,[35659]:B,[37154]:B,[35371]:B,[35658]:B,[35076]:B,[35077]:B,[35380]:B};function Do(e,t,r){let n=gu[r],i=typeof n=="function"?n(e,t,r):n;return i!==void 0?i:t(r)}function at(e){if(!e.luma){let r={_polyfilled:!1,_extensions:{}};e.luma=r}return e.luma}var hu="OES_vertex_array_object",Fo="ANGLE_instanced_arrays",_u="WEBGL_draw_buffers",pu="EXT_disjoint_timer_query",Au="EXT_texture_filter_anisotropic",Tu="VertexArray requires WebGL2 or OES_vertex_array_object extension";function vu(e,t){return{webgl2:D(e),ext:e.getExtension(t)}}var zn={[hu]:{meta:{suffix:"OES"},createVertexArray:()=>{(0,ke.assert)(!1,Tu)},deleteVertexArray:()=>{},bindVertexArray:()=>{},isVertexArray:()=>!1},[Fo]:{meta:{suffix:"ANGLE"},vertexAttribDivisor(e,t){(0,ke.assert)(t===0,"WebGL instanced rendering not supported")},drawElementsInstanced:()=>{},drawArraysInstanced:()=>{}},[_u]:{meta:{suffix:"WEBGL"},drawBuffers:()=>{(0,ke.assert)(!1)}},[pu]:{meta:{suffix:"EXT"},createQuery:()=>{(0,ke.assert)(!1)},deleteQuery:()=>{(0,ke.assert)(!1)},beginQuery:()=>{(0,ke.assert)(!1)},endQuery:()=>{},getQuery(e,t){return this.getQueryObject(e,t)},getQueryParameter(e,t){return this.getQueryObject(e,t)},getQueryObject:(e,t)=>{}}},yr={readBuffer:(e,t,r)=>{D(e)&&t(r)},getVertexAttrib:(e,t,r,n)=>{let{webgl2:i,ext:o}=vu(e,Fo),a;switch(n){case 35069:a=i?void 0:!1;break;case 35070:a=!i&&!o?0:void 0;break;default:}return a!==void 0?a:t(r,n)},getProgramParameter:(e,t,r,n)=>{if(!D(e))switch(n){case 35967:return 35981;case 35971:return 0;case 35382:return 0;default:}return t(r,n)},getInternalformatParameter:(e,t,r,n,i)=>{if(!D(e))switch(i){case 32937:return new Int32Array([0]);default:}return e.getInternalformatParameter(r,n,i)},getTexParameter(e,t,r,n){switch(n){case 34046:let i=at(e),{_extensions:o}=i,a=o[Au];n=a&&a.TEXTURE_MAX_ANISOTROPY_EXT||34046;break;default:}return t(r,n)},getParameter:Do,hint(e,t,r,n){return t(r,n)}};function Bo(e){let t=at(e);return t._polyfilled||(Oo(e),mu(e),bu(e,zn),Ru(e,{target:t,target2:e}),t._polyfilled=!0),e}function mu(e){let t=at(e),r=e.getSupportedExtensions()||[],n=["WEBGL_polygon_mode"];for(let i of r)if(!n.includes(i)){let o=e.getExtension(i);t._extensions[i]=o}}function bu(e,t){let r=at(e);for(let n of Object.getOwnPropertyNames(t))n!=="overrides"&&Su(e,{extension:n,target:r,target2:e})}function Su(e,t){let{extension:r,target:n,target2:i}=t,o=zn[r];(0,wo.assert)(o);let{meta:a={}}=o,{suffix:s=""}=a,l=e.getExtension(r);for(let f of Object.keys(o)){let u=`${f}${s}`,c=null;f==="meta"||typeof e[f]=="function"||(l&&typeof l[u]=="function"?c=function(){return l[u](...arguments)}:typeof o[f]=="function"&&(c=o[f].bind(n))),c&&(n[f]=c,i[f]=c)}}function Ru(e,t){let{target:r,target2:n}=t;Object.keys(yr).forEach(i=>{if(typeof yr[i]=="function"){let o=e[i]?e[i].bind(e):()=>{},a=yr[i].bind(null,e,o);r[i]=a,n[i]=a}})}var qt=P(I(),1);var Er={[3042]:!1,[32773]:new Float32Array([0,0,0,0]),[32777]:32774,[34877]:32774,[32969]:1,[32968]:0,[32971]:1,[32970]:0,[3106]:new Float32Array([0,0,0,0]),[3107]:[!0,!0,!0,!0],[2884]:!1,[2885]:1029,[2929]:!1,[2931]:1,[2932]:513,[2928]:new Float32Array([0,1]),[2930]:!0,[3024]:!0,[35725]:null,[36006]:null,[36007]:null,[34229]:null,[34964]:null,[2886]:2305,[33170]:4352,[2849]:1,[32823]:!1,[32824]:0,[10752]:0,[32926]:!1,[32928]:!1,[32938]:1,[32939]:!1,[3089]:!1,[3088]:new Int32Array([0,0,1024,1024]),[2960]:!1,[2961]:0,[2968]:4294967295,[36005]:4294967295,[2962]:519,[2967]:0,[2963]:4294967295,[34816]:519,[36003]:0,[36004]:4294967295,[2964]:7680,[2965]:7680,[2966]:7680,[34817]:7680,[34818]:7680,[34819]:7680,[2978]:[0,0,1024,1024],[3333]:4,[3317]:4,[37440]:!1,[37441]:!1,[37443]:37444,[36389]:null,[36662]:null,[36663]:null,[35053]:null,[35055]:null,[35723]:4352,[36010]:null,[35977]:!1,[3330]:0,[3332]:0,[3331]:0,[3314]:0,[32878]:0,[3316]:0,[3315]:0,[32877]:0},pe=(e,t,r)=>t?e.enable(r):e.disable(r),Uo=(e,t,r)=>e.hint(r,t),ne=(e,t,r)=>e.pixelStorei(r,t),Wo=(e,t,r)=>{let n;return r===36006?n=D(e)?36009:36160:n=36008,e.bindFramebuffer(n,t)},Zt=(e,t,r)=>{let i={[34964]:34962,[36662]:36662,[36663]:36663,[35053]:35051,[35055]:35052}[r];e.bindBuffer(i,t)};function jn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}var Ho={[3042]:pe,[32773]:(e,t)=>e.blendColor(...t),[32777]:"blendEquation",[34877]:"blendEquation",[32969]:"blendFunc",[32968]:"blendFunc",[32971]:"blendFunc",[32970]:"blendFunc",[3106]:(e,t)=>e.clearColor(...t),[3107]:(e,t)=>e.colorMask(...t),[2884]:pe,[2885]:(e,t)=>e.cullFace(t),[2929]:pe,[2931]:(e,t)=>e.clearDepth(t),[2932]:(e,t)=>e.depthFunc(t),[2928]:(e,t)=>e.depthRange(...t),[2930]:(e,t)=>e.depthMask(t),[3024]:pe,[35723]:Uo,[35725]:(e,t)=>e.useProgram(t),[36007]:(e,t)=>e.bindRenderbuffer(36161,t),[36389]:(e,t)=>{var r,n;return(r=(n=e).bindTransformFeedback)===null||r===void 0?void 0:r.call(n,36386,t)},[34229]:(e,t)=>e.bindVertexArray(t),[36006]:Wo,[36010]:Wo,[34964]:Zt,[36662]:Zt,[36663]:Zt,[35053]:Zt,[35055]:Zt,[2886]:(e,t)=>e.frontFace(t),[33170]:Uo,[2849]:(e,t)=>e.lineWidth(t),[32823]:pe,[32824]:"polygonOffset",[10752]:"polygonOffset",[35977]:pe,[32926]:pe,[32928]:pe,[32938]:"sampleCoverage",[32939]:"sampleCoverage",[3089]:pe,[3088]:(e,t)=>e.scissor(...t),[2960]:pe,[2961]:(e,t)=>e.clearStencil(t),[2968]:(e,t)=>e.stencilMaskSeparate(1028,t),[36005]:(e,t)=>e.stencilMaskSeparate(1029,t),[2962]:"stencilFuncFront",[2967]:"stencilFuncFront",[2963]:"stencilFuncFront",[34816]:"stencilFuncBack",[36003]:"stencilFuncBack",[36004]:"stencilFuncBack",[2964]:"stencilOpFront",[2965]:"stencilOpFront",[2966]:"stencilOpFront",[34817]:"stencilOpBack",[34818]:"stencilOpBack",[34819]:"stencilOpBack",[2978]:(e,t)=>e.viewport(...t),[3333]:ne,[3317]:ne,[37440]:ne,[37441]:ne,[37443]:ne,[3330]:ne,[3332]:ne,[3331]:ne,[3314]:ne,[32878]:ne,[3316]:ne,[3315]:ne,[32877]:ne,framebuffer:(e,t)=>{let r=t&&"handle"in t?t.handle:t;return e.bindFramebuffer(36160,r)},blend:(e,t)=>t?e.enable(3042):e.disable(3042),blendColor:(e,t)=>e.blendColor(...t),blendEquation:(e,t)=>{let r=typeof t=="number"?[t,t]:t;e.blendEquationSeparate(...r)},blendFunc:(e,t)=>{let r=t?.length===2?[...t,...t]:t;e.blendFuncSeparate(...r)},clearColor:(e,t)=>e.clearColor(...t),clearDepth:(e,t)=>e.clearDepth(t),clearStencil:(e,t)=>e.clearStencil(t),colorMask:(e,t)=>e.colorMask(...t),cull:(e,t)=>t?e.enable(2884):e.disable(2884),cullFace:(e,t)=>e.cullFace(t),depthTest:(e,t)=>t?e.enable(2929):e.disable(2929),depthFunc:(e,t)=>e.depthFunc(t),depthMask:(e,t)=>e.depthMask(t),depthRange:(e,t)=>e.depthRange(...t),dither:(e,t)=>t?e.enable(3024):e.disable(3024),derivativeHint:(e,t)=>{e.hint(35723,t)},frontFace:(e,t)=>e.frontFace(t),mipmapHint:(e,t)=>e.hint(33170,t),lineWidth:(e,t)=>e.lineWidth(t),polygonOffsetFill:(e,t)=>t?e.enable(32823):e.disable(32823),polygonOffset:(e,t)=>e.polygonOffset(...t),sampleCoverage:(e,t)=>e.sampleCoverage(...t),scissorTest:(e,t)=>t?e.enable(3089):e.disable(3089),scissor:(e,t)=>e.scissor(...t),stencilTest:(e,t)=>t?e.enable(2960):e.disable(2960),stencilMask:(e,t)=>{t=jn(t)?t:[t,t];let[r,n]=t;e.stencilMaskSeparate(1028,r),e.stencilMaskSeparate(1029,n)},stencilFunc:(e,t)=>{t=jn(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,a,s]=t;e.stencilFuncSeparate(1028,r,n,i),e.stencilFuncSeparate(1029,o,a,s)},stencilOp:(e,t)=>{t=jn(t)&&t.length===3?[...t,...t]:t;let[r,n,i,o,a,s]=t;e.stencilOpSeparate(1028,r,n,i),e.stencilOpSeparate(1029,o,a,s)},viewport:(e,t)=>e.viewport(...t)};function V(e,t,r){return t[e]!==void 0?t[e]:r[e]}var Vo={blendEquation:(e,t,r)=>e.blendEquationSeparate(V(32777,t,r),V(34877,t,r)),blendFunc:(e,t,r)=>e.blendFuncSeparate(V(32969,t,r),V(32968,t,r),V(32971,t,r),V(32970,t,r)),polygonOffset:(e,t,r)=>e.polygonOffset(V(32824,t,r),V(10752,t,r)),sampleCoverage:(e,t,r)=>e.sampleCoverage(V(32938,t,r),V(32939,t,r)),stencilFuncFront:(e,t,r)=>e.stencilFuncSeparate(1028,V(2962,t,r),V(2967,t,r),V(2963,t,r)),stencilFuncBack:(e,t,r)=>e.stencilFuncSeparate(1029,V(34816,t,r),V(36003,t,r),V(36004,t,r)),stencilOpFront:(e,t,r)=>e.stencilOpSeparate(1028,V(2964,t,r),V(2965,t,r),V(2966,t,r)),stencilOpBack:(e,t,r)=>e.stencilOpSeparate(1029,V(34817,t,r),V(34818,t,r),V(34819,t,r))},kn={enable:(e,t)=>e({[t]:!0}),disable:(e,t)=>e({[t]:!1}),pixelStorei:(e,t,r)=>e({[t]:r}),hint:(e,t,r)=>e({[t]:r}),useProgram:(e,t)=>e({[35725]:t}),bindRenderbuffer:(e,t,r)=>e({[36007]:r}),bindTransformFeedback:(e,t,r)=>e({[36389]:r}),bindVertexArray:(e,t)=>e({[34229]:t}),bindFramebuffer:(e,t,r)=>{switch(t){case 36160:return e({[36006]:r,[36010]:r});case 36009:return e({[36006]:r});case 36008:return e({[36010]:r});default:return null}},bindBuffer:(e,t,r)=>{let n={[34962]:[34964],[36662]:[36662],[36663]:[36663],[35051]:[35053],[35052]:[35055]}[t];return n?e({[n]:r}):{valueChanged:!0}},blendColor:(e,t,r,n,i)=>e({[32773]:new Float32Array([t,r,n,i])}),blendEquation:(e,t)=>e({[32777]:t,[34877]:t}),blendEquationSeparate:(e,t,r)=>e({[32777]:t,[34877]:r}),blendFunc:(e,t,r)=>e({[32969]:t,[32968]:r,[32971]:t,[32970]:r}),blendFuncSeparate:(e,t,r,n,i)=>e({[32969]:t,[32968]:r,[32971]:n,[32970]:i}),clearColor:(e,t,r,n,i)=>e({[3106]:new Float32Array([t,r,n,i])}),clearDepth:(e,t)=>e({[2931]:t}),clearStencil:(e,t)=>e({[2961]:t}),colorMask:(e,t,r,n,i)=>e({[3107]:[t,r,n,i]}),cullFace:(e,t)=>e({[2885]:t}),depthFunc:(e,t)=>e({[2932]:t}),depthRange:(e,t,r)=>e({[2928]:new Float32Array([t,r])}),depthMask:(e,t)=>e({[2930]:t}),frontFace:(e,t)=>e({[2886]:t}),lineWidth:(e,t)=>e({[2849]:t}),polygonOffset:(e,t,r)=>e({[32824]:t,[10752]:r}),sampleCoverage:(e,t,r)=>e({[32938]:t,[32939]:r}),scissor:(e,t,r,n,i)=>e({[3088]:new Int32Array([t,r,n,i])}),stencilMask:(e,t)=>e({[2968]:t,[36005]:t}),stencilMaskSeparate:(e,t,r)=>e({[t===1028?2968:36005]:r}),stencilFunc:(e,t,r,n)=>e({[2962]:t,[2967]:r,[2963]:n,[34816]:t,[36003]:r,[36004]:n}),stencilFuncSeparate:(e,t,r,n,i)=>e({[t===1028?2962:34816]:r,[t===1028?2967:36003]:n,[t===1028?2963:36004]:i}),stencilOp:(e,t,r,n)=>e({[2964]:t,[2965]:r,[2966]:n,[34817]:t,[34818]:r,[34819]:n}),stencilOpSeparate:(e,t,r,n,i)=>e({[t===1028?2964:34817]:r,[t===1028?2965:34818]:n,[t===1028?2966:34819]:i}),viewport:(e,t,r,n,i)=>e({[2978]:[t,r,n,i]})},Ae=(e,t)=>e.isEnabled(t),$n={[3042]:Ae,[2884]:Ae,[2929]:Ae,[3024]:Ae,[32823]:Ae,[32926]:Ae,[32928]:Ae,[3089]:Ae,[2960]:Ae,[35977]:Ae},Xo=new Set([34016,36388,36387,35983,35368,34965,35739,35738,3074,34853,34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34866,34867,34868,35097,32873,35869,32874,34068]);function ye(e,t){let n=k.attach(e).gl;if(yu(t))return;let i={};for(let a in t){let s=Number(a),l=Ho[a];l&&(typeof l=="string"?i[l]=!0:l(n,t[a],s))}let o=n.state&&n.state.cache;if(o)for(let a in i){let s=Vo[a];s(n,t,o)}}function Lo(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Er,n=k.attach(e).gl;if(typeof t=="number"){let a=t,s=$n[a];return s?s(n,a):n.getParameter(a)}let i=Array.isArray(t)?t:Object.keys(t),o={};for(let a of i){let s=$n[a];o[a]=s?s(n,Number(a)):n.getParameter(Number(a))}return o}function yu(e){for(let t in e)return!1;return!0}function zo(e,t){if(e===t)return!0;let r=Array.isArray(e)||ArrayBuffer.isView(e),n=Array.isArray(t)||ArrayBuffer.isView(t);if(r&&n&&e.length===t.length){for(let i=0;i<e.length;++i)if(e[i]!==t[i])return!1;return!0}return!1}var Kn=class{constructor(t){let{copyState:r=!1,log:n=()=>{}}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.gl=void 0,this.program=null,this.stateStack=[],this.enable=!0,this.cache=void 0,this.log=void 0,this.gl=t,this.cache=r?Lo(t):Object.assign({},Er),this.log=n,this._updateCache=this._updateCache.bind(this),Object.seal(this)}push(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.stateStack.push({})}pop(){(0,qt.assert)(this.stateStack.length>0);let t=this.stateStack[this.stateStack.length-1];ye(this.gl,t),this.stateStack.pop()}_updateCache(t){let r=!1,n,i=this.stateStack.length>0?this.stateStack[this.stateStack.length-1]:null;for(let o in t){(0,qt.assert)(o!==void 0);let a=t[o],s=this.cache[o];zo(a,s)||(r=!0,n=s,i&&!(o in i)&&(i[o]=s),this.cache[o]=a)}return{valueChanged:r,oldValue:n}}};function $e(e){return e.state}function Yn(e,t){let{enable:r=!0,copyState:n}=t;if((0,qt.assert)(n!==void 0),!e.state){e.state=new Kn(e,{copyState:n}),xu(e);for(let o in kn){let a=kn[o];Eu(e,o,a)}jo(e,"getParameter"),jo(e,"isEnabled")}let i=$e(e);return i.enable=r,e}function Ie(e){let t=$e(e);t||(Yn(e,{copyState:!1}),t=$e(e)),t.push()}function Ee(e){let t=$e(e);(0,qt.assert)(t),t.pop()}function jo(e,t){let r=e[t].bind(e);e[t]=function(i){if(i===void 0||Xo.has(i))return r(i);let o=$e(e);return i in o.cache||(o.cache[i]=r(i)),o.enable?o.cache[i]:r(i)},Object.defineProperty(e[t],"name",{value:`${t}-from-cache`,configurable:!1})}function Eu(e,t,r){if(!e[t])return;let n=e[t].bind(e);e[t]=function(){let o=$e(e);for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];let{valueChanged:f,oldValue:u}=r(o._updateCache,...s);return f&&n(...s),u},Object.defineProperty(e[t],"name",{value:`${t}-to-cache`,configurable:!1})}function xu(e){let t=e.useProgram.bind(e);e.useProgram=function(n){let i=$e(e);i.program!==n&&(t(n),i.program=n)}}var Ou={webgl2:!0,webgl1:!0,powerPreference:"high-performance",onContextLost:()=>console.error("WebGL context lost"),onContextRestored:()=>console.info("WebGL context restored")};function ko(e,t){t={...Ou,...t};let r=null,n=o=>r=o.statusMessage||r;e.addEventListener("webglcontextcreationerror",n,!1);let i=null;if(t.type==="webgl2"&&(t={...t,webgl1:!1}),t.type==="webgl1"&&(t={...t,webgl2:!1}),!i&&t.webgl2&&(i=e.getContext("webgl2",t)),!i&&t.webgl1&&(i=e.getContext("webgl",t)),e.removeEventListener("webglcontextcreationerror",n,!1),!i)throw new Error(`Failed to create ${t.webgl2&&!t.webgl1?"WebGL2":"WebGL"} context: ${r||"Unknown error"}`);if(t.onContextLost){let{onContextLost:o}=t;e.addEventListener("webglcontextlost",a=>o(a),!1)}if(t.onContextRestored){let{onContextRestored:o}=t;e.addEventListener("webglcontextrestored",a=>o(a),!1)}return i}function $o(e){let t=e.getParameter(7936),r=e.getParameter(7937),n=e.getExtension("WEBGL_debug_renderer_info"),i=e.getParameter(n?n.UNMASKED_VENDOR_WEBGL:7936),o=e.getParameter(n?n.UNMASKED_RENDERER_WEBGL:7937),a=i||t,s=o||r,l=e.getParameter(7938),f=Ko(a,s),u=Cu(a,s),c=Pu(a,s),d="glsl",g=D(e)?300:100;return{type:D(e)?"webgl2":"webgl",gpu:f,gpuType:c,gpuBackend:u,vendor:a,renderer:s,version:l,shadingLanguage:d,shadingLanguageVersion:g}}function Ko(e,t){return/NVIDIA/i.exec(e)||/NVIDIA/i.exec(t)?"nvidia":/INTEL/i.exec(e)||/INTEL/i.exec(t)?"intel":/Apple/i.exec(e)||/Apple/i.exec(t)?"apple":/AMD/i.exec(e)||/AMD/i.exec(t)||/ATI/i.exec(e)||/ATI/i.exec(t)?"amd":/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t)?"software":"unknown"}function Cu(e,t){return/Metal/i.exec(e)||/Metal/i.exec(t)?"metal":/ANGLE/i.exec(e)||/ANGLE/i.exec(t)?"opengl":"unknown"}function Pu(e,t){if(/SwiftShader/i.exec(e)||/SwiftShader/i.exec(t))return"cpu";switch(Ko(e,t)){case"intel":return"integrated";case"software":return"cpu";case"unknown":return"unknown";default:return"discrete"}}function Yo(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=typeof window<"u"?window.navigator||{}:{},r=e.userAgent||t.userAgent||"",n=r.indexOf("MSIE ")!==-1,i=r.indexOf("Trident/")!==-1;return n||i}var Qn=P(I(),1);function xr(e){switch(e){case"uint8":return 5121;case"sint8":return 5120;case"unorm8":return 5121;case"snorm8":return 5120;case"uint16":return 5123;case"sint16":return 5122;case"unorm16":return 5123;case"snorm16":return 5122;case"uint32":return 5125;case"sint32":return 5124;case"float16":return 5131;case"float32":return 5126}throw new Error(String(e))}var q="texture-compression-bc",F="texture-compression-astc",Te="texture-compression-etc2",Nu="texture-compression-etc1-webgl",Or="texture-compression-pvrtc-webgl",Zn="texture-compression-atc-webgl",Qt="WEBGL_compressed_texture_s3tc",Jt="WEBGL_compressed_texture_s3tc_srgb",st="EXT_texture_compression_rgtc",Gt="EXT_texture_compression_bptc",Mu="WEBGL_compressed_texture_etc",Iu="WEBGL_compressed_texture_astc",Du="WEBGL_compressed_texture_etc1",Fu="WEBGL_compressed_texture_pvrtc",wu="WEBGL_compressed_texture_atc",Zo="EXT_sRGB",xe="EXT_texture_norm16",Bu="WEBGL_color_buffer_float",Uu="EXT_color_buffer_float",ue=(e,t)=>e.getExtension(t),Ke=(e,t)=>t.every(r=>e.getExtension(r)),qn={"texture-blend-float-webgl1":e=>D(e)?!0:ue(e,"EXT_float_blend"),"texture-formats-srgb-webgl1":e=>D(e)?!0:ue(e,Zo),"texture-formats-depth-webgl1":e=>D(e)?!0:ue(e,"WEBGL_depth_texture"),"texture-formats-float32-webgl1":e=>D(e)?!0:ue(e,"OES_texture_float"),"texture-formats-float16-webgl1":e=>D(e)?!0:ue(e,"OES_texture_half_float"),"texture-formats-norm16-webgl":e=>D(e)?ue(e,xe):!1,"texture-filter-linear-float32-webgl":e=>ue(e,"OES_texture_float_linear"),"texture-filter-linear-float16-webgl":e=>ue(e,"OES_texture_half_float_linear"),"texture-filter-anisotropic-webgl":e=>ue(e,"EXT_texture_filter_anisotropic"),"texture-renderable-float32-webgl":e=>ue(e,"EXT_color_buffer_float"),"texture-renderable-float16-webgl":e=>ue(e,"EXT_color_buffer_half_float"),"texture-compression-bc":e=>Ke(e,[Qt,Jt,st,Gt]),"texture-compression-bc5-webgl":e=>Ke(e,[st]),"texture-compression-etc2":e=>Ke(e,[Mu]),"texture-compression-astc":e=>Ke(e,[Iu]),"texture-compression-etc1-webgl":e=>Ke(e,[Du]),"texture-compression-pvrtc-webgl":e=>Ke(e,[Fu]),"texture-compression-atc-webgl":e=>Ke(e,[wu])};function Wu(e,t){var r;return((r=qn[t])===null||r===void 0?void 0:r.call(qn,e))||!1}function qo(e){return Object.keys(qn).filter(r=>Wu(e,r))}var er={"rgb8unorm-unsized":{gl:6407,gl1:6407,b:4,c:2,bpp:4,dataFormat:6407,types:[5121,33635]},"rgba8unorm-unsized":{gl:6408,gl1:6408,b:4,c:2,bpp:4,dataFormat:6408,types:[5121,32819,32820]},r8unorm:{gl:33321,b:1,c:1,renderbuffer:!0},r8snorm:{gl:36756,b:1,c:1},r8uint:{gl:33330,b:1,c:1,renderbuffer:!0},r8sint:{gl:33329,b:1,c:1,renderbuffer:!0},rg8unorm:{gl:33323,b:2,c:2,renderbuffer:!0},rg8snorm:{gl:36757,b:2,c:2},rg8uint:{gl:33336,b:2,c:2,renderbuffer:!0},rg8sint:{gl:33335,b:2,c:2,renderbuffer:!0},r16uint:{gl:33332,b:2,c:1,renderbuffer:!0},r16sint:{gl:33331,b:2,c:1,renderbuffer:!0},r16float:{gl:33325,b:2,c:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"r16unorm-webgl":{gl:33322,b:2,c:1,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:xe},"r16snorm-webgl":{gl:36760,b:2,c:1,f:"texture-formats-norm16-webgl",x:xe},"rgba4unorm-webgl":{gl:32854,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb565unorm-webgl":{gl:36194,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb5a1unorm-webgl":{gl:32855,b:2,c:4,wgpu:!1,renderbuffer:!0},"rgb8unorm-webgl":{gl:32849,b:3,c:3,wgpu:!1},"rgb8snorm-webgl":{gl:36758,b:3,c:3,wgpu:!1},rgba8unorm:{gl:32856,gl1:6408,b:4,c:2,bpp:4},"rgba8unorm-srgb":{gl:35907,gl1:35906,b:4,c:4,gl1ext:Zo,bpp:4},rgba8snorm:{gl:36759,b:4,c:4},rgba8uint:{gl:36220,b:4,c:4,bpp:4},rgba8sint:{gl:36238,b:4,c:4,bpp:4},bgra8unorm:{b:4,c:4},"bgra8unorm-srgb":{b:4,c:4},rg16uint:{gl:33338,b:4,c:1,bpp:4},rg16sint:{gl:33337,b:4,c:2,bpp:4},rg16float:{gl:33327,bpp:4,b:4,c:2,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl",renderbuffer:!0},"rg16unorm-webgl":{gl:33324,b:2,c:2,f:"texture-formats-norm16-webgl",x:xe},"rg16snorm-webgl":{gl:36761,b:2,c:2,f:"texture-formats-norm16-webgl",x:xe},r32uint:{gl:33334,b:4,c:1,bpp:4,renderbuffer:!0},r32sint:{gl:33333,b:4,c:1,bpp:4,renderbuffer:!0},r32float:{gl:33326,bpp:4,b:4,c:1,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl"},rgb9e5ufloat:{gl:35901,b:4,c:3,p:1,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},rg11b10ufloat:{gl:35898,b:4,c:3,p:1,render:"texture-renderable-float32-webgl",renderbuffer:!0},rgb10a2unorm:{gl:32857,b:4,c:4,p:1,renderbuffer:!0},"rgb10a2unorm-webgl":{b:4,c:4,gl:36975,p:1,wgpu:!1,bpp:4,renderbuffer:!0},"rgb16unorm-webgl":{gl:32852,b:2,c:3,f:"texture-formats-norm16-webgl",x:xe},"rgb16snorm-webgl":{gl:36762,b:2,c:3,f:"texture-formats-norm16-webgl",x:xe},rg32uint:{gl:33340,b:8,c:2,renderbuffer:!0},rg32sint:{gl:33339,b:8,c:2,renderbuffer:!0},rg32float:{gl:33328,b:8,c:2,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},rgba16uint:{gl:36214,b:8,c:4,renderbuffer:!0},rgba16sint:{gl:36232,b:8,c:4,renderbuffer:!0},rgba16float:{gl:34842,gl1:6408,b:8,c:4,render:"texture-renderable-float16-webgl",filter:"texture-filter-linear-float16-webgl"},"rgba16unorm-webgl":{gl:32859,b:2,c:4,f:"texture-formats-norm16-webgl",renderbuffer:!0,x:xe},"rgba16snorm-webgl":{gl:36763,b:2,c:4,f:"texture-formats-norm16-webgl",x:xe},"rgb32float-webgl":{gl:34837,gl1:6407,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",gl2ext:Uu,gl1ext:Bu,dataFormat:6407,types:[5126]},rgba32uint:{gl:36208,b:16,c:4,renderbuffer:!0},rgba32sint:{gl:36226,b:16,c:4,renderbuffer:!0},rgba32float:{gl:34836,b:16,c:4,render:"texture-renderable-float32-webgl",filter:"texture-filter-linear-float32-webgl",renderbuffer:!0},stencil8:{gl:36168,gl1:36168,b:1,c:1,attachment:36128,renderbuffer:!0},depth16unorm:{gl:33189,gl1:33189,b:2,c:1,attachment:36096,renderbuffer:!0},depth24plus:{gl:33190,b:3,c:1,attachment:36096},depth32float:{gl:36012,b:4,c:1,attachment:36096,renderbuffer:!0},"depth24plus-stencil8":{gl:34041,gl1:34041,b:4,c:2,p:1,attachment:33306,renderbuffer:!0,depthTexture:!0},"depth24unorm-stencil8":{gl:35056,b:4,c:2,p:1,attachment:33306,renderbuffer:!0},"depth32float-stencil8":{gl:36013,b:5,c:2,p:1,attachment:33306,renderbuffer:!0},"bc1-rgb-unorm-webgl":{gl:33776,x:Qt,f:q},"bc1-rgb-unorm-srgb-webgl":{gl:35916,x:Jt,f:q},"bc1-rgba-unorm":{gl:33777,x:Qt,f:q},"bc1-rgba-unorm-srgb":{gl:35916,x:Jt,f:q},"bc2-rgba-unorm":{gl:33778,x:Qt,f:q},"bc2-rgba-unorm-srgb":{gl:35918,x:Jt,f:q},"bc3-rgba-unorm":{gl:33779,x:Qt,f:q},"bc3-rgba-unorm-srgb":{gl:35919,x:Jt,f:q},"bc4-r-unorm":{gl:36283,x:st,f:q},"bc4-r-snorm":{gl:36284,x:st,f:q},"bc5-rg-unorm":{gl:36285,x:st,f:q},"bc5-rg-snorm":{gl:36286,x:st,f:q},"bc6h-rgb-ufloat":{gl:36495,x:Gt,f:q},"bc6h-rgb-float":{gl:36494,x:Gt,f:q},"bc7-rgba-unorm":{gl:36492,x:Gt,f:q},"bc7-rgba-unorm-srgb":{gl:36493,x:Gt,f:q},"etc2-rgb8unorm":{gl:37492,f:Te},"etc2-rgb8unorm-srgb":{gl:37494,f:Te},"etc2-rgb8a1unorm":{gl:37496,f:Te},"etc2-rgb8a1unorm-srgb":{gl:37497,f:Te},"etc2-rgba8unorm":{gl:37493,f:Te},"etc2-rgba8unorm-srgb":{gl:37495,f:Te},"eac-r11unorm":{gl:37488,f:Te},"eac-r11snorm":{gl:37489,f:Te},"eac-rg11unorm":{gl:37490,f:Te},"eac-rg11snorm":{gl:37491,f:Te},"astc-4x4-unorm":{gl:37808,f:F},"astc-4x4-unorm-srgb":{gl:37840,f:F},"astc-5x4-unorm":{gl:37809,f:F},"astc-5x4-unorm-srgb":{gl:37841,f:F},"astc-5x5-unorm":{gl:37810,f:F},"astc-5x5-unorm-srgb":{gl:37842,f:F},"astc-6x5-unorm":{gl:37811,f:F},"astc-6x5-unorm-srgb":{gl:37843,f:F},"astc-6x6-unorm":{gl:37812,f:F},"astc-6x6-unorm-srgb":{gl:37844,f:F},"astc-8x5-unorm":{gl:37813,f:F},"astc-8x5-unorm-srgb":{gl:37845,f:F},"astc-8x6-unorm":{gl:37814,f:F},"astc-8x6-unorm-srgb":{gl:37846,f:F},"astc-8x8-unorm":{gl:37815,f:F},"astc-8x8-unorm-srgb":{gl:37847,f:F},"astc-10x5-unorm":{gl:37819,f:F},"astc-10x5-unorm-srgb":{gl:37851,f:F},"astc-10x6-unorm":{gl:37817,f:F},"astc-10x6-unorm-srgb":{gl:37849,f:F},"astc-10x8-unorm":{gl:37818,f:F},"astc-10x8-unorm-srgb":{gl:37850,f:F},"astc-10x10-unorm":{gl:37819,f:F},"astc-10x10-unorm-srgb":{gl:37851,f:F},"astc-12x10-unorm":{gl:37820,f:F},"astc-12x10-unorm-srgb":{gl:37852,f:F},"astc-12x12-unorm":{gl:37821,f:F},"astc-12x12-unorm-srgb":{gl:37853,f:F},"pvrtc-rgb4unorm-webgl":{gl:35840,f:Or},"pvrtc-rgba4unorm-webgl":{gl:35842,f:Or},"pvrtc-rbg2unorm-webgl":{gl:35841,f:Or},"pvrtc-rgba2unorm-webgl":{gl:35843,f:Or},"etc1-rbg-unorm-webgl":{gl:36196,f:Nu},"atc-rgb-unorm-webgl":{gl:35986,f:Zn},"atc-rgba-unorm-webgl":{gl:35986,f:Zn},"atc-rgbai-unorm-webgl":{gl:34798,f:Zn}},Hu={[6403]:1,[36244]:1,[33319]:2,[33320]:2,[6407]:3,[36248]:3,[6408]:4,[36249]:4,[6402]:1,[34041]:1,[6406]:1,[6409]:1,[6410]:2},Vu={[5126]:4,[5125]:4,[5124]:4,[5123]:2,[5122]:2,[5131]:2,[5120]:1,[5121]:1};function tr(e,t){let r=rr(t),n=er[r];if(!n||(D(e)?n.gl===void 0:n.gl1===void 0))return!1;let i=n.x||D(e)&&n.gl2ext||n.gl1ext;return i?Boolean(e.getExtension(i)):!0}function Qo(e,t){var r;return tr(e,t)&&((r=er[t])===null||r===void 0?void 0:r.renderbuffer)}function rr(e){if(typeof e=="string")return e;let t=Object.entries(er).find(r=>{let[,n]=r;return n.gl===e||n.gl1===e});if(!t)throw new Error(`Unknown texture format ${e}`);return t[0]}function nr(e,t){let r=er[e],n=t?r?.gl:r?.gl1;if(n===void 0)throw new Error(`Unsupported texture format ${e}`);return n}function Jo(e,t){let r=rr(t);if(!tr(e,r))return!1;try{if((0,Qn.decodeTextureFormat)(r).signed)return!1}catch{return!1}return r.endsWith("32float")?Boolean(e.getExtension("OES_texture_float_linear")):r.endsWith("16float")?Boolean(e.getExtension("OES_texture_half_float_linear")):!0}function Go(e,t){let r=rr(t);return!(!tr(e,r)||typeof r=="number")}function lt(e,t){let r=rr(e),n=nr(r,t),i=(0,Qn.decodeTextureFormat)(r);return{format:n,dataFormat:Xu(i.format,i.integer,i.normalized,n),type:i.dataType?xr(i.dataType):5121,compressed:i.compressed}}function ea(e){let t=er[e];if(!(t!=null&&t.attachment))throw new Error(`${e} is not a depth stencil format`);return t.attachment}function ta(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6408,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:6408,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5121,i=null,o=null;try{i=e.createTexture(),e.bindTexture(3553,i);let a=0,s=1,l=1,f=0,u=new Uint8Array([0,0,255,255]);e.texImage2D(3553,a,t,s,l,f,r,n,u),o=e.createFramebuffer(),e.bindFramebuffer(36160,o),e.framebufferTexture2D(36160,36064,3553,i,0);let c=e.checkFramebufferStatus(36160)===36053;return e.bindTexture(3553,null),c}finally{e.deleteTexture(i),e.deleteFramebuffer(o)}}function ir(e,t){let r=rr(e),n=lt(r,t),i=Hu[n.dataFormat]||4,o=Vu[n.type]||1;return i*o}function Xu(e,t,r,n){if(n===6408||n===6407)return n;switch(e){case"r":return t&&!r?36244:6403;case"rg":return t&&!r?33320:33319;case"rgb":return t&&!r?36248:6407;case"rgba":return t&&!r?36249:6408;default:return 6408}}function ra(e){let t=Lu(e);for(let r of qo(e))t.add(r);return t}function Lu(e){e.getExtension("EXT_color_buffer_float"),e.getExtension("WEBGL_color_buffer_float"),e.getExtension("EXT_float_blend");let t=new Set;for(let r of Object.keys(na))zu(e,r)&&t.add(r);return t}function zu(e,t){let r=na[t];if(!r)return!1;let[n,i]=r||[],o=D(e)?i:n;if(typeof o=="boolean")return o;switch(t){case"texture-renderable-rgba32float-webgl":return D(e)?Boolean(e.getExtension(o)):ta(e);case"glsl-derivatives":return Gn(e,o);case"glsl-frag-data":return Gn(e,o,{behavior:"require"});case"glsl-frag-depth":return Gn(e,o);default:return Boolean(e.getExtension(o))}}var Jn={};function Gn(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!Yo(r))return!0;if(t in Jn)return Jn[t];let n=r.behavior||"enable",i=`#extension GL_${t} : ${n}
|
|
313
|
+
void main(void) {}`,o=e.createShader(35633);if(!o)throw new Error("shader");e.shaderSource(o,i),e.compileShader(o);let a=e.getShaderParameter(o,35713);return e.deleteShader(o),Jn[t]=a,a}var na={webgl:[!0,!0],webgl2:[!1,!0],"timer-query-webgl":["EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2"],"transform-feedback-webgl2":[!1,!0],"vertex-array-object-webgl1":["OES_vertex_array_object",!0],"instanced-rendering-webgl1":["ANGLE_instanced_arrays",!0],"multiple-render-targets-webgl1":["WEBGL_draw_buffers",!0],"index-uint32-webgl1":["OES_element_index_uint",!0],"blend-minmax-webgl1":["EXT_blend_minmax",!0],"texture-blend-float-webgl1":["EXT_float_blend","EXT_float_blend"],"texture-formats-srgb-webgl1":["EXT_sRGB",!0],"texture-formats-depth-webgl1":["WEBGL_depth_texture",!0],"texture-formats-float32-webgl1":["OES_texture_float",!0],"texture-formats-float16-webgl1":["OES_texture_half_float",!0],"texture-filter-linear-float32-webgl":["OES_texture_float_linear","OES_texture_float_linear"],"texture-filter-linear-float16-webgl":["OES_texture_half_float_linear","OES_texture_half_float_linear"],"texture-filter-anisotropic-webgl":["EXT_texture_filter_anisotropic","EXT_texture_filter_anisotropic"],"texture-renderable-rgba32float-webgl":["WEBGL_color_buffer_float","EXT_color_buffer_float"],"texture-renderable-float32-webgl":[!1,"EXT_color_buffer_float"],"texture-renderable-float16-webgl":["EXT_color_buffer_half_float","EXT_color_buffer_half_float"],"glsl-frag-data":["WEBGL_draw_buffers",!0],"glsl-frag-depth":["EXT_frag_depth",!0],"glsl-derivatives":["OES_standard_derivatives",!0],"glsl-texture-lod":["EXT_shader_texture_lod",!0]};function ia(e){let t=Ln(e);return{maxTextureDimension1D:0,maxTextureDimension2D:e.getParameter(3379),maxTextureDimension3D:t?t.getParameter(32883):0,maxTextureArrayLayers:t?t.getParameter(35071):0,maxBindGroups:1,maxDynamicUniformBuffersPerPipelineLayout:0,maxDynamicStorageBuffersPerPipelineLayout:0,maxSampledTexturesPerShaderStage:e.getParameter(35660),maxSamplersPerShaderStage:e.getParameter(35661),maxStorageBuffersPerShaderStage:0,maxStorageTexturesPerShaderStage:0,maxUniformBuffersPerShaderStage:t?t.getParameter(35375):0,maxUniformBufferBindingSize:t?t.getParameter(35376):0,maxStorageBufferBindingSize:0,minUniformBufferOffsetAlignment:t?t.getParameter(35380):0,minStorageBufferOffsetAlignment:0,maxVertexBuffers:0,maxVertexAttributes:e.getParameter(34921),maxVertexBufferArrayStride:2048,maxInterStageShaderComponents:t?t.getParameter(35659):0,maxComputeWorkgroupStorageSize:0,maxComputeInvocationsPerWorkgroup:0,maxComputeWorkgroupSizeX:0,maxComputeWorkgroupSizeY:0,maxComputeWorkgroupSizeZ:0,maxComputeWorkgroupsPerDimension:0}}function oa(e){let t=Ln(e);function r(i){return e.getParameter(i)}function n(i,o){return t?t.getParameter(i):o||0}return{[33902]:r(33902),[33901]:r(33901),[3379]:r(3379),[34076]:r(34076),[34930]:r(34930),[35661]:r(35661),[35660]:r(35660),[34024]:r(34024),[36348]:r(36348),[34921]:r(34921),[36347]:r(36347),[36349]:r(36349),[3386]:r(3386),[34047]:r(34047),[32883]:n(32883),[35071]:n(35071),[37447]:n(37447),[36063]:n(36063),[35379]:n(35379),[35374]:n(35374),[35377]:n(35377),[34852]:n(34852),[36203]:n(36203),[33001]:n(33001),[33e3]:n(33e3),[37157]:n(37157),[35373]:n(35373),[35657]:n(35657),[36183]:n(36183),[37137]:n(37137),[34045]:n(34045),[35978]:n(35978),[35979]:n(35979),[35968]:n(35968),[35376]:n(35376),[35375]:n(35375),[35659]:n(35659),[37154]:n(37154),[35371]:n(35371),[35658]:n(35658),[35076]:n(35076),[35077]:n(35077),[35380]:n(35380)}}var ha=P(I(),1);var wr=P(I(),1);var L=P(I(),1);function Q(e,t,r){let i=k.attach(e).gl;if(ju(t))return r(e);let{nocatch:o=!0}=t;Ie(i),ye(i,t);let a;if(o)a=r(i),Ee(i);else try{a=r(i)}finally{Ee(i)}return a}function ju(e){for(let t in e)return!1;return!0}var Nr=P(I(),1);function sa(e,t,r,n){if((0,Nr.isObjectEmpty)(t))return n(e);Ie(e.gl);try{return ku(e,t),ye(e,r),n(e)}finally{Ee(e.gl)}}function ku(e,t){let r=k.attach(e),{gl:n}=r;if(t.cullMode)switch(t.cullMode){case"none":n.disable(2884);break;case"front":n.enable(2884),n.cullFace(1028);break;case"back":n.enable(2884),n.cullFace(1029);break}if(t.frontFace&&n.frontFace(or("frontFace",t.frontFace,{ccw:2305,cw:2304})),t.depthBias!==void 0&&n.polygonOffset(t.depthBias,t.depthBiasSlopeScale||0),t.depthWriteEnabled!==void 0&&n.depthMask(Ku("depthWriteEnabled",t.depthWriteEnabled)),t.depthCompare&&(t.depthCompare!=="always"?n.enable(2929):n.disable(2929),n.depthFunc(Pr("depthCompare",t.depthCompare))),t.stencilWriteMask){let i=t.stencilWriteMask;n.stencilMaskSeparate(1028,i),n.stencilMaskSeparate(1029,i)}if(t.stencilReadMask&&Nr.log.warn("stencilReadMask not supported under WebGL"),t.stencilCompare){let i=t.stencilReadMask||4294967295,o=Pr("depthCompare",t.stencilCompare);t.stencilCompare!=="always"?n.enable(2960):n.disable(2960),n.stencilFuncSeparate(1028,o,0,i),n.stencilFuncSeparate(1029,o,0,i)}if(t.stencilPassOperation&&t.stencilFailOperation&&t.stencilDepthFailOperation){let i=ei("stencilPassOperation",t.stencilPassOperation),o=ei("stencilFailOperation",t.stencilFailOperation),a=ei("stencilDepthFailOperation",t.stencilDepthFailOperation);n.stencilOpSeparate(1028,o,a,i),n.stencilOpSeparate(1029,o,a,i)}if(t.blendColorOperation||t.blendAlphaOperation){n.enable(3042);let i=aa("blendColorOperation",t.blendColorOperation||"add"),o=aa("blendAlphaOperation",t.blendAlphaOperation||"add");n.blendEquationSeparate(i,o);let a=Cr("blendColorSrcFactor",t.blendColorSrcFactor||"one"),s=Cr("blendColorDstFactor",t.blendColorDstFactor||"zero"),l=Cr("blendAlphaSrcFactor",t.blendAlphaSrcFactor||"one"),f=Cr("blendAlphaDstFactor",t.blendAlphaDstFactor||"zero");n.blendFuncSeparate(a,s,l,f)}}function Pr(e,t){return or(e,t,{never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519})}function ei(e,t){return or(e,t,{keep:7680,zero:0,replace:7681,invert:5386,"increment-clamp":7682,"decrement-clamp":7683,"increment-wrap":34055,"decrement-wrap":34056})}function aa(e,t){return or(e,t,{add:32774,subtract:32778,"reverse-subtract":32779,min:32775,max:32776})}function Cr(e,t){return or(e,t,{one:1,zero:0,"src-color":768,"one-minus-src-color":769,"dst-color":774,"one-minus-dst-color":775,"src-alpha":770,"one-minus-src-alpha":771,"dst-alpha":772,"one-minus-dst-alpha":773})}function $u(e,t){return`Illegal parameter ${t} for ${e}`}function or(e,t,r){if(!(t in r))throw new Error($u(e,t));return r[t]}function Ku(e,t){return t}function Mr(e){let t={};return e.addressModeU&&(t[10242]=ti(e.addressModeU)),e.addressModeV&&(t[10243]=ti(e.addressModeV)),e.addressModeW&&(t[32882]=ti(e.addressModeW)),e.magFilter&&(t[10240]=fa(e.magFilter)),(e.minFilter||e.mipmapFilter)&&(t[10241]=Yu(e.minFilter||"linear",e.mipmapFilter)),e.lodMinClamp!==void 0&&(t[33082]=e.lodMinClamp),e.lodMaxClamp!==void 0&&(t[33083]=e.lodMaxClamp),e.type==="comparison-sampler"&&(t[34892]=34894),e.compare&&(t[34893]=Pr("compare",e.compare)),e.maxAnisotropy&&(t[34046]=e.maxAnisotropy),t}function la(e){let t={...e};return e[10241]!==9728&&(t[10241]=9729),t[10242]=33071,t[10243]=33071,t}function ti(e){switch(e){case"clamp-to-edge":return 33071;case"repeat":return 10497;case"mirror-repeat":return 33648}}function fa(e){switch(e){case"nearest":return 9728;case"linear":return 9729}}function Yu(e,t){if(!t)return fa(e);switch(e){case"nearest":return t==="nearest"?9984:9986;case"linear":return t==="nearest"?9985:9987}}var ce=P(I(),1),Zu=10,te=class extends ce.Buffer{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(t,r),this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.glTarget=void 0,this.glUsage=void 0,this.glIndexType=5123,this.byteLength=void 0,this.bytesUsed=void 0,this.debugData=null,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2;let n=typeof r=="object"?r.handle:void 0;this.handle=n||this.gl.createBuffer(),t.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glTarget=qu(this.props.usage),this.glUsage=Qu(this.props.usage),this.glIndexType=this.props.indexType==="uint32"?5125:5123,this.debugData=null,r.data?this._initWithData(r.data,r.byteOffset,r.byteLength):this._initWithByteLength(r.byteLength||0)}_initWithData(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.byteLength+r;(0,ce.assert)(ArrayBuffer.isView(t));let i=this._getWriteTarget();return this.gl.bindBuffer(i,this.handle),this.gl.bufferData(i,n,this.glUsage),this.gl.bufferSubData(i,r,t),this.gl.bindBuffer(i,null),this.debugData=t.slice(0,Zu),this.bytesUsed=n,this.byteLength=n,this.trackAllocatedMemory(n),this}_initWithByteLength(t){(0,ce.assert)(t>=0);let r=t;t===0&&(r=new Float32Array(0));let n=this._getWriteTarget();return this.gl.bindBuffer(n,this.handle),this.gl.bufferData(n,r,this.glUsage),this.gl.bindBuffer(n,null),this.debugData=null,this.bytesUsed=t,this.byteLength=t,this}destroy(){!this.destroyed&&this.handle&&(this.removeStats(),this.trackDeallocatedMemory(),this.gl.deleteBuffer(this.handle),this.destroyed=!0,this.handle=null)}write(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=0,i=void 0,o=this.device.isWebGL2?36663:this.glTarget;this.gl.bindBuffer(o,this.handle),n!==0||i!==void 0?(this.device.assertWebGL2(),this.gl2.bufferSubData(o,r,t,n,i)):this.gl.bufferSubData(o,r,t),this.gl.bindBuffer(o,null)}async readAsync(){var t;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0;this.device.assertWebGL2(),n=(t=n)!==null&&t!==void 0?t:this.byteLength;let i=new Uint8Array(n),o=0;return this.gl.bindBuffer(36662,this.handle),this.gl2.getBufferSubData(36662,r,i,o,n),this.gl.bindBuffer(36662,null),i}_invalidateDebugData(){this.debugData=null}_getWriteTarget(){return this.glTarget}_getReadTarget(){return this.glTarget}};function qu(e){return e&ce.Buffer.INDEX?34963:e&ce.Buffer.VERTEX?34962:e&ce.Buffer.UNIFORM?35345:34962}function Qu(e){return e&ce.Buffer.INDEX||e&ce.Buffer.VERTEX?35044:e&ce.Buffer.UNIFORM?35048:35044}var ua=P(I(),1);var Ye=class extends ua.Sampler{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.parameters=void 0,this.device=t,this.parameters=Mr(r),this.device.isWebGL2&&(this.handle=this.handle||this.device.gl2.createSampler(),this._setSamplerParameters(this.parameters))}destroy(){this.handle&&(this.device.gl2.deleteSampler(this.handle),this.handle=void 0)}toString(){return`Sampler(${this.id},${JSON.stringify(this.props)})`}_setSamplerParameters(t){for(let[r,n]of Object.entries(t)){let i=Number(r);switch(i){case 33082:case 33083:this.device.gl2.samplerParameterf(this.handle,i,n);break;default:this.device.gl2.samplerParameteri(this.handle,i,n);break}}}};var Ju={parameters:{},pixelStore:{},pixels:null,border:0,dataFormat:void 0,textureUnit:void 0,target:void 0},K=class extends L.Texture{constructor(t,r){var n;super(t,{...Ju,format:"rgba8unorm",...r}),this.MAX_ATTRIBUTES=void 0,this.device=void 0,this.gl=void 0,this.gl2=void 0,this.handle=void 0,this.sampler=void 0,this.glFormat=void 0,this.type=void 0,this.dataFormat=void 0,this.mipmaps=void 0,this.target=void 0,this.textureUnit=void 0,this.loaded=!1,this._video=void 0,this.device=t,this.gl=this.device.gl,this.gl2=this.device.gl2,this.handle=this.props.handle||this.gl.createTexture(),this.device.setSpectorMetadata(this.handle,{...this.props,data:typeof this.props.data}),this.glFormat=6408,this.target=Gu(this.props),this.loaded=!1,typeof((n=this.props)===null||n===void 0?void 0:n.data)=="string"&&Object.assign(this.props,{data:(0,L.loadImage)(this.props.data)}),this.initialize(this.props),Object.seal(this)}destroy(){this.handle&&(this.gl.deleteTexture(this.handle),this.removeStats(),this.trackDeallocatedMemory("Texture"),this.destroyed=!0)}toString(){return`Texture(${this.id},${this.width}x${this.height})`}initialize(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.props.dimension==="cube")return this.initializeCube(t);let r=t.data;if(r instanceof Promise)return r.then(_=>this.initialize(Object.assign({},t,{pixels:_,data:_}))),this;let n=typeof HTMLVideoElement<"u"&&r instanceof HTMLVideoElement;if(n&&r.readyState<HTMLVideoElement.HAVE_METADATA)return this._video=null,r.addEventListener("loadeddata",()=>this.initialize(t)),this;let{parameters:i={}}=t,{pixels:o=null,pixelStore:a={},textureUnit:s=void 0}=t;r||(r=o);let{width:l,height:f,dataFormat:u,type:c,compressed:d=!1,mipmaps:g=!0}=t,{depth:h=0}=t,A=nr(t.format,this.device.isWebGL2);return{width:l,height:f,compressed:d,dataFormat:u,type:c}=this._deduceParameters({format:t.format,type:c,dataFormat:u,compressed:d,data:r,width:l,height:f}),this.width=l,this.height=f,this.glFormat=A,this.type=c,this.dataFormat=u,this.textureUnit=s,Number.isFinite(this.textureUnit)&&(this.gl.activeTexture(33984+this.textureUnit),this.gl.bindTexture(this.target,this.handle)),g&&this.device.isWebGL1&&Ir(this.width,this.height)&&(L.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaps`)(),g=!1),this.mipmaps=g,this.setImageData({data:r,width:l,height:f,depth:h,format:A,type:c,dataFormat:u,parameters:a,compressed:d}),this.setSampler(t.sampler),this._setSamplerParameters(i),g&&this.generateMipmap(),n&&(this._video={video:r,parameters:i,lastTime:r.readyState>=HTMLVideoElement.HAVE_CURRENT_DATA?r.currentTime:-1}),this}initializeCube(t){let{mipmaps:r=!0,parameters:n={}}=t;return this.setCubeMapImageData(t).then(()=>{this.loaded=!0,r&&this.generateMipmap(t),this.setSampler(t.sampler),this._setSamplerParameters(n)}),this}setSampler(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r;t instanceof Ye?(this.sampler=t,r=t.props):(this.sampler=new Ye(this.device,t),r=t);let n=Mr(r);return this._setSamplerParameters(n),this}resize(t){let{height:r,width:n,mipmaps:i=!1}=t;return n!==this.width||r!==this.height?this.initialize({width:n,height:r,format:this.format,type:this.type,dataFormat:this.dataFormat,mipmaps:i}):this}update(){if(this._video){let{video:t,parameters:r,lastTime:n}=this._video;if(n===t.currentTime||t.readyState<HTMLVideoElement.HAVE_CURRENT_DATA)return;this.setSubImageData({data:t,parameters:r}),this.mipmaps&&this.generateMipmap(),this._video.lastTime=t.currentTime}}generateMipmap(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return this.device.isWebGL1&&Ir(this.width,this.height)?(L.log.warn(`texture: ${this} is Non-Power-Of-Two, disabling mipmaping`)(),this):(this.mipmaps=!0,this.gl.bindTexture(this.target,this.handle),Q(this.gl,t,()=>{this.gl.generateMipmap(this.target)}),this.gl.bindTexture(this.target,null),this)}setImageData(t){if(this.props.dimension==="3d"||this.props.dimension==="2d-array")return this.setImageData3D(t);this.trackDeallocatedMemory("Texture");let{target:r=this.target,pixels:n=null,level:i=0,glFormat:o=this.glFormat,offset:a=0,parameters:s={}}=t,{data:l=null,type:f=this.type,width:u=this.width,height:c=this.height,dataFormat:d=this.dataFormat,compressed:g=!1}=t;l||(l=n),{type:f,dataFormat:d,compressed:g,width:u,height:c}=this._deduceParameters({format:this.props.format,type:f,dataFormat:d,compressed:g,data:l,width:u,height:c});let{gl:h}=this;h.bindTexture(this.target,this.handle);let A=null;({data:l,dataType:A}=this._getDataType({data:l,compressed:g}));let _;if(Q(this.gl,s,()=>{switch(A){case"null":h.texImage2D(r,i,o,u,c,0,d,f,l);break;case"typed-array":h.texImage2D(r,i,o,u,c,0,d,f,l,a);break;case"buffer":_=this.device.assertWebGL2(),_.bindBuffer(35052,l.handle||l),_.texImage2D(r,i,o,u,c,0,d,f,a),_.bindBuffer(35052,null);break;case"browser-object":this.device.isWebGL2?h.texImage2D(r,i,o,u,c,0,d,f,l):h.texImage2D(r,i,o,d,f,l);break;case"compressed":for(let[v,T]of l.entries())h.compressedTexImage2D(r,v,T.format,T.width,T.height,0,T.data);break;default:(0,L.assert)(!1,"Unknown image data type")}}),l&&l.byteLength)this.trackAllocatedMemory(l.byteLength,"Texture");else{let v=ir(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*v,"Texture")}return this.loaded=!0,this}setSubImageData(t){let{target:r=this.target,pixels:n=null,data:i=null,x:o=0,y:a=0,width:s=this.width,height:l=this.height,level:f=0,glFormat:u=this.glFormat,type:c=this.type,dataFormat:d=this.dataFormat,compressed:g=!1,offset:h=0,parameters:A={}}=t;if({type:c,dataFormat:d,compressed:g,width:s,height:l}=this._deduceParameters({format:this.props.format,type:c,dataFormat:d,compressed:g,data:i,width:s,height:l}),(0,L.assert)(this.depth===1,"texSubImage not supported for 3D textures"),i||(i=n),i&&i.data){let _=i;i=_.data,s=_.shape[0],l=_.shape[1]}i instanceof te&&(i=i.handle),this.gl.bindTexture(this.target,this.handle),Q(this.gl,A,()=>{if(g)this.gl.compressedTexSubImage2D(r,f,o,a,s,l,u,i);else if(i===null)this.gl.texSubImage2D(r,f,o,a,s,l,d,c,null);else if(ArrayBuffer.isView(i))this.gl.texSubImage2D(r,f,o,a,s,l,d,c,i,h);else if(typeof WebGLBuffer<"u"&&i instanceof WebGLBuffer){let _=this.device.assertWebGL2();_.bindBuffer(35052,i),_.texSubImage2D(r,f,o,a,s,l,d,c,h),_.bindBuffer(35052,null)}else this.device.isWebGL2?this.device.assertWebGL2().texSubImage2D(r,f,o,a,s,l,d,c,i):this.gl.texSubImage2D(r,f,o,a,d,c,i)}),this.gl.bindTexture(this.target,null)}copyFramebuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return L.log.error("Texture.copyFramebuffer({...}) is no logner supported, use copyToTexture(source, target, opts})")(),null}getActiveUnit(){return this.gl.getParameter(34016)-33984}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,this.handle),t}unbind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.textureUnit,{gl:r}=this;return t!==void 0&&(this.textureUnit=t,r.activeTexture(33984+t)),r.bindTexture(this.target,null),t}_getDataType(t){let{data:r,compressed:n=!1}=t;return n?{data:r,dataType:"compressed"}:r===null?{data:r,dataType:"null"}:ArrayBuffer.isView(r)?{data:r,dataType:"typed-array"}:r instanceof te?{data:r.handle,dataType:"buffer"}:typeof WebGLBuffer<"u"&&r instanceof WebGLBuffer?{data:r,dataType:"buffer"}:{data:r,dataType:"browser-object"}}_deduceParameters(t){let{format:r,data:n}=t,{width:i,height:o,dataFormat:a,type:s,compressed:l}=t,f=lt(r,this.device.isWebGL2);return a=a||f.dataFormat,s=s||f.type,l=l||f.compressed,{width:i,height:o}=this._deduceImageSize(n,i,o),{dataFormat:a,type:s,compressed:l,width:i,height:o,format:r,data:n}}_deduceImageSize(t,r,n){let i;return typeof ImageData<"u"&&t instanceof ImageData?i={width:t.width,height:t.height}:typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement?i={width:t.naturalWidth,height:t.naturalHeight}:typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement?i={width:t.width,height:t.height}:typeof ImageBitmap<"u"&&t instanceof ImageBitmap?i={width:t.width,height:t.height}:typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?i={width:t.videoWidth,height:t.videoHeight}:t?i={width:r,height:n}:i={width:r>=0?r:1,height:n>=0?n:1},(0,L.assert)(i,"Could not deduced texture size"),(0,L.assert)(r===void 0||i.width===r,"Deduced texture width does not match supplied width"),(0,L.assert)(n===void 0||i.height===n,"Deduced texture height does not match supplied height"),i}async setCubeMapImageData(t){let{gl:r}=this,{width:n,height:i,pixels:o,data:a,format:s=6408,type:l=5121}=t,f=o||a,u=await Promise.all(K.FACES.map(c=>{let d=f[c];return Promise.all(Array.isArray(d)?d:[d])}));this.bind(),K.FACES.forEach((c,d)=>{u[d].length>1&&this.props.mipmaps!==!1&&L.log.warn(`${this.id} has mipmap and multiple LODs.`)(),u[d].forEach((g,h)=>{n&&i?r.texImage2D(c,h,s,n,i,0,s,l,g):r.texImage2D(c,h,s,s,l,g)})}),this.unbind()}setImageDataForFace(t){let{face:r,width:n,height:i,pixels:o,data:a,format:s=6408,type:l=5121}=t,{gl:f}=this,u=o||a;return this.bind(),u instanceof Promise?u.then(c=>this.setImageDataForFace(Object.assign({},t,{face:r,data:c,pixels:c}))):this.width||this.height?f.texImage2D(r,0,s,n,i,0,s,l,u):f.texImage2D(r,0,s,s,l,u),this}setImageData3D(t){let{level:r=0,dataFormat:n,format:i,type:o,width:a,height:s,depth:l=1,offset:f=0,data:u,parameters:c={}}=t;this.trackDeallocatedMemory("Texture"),this.gl.bindTexture(this.target,this.handle);let d=lt(i,this.device.isWebGL2);if(Q(this.gl,c,()=>{ArrayBuffer.isView(u)&&this.gl.texImage3D(this.target,r,d.format,a,s,l,0,d.dataFormat,d.type,u),u instanceof te&&(this.gl.bindBuffer(35052,u.handle),this.gl.texImage3D(this.target,r,n,a,s,l,0,i,o,f))}),u&&u.byteLength)this.trackAllocatedMemory(u.byteLength,"Texture");else{let g=ir(this.props.format,this.device.isWebGL2);this.trackAllocatedMemory(this.width*this.height*this.depth*g,"Texture")}return this.loaded=!0,this}_setSamplerParameters(t){if(this.device.isWebGL1&&Ir(this.width,this.height)&&(t=la(t)),!(0,L.isObjectEmpty)(t)){ec(t),this.gl.bindTexture(this.target,this.handle);for(let[r,n]of Object.entries(t)){let i=Number(r),o=n;switch(i){case 33082:case 33083:this.gl.texParameterf(this.target,i,o);break;default:this.gl.texParameteri(this.target,i,o);break}}this.gl.bindTexture(this.target,null)}}_getWebGL1NPOTParameterOverride(t,r){if(this.device.isWebGL1&&Ir(this.width,this.height))switch(t){case 10241:if(r!==9729&&r!==9728)return 9729;break;case 10242:case 10243:return 33071;default:break}return r}};K.FACES=[34069,34070,34071,34072,34073,34074];function Gu(e){switch(e.dimension){case"2d":return 3553;case"cube":return 34067;case"2d-array":return 35866;case"3d":return 32879;case"1d":case"cube-array":default:throw new Error(e.dimension)}}function Ir(e,t){return!e||!t?!1:!(0,L.isPowerOfTwo)(e)||!(0,L.isPowerOfTwo)(t)}function ec(e){L.log.log(1,"texture sampler parameters",e)()}var ga=P(I(),1);var Oe=P(I(),1);var ca=P(I(),1);function Dr(e,t){if(typeof t!="string")return t;let r=Number(t);if(!isNaN(r))return r;t=t.replace(/^.*\./,"");let n=e[t];return(0,ca.assert)(n!==void 0,`Accessing undefined constant GL.${t}`),n}var ft="Resource subclass must define virtual methods",Fr=class extends Oe.Resource{constructor(t,r,n){super(t,r,n),this.device=void 0,this.gl=void 0,this.gl2=void 0,this._handle=void 0,this._bound=!1,this.byteLength=0,this.device=k.attach(t);let i=this.device.gl;Po(i);let{id:o}=r||{};this.gl=i,this.gl2=i,this.id=o||(0,Oe.uid)(this.constructor.name),this._handle=r?.handle,this._handle===void 0&&(this._handle=this._createHandle()),this.byteLength=0}toString(){return`${this.constructor.name}(${this.id})`}get handle(){return this._handle}delete(){let{deleteChildren:t=!1}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=this._handle&&this._deleteHandle(this._handle);return this._handle&&this.removeStats(),this._handle=null,r&&t&&r.filter(Boolean).forEach(n=>n.destroy()),this}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this._bindHandle(t),this;let r;return this._bound?r=t():(this._bindHandle(this.handle),this._bound=!0,r=t(),this._bound=!1,this._bindHandle(null)),r}unbind(){this.bind(null)}getParameter(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};t=Dr(this.gl,t),(0,Oe.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=D(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension)))){let s=i.webgl1,l="webgl2"in i?i.webgl2:i.webgl1;return o?l:s}}return this._getParameter(t,r)}getParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{parameters:r,keys:n}=t,i=this.constructor.PARAMETERS||{},o=D(this.gl),a={},s=r||Object.keys(i);for(let l of s){let f=i[l];if(f&&(!("webgl2"in f)||o)&&(!("extension"in f)||this.gl.getExtension(f.extension))){let c=n?this.device.getGLKey(l):l;a[c]=this.getParameter(l,t),n&&f.type==="GLenum"&&(a[c]=this.device.getGLKey(a[c]))}}return a}setParameter(t,r){t=Dr(this.gl,t),(0,Oe.assert)(t);let i=(this.constructor.PARAMETERS||{})[t];if(i){let o=D(this.gl);if(!((!("webgl2"in i)||o)&&(!("extension"in i)||this.gl.getExtension(i.extension))))throw new Error("Parameter not available on this platform");i.type==="GLenum"&&(r=Dr(r))}return this._setParameter(t,r),this}setParameters(t){for(let r in t)this.setParameter(r,t[r]);return this}stubRemovedMethods(t,r,n){return(0,Oe.stubRemovedMethods)(this,t,r,n)}initialize(t){}_createHandle(){throw new Error(ft)}_deleteHandle(){throw new Error(ft)}_bindHandle(t){throw new Error(ft)}_getOptsFromHandle(){throw new Error(ft)}_getParameter(t,r){throw new Error(ft)}_setParameter(t,r){throw new Error(ft)}};var da;da=Symbol.toStringTag;var De=class extends Fr{get[da](){return"Renderbuffer"}get width(){return this.props.width}get height(){return this.props.height}get format(){return this.props.format}get samples(){return this.props.samples}get attachment(){}static isTextureFormatSupported(t,r){return Qo(t.gl,r)}constructor(t,r){if(typeof r.format=="number")throw new Error("Renderbuffer");super(t,r,De.defaultProps),this.glFormat=void 0,this.glFormat=nr(this.props.format,t.isWebGL2),this._initialize(this.props)}resize(t){(t.width!==this.width||t.height!==this.height)&&(Object.assign(this.props,{...t,format:this.format,samples:this.samples}),this._initialize(this.props))}_initialize(t){let{format:r,width:n,height:i,samples:o}=t;(0,ga.assert)(r,"Needs format"),this.trackDeallocatedMemory(),this.gl.bindRenderbuffer(36161,this.handle),o!==0&&this.device.isWebGL2?this.gl2.renderbufferStorageMultisample(36161,o,this.glFormat,n,i):this.gl.renderbufferStorage(36161,this.glFormat,n,i),this.gl.bindRenderbuffer(36161,null),this.trackAllocatedMemory(n*i*(o||1)*ir(this.glFormat,this.device.isWebGL2))}_createHandle(){return this.gl.createRenderbuffer()}_deleteHandle(){this.gl.deleteRenderbuffer(this.handle),this.trackDeallocatedMemory()}_bindHandle(t){this.gl.bindRenderbuffer(36161,t)}};De.defaultProps={id:void 0,handle:void 0,userData:void 0,format:void 0,width:1,height:1,samples:0};var ve=class extends wr.Framebuffer{get texture(){return this.colorAttachments[0]}constructor(t,r){super(t,r),this.device=void 0,this.gl=void 0,this.handle=void 0;let n=r.handle===null;if(this.device=t,this.gl=t.gl,this.handle=this.props.handle||n?this.props.handle:this.gl.createFramebuffer(),!n){t.setSpectorMetadata(this.handle,{id:this.props.id,props:this.props}),this.autoCreateAttachmentTextures(),this.gl.bindFramebuffer(36160,this.handle);for(let i=0;i<this.colorAttachments.length;++i){let o=this.colorAttachments[i],a=36064+i;o&&this._attachOne(a,o)}this.depthStencilAttachment&&this._attachOne(ea(this.depthStencilAttachment.format),this.depthStencilAttachment),this.gl.bindFramebuffer(36160,null)}r.check!==!1&&this._checkStatus()}destroy(){super.destroy(),!this.destroyed&&this.handle!==null&&this.gl.deleteFramebuffer(this.handle)}_checkStatus(){let{gl:t}=this,r=t.bindFramebuffer(36160,this.handle),n=t.checkFramebufferStatus(36160);if(t.bindFramebuffer(36160,r||null),n!==36053)throw new Error(`Framebuffer ${rc(n)}`)}createDepthStencilTexture(t){return new De(this.device,{id:`${this.id}-depth-stencil`,format:t,width:this.width,height:this.height})}resizeAttachments(t,r){if(this.handle===null)return this.width=this.gl.drawingBufferWidth,this.height=this.gl.drawingBufferHeight,this;t===void 0&&(t=this.gl.drawingBufferWidth),r===void 0&&(r=this.gl.drawingBufferHeight);for(let n of this.colorAttachments)n.resize({width:t,height:r});return this.depthStencilAttachment&&this.depthStencilAttachment.resize({width:t,height:r}),this}_attachOne(t,r){if(r instanceof De)return this._attachWEBGLRenderbuffer(t,r),r;if(Array.isArray(r)){let[n,i=0,o=0]=r;return this._attachTexture(t,n,i,o),n}else if(r instanceof K)return this._attachTexture(t,r,0,0),r;throw new Error("attach")}_attachWEBGLRenderbuffer(t,r){this.gl.framebufferRenderbuffer(36160,t,36161,r.handle)}_attachTexture(t,r,n,i){let{gl:o,gl2:a}=this.device;switch(o.bindTexture(r.target,r.handle),r.target){case 35866:case 32879:this.device.assertWebGL2(),a?.framebufferTextureLayer(36160,t,r.target,i,n);break;case 34067:let s=tc(n);o.framebufferTexture2D(36160,t,s,r.handle,i);break;case 3553:o.framebufferTexture2D(36160,t,3553,r.handle,i);break;default:(0,wr.assert)(!1,"Illegal texture type")}o.bindTexture(r.target,null)}};function tc(e){return e<34069?e+34069:e}function rc(e){switch(e){case 36053:return"success";case 36054:return"Mismatched attachments";case 36055:return"No attachments";case 36057:return"Height/width mismatch";case 36061:return"Unsupported or split attachments";case 36182:return"Samples mismatch";default:return`${e}`}}var Br=class extends ha.CanvasContext{constructor(t,r){super(r),this.device=void 0,this.presentationSize=void 0,this._framebuffer=null,this.device=t,this.presentationSize=[-1,-1],this._setAutoCreatedCanvasId(`${this.device.id}-canvas`),this.update()}getCurrentFramebuffer(){return this.update(),this._framebuffer=this._framebuffer||new ve(this.device,{handle:null}),this._framebuffer}update(){let t=this.getPixelSize();(t[0]!==this.presentationSize[0]||t[1]!==this.presentationSize[1])&&(this.presentationSize=t)}resize(t){if(this.canvas){let n=this.getDevicePixelRatio(t?.useDevicePixels);this.setDevicePixelRatio(n,t);return}let r=this.device.gl.getExtension("STACKGL_resize_drawingbuffer");r&&t&&"width"in t&&"height"in t&&r.resize(t.width,t.height)}commit(){}};var me=P(I(),1),nc={spector:me.log.get("spector")||me.log.get("inspect")},ic="https://spectorcdn.babylonjs.com/spector.bundle.js",oc=1,re=null,_a=!1;async function pa(e){if(!globalThis.SPECTOR)try{await(0,me.loadScript)(ic)}catch(t){me.log.warn(String(t))}}function Aa(e){var t,r;if(e={...nc,...e},!((t=e)!==null&&t!==void 0&&t.spector)||(!re&&globalThis.SPECTOR&&(me.log.probe(oc,"SPECTOR found and initialized")(),re=new globalThis.SPECTOR.Spector,globalThis.luma&&(globalThis.luma.spector=re)),!re))return null;if(!_a){var n,i;_a=!0,re.spyCanvases(),(n=re)===null||n===void 0||n.onCaptureStarted.add(s=>me.log.info("Spector capture started:",s)()),(i=re)===null||i===void 0||i.onCapture.add(s=>{var l,f,u;me.log.info("Spector capture complete:",s)(),(l=re)===null||l===void 0||l.getResultUI(),(f=re)===null||f===void 0||f.resultView.display(),(u=re)===null||u===void 0||u.resultView.addCapture(s)})}if((r=e)!==null&&r!==void 0&&r.canvas){var o,a;if(typeof e.spector=="string"&&e.spector!==e.canvas.id)return re;(o=re)===null||o===void 0||o.startCapture((a=e)===null||a===void 0?void 0:a.canvas,500),new Promise(s=>setTimeout(s,2e3)).then(s=>{var l;me.log.info("Spector capture stopped after 2 seconds")(),(l=re)===null||l===void 0||l.stopCapture()})}return re}var Fe=P(I(),1);var ac="https://unpkg.com/webgl-debug@2.0.1/index.js";function Ta(e){return e.luma=e.luma||{},e.luma}async function va(){fe()&&!globalThis.WebGLDebugUtils&&(globalThis.global=globalThis.global||globalThis,globalThis.global.module={},await(0,Fe.loadScript)(ac))}function ma(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return e?t.debug?lc(e,t):sc(e):null}function sc(e){let t=Ta(e);return t.realContext?t.realContext:e}function lc(e,t){if(!globalThis.WebGLDebugUtils)return Fe.log.warn("webgl-debug not loaded")(),e;let r=Ta(e);if(r.debugContext)return r.debugContext;globalThis.WebGLDebugUtils.init({...ze,...e});let n=globalThis.WebGLDebugUtils.makeDebugContext(e,fc.bind(null,t),uc.bind(null,t));for(let a in ze)!(a in n)&&typeof ze[a]=="number"&&(n[a]=ze[a]);class i{}Object.setPrototypeOf(n,Object.getPrototypeOf(e)),Object.setPrototypeOf(i,n);let o=Object.create(i);return r.realContext=e,r.debugContext=o,o.debug=!0,o}function ri(e,t){t=Array.from(t).map(n=>n===void 0?"undefined":n);let r=globalThis.WebGLDebugUtils.glFunctionArgsToString(e,t);return r=`${r.slice(0,100)}${r.length>100?"...":""}`,`gl.${e}(${r})`}function fc(e,t,r,n){n=Array.from(n).map(l=>l===void 0?"undefined":l);let i=globalThis.WebGLDebugUtils.glEnumToString(t),o=globalThis.WebGLDebugUtils.glFunctionArgsToString(r,n),a=e.webgl2?"gl2":"gl1",s=`${i} in ${a}.${r}(${o})`;Fe.log.error(s)();debugger;if(e.throwOnError)throw new Error(s)}function uc(e,t,r){let n="";if(Fe.log.level>=1&&(n=ri(t,r),Fe.log.log(1,n)()),e.break&&e.break.length>0&&(n=n||ri(t,r),e.break.every(o=>n.indexOf(o)!==-1)))debugger;for(let i of r)if(i===void 0){if(n=n||ri(t,r),e.throwOnError)throw new Error(`Undefined argument: ${n}`);Fe.log.error(`Undefined argument: ${n}`)();debugger}}var Ra=P(I(),1);function Sa(e){let t=e.split(/\r?\n/),r=[];for(let n of t){if(n.length<=1)continue;let i=n.split(":");if(i.length===2){let[c,d]=i;r.push({message:d.trim(),type:ba(c),lineNum:0,linePos:0});continue}let[o,a,s,...l]=i,f=parseInt(s,10);isNaN(f)&&(f=0);let u=parseInt(a,10);isNaN(u)&&(u=0),r.push({message:l.join(":").trim(),type:ba(o),lineNum:f,linePos:u})}return r}function ba(e){let t=["warning","error","info"],r=e.toLowerCase();return t.includes(r)?r:"info"}var Ur=class extends Ra.Shader{constructor(t,r){switch(super(t,r),this.device=void 0,this.handle=void 0,this.device=t,this.props.stage){case"vertex":this.handle=this.props.handle||this.device.gl.createShader(35633);break;case"fragment":this.handle=this.props.handle||this.device.gl.createShader(35632);break;default:throw new Error(this.props.stage)}this._compile(this.source)}destroy(){this.handle&&(this.removeStats(),this.device.gl.deleteShader(this.handle),this.destroyed=!0)}async getCompilationInfo(){return this.getCompilationInfoSync()}getCompilationInfoSync(){let t=this.device.gl.getShaderInfoLog(this.handle);return Sa(t)}_compile(t){t=(i=>i.startsWith("#version ")?i:`#version 100
|
|
314
|
+
${i}`)(t);let{gl:n}=this.device;if(n.shaderSource(this.handle,t),n.compileShader(this.handle),this.compilationStatus=n.getShaderParameter(this.handle,35713)?"success":"error",this.debugShader(),this.compilationStatus==="error")throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`)}};var ya=P(I(),1);var cc=256,dc=1024,gc=16384,ni=6144,Wr=class extends ya.RenderPass{constructor(t,r){super(t,r),this.device=void 0,this.glParameters=void 0,this.device=t,Ie(this.device.gl),this.setParameters(this.props.parameters),this.clear()}end(){Ee(this.device.gl),this.props.framebuffer&&ye(this.device,{framebuffer:null})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}setParameters(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r={};this.props.framebuffer&&(r.framebuffer=this.props.framebuffer),this.props.depthReadOnly&&(r.depthMask=!this.props.depthReadOnly),r.stencilMask=this.props.stencilReadOnly?0:1,r[35977]=this.props.discard,t.viewport&&(t.viewport.length>=6?(r.viewport=t.viewport.slice(0,4),r.depthRange=[t.viewport[4],t.viewport[5]]):r.viewport=t.viewport),r.scissorTest=Boolean(t.scissorRect),t.scissorRect&&(r.scissor=t.scissorRect),t.blendConstant&&(r.blendColor=t.blendConstant),t.stencilReference&&(console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL"),t[2967]=t.stencilReference),this.glParameters=r,ye(this.device,r)}clear(){let t={...this.glParameters},r=0;this.props.clearColor!==!1&&(r|=gc,t.clearColor=this.props.clearColor),this.props.clearDepth!==!1&&(r|=cc,t.clearDepth=this.props.clearDepth),this.props.clearStencil!==!1&&(r|=dc,t.clearStencil=this.props.clearStencil),r!==0&&Q(this.device,t,()=>{this.device.gl.clear(r)})}clearColorBuffer(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0,0,0,0];Q(this.device.gl2,{framebuffer:this.props.framebuffer},()=>{switch(r.constructor){case Int32Array:this.device.gl2.clearBufferiv(ni,t,r);break;case Uint32Array:this.device.gl2.clearBufferuiv(ni,t,r);break;case Float32Array:default:this.device.gl2.clearBufferfv(ni,t,r);break}})}};var J=P(I(),1),Da=P(I(),1);var Hr=P(I(),1);function ii(e,t){let{clamped:r=!0}=t||{};switch(e){case 5126:return Float32Array;case 5123:case 33635:case 32819:case 32820:return Uint16Array;case 5125:return Uint32Array;case 5121:return r?Uint8ClampedArray:Uint8Array;case 5120:return Int8Array;case 5122:return Int16Array;case 5124:return Int32Array;default:throw new Error("Failed to deduce typed array type from GL constant")}}var hc={offset:0,stride:0,type:5126,size:1,divisor:0,normalized:!1,integer:!1},_c={deprecatedProps:{instanced:"divisor",isInstanced:"divisor"}},we=class{static getBytesPerElement(t){return ii(t.type||5126).BYTES_PER_ELEMENT}static getBytesPerVertex(t){return(0,Hr.assert)(t.size),ii(t.type||5126).BYTES_PER_ELEMENT*t.size}static resolve(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return new we(hc,...r)}constructor(){this.offset=void 0,this.stride=void 0,this.type=void 0,this.size=void 0,this.divisor=void 0,this.normalized=void 0,this.integer=void 0,this.buffer=void 0,this.index=void 0;for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];r.forEach(i=>this._assign(i)),Object.freeze(this)}toString(){return JSON.stringify(this)}get BYTES_PER_ELEMENT(){return we.getBytesPerElement(this)}get BYTES_PER_VERTEX(){return we.getBytesPerVertex(this)}_assign(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t=(0,Hr.checkProps)("Accessor",t,_c),t.type!==void 0&&(this.type=t.type,(t.type===5124||t.type===5125)&&(this.integer=!0)),t.size!==void 0&&(this.size=t.size),t.offset!==void 0&&(this.offset=t.offset),t.stride!==void 0&&(this.stride=t.stride),t.normalize!==void 0&&(this.normalized=t.normalize),t.normalized!==void 0&&(this.normalized=t.normalized),t.integer!==void 0&&(this.integer=t.integer),t.divisor!==void 0&&(this.divisor=t.divisor),t.buffer!==void 0&&(this.buffer=t.buffer),t.index!==void 0&&(typeof t.index=="boolean"?this.index=t.index?1:0:this.index=t.index),t.instanced!==void 0&&(this.divisor=t.instanced?1:0),t.isInstanced!==void 0&&(this.divisor=t.isInstanced?1:0),this.offset===void 0&&delete this.offset,this.stride===void 0&&delete this.stride,this.type===void 0&&delete this.type,this.size===void 0&&delete this.size,this.divisor===void 0&&delete this.divisor,this.normalized===void 0&&delete this.normalized,this.integer===void 0&&delete this.integer,this.buffer===void 0&&delete this.buffer,this.index===void 0&&delete this.index,this}};function Ea(e){return pc.includes(e)}var pc=[35678,35680,35679,35682,36289,36292,36293,36298,36299,36300,36303,36306,36307,36308,36311],xa={[5126]:[5126,1,"float","f32","float32"],[35664]:[5126,2,"vec2","vec2<f32>","float32x2"],[35665]:[5126,3,"vec3","vec3<f32>","float32x3"],[35666]:[5126,4,"vec4","vec4<f32>","float32x4"],[5124]:[5124,1,"int","i32","sint32"],[35667]:[5124,2,"ivec2","vec2<i32>","sint32x2"],[35668]:[5124,3,"ivec3","vec3<i32>","sint32x3"],[35669]:[5124,4,"ivec4","vec4<i32>","sint32x4"],[5125]:[5125,1,"uint","u32","uint32"],[36294]:[5125,2,"uvec2","vec2<u32>","uint32x2"],[36295]:[5125,3,"uvec3","vec3<u32>","uint32x3"],[36296]:[5125,4,"uvec4","vec4<u32>","uint32x4"],[35670]:[5126,1,"bool","f32","float32"],[35671]:[5126,2,"bvec2","vec2<f32>","float32x2"],[35672]:[5126,3,"bvec3","vec3<f32>","float32x3"],[35673]:[5126,4,"bvec4","vec4<f32>","float32x4"],[35674]:[5126,8,"mat2","mat2x2<f32>"],[35685]:[5126,8,"mat2x3","mat2x3<f32>"],[35686]:[5126,8,"mat2x4","mat2x4<f32>"],[35687]:[5126,12,"mat3x2","mat3x2<f32>"],[35675]:[5126,12,"mat3","mat3x3<f32>"],[35688]:[5126,12,"mat3x4","mat3x4<f32>"],[35689]:[5126,16,"mat4x2","mat4x2<f32>"],[35690]:[5126,16,"mat4x3","mat4x3<f32>"],[35676]:[5126,16,"mat4","mat4x4<f32>"]};function oi(e){let t=xa[e];if(!t)throw new Error("uniform");let[r,n,,i]=t;return{format:i,components:n,glType:r}}function Oa(e){let t=xa[e];if(!t)throw new Error("attribute");let[,r,,n,i]=t;return{attributeType:n,vertexFormat:i,components:r}}function Ca(e,t){let r={attributes:[],bindings:[]};r.attributes=Ac(e,t);let n=mc(e,t);for(let s of n){let l=s.uniforms.map(f=>({name:f.name,format:f.format,byteOffset:f.byteOffset,byteStride:f.byteStride,arrayLength:f.arrayLength}));r.bindings.push({type:"uniform",name:s.name,location:s.location,visibility:(s.vertex?1:0)&(s.fragment?2:0),minBindingSize:s.byteLength,uniforms:l})}let i=vc(e,t),o=0;for(let s of i)if(Ea(s.type)){let{viewDimension:l,sampleType:f}=Sc(s.type);r.bindings.push({type:"texture",name:s.name,location:o,viewDimension:l,sampleType:f}),s.textureUnit=o,o+=1}i.length&&(r.uniforms=i);let a=Tc(e,t);return a!=null&&a.length&&(r.varyings=a),r}function Ac(e,t){let r=[],n=e.getProgramParameter(t,35721);for(let i=0;i<n;i++){let o=e.getActiveAttrib(t,i);if(!o)throw new Error("activeInfo");let{name:a,type:s}=o,l=e.getAttribLocation(t,a);if(l>=0){let{attributeType:f}=Oa(s),u=/instance/i.test(a)?"instance":"vertex";r.push({name:a,location:l,stepMode:u,type:f})}}return r.sort((i,o)=>i.location-o.location),r}function Tc(e,t){if(!D(e))return[];let r=e,n=[],i=e.getProgramParameter(t,35971);for(let o=0;o<i;o++){let a=r.getTransformFeedbackVarying(t,o);if(!a)throw new Error("activeInfo");let{name:s,type:l,size:f}=a,{glType:u,components:c}=oi(l),d=new we({type:u,size:f*c}),g={location:o,name:s,accessor:d};n.push(g)}return n.sort((o,a)=>o.location-a.location),n}function vc(e,t){let r=[],n=e.getProgramParameter(t,35718);for(let i=0;i<n;i++){let o=e.getActiveUniform(t,i);if(!o)throw new Error("activeInfo");let{name:a,size:s,type:l}=o,{name:f,isArray:u}=Rc(a),c=e.getUniformLocation(t,f),d={location:c,name:f,size:s,type:l,isArray:u};if(r.push(d),d.size>1)for(let g=0;g<d.size;g++){let h=`${f}[${g}]`;c=e.getUniformLocation(t,h);let A={...d,name:h,location:c};r.push(A)}}return r}function mc(e,t){if(!D(e))return[];let r=e,n=(a,s)=>r.getActiveUniformBlockParameter(t,a,s),i=[],o=r.getProgramParameter(t,35382);for(let a=0;a<o;a++){let s={name:r.getActiveUniformBlockName(t,a)||"",location:n(a,35391),byteLength:n(a,35392),vertex:n(a,35396),fragment:n(a,35398),uniformCount:n(a,35394),uniforms:[]},l=n(a,35395)||[],f=r.getActiveUniforms(t,l,35383),u=r.getActiveUniforms(t,l,35384),c=r.getActiveUniforms(t,l,35387),d=r.getActiveUniforms(t,l,35388);for(let g=0;g<s.uniformCount;++g){let h=r.getActiveUniform(t,l[g]);if(!h)throw new Error("activeInfo");s.uniforms.push({name:h.name,format:oi(f[g]).format,type:f[g],arrayLength:u[g],byteOffset:c[g],byteStride:d[g]})}i.push(s)}return i.sort((a,s)=>a.location-s.location),i}var bc={[35678]:["2d","float"],[35680]:["cube","float"],[35679]:["3d","float"],[35682]:["3d","depth"],[36289]:["2d-array","float"],[36292]:["2d-array","depth"],[36293]:["cube","float"],[36298]:["2d","sint"],[36299]:["3d","sint"],[36300]:["cube","sint"],[36303]:["2d-array","uint"],[36306]:["2d","uint"],[36307]:["3d","uint"],[36308]:["cube","uint"],[36311]:["2d-array","uint"]};function Sc(e){let t=bc[e];if(!t)throw new Error("sampler");let[r,n]=t;return{viewDimension:r,sampleType:n}}function Rc(e){if(e[e.length-1]!=="]")return{name:e,length:1,isArray:!1};let r=/([^[]*)(\[[0-9]+\])?/.exec(e);if(!r||r.length<2)throw new Error(`Failed to parse GLSL uniform name ${e}`);return{name:r[1],length:r[2]?1:0,isArray:Boolean(r[2])}}function Pa(e,t,r,n){let i=e,o=n;o===!0&&(o=1),o===!1&&(o=0);let a=typeof o=="number"?[o]:o;switch(r){case 35678:case 35680:case 35679:case 35682:case 36289:case 36292:case 36293:case 36298:case 36299:case 36300:case 36303:case 36306:case 36307:case 36308:case 36311:if(typeof n!="number")throw new Error("samplers must be set to integers");return e.uniform1i(t,n);case 5126:return e.uniform1fv(t,a);case 35664:return e.uniform2fv(t,a);case 35665:return e.uniform3fv(t,a);case 35666:return e.uniform4fv(t,a);case 5124:return e.uniform1iv(t,a);case 35667:return e.uniform2iv(t,a);case 35668:return e.uniform3iv(t,a);case 35669:return e.uniform4iv(t,a);case 35670:return e.uniform1iv(t,a);case 35671:return e.uniform2iv(t,a);case 35672:return e.uniform3iv(t,a);case 35673:return e.uniform4iv(t,a);case 5125:return i.uniform1uiv(t,a,1);case 36294:return i.uniform2uiv(t,a,2);case 36295:return i.uniform3uiv(t,a,3);case 36296:return i.uniform4uiv(t,a,4);case 35674:return e.uniformMatrix2fv(t,!1,a);case 35675:return e.uniformMatrix3fv(t,!1,a);case 35676:return e.uniformMatrix4fv(t,!1,a);case 35685:return i.uniformMatrix2x3fv(t,!1,a);case 35686:return i.uniformMatrix2x4fv(t,!1,a);case 35687:return i.uniformMatrix3x2fv(t,!1,a);case 35688:return i.uniformMatrix3x4fv(t,!1,a);case 35689:return i.uniformMatrix4x2fv(t,!1,a);case 35690:return i.uniformMatrix4x3fv(t,!1,a)}throw new Error("Illegal uniform")}function Na(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 3;case"line-loop-webgl":return 2;case"triangle-list":return 4;case"triangle-strip":return 5;case"triangle-fan-webgl":return 6;default:throw new Error(e)}}function Ma(e){switch(e){case"point-list":return 0;case"line-list":return 1;case"line-strip":return 1;case"line-loop-webgl":return 1;case"triangle-list":return 4;case"triangle-strip":return 4;case"triangle-fan-webgl":return 4;default:throw new Error(e)}}var Ia=4,Vr=class extends J.RenderPipeline{constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.vs=void 0,this.fs=void 0,this.introspectedLayout=void 0,this.uniforms={},this.bindings={},this.varyings=null,this._uniformCount=0,this._uniformSetters={},this.device=t,this.handle=this.props.handle||this.device.gl.createProgram(),this.device.setSpectorMetadata(this.handle,{id:this.props.id}),this.vs=(0,J.cast)(r.vs),this.fs=(0,J.cast)(r.fs);let{varyings:n,bufferMode:i=35981}=r;if(n&&n.length>0){var o;this.device.assertWebGL2(),this.varyings=n,(o=this.device.gl2)===null||o===void 0||o.transformFeedbackVaryings(this.handle,n,i)}this._compileAndLink(),this.introspectedLayout=Ca(this.device.gl,this.handle),this.shaderLayout=(0,Da.mergeShaderLayout)(this.introspectedLayout,r.shaderLayout)}destroy(){this.handle&&(this.device.gl.deleteProgram(this.handle),this.destroyed=!0)}setBindings(t){for(let[r,n]of Object.entries(t)){let i=this.shaderLayout.bindings.find(o=>o.name===r)||this.shaderLayout.bindings.find(o=>o.name===`${r}Uniforms`);if(!i){let o=this.shaderLayout.bindings.map(a=>`"${a.name}"`).join(", ");J.log.warn(`Unknown binding "${r}" in render pipeline "${this.id}", expected one of ${o}`)();continue}switch(n||J.log.warn(`Unsetting binding "${r}" in render pipeline "${this.id}"`)(),i.type){case"uniform":if(!(n instanceof te)&&!(n.buffer instanceof te))throw new Error("buffer value");break;case"texture":if(!(n instanceof K||n instanceof ve))throw new Error("texture value");break;case"sampler":J.log.warn(`Ignoring sampler ${r}`)();break;default:throw new Error(i.type)}this.bindings[r]=n}}setUniforms(t){let{bindings:r}=(0,J.splitUniformsAndBindings)(t);Object.keys(r).forEach(n=>{J.log.warn(`Unsupported value "${JSON.stringify(r[n])}" used in setUniforms() for key ${n}. Use setBindings() instead?`)()}),Object.assign(this.uniforms,t)}draw(t){var r;let{renderPass:n,vertexArray:i,vertexCount:o,instanceCount:a,firstVertex:s=0,transformFeedback:l}=t,f=Na(this.props.topology),u=Boolean(i.indexBuffer),c=(r=i.indexBuffer)===null||r===void 0?void 0:r.glIndexType,d=Number(a)>0;if(!this._areTexturesRenderable()||o===0)return!1;this.device.gl.useProgram(this.handle),i.bindBeforeRender(n),l&&l.begin(this.props.topology),this._applyBindings(),this._applyUniforms();let g=n;return sa(this.device,this.props.parameters,g.glParameters,()=>{if(u&&d){var h;(h=this.device.gl2)===null||h===void 0||h.drawElementsInstanced(f,o||0,c,s,a||0)}else if(u)this.device.gl.drawElements(f,o||0,c,s);else if(d){var A;(A=this.device.gl2)===null||A===void 0||A.drawArraysInstanced(f,s,o||0,a||0)}else this.device.gl.drawArrays(f,s,o||0);l&&l.end()}),i.unbindAfterRender(n),!0}_compileAndLink(){let{gl:t}=this.device;if(t.attachShader(this.handle,this.vs.handle),t.attachShader(this.handle,this.fs.handle),J.log.time(Ia,`linkProgram for ${this.id}`)(),t.linkProgram(this.handle),J.log.timeEnd(Ia,`linkProgram for ${this.id}`)(),!t.debug&&J.log.level,!t.getProgramParameter(this.handle,35714))throw new Error(`Error linking: ${t.getProgramInfoLog(this.handle)}`);if(t.validateProgram(this.handle),!t.getProgramParameter(this.handle,35715))throw new Error(`Error validating: ${t.getProgramInfoLog(this.handle)}`)}_areTexturesRenderable(){let t=!0;for(let[,r]of Object.entries(this.bindings))r instanceof K&&(r.update(),t=t&&r.loaded);return t}_applyBindings(){this.device.gl.useProgram(this.handle);let{gl2:t}=this.device;if(!t)throw new Error("bindings");let r=0,n=0;for(let i of this.shaderLayout.bindings){let o=this.bindings[i.name]||this.bindings[i.name.replace(/Uniforms$/,"")];if(!o)throw new Error(`No value for binding ${i.name} in ${this.id}`);switch(i.type){case"uniform":let{name:a}=i,s=t.getUniformBlockIndex(this.handle,a);if(s===4294967295)throw new Error(`Invalid uniform block name ${a}`);t.uniformBlockBinding(this.handle,n,s),o instanceof te?t.bindBufferBase(35345,n,o.handle):t.bindBufferRange(35345,n,o.buffer.handle,o.offset||0,o.size||o.buffer.byteLength-o.offset),n+=1;break;case"texture":if(!(o instanceof K||o instanceof ve))throw new Error("texture");let l;if(o instanceof K)l=o;else if(o instanceof ve&&o.colorAttachments[0]instanceof K)J.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")(),l=o.colorAttachments[0];else throw new Error("No texture");t.activeTexture(33984+r),t.bindTexture(l.target,l.handle),r+=1;break;case"sampler":break;case"storage":case"read-only-storage":throw new Error(`binding type '${i.type}' not supported in WebGL`)}}}_applyUniforms(){for(let r of this.shaderLayout.uniforms||[]){var t;let{name:n,location:i,type:o,textureUnit:a}=r,s=(t=this.uniforms[n])!==null&&t!==void 0?t:a;s!==void 0&&Pa(this.device.gl,i,o,s)}}};var wa=P(I(),1);var Lr=P(I(),1);var Xr=class extends Lr.CommandBuffer{constructor(t){super(t,{}),this.device=void 0,this.commands=[],this.device=t}submitCommands(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.commands;for(let r of t)switch(r.name){case"copy-buffer-to-buffer":yc(this.device,r.options);break;case"copy-buffer-to-texture":Ec(this.device,r.options);break;case"copy-texture-to-buffer":xc(this.device,r.options);break;case"copy-texture-to-texture":Oc(this.device,r.options);break}}};function yc(e,t){let r=t.source,n=t.destination,i=e.assertWebGL2();if(i){var o,a;i.bindBuffer(36662,r.handle),i.bindBuffer(36663,n.handle),i.copyBufferSubData(36662,36663,(o=t.sourceOffset)!==null&&o!==void 0?o:0,(a=t.destinationOffset)!==null&&a!==void 0?a:0,t.size),i.bindBuffer(36662,null),i.bindBuffer(36663,null)}else throw new Error("copyBufferToBuffer not implemented in WebGL1")}function Ec(e,t){throw new Error("Not implemented")}function xc(e,t){let{source:r,mipLevel:n=0,aspect:i="all",width:o=t.source.width,height:a=t.source.height,depthOrArrayLayers:s=0,origin:l=[0,0],destination:f,byteOffset:u=0,bytesPerRow:c,rowsPerImage:d}=t;if(i!=="all")throw new Error("not supported");if(n!==0||s!==0||c||d)throw new Error("not implemented");let g=e.assertWebGL2(),{framebuffer:h,destroyFramebuffer:A}=Fa(r);try{let _=f,v=o||h.width,T=a||h.height,m=lt(h.texture.format,!0),E=m.dataFormat,O=m.type;g.bindBuffer(35051,_.handle),g.bindFramebuffer(36160,h.handle),g.readPixels(l[0],l[1],v,T,E,O,u)}finally{g.bindBuffer(35051,null),g.bindFramebuffer(36160,null),A&&h.destroy()}}function Oc(e,t){let{source:r,origin:n=[0,0],destination:i}=t,{width:o=t.destination.width,height:a=t.destination.width}=t,s=0,l=6408,{framebuffer:f,destroyFramebuffer:u}=Fa(r),[c,d]=n,g=!1;e.gl.bindFramebuffer(36160,f.handle);let h=null,A;if(i instanceof K)h=i,o=Number.isFinite(o)?o:h.width,a=Number.isFinite(a)?a:h.height,h.bind(0),A=h.destination;else throw new Error("whoops");return g||e.gl.copyTexImage2D(A,s,l,c,d,o,a,0),h&&h.unbind(),u&&f.destroy(),h}function Fa(e){if(e instanceof Lr.Texture){let{width:t,height:r,id:n}=e;return{framebuffer:e.device.createFramebuffer({id:`framebuffer-for-${n}`,width:t,height:r,colorAttachments:[e]}),destroyFramebuffer:!0}}return{framebuffer:e,destroyFramebuffer:!1}}var zr=class extends wa.CommandEncoder{constructor(t,r){super(t,r),this.device=void 0,this.commandBuffer=void 0,this.device=t,this.commandBuffer=new Xr(t)}destroy(){}finish(){this.commandBuffer.submitCommands()}copyBufferToBuffer(t){this.commandBuffer.commands.push({name:"copy-buffer-to-buffer",options:t})}copyBufferToTexture(t){this.commandBuffer.commands.push({name:"copy-buffer-to-texture",options:t})}copyTextureToBuffer(t){this.commandBuffer.commands.push({name:"copy-texture-to-buffer",options:t})}copyTextureToTexture(t){this.commandBuffer.commands.push({name:"copy-texture-to-texture",options:t})}pushDebugGroup(t){}popDebugGroup(){}insertDebugMarker(t){}};var ct=P(I(),1);var Ba;Ba=Symbol.toStringTag;var ut=class extends ct.VertexArray{get[Ba](){return"VertexArray"}static isConstantAttributeZeroSupported(t){return t.info.type==="webgl2"||Rr()==="Chrome"}constructor(t,r){super(t,r),this.device=void 0,this.handle=void 0,this.buffer=null,this.bufferValue=null,this.init=!1,this.device=t,this.handle=this.device.gl2.createVertexArray()}destroy(){if(super.destroy(),this.buffer){var t;(t=this.buffer)===null||t===void 0||t.destroy()}this.handle&&(this.device.gl2.deleteVertexArray(this.handle),this.handle=void 0)}setIndexBuffer(t){let r=t;if(r&&r.glTarget!==34963)throw new Error("Use .setBuffer()");this.device.gl2.bindVertexArray(this.handle),this.device.gl2.bindBuffer(34963,r?r.handle:null),this.indexBuffer=r}setBuffer(t,r){let n=r;if(n.glTarget===34963)throw new Error("Use .setIndexBuffer()");let{size:i,type:o,stride:a,offset:s,normalized:l,integer:f,divisor:u}=this._getAccessor(t);this.device.gl2.bindVertexArray(this.handle),this.device.gl.bindBuffer(34962,n.handle),f?(this.device.assertWebGL2(),this.device.gl2.vertexAttribIPointer(t,i,o,a,s)):this.device.gl.vertexAttribPointer(t,i,o,l,a,s),this.device.gl.enableVertexAttribArray(t),this.device.gl2.vertexAttribDivisor(t,u||0),this.attributes[t]=n}setConstant(t,r){this._enable(t,!1),this.attributes[t]=r}bindBeforeRender(){if(this.device.gl2.bindVertexArray(this.handle),!this.init){let t=this.indexBuffer;this.device.gl2.bindBuffer(34963,t?.handle||null),this.init=!0}this._applyConstantAttributes()}unbindAfterRender(){this.device.gl2.bindVertexArray(null)}_applyConstantAttributes(){for(let t=0;t<this.maxVertexAttributes;++t){let r=this.attributes[t];ArrayBuffer.isView(r)&&this.device.setConstantAttribute(t,r)}}_getAccessor(t){let r=this.attributeInfos[t];if(!r)throw new Error(`Unknown attribute location ${t}`);let n=xr(r.bufferDataType);return{size:r.bufferComponents,type:n,stride:r.byteStride,offset:r.byteOffset,normalized:r.normalized,integer:r.integer,divisor:r.stepMode==="instance"?1:0}}_enable(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,i=ut.isConstantAttributeZeroSupported(this.device)||t!==0;(r||i)&&(t=Number(t),this.device.gl2.bindVertexArray(this.handle),r?this.device.gl.enableVertexAttribArray(t):this.device.gl.disableVertexAttribArray(t),this.device.gl2.bindVertexArray(null))}getConstantBuffer(t,r){let n=Cc(r),i=n.byteLength*t,o=n.length*t;if(this.buffer&&i!==this.buffer.byteLength)throw new Error(`Buffer size is immutable, byte length ${i} !== ${this.buffer.byteLength}.`);let a=!this.buffer;if(this.buffer=this.buffer||this.device.createBuffer({byteLength:i}),a=a||!Pc(n,this.bufferValue),a){let s=(0,ct.getScratchArray)(r.constructor,o);(0,ct.fillArray)({target:s,source:n,start:0,count:o}),this.buffer.write(s),this.bufferValue=r}return this.buffer}};function Cc(e){return Array.isArray(e)?new Float32Array(e):e}function Pc(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var kr=P(I(),1);var jr=class extends kr.TransformFeedback{constructor(t,r){super(t,r),this.device=void 0,this.gl2=void 0,this.handle=void 0,this.layout=void 0,this.buffers={},this.unusedBuffers={},this.bindOnUse=!0,this._bound=!1,t.assertWebGL2(),this.device=t,this.gl2=t.gl2,this.handle=this.props.handle||this.gl2.createTransformFeedback(),this.layout=this.props.layout,r.buffers&&this.setBuffers(r.buffers),Object.seal(this)}destroy(){this.gl2.deleteTransformFeedback(this.handle),super.destroy()}begin(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"point-list";this.gl2.bindTransformFeedback(36386,this.handle),this.bindOnUse&&this._bindBuffers(),this.gl2.beginTransformFeedback(Ma(t))}end(){this.gl2.endTransformFeedback(),this.bindOnUse||this._unbindBuffers(),this.gl2.bindTransformFeedback(36386,null)}setBuffers(t){this.buffers={},this.unusedBuffers={},this.bind(()=>{for(let r in t)this.setBuffer(r,t[r])})}setBuffer(t,r){let n=this._getVaryingIndex(t),{buffer:i,byteLength:o,byteOffset:a}=this._getBufferRange(r);if(n<0){this.unusedBuffers[t]=i,kr.log.warn(`${this.id} unusedBuffers varying buffer ${t}`)();return}this.buffers[n]={buffer:i,byteLength:o,byteOffset:a},this.bindOnUse||this._bindBuffer(n,i,a,o)}getBuffer(t){if(Ua(t))return this.buffers[t]||null;let r=this._getVaryingIndex(t);return r>=0?this.buffers[r]:null}bind(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.handle;if(typeof t!="function")return this.gl2.bindTransformFeedback(36386,t),this;let r;return this._bound?r=t():(this.gl2.bindTransformFeedback(36386,this.handle),this._bound=!0,r=t(),this._bound=!1,this.gl2.bindTransformFeedback(36386,null)),r}unbind(){this.bind(null)}_getBufferRange(t){if(t instanceof te)return{buffer:t,byteOffset:0,byteLength:t.byteLength};let{buffer:r,byteOffset:n=0,byteLength:i=t.buffer.byteLength}=t;return{buffer:r,byteOffset:n,byteLength:i}}_getVaryingIndex(t){if(Ua(t))return Number(t);for(let r of this.layout.varyings)if(t===r.name)return r.location;return-1}_bindBuffers(){for(let t in this.buffers){let{buffer:r,byteLength:n,byteOffset:i}=this._getBufferRange(this.buffers[t]);this._bindBuffer(Number(t),r,i,n)}}_unbindBuffers(){for(let t in this.buffers)this.gl2.bindBufferBase(35982,Number(t),null)}_bindBuffer(t,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0,o=r&&r.handle;!o||i===void 0?this.gl2.bindBufferBase(35982,t,o):this.gl2.bindBufferRange(35982,t,o,n,i)}};function Ua(e){return typeof e=="number"?Number.isInteger(e):/^\d+$/.test(e)}var ar=1,k=class extends H.Device{static isSupported(){return typeof WebGLRenderingContext<"u"||yo()}get features(){return this._features=this._features||ra(this.gl),this._features}get limits(){return this._limits=this._limits||ia(this.gl),this._limits}static attach(t){if(t instanceof k)return t;if(t?.device instanceof H.Device)return t.device;if(!Nc(t))throw new Error("Invalid WebGLRenderingContext");return new k({gl:t})}static async create(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};H.log.groupCollapsed(ar,"WebGLDevice created")(),typeof t.canvas=="string"&&await H.CanvasContext.pageLoaded,(H.log.get("debug")||t.debug)&&await va();let{spector:r}=t;if((H.log.get("spector")||r)&&await pa(),H.log.probe(ar+1,"DOM is loaded")(),t.gl&&t.gl.device)return k.attach(t.gl);let n=new k(t),i=`Created ${n.info.type}${n.debug?" debug":""} context: ${n.info.vendor}, ${n.info.renderer} for canvas: ${n.canvasContext.id}`;return H.log.probe(ar,i)(),H.log.table(ar,n.info)(),H.log.groupEnd(ar)(),n}constructor(t){var r;super({...t,id:t.id||(0,H.uid)("webgl-device")}),this.info=void 0,this.canvasContext=void 0,this.handle=void 0,this.lost=void 0,this._resolveContextLost=void 0,this._features=void 0,this._limits=void 0,this.renderPass=null,this.gl=void 0,this.gl2=null,this.debug=!1,this.isWebGL1=void 0,this.isWebGL2=void 0,this._canvasSizeInfo={clientWidth:0,clientHeight:0,devicePixelRatio:1},this._extensions={},this._polyfilled=!1,this.spector=void 0,this._webglLimits=void 0,this._constants=void 0;let n=(r=t.gl)===null||r===void 0?void 0:r.device;if(n)throw new Error(`WebGL context already attached to device ${n.id}`);this.canvasContext=new Br(this,t),this.lost=new Promise(l=>{this._resolveContextLost=l});let i=l=>{var f;return(f=this._resolveContextLost)===null||f===void 0?void 0:f.call(this,{reason:"destroyed",message:"Computer entered sleep mode, or too many apps or browser tabs are using the GPU."})},o=t.gl||null;if(o=o||(fe()?ko(this.canvasContext.canvas,{...t,onContextLost:i}):null),o=o||(fe()?null:Eo({...t,onContextLost:i})),!o)throw new Error("WebGL context creation failed");this.handle=o,this.gl=this.handle,this.gl2=this.gl,this.isWebGL2=Mc(this.gl),this.isWebGL1=!this.isWebGL2,this.info=$o(this.gl),this.gl.device=this,this.gl._version=this.isWebGL2?2:1,Bo(this.gl);let{enable:a=!0,copyState:s=!1}=t;if(Yn(this.gl,{enable:a,copyState:s,log:function(){for(var l=arguments.length,f=new Array(l),u=0;u<l;u++)f[u]=arguments[u];return H.log.log(1,...f)()}}),fe()&&t.debug&&(this.gl=ma(this.gl,{...t,webgl2:this.isWebGL2,throwOnError:!0}),this.gl2=this.gl,this.debug=!0,H.log.level=Math.max(H.log.level,1),H.log.warn("WebGL debug mode activated. Performance reduced.")()),fe()&&t.spector){let l=this.handle.canvas||t.canvas;this.spector=Aa({...this.props,canvas:l})}}destroy(){let t=this.gl.getExtension("STACKGL_destroy_context");t&&t.destroy()}get isLost(){return this.gl.isContextLost()}getSize(){return[this.gl.drawingBufferWidth,this.gl.drawingBufferHeight]}isTextureFormatSupported(t){return tr(this.gl,t)}isTextureFormatFilterable(t){return Jo(this.gl,t)}isTextureFormatRenderable(t){return Go(this.gl,t)}assertWebGL2(){if(!this.gl2)throw new Error("Requires WebGL2");return this.gl2}createCanvasContext(t){throw new Error("WebGL only supports a single canvas")}createBuffer(t){let r=this._getBufferProps(t);return new te(this,r)}_createTexture(t){return new K(this,t)}createExternalTexture(t){throw new Error("createExternalTexture() not implemented")}createSampler(t){return new Ye(this,t)}createShader(t){return new Ur(this,t)}createFramebuffer(t){return new ve(this,t)}createRenderPipeline(t){return new Vr(this,t)}createVertexArray(t){return new ut(this,t)}beginRenderPass(t){return new Wr(this,t)}createComputePipeline(t){throw new Error("ComputePipeline not supported in WebGL")}beginComputePass(t){throw new Error("ComputePass not supported in WebGL")}createTransformFeedback(t){return new jr(this,t)}getDefaultRenderPass(){return this.renderPass=this.renderPass||this.beginRenderPass({framebuffer:this.canvasContext.getCurrentFramebuffer()}),this.renderPass}createCommandEncoder(t){return new zr(this,t)}submit(){var t;(t=this.renderPass)===null||t===void 0||t.end(),this.renderPass=null}get webglLimits(){return this._webglLimits=this._webglLimits||oa(this.gl),this._webglLimits}loseDevice(){var t;let r=!1,n=this.gl.getExtension("WEBGL_lose_context");return n&&(r=!0,n.loseContext()),(t=this._resolveContextLost)===null||t===void 0||t.call(this,{reason:"destroyed",message:"Application triggered context loss"}),r}pushState(){Ie(this.gl)}popState(){Ee(this.gl)}setSpectorMetadata(t,r){t.__SPECTOR_Metadata=r}getGLKey(t,r){r=r||this.gl2||this.gl;let n=Number(t);for(let i in r)if(r[i]===n)return`GL.${i}`;return String(t)}setConstantAttribute(t,r){this._constants=this._constants||new Array(this.limits.maxVertexAttributes).fill(null);let n=this._constants[t];switch(n&&wc(n,r)&&H.log.info(1,`setConstantAttribute(${t}) could have been skipped, value unchanged`)(),this._constants[t]=r,r.constructor){case Float32Array:Ic(this,t,r);break;case Int32Array:Dc(this,t,r);break;case Uint32Array:Fc(this,t,r);break;default:(0,H.assert)(!1)}}};k.type="webgl";function Nc(e){return typeof WebGLRenderingContext<"u"&&e instanceof WebGLRenderingContext||typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&Number.isFinite(e._version))}function Mc(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:Boolean(e&&e._version===2)}function Ic(e,t,r){switch(r.length){case 1:e.gl.vertexAttrib1fv(t,r);break;case 2:e.gl.vertexAttrib2fv(t,r);break;case 3:e.gl.vertexAttrib3fv(t,r);break;case 4:e.gl.vertexAttrib4fv(t,r);break;default:(0,H.assert)(!1)}}function Dc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4iv(t,r)}function Fc(e,t,r){var n;e.assertWebGL2(),(n=e.gl2)===null||n===void 0||n.vertexAttribI4uiv(t,r)}function wc(e,t){if(!e||!t||e.length!==t.length||e.constructor!==t.constructor)return!1;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}var Wa=P(I(),1);var Bc=256,Uc=1024,Wc=16384;var Hc="clear: bad arguments";function $r(e,t){let r=k.attach(e),{framebuffer:n=null,color:i=null,depth:o=null,stencil:a=null}=t||{},s={};n&&(s.framebuffer=n);let l=0;i&&(l|=Wc,i!==!0&&(s.clearColor=i)),o&&(l|=Bc,o!==!0&&(s.clearDepth=o)),a&&(l|=Uc,o!==!0&&(s.clearStencil=o)),(0,Wa.assert)(l!==0,Hc),Q(r.gl,s,()=>{r.gl.clear(l)})}var sr=P(I(),1);var ai=P(I(),1);function Ha(e){switch(e){case 6406:case 33326:case 6403:return 1;case 33328:case 33319:return 2;case 6407:case 34837:return 3;case 6408:case 34836:return 4;default:return(0,ai.assert)(!1),0}}function Va(e){switch(e){case 5121:return 1;case 33635:case 32819:case 32820:return 2;case 5126:return 4;default:return(0,ai.assert)(!1),0}}function dt(e,t){let{sourceX:r=0,sourceY:n=0,sourceFormat:i=6408,targetByteOffset:o=0}=t||{},{target:a,sourceWidth:s,sourceHeight:l,sourceType:f}=t||{},{framebuffer:u,deleteFramebuffer:c}=Vc(e);(0,sr.assert)(u),s=s||u.width,l=l||u.height;let d=u;if(f=f||5121,!a){let h=Ha(i),A=Va(f),_=o+s*l*h*A;a=d.device.createBuffer({byteLength:_})}let g=e.device.createCommandEncoder();return g.copyTextureToBuffer({source:e,width:s,height:l,origin:[r,n],destination:a,byteOffset:o}),g.destroy(),c&&u.destroy(),a}function Vc(e){return e instanceof sr.Framebuffer?{framebuffer:e,deleteFramebuffer:!1}:{framebuffer:Xc(e),deleteFramebuffer:!0}}function Xc(e,t){let{device:r,width:n,height:i,id:o}=e;return r.createFramebuffer({...t,id:`framebuffer-for-${o}`,width:n,height:i,colorAttachments:[e]})}var Ue=P($());var w={SUM:1,MEAN:2,MIN:3,MAX:4};function Xa(e,t){return e+t}function Lc(e,t){return t>e?t:e}function zc(e,t){return t<e?t:e}function jc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Xa,0)/r.length:null}function kc(e,t){if(Number.isFinite(t))return e.length?e.length*t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Xa,0):null}function $c(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(Lc,-1/0):null}function Kc(e,t){if(Number.isFinite(t))return e.length?t:null;var r=e.map(t).filter(Number.isFinite);return r.length?r.reduce(zc,1/0):null}function gt(e,t,r){var n=w[e]||w.SUM;switch(t=Yc(t,r),n){case w.MIN:return function(i){return Kc(i,t)};case w.SUM:return function(i){return kc(i,t)};case w.MEAN:return function(i){return jc(i,t)};case w.MAX:return function(i){return $c(i,t)};default:return null}}function Yc(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Number.isFinite(e)?e:function(r){return t.index=r.index,e(r.source,t)}}function La(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function(r){return t.indices=r.map(function(n){return n.index}),e(r.map(function(n){return n.source}),t)}}var ht;function Kr(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var za={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},Be=3402823466e29,si=[32775,32774],li=[32776,32774],ja=[32776,32775],fi=(ht={},Kr(ht,w.SUM,32774),Kr(ht,w.MEAN,32774),Kr(ht,w.MIN,si),Kr(ht,w.MAX,li),ht);var ka={size:1,operation:w.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},$a=4;var Ka=`#version 300 es
|
|
315
|
+
#define SHADER_NAME gpu-aggregation-to-grid-vs
|
|
304
316
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
317
|
+
in vec3 positions;
|
|
318
|
+
in vec3 positions64Low;
|
|
319
|
+
in vec3 weights;
|
|
308
320
|
uniform vec2 cellSize;
|
|
309
321
|
uniform vec2 gridSize;
|
|
310
322
|
uniform bool projectPoints;
|
|
311
323
|
uniform vec2 translation;
|
|
312
324
|
uniform vec3 scaling;
|
|
313
325
|
|
|
314
|
-
|
|
326
|
+
out vec3 vWeights;
|
|
315
327
|
|
|
316
328
|
vec2 project_to_pixel(vec4 pos) {
|
|
317
329
|
vec4 result;
|
|
@@ -348,17 +360,20 @@ void main(void) {
|
|
|
348
360
|
gl_Position = vec4(pos, 0.0, 1.0);
|
|
349
361
|
gl_PointSize = 1.0;
|
|
350
362
|
}
|
|
351
|
-
`;var
|
|
363
|
+
`;var Ya=`#version 300 es
|
|
364
|
+
#define SHADER_NAME gpu-aggregation-to-grid-fs
|
|
352
365
|
|
|
353
366
|
precision highp float;
|
|
354
367
|
|
|
355
|
-
|
|
368
|
+
in vec3 vWeights;
|
|
369
|
+
|
|
370
|
+
out vec4 fragColor;
|
|
356
371
|
|
|
357
372
|
void main(void) {
|
|
358
|
-
|
|
359
|
-
DECKGL_FILTER_COLOR(
|
|
373
|
+
fragColor = vec4(vWeights, 1.0);
|
|
374
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
360
375
|
}
|
|
361
|
-
`;var
|
|
376
|
+
`;var Za=`#version 300 es
|
|
362
377
|
#define SHADER_NAME gpu-aggregation-all-vs-64
|
|
363
378
|
|
|
364
379
|
in vec2 position;
|
|
@@ -386,7 +401,7 @@ void main(void) {
|
|
|
386
401
|
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
387
402
|
gl_PointSize = 1.0;
|
|
388
403
|
}
|
|
389
|
-
`;var
|
|
404
|
+
`;var qa=`#version 300 es
|
|
390
405
|
#define SHADER_NAME gpu-aggregation-all-fs
|
|
391
406
|
|
|
392
407
|
precision highp float;
|
|
@@ -403,9 +418,10 @@ void main(void) {
|
|
|
403
418
|
fragColor.rgb = textureColor.rgb;
|
|
404
419
|
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
|
|
405
420
|
}
|
|
406
|
-
`;var
|
|
407
|
-
|
|
408
|
-
|
|
421
|
+
`;var Qa=`#version 300 es
|
|
422
|
+
#define SHADER_NAME gpu-aggregation-transform-mean-vs
|
|
423
|
+
in vec4 aggregationValues;
|
|
424
|
+
out vec4 meanValues;
|
|
409
425
|
|
|
410
426
|
void main()
|
|
411
427
|
{
|
|
@@ -414,14 +430,15 @@ void main()
|
|
|
414
430
|
meanValues.w = aggregationValues.w;
|
|
415
431
|
gl_PointSize = 1.0;
|
|
416
432
|
}
|
|
417
|
-
`;var
|
|
418
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,s=!1,u;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return a=f.done,f},e:function(f){s=!0,u=f},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(s)throw u}}}}function zc(e,t){if(e){if(typeof e=="string")return Ga(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ga(e,t)}}function Ga(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function za(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?za(Object(r),!0).forEach(function(n){_i(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):za(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Yc=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],ja={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},kc=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],Q=function(){e.getAggregationData=function(n){var o=n.aggregationData,a=n.maxData,s=n.minData,u=n.maxMinData,l=n.pixelIndex,f=l*La,c={};return o&&(c.cellCount=o[f+3],c.cellWeight=o[f]),u?(c.maxCellWieght=u[0],c.minCellWeight=u[3]):(a&&(c.maxCellWieght=a[0],c.totalCount=a[3]),s&&(c.minCellWeight=s[0],c.totalCount=s[3])),c},e.getCellData=function(n){for(var o=n.countsData,a=n.size,s=a===void 0?1:a,u=o.length/4,l=new Float32Array(u*s),f=new Uint32Array(u),c=0;c<u;c++){for(var _=0;_<s;_++)l[c*s+_]=o[c*4+_];f[c]=o[c*4+3]}return{cellCounts:f,cellWeights:l}},e.isSupported=function(n){return kc.every(function(o){return n.features.has(o)})};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};jc(this,e),this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=void 0,this.device=void 0,this._hasGPUSupport=void 0,this.gridAggregationModel=void 0,this.allAggregationModel=void 0,this.meanTransform=void 0,this.id=n.id||"gpu-grid-aggregator",this.device=r;var o=["blend-minmax-webgl1","texture-renderable-float32-webgl","texture-formats-float32-webgl1"];this._hasGPUSupport=this.device.info.type==="webgl2"&&o.every(function(a){return r.features.has(a)}),this._hasGPUSupport&&this._setupModels()}var t=e.prototype;return t.delete=function(){var n=this.gridAggregationModel,o=this.allAggregationModel,a=this.meanTransform,s=this.state,u=s.textures,l=s.framebuffers,f=s.maxMinFramebuffers,c=s.minFramebuffers,_=s.maxFramebuffers,E=s.meanTextures,d=s.resources;n?.destroy(),o?.destroy(),a?.destroy(),Zc([l,u,f,c,_,E,d])},t.run=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({results:{}});var o=this._normalizeAggregationParams(n);return this._hasGPUSupport||Le.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(o)},t.getData=function(n){var o={},a=this.state.results;a[n].aggregationData||(a[n].aggregationData=a[n].aggregationBuffer.getData()),o.aggregationData=a[n].aggregationData;for(var s in ja){var u=ja[s];(a[n][s]||a[n][u])&&(a[n][s]=a[n][s]||a[n][u].getData(),o[s]=a[n][s])}return o},t.updateShaders=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({shaderOptions:n,modelDirty:!0})},t._normalizeAggregationParams=function(n){var o=q(q({},Ba),n),a=o.weights;return a&&(o.weights=$c(a)),o},t.setState=function(n){Object.assign(this.state,n)},t._getAggregateData=function(n){var o={},a=this.state,s=a.textures,u=a.framebuffers,l=a.maxMinFramebuffers,f=a.minFramebuffers,c=a.maxFramebuffers,_=a.resources,E=n.weights;for(var d in E){o[d]={};var h=E[d],p=h.needMin,g=h.needMax,T=h.combineMaxMin;o[d].aggregationTexture=s[d],o[d].aggregationBuffer=ht(u[d],{target:E[d].aggregationBuffer,sourceType:5126}),p&&g&&T?(o[d].maxMinBuffer=ht(l[d],{target:E[d].maxMinBuffer,sourceType:5126}),o[d].maxMinTexture=_["".concat(d,"-maxMinTexture")]):(p&&(o[d].minBuffer=ht(f[d],{target:E[d].minBuffer,sourceType:5126}),o[d].minTexture=_["".concat(d,"-minTexture")]),g&&(o[d].maxBuffer=ht(c[d],{target:E[d].maxBuffer,sourceType:5126}),o[d].maxTexture=_["".concat(d,"-maxTexture")]))}return this._trackGPUResultBuffers(o,E),o},t._renderAggregateData=function(n){var o=n.cellSize,a=n.projectPoints,s=n.attributes,u=n.moduleSettings,l=n.numCol,f=n.numRow,c=n.weights,_=n.translation,E=n.scaling,d=this.state,h=d.maxMinFramebuffers,p=d.minFramebuffers,g=d.maxFramebuffers,T=[l,f],m={blend:!0,depthTest:!1,blendFunc:[1,1]},R={cellSize:o,gridSize:T,projectPoints:a,translation:_,scaling:E};for(var S in c){var y=c[S],I=y.needMin,P=y.needMax,M=I&&P&&c[S].combineMaxMin;this._renderToWeightsTexture({id:S,parameters:m,moduleSettings:u,uniforms:R,gridSize:T,attributes:s,weights:c}),M?this._renderToMaxMinTexture({id:S,parameters:q(q({},m),{},{blendEquation:Ua}),gridSize:T,minOrMaxFb:h[S],clearParams:{clearColor:[0,0,0,we]},combineMaxMin:M}):(I&&this._renderToMaxMinTexture({id:S,parameters:q(q({},m),{},{blendEquation:li}),gridSize:T,minOrMaxFb:p[S],clearParams:{clearColor:[we,we,we,0]},combineMaxMin:M}),P&&this._renderToMaxMinTexture({id:S,parameters:q(q({},m),{},{blendEquation:fi}),gridSize:T,minOrMaxFb:g[S],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:M}))}},t._renderToMaxMinTexture=function(n){var o=this,a=n.id,s=n.parameters,u=n.gridSize,l=n.minOrMaxFb,f=n.combineMaxMin,c=n.clearParams,_=c===void 0?{}:c,E=this.state.framebuffers,d=this.allAggregationModel;Y(this.device,q(q({},_),{},{framebuffer:l,viewport:[0,0,u[0],u[1]]}),function(){Gr(o.device,{color:!0}),d.setUniforms({gridSize:u,combineMaxMin:f}),d.setBindings({uSampler:E[a].texture}),d.draw()})},t._renderToWeightsTexture=function(n){var o=this,a=n.id,s=n.parameters,u=n.moduleSettings,l=n.uniforms,f=n.gridSize,c=n.weights,_=this.state,E=_.framebuffers,d=_.equations,h=_.weightAttributes,p=this.gridAggregationModel,g=c[a].operation,T=g===w.MIN?[we,we,we,0]:[0,0,0,0];if(Y(this.device,{framebuffer:E[a],viewport:[0,0,f[0],f[1]],clearColor:T},function(){Gr(o.device,{color:!0});var I={weights:h[a]};p.draw({parameters:q(q({},s),{},{blendEquation:d[a]}),moduleSettings:u,uniforms:l,attributes:I})}),g===w.MEAN){var m=this.state,R=m.meanTextures,S=m.textures,y={_sourceTextures:{aggregationValues:R[a]},_targetTexture:S[a],elementCount:S[a].width*S[a].height};this.meanTransform?this.meanTransform.update(y):this.meanTransform=Jc(this.device,y),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),E[a].attach(_i({},36064,S[a]))}},t._runAggregation=function(n){this._updateModels(n),this._setupFramebuffers(n),this._renderAggregateData(n);var o=this._getAggregateData(n);return this.setState({results:o}),o},t._setupFramebuffers=function(n){var o=this.state,a=o.textures,s=o.framebuffers,u=o.maxMinFramebuffers,l=o.minFramebuffers,f=o.maxFramebuffers,c=o.meanTextures,_=o.equations,E=n.weights,d=n.numCol,h=n.numRow,p={width:d,height:h};for(var g in E){var T=E[g],m=T.needMin,R=T.needMax,S=T.combineMaxMin,y=T.operation;a[g]=E[g].aggregationTexture||a[g]||Tt(this.device,{id:"".concat(g,"-texture"),width:d,height:h}),a[g].resize(p);var I=a[g];y===w.MEAN&&(c[g]=c[g]||Tt(this.device,{id:"".concat(g,"-mean-texture"),width:d,height:h}),c[g].resize(p),I=c[g]),s[g]?s[g].attach(_i({},36064,I)):s[g]=ur(this.device,{id:"".concat(g,"-fb"),width:d,height:h,texture:I}),s[g].resize(p),_[g]=ci[y]||ci[w.SUM],(m||R)&&(m&&R&&S?u[g]||(I=E[g].maxMinTexture||this._getMinMaxTexture("".concat(g,"-maxMinTexture")),u[g]=ur(this.device,{id:"".concat(g,"-maxMinFb"),texture:I})):(m&&(l[g]||(I=E[g].minTexture||this._getMinMaxTexture("".concat(g,"-minTexture")),l[g]=ur(this.device,{id:"".concat(g,"-minFb"),texture:I}))),R&&(f[g]||(I=E[g].maxTexture||this._getMinMaxTexture("".concat(g,"-maxTexture")),f[g]=ur(this.device,{id:"".concat(g,"-maxFb"),texture:I})))))}},t._getMinMaxTexture=function(n){var o=this.state.resources;return o[n]||(o[n]=Tt(this.device,{id:"resourceName"})),o[n]},t._setupModels=function(){var n,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=o.numCol,s=a===void 0?0:a,u=o.numRow,l=u===void 0?0:u,f=this.state.shaderOptions;if((n=this.gridAggregationModel)===null||n===void 0||n.destroy(),this.gridAggregationModel=qc(this.device,f),!this.allAggregationModel){var c=s*l;this.allAggregationModel=Qc(this.device,c)}},t._setupWeightAttributes=function(n){var o=this.state.weightAttributes,a=n.weights;for(var s in a)o[s]=n.attributes[s]},t._trackGPUResultBuffers=function(n,o){var a=this.state.resources;for(var s in n)if(n[s]){var u=Gc(Yc),l;try{for(u.s();!(l=u.n()).done;){var f=l.value;if(n[s][f]&&o[s][f]!==n[s][f]){var c="gpu-result-".concat(s,"-").concat(f);a[c]&&a[c].delete(),a[c]=n[s][f]}}}catch(_){u.e(_)}finally{u.f()}}},t._updateModels=function(n){var o=n.vertexCount,a=n.attributes,s=n.numCol,u=n.numRow,l=this.state.modelDirty;l&&(this._setupModels(n),this.setState({modelDirty:!1})),this._setupWeightAttributes(n),this.gridAggregationModel.setVertexCount(o),this.gridAggregationModel.setAttributes(a),this.allAggregationModel.setInstanceCount(s*u)},e}();function $c(e){var t={};for(var r in e)t[r]=q(q({},wa),e[r]);return t}function Zc(e){e=Array.isArray(e)?e:[e],e.forEach(function(t){for(var r in t)t[r].delete()})}function qc(e,t){var r=(0,Le._mergeShaders)({vs:Xa,fs:Wa,modules:[st,Le.project32]},t);return new J(e,q({id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,Le.getShaderAssembler)()},r))}function Qc(e,t){return new J(e,{id:"All-Aggregation-Model",vs:Ha,fs:Va,modules:[st],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function Jc(e,t){return new Me(e,q({vs:Ka,_targetTextureVarying:"meanValues"},t))}var mt=x(j());var le=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function Xe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array,n;if(Number.isFinite(e[0]))n=new r(e);else{n=new r(e.length*4);for(var o=0,a=0;a<e.length;a++){var s=e[a];n[o++]=s[0],n[o++]=s[1],n[o++]=s[2],n[o++]=Number.isFinite(s[3])?s[3]:255}}if(t)for(var u=0;u<n.length;u++)n[u]/=255;return n}var Ya=`#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
433
|
+
`;var Zc={minFilter:"nearest",magFilter:"nearest"};function _t(e,t){var r=t.width,n=r===void 0?1:r,i=t.height,o=i===void 0?1:i,a=t.data,s=a===void 0?null:a,l=t.unpackFlipY,f=l===void 0?!0:l,u=t.parameters,c=u===void 0?Zc:u,d=e.createTexture({data:s,format:"rgba32float",mipmaps:!1,sampler:c,width:n,height:o});return d}function lr(e,t){var r=t.id,n=t.width,i=n===void 0?1:n,o=t.height,a=o===void 0?1:o,s=t.texture,l=e.createFramebuffer({id:r,width:i,height:a,colorAttachments:[s]});return l}function qc(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Qc(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
434
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Qc(e,t){if(e){if(typeof e=="string")return Ja(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ja(e,t)}}function Ja(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ga(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ga(Object(r),!0).forEach(function(n){ui(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ga(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ui(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Gc=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],es={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},ed=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],ee=function(){e.getAggregationData=function(n){var i=n.aggregationData,o=n.maxData,a=n.minData,s=n.maxMinData,l=n.pixelIndex,f=l*$a,u={};return i&&(u.cellCount=i[f+3],u.cellWeight=i[f]),s?(u.maxCellWieght=s[0],u.minCellWeight=s[3]):(o&&(u.maxCellWieght=o[0],u.totalCount=o[3]),a&&(u.minCellWeight=a[0],u.totalCount=a[3])),u},e.getCellData=function(n){for(var i=n.countsData,o=n.size,a=o===void 0?1:o,s=i.length/4,l=new Float32Array(s*a),f=new Uint32Array(s),u=0;u<s;u++){for(var c=0;c<a;c++)l[u*a+c]=i[u*4+c];f[u]=i[u*4+3]}return{cellCounts:f,cellWeights:l}},e.isSupported=function(n){return ed.every(function(i){return n.features.has(i)})};function e(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Jc(this,e),this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=void 0,this.device=void 0,this._hasGPUSupport=void 0,this.gridAggregationModel=void 0,this.allAggregationModel=void 0,this.meanTransform=void 0,this.id=n.id||"gpu-grid-aggregator",this.device=r;var i=["blend-minmax-webgl1","texture-renderable-float32-webgl","texture-formats-float32-webgl1"];this._hasGPUSupport=this.device.info.type==="webgl2"&&i.every(function(o){return r.features.has(o)}),this._hasGPUSupport&&this._setupModels()}var t=e.prototype;return t.delete=function(){var n=this.gridAggregationModel,i=this.allAggregationModel,o=this.meanTransform,a=this.state,s=a.textures,l=a.framebuffers,f=a.maxMinFramebuffers,u=a.minFramebuffers,c=a.maxFramebuffers,d=a.meanTextures,g=a.resources;n?.destroy(),i?.destroy(),o?.destroy(),rd([l,s,f,u,c,d,g])},t.run=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({results:{}});var i=this._normalizeAggregationParams(n);return this._hasGPUSupport||Ue.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(i)},t.getData=function(n){var i={},o=this.state.results;o[n].aggregationData||(o[n].aggregationData=o[n].aggregationBuffer.getData()),i.aggregationData=o[n].aggregationData;for(var a in es){var s=es[a];(o[n][a]||o[n][s])&&(o[n][a]=o[n][a]||o[n][s].getData(),i[a]=o[n][a])}return i},t.updateShaders=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.setState({shaderOptions:n,modelDirty:!0})},t._normalizeAggregationParams=function(n){var i=G(G({},za),n),o=i.weights;return o&&(i.weights=td(o)),i},t.setState=function(n){Object.assign(this.state,n)},t._getAggregateData=function(n){var i={},o=this.state,a=o.textures,s=o.framebuffers,l=o.maxMinFramebuffers,f=o.minFramebuffers,u=o.maxFramebuffers,c=o.resources,d=n.weights;for(var g in d){i[g]={};var h=d[g],A=h.needMin,_=h.needMax,v=h.combineMaxMin;i[g].aggregationTexture=a[g],i[g].aggregationBuffer=dt(s[g],{target:d[g].aggregationBuffer,sourceType:5126}),A&&_&&v?(i[g].maxMinBuffer=dt(l[g],{target:d[g].maxMinBuffer,sourceType:5126}),i[g].maxMinTexture=c["".concat(g,"-maxMinTexture")]):(A&&(i[g].minBuffer=dt(f[g],{target:d[g].minBuffer,sourceType:5126}),i[g].minTexture=c["".concat(g,"-minTexture")]),_&&(i[g].maxBuffer=dt(u[g],{target:d[g].maxBuffer,sourceType:5126}),i[g].maxTexture=c["".concat(g,"-maxTexture")]))}return this._trackGPUResultBuffers(i,d),i},t._renderAggregateData=function(n){var i=n.cellSize,o=n.projectPoints,a=n.attributes,s=n.moduleSettings,l=n.numCol,f=n.numRow,u=n.weights,c=n.translation,d=n.scaling,g=this.state,h=g.maxMinFramebuffers,A=g.minFramebuffers,_=g.maxFramebuffers,v=[l,f],T={blend:!0,depthTest:!1,blendFunc:[1,1]},m={cellSize:i,gridSize:v,projectPoints:o,translation:c,scaling:d};for(var E in u){var O=u[E],C=O.needMin,N=O.needMax,M=C&&N&&u[E].combineMaxMin;this._renderToWeightsTexture({id:E,parameters:T,moduleSettings:s,uniforms:m,gridSize:v,attributes:a,weights:u}),M?this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:ja}),gridSize:v,minOrMaxFb:h[E],clearParams:{clearColor:[0,0,0,Be]},combineMaxMin:M}):(C&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:si}),gridSize:v,minOrMaxFb:A[E],clearParams:{clearColor:[Be,Be,Be,0]},combineMaxMin:M}),N&&this._renderToMaxMinTexture({id:E,parameters:G(G({},T),{},{blendEquation:li}),gridSize:v,minOrMaxFb:_[E],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:M}))}},t._renderToMaxMinTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.gridSize,l=n.minOrMaxFb,f=n.combineMaxMin,u=n.clearParams,c=u===void 0?{}:u,d=this.state.framebuffers,g=this.allAggregationModel;Q(this.device,G(G({},c),{},{framebuffer:l,viewport:[0,0,s[0],s[1]]}),function(){$r(i.device,{color:!0}),g.setUniforms({gridSize:s,combineMaxMin:f}),g.setBindings({uSampler:d[o].texture}),g.draw()})},t._renderToWeightsTexture=function(n){var i=this,o=n.id,a=n.parameters,s=n.moduleSettings,l=n.uniforms,f=n.gridSize,u=n.weights,c=this.state,d=c.framebuffers,g=c.equations,h=c.weightAttributes,A=this.gridAggregationModel,_=u[o].operation,v=_===w.MIN?[Be,Be,Be,0]:[0,0,0,0];if(Q(this.device,{framebuffer:d[o],viewport:[0,0,f[0],f[1]],clearColor:v},function(){$r(i.device,{color:!0});var C={weights:h[o]};A.draw({parameters:G(G({},a),{},{blendEquation:g[o]}),moduleSettings:s,uniforms:l,attributes:C})}),_===w.MEAN){var T=this.state,m=T.meanTextures,E=T.textures,O={_sourceTextures:{aggregationValues:m[o]},_targetTexture:E[o],elementCount:E[o].width*E[o].height};this.meanTransform?this.meanTransform.update(O):this.meanTransform=od(this.device,O),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),d[o].attach(ui({},36064,E[o]))}},t._runAggregation=function(n){this._updateModels(n),this._setupFramebuffers(n),this._renderAggregateData(n);var i=this._getAggregateData(n);return this.setState({results:i}),i},t._setupFramebuffers=function(n){var i=this.state,o=i.textures,a=i.framebuffers,s=i.maxMinFramebuffers,l=i.minFramebuffers,f=i.maxFramebuffers,u=i.meanTextures,c=i.equations,d=n.weights,g=n.numCol,h=n.numRow,A={width:g,height:h};for(var _ in d){var v=d[_],T=v.needMin,m=v.needMax,E=v.combineMaxMin,O=v.operation;o[_]=d[_].aggregationTexture||o[_]||_t(this.device,{id:"".concat(_,"-texture"),width:g,height:h}),o[_].resize(A);var C=o[_];O===w.MEAN&&(u[_]=u[_]||_t(this.device,{id:"".concat(_,"-mean-texture"),width:g,height:h}),u[_].resize(A),C=u[_]),a[_]?a[_].attach(ui({},36064,C)):a[_]=lr(this.device,{id:"".concat(_,"-fb"),width:g,height:h,texture:C}),a[_].resize(A),c[_]=fi[O]||fi[w.SUM],(T||m)&&(T&&m&&E?s[_]||(C=d[_].maxMinTexture||this._getMinMaxTexture("".concat(_,"-maxMinTexture")),s[_]=lr(this.device,{id:"".concat(_,"-maxMinFb"),texture:C})):(T&&(l[_]||(C=d[_].minTexture||this._getMinMaxTexture("".concat(_,"-minTexture")),l[_]=lr(this.device,{id:"".concat(_,"-minFb"),texture:C}))),m&&(f[_]||(C=d[_].maxTexture||this._getMinMaxTexture("".concat(_,"-maxTexture")),f[_]=lr(this.device,{id:"".concat(_,"-maxFb"),texture:C})))))}},t._getMinMaxTexture=function(n){var i=this.state.resources;return i[n]||(i[n]=_t(this.device,{id:"resourceName"})),i[n]},t._setupModels=function(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=i.numCol,a=o===void 0?0:o,s=i.numRow,l=s===void 0?0:s,f=this.state.shaderOptions;if((n=this.gridAggregationModel)===null||n===void 0||n.destroy(),this.gridAggregationModel=nd(this.device,f),!this.allAggregationModel){var u=a*l;this.allAggregationModel=id(this.device,u)}},t._setupWeightAttributes=function(n){var i=this.state.weightAttributes,o=n.weights;for(var a in o)i[a]=n.attributes[a]},t._trackGPUResultBuffers=function(n,i){var o=this.state.resources;for(var a in n)if(n[a]){var s=qc(Gc),l;try{for(s.s();!(l=s.n()).done;){var f=l.value;if(n[a][f]&&i[a][f]!==n[a][f]){var u="gpu-result-".concat(a,"-").concat(f);o[u]&&o[u].delete(),o[u]=n[a][f]}}}catch(c){s.e(c)}finally{s.f()}}},t._updateModels=function(n){var i=n.vertexCount,o=n.attributes,a=n.numCol,s=n.numRow,l=this.state.modelDirty;l&&(this._setupModels(n),this.setState({modelDirty:!1})),this._setupWeightAttributes(n),this.gridAggregationModel.setVertexCount(i),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(a*s)},e}();function td(e){var t={};for(var r in e)t[r]=G(G({},ka),e[r]);return t}function rd(e){e=Array.isArray(e)?e:[e],e.forEach(function(t){for(var r in t)t[r].delete()})}function nd(e,t){var r=(0,Ue._mergeShaders)({vs:Ka,fs:Ya,modules:[it,Ue.project32]},t);return new Y(e,G({id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,Ue.getShaderAssembler)()},r))}function id(e,t){return new Y(e,{id:"All-Aggregation-Model",vs:Za,fs:qa,modules:[it],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function od(e,t){return new Me(e,G({vs:Qa,_targetTextureVarying:"meanValues"},t))}var At=P($());var ae=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function We(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Float32Array,n;if(Number.isFinite(e[0]))n=new r(e);else{n=new r(e.length*4);for(var i=0,o=0;o<e.length;o++){var a=e[o];n[i++]=a[0],n[i++]=a[1],n[i++]=a[2],n[i++]=Number.isFinite(a[3])?a[3]:255}}if(t)for(var s=0;s<n.length;s++)n[s]/=255;return n}var ts=`#version 300 es
|
|
435
|
+
#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
419
436
|
#define RANGE_COUNT 6
|
|
420
437
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
438
|
+
in vec3 positions;
|
|
439
|
+
in vec3 instancePositions;
|
|
440
|
+
in vec4 instanceCounts;
|
|
441
|
+
in vec3 instancePickingColors;
|
|
425
442
|
|
|
426
443
|
uniform float opacity;
|
|
427
444
|
uniform vec3 cellScale;
|
|
@@ -432,8 +449,8 @@ uniform vec2 colorDomain;
|
|
|
432
449
|
uniform bool shouldUseMinMax;
|
|
433
450
|
uniform sampler2D maxTexture;
|
|
434
451
|
|
|
435
|
-
|
|
436
|
-
|
|
452
|
+
out vec4 vColor;
|
|
453
|
+
out float vSampleCount;
|
|
437
454
|
|
|
438
455
|
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
439
456
|
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
@@ -458,7 +475,7 @@ void main(void) {
|
|
|
458
475
|
vSampleCount = instanceCounts.a;
|
|
459
476
|
|
|
460
477
|
float weight = instanceCounts.r;
|
|
461
|
-
float maxWeight =
|
|
478
|
+
float maxWeight = texture(maxTexture, vec2(0.5)).r;
|
|
462
479
|
|
|
463
480
|
float step = weight / maxWeight;
|
|
464
481
|
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
|
|
@@ -475,31 +492,34 @@ void main(void) {
|
|
|
475
492
|
|
|
476
493
|
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
477
494
|
}
|
|
478
|
-
`;var
|
|
495
|
+
`;var rs=`#version 300 es
|
|
496
|
+
#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
479
497
|
|
|
480
498
|
precision highp float;
|
|
481
499
|
|
|
482
|
-
|
|
483
|
-
|
|
500
|
+
in vec4 vColor;
|
|
501
|
+
in float vSampleCount;
|
|
502
|
+
|
|
503
|
+
out vec4 fragColor;
|
|
484
504
|
|
|
485
505
|
void main(void) {
|
|
486
506
|
if (vSampleCount <= 0.0) {
|
|
487
507
|
discard;
|
|
488
508
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
DECKGL_FILTER_COLOR(
|
|
492
|
-
}
|
|
493
|
-
`;function
|
|
494
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
495
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
496
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
497
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
498
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
499
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
500
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,s=!1,u;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return a=f.done,f},e:function(f){s=!0,u=f},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(s)throw u}}}}function eE(e,t){if(e){if(typeof e=="string")return Ss(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ss(e,t)}}function Ss(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function tE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Nt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Nt=Reflect.get:Nt=function(o,a,s){var u=rE(o,a);if(u){var l=Object.getOwnPropertyDescriptor(u,a);return l.get?l.get.call(s):l.value}},Nt(e,t,r||e)}function rE(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=He(e),e!==null););return e}function nE(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pi(e,t)}function pi(e,t){return pi=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},pi(e,t)}function iE(e){var t=sE();return function(){var n=He(e),o;if(t){var a=He(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return oE(this,o)}}function oE(e,t){if(t&&(Jr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aE(e)}function aE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function sE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function He(e){return He=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},He(e)}var Qe=function(e){nE(r,e);var t=iE(r);function r(){var o;tE(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.initializeAggregationLayer=function(a){var s=a.dimensions;Nt(He(r.prototype),"initializeAggregationLayer",this).call(this,s),this.setState({layerData:{},gpuGridAggregator:new Q(this.context.device,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:bt})},n.updateState=function(a){Nt(He(r.prototype),"updateState",this).call(this,a),this.updateAggregationState(a);var s=this.state,u=s.aggregationDataDirty,l=s.aggregationWeightsDirty,f=s.gpuAggregation;if(!(this.getNumInstances()<=0)){var c=!1;(u||f&&l)&&(this._updateAggregation(a),c=!0),!f&&(u||l)&&(this._updateWeightBins(),this._uploadAggregationResults(),c=!0),this.setState({aggregationDirty:c})}},n.finalizeState=function(a){var s,u=this.state.weights.count;u&&u.aggregationBuffer&&u.aggregationBuffer.delete(),(s=this.state.gpuGridAggregator)===null||s===void 0||s.delete(),Nt(He(r.prototype),"finalizeState",this).call(this,a)},n.updateShaders=function(a){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(a)},n.updateAggregationState=function(a){Os.log.assert(!1)},n.allocateResources=function(a,s){if(this.state.numRow!==a||this.state.numCol!==s){var u=s*a*4*4,l=this.state.weights;for(var f in l){var c=l[f];c.aggregationBuffer&&c.aggregationBuffer.delete(),c.aggregationBuffer=this.context.device.createBuffer({byteLength:u,accessor:{size:4,type:5126,divisor:1}})}}},n.updateResults=function(a){var s=a.aggregationData,u=a.maxMinData,l=a.maxData,f=a.minData,c=this.state.weights.count;c&&(c.aggregationData=s,c.maxMinData=u,c.maxData=l,c.minData=f)},n._updateAggregation=function(a){var s=this.state,u=s.cpuGridAggregator,l=s.gpuGridAggregator,f=s.gridOffset,c=s.posOffset,_=s.translation,E=_===void 0?[0,0]:_,d=s.scaling,h=d===void 0?[0,0,0]:d,p=s.boundingBox,g=s.projectPoints,T=s.gpuAggregation,m=s.numCol,R=s.numRow,S=a.props,y=this.context.viewport,I=this.getAttributes(),P=this.getNumInstances();if(T){var B=this.state.weights;l.run({weights:B,cellSize:[f.xOffset,f.yOffset],numCol:m,numRow:R,translation:E,scaling:h,vertexCount:P,projectPoints:g,attributes:I,moduleSettings:this.getModuleSettings()})}else{var M=u(S,{gridOffset:f,projectPoints:g,attributes:I,viewport:y,posOffset:c,boundingBox:p});this.setState({layerData:M})}},n._updateWeightBins=function(){var a=this.state.getValue,s=new vt(this.state.layerData.data||[],{getValue:a});this.setState({sortedBins:s})},n._uploadAggregationResults=function(){var a=this.state,s=a.numCol,u=a.numRow,l=this.state.layerData.data,f=this.state.sortedBins,c=f.aggregatedBins,_=f.minValue,E=f.maxValue,d=f.totalCount,h=4,p=s*u*h,g=new Float32Array(p).fill(0),T=J_(c),m;try{for(T.s();!(m=T.n()).done;){var R=m.value,S=l[R.i],y=S.lonIdx,I=S.latIdx,P=R.value,M=R.counts,B=(y+I*s)*h;g[B]=P,g[B+h-1]=M}}catch(re){T.e(re)}finally{T.f()}var z=new Float32Array([E,0,0,_]),W=new Float32Array([E,0,0,d]),L=new Float32Array([_,0,0,d]);this.updateResults({aggregationData:g,maxMinData:z,maxData:W,minData:L})},r}(ge);Qe.layerName="GridAggregationLayer";function en(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?en=function(r){return typeof r}:en=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},en(e)}function uE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ct(e,t,r){return typeof Reflect<"u"&&Reflect.get?Ct=Reflect.get:Ct=function(o,a,s){var u=lE(o,a);if(u){var l=Object.getOwnPropertyDescriptor(u,a);return l.get?l.get.call(s):l.value}},Ct(e,t,r||e)}function lE(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ve(e),e!==null););return e}function fE(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ti(e,t)}function Ti(e,t){return Ti=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},Ti(e,t)}function cE(e){var t=dE();return function(){var n=Ve(e),o;if(t){var a=Ve(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return _E(this,o)}}function _E(e,t){if(t&&(en(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return EE(e)}function EE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function dE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ve(e){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ve(e)}function vs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Ri(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vs(Object(r),!0).forEach(function(n){mi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function mi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var gE=Ri(Ri({},St.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"}),bs="positions",hE={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},tn=function(e){fE(r,e);var t=cE(r);function r(){var o;uE(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.initializeState=function(){var a;if(!St.isSupported(this.context.device)){this.setState({supported:!1}),Si.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}Ct(Ve(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:hE,getCellSize:function(f){return f.cellSizePixels}});var s={count:{size:1,operation:w.SUM,needMax:!0,maxTexture:Tt(this.context.device,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:s,subLayerData:{attributes:{}},maxTexture:s.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var u=this.getAttributeManager();u.add((a={},mi(a,bs,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),mi(a,"count",{size:3,accessor:"getWeight"}),a))},n.shouldUpdateState=function(a){var s=a.changeFlags;return this.state.supported&&s.somethingChanged},n.updateState=function(a){Ct(Ve(r.prototype),"updateState",this).call(this,a)},n.renderLayers=function(){if(!this.state.supported)return[];var a=this.state,s=a.maxTexture,u=a.numRow,l=a.numCol,f=a.weights,c=this.props.updateTriggers,_=f.count.aggregationBuffer,E=this.getSubLayerClass("cells",St);return new E(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:c}),{data:{attributes:{instanceCounts:_}},maxTexture:s,numInstances:u*l})},n.finalizeState=function(a){Ct(Ve(r.prototype),"finalizeState",this).call(this,a);var s=this.state,u=s.aggregationBuffer,l=s.maxBuffer,f=s.maxTexture;u?.delete(),l?.delete(),f?.delete()},n.getPickingInfo=function(a){var s=a.info,u=s.index;if(u>=0){var l=this.state,f=l.gpuGridAggregator,c=l.gpuAggregation,_=l.weights,E=c?f.getData("count"):_.count;s.object=Q.getAggregationData(Ri({pixelIndex:u},E))}return s},n.updateResults=function(a){var s=a.aggregationData,u=a.maxData,l=this.state.weights.count;l.aggregationData=s,l.aggregationBuffer.setData({data:s}),l.maxData=u,l.maxTexture.setImageData({data:u})},n.updateAggregationState=function(a){var s=a.props.cellSizePixels,u=a.oldProps.cellSizePixels!==s,l=a.changeFlags.viewportChanged,f=a.props.gpuAggregation;this.state.gpuAggregation!==a.props.gpuAggregation&&f&&!Q.isSupported(this.context.device)&&(Si.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),f=!1);var c=f!==this.state.gpuAggregation;this.setState({gpuAggregation:f});var _=this.isAttributeChanged(bs),E=this.state.dimensions,d=E.data,h=E.weights,p=_||c||l||this.isAggregationDirty(a,{compareAll:f,dimension:d}),g=this.isAggregationDirty(a,{dimension:h});this.setState({aggregationDataDirty:p,aggregationWeightsDirty:g});var T=this.context.viewport;if(l||u){var m=T.width,R=T.height,S=Math.ceil(m/s),y=Math.ceil(R/s);this.allocateResources(y,S),this.setState({scaling:[m/2,-R/2,1],gridOffset:{xOffset:s,yOffset:s},width:m,height:R,numCol:S,numRow:y})}g&&this._updateAccessors(a),(p||g)&&this._resetResults()},n._updateAccessors=function(a){var s=a.props,u=s.getWeight,l=s.aggregation,f=s.data,c=this.state.weights.count;c&&(c.getWeight=u,c.operation=w[l]),this.setState({getValue:At(l,u,{data:f})})},n._resetResults=function(){var a=this.state.weights.count;a&&(a.aggregationData=null)},r}(Qe);tn.layerName="ScreenGridLayer";tn.defaultProps=gE;var Ms=x(it());function fr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fr=function(r){return typeof r}:fr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fr(e)}function Ns(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ns(Object(r),!0).forEach(function(n){xs(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ns(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function xs(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Cs(){}var ys=["getBins","getDomain","getScaleFunc"],Is=[{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}],pE=function(t){return t.cellSize},yt=function(){function e(r){AE(this,e),this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=void 0,this._getAggregator=void 0,this._getCellSize=r.getCellSize||pE,this._getAggregator=r.getAggregator,this._addDimension(r.dimensions||Is)}e.defaultDimensions=function(){return Is};var t=e.prototype;return t.updateState=function(n,o){var a=n.oldProps,s=n.props,u=n.changeFlags;this.updateGetValueFuncs(a,s,u);var l=this.needsReProjectPoints(a,s,u),f=!1;if(u.dataChanged||l)this.getAggregatedData(s,o),f=!0;else{var c=this.getDimensionChanges(a,s,u)||[];c.forEach(function(_){return typeof _=="function"&&_()}),f=!0}return this.setState({aggregationDirty:f}),this.state},t.setState=function(n){this.state=he(he({},this.state),n)},t.setDimensionState=function(n,o){this.setState({dimensions:he(he({},this.state.dimensions),{},xs({},n,he(he({},this.state.dimensions[n]),o)))})},t.normalizeResult=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n.hexagons?he({data:n.hexagons},n):n.layerData?he({data:n.layerData},n):n},t.getAggregatedData=function(n,o){var a=this._getAggregator(n),s=a(n,o);this.setState({layerData:this.normalizeResult(s)}),this.changeFlags={layerData:!0},this.getSortedBins(n)},t.updateGetValueFuncs=function(n,o,a){for(var s in this.dimensionUpdaters){var u=this.dimensionUpdaters[s].getBins.triggers,l=u.value,f=u.weight,c=u.aggregation,_=o[l.prop],E=this.needUpdateDimensionStep(this.dimensionUpdaters[s].getBins,n,o,a);E&&(_?_=Da(_,{data:o.data}):_=At(o[c.prop],o[f.prop],{data:o.data})),_&&this.setDimensionState(s,{getValue:_})}},t.needsReProjectPoints=function(n,o,a){return this._getCellSize(n)!==this._getCellSize(o)||this._getAggregator(n)!==this._getAggregator(o)||a.updateTriggersChanged&&(a.updateTriggersChanged.all||a.updateTriggersChanged.getPosition)},t.addDimension=function(n){this._addDimension(n)},t._addDimension=function(){var n=this,o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];o.forEach(function(a){var s=a.key;n.dimensionUpdaters[s]=n.getDimensionUpdaters(a),n.state.dimensions[s]={getValue:null,domain:null,sortedBins:null,scaleFunc:Cs}})},t.getDimensionUpdaters=function(n){var o=n.key,a=n.accessor,s=n.pickingInfo,u=n.getBins,l=n.getDomain,f=n.getScaleFunc,c=n.nullValue;return{key:o,accessor:a,pickingInfo:s,getBins:he({updater:this.getDimensionSortedBins.bind(this)},u),getDomain:he({updater:this.getDimensionValueDomain.bind(this)},l),getScaleFunc:he({updater:this.getDimensionScale.bind(this)},f),attributeAccessor:this.getSubLayerDimensionAttribute(o,c)}},t.needUpdateDimensionStep=function(n,o,a,s){return Object.values(n.triggers).some(function(u){return u.updateTrigger?s.dataChanged||s.updateTriggersChanged&&(s.updateTriggersChanged.all||s.updateTriggersChanged[u.updateTrigger]):o[u.prop]!==a[u.prop]})},t.getDimensionChanges=function(n,o,a){var s=this,u=[],l=function(_){var E=ys.find(function(d){return s.needUpdateDimensionStep(s.dimensionUpdaters[_][d],n,o,a)});E&&u.push(s.dimensionUpdaters[_][E].updater.bind(s,o,s.dimensionUpdaters[_]))};for(var f in this.dimensionUpdaters)l(f);return u.length?u:null},t.getUpdateTriggers=function(n){var o=this,a=n.updateTriggers||{},s={},u=function(c){var _=o.dimensionUpdaters[c].accessor;s[_]={},ys.forEach(function(E){Object.values(o.dimensionUpdaters[c][E].triggers).forEach(function(d){var h=d.prop,p=d.updateTrigger;if(p){var g=a[p];fr(g)==="object"&&!Array.isArray(g)?Object.assign(s[_],g):g!==void 0&&(s[_][h]=g)}else s[_][h]=n[h]})})};for(var l in this.dimensionUpdaters)u(l);return s},t.getSortedBins=function(n){for(var o in this.dimensionUpdaters)this.getDimensionSortedBins(n,this.dimensionUpdaters[o])},t.getDimensionSortedBins=function(n,o){var a=o.key,s=this.state.dimensions[a].getValue,u=new vt(this.state.layerData.data||[],{getValue:s,filterData:n._filterData});this.setDimensionState(a,{sortedBins:u}),this.getDimensionValueDomain(n,o)},t.getDimensionValueDomain=function(n,o){var a=o.getDomain,s=o.key,u=a.triggers,l=u.lowerPercentile,f=u.upperPercentile,c=u.scaleType,_=this.state.dimensions[s].sortedBins.getValueDomainByScale(n[c.prop],[n[l.prop],n[f.prop]]);this.setDimensionState(s,{valueDomain:_}),this.getDimensionScale(n,o)},t.getDimensionScale=function(n,o){var a=o.key,s=o.getScaleFunc,u=o.getDomain,l=s.triggers,f=l.domain,c=l.range,_=u.triggers.scaleType,E=s.onSet,d=n[c.prop],h=n[f.prop]||this.state.dimensions[a].valueDomain,p=us(_&&n[_.prop]),g=p(h,d);fr(E)==="object"&&typeof n[E.props]=="function"&&n[E.props](g.domain()),this.setDimensionState(a,{scaleFunc:g})},t.getSubLayerDimensionAttribute=function(n,o){var a=this;return function(s){var u=a.state.dimensions[n],l=u.sortedBins,f=u.scaleFunc,c=l.binMap[s.index];if(c&&c.counts===0)return o;var _=c&&c.value,E=f.domain(),d=_>=E[0]&&_<=E[E.length-1];return d?f(_):o}},t.getSubLayerAccessors=function(n){var o={};for(var a in this.dimensionUpdaters){var s=this.dimensionUpdaters[a].accessor;o[s]=this.getSubLayerDimensionAttribute(n,a)}return o},t.getPickingInfo=function(n){var o=n.info,a=o.picked&&o.index>-1,s=null;if(a){var u=this.state.layerData.data[o.index],l={};for(var f in this.dimensionUpdaters){var c=this.dimensionUpdaters[f].pickingInfo,_=this.state.dimensions[f].sortedBins,E=_.binMap[u.index]&&_.binMap[u.index].value;l[c]=E}s=Object.assign(l,u,{points:u.filteredPoints||u.points})}return o.picked=Boolean(s),o.object=s,o},t.getAccessor=function(n){return this.dimensionUpdaters.hasOwnProperty(n)?this.dimensionUpdaters[n].attributeAccessor:Cs},e}();function rn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rn=function(r){return typeof r}:rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},rn(e)}function TE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nn(e,t,r){return typeof Reflect<"u"&&Reflect.get?nn=Reflect.get:nn=function(o,a,s){var u=RE(o,a);if(u){var l=Object.getOwnPropertyDescriptor(u,a);return l.get?l.get.call(s):l.value}},nn(e,t,r||e)}function RE(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=It(e),e!==null););return e}function mE(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Oi(e,t)}function Oi(e,t){return Oi=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},Oi(e,t)}function SE(e){var t=bE();return function(){var n=It(e),o;if(t){var a=It(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return OE(this,o)}}function OE(e,t){if(t&&(rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vE(e)}function vE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function bE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function It(e){return It=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},It(e)}function Ps(){}var NE={colorDomain:null,colorRange:le,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:Ps,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:Ps,gridAggregator:bt,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Je=function(e){mE(r,e);var t=SE(r);function r(){var o;TE(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.initializeState=function(){var a=new yt({getAggregator:function(l){return l.gridAggregator},getCellSize:function(l){return l.cellSize}});this.state={cpuAggregator:a,aggregatorState:a.state};var s=this.getAttributeManager();s.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(a){nn(It(r.prototype),"updateState",this).call(this,a),this.setState({aggregatorState:this.state.cpuAggregator.updateState(a,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})},n.getPickingInfo=function(a){var s=a.info;return this.state.cpuAggregator.getPickingInfo({info:s})},n._onGetSublayerColor=function(a){return this.state.cpuAggregator.getAccessor("fillColor")(a)},n._onGetSublayerElevation=function(a){return this.state.cpuAggregator.getAccessor("elevation")(a)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var a=this.props,s=a.elevationScale,u=a.extruded,l=a.cellSize,f=a.coverage,c=a.material,_=a.transitions,E=this.state.cpuAggregator,d=this.getSubLayerClass("grid-cell",Ms.GridCellLayer),h=this._getSublayerUpdateTriggers();return new d({cellSize:l,coverage:f,material:c,elevationScale:s,extruded:u,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:_&&{getFillColor:_.getColorValue||_.getColorWeight,getElevation:_.getElevationValue||_.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:h}),{data:E.state.layerData.data})},r}(ge);Je.layerName="CPUGridLayer";Je.defaultProps=NE;var Ls=x(j()),Xs=x(it());var xt=Math.PI/3,CE=[0,xt,2*xt,3*xt,4*xt,5*xt];function yE(e){return e[0]}function IE(e){return e[1]}function vi(){var e=0,t=0,r=1,n=1,o=yE,a=IE,s,u,l;function f(_){var E={},d=[],h,p=_.length;for(h=0;h<p;++h)if(!(isNaN(T=+o.call(null,g=_[h],h,_))||isNaN(m=+a.call(null,g,h,_)))){var g,T,m,R=Math.round(m=m/l),S=Math.round(T=T/u-(R&1)/2),y=m-R;if(Math.abs(y)*3>1){var I=T-S,P=S+(T<S?-1:1)/2,M=R+(m<R?-1:1),B=T-P,z=m-M;I*I+y*y>B*B+z*z&&(S=P+(R&1?1:-1)/2,R=M)}var W=S+"-"+R,L=E[W];L?L.push(g):(d.push(L=E[W]=[g]),L.x=(S+(R&1)/2)*u,L.y=R*l)}return d}function c(_){var E=0,d=0;return CE.map(function(h){var p=Math.sin(h)*_,g=-Math.cos(h)*_,T=p-E,m=g-d;return E=p,d=g,[T,m]})}return f.hexagon=function(_){return"m"+c(_==null?s:+_).join("l")+"z"},f.centers=function(){for(var _=[],E=Math.round(t/l),d=Math.round(e/u),h=E*l;h<n+s;h+=l,++E)for(var p=d*u+(E&1)*u/2;p<r+u/2;p+=u)_.push([p,h]);return _},f.mesh=function(){var _=c(s).slice(0,4).join("l");return f.centers().map(function(E){return"M"+E+"m"+_}).join("")},f.x=function(_){return arguments.length?(o=_,f):o},f.y=function(_){return arguments.length?(a=_,f):a},f.radius=function(_){return arguments.length?(s=+_,u=s*2*Math.sin(xt),l=s*1.5,f):s},f.size=function(_){return arguments.length?(e=t=0,r=+_[0],n=+_[1],f):[r-e,n-t]},f.extent=function(_){return arguments.length?(e=+_[0][0],t=+_[0][1],r=+_[1][0],n=+_[1][1],f):[[e,t],[r,n]]},f.radius(1)}var on=x(j());function xE(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=PE(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
501
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,s=!1,u;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return a=f.done,f},e:function(f){s=!0,u=f},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(s)throw u}}}}function PE(e,t){if(e){if(typeof e=="string")return Fs(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Fs(e,t)}}function Fs(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ds(e,t){var r=e.data,n=e.radius,o=t.viewport,a=t.attributes,s=r.length?ME(r,t):null,u=FE(n,o,s),l=[],f=(0,on.createIterable)(r),c=f.iterable,_=f.objectInfo,E=a.positions.value,d=a.positions.getAccessor(),h=d.size,p=xE(c),g;try{for(p.s();!(g=p.n()).done;){var T=g.value;_.index++;var m=_.index*h,R=[E[m],E[m+1]],S=Number.isFinite(R[0])&&Number.isFinite(R[1]);S?l.push({screenCoord:o.projectFlat(R),source:T,index:_.index}):on.log.warn("HexagonLayer: invalid position")()}}catch(P){p.e(P)}finally{p.f()}var y=vi().radius(u).x(function(P){return P.screenCoord[0]}).y(function(P){return P.screenCoord[1]}),I=y(l);return{hexagons:I.map(function(P,M){return{position:o.unprojectFlat([P.x,P.y]),points:P,index:M}}),radiusCommon:u}}function ME(e,t){var r=t.attributes,n=r.positions.value,o=r.positions.getAccessor(),a=o.size,s=1/0,u=1/0,l=-1/0,f=-1/0,c;for(c=0;c<a*e.length;c+=a){var _=n[c],E=n[c+1],d=Number.isFinite(_)&&Number.isFinite(E);d&&(s=Math.min(_,s),l=Math.max(_,l),u=Math.min(E,u),f=Math.max(E,f))}return[s,u,l,f].every(Number.isFinite)?[(s+l)/2,(u+f)/2]:null}function FE(e,t,r){var n=t.getDistanceScales(r),o=n.unitsPerMeter;return e*o[0]}function an(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?an=function(r){return typeof r}:an=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},an(e)}function Bs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Us(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bs(Object(r),!0).forEach(function(n){DE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function DE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function BE(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sn(e,t,r){return typeof Reflect<"u"&&Reflect.get?sn=Reflect.get:sn=function(o,a,s){var u=UE(o,a);if(u){var l=Object.getOwnPropertyDescriptor(u,a);return l.get?l.get.call(s):l.value}},sn(e,t,r||e)}function UE(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Pt(e),e!==null););return e}function wE(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bi(e,t)}function bi(e,t){return bi=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},bi(e,t)}function LE(e){var t=HE();return function(){var n=Pt(e),o;if(t){var a=Pt(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return XE(this,o)}}function XE(e,t){if(t&&(an(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return WE(e)}function WE(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function HE(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Pt(e){return Pt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Pt(e)}function ws(){}var VE={colorDomain:null,colorRange:le,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:ws,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:ws,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Ds,getPosition:{type:"accessor",value:function(t){return t.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},un=function(e){wE(r,e);var t=LE(r);function r(){var o;BE(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.initializeState=function(){var a=new yt({getAggregator:function(l){return l.hexagonAggregator},getCellSize:function(l){return l.radius}});this.state={cpuAggregator:a,aggregatorState:a.state,vertices:null};var s=this.getAttributeManager();s.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(a){if(sn(Pt(r.prototype),"updateState",this).call(this,a),a.changeFlags.propsOrDataChanged){var s=this.state.cpuAggregator.updateState(a,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==s.layerData){var u=s.layerData||{},l=u.hexagonVertices;this.setState({vertices:l&&this.convertLatLngToMeterOffset(l)})}this.setState({aggregatorState:s})}},n.convertLatLngToMeterOffset=function(a){var s=this.context.viewport;if(Array.isArray(a)&&a.length===6){var u=a[0],l=a[3],f=[(u[0]+l[0])/2,(u[1]+l[1])/2],c=s.projectFlat(f),_=s.getDistanceScales(f),E=_.metersPerUnit,d=a.map(function(h){var p=s.projectFlat(h);return[(p[0]-c[0])*E[0],(p[1]-c[1])*E[1]]});return d}return Ls.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null},n.getPickingInfo=function(a){var s=a.info;return this.state.cpuAggregator.getPickingInfo({info:s})},n._onGetSublayerColor=function(a){return this.state.cpuAggregator.getAccessor("fillColor")(a)},n._onGetSublayerElevation=function(a){return this.state.cpuAggregator.getAccessor("elevation")(a)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var a=this.props,s=a.elevationScale,u=a.extruded,l=a.coverage,f=a.material,c=a.transitions,_=this.state,E=_.aggregatorState,d=_.vertices,h=this.getSubLayerClass("hexagon-cell",Xs.ColumnLayer),p=this._getSublayerUpdateTriggers(),g=d?{vertices:d,radius:1}:{radius:E.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new h(Us(Us({},g),{},{diskResolution:6,elevationScale:s,extruded:u,coverage:l,material:f,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:c&&{getFillColor:c.getColorValue||c.getColorWeight,getElevation:c.getElevationValue||c.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:p}),{data:E.layerData.data})},r}(ge);un.layerName="HexagonLayer";un.defaultProps=VE;var dn=x(it());var Eu=x(j());var v;function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=.5,C=1/6,A={N:[0,O],E:[O,0],S:[0,-O],W:[-O,0],NE:[O,O],NW:[-O,O],SE:[O,-O],SW:[-O,-O]},Mt=[A.W,A.SW,A.S],Ft=[A.S,A.SE,A.E],Dt=[A.E,A.NE,A.N],Bt=[A.NW,A.W,A.N],Ut=[[-O,C],[-O,-C],[-C,-O],[C,-O]],wt=[[-C,-O],[C,-O],[O,-C],[O,C]],Lt=[[O,-C],[O,C],[C,O],[-C,O]],Xt=[[-O,C],[-O,-C],[C,O],[-C,O]],Ws=[A.W,A.SW,A.SE,A.E],Hs=[A.S,A.SE,A.NE,A.N],Vs=[A.NW,A.W,A.E,A.NE],Ks=[A.NW,A.SW,A.S,A.N],Gs=[[-O,C],[-O,-C],[O,-C],[O,C]],zs=[[-C,-O],[C,-O],[C,O],[-C,O]],KE=[A.NW,A.SW,A.SE,A.NE],js=[A.NW,A.SW,A.SE,A.E,A.N],Ys=[A.W,A.SW,A.SE,A.NE,A.N],ks=[A.NW,A.W,A.S,A.SE,A.NE],$s=[A.NW,A.SW,A.S,A.E,A.NE],Zs=[A.NW,A.W,[O,-C],[O,C],A.N],qs=[[-C,-O],[C,-O],A.E,A.NE,A.N],Qs=[[-O,C],[-O,-C],A.S,A.SE,A.E],Js=[A.W,A.SW,A.S,[C,O],[-C,O]],eu=[A.NW,A.W,[-C,-O],[C,-O],A.N],tu=[[-O,C],[-O,-C],A.E,A.NE,A.N],ru=[A.S,A.SE,A.E,[C,O],[-C,O]],nu=[A.W,A.SW,A.S,[O,-C],[O,C]],iu=[A.W,A.SW,A.SE,A.E,[C,O],[-C,O]],ou=[[-O,C],[-O,-C],A.S,A.SE,A.NE,A.N],au=[A.NW,A.W,[-C,-O],[C,-O],A.E,A.NE],su=[A.NW,A.SW,A.S,[O,-C],[O,C],A.N],Wt=[A.W,A.SW,A.S,A.E,A.NE,A.N],Ht=[A.NW,A.W,A.S,A.SE,A.E,A.N],ln=[[-O,C],[-O,-C],[-C,-O],[C,-O],A.E,A.NE,A.N],fn=[A.W,A.SW,A.S,[O,-C],[O,C],[C,O],[-C,O]],cn=[A.NW,A.W,[-C,-O],[C,-O],[O,-C],[O,C],A.N],_n=[[-O,C],[-O,-C],A.S,A.SE,A.E,[C,O],[-C,O]],uu=[[-O,C],[-O,-C],[-C,-O],[C,-O],[O,-C],[O,C],[C,O],[-C,O]],lu={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 N(e){return parseInt(e,4)}var fu=(v={},b(v,N("0000"),[]),b(v,N("2222"),[]),b(v,N("2221"),[Mt]),b(v,N("2212"),[Ft]),b(v,N("2122"),[Dt]),b(v,N("1222"),[Bt]),b(v,N("0001"),[Mt]),b(v,N("0010"),[Ft]),b(v,N("0100"),[Dt]),b(v,N("1000"),[Bt]),b(v,N("2220"),[Ut]),b(v,N("2202"),[wt]),b(v,N("2022"),[Lt]),b(v,N("0222"),[Xt]),b(v,N("0002"),[Ut]),b(v,N("0020"),[wt]),b(v,N("0200"),[Lt]),b(v,N("2000"),[Xt]),b(v,N("0011"),[Ws]),b(v,N("0110"),[Hs]),b(v,N("1100"),[Vs]),b(v,N("1001"),[Ks]),b(v,N("2211"),[Ws]),b(v,N("2112"),[Hs]),b(v,N("1122"),[Vs]),b(v,N("1221"),[Ks]),b(v,N("2200"),[Gs]),b(v,N("2002"),[zs]),b(v,N("0022"),[Gs]),b(v,N("0220"),[zs]),b(v,N("1111"),[KE]),b(v,N("1211"),[js]),b(v,N("2111"),[Ys]),b(v,N("1112"),[ks]),b(v,N("1121"),[$s]),b(v,N("1011"),[js]),b(v,N("0111"),[Ys]),b(v,N("1110"),[ks]),b(v,N("1101"),[$s]),b(v,N("1200"),[Zs]),b(v,N("0120"),[qs]),b(v,N("0012"),[Qs]),b(v,N("2001"),[Js]),b(v,N("1022"),[Zs]),b(v,N("2102"),[qs]),b(v,N("2210"),[Qs]),b(v,N("0221"),[Js]),b(v,N("1002"),[eu]),b(v,N("2100"),[tu]),b(v,N("0210"),[ru]),b(v,N("0021"),[nu]),b(v,N("1220"),[eu]),b(v,N("0122"),[tu]),b(v,N("2012"),[ru]),b(v,N("2201"),[nu]),b(v,N("0211"),[iu]),b(v,N("2110"),[ou]),b(v,N("1102"),[au]),b(v,N("1021"),[su]),b(v,N("2011"),[iu]),b(v,N("0112"),[ou]),b(v,N("1120"),[au]),b(v,N("1201"),[su]),b(v,N("2101"),[Wt]),b(v,N("0121"),[Wt]),b(v,N("1012"),[Ht]),b(v,N("1210"),[Ht]),b(v,N("0101"),{0:[Mt,Dt],1:[Wt],2:[Wt]}),b(v,N("1010"),{0:[Bt,Ft],1:[Ht],2:[Ht]}),b(v,N("2121"),{0:[Wt],1:[Wt],2:[Mt,Dt]}),b(v,N("1212"),{0:[Ht],1:[Ht],2:[Bt,Ft]}),b(v,N("2120"),{0:[ln],1:[ln],2:[Ut,Dt]}),b(v,N("2021"),{0:[fn],1:[fn],2:[Mt,Lt]}),b(v,N("1202"),{0:[cn],1:[cn],2:[Bt,wt]}),b(v,N("0212"),{0:[_n],1:[_n],2:[Ft,Xt]}),b(v,N("0102"),{0:[Ut,Dt],1:[ln],2:[ln]}),b(v,N("0201"),{0:[Mt,Lt],1:[fn],2:[fn]}),b(v,N("1020"),{0:[Bt,wt],1:[cn],2:[cn]}),b(v,N("2010"),{0:[Ft,Xt],1:[_n],2:[_n]}),b(v,N("2020"),{0:[Xt,wt],1:[uu],2:[Ut,Lt]}),b(v,N("0202"),{0:[Lt,Ut],1:[uu],2:[Xt,wt]}),v);function cu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function _u(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?cu(Object(r),!0).forEach(function(n){GE(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function GE(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var et={ISO_LINES:1,ISO_BANDS:2},zE={zIndex:0,zOffset:.005};function cr(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function du(e){var t=e.cellWeights,r=e.x,n=e.y,o=e.width,a=e.height,s=e.threshold;e.thresholdValue&&(Eu.log.deprecated("thresholdValue","threshold")(),s=e.thresholdValue);var u=r<0,l=r>=o-1,f=n<0,c=n>=a-1,_=u||l||f||c,E={},d={};u||c?d.top=0:(E.top=t[(n+1)*o+r],d.top=cr(E.top,s)),l||c?d.topRight=0:(E.topRight=t[(n+1)*o+r+1],d.topRight=cr(E.topRight,s)),l||f?d.right=0:(E.right=t[n*o+r+1],d.right=cr(E.right,s)),u||f?d.current=0:(E.current=t[n*o+r],d.current=cr(E.current,s));var h=d.top,p=d.topRight,g=d.right,T=d.current,m=-1;Number.isFinite(s)&&(m=h<<3|p<<2|g<<1|T),Array.isArray(s)&&(m=h<<6|p<<4|g<<2|T);var R=0;return _||(R=cr((E.top+E.topRight+E.right+E.current)/4,s)),{code:m,meanCode:R}}function Ni(e){var t=e.gridOrigin,r=e.cellSize,n=e.x,o=e.y,a=e.code,s=e.meanCode,u=e.type,l=u===void 0?et.ISO_LINES:u,f=_u(_u({},zE),e.thresholdData),c=l===et.ISO_BANDS?fu[a]:lu[a];Array.isArray(c)||(c=c[s]);var _=f.zIndex*f.zOffset,E=(n+1)*r[0],d=(o+1)*r[1],h=t[0]+E,p=t[1]+d;if(l===et.ISO_BANDS){var g=[];return c.forEach(function(m){var R=[];m.forEach(function(S){var y=h+S[0]*r[0],I=p+S[1]*r[1];R.push([y,I,_])}),g.push(R)}),g}var T=[];return c.forEach(function(m){m.forEach(function(R){var S=h+R[0]*r[0],y=p+R[1]*r[1];T.push([S,y,_])})}),T}function gu(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=jE(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
502
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
509
|
+
fragColor = vColor;
|
|
510
|
+
|
|
511
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
512
|
+
}
|
|
513
|
+
`;function Yr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yr=function(r){return typeof r}:Yr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Yr(e)}function ns(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ci(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ns(Object(r),!0).forEach(function(n){ad(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ns(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ad(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zr(e,t,r){return typeof Reflect<"u"&&Reflect.get?Zr=Reflect.get:Zr=function(i,o,a){var s=ld(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},Zr(e,t,r||e)}function ld(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=pt(e),e!==null););return e}function fd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&di(e,t)}function di(e,t){return di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},di(e,t)}function ud(e){var t=gd();return function(){var n=pt(e),i;if(t){var o=pt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cd(this,i)}}function cd(e,t){if(t&&(Yr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dd(e)}function dd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gd(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function pt(e){return pt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},pt(e)}var hd=[0,0,0,0],_d=[0,255,0,255],pd=["minColor","maxColor","colorRange","colorDomain"],Ad={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:ae},Tt=function(e){fd(r,e);var t=ud(r);function r(){var i;sd(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}r.isSupported=function(o){return o.features.has("texture-formats-float32-webgl1")};var n=r.prototype;return n.getShaders=function(){return{vs:ts,fs:rs,modules:[At.picking]}},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})},n.shouldUpdateState=function(o){var a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){Zr(pt(r.prototype),"updateState",this).call(this,o);var a=o.oldProps,s=o.props,l=o.changeFlags,f=this.getAttributeManager();s.numInstances!==a.numInstances?f.invalidateAll():a.cellSizePixels!==s.cellSizePixels&&f.invalidate("instancePositions"),this._updateUniforms(a,s,l)},n.draw=function(o){var a=o.uniforms,s=this.props,l=s.parameters,f=s.maxTexture,u=this.props.minColor||hd,c=this.props.maxColor||_d,d=this.props.colorDomain||[1,0],g=this.state.model;g.setUniforms(a),g.setBindings({maxTexture:f}),g.setUniforms({minColor:u,maxColor:c,colorDomain:d}),g.setParameters(ci({depthWriteEnabled:!1},l)),g.draw(this.context.renderPass)},n.calculateInstancePositions=function(o,a){for(var s=a.numInstances,l=this.context.viewport,f=l.width,u=l.height,c=this.props.cellSizePixels,d=Math.ceil(f/c),g=o.value,h=o.size,A=0;A<s;A++){var _=A%d,v=Math.floor(A/d);g[A*h+0]=_*c/f*2-1,g[A*h+1]=1-v*c/u*2,g[A*h+2]=0}},n._getModel=function(){return new Y(this.context.device,ci(ci({},this.getShaders()),{},{id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Re({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})}))},n._shouldUseMinMax=function(){var o=this.props,a=o.minColor,s=o.maxColor,l=o.colorDomain,f=o.colorRange;return a||s?(At.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(l||f)},n._updateUniforms=function(o,a,s){var l=this.state.model;if(pd.some(function(v){return o[v]!==a[v]})&&l.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),o.colorRange!==a.colorRange&&l.setUniforms({colorRange:We(a.colorRange)}),o.cellMarginPixels!==a.cellMarginPixels||o.cellSizePixels!==a.cellSizePixels||s.viewportChanged){var f=this.context.viewport,u=f.width,c=f.height,d=this.props,g=d.cellSizePixels,h=d.cellMarginPixels,A=g>h?h:0,_=new Float32Array([(g-A)/u*2,-(g-A)/c*2,1]);l.setUniforms({cellScale:_})}},r}(At.Layer);Tt.layerName="ScreenGridCellLayer";Tt.defaultProps=Ad;var Ms=P($());var vt=P($());function is(e,t){var r={};for(var n in e)t.includes(n)||(r[n]=e[n]);return r}function qr(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qr=function(r){return typeof r}:qr=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},qr(e)}function os(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Td(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
514
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Td(e,t){if(e){if(typeof e=="string")return as(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return as(e,t)}}function as(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function vd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fr(e,t,r){return typeof Reflect<"u"&&Reflect.get?fr=Reflect.get:fr=function(i,o,a){var s=md(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},fr(e,t,r||e)}function md(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ze(e),e!==null););return e}function bd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&gi(e,t)}function gi(e,t){return gi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},gi(e,t)}function Sd(e){var t=Ed();return function(){var n=Ze(e),i;if(t){var o=Ze(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Rd(this,i)}}function Rd(e,t){if(t&&(qr(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yd(e)}function yd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ed(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ze(e){return Ze=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ze(e)}var de=function(e){bd(r,e);var t=Sd(r);function r(){var i;vd(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){fr(Ze(r.prototype),"initializeState",this).call(this,this.context),this.setState({ignoreProps:is(this.constructor._propTypes,o.data.props),dimensions:o})},n.updateState=function(o){fr(Ze(r.prototype),"updateState",this).call(this,o);var a=o.changeFlags;if(a.extensionsChanged){var s=this.getShaders({});s&&s.defines&&(s.defines.NON_INSTANCED_MODEL=1),this.updateShaders(s)}this._updateAttributes()},n.updateAttributes=function(o){this.setState({changedAttributes:o})},n.getAttributes=function(){return this.getAttributeManager().getAttributes()},n.getModuleSettings=function(){var o=this.context,a=o.viewport,s=o.mousePosition,l=o.device,f=Object.assign(Object.create(this.props),{viewport:a,mousePosition:s,pickingActive:0,devicePixelRatio:l.canvasContext.cssToDeviceRatio()});return f},n.updateShaders=function(o){},n.isAggregationDirty=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.props,l=o.oldProps,f=o.changeFlags,u=a.compareAll,c=u===void 0?!1:u,d=a.dimension,g=this.state.ignoreProps,h=d.props,A=d.accessors,_=A===void 0?[]:A,v=f.updateTriggersChanged;if(f.dataChanged)return!0;if(v){if(v.all)return!0;var T=os(_),m;try{for(T.s();!(m=T.n()).done;){var E=m.value;if(v[E])return!0}}catch(M){T.e(M)}finally{T.f()}}if(c)return f.extensionsChanged?!0:(0,vt._compareProps)({oldProps:l,newProps:s,ignoreProps:g,propTypes:this.constructor._propTypes});var O=os(h),C;try{for(O.s();!(C=O.n()).done;){var N=C.value;if(s[N]!==l[N])return!0}}catch(M){O.e(M)}finally{O.f()}return!1},n.isAttributeChanged=function(o){var a=this.state.changedAttributes;return o?a&&a[o]!==void 0:!xd(a)},n._getAttributeManager=function(){return new vt.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},r}(vt.CompositeLayer);de.layerName="AggregationLayer";function xd(e){var t=!0;for(var r in e){t=!1;break}return t}var fs=P($());function Od(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Cd(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
515
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Cd(e,t){if(e){if(typeof e=="string")return ss(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ss(e,t)}}function ss(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Qr(e,t,r){var n=r;return n.domain=function(){return e},n.range=function(){return t},n}function ls(e,t){var r=function(i){return Bd(e,t,i)};return Qr(e,t,r)}function Pd(e,t){var r=function(i){return Ud(e,t,i)};return Qr(e,t,r)}function Nd(e,t){for(var r=e.sort(us),n=0,i=Math.max(1,t.length),o=new Array(i-1);++n<i;)o[n-1]=Md(r,n/i);var a=function(l){return Dd(o,t,l)};return a.thresholds=function(){return o},Qr(e,t,a)}function us(e,t){return e-t}function Md(e,t){var r=e.length;if(t<=0||r<2)return e[0];if(t>=1)return e[r-1];var n=(r-1)*t,i=Math.floor(n),o=e[i],a=e[i+1];return o+(a-o)*(n-i)}function Id(e,t){for(var r=0,n=e.length;r<n;){var i=r+n>>>1;us(e[i],t)>0?n=i:r=i+1}return r}function Dd(e,t,r){return t[Id(e,r)]}function Fd(e,t,r,n){var i="".concat(n),o=t.get(i);return o===void 0&&(o=e.push(n),t.set(i,o)),r[(o-1)%r.length]}function wd(e,t){var r=new Map,n=[],i=Od(e),o;try{for(i.s();!(o=i.n()).done;){var a=o.value,s="".concat(a);r.has(s)||r.set(s,n.push(a))}}catch(f){i.e(f)}finally{i.f()}var l=function(u){return Fd(n,r,t,u)};return Qr(e,t,l)}function Bd(e,t,r){var n=e[1]-e[0];if(n<=0)return fs.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];var i=n/t.length,o=Math.floor((r-e[0])/i),a=Math.max(Math.min(o,t.length-1),0);return t[a]}function Ud(e,t,r){return(r-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function cs(e){return e!=null}function Wd(e){var t=[];return e.forEach(function(r){!t.includes(r)&&cs(r)&&t.push(r)}),t}function ds(e,t){var r=typeof t=="function"?e.map(t):e;return r.filter(cs)}function gs(e,t){return ds(e,t)}function hs(e,t){return Wd(ds(e,t))}function _s(e,t,r){return Math.max(t,Math.min(r,e))}function ps(e){switch(e){case"quantize":return ls;case"linear":return Pd;case"quantile":return Nd;case"ordinal":return wd;default:return ls}}function As(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ms(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
516
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function hi(e,t){return Xd(e)||Vd(e,t)||ms(e,t)||Hd()}function Hd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
517
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ms(e,t){if(e){if(typeof e=="string")return Ts(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ts(e,t)}}function Ts(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Vd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function Xd(e){if(Array.isArray(e))return e}function Ld(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var bs=function(t){return t.length},zd=3402823466e29,Ss=function(t){return t.points},Rs=function(t){return t.index},vs=function(t,r){return t<r?-1:t>r?1:t>=r?0:NaN},jd={getValue:bs,getPoints:Ss,getIndex:Rs,filterData:null},mt=function(){function e(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jd;Ld(this,e),this.maxCount=void 0,this.maxValue=void 0,this.minValue=void 0,this.totalCount=void 0,this.aggregatedBins=void 0,this.sortedBins=void 0,this.binMap=void 0,this.aggregatedBins=this.getAggregatedBins(r,n),this._updateMinMaxValues(),this.binMap=this.getBinMap()}var t=e.prototype;return t.getAggregatedBins=function(n,i){for(var o=i.getValue,a=o===void 0?bs:o,s=i.getPoints,l=s===void 0?Ss:s,f=i.getIndex,u=f===void 0?Rs:f,c=i.filterData,d=typeof c=="function",g=n.length,h=[],A=0,_=0;_<g;_++){var v=n[_],T=l(v),m=u(v),E=d?T.filter(c):T;v.filteredPoints=d?E:null;var O=E.length?a(E):null;O!=null&&(h[A]={i:Number.isFinite(m)?m:_,value:O,counts:E.length},A++)}return h},t._percentileToIndex=function(n){var i=this.sortedBins.length;if(i<2)return[0,0];var o=n.map(function(c){return _s(c,0,100)}),a=hi(o,2),s=a[0],l=a[1],f=Math.ceil(s/100*(i-1)),u=Math.floor(l/100*(i-1));return[f,u]},t.getBinMap=function(){var n={},i=As(this.aggregatedBins),o;try{for(i.s();!(o=i.n()).done;){var a=o.value;n[a.i]=a}}catch(s){i.e(s)}finally{i.f()}return n},t._updateMinMaxValues=function(){var n=0,i=0,o=zd,a=0,s=As(this.aggregatedBins),l;try{for(s.s();!(l=s.n()).done;){var f=l.value;n=n>f.counts?n:f.counts,i=i>f.value?i:f.value,o=o<f.value?o:f.value,a+=f.counts}}catch(u){s.e(u)}finally{s.f()}this.maxCount=n,this.maxValue=i,this.minValue=o,this.totalCount=a},t.getValueRange=function(n){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(s,l){return vs(s.value,l.value)})),!this.sortedBins.length)return[];var i=0,o=this.sortedBins.length-1;if(Array.isArray(n)){var a=this._percentileToIndex(n);i=a[0],o=a[1]}return[this.sortedBins[i].value,this.sortedBins[o].value]},t.getValueDomainByScale=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=hi(i,2),a=o[0],s=a===void 0?0:a,l=o[1],f=l===void 0?100:l;if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort(function(c,d){return vs(c.value,d.value)})),!this.sortedBins.length)return[];var u=this._percentileToIndex([s,f]);return this._getScaleDomain(n,u)},t._getScaleDomain=function(n,i){var o=hi(i,2),a=o[0],s=o[1],l=this.sortedBins;switch(n){case"quantize":case"linear":return[l[a].value,l[s].value];case"quantile":return gs(l.slice(a,s+1),function(f){return f.value});case"ordinal":return hs(l,function(f){return f.value});default:return[l[a].value,l[s].value]}},e}();var Ps=P($());var He=P($()),Es=6378e3;function Jr(e){return Number.isFinite(e)?e:0}function Gr(e,t){for(var r=e.positions.value,n=1/0,i=-1/0,o=1/0,a=-1/0,s,l,f=0;f<t;f++)l=r[f*3],s=r[f*3+1],n=s<n?s:n,i=s>i?s:i,o=l<o?l:o,a=l>a?l:a;var u={xMin:Jr(o),xMax:Jr(a),yMin:Jr(n),yMax:Jr(i)};return u}function kd(e,t,r,n){var i=n.width,o=n.height,a=r===He.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-o/2]:[-180,-90];He.log.assert(r===He.COORDINATE_SYSTEM.CARTESIAN||r===He.COORDINATE_SYSTEM.LNGLAT||r===He.COORDINATE_SYSTEM.DEFAULT);var s=e.xMin,l=e.yMin;return[-1*(ys(s-a[0],t.xOffset)+a[0]),-1*(ys(l-a[1],t.yOffset)+a[1])]}function ys(e,t){var r=e<0?-1:1,n=r<0?Math.abs(e)+t:Math.abs(e);return n=Math.floor(n/t)*t,n*r}function _i(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!r)return{xOffset:t,yOffset:t};var n=e.yMin,i=e.yMax,o=(n+i)/2;return $d(t,o)}function en(e,t,r,n){var i=_i(e,t,n!==He.COORDINATE_SYSTEM.CARTESIAN),o=kd(e,i,n,r),a=e.xMin,s=e.yMin,l=e.xMax,f=e.yMax,u=l-a+i.xOffset,c=f-s+i.yOffset,d=Math.ceil(u/i.xOffset),g=Math.ceil(c/i.yOffset);return{gridOffset:i,translation:o,width:u,height:c,numCol:d,numRow:g}}function $d(e,t){var r=Kd(e),n=Yd(t,e);return{yOffset:r,xOffset:n}}function Kd(e){return e/Es*(180/Math.PI)}function Yd(e,t){return t/Es*(180/Math.PI)/Math.cos(e*Math.PI/180)}function xs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Zd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xs(Object(r),!0).forEach(function(n){qd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Qd(e,t){return eg(e)||Gd(e,t)||Cs(e,t)||Jd()}function Jd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
518
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function eg(e){if(Array.isArray(e))return e}function tg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Cs(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
519
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Cs(e,t){if(e){if(typeof e=="string")return Os(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Os(e,t)}}function Os(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function bt(e,t){var r=rg(e,t),n=ng(r);return{gridHash:r.gridHash,gridOffset:r.gridOffset,data:n}}function rg(e,t){var r=e.data,n=r===void 0?[]:r,i=e.cellSize,o=t.attributes,a=t.viewport,s=t.projectPoints,l=t.numInstances,f=o.positions.value,u=o.positions.getAccessor(),c=u.size,d=t.boundingBox||ig(o.positions,l),g=t.posOffset||[180,90],h=t.gridOffset||_i(d,i);if(h.xOffset<=0||h.yOffset<=0)return{gridHash:{},gridOffset:h,offsets:[0,0]};var A=a.width,_=a.height,v=Math.ceil(A/h.xOffset),T=Math.ceil(_/h.yOffset),m={},E=(0,Ps.createIterable)(n),O=E.iterable,C=E.objectInfo,N=new Array(3),M=tg(O),U;try{for(M.s();!(U=M.n()).done;){var W=U.value;C.index++,N[0]=f[C.index*c],N[1]=f[C.index*c+1],N[2]=c>=3?f[C.index*c+2]:0;var j=s?a.project(N):N,Z=Qd(j,2),oe=Z[0],Ui=Z[1];if(Number.isFinite(oe)&&Number.isFinite(Ui)){var hr=Math.floor((Ui+g[1])/h.yOffset),_r=Math.floor((oe+g[0])/h.xOffset);if(!s||_r>=0&&_r<v&&hr>=0&&hr<T){var pr="".concat(hr,"-").concat(_r);m[pr]=m[pr]||{count:0,points:[],lonIdx:_r,latIdx:hr},m[pr].count+=1,m[pr].points.push({source:W,index:C.index})}}}}catch(sf){M.e(sf)}finally{M.f()}return{gridHash:m,gridOffset:h,offsets:[g[0]*-1,g[1]*-1]}}function ng(e){var t=e.gridHash,r=e.gridOffset,n=e.offsets,i=new Array(Object.keys(t).length),o=0;for(var a in t){var s=a.split("-"),l=parseInt(s[0],10),f=parseInt(s[1],10),u=o++;i[u]=Zd({index:u,position:[n[0]+r.xOffset*f,n[1]+r.yOffset*l]},t[a])}return i}function ig(e,t){for(var r=e.value,n=e.getAccessor(),i=n.size,o=1/0,a=-1/0,s=1/0,l=-1/0,f,u,c=0;c<t;c++)u=r[c*i],f=r[c*i+1],Number.isFinite(u)&&Number.isFinite(f)&&(o=f<o?f:o,a=f>a?f:a,s=u<s?u:s,l=u>l?u:l);return{xMin:s,xMax:l,yMin:o,yMax:a}}function tn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?tn=function(r){return typeof r}:tn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},tn(e)}function og(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=ag(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
520
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function ag(e,t){if(e){if(typeof e=="string")return Ns(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ns(e,t)}}function Ns(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function sg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function St(e,t,r){return typeof Reflect<"u"&&Reflect.get?St=Reflect.get:St=function(i,o,a){var s=lg(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},St(e,t,r||e)}function lg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ve(e),e!==null););return e}function fg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pi(e,t)}function pi(e,t){return pi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},pi(e,t)}function ug(e){var t=gg();return function(){var n=Ve(e),i;if(t){var o=Ve(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return cg(this,i)}}function cg(e,t){if(t&&(tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return dg(e)}function dg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ve(e){return Ve=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ve(e)}var qe=function(e){fg(r,e);var t=ug(r);function r(){var i;sg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeAggregationLayer=function(o){var a=o.dimensions;St(Ve(r.prototype),"initializeAggregationLayer",this).call(this,a),this.setState({layerData:{},gpuGridAggregator:new ee(this.context.device,{id:"".concat(this.id,"-gpu-aggregator")}),cpuGridAggregator:bt})},n.updateState=function(o){St(Ve(r.prototype),"updateState",this).call(this,o),this.updateAggregationState(o);var a=this.state,s=a.aggregationDataDirty,l=a.aggregationWeightsDirty,f=a.gpuAggregation;if(!(this.getNumInstances()<=0)){var u=!1;(s||f&&l)&&(this._updateAggregation(o),u=!0),!f&&(s||l)&&(this._updateWeightBins(),this._uploadAggregationResults(),u=!0),this.setState({aggregationDirty:u})}},n.finalizeState=function(o){var a,s=this.state.weights.count;s&&s.aggregationBuffer&&s.aggregationBuffer.delete(),(a=this.state.gpuGridAggregator)===null||a===void 0||a.delete(),St(Ve(r.prototype),"finalizeState",this).call(this,o)},n.updateShaders=function(o){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(o)},n.updateAggregationState=function(o){Ms.log.assert(!1)},n.allocateResources=function(o,a){if(this.state.numRow!==o||this.state.numCol!==a){var s=a*o*4*4,l=this.state.weights;for(var f in l){var u=l[f];u.aggregationBuffer&&u.aggregationBuffer.delete(),u.aggregationBuffer=this.context.device.createBuffer({byteLength:s,accessor:{size:4,type:5126,divisor:1}})}}},n.updateResults=function(o){var a=o.aggregationData,s=o.maxMinData,l=o.maxData,f=o.minData,u=this.state.weights.count;u&&(u.aggregationData=a,u.maxMinData=s,u.maxData=l,u.minData=f)},n._updateAggregation=function(o){var a=this.state,s=a.cpuGridAggregator,l=a.gpuGridAggregator,f=a.gridOffset,u=a.posOffset,c=a.translation,d=c===void 0?[0,0]:c,g=a.scaling,h=g===void 0?[0,0,0]:g,A=a.boundingBox,_=a.projectPoints,v=a.gpuAggregation,T=a.numCol,m=a.numRow,E=o.props,O=this.context.viewport,C=this.getAttributes(),N=this.getNumInstances();if(v){var U=this.state.weights;l.run({weights:U,cellSize:[f.xOffset,f.yOffset],numCol:T,numRow:m,translation:d,scaling:h,vertexCount:N,projectPoints:_,attributes:C,moduleSettings:this.getModuleSettings()})}else{var M=s(E,{gridOffset:f,projectPoints:_,attributes:C,viewport:O,posOffset:u,boundingBox:A});this.setState({layerData:M})}},n._updateWeightBins=function(){var o=this.state.getValue,a=new mt(this.state.layerData.data||[],{getValue:o});this.setState({sortedBins:a})},n._uploadAggregationResults=function(){var o=this.state,a=o.numCol,s=o.numRow,l=this.state.layerData.data,f=this.state.sortedBins,u=f.aggregatedBins,c=f.minValue,d=f.maxValue,g=f.totalCount,h=4,A=a*s*h,_=new Float32Array(A).fill(0),v=og(u),T;try{for(v.s();!(T=v.n()).done;){var m=T.value,E=l[m.i],O=E.lonIdx,C=E.latIdx,N=m.value,M=m.counts,U=(O+C*a)*h;_[U]=N,_[U+h-1]=M}}catch(oe){v.e(oe)}finally{v.f()}var W=new Float32Array([d,0,0,c]),j=new Float32Array([d,0,0,g]),Z=new Float32Array([c,0,0,g]);this.updateResults({aggregationData:_,maxMinData:W,maxData:j,minData:Z})},r}(de);qe.layerName="GridAggregationLayer";function rn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rn=function(r){return typeof r}:rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},rn(e)}function hg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Rt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Rt=Reflect.get:Rt=function(i,o,a){var s=_g(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},Rt(e,t,r||e)}function _g(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Xe(e),e!==null););return e}function pg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ai(e,t)}function Ai(e,t){return Ai=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ai(e,t)}function Ag(e){var t=mg();return function(){var n=Xe(e),i;if(t){var o=Xe(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Tg(this,i)}}function Tg(e,t){if(t&&(rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return vg(e)}function vg(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function mg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xe(e){return Xe=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Xe(e)}function Is(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ti(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Is(Object(r),!0).forEach(function(n){vi(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Is(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function vi(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var bg=Ti(Ti({},Tt.defaultProps),{},{getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM"}),Ds="positions",Sg={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},nn=function(e){pg(r,e);var t=Ag(r);function r(){var i;hg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;if(!Tt.isSupported(this.context.device)){this.setState({supported:!1}),mi.log.error("ScreenGridLayer: ".concat(this.id," is not supported on this browser"))();return}Rt(Xe(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Sg,getCellSize:function(f){return f.cellSizePixels}});var a={count:{size:1,operation:w.SUM,needMax:!0,maxTexture:_t(this.context.device,{id:"".concat(this.id,"-max-texture")})}};this.setState({supported:!0,projectPoints:!0,weights:a,subLayerData:{attributes:{}},maxTexture:a.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]});var s=this.getAttributeManager();s.add((o={},vi(o,Ds,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),vi(o,"count",{size:3,accessor:"getWeight"}),o))},n.shouldUpdateState=function(o){var a=o.changeFlags;return this.state.supported&&a.somethingChanged},n.updateState=function(o){Rt(Xe(r.prototype),"updateState",this).call(this,o)},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,a=o.maxTexture,s=o.numRow,l=o.numCol,f=o.weights,u=this.props.updateTriggers,c=f.count.aggregationBuffer,d=this.getSubLayerClass("cells",Tt);return new d(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:u}),{data:{attributes:{instanceCounts:c}},maxTexture:a,numInstances:s*l})},n.finalizeState=function(o){Rt(Xe(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.aggregationBuffer,l=a.maxBuffer,f=a.maxTexture;s?.delete(),l?.delete(),f?.delete()},n.getPickingInfo=function(o){var a=o.info,s=a.index;if(s>=0){var l=this.state,f=l.gpuGridAggregator,u=l.gpuAggregation,c=l.weights,d=u?f.getData("count"):c.count;a.object=ee.getAggregationData(Ti({pixelIndex:s},d))}return a},n.updateResults=function(o){var a=o.aggregationData,s=o.maxData,l=this.state.weights.count;l.aggregationData=a,l.aggregationBuffer.write(a),l.maxData=s,l.maxTexture.setImageData({data:s})},n.updateAggregationState=function(o){var a=o.props.cellSizePixels,s=o.oldProps.cellSizePixels!==a,l=o.changeFlags.viewportChanged,f=o.props.gpuAggregation;this.state.gpuAggregation!==o.props.gpuAggregation&&f&&!ee.isSupported(this.context.device)&&(mi.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),f=!1);var u=f!==this.state.gpuAggregation;this.setState({gpuAggregation:f});var c=this.isAttributeChanged(Ds),d=this.state.dimensions,g=d.data,h=d.weights,A=c||u||l||this.isAggregationDirty(o,{compareAll:f,dimension:g}),_=this.isAggregationDirty(o,{dimension:h});this.setState({aggregationDataDirty:A,aggregationWeightsDirty:_});var v=this.context.viewport;if(l||s){var T=v.width,m=v.height,E=Math.ceil(T/a),O=Math.ceil(m/a);this.allocateResources(O,E),this.setState({scaling:[T/2,-m/2,1],gridOffset:{xOffset:a,yOffset:a},width:T,height:m,numCol:E,numRow:O})}_&&this._updateAccessors(o),(A||_)&&this._resetResults()},n._updateAccessors=function(o){var a=o.props,s=a.getWeight,l=a.aggregation,f=a.data,u=this.state.weights.count;u&&(u.getWeight=s,u.operation=w[l]),this.setState({getValue:gt(l,s,{data:f})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},r}(qe);nn.layerName="ScreenGridLayer";nn.defaultProps=bg;var Vs=P(rt());function ur(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ur=function(r){return typeof r}:ur=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ur(e)}function Fs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ge(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fs(Object(r),!0).forEach(function(n){Ws(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ws(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Rg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ws(){}var Bs=["getBins","getDomain","getScaleFunc"],Us=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],yg=function(t){return t.cellSize},yt=function(){function e(r){Rg(this,e),this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=void 0,this._getAggregator=void 0,this._getCellSize=r.getCellSize||yg,this._getAggregator=r.getAggregator,this._addDimension(r.dimensions||Us)}e.defaultDimensions=function(){return Us};var t=e.prototype;return t.updateState=function(n,i){var o=n.oldProps,a=n.props,s=n.changeFlags;this.updateGetValueFuncs(o,a,s);var l=this.needsReProjectPoints(o,a,s),f=!1;if(s.dataChanged||l)this.getAggregatedData(a,i),f=!0;else{var u=this.getDimensionChanges(o,a,s)||[];u.forEach(function(c){return typeof c=="function"&&c()}),f=!0}return this.setState({aggregationDirty:f}),this.state},t.setState=function(n){this.state=ge(ge({},this.state),n)},t.setDimensionState=function(n,i){this.setState({dimensions:ge(ge({},this.state.dimensions),{},Ws({},n,ge(ge({},this.state.dimensions[n]),i)))})},t.normalizeResult=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n.hexagons?ge({data:n.hexagons},n):n.layerData?ge({data:n.layerData},n):n},t.getAggregatedData=function(n,i){var o=this._getAggregator(n),a=o(n,i);this.setState({layerData:this.normalizeResult(a)}),this.changeFlags={layerData:!0},this.getSortedBins(n)},t.updateGetValueFuncs=function(n,i,o){for(var a in this.dimensionUpdaters){var s=this.dimensionUpdaters[a].getBins.triggers,l=s.value,f=s.weight,u=s.aggregation,c=i[l.prop],d=this.needUpdateDimensionStep(this.dimensionUpdaters[a].getBins,n,i,o);d&&(c?c=La(c,{data:i.data}):c=gt(i[u.prop],i[f.prop],{data:i.data})),c&&this.setDimensionState(a,{getValue:c})}},t.needsReProjectPoints=function(n,i,o){return this._getCellSize(n)!==this._getCellSize(i)||this._getAggregator(n)!==this._getAggregator(i)||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPosition)},t.addDimension=function(n){this._addDimension(n)},t._addDimension=function(){var n=this,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];i.forEach(function(o){var a=o.key;n.dimensionUpdaters[a]=n.getDimensionUpdaters(o),n.state.dimensions[a]={getValue:null,domain:null,sortedBins:null,scaleFunc:ws}})},t.getDimensionUpdaters=function(n){var i=n.key,o=n.accessor,a=n.pickingInfo,s=n.getBins,l=n.getDomain,f=n.getScaleFunc,u=n.nullValue;return{key:i,accessor:o,pickingInfo:a,getBins:ge({updater:this.getDimensionSortedBins.bind(this)},s),getDomain:ge({updater:this.getDimensionValueDomain.bind(this)},l),getScaleFunc:ge({updater:this.getDimensionScale.bind(this)},f),attributeAccessor:this.getSubLayerDimensionAttribute(i,u)}},t.needUpdateDimensionStep=function(n,i,o,a){return Object.values(n.triggers).some(function(s){return s.updateTrigger?a.dataChanged||a.updateTriggersChanged&&(a.updateTriggersChanged.all||a.updateTriggersChanged[s.updateTrigger]):i[s.prop]!==o[s.prop]})},t.getDimensionChanges=function(n,i,o){var a=this,s=[],l=function(c){var d=Bs.find(function(g){return a.needUpdateDimensionStep(a.dimensionUpdaters[c][g],n,i,o)});d&&s.push(a.dimensionUpdaters[c][d].updater.bind(a,i,a.dimensionUpdaters[c]))};for(var f in this.dimensionUpdaters)l(f);return s.length?s:null},t.getUpdateTriggers=function(n){var i=this,o=n.updateTriggers||{},a={},s=function(u){var c=i.dimensionUpdaters[u].accessor;a[c]={},Bs.forEach(function(d){Object.values(i.dimensionUpdaters[u][d].triggers).forEach(function(g){var h=g.prop,A=g.updateTrigger;if(A){var _=o[A];ur(_)==="object"&&!Array.isArray(_)?Object.assign(a[c],_):_!==void 0&&(a[c][h]=_)}else a[c][h]=n[h]})})};for(var l in this.dimensionUpdaters)s(l);return a},t.getSortedBins=function(n){for(var i in this.dimensionUpdaters)this.getDimensionSortedBins(n,this.dimensionUpdaters[i])},t.getDimensionSortedBins=function(n,i){var o=i.key,a=this.state.dimensions[o].getValue,s=new mt(this.state.layerData.data||[],{getValue:a,filterData:n._filterData});this.setDimensionState(o,{sortedBins:s}),this.getDimensionValueDomain(n,i)},t.getDimensionValueDomain=function(n,i){var o=i.getDomain,a=i.key,s=o.triggers,l=s.lowerPercentile,f=s.upperPercentile,u=s.scaleType,c=this.state.dimensions[a].sortedBins.getValueDomainByScale(n[u.prop],[n[l.prop],n[f.prop]]);this.setDimensionState(a,{valueDomain:c}),this.getDimensionScale(n,i)},t.getDimensionScale=function(n,i){var o=i.key,a=i.getScaleFunc,s=i.getDomain,l=a.triggers,f=l.domain,u=l.range,c=s.triggers.scaleType,d=a.onSet,g=n[u.prop],h=n[f.prop]||this.state.dimensions[o].valueDomain,A=ps(c&&n[c.prop]),_=A(h,g);ur(d)==="object"&&typeof n[d.props]=="function"&&n[d.props](_.domain()),this.setDimensionState(o,{scaleFunc:_})},t.getSubLayerDimensionAttribute=function(n,i){var o=this;return function(a){var s=o.state.dimensions[n],l=s.sortedBins,f=s.scaleFunc,u=l.binMap[a.index];if(u&&u.counts===0)return i;var c=u&&u.value,d=f.domain(),g=c>=d[0]&&c<=d[d.length-1];return g?f(c):i}},t.getSubLayerAccessors=function(n){var i={};for(var o in this.dimensionUpdaters){var a=this.dimensionUpdaters[o].accessor;i[a]=this.getSubLayerDimensionAttribute(n,o)}return i},t.getPickingInfo=function(n){var i=n.info,o=i.picked&&i.index>-1,a=null;if(o){var s=this.state.layerData.data[i.index],l={};for(var f in this.dimensionUpdaters){var u=this.dimensionUpdaters[f].pickingInfo,c=this.state.dimensions[f].sortedBins,d=c.binMap[s.index]&&c.binMap[s.index].value;l[u]=d}a=Object.assign(l,s,{points:s.filteredPoints||s.points})}return i.picked=Boolean(a),i.object=a,i},t.getAccessor=function(n){return this.dimensionUpdaters.hasOwnProperty(n)?this.dimensionUpdaters[n].attributeAccessor:ws},e}();function on(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?on=function(r){return typeof r}:on=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},on(e)}function Eg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function an(e,t,r){return typeof Reflect<"u"&&Reflect.get?an=Reflect.get:an=function(i,o,a){var s=xg(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},an(e,t,r||e)}function xg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Et(e),e!==null););return e}function Og(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&bi(e,t)}function bi(e,t){return bi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},bi(e,t)}function Cg(e){var t=Mg();return function(){var n=Et(e),i;if(t){var o=Et(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Pg(this,i)}}function Pg(e,t){if(t&&(on(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ng(e)}function Ng(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Et(e){return Et=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Et(e)}function Hs(){}var Ig={colorDomain:null,colorRange:ae,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:Hs,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:Hs,gridAggregator:bt,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Qe=function(e){Og(r,e);var t=Cg(r);function r(){var i;Eg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new yt({getAggregator:function(l){return l.gridAggregator},getCellSize:function(l){return l.cellSize}});this.state={cpuAggregator:o,aggregatorState:o.state};var a=this.getAttributeManager();a.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){an(Et(r.prototype),"updateState",this).call(this,o),this.setState({aggregatorState:this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})},n.getPickingInfo=function(o){var a=o.info;return this.state.cpuAggregator.getPickingInfo({info:a})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,a=o.elevationScale,s=o.extruded,l=o.cellSize,f=o.coverage,u=o.material,c=o.transitions,d=this.state.cpuAggregator,g=this.getSubLayerClass("grid-cell",Vs.GridCellLayer),h=this._getSublayerUpdateTriggers();return new g({cellSize:l,coverage:f,material:u,elevationScale:a,extruded:s,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:c&&{getFillColor:c.getColorValue||c.getColorWeight,getElevation:c.getElevationValue||c.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:h}),{data:d.state.layerData.data})},r}(de);Qe.layerName="CPUGridLayer";Qe.defaultProps=Ig;var $s=P($()),Ks=P(rt());var xt=Math.PI/3,Dg=[0,xt,2*xt,3*xt,4*xt,5*xt];function Fg(e){return e[0]}function wg(e){return e[1]}function Si(){var e=0,t=0,r=1,n=1,i=Fg,o=wg,a,s,l;function f(c){var d={},g=[],h,A=c.length;for(h=0;h<A;++h)if(!(isNaN(v=+i.call(null,_=c[h],h,c))||isNaN(T=+o.call(null,_,h,c)))){var _,v,T,m=Math.round(T=T/l),E=Math.round(v=v/s-(m&1)/2),O=T-m;if(Math.abs(O)*3>1){var C=v-E,N=E+(v<E?-1:1)/2,M=m+(T<m?-1:1),U=v-N,W=T-M;C*C+O*O>U*U+W*W&&(E=N+(m&1?1:-1)/2,m=M)}var j=E+"-"+m,Z=d[j];Z?Z.push(_):(g.push(Z=d[j]=[_]),Z.x=(E+(m&1)/2)*s,Z.y=m*l)}return g}function u(c){var d=0,g=0;return Dg.map(function(h){var A=Math.sin(h)*c,_=-Math.cos(h)*c,v=A-d,T=_-g;return d=A,g=_,[v,T]})}return f.hexagon=function(c){return"m"+u(c==null?a:+c).join("l")+"z"},f.centers=function(){for(var c=[],d=Math.round(t/l),g=Math.round(e/s),h=d*l;h<n+a;h+=l,++d)for(var A=g*s+(d&1)*s/2;A<r+s/2;A+=s)c.push([A,h]);return c},f.mesh=function(){var c=u(a).slice(0,4).join("l");return f.centers().map(function(d){return"M"+d+"m"+c}).join("")},f.x=function(c){return arguments.length?(i=c,f):i},f.y=function(c){return arguments.length?(o=c,f):o},f.radius=function(c){return arguments.length?(a=+c,s=a*2*Math.sin(xt),l=a*1.5,f):a},f.size=function(c){return arguments.length?(e=t=0,r=+c[0],n=+c[1],f):[r-e,n-t]},f.extent=function(c){return arguments.length?(e=+c[0][0],t=+c[0][1],r=+c[1][0],n=+c[1][1],f):[[e,t],[r,n]]},f.radius(1)}var sn=P($());function Bg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Ug(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
521
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Ug(e,t){if(e){if(typeof e=="string")return Xs(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Xs(e,t)}}function Xs(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ls(e,t){var r=e.data,n=e.radius,i=t.viewport,o=t.attributes,a=r.length?Wg(r,t):null,s=Hg(n,i,a),l=[],f=(0,sn.createIterable)(r),u=f.iterable,c=f.objectInfo,d=o.positions.value,g=o.positions.getAccessor(),h=g.size,A=Bg(u),_;try{for(A.s();!(_=A.n()).done;){var v=_.value;c.index++;var T=c.index*h,m=[d[T],d[T+1]],E=Number.isFinite(m[0])&&Number.isFinite(m[1]);E?l.push({screenCoord:i.projectFlat(m),source:v,index:c.index}):sn.log.warn("HexagonLayer: invalid position")()}}catch(N){A.e(N)}finally{A.f()}var O=Si().radius(s).x(function(N){return N.screenCoord[0]}).y(function(N){return N.screenCoord[1]}),C=O(l);return{hexagons:C.map(function(N,M){return{position:i.unprojectFlat([N.x,N.y]),points:N,index:M}}),radiusCommon:s}}function Wg(e,t){var r=t.attributes,n=r.positions.value,i=r.positions.getAccessor(),o=i.size,a=1/0,s=1/0,l=-1/0,f=-1/0,u;for(u=0;u<o*e.length;u+=o){var c=n[u],d=n[u+1],g=Number.isFinite(c)&&Number.isFinite(d);g&&(a=Math.min(c,a),l=Math.max(c,l),s=Math.min(d,s),f=Math.max(d,f))}return[a,s,l,f].every(Number.isFinite)?[(a+l)/2,(s+f)/2]:null}function Hg(e,t,r){var n=t.getDistanceScales(r),i=n.unitsPerMeter;return e*i[0]}function ln(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ln=function(r){return typeof r}:ln=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ln(e)}function zs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function js(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?zs(Object(r),!0).forEach(function(n){Vg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zs(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function fn(e,t,r){return typeof Reflect<"u"&&Reflect.get?fn=Reflect.get:fn=function(i,o,a){var s=Lg(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},fn(e,t,r||e)}function Lg(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ot(e),e!==null););return e}function zg(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ri(e,t)}function Ri(e,t){return Ri=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ri(e,t)}function jg(e){var t=Kg();return function(){var n=Ot(e),i;if(t){var o=Ot(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return kg(this,i)}}function kg(e,t){if(t&&(ln(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return $g(e)}function $g(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Kg(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ot(e){return Ot=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ot(e)}function ks(){}var Yg={colorDomain:null,colorRange:ae,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:ks,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:ks,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Ls,getPosition:{type:"accessor",value:function(t){return t.position}},material:!0,_filterData:{type:"function",value:null,optional:!0}},un=function(e){zg(r,e);var t=jg(r);function r(){var i;Xg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=new yt({getAggregator:function(l){return l.hexagonAggregator},getCellSize:function(l){return l.radius}});this.state={cpuAggregator:o,aggregatorState:o.state,vertices:null};var a=this.getAttributeManager();a.add({positions:{size:3,type:5130,accessor:"getPosition"}})},n.updateState=function(o){if(fn(Ot(r.prototype),"updateState",this).call(this,o),o.changeFlags.propsOrDataChanged){var a=this.state.cpuAggregator.updateState(o,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==a.layerData){var s=a.layerData||{},l=s.hexagonVertices;this.setState({vertices:l&&this.convertLatLngToMeterOffset(l)})}this.setState({aggregatorState:a})}},n.convertLatLngToMeterOffset=function(o){var a=this.context.viewport;if(Array.isArray(o)&&o.length===6){var s=o[0],l=o[3],f=[(s[0]+l[0])/2,(s[1]+l[1])/2],u=a.projectFlat(f),c=a.getDistanceScales(f),d=c.metersPerUnit,g=o.map(function(h){var A=a.projectFlat(h);return[(A[0]-u[0])*d[0],(A[1]-u[1])*d[1]]});return g}return $s.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null},n.getPickingInfo=function(o){var a=o.info;return this.state.cpuAggregator.getPickingInfo({info:a})},n._onGetSublayerColor=function(o){return this.state.cpuAggregator.getAccessor("fillColor")(o)},n._onGetSublayerElevation=function(o){return this.state.cpuAggregator.getAccessor("elevation")(o)},n._getSublayerUpdateTriggers=function(){return this.state.cpuAggregator.getUpdateTriggers(this.props)},n.renderLayers=function(){var o=this.props,a=o.elevationScale,s=o.extruded,l=o.coverage,f=o.material,u=o.transitions,c=this.state,d=c.aggregatorState,g=c.vertices,h=this.getSubLayerClass("hexagon-cell",Ks.ColumnLayer),A=this._getSublayerUpdateTriggers(),_=g?{vertices:g,radius:1}:{radius:d.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new h(js(js({},_),{},{diskResolution:6,elevationScale:a,extruded:s,coverage:l,material:f,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:u&&{getFillColor:u.getColorValue||u.getColorWeight,getElevation:u.getElevationValue||u.getElevationWeight}}),this.getSubLayerProps({id:"hexagon-cell",updateTriggers:A}),{data:d.layerData.data})},r}(de);un.layerName="HexagonLayer";un.defaultProps=Yg;var pn=P(rt());var bl=P($());var S;function R(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=.5,x=1/6,p={N:[0,b],E:[b,0],S:[0,-b],W:[-b,0],NE:[b,b],NW:[-b,b],SE:[b,-b],SW:[-b,-b]},Ct=[p.W,p.SW,p.S],Pt=[p.S,p.SE,p.E],Nt=[p.E,p.NE,p.N],Mt=[p.NW,p.W,p.N],It=[[-b,x],[-b,-x],[-x,-b],[x,-b]],Dt=[[-x,-b],[x,-b],[b,-x],[b,x]],Ft=[[b,-x],[b,x],[x,b],[-x,b]],wt=[[-b,x],[-b,-x],[x,b],[-x,b]],Ys=[p.W,p.SW,p.SE,p.E],Zs=[p.S,p.SE,p.NE,p.N],qs=[p.NW,p.W,p.E,p.NE],Qs=[p.NW,p.SW,p.S,p.N],Js=[[-b,x],[-b,-x],[b,-x],[b,x]],Gs=[[-x,-b],[x,-b],[x,b],[-x,b]],Zg=[p.NW,p.SW,p.SE,p.NE],el=[p.NW,p.SW,p.SE,p.E,p.N],tl=[p.W,p.SW,p.SE,p.NE,p.N],rl=[p.NW,p.W,p.S,p.SE,p.NE],nl=[p.NW,p.SW,p.S,p.E,p.NE],il=[p.NW,p.W,[b,-x],[b,x],p.N],ol=[[-x,-b],[x,-b],p.E,p.NE,p.N],al=[[-b,x],[-b,-x],p.S,p.SE,p.E],sl=[p.W,p.SW,p.S,[x,b],[-x,b]],ll=[p.NW,p.W,[-x,-b],[x,-b],p.N],fl=[[-b,x],[-b,-x],p.E,p.NE,p.N],ul=[p.S,p.SE,p.E,[x,b],[-x,b]],cl=[p.W,p.SW,p.S,[b,-x],[b,x]],dl=[p.W,p.SW,p.SE,p.E,[x,b],[-x,b]],gl=[[-b,x],[-b,-x],p.S,p.SE,p.NE,p.N],hl=[p.NW,p.W,[-x,-b],[x,-b],p.E,p.NE],_l=[p.NW,p.SW,p.S,[b,-x],[b,x],p.N],Bt=[p.W,p.SW,p.S,p.E,p.NE,p.N],Ut=[p.NW,p.W,p.S,p.SE,p.E,p.N],cn=[[-b,x],[-b,-x],[-x,-b],[x,-b],p.E,p.NE,p.N],dn=[p.W,p.SW,p.S,[b,-x],[b,x],[x,b],[-x,b]],gn=[p.NW,p.W,[-x,-b],[x,-b],[b,-x],[b,x],p.N],hn=[[-b,x],[-b,-x],p.S,p.SE,p.E,[x,b],[-x,b]],pl=[[-b,x],[-b,-x],[-x,-b],[x,-b],[b,-x],[b,x],[x,b],[-x,b]],Al={0:[],1:[[p.W,p.S]],2:[[p.S,p.E]],3:[[p.W,p.E]],4:[[p.N,p.E]],5:{0:[[p.W,p.S],[p.N,p.E]],1:[[p.W,p.N],[p.S,p.E]]},6:[[p.N,p.S]],7:[[p.W,p.N]],8:[[p.W,p.N]],9:[[p.N,p.S]],10:{0:[[p.W,p.N],[p.S,p.E]],1:[[p.W,p.S],[p.N,p.E]]},11:[[p.N,p.E]],12:[[p.W,p.E]],13:[[p.S,p.E]],14:[[p.W,p.S]],15:[]};function y(e){return parseInt(e,4)}var Tl=(S={},R(S,y("0000"),[]),R(S,y("2222"),[]),R(S,y("2221"),[Ct]),R(S,y("2212"),[Pt]),R(S,y("2122"),[Nt]),R(S,y("1222"),[Mt]),R(S,y("0001"),[Ct]),R(S,y("0010"),[Pt]),R(S,y("0100"),[Nt]),R(S,y("1000"),[Mt]),R(S,y("2220"),[It]),R(S,y("2202"),[Dt]),R(S,y("2022"),[Ft]),R(S,y("0222"),[wt]),R(S,y("0002"),[It]),R(S,y("0020"),[Dt]),R(S,y("0200"),[Ft]),R(S,y("2000"),[wt]),R(S,y("0011"),[Ys]),R(S,y("0110"),[Zs]),R(S,y("1100"),[qs]),R(S,y("1001"),[Qs]),R(S,y("2211"),[Ys]),R(S,y("2112"),[Zs]),R(S,y("1122"),[qs]),R(S,y("1221"),[Qs]),R(S,y("2200"),[Js]),R(S,y("2002"),[Gs]),R(S,y("0022"),[Js]),R(S,y("0220"),[Gs]),R(S,y("1111"),[Zg]),R(S,y("1211"),[el]),R(S,y("2111"),[tl]),R(S,y("1112"),[rl]),R(S,y("1121"),[nl]),R(S,y("1011"),[el]),R(S,y("0111"),[tl]),R(S,y("1110"),[rl]),R(S,y("1101"),[nl]),R(S,y("1200"),[il]),R(S,y("0120"),[ol]),R(S,y("0012"),[al]),R(S,y("2001"),[sl]),R(S,y("1022"),[il]),R(S,y("2102"),[ol]),R(S,y("2210"),[al]),R(S,y("0221"),[sl]),R(S,y("1002"),[ll]),R(S,y("2100"),[fl]),R(S,y("0210"),[ul]),R(S,y("0021"),[cl]),R(S,y("1220"),[ll]),R(S,y("0122"),[fl]),R(S,y("2012"),[ul]),R(S,y("2201"),[cl]),R(S,y("0211"),[dl]),R(S,y("2110"),[gl]),R(S,y("1102"),[hl]),R(S,y("1021"),[_l]),R(S,y("2011"),[dl]),R(S,y("0112"),[gl]),R(S,y("1120"),[hl]),R(S,y("1201"),[_l]),R(S,y("2101"),[Bt]),R(S,y("0121"),[Bt]),R(S,y("1012"),[Ut]),R(S,y("1210"),[Ut]),R(S,y("0101"),{0:[Ct,Nt],1:[Bt],2:[Bt]}),R(S,y("1010"),{0:[Mt,Pt],1:[Ut],2:[Ut]}),R(S,y("2121"),{0:[Bt],1:[Bt],2:[Ct,Nt]}),R(S,y("1212"),{0:[Ut],1:[Ut],2:[Mt,Pt]}),R(S,y("2120"),{0:[cn],1:[cn],2:[It,Nt]}),R(S,y("2021"),{0:[dn],1:[dn],2:[Ct,Ft]}),R(S,y("1202"),{0:[gn],1:[gn],2:[Mt,Dt]}),R(S,y("0212"),{0:[hn],1:[hn],2:[Pt,wt]}),R(S,y("0102"),{0:[It,Nt],1:[cn],2:[cn]}),R(S,y("0201"),{0:[Ct,Ft],1:[dn],2:[dn]}),R(S,y("1020"),{0:[Mt,Dt],1:[gn],2:[gn]}),R(S,y("2010"),{0:[Pt,wt],1:[hn],2:[hn]}),R(S,y("2020"),{0:[wt,Dt],1:[pl],2:[It,Ft]}),R(S,y("0202"),{0:[Ft,It],1:[pl],2:[wt,Dt]}),S);function vl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function ml(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vl(Object(r),!0).forEach(function(n){qg(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function qg(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Je={ISO_LINES:1,ISO_BANDS:2},Qg={zIndex:0,zOffset:.005};function cr(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function Sl(e){var t=e.cellWeights,r=e.x,n=e.y,i=e.width,o=e.height,a=e.threshold;e.thresholdValue&&(bl.log.deprecated("thresholdValue","threshold")(),a=e.thresholdValue);var s=r<0,l=r>=i-1,f=n<0,u=n>=o-1,c=s||l||f||u,d={},g={};s||u?g.top=0:(d.top=t[(n+1)*i+r],g.top=cr(d.top,a)),l||u?g.topRight=0:(d.topRight=t[(n+1)*i+r+1],g.topRight=cr(d.topRight,a)),l||f?g.right=0:(d.right=t[n*i+r+1],g.right=cr(d.right,a)),s||f?g.current=0:(d.current=t[n*i+r],g.current=cr(d.current,a));var h=g.top,A=g.topRight,_=g.right,v=g.current,T=-1;Number.isFinite(a)&&(T=h<<3|A<<2|_<<1|v),Array.isArray(a)&&(T=h<<6|A<<4|_<<2|v);var m=0;return c||(m=cr((d.top+d.topRight+d.right+d.current)/4,a)),{code:T,meanCode:m}}function yi(e){var t=e.gridOrigin,r=e.cellSize,n=e.x,i=e.y,o=e.code,a=e.meanCode,s=e.type,l=s===void 0?Je.ISO_LINES:s,f=ml(ml({},Qg),e.thresholdData),u=l===Je.ISO_BANDS?Tl[o]:Al[o];Array.isArray(u)||(u=u[a]);var c=f.zIndex*f.zOffset,d=(n+1)*r[0],g=(i+1)*r[1],h=t[0]+d,A=t[1]+g;if(l===Je.ISO_BANDS){var _=[];return u.forEach(function(T){var m=[];T.forEach(function(E){var O=h+E[0]*r[0],C=A+E[1]*r[1];m.push([O,C,c])}),_.push(m)}),_}var v=[];return u.forEach(function(T){T.forEach(function(m){var E=h+m[0]*r[0],O=A+m[1]*r[1];v.push([E,O,c])})}),v}function Rl(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Jg(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
522
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function Jg(e,t){if(e){if(typeof e=="string")return yl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yl(e,t)}}function yl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function El(e){var t=e.thresholdData,r=e.cellWeights,n=e.gridSize,i=e.gridOrigin,o=e.cellSize,a=[],s=[],l=n[0],f=n[1],u=0,c=0,d=Rl(t),g;try{for(d.s();!(g=d.n()).done;)for(var h=g.value,A=h.contour,_=A.threshold,v=-1;v<l;v++)for(var T=-1;T<f;T++){var m=Sl({cellWeights:r,threshold:_,x:v,y:T,width:l,height:f}),E=m.code,O=m.meanCode,C={type:Je.ISO_BANDS,gridOrigin:i,cellSize:o,x:v,y:T,width:l,height:f,code:E,meanCode:O,thresholdData:h};if(Array.isArray(_)){C.type=Je.ISO_BANDS;var N=yi(C),M=Rl(N),U;try{for(M.s();!(U=M.n()).done;){var W=U.value;s[c++]={vertices:W,contour:A}}}catch(oe){M.e(oe)}finally{M.f()}}else{C.type=Je.ISO_LINES;for(var j=yi(C),Z=0;Z<j.length;Z+=2)a[u++]={start:j[Z],end:j[Z+1],contour:A}}}}catch(oe){d.e(oe)}finally{d.f()}return{contourSegments:a,contourPolygons:s}}var Pl=P($());function _n(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?_n=function(r){return typeof r}:_n=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_n(e)}function xl(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gg(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function dr(e,t,r){return typeof Reflect<"u"&&Reflect.get?dr=Reflect.get:dr=function(i,o,a){var s=eh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},dr(e,t,r||e)}function eh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ge(e),e!==null););return e}function th(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ei(e,t)}function Ei(e,t){return Ei=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ei(e,t)}function rh(e){var t=oh();return function(){var n=Ge(e),i;if(t){var o=Ge(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return nh(this,i)}}function nh(e,t){if(t&&(_n(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ih(e)}function ih(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function oh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ge(e){return Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ge(e)}var Ol=[255,255,255,255],ah=1,sh=1,lh={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},gpuAggregation:!0,aggregation:"SUM",contours:{type:"object",value:[{threshold:sh}],optional:!0,compare:3},zOffset:.005},Cl="positions",fh={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},An=function(e){th(r,e);var t=rh(r);function r(){var i;Gg(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o;dr(Ge(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:fh}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:w.SUM}}});var a=this.getAttributeManager();a.add((o={},xl(o,Cl,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),xl(o,"count",{size:3,accessor:"getWeight"}),o))},n.updateState=function(o){dr(Ge(r.prototype),"updateState",this).call(this,o);var a=!1,s=o.oldProps,l=o.props,f=this.state.aggregationDirty;(s.contours!==l.contours||s.zOffset!==l.zOffset)&&(a=!0,this._updateThresholdData(o.props)),this.getNumInstances()>0&&(f||a)&&this._generateContours()},n.renderLayers=function(){var o=this.state.contourData,a=o.contourSegments,s=o.contourPolygons,l=this.getSubLayerClass("lines",pn.LineLayer),f=this.getSubLayerClass("bands",pn.SolidPolygonLayer),u=a&&a.length>0&&new l(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:function(g){return g.start},getTargetPosition:function(g){return g.end},getColor:function(g){return g.contour.color||Ol},getWidth:function(g){return g.contour.strokeWidth||ah}}),c=s&&s.length>0&&new f(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:function(g){return g.vertices},getFillColor:function(g){return g.contour.color||Ol}});return[u,c]},n.updateAggregationState=function(o){var a=o.props,s=o.oldProps,l=a.cellSize,f=a.coordinateSystem,u=this.context.viewport,c=s.cellSize!==l,d=a.gpuAggregation;this.state.gpuAggregation!==a.gpuAggregation&&d&&!ee.isSupported(this.context.device)&&(Pl.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),d=!1);var g=d!==this.state.gpuAggregation;this.setState({gpuAggregation:d});var h=this.state.dimensions,A=this.isAttributeChanged(Cl),_=h.data,v=h.weights,T=this.state.boundingBox;if(A&&(T=Gr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:T})),A||c){var m=en(T,l,u,f),E=m.gridOffset,O=m.translation,C=m.width,N=m.height,M=m.numCol,U=m.numRow;this.allocateResources(U,M),this.setState({gridOffset:E,boundingBox:T,translation:O,posOffset:O.slice(),gridOrigin:[-1*O[0],-1*O[1]],width:C,height:N,numCol:M,numRow:U})}var W=A||g||this.isAggregationDirty(o,{dimension:_,compareAll:d}),j=this.isAggregationDirty(o,{dimension:v});j&&this._updateAccessors(o),(W||j)&&this._resetResults(),this.setState({aggregationDataDirty:W,aggregationWeightsDirty:j})},n._updateAccessors=function(o){var a=o.props,s=a.getWeight,l=a.aggregation,f=a.data,u=this.state.weights.count;u&&(u.getWeight=s,u.operation=w[l]),this.setState({getValue:gt(l,s,{data:f})})},n._resetResults=function(){var o=this.state.weights.count;o&&(o.aggregationData=null)},n._generateContours=function(){var o=this.state,a=o.numCol,s=o.numRow,l=o.gridOrigin,f=o.gridOffset,u=o.thresholdData,c=this.state.weights.count,d=c.aggregationData;d||(d=c.aggregationBuffer.getData(),c.aggregationData=d);var g=ee.getCellData({countsData:d}),h=g.cellWeights,A=El({thresholdData:u,cellWeights:h,gridSize:[a,s],gridOrigin:l,cellSize:[f.xOffset,f.yOffset]});this.setState({contourData:A})},n._updateThresholdData=function(o){for(var a=o.contours,s=o.zOffset,l=a.length,f=new Array(l),u=0;u<l;u++){var c=a[u];f[u]={contour:c,zIndex:c.zIndex||u,zOffset:s}}this.setState({thresholdData:f})},r}(qe);An.layerName="ContourLayer";An.defaultProps=lh;var Hl=P($());var Ul=P($());var ie=P($());var Nl=`#version 300 es
|
|
503
523
|
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
504
524
|
#define RANGE_COUNT 6
|
|
505
525
|
|
|
@@ -605,7 +625,7 @@ void main(void) {
|
|
|
605
625
|
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
606
626
|
}
|
|
607
627
|
}
|
|
608
|
-
`;var
|
|
628
|
+
`;var Ml=`#version 300 es
|
|
609
629
|
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
|
|
610
630
|
|
|
611
631
|
precision highp float;
|
|
@@ -618,9 +638,10 @@ void main(void) {
|
|
|
618
638
|
fragColor = vColor;
|
|
619
639
|
fragColor = picking_filterColor(fragColor);
|
|
620
640
|
}
|
|
621
|
-
`;function hn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hn=function(r){return typeof r}:hn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hn(e)}function vu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function bu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?vu(Object(r),!0).forEach(function(n){id(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function id(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function od(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function An(e,t,r){return typeof Reflect<"u"&&Reflect.get?An=Reflect.get:An=function(o,a,s){var u=ad(o,a);if(u){var l=Object.getOwnPropertyDescriptor(u,a);return l.get?l.get.call(s):l.value}},An(e,t,r||e)}function ad(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Vt(e),e!==null););return e}function sd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xi(e,t)}function xi(e,t){return xi=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},xi(e,t)}function ud(e){var t=cd();return function(){var n=Vt(e),o;if(t){var a=Vt(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return ld(this,o)}}function ld(e,t){if(t&&(hn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fd(e)}function fd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function cd(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Vt(e){return Vt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Vt(e)}var yi=0,Ii=1,_d={colorDomain:null,colorRange:le,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},pn=function(e){sd(r,e);var t=ud(r);function r(){var o;od(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.getShaders=function(){return An(Vt(r.prototype),"getShaders",this).call(this,{vs:Su,fs:Ou,modules:[ae.project32,ae.gouraudLighting,ae.picking,st]})},n.initializeState=function(){var a=this.getAttributeManager();a.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var s=this._getModel();this._setupUniformBuffer(s),this.setState({model:s})},n._getModel=function(){return new J(this.context.device,bu(bu({},this.getShaders()),{},{id:this.props.id,geometry:new Yt,isInstanced:!0}))},n.draw=function(a){var s=a.uniforms,u=this.props,l=u.cellSize,f=u.offset,c=u.extruded,_=u.elevationScale,E=u.coverage,d=u.gridSize,h=u.gridOrigin,p=u.gridOffset,g=u.elevationRange,T=u.colorMaxMinBuffer,m=u.elevationMaxMinBuffer,R=this.state.model,S=[(0,ae.fp64LowPart)(h[0]),(0,ae.fp64LowPart)(h[1])],y=[(0,ae.fp64LowPart)(p[0]),(0,ae.fp64LowPart)(p[1])],I=this.getDomainUniforms(),P=Xe(this.props.colorRange);this.bindUniformBuffers(T,m),R.setUniforms(s),R.setUniforms(I),R.setUniforms({cellSize:l,offset:f,extruded:c,elevationScale:_,coverage:E,gridSize:d,gridOrigin:h,gridOriginLow:S,gridOffset:p,gridOffsetLow:y,colorRange:P,elevationRange:g}),R.draw(this.context.renderPass),this.unbindUniformBuffers(T,m)},n.bindUniformBuffers=function(a,s){a.bind({target:35345,index:yi}),s.bind({target:35345,index:Ii})},n.unbindUniformBuffers=function(a,s){a.unbind({target:35345,index:yi}),s.unbind({target:35345,index:Ii})},n.getDomainUniforms=function(){var a=this.props,s=a.colorDomain,u=a.elevationDomain,l={};return s!==null?(l.colorDomainValid=!0,l.colorDomain=s):l.colorDomainValid=!1,u!==null?(l.elevationDomainValid=!0,l.elevationDomain=u):l.elevationDomainValid=!1,l},n._setupUniformBuffer=function(a){var s=a.pipeline.handle,u=this.context.gl,l=u.getUniformBlockIndex(s,"ColorData"),f=u.getUniformBlockIndex(s,"ElevationData");u.uniformBlockBinding(s,l,yi),u.uniformBlockBinding(s,f,Ii)},r}(ae.Layer);pn.layerName="GPUGridCellLayer";pn.defaultProps=_d;function Tn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Tn=function(r){return typeof r}:Tn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Tn(e)}function Nu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Cu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nu(Object(r),!0).forEach(function(n){Rn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Rn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ed(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Kt(e,t,r){return typeof Reflect<"u"&&Reflect.get?Kt=Reflect.get:Kt=function(o,a,s){var u=dd(o,a);if(u){var l=Object.getOwnPropertyDescriptor(u,a);return l.get?l.get.call(s):l.value}},Kt(e,t,r||e)}function dd(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ke(e),e!==null););return e}function gd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pi(e,t)}function Pi(e,t){return Pi=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},Pi(e,t)}function hd(e){var t=Td();return function(){var n=Ke(e),o;if(t){var a=Ke(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return Ad(this,o)}}function Ad(e,t){if(t&&(Tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pd(e)}function pd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Td(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ke(e){return Ke=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ke(e)}var Rd={colorDomain:null,colorRange:le,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0},md={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},yu="positions",rt=function(e){gd(r,e);var t=hd(r);function r(){var o;Ed(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.initializeState=function(a){var s,u=a.device,l=Q.isSupported(u);l||Iu.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),Kt(Ke(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:md}),this.setState({gpuAggregation:!0,projectPoints:!1,isSupported:l,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:u.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:u.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var f=this.getAttributeManager();f.add((s={},Rn(s,yu,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),Rn(s,"color",{size:3,accessor:"getColorWeight"}),Rn(s,"elevation",{size:3,accessor:"getElevationWeight"}),s))},n.updateState=function(a){if(this.state.isSupported!==!1){Kt(Ke(r.prototype),"updateState",this).call(this,a);var s=this.state.aggregationDirty;s&&this.setState({gridHash:null})}},n.getHashKeyForIndex=function(a){var s=this.state,u=s.numRow,l=s.numCol,f=s.boundingBox,c=s.gridOffset,_=[l,u],E=[f.xMin,f.yMin],d=[c.xOffset,c.yOffset],h=Math.floor(a/_[0]),p=a-h*_[0],g=Math.floor((h*d[1]+E[1]+90+d[1]/2)/d[1]),T=Math.floor((p*d[0]+E[0]+180+d[0]/2)/d[0]);return"".concat(g,"-").concat(T)},n.getPositionForIndex=function(a){var s=this.state,u=s.numRow,l=s.numCol,f=s.boundingBox,c=s.gridOffset,_=[l,u],E=[f.xMin,f.yMin],d=[c.xOffset,c.yOffset],h=Math.floor(a/_[0]),p=a-h*_[0],g=h*d[1]+E[1],T=p*d[0]+E[0];return[T,g]},n.getPickingInfo=function(a){var s=a.info,u=a.mode,l=s.index,f=null;if(l>=0){var c=this.state.gpuGridAggregator,_=this.getPositionForIndex(l),E=Q.getAggregationData(Cu({pixelIndex:l},c.getData("color"))),d=Q.getAggregationData(Cu({pixelIndex:l},c.getData("elevation")));if(f={colorValue:E.cellWeight,elevationValue:d.cellWeight,count:E.cellCount||d.cellCount,position:_,totalCount:E.totalCount||d.totalCount},u!=="hover"){var h=this.props,p=this.state.gridHash;if(!p){var g=this.state,T=g.gridOffset,m=g.translation,R=g.boundingBox,S=this.context.viewport,y=this.getAttributes(),I=bt(h,{gridOffset:T,attributes:y,viewport:S,translation:m,boundingBox:R});p=I.gridHash,this.setState({gridHash:p})}var P=this.getHashKeyForIndex(l),M=p[P];Object.assign(f,M)}}return s.picked=Boolean(f),s.object=f,s},n.renderLayers=function(){if(!this.state.isSupported)return null;var a=this.props,s=a.elevationScale,u=a.extruded,l=a.cellSize,f=a.coverage,c=a.material,_=a.elevationRange,E=a.colorDomain,d=a.elevationDomain,h=this.state,p=h.weights,g=h.numRow,T=h.numCol,m=h.gridOrigin,R=h.gridOffset,S=p.color,y=p.elevation,I=Xe(this.props.colorRange),P=this.getSubLayerClass("gpu-grid-cell",pn);return new P({gridSize:[T,g],gridOrigin:m,gridOffset:[R.xOffset,R.yOffset],colorRange:I,elevationRange:_,colorDomain:E,elevationDomain:d,cellSize:l,coverage:f,material:c,elevationScale:s,extruded:u},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:S.aggregationBuffer,elevations:y.aggregationBuffer}},colorMaxMinBuffer:S.maxMinBuffer,elevationMaxMinBuffer:y.maxMinBuffer,numInstances:T*g})},n.finalizeState=function(a){var s=this.state.weights,u=s.color,l=s.elevation;[u,l].forEach(function(f){var c=f.aggregationBuffer,_=f.maxMinBuffer;_?.destroy(),c?.destroy()}),Kt(Ke(r.prototype),"finalizeState",this).call(this,a)},n.updateAggregationState=function(a){var s=a.props,u=a.oldProps,l=s.cellSize,f=s.coordinateSystem,c=this.context.viewport,_=u.cellSize!==l,E=this.state.dimensions,d=this.isAttributeChanged(yu),h=d||this.isAttributeChanged(),p=this.state.boundingBox;if(d&&(p=qr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:p})),d||_){var g=Qr(p,l,c,f),T=g.gridOffset,m=g.translation,R=g.width,S=g.height,y=g.numCol,I=g.numRow;this.allocateResources(I,y),this.setState({gridOffset:T,translation:m,gridOrigin:[-1*m[0],-1*m[1]],width:R,height:S,numCol:y,numRow:I})}var P=h||this.isAggregationDirty(a,{dimension:E.data,compareAll:!0});P&&this._updateAccessors(a),this.setState({aggregationDataDirty:P})},n._updateAccessors=function(a){var s=a.props,u=s.colorAggregation,l=s.elevationAggregation,f=this.state.weights,c=f.color,_=f.elevation;c.operation=w[u],_.operation=w[l]},r}(Qe);rt.layerName="GPUGridLayer";rt.defaultProps=Rd;function mn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mn=function(r){return typeof r}:mn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mn(e)}function Sd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Od(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fi(e,t)}function Fi(e,t){return Fi=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},Fi(e,t)}function vd(e){var t=Cd();return function(){var n=Sn(e),o;if(t){var a=Sn(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return bd(this,o)}}function bd(e,t){if(t&&(mn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nd(e)}function Nd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Cd(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Sn(e){return Sn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Sn(e)}function xu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Mi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xu(Object(r),!0).forEach(function(n){yd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Id=Mi(Mi(Mi({},rt.defaultProps),Je.defaultProps),{},{gpuAggregation:!1}),On=function(e){Od(r,e);var t=vd(r);function r(){var o;Sd(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.initializeState=function(){this.state={useGPUAggregation:!0}},n.updateState=function(a){var s=a.props;this.setState({useGPUAggregation:this.canUseGPUAggregation(s)})},n.renderLayers=function(){var a=this.props,s=a.data,u=a.updateTriggers,l=this.state.useGPUAggregation?"GPU":"CPU",f=this.state.useGPUAggregation?this.getSubLayerClass("GPU",rt):this.getSubLayerClass("CPU",Je);return new f(this.props,this.getSubLayerProps({id:l,updateTriggers:u}),{data:s})},n.canUseGPUAggregation=function(a){var s=a.gpuAggregation,u=a.lowerPercentile,l=a.upperPercentile,f=a.getColorValue,c=a.getElevationValue,_=a.colorScaleType;return!(!s||!Q.isSupported(this.context.device)||u!==0||l!==100||f!==null||c!==null||_==="quantile"||_==="ordinal")},r}(Pu.CompositeLayer);On.layerName="GridLayer";On.defaultProps=Id;function Du(e,t){return Md(e)||Pd(e,t)||Bu(e,t)||xd()}function xd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
622
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
623
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
641
|
+
`;function Tn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Tn=function(r){return typeof r}:Tn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Tn(e)}function Il(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Dl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Il(Object(r),!0).forEach(function(n){uh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Il(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ch(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function vn(e,t,r){return typeof Reflect<"u"&&Reflect.get?vn=Reflect.get:vn=function(i,o,a){var s=dh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},vn(e,t,r||e)}function dh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Wt(e),e!==null););return e}function gh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ci(e,t)}function Ci(e,t){return Ci=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Ci(e,t)}function hh(e){var t=Ah();return function(){var n=Wt(e),i;if(t){var o=Wt(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return _h(this,i)}}function _h(e,t){if(t&&(Tn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ph(e)}function ph(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ah(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Wt(e){return Wt=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Wt(e)}var xi=0,Oi=1,Th={colorDomain:null,colorRange:ae,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},mn=function(e){gh(r,e);var t=hh(r);function r(){var i;ch(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return vn(Wt(r.prototype),"getShaders",this).call(this,{vs:Nl,fs:Ml,modules:[ie.project32,ie.gouraudLighting,ie.picking,it]})},n.initializeState=function(){var o=this.getAttributeManager();o.addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});var a=this._getModel();this._setupUniformBuffer(a),this.setState({model:a})},n._getModel=function(){return new Y(this.context.device,Dl(Dl({},this.getShaders()),{},{id:this.props.id,geometry:new kt,isInstanced:!0}))},n.draw=function(o){var a=o.uniforms,s=this.props,l=s.cellSize,f=s.offset,u=s.extruded,c=s.elevationScale,d=s.coverage,g=s.gridSize,h=s.gridOrigin,A=s.gridOffset,_=s.elevationRange,v=s.colorMaxMinBuffer,T=s.elevationMaxMinBuffer,m=this.state.model,E=[(0,ie.fp64LowPart)(h[0]),(0,ie.fp64LowPart)(h[1])],O=[(0,ie.fp64LowPart)(A[0]),(0,ie.fp64LowPart)(A[1])],C=this.getDomainUniforms(),N=We(this.props.colorRange);this.bindUniformBuffers(v,T),m.setUniforms(a),m.setUniforms(C),m.setUniforms({cellSize:l,offset:f,extruded:u,elevationScale:c,coverage:d,gridSize:g,gridOrigin:h,gridOriginLow:E,gridOffset:A,gridOffsetLow:O,colorRange:N,elevationRange:_}),m.draw(this.context.renderPass),this.unbindUniformBuffers(v,T)},n.bindUniformBuffers=function(o,a){o.bind({target:35345,index:xi}),a.bind({target:35345,index:Oi})},n.unbindUniformBuffers=function(o,a){o.unbind({target:35345,index:xi}),a.unbind({target:35345,index:Oi})},n.getDomainUniforms=function(){var o=this.props,a=o.colorDomain,s=o.elevationDomain,l={};return a!==null?(l.colorDomainValid=!0,l.colorDomain=a):l.colorDomainValid=!1,s!==null?(l.elevationDomainValid=!0,l.elevationDomain=s):l.elevationDomainValid=!1,l},n._setupUniformBuffer=function(o){var a=o.pipeline.handle,s=this.context.gl,l=s.getUniformBlockIndex(a,"ColorData"),f=s.getUniformBlockIndex(a,"ElevationData");s.uniformBlockBinding(a,l,xi),s.uniformBlockBinding(a,f,Oi)},r}(ie.Layer);mn.layerName="GPUGridCellLayer";mn.defaultProps=Th;function bn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bn=function(r){return typeof r}:bn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bn(e)}function Fl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function wl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fl(Object(r),!0).forEach(function(n){Sn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ht(e,t,r){return typeof Reflect<"u"&&Reflect.get?Ht=Reflect.get:Ht=function(i,o,a){var s=mh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},Ht(e,t,r||e)}function mh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Le(e),e!==null););return e}function bh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pi(e,t)}function Pi(e,t){return Pi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Pi(e,t)}function Sh(e){var t=Eh();return function(){var n=Le(e),i;if(t){var o=Le(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Rh(this,i)}}function Rh(e,t){if(t&&(bn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yh(e)}function yh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Eh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Le(e){return Le=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Le(e)}var xh={colorDomain:null,colorRange:ae,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:function(t){return t.position}},extruded:!1,material:!0},Oh={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},Bl="positions",et=function(e){bh(r,e);var t=Sh(r);function r(){var i;vh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(o){var a,s=o.device,l=ee.isSupported(s);l||Ul.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),Ht(Le(r.prototype),"initializeAggregationLayer",this).call(this,{dimensions:Oh}),this.setState({gpuAggregation:!0,projectPoints:!1,isSupported:l,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:s.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:s.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"});var f=this.getAttributeManager();f.add((a={},Sn(a,Bl,{size:3,accessor:"getPosition",type:5130,fp64:this.use64bitPositions()}),Sn(a,"color",{size:3,accessor:"getColorWeight"}),Sn(a,"elevation",{size:3,accessor:"getElevationWeight"}),a))},n.updateState=function(o){if(this.state.isSupported!==!1){Ht(Le(r.prototype),"updateState",this).call(this,o);var a=this.state.aggregationDirty;a&&this.setState({gridHash:null})}},n.getHashKeyForIndex=function(o){var a=this.state,s=a.numRow,l=a.numCol,f=a.boundingBox,u=a.gridOffset,c=[l,s],d=[f.xMin,f.yMin],g=[u.xOffset,u.yOffset],h=Math.floor(o/c[0]),A=o-h*c[0],_=Math.floor((h*g[1]+d[1]+90+g[1]/2)/g[1]),v=Math.floor((A*g[0]+d[0]+180+g[0]/2)/g[0]);return"".concat(_,"-").concat(v)},n.getPositionForIndex=function(o){var a=this.state,s=a.numRow,l=a.numCol,f=a.boundingBox,u=a.gridOffset,c=[l,s],d=[f.xMin,f.yMin],g=[u.xOffset,u.yOffset],h=Math.floor(o/c[0]),A=o-h*c[0],_=h*g[1]+d[1],v=A*g[0]+d[0];return[v,_]},n.getPickingInfo=function(o){var a=o.info,s=o.mode,l=a.index,f=null;if(l>=0){var u=this.state.gpuGridAggregator,c=this.getPositionForIndex(l),d=ee.getAggregationData(wl({pixelIndex:l},u.getData("color"))),g=ee.getAggregationData(wl({pixelIndex:l},u.getData("elevation")));if(f={colorValue:d.cellWeight,elevationValue:g.cellWeight,count:d.cellCount||g.cellCount,position:c,totalCount:d.totalCount||g.totalCount},s!=="hover"){var h=this.props,A=this.state.gridHash;if(!A){var _=this.state,v=_.gridOffset,T=_.translation,m=_.boundingBox,E=this.context.viewport,O=this.getAttributes(),C=bt(h,{gridOffset:v,attributes:O,viewport:E,translation:T,boundingBox:m});A=C.gridHash,this.setState({gridHash:A})}var N=this.getHashKeyForIndex(l),M=A[N];Object.assign(f,M)}}return a.picked=Boolean(f),a.object=f,a},n.renderLayers=function(){if(!this.state.isSupported)return null;var o=this.props,a=o.elevationScale,s=o.extruded,l=o.cellSize,f=o.coverage,u=o.material,c=o.elevationRange,d=o.colorDomain,g=o.elevationDomain,h=this.state,A=h.weights,_=h.numRow,v=h.numCol,T=h.gridOrigin,m=h.gridOffset,E=A.color,O=A.elevation,C=We(this.props.colorRange),N=this.getSubLayerClass("gpu-grid-cell",mn);return new N({gridSize:[v,_],gridOrigin:T,gridOffset:[m.xOffset,m.yOffset],colorRange:C,elevationRange:c,colorDomain:d,elevationDomain:g,cellSize:l,coverage:f,material:u,elevationScale:a,extruded:s},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:E.aggregationBuffer,elevations:O.aggregationBuffer}},colorMaxMinBuffer:E.maxMinBuffer,elevationMaxMinBuffer:O.maxMinBuffer,numInstances:v*_})},n.finalizeState=function(o){var a=this.state.weights,s=a.color,l=a.elevation;[s,l].forEach(function(f){var u=f.aggregationBuffer,c=f.maxMinBuffer;c?.destroy(),u?.destroy()}),Ht(Le(r.prototype),"finalizeState",this).call(this,o)},n.updateAggregationState=function(o){var a=o.props,s=o.oldProps,l=a.cellSize,f=a.coordinateSystem,u=this.context.viewport,c=s.cellSize!==l,d=this.state.dimensions,g=this.isAttributeChanged(Bl),h=g||this.isAttributeChanged(),A=this.state.boundingBox;if(g&&(A=Gr(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:A})),g||c){var _=en(A,l,u,f),v=_.gridOffset,T=_.translation,m=_.width,E=_.height,O=_.numCol,C=_.numRow;this.allocateResources(C,O),this.setState({gridOffset:v,translation:T,gridOrigin:[-1*T[0],-1*T[1]],width:m,height:E,numCol:O,numRow:C})}var N=h||this.isAggregationDirty(o,{dimension:d.data,compareAll:!0});N&&this._updateAccessors(o),this.setState({aggregationDataDirty:N})},n._updateAccessors=function(o){var a=o.props,s=a.colorAggregation,l=a.elevationAggregation,f=this.state.weights,u=f.color,c=f.elevation;u.operation=w[s],c.operation=w[l]},r}(qe);et.layerName="GPUGridLayer";et.defaultProps=xh;function Rn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Rn=function(r){return typeof r}:Rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Rn(e)}function Ch(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ph(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Mi(e,t)}function Mi(e,t){return Mi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Mi(e,t)}function Nh(e){var t=Dh();return function(){var n=yn(e),i;if(t){var o=yn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Mh(this,i)}}function Mh(e,t){if(t&&(Rn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Ih(e)}function Ih(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Dh(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function yn(e){return yn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},yn(e)}function Wl(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Ni(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Wl(Object(r),!0).forEach(function(n){Fh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wl(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Fh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var wh=Ni(Ni(Ni({},et.defaultProps),Qe.defaultProps),{},{gpuAggregation:!1}),En=function(e){Ph(r,e);var t=Nh(r);function r(){var i;Ch(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){this.state={useGPUAggregation:!0}},n.updateState=function(o){var a=o.props;this.setState({useGPUAggregation:this.canUseGPUAggregation(a)})},n.renderLayers=function(){var o=this.props,a=o.data,s=o.updateTriggers,l=this.state.useGPUAggregation?"GPU":"CPU",f=this.state.useGPUAggregation?this.getSubLayerClass("GPU",et):this.getSubLayerClass("CPU",Qe);return new f(this.props,this.getSubLayerProps({id:l,updateTriggers:s}),{data:a})},n.canUseGPUAggregation=function(o){var a=o.gpuAggregation,s=o.lowerPercentile,l=o.upperPercentile,f=o.getColorValue,u=o.getElevationValue,c=o.colorScaleType;return!(!a||!ee.isSupported(this.context.device)||s!==0||l!==100||f!==null||u!==null||c==="quantile"||c==="ordinal")},r}(Hl.CompositeLayer);En.layerName="GridLayer";En.defaultProps=wh;function Ll(e,t){return Wh(e)||Uh(e,t)||zl(e,t)||Bh()}function Bh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
642
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uh(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function Wh(e){if(Array.isArray(e))return e}function Hh(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=zl(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(f){throw f},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
643
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(e)},n:function(){var f=r.next();return o=f.done,f},e:function(f){a=!0,s=f},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}function zl(e,t){if(e){if(typeof e=="string")return Vl(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vl(e,t)}}function Vl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function jl(e){var t=e.map(function(s){return s[0]}),r=e.map(function(s){return s[1]}),n=Math.min.apply(null,t),i=Math.max.apply(null,t),o=Math.min.apply(null,r),a=Math.max.apply(null,r);return[n,o,i,a]}function kl(e,t){return t[0]>=e[0]&&t[2]<=e[2]&&t[1]>=e[1]&&t[3]<=e[3]}var Xl=new Float32Array(12);function Ii(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2,r=0,n=Hh(e),i;try{for(n.s();!(i=n.n()).done;)for(var o=i.value,a=0;a<t;a++)Xl[r++]=o[a]||0}catch(s){n.e(s)}finally{n.f()}return Xl}function $l(e,t,r){var n=Ll(e,4),i=n[0],o=n[1],a=n[2],s=n[3],l=a-i,f=s-o,u=l,c=f;l/f<t/r?u=t/r*f:c=r/t*l,u<t&&(u=t,c=r);var d=(a+i)/2,g=(s+o)/2;return[d-u/2,g-c/2,d+u/2,g+c/2]}function Kl(e,t){var r=Ll(t,4),n=r[0],i=r[1],o=r[2],a=r[3];return[(e[0]-n)/(o-n),(e[1]-i)/(a-i)]}function Yl(e){var t=e.device,r=e.floatTargetSupport;return r?{format:t.info.type==="webgl2"?34836:6408,type:5126}:{format:6408,type:5121}}var be=P($());var Pn=P($());var Zl=`#version 300 es
|
|
644
|
+
#define SHADER_NAME heatp-map-layer-vertex-shader
|
|
624
645
|
|
|
625
646
|
uniform sampler2D maxTexture;
|
|
626
647
|
uniform float intensity;
|
|
@@ -628,17 +649,17 @@ uniform vec2 colorDomain;
|
|
|
628
649
|
uniform float threshold;
|
|
629
650
|
uniform float aggregationMode;
|
|
630
651
|
|
|
631
|
-
|
|
632
|
-
|
|
652
|
+
in vec3 positions;
|
|
653
|
+
in vec2 texCoords;
|
|
633
654
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
655
|
+
out vec2 vTexCoords;
|
|
656
|
+
out float vIntensityMin;
|
|
657
|
+
out float vIntensityMax;
|
|
637
658
|
|
|
638
659
|
void main(void) {
|
|
639
660
|
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
|
|
640
661
|
vTexCoords = texCoords;
|
|
641
|
-
vec4 maxTexture =
|
|
662
|
+
vec4 maxTexture = texture(maxTexture, vec2(0.5));
|
|
642
663
|
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
|
|
643
664
|
float minValue = maxValue * threshold;
|
|
644
665
|
if (colorDomain[1] > 0.) {
|
|
@@ -648,7 +669,8 @@ void main(void) {
|
|
|
648
669
|
vIntensityMax = intensity / maxValue;
|
|
649
670
|
vIntensityMin = intensity / minValue;
|
|
650
671
|
}
|
|
651
|
-
`;var
|
|
672
|
+
`;var ql=`#version 300 es
|
|
673
|
+
#define SHADER_NAME triangle-layer-fragment-shader
|
|
652
674
|
|
|
653
675
|
precision highp float;
|
|
654
676
|
|
|
@@ -657,19 +679,21 @@ uniform sampler2D texture;
|
|
|
657
679
|
uniform sampler2D colorTexture;
|
|
658
680
|
uniform float aggregationMode;
|
|
659
681
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
682
|
+
in vec2 vTexCoords;
|
|
683
|
+
in float vIntensityMin;
|
|
684
|
+
in float vIntensityMax;
|
|
685
|
+
|
|
686
|
+
out vec4 fragColor;
|
|
663
687
|
|
|
664
688
|
vec4 getLinearColor(float value) {
|
|
665
689
|
float factor = clamp(value * vIntensityMax, 0., 1.);
|
|
666
|
-
vec4 color =
|
|
690
|
+
vec4 color = texture(colorTexture, vec2(factor, 0.5));
|
|
667
691
|
color.a *= min(value * vIntensityMin, 1.0);
|
|
668
692
|
return color;
|
|
669
693
|
}
|
|
670
694
|
|
|
671
695
|
void main(void) {
|
|
672
|
-
vec4 weights =
|
|
696
|
+
vec4 weights = texture(texture, vTexCoords);
|
|
673
697
|
float weight = weights.r;
|
|
674
698
|
|
|
675
699
|
if (aggregationMode > 0.5) {
|
|
@@ -681,12 +705,13 @@ void main(void) {
|
|
|
681
705
|
|
|
682
706
|
vec4 linearColor = getLinearColor(weight);
|
|
683
707
|
linearColor.a *= opacity;
|
|
684
|
-
|
|
708
|
+
fragColor = linearColor;
|
|
685
709
|
}
|
|
686
|
-
`;function
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
710
|
+
`;function On(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?On=function(r){return typeof r}:On=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},On(e)}function Ql(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xn(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ql(Object(r),!0).forEach(function(n){Vh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ql(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Xh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Lh(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Di(e,t)}function Di(e,t){return Di=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Di(e,t)}function zh(e){var t=$h();return function(){var n=Cn(e),i;if(t){var o=Cn(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return jh(this,i)}}function jh(e,t){if(t&&(On(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return kh(e)}function kh(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function $h(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Cn(e){return Cn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Cn(e)}var Fi=function(e){Lh(r,e);var t=zh(r);function r(){var i;Xh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.getShaders=function(){return{vs:Zl,fs:ql,modules:[Pn.project32]}},n.initializeState=function(o){var a=o.device,s=this.getAttributeManager();s.add({positions:{size:3,noAlloc:!0},texCoords:{size:2,noAlloc:!0}}),this.setState({model:this._getModel(a)})},n._getModel=function(o){var a=this.props.vertexCount;return new Y(o,xn(xn({},this.getShaders()),{},{id:this.props.id,geometry:new Re({topology:"triangle-fan-webgl",vertexCount:a})}))},n.draw=function(o){var a=o.uniforms,s=this.state.model,l=this.props,f=l.texture,u=l.maxTexture,c=l.colorTexture,d=l.intensity,g=l.threshold,h=l.aggregationMode,A=l.colorDomain;s.setUniforms(xn(xn({},a),{},{texture:f,maxTexture:u,colorTexture:c,intensity:d,threshold:g,aggregationMode:h,colorDomain:A})),s.draw(this.context.renderPass)},r}(Pn.Layer);Fi.layerName="TriangleLayer";var Jl=`#version 300 es
|
|
711
|
+
in vec3 positions;
|
|
712
|
+
in vec3 positions64Low;
|
|
713
|
+
in float weights;
|
|
714
|
+
out vec4 weightsTexture;
|
|
690
715
|
uniform float radiusPixels;
|
|
691
716
|
uniform float textureWidth;
|
|
692
717
|
uniform vec4 commonBounds;
|
|
@@ -702,7 +727,9 @@ void main()
|
|
|
702
727
|
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
|
|
703
728
|
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
704
729
|
}
|
|
705
|
-
`;var
|
|
730
|
+
`;var Gl=`#version 300 es
|
|
731
|
+
in vec4 weightsTexture;
|
|
732
|
+
out vec4 fragColor;
|
|
706
733
|
float gaussianKDE(float u){
|
|
707
734
|
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
|
|
708
735
|
}
|
|
@@ -712,11 +739,12 @@ void main()
|
|
|
712
739
|
if (dist > 0.5) {
|
|
713
740
|
discard;
|
|
714
741
|
}
|
|
715
|
-
|
|
716
|
-
DECKGL_FILTER_COLOR(
|
|
742
|
+
fragColor = weightsTexture * gaussianKDE(2. * dist);
|
|
743
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
717
744
|
}
|
|
718
|
-
`;var
|
|
719
|
-
|
|
745
|
+
`;var ef=`#version 300 es
|
|
746
|
+
in vec4 inTexture;
|
|
747
|
+
out vec4 outTexture;
|
|
720
748
|
|
|
721
749
|
void main()
|
|
722
750
|
{
|
|
@@ -724,12 +752,14 @@ outTexture = inTexture;
|
|
|
724
752
|
gl_Position = vec4(0, 0, 0, 1.);
|
|
725
753
|
gl_PointSize = 1.0;
|
|
726
754
|
}
|
|
727
|
-
`;var
|
|
755
|
+
`;var tf=`#version 300 es
|
|
756
|
+
in vec4 outTexture;
|
|
757
|
+
out vec4 fragColor;
|
|
728
758
|
void main() {
|
|
729
|
-
|
|
730
|
-
|
|
759
|
+
fragColor = outTexture;
|
|
760
|
+
fragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
731
761
|
}
|
|
732
|
-
`;function
|
|
733
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vd(e,t){if(e){if(typeof e=="string")return $u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $u(e,t)}}function $u(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Kd(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],o=!0,a=!1,s,u;try{for(r=r.call(e);!(o=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));o=!0);}catch(l){a=!0,u=l}finally{try{!o&&r.return!=null&&r.return()}finally{if(a)throw u}}return n}}function Gd(e){if(Array.isArray(e))return e}function Zu(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),r.push.apply(r,n)}return r}function Gt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Zu(Object(r),!0).forEach(function(n){zd(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zu(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zd(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function nt(e,t,r){return typeof Reflect<"u"&&Reflect.get?nt=Reflect.get:nt=function(o,a,s){var u=Yd(o,a);if(u){var l=Object.getOwnPropertyDescriptor(u,a);return l.get?l.get.call(s):l.value}},nt(e,t,r||e)}function Yd(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=ye(e),e!==null););return e}function kd(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Li(e,t)}function Li(e,t){return Li=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},Li(e,t)}function $d(e){var t=Qd();return function(){var n=ye(e),o;if(t){var a=ye(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return Zd(this,o)}}function Zd(e,t){if(t&&(yn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return qd(e)}function qd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Qd(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ye(e){return ye=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ye(e)}var Jd=2,wi={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},qu=[0,0],eg={SUM:0,MEAN:1},tg={getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:le,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}},rg=["blend-minmax-webgl1","texture-formats-float32-webgl1"],ng=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],ig={data:{props:["radiusPixels"]}},In=function(e){kd(r,e);var t=$d(r);function r(){var o;jd(this,r);for(var a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return o=t.call.apply(t,[this].concat(s)),o.state=void 0,o}var n=r.prototype;return n.initializeState=function(){var a=this;if(!rg.every(function(s){return a.context.device.features.has(s)})){this.setState({supported:!1}),Oe.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}nt(ye(r.prototype),"initializeAggregationLayer",this).call(this,ig),this.setState({supported:!0,colorDomain:qu}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()},n.shouldUpdateState=function(a){var s=a.changeFlags;return s.somethingChanged},n.updateState=function(a){this.state.supported&&(nt(ye(r.prototype),"updateState",this).call(this,a),this._updateHeatmapState(a))},n._updateHeatmapState=function(a){var s=a.props,u=a.oldProps,l=this._getChangeFlags(a);(l.dataChanged||l.viewportChanged)&&(l.boundsChanged=this._updateBounds(l.dataChanged),this._updateTextureRenderingBounds()),l.dataChanged||l.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):l.viewportZoomChanged&&this._debouncedUpdateWeightmap(),s.colorRange!==u.colorRange&&this._updateColorTexture(a),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:a.context.viewport.zoom})},n.renderLayers=function(){if(!this.state.supported)return[];var a=this.state,s=a.weightsTexture,u=a.triPositionBuffer,l=a.triTexCoordBuffer,f=a.maxWeightsTexture,c=a.colorTexture,_=a.colorDomain,E=this.props,d=E.updateTriggers,h=E.intensity,p=E.threshold,g=E.aggregation,T=this.getSubLayerClass("triangle",Ui);return new T(this.getSubLayerProps({id:"triangle-layer",updateTriggers:d}),{coordinateSystem:Oe.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:u,texCoords:l}},vertexCount:4,maxTexture:f,colorTexture:c,aggregationMode:eg[g]||0,texture:s,intensity:h,threshold:p,colorDomain:_})},n.finalizeState=function(a){nt(ye(r.prototype),"finalizeState",this).call(this,a);var s=this.state,u=s.weightsTransform,l=s.weightsTexture,f=s.maxWeightTransform,c=s.maxWeightsTexture,_=s.triPositionBuffer,E=s.triTexCoordBuffer,d=s.colorTexture,h=s.updateTimer;u?.destroy(),l?.destroy(),f?.destroy(),c?.destroy(),_?.destroy(),E?.destroy(),d?.destroy(),h&&clearTimeout(h)},n._getAttributeManager=function(){return new Oe.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},n._getChangeFlags=function(a){var s={},u=this.state.dimensions;s.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(a,{compareAll:!0,dimension:u.data})&&"aggregation is dirty",s.viewportChanged=a.changeFlags.viewportChanged;var l=this.state.zoom;return(!a.context.viewport||a.context.viewport.zoom!==l)&&(s.viewportZoomChanged=!0),s},n._createTextures=function(){var a=this.state,s=a.textureSize,u=a.format,l=a.type;this.setState({weightsTexture:this.context.device.createTexture(Gt({width:s,height:s,format:u,type:l},wi)),maxWeightsTexture:this.context.device.createTexture(Gt({format:u,type:l},wi))})},n._setupAttributes=function(){var a=this.getAttributeManager();a.add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})},n._setupTextureParams=function(){var a=this.context.device,s=this.props.weightsTextureSize,u=Math.min(s,a.limits.maxTextureDimension2D),l=ng.every(function(d){return a.features.has(d)}),f=Wu({device:a,floatTargetSupport:l}),c=f.format,_=f.type,E=l?1:1/255;this.setState({textureSize:u,format:c,type:_,weightsScale:E}),l||Oe.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()},n.getShaders=function(a){return nt(ye(r.prototype),"getShaders",this).call(this,a==="max-weights-transform"?{vs:ju,_fs:Yu}:{vs:Gu,_fs:zu})},n._createWeightsTransform=function(){var a,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},u=this.state.weightsTransform,l=this.state.weightsTexture;(a=u)===null||a===void 0||a.delete(),u=new Me(this.context.device,Gt({id:"".concat(this.id,"-weights-transform"),elementCount:1,_targetTexture:l,_targetTextureVarying:"weightsTexture"},s)),this.setState({weightsTransform:u})},n._setupResources=function(){this._createTextures();var a=this.state,s=a.textureSize,u=a.weightsTexture,l=a.maxWeightsTexture,f=this.getShaders("weights-transform");this._createWeightsTransform(f);var c=this.getShaders("max-weights-transform"),_=new Me(this.context.device,Gt(Gt({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:u},_targetTexture:l,_targetTextureVarying:"outTexture"},c),{},{elementCount:s*s}));this.setState({weightsTexture:u,maxWeightsTexture:l,maxWeightTransform:_,zoom:null,triPositionBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:3}}),triTexCoordBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:2}})})},n.updateShaders=function(a){this._createWeightsTransform(a)},n._updateMaxWeightValue=function(){var a=this.state.maxWeightTransform;a.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})},n._updateBounds=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.context.viewport,u=[s.unproject([0,0]),s.unproject([s.width,0]),s.unproject([s.width,s.height]),s.unproject([0,s.height])].map(function(h){return h.map(Math.fround)}),l=Uu(u),f={visibleWorldBounds:l,viewportCorners:u},c=!1;if(a||!this.state.worldBounds||!wu(this.state.worldBounds,l)){var _=this._worldToCommonBounds(l),E=this._commonToWorldBounds(_);this.props.coordinateSystem===Oe.COORDINATE_SYSTEM.LNGLAT&&(E[1]=Math.max(E[1],-85.051129),E[3]=Math.min(E[3],85.051129),E[0]=Math.max(E[0],-360),E[2]=Math.min(E[2],360));var d=this._worldToCommonBounds(E);f.worldBounds=E,f.normalizedCommonBounds=d,c=!0}return this.setState(f),c},n._updateTextureRenderingBounds=function(){var a=this.state,s=a.triPositionBuffer,u=a.triTexCoordBuffer,l=a.normalizedCommonBounds,f=a.viewportCorners,c=this.context.viewport;s.subData(Di(f,3));var _=f.map(function(E){return Xu(c.projectPosition(E),l)});u.subData(Di(_,2))},n._updateColorTexture=function(a){var s=a.props.colorRange,u=this.state.colorTexture,l=Xe(s,!1,Uint8Array);u?u.setImageData({data:l,width:s.length}):u=this.context.device.createTexture(Gt({data:l,width:s.length,height:1},wi)),this.setState({colorTexture:u})},n._updateWeightmap=function(){var a=this,s=this.props,u=s.radiusPixels,l=s.colorDomain,f=s.aggregation,c=this.state,_=c.worldBounds,E=c.textureSize,d=c.weightsScale,h=this.state.weightsTransform;this.state.isWeightMapDirty=!1;var p=this._worldToCommonBounds(_,{useLayerCoordinateSystem:!0});if(l&&f==="SUM"){var g=this.context.viewport,T=g.distanceScales.metersPerUnit[2]*(p[2]-p[0])/E;this.state.colorDomain=l.map(function(R){return R*T*d})}else this.state.colorDomain=l||qu;var m={radiusPixels:u,commonBounds:p,textureWidth:E,weightsScale:d};h.update({elementCount:this.getNumInstances()}),Y(this.context.gl,{clearColor:[0,0,0,0]},function(){h.run({uniforms:m,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:a.getAttributes(),moduleSettings:a.getModuleSettings()})}),this._updateMaxWeightValue()},n._debouncedUpdateWeightmap=function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.state.updateTimer,u=this.props.debounceTimeout;a?(s=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(s),s=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),u)),this.setState({updateTimer:s})},n._worldToCommonBounds=function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=s.useLayerCoordinateSystem,l=u===void 0?!1:u,f=ku(a,4),c=f[0],_=f[1],E=f[2],d=f[3],h=this.context.viewport,p=this.state.textureSize,g=this.props.coordinateSystem,T=l&&(g===Oe.COORDINATE_SYSTEM.LNGLAT_OFFSETS||g===Oe.COORDINATE_SYSTEM.METER_OFFSETS),m=T?h.projectPosition(this.props.coordinateOrigin):[0,0],R=p*Jd/h.scale,S,y;return l&&!T?(S=this.projectPosition([c,_,0]),y=this.projectPosition([E,d,0])):(S=h.projectPosition([c,_,0]),y=h.projectPosition([E,d,0])),Lu([S[0]-m[0],S[1]-m[1],y[0]-m[0],y[1]-m[1]],R,R)},n._commonToWorldBounds=function(a){var s=ku(a,4),u=s[0],l=s[1],f=s[2],c=s[3],_=this.context.viewport,E=_.unprojectPosition([u,l]),d=_.unprojectPosition([f,c]);return E.slice(0,2).concat(d.slice(0,2))},r}(ge);In.layerName="HeatmapLayer";In.defaultProps=tg;return ol(Er);})();
|
|
762
|
+
`;function Nn(e){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Nn=function(r){return typeof r}:Nn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Nn(e)}function rf(e,t){return qh(e)||Zh(e,t)||Yh(e,t)||Kh()}function Kh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
763
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yh(e,t){if(e){if(typeof e=="string")return nf(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return nf(e,t)}}function nf(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Zh(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,a,s;try{for(r=r.call(e);!(i=(a=r.next()).done)&&(n.push(a.value),!(t&&n.length===t));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}return n}}function qh(e){if(Array.isArray(e))return e}function of(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function Vt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?of(Object(r),!0).forEach(function(n){Qh(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):of(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Qh(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Jh(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function tt(e,t,r){return typeof Reflect<"u"&&Reflect.get?tt=Reflect.get:tt=function(i,o,a){var s=Gh(i,o);if(s){var l=Object.getOwnPropertyDescriptor(s,o);return l.get?l.get.call(a):l.value}},tt(e,t,r||e)}function Gh(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&(e=Ce(e),e!==null););return e}function e_(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bi(e,t)}function Bi(e,t){return Bi=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Bi(e,t)}function t_(e){var t=i_();return function(){var n=Ce(e),i;if(t){var o=Ce(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return r_(this,i)}}function r_(e,t){if(t&&(Nn(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return n_(e)}function n_(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function i_(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ce(e){return Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ce(e)}var o_=2,wi={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"nearest",magFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},af=[0,0],a_={SUM:0,MEAN:1},s_={getPosition:{type:"accessor",value:function(t){return t.position}},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:ae,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},l_=["blend-minmax-webgl1","texture-formats-float32-webgl1"],f_=["texture-renderable-float32-webgl","texture-blend-float-webgl1"],u_={data:{props:["radiusPixels"]}},Mn=function(e){e_(r,e);var t=t_(r);function r(){var i;Jh(this,r);for(var o=arguments.length,a=new Array(o),s=0;s<o;s++)a[s]=arguments[s];return i=t.call.apply(t,[this].concat(a)),i.state=void 0,i}var n=r.prototype;return n.initializeState=function(){var o=this;if(!l_.every(function(a){return o.context.device.features.has(a)})){this.setState({supported:!1}),be.log.error("HeatmapLayer: ".concat(this.id," is not supported on this browser"))();return}tt(Ce(r.prototype),"initializeAggregationLayer",this).call(this,u_),this.setState({supported:!0,colorDomain:af}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()},n.shouldUpdateState=function(o){var a=o.changeFlags;return a.somethingChanged},n.updateState=function(o){this.state.supported&&(tt(Ce(r.prototype),"updateState",this).call(this,o),this._updateHeatmapState(o))},n._updateHeatmapState=function(o){var a=o.props,s=o.oldProps,l=this._getChangeFlags(o);(l.dataChanged||l.viewportChanged)&&(l.boundsChanged=this._updateBounds(l.dataChanged),this._updateTextureRenderingBounds()),l.dataChanged||l.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):l.viewportZoomChanged&&this._debouncedUpdateWeightmap(),a.colorRange!==s.colorRange&&this._updateColorTexture(o),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:o.context.viewport.zoom})},n.renderLayers=function(){if(!this.state.supported)return[];var o=this.state,a=o.weightsTexture,s=o.triPositionBuffer,l=o.triTexCoordBuffer,f=o.maxWeightsTexture,u=o.colorTexture,c=o.colorDomain,d=this.props,g=d.updateTriggers,h=d.intensity,A=d.threshold,_=d.aggregation,v=this.getSubLayerClass("triangle",Fi);return new v(this.getSubLayerProps({id:"triangle-layer",updateTriggers:g}),{coordinateSystem:be.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:s,texCoords:l}},vertexCount:4,maxTexture:f,colorTexture:u,aggregationMode:a_[_]||0,texture:a,intensity:h,threshold:A,colorDomain:c})},n.finalizeState=function(o){tt(Ce(r.prototype),"finalizeState",this).call(this,o);var a=this.state,s=a.weightsTransform,l=a.weightsTexture,f=a.maxWeightTransform,u=a.maxWeightsTexture,c=a.triPositionBuffer,d=a.triTexCoordBuffer,g=a.colorTexture,h=a.updateTimer;s?.destroy(),l?.destroy(),f?.destroy(),u?.destroy(),c?.destroy(),d?.destroy(),g?.destroy(),h&&clearTimeout(h)},n._getAttributeManager=function(){return new be.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})},n._getChangeFlags=function(o){var a={},s=this.state.dimensions;a.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(o,{compareAll:!0,dimension:s.data})&&"aggregation is dirty",a.viewportChanged=o.changeFlags.viewportChanged;var l=this.state.zoom;return(!o.context.viewport||o.context.viewport.zoom!==l)&&(a.viewportZoomChanged=!0),a},n._createTextures=function(){var o=this.state,a=o.textureSize,s=o.format,l=o.type;this.setState({weightsTexture:this.context.device.createTexture(Vt({width:a,height:a,format:s,type:l},wi)),maxWeightsTexture:this.context.device.createTexture(Vt({format:s,type:l},wi))})},n._setupAttributes=function(){var o=this.getAttributeManager();o.add({positions:{size:3,type:5130,accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})},n._setupTextureParams=function(){var o=this.context.device,a=this.props.weightsTextureSize,s=Math.min(a,o.limits.maxTextureDimension2D),l=f_.every(function(g){return o.features.has(g)}),f=Yl({device:o,floatTargetSupport:l}),u=f.format,c=f.type,d=l?1:1/255;this.setState({textureSize:s,format:u,type:c,weightsScale:d}),l||be.log.warn("HeatmapLayer: ".concat(this.id," rendering to float texture not supported, fallingback to low precession format"))()},n.getShaders=function(o){return tt(Ce(r.prototype),"getShaders",this).call(this,o==="max-weights-transform"?{vs:ef,_fs:tf}:{vs:Jl,_fs:Gl})},n._createWeightsTransform=function(){var o,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=this.state.weightsTransform;(o=s)===null||o===void 0||o.delete(),s=new Me(this.context.device,Vt({id:"".concat(this.id,"-weights-transform"),vertexCount:1,targetTexture:this.state.weightsTexture,targetTextureVarying:"weightsTexture"},a)),this.setState({weightsTransform:s})},n._setupResources=function(){this._createTextures();var o=this.state,a=o.textureSize,s=o.weightsTexture,l=o.maxWeightsTexture,f=this.getShaders("weights-transform");this._createWeightsTransform(f);var u=this.getShaders("max-weights-transform"),c=new Me(this.context.device,Vt(Vt({id:"".concat(this.id,"-max-weights-transform"),_sourceTextures:{inTexture:s},_targetTexture:l,_targetTextureVarying:"outTexture"},u),{},{elementCount:a*a}));this.setState({weightsTexture:s,maxWeightsTexture:l,maxWeightTransform:c,zoom:null,triPositionBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:3}}),triTexCoordBuffer:this.context.device.createBuffer({byteLength:48,accessor:{size:2}})})},n.updateShaders=function(o){this._createWeightsTransform(o)},n._updateMaxWeightValue=function(){var o=this.state.maxWeightTransform;o.run({parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32776}})},n._updateBounds=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.context.viewport,s=[a.unproject([0,0]),a.unproject([a.width,0]),a.unproject([a.width,a.height]),a.unproject([0,a.height])].map(function(h){return h.map(Math.fround)}),l=jl(s),f={visibleWorldBounds:l,viewportCorners:s},u=!1;if(o||!this.state.worldBounds||!kl(this.state.worldBounds,l)){var c=this._worldToCommonBounds(l),d=this._commonToWorldBounds(c);this.props.coordinateSystem===be.COORDINATE_SYSTEM.LNGLAT&&(d[1]=Math.max(d[1],-85.051129),d[3]=Math.min(d[3],85.051129),d[0]=Math.max(d[0],-360),d[2]=Math.min(d[2],360));var g=this._worldToCommonBounds(d);f.worldBounds=d,f.normalizedCommonBounds=g,u=!0}return this.setState(f),u},n._updateTextureRenderingBounds=function(){var o=this.state,a=o.triPositionBuffer,s=o.triTexCoordBuffer,l=o.normalizedCommonBounds,f=o.viewportCorners,u=this.context.viewport;a.write(Ii(f,3));var c=f.map(function(d){return Kl(u.projectPosition(d),l)});s.write(Ii(c,2))},n._updateColorTexture=function(o){var a=o.props.colorRange,s=this.state.colorTexture,l=We(a,!1,Uint8Array);s?s.setImageData({data:l,width:a.length}):s=this.context.device.createTexture(Vt({data:l,width:a.length,height:1},wi)),this.setState({colorTexture:s})},n._updateWeightmap=function(){var o=this,a=this.props,s=a.radiusPixels,l=a.colorDomain,f=a.aggregation,u=this.state,c=u.worldBounds,d=u.textureSize,g=u.weightsScale,h=this.state.weightsTransform;this.state.isWeightMapDirty=!1;var A=this._worldToCommonBounds(c,{useLayerCoordinateSystem:!0});if(l&&f==="SUM"){var _=this.context.viewport,v=_.distanceScales.metersPerUnit[2]*(A[2]-A[0])/d;this.state.colorDomain=l.map(function(m){return m*v*g})}else this.state.colorDomain=l||af;var T={radiusPixels:s,commonBounds:A,textureWidth:d,weightsScale:g};h.update({elementCount:this.getNumInstances()}),Q(this.context.gl,{clearColor:[0,0,0,0]},function(){h.run({uniforms:T,parameters:{blend:!0,depthTest:!1,blendFunc:[1,1],blendEquation:32774},clearRenderTarget:!0,attributes:o.getAttributes(),moduleSettings:o.getModuleSettings()})}),this._updateMaxWeightValue()},n._debouncedUpdateWeightmap=function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.state.updateTimer,s=this.props.debounceTimeout;o?(a=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(a),a=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),s)),this.setState({updateTimer:a})},n._worldToCommonBounds=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=a.useLayerCoordinateSystem,l=s===void 0?!1:s,f=rf(o,4),u=f[0],c=f[1],d=f[2],g=f[3],h=this.context.viewport,A=this.state.textureSize,_=this.props.coordinateSystem,v=l&&(_===be.COORDINATE_SYSTEM.LNGLAT_OFFSETS||_===be.COORDINATE_SYSTEM.METER_OFFSETS),T=v?h.projectPosition(this.props.coordinateOrigin):[0,0],m=A*o_/h.scale,E,O;return l&&!v?(E=this.projectPosition([u,c,0]),O=this.projectPosition([d,g,0])):(E=h.projectPosition([u,c,0]),O=h.projectPosition([d,g,0])),$l([E[0]-T[0],E[1]-T[1],O[0]-T[0],O[1]-T[1]],m,m)},n._commonToWorldBounds=function(o){var a=rf(o,4),s=a[0],l=a[1],f=a[2],u=a[3],c=this.context.viewport,d=c.unprojectPosition([s,l]),g=c.unprojectPosition([f,u]);return d.slice(0,2).concat(g.slice(0,2))},r}(de);Mn.layerName="HeatmapLayer";Mn.defaultProps=s_;return hf(gr);})();
|
|
734
764
|
return __exports__;
|
|
735
765
|
});
|