1(window.webpackJsonp=window.webpackJsonp||[]).push([[70],{15:function(e,t,r){"use strict";r.d(t,"a",(function(){return T})),r.d(t,"b",(function(){return R})),r.d(t,"c",(function(){return l})),r.d(t,"d",(function(){return S})),r.d(t,"e",(function(){return h})),r.d(t,"f",(function(){return O})),r.d(t,"g",(function(){return U})),r.d(t,"h",(function(){return _})),r.d(t,"i",(function(){return c})),r.d(t,"j",(function(){return A})),r.d(t,"k",(function(){return G})),r.d(t,"l",(function(){return d})),r.d(t,"m",(function(){return f})),r.d(t,"n",(function(){return m})),r.d(t,"o",(function(){return C})),r.d(t,"p",(function(){return ne})),r.d(t,"q",(function(){return N})),r.d(t,"r",(function(){return M})),r.d(t,"s",(function(){return Vt})),r.d(t,"t",(function(){return Qr})),r.d(t,"u",(function(){return ve})),r.d(t,"v",(function(){return Be})),r.d(t,"w",(function(){return re})),r.d(t,"x",(function(){return Xe})),r.d(t,"y",(function(){return Le})),r.d(t,"z",(function(){return st})),r.d(t,"A",(function(){return Ge})),r.d(t,"B",(function(){return Ie}));var n,o,_,E,c,R,l,T,A,d,f,h,S,N,B,F,C,O,m,I,M,U,L,D,P,v,G,y=r(188),x=r(343),X=r(1227),w=r(33),W=r(550),H=r.n(W);function V(e,t,r){return e<<16|t<<8|r}function k(e){return e>>>8&255}function Y(e){return e>>>16&255}function K(e){return 255&e}function j(e){switch(e){case D.F32:case D.U32:case D.S32:return 4;case D.U16:case D.S16:case D.F16:return 2;case D.U8:case D.S8:return 1;default:throw new Error("whoops")}}function z(e){return j(Y(e))}function Z(e){var t=K(e);if(t&v.Depth)return I.Depth;if(t&v.Normalized)return I.Float;var r=Y(e);if(r===D.F16||r===D.F32)return I.Float;if(r===D.U8||r===D.U16||r===D.U32)return I.Uint;if(r===D.S8||r===D.S16||r===D.S32)return I.Sint;throw new Error("whoops")}function Q(b,e){if(void 0===e&&(e=""),!b)throw new Error("Assert fail: ".concat(e))}function $(e){if(null!=e)return e;throw new Error("Missing object")}function J(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}function ee(e,t){e.r=t.r,e.g=t.g,e.b=t.b,e.a=t.a}function te(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}function re(e,g,b,a){return void 0===a&&(a=1),{r:e,g:g,b:b,a:a}}!function(e){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_WRITEMA
1SK=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_
1SHADERS=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.ALWAYS=519]="ALWAYS",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.GEQUAL=518]="GEQUAL",e[e.NOTEQUAL=517]="NOTEQUAL
vendor: 17,522 bytes, line 1
1",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.
1VERTEX_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.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_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.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.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.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"}(n||(n={})),function(e){e[e.Buffer=0]="Buffer",e[e.Texture=1]="Texture",e[e.RenderTarget=2]="RenderTarget",e[e.Sampler=3]="Sampler",e[e.Program=4]="Program",e[e.Bindings=5]="Bindings",e[e.InputLayout=6]="InputLayout",e[e.RenderPipeline=7]="RenderPipeline",e[e.ComputePipeline=8]="ComputePipeline",e[e.Readback=9]="Readback",e[e.QueryPool=10]="QueryPool",e[e.RenderBundle=11]="RenderBundle"}(o||(o={})),function(e){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"}(_||(_={})),function(e){e[e.CCW=2305]="CCW",e[e.CW=2304]="CW"}(E||(E={})),function(e){e[e.NONE=0]="NONE",e[e.FRONT=1]="FRONT",e[e.BACK=2]="BACK",e[e.FRONT_AND_BACK=3]="FRONT_AND_BACK"}(c||(c={})),function(e){e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC=768]="SRC",e[e.ONE_MINUS_SRC=769]="ONE_MINUS_SRC",e[e.DST=774]="DST",e[e.ONE_MINUS_DST=775]="ONE_MINUS_DST",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.CONST=32769]="CONST",e[e.ONE_MINUS_CONSTANT=32770]="ONE_MINUS_CONSTANT",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE"}(R||(R={})),function(e){e[e.ADD=32774]="ADD",e[e.SUBSTRACT=32778]="SUBSTRACT",e[e.REVERSE_SUBSTRACT=32779]="REVERSE_SUBSTRACT",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX"}(l||(l={})),function(e){e[e.CLAMP_TO_EDGE=0]="CLAMP_TO_EDGE",e[e.REPEAT=1]="REPEAT",e[e.MIRRORED_REPEAT=2]="MIRRORED_REPEAT"}(T||(T={})),function(e){e[e.POINT=0]="POINT",e[e.BILINEAR=1]="BILINEAR"}(A||(A={})),function(e){e[e.NO_MIP=0]="NO_MIP",e[e.NEAREST=1]="NEAREST",e[e.LINEAR=2]="LINEAR"}(d||(d={})),function(e){e[e.POINTS=0]="POINTS",e[e.TRIANGLES=1]="TRIANGLES",e[e.TRIANGLE_STRIP=2]="TRIANGLE_STRIP",e[e.LINES=3]="LINES",e[e.LINE_STRIP=4]="LINE_STRIP"}(f||(f={})),function(e){e[e.MAP_READ=1]="MAP_READ",e[e.MAP_WRITE=2]="MAP_WRITE",e[e.COPY_SRC=4]="COPY_SRC",e[e.COPY_DST=8]="COPY_DST",e[e.INDEX=16]="INDEX",e[e.VERTEX=32]="VERTEX",e[e.UNIFORM=64]="UNIFORM",e[e.STORAGE=128]="STORAGE",e[e.INDIRECT=256]="INDIRECT",e[e.QUERY_RESOLVE=512]="QUERY_RESOLVE"}
1(h||(h={})),function(e){e[e.STATIC=1]="STATIC",e[e.DYNAMIC=2]="DYNAMIC"}(S||(S={})),function(e){e[e.VERTEX=1]="VERTEX",e[e.INSTANCE=2]="INSTANCE"}(N||(N={})),function(e){e.LOADED="loaded"}(B||(B={})),function(e){e[e.TEXTURE_2D=0]="TEXTURE_2D",e[e.TEXTURE_2D_ARRAY=1]="TEXTURE_2D_ARRAY",e[e.TEXTURE_3D=2]="TEXTURE_3D",e[e.TEXTURE_CUBE_MAP=3]="TEXTURE_CUBE_MAP"}(F||(F={})),function(e){e[e.SAMPLED=1]="SAMPLED",e[e.RENDER_TARGET=2]="RENDER_TARGET",e[e.STORAGE=4]="STORAGE"}(C||(C={})),function(e){e[e.NONE=0]="NONE",e[e.RED=1]="RED",e[e.GREEN=2]="GREEN",e[e.BLUE=4]="BLUE",e[e.ALPHA=8]="ALPHA",e[e.RGB=7]="RGB",e[e.ALL=15]="ALL"}(O||(O={})),function(e){e[e.KEEP=7680]="KEEP",e[e.ZERO=0]="ZERO",e[e.REPLACE=7681]="REPLACE",e[e.INVERT=5386]="INVERT",e[e.INCREMENT_CLAMP=7682]="INCREMENT_CLAMP",e[e.DECREMENT_CLAMP=7683]="DECREMENT_CLAMP",e[e.INCREMENT_WRAP=34055]="INCREMENT_WRAP",e[e.DECREMENT_WRAP=34056]="DECREMENT_WRAP"}(m||(m={})),function(e){e[e.Float=0]="Float",e[e.UnfilterableFloat=1]="UnfilterableFloat",e[e.Uint=2]="Uint",e[e.Sint=3]="Sint",e[e.Depth=4]="Depth"}(I||(I={})),function(e){e[e.LOWER_LEFT=0]="LOWER_LEFT",e[e.UPPER_LEFT=1]="UPPER_LEFT"}(M||(M={})),function(e){e[e.NEGATIVE_ONE=0]="NEGATIVE_ONE",e[e.ZERO=1]="ZERO"}(U||(U={})),function(e){e[e.OcclusionConservative=0]="OcclusionConservative"}(L||(L={})),function(e){e[e.U8=1]="U8",e[e.U16=2]="U16",e[e.U32=3]="U32",e[e.S8=4]="S8",e[e.S16=5]="S16",e[e.S32=6]="S32",e[e.F16=7]="F16",e[e.F32=8]="F32",e[e.BC1=65]="BC1",e[e.BC2=66]="BC2",e[e.BC3=67]="BC3",e[e.BC4_UNORM=68]="BC4_UNORM",e[e.BC4_SNORM=69]="BC4_SNORM",e[e.BC5_UNORM=70]="BC5_UNORM",e[e.BC5_SNORM=71]="BC5_SNORM",e[e.U16_PACKED_5551=97]="U16_PACKED_5551",e[e.U16_PACKED_565=98]="U16_PACKED_565",e[e.D24=129]="D24",e[e.D32F=130]="D32F",e[e.D24S8=131]="D24S8",e[e.D32FS8=132]="D32FS8"}(D||(D={})),function(e){e[e.R=1]="R",e[e.RG=2]="RG",e[e.RGB=3]="RGB",e[e.RGBA=4]="RGBA",e[e.A=5]="A"}(P||(P={})),function(e){e[e.None=0]="None",e[e.Normalized=1]="Normalized",e[e.sRGB=2]="sRGB",e[e.Depth=4]="Depth",e[e.Stencil=8]="Stencil",e[e.RenderTarget=16]="RenderTarget",e[e.Luminance=32]="Luminance"}(v||(v={})),function(e){e[e.ALPHA=V(D.U8,P.A,v.None)]="ALPHA",e[e.U8_LUMINANCE=V(D.U8,P.A,v.Luminance)]="U8_LUMINANCE",e[e.F16_LUMINANCE=V(D.F16,P.A,v.Luminance)]="F16_LUMINANCE",e[e.F32_LUMINANCE=V(D.F32,P.A,v.Luminance)]="F32_LUMINANCE",e[e.F16_R=V(D.F16,P.R,v.None)]="F16_R",e[e.F16_RG=V(D.F16,P.RG,v.None)]="F16_RG",e[e.F16_RGB=V(D.F16,P.RGB,v.None)]="F16_RGB",e[e.F16_RGBA=V(D.F16,P.RGBA,v.None)]="F16_RGBA",e[e.F32_R=V(D.F32,P.R,v.None)]="F32_R",e[e.F32_RG=V(D.F32,P.RG,v.None)]="F32_RG",e[e.F32_RGB=V(D.F32,P.RGB,v.None)]="F32_RGB",e[e.F32_RGBA=V(D.F32,P.RGBA,v.None)]="F32_RGBA",e[e.U8_R=V(D.U8,P.R,v.None)]="U8_R",e[e.U8_R_NORM=V(D.U8,P.R,v.Normalized)]="U8_R_NORM",e[e.U8_RG=V(D.U8,P.RG,v.None)]="U8_RG",e[e.U8_RG_NORM=V(D.U8,P.RG,v.Normalized)]="U8_RG_NORM",e[e.U8_RGB=V(D.U8,P.RGB,v.None)]="U8_RGB",e[e.U8_RGB_NORM=V(D.U8,P.RGB,v.Normalized)]="U8_RGB_NORM",e[e.U8_RGB_SRGB=V(D.U8,P.RGB,v.sRGB|v.Normalized)]="U8_RGB_SRGB",e[e.U8_RGBA=V(D.U8,P.RGBA,v.None)]="U8_RGBA",e[e.U8_RGBA_NORM=V(D.U8,P.RGBA,v.Normalized)]="U8_RGBA_NORM",e[e.U8_RGBA_SRGB=V(D.U8,P.RGBA,v.sRGB|v.Normalized)]="U8_RGBA_SRGB",e[e.U16_R=V(D.U16,P.R,v.None)]="U16_R",e[e.U16_R_NORM=V(D.U16,P.R,v.Normalized)]="U16_R_NORM",e[e.U16_RG_NORM=V(D.U16,P.RG,v.Normalized)]="U16_RG_NORM",e[e.U16_RGBA_NORM=V(D.U16,P.RGBA,v.Normalized)]="U16_RGBA_NORM",e[e.U16_RGBA=V(D.U16,P.RGBA,v.None)]="U16_RGBA",e[e.U16_RGB=V(D.U16,P.RGB,v.None)]="U16_RGB",e[e.U16_RG=V(D.U16,P.RG,v.None)]="U16_RG",e[e.U32_R=V(D.U32,P.R,v.None)]="U32_R",e[e.U32_RG=V(D.U32,P.RG,v.None)]="U32_RG",e[e.U32_RGB=V(D.U32,P.RGB,v.None)]="U32_RGB",e[e.U32_RGBA=V(D.U32,P.RGBA,v.None)]="U32_RGBA",e[e.S8_R=V(D.S8,P.R,v.None)]="S8_R",e[e.S8_R_NORM=V(D.S8,P.R,v.Normalized)]="S8_R_NORM",e[e.S8_RG_NORM=V(D.S8,P.RG,v.Normalized)]="S8_RG_NORM",e[e.S8_RGB_NORM=V(D.S8,P.RGB,v.Normalized)]="S8_RGB_NORM",e[e.S8_RGBA_NORM=V(D.S8,P.RGBA,v.Normalized)]="S8_RGBA_NORM",e[e.S16_R=V(D.S16,P.R,v.None)]="S16_R",e[e.S16_RG=V(D.S16,P.RG,v.None)]="S16_RG",e[e.S16_RG_NORM=V(D.S16,P.RG,v.Normalized)]="S16_RG_NORM",e[e.S16_RGB_NORM=V(D.S16,P.RGB,v.Normalized)]="S16_RGB_NORM",e[e.S16_RGBA=V(D.S16,P.RGBA,v.None)]="S16_RGBA",e[e.S16_RGBA_NORM=V(D.S16,P.RGBA,v.Normalized)]="S16_RGBA_NORM",e[e.S32_R=V(D.S32,P.R,v.None)]="S32_R",e[e.S32_RG=V(D.S32,P.RG,v.None)]="S32_RG",e[e.S32_RGB=V(D.S32,P.RGB,v.None)]="S32_RGB",e[e.S32_RGBA=V(D.S32,P.RGBA,v.None)]="S32_RGBA",e[e.U16_RGBA_5551=V(D.U16_PACKED_5551,P.RGBA,v.Normalized)]="U16_RGBA_5551",e[e.U16_RGB_565=V(D.U16_PACKED_565,P.RGB,v.Normalized)]="U16_RGB_565",e[e.BC1=V(D.BC1,P.RGBA,v.Normalized)]="BC1",e[e.BC1_SRGB=V(D.BC1,P.RGBA,v.Normalized|v.sRGB)]="BC1_SRGB",e[e.BC2=V(D.BC2,P.RGBA,v.Normalized)]="BC2",e[e.BC2_SRGB=V(D.BC2,P.RGBA,v.Normalized|v.sRGB)]="BC2_SRGB",e[e.BC3=V(D.BC3,P.RGBA,v.Normalized)]="BC3",e[e.BC3_SRGB=V(D.BC3,P.RGBA,v.Normalized|v.sRGB)]="BC3_SRGB",e[e.BC4_UNORM=V(D.BC4_UNORM,P.R,v.Normalized)]="BC4_UNORM",e[e.BC4_SNORM=V(D.BC4_SNORM,P.R,v.Normalized)]="BC4_SNORM",e[e.BC5_
1UNORM=V(D.BC5_UNORM,P.RG,v.Normalized)]="BC5_UNORM",e[e.BC5_SNORM=V(D.BC5_SNORM,P.RG,v.Normalized)]="BC5_SNORM",e[e.D24=V(D.D24,P.R,v.Depth)]="D24",e[e.D24_S8=V(D.D24S8,P.RG,v.Depth|v.Stencil)]="D24_S8",e[e.D32F=V(D.D32F,P.R,v.Depth)]="D32F",e[e.D32F_S8=V(D.D32FS8,P.RG,v.Depth|v.Stencil)]="D32F_S8",e[e.U8_RGB_RT=V(D.U8,P.RGB,v.RenderTarget|v.Normalized)]="U8_RGB_RT",e[e.U8_RGBA_RT=V(D.U8,P.RGBA,v.RenderTarget|v.Normalized)]="U8_RGBA_RT",e[e.U8_RGBA_RT_SRGB=V(D.U8,P.RGBA,v.RenderTarget|v.Normalized|v.sRGB)]="U8_RGBA_RT_SRGB"}(G||(G={}));var ne=re(0,0,0,0),ie=(re(0,0,0,1),re(1,1,1,0));re(1,1,1,1);function oe(e){return!(!e||0!=(e&e-1))}function ae(e,t){return null!=e?e:t}function se(e,t){var mask=t-1;return e+mask&~mask}function _e(e,t){e.blendDstFactor=t.blendDstFactor,e.blendSrcFactor=t.blendSrcFactor,e.blendMode=t.blendMode}function Ee(e,t){return void 0===e&&(e={}),e.compare=t.compare,e.depthFailOp=t.depthFailOp,e.passOp=t.passOp,e.failOp=t.failOp,e.mask=t.mask,e}function ue(e,t){return void 0===e&&(e={rgbBlendState:{},alphaBlendState:{},channelWriteMask:0}),_e(e.rgbBlendState,t.rgbBlendState),_e(e.alphaBlendState,t.alphaBlendState),e.channelWriteMask=t.channelWriteMask,e}function ce(e,t){e.length!==t.length&&(e.length=t.length);for(var i=0;i<t.length;i++)e[i]=ue(e[i],t[i])}function Re(e){var t=Object.assign({},e);return t.attachmentsState=[],ce(t.attachmentsState,e.attachmentsState),t.blendConstant=t.blendConstant&&te(t.blendConstant),t.stencilFront=Ee(void 0,e.stencilFront),t.stencilBack=Ee(void 0,e.stencilBack),t}var le={blendMode:l.ADD,blendSrcFactor:R.ONE,blendDstFactor:R.ZERO},Te={attachmentsState:[{channelWriteMask:O.ALL,rgbBlendState:le,alphaBlendState:le}],blendConstant:te(ne),depthWrite:!0,depthCompare:_.LEQUAL,stencilWrite:!1,stencilFront:{compare:_.ALWAYS,passOp:m.KEEP,depthFailOp:m.KEEP,failOp:m.KEEP},stencilBack:{compare:_.ALWAYS,passOp:m.KEEP,depthFailOp:m.KEEP,failOp:m.KEEP},cullMode:c.NONE,frontFace:E.CCW,polygonOffset:!1,polygonOffsetFactor:0,polygonOffsetUnits:0};!function(e,t){void 0===e&&(e=null),void 0===t&&(t=Te);var r=Re(t);null!==e&&function(e,t){void 0!==t.attachmentsState&&ce(e.attachmentsState,t.attachmentsState),e.blendConstant&&t.blendConstant&&ee(e.blendConstant,t.blendConstant),e.depthCompare=ae(t.depthCompare,e.depthCompare),e.depthWrite=ae(t.depthWrite,e.depthWrite),e.stencilWrite=ae(t.stencilWrite,e.stencilWrite),e.stencilFront&&t.stencilFront&&Ee(e.stencilFront,t.stencilFront),e.stencilBack&&t.stencilBack&&Ee(e.stencilBack,t.stencilBack),e.cullMode=ae(t.cullMode,e.cullMode),e.frontFace=ae(t.frontFace,e.frontFace),e.polygonOffset=ae(t.polygonOffset,e.polygonOffset),e.polygonOffsetFactor=ae(t.polygonOffsetFactor,e.polygonOffsetFactor),e.polygonOffsetUnits=ae(t.polygonOffsetUnits,e.polygonOffsetUnits)}(r,e)}({depthCompare:_.ALWAYS,depthWrite:!1},Te);var Ae,de={texture:null,sampler:null,formatKind:I.Float,dimension:F.TEXTURE_2D};function fe(a,b,e){if(a.length!==b.length)return!1;for(var i=0;i<a.length;i++)if(!e(a[i],b[i]))return!1;return!0}function pe(a,e){for(var b=Array(a.length),i=0;i<a.length;i++)b[i]=e(a[i]);return b}function he(a,b){return a.texture===b.texture&&a.binding===b.binding}function Se(a,b){return a.buffer===b.buffer&&a.size===b.size&&a.binding===b.binding&&a.offset===b.offset}function Ne(a,b){return null===a?null===b:null!==b&&(a.sampler===b.sampler&&a.texture===b.texture&&a.dimension===b.dimension&&a.formatKind===b.formatKind&&a.comparison===b.comparison)}function Be(a,b){return a.samplerBindings=a.samplerBindings||[],a.uniformBufferBindings=a.uniformBufferBindings||[],a.storageBufferBindings=a.storageBufferBindings||[],a.storageTextureBindings=a.storageTextureBindings||[],b.samplerBindings=b.samplerBindings||[],b.uniformBufferBindings=b.uniformBufferBindings||[],b.storageBufferBindings=b.storageBufferBindings||[],b.storageTextureBindings=b.storageTextureBindings||[],a.samplerBindings.length===b.samplerBindings.length&&(!!fe(a.samplerBindings,b.samplerBindings,Ne)&&(!!fe(a.uniformBufferBindings,b.uniformBufferBindings,Se)&&(!!fe(a.storageBufferBindings,b.storageBufferBindings,Se)&&!!fe(a.storageTextureBindings,b.storageTextureBindings,he))))}function Fe(a,b){return a.blendMode==b.blendMode&&a.blendSrcFactor===b.blendSrcFactor&&a.blendDstFactor===b.blendDstFactor}function Ce(a,b){return!!Fe(a.rgbBlendState,b.rgbBlendState)&&(!!Fe(a.alph
1aBlendState,b.alphaBlendState)&&a.channelWriteMask===b.channelWriteMask)}function Oe(a,b){return a.compare==b.compare&&a.depthFailOp===b.depthFailOp&&a.failOp===b.failOp&&a.passOp===b.passOp&&a.mask===b.mask}function ge(a,b){return a.id===b.id}function me(a,b){return a===b}function Ie(a,b){return a.topology===b.topology&&(a.inputLayout===b.inputLayout&&(a.sampleCount===b.sampleCount&&(!(a.megaStateDescriptor&&b.megaStateDescriptor&&!function(a,b){return!(!fe(a.attachmentsState,b.attachmentsState,Ce)||a.blendConstant&&b.blendConstant&&!J(a.blendConstant,b.blendConstant)||a.stencilFront&&b.stencilFront&&!Oe(a.stencilFront,b.stencilFront)||a.stencilBack&&b.stencilBack&&!Oe(a.stencilBack,b.stencilBack)||a.depthCompare!==b.depthCompare||a.depthWrite!==b.depthWrite||a.stencilWrite!==b.stencilWrite||a.cullMode!==b.cullMode||a.frontFace!==b.frontFace||a.polygonOffset!==b.polygonOffset||a.polygonOffsetFactor!==b.polygonOffsetFactor||a.polygonOffsetUnits!==b.polygonOffsetUnits)}(a.megaStateDescriptor,b.megaStateDescriptor))&&(!!ge(a.program,b.program)&&(!!fe(a.colorAttachmentFormats,b.colorAttachmentFormats,me)&&a.depthStencilAttachmentFormat===b.depthStencilAttachmentFormat)))))}function Me(a,b){return a.offset===b.offset&&a.shaderLocation===b.shaderLocation&&a.format===b.format&&a.divisor===b.divisor}function Ue(a,b){return Object(y.a)(a)?Object(y.a)(b):!Object(y.a)(b)&&(a.arrayStride===b.arrayStride&&a.stepMode===b.stepMode&&fe(a.attributes,b.attributes,Me))}function Le(a,b){return a.indexBufferFormat===b.indexBufferFormat&&(!!fe(a.vertexBufferDescriptors,b.vertexBufferDescriptors,Ue)&&!!ge(a.program,b.program))}function De(a){return{sampler:a.sampler,texture:a.texture,dimension:a.dimension,formatKind:a.formatKind,comparison:a.comparison}}function Pe(a){var e=a.buffer,t=a.size;return{binding:a.binding,buffer:e,offset:a.offset,size:t}}function be(a){return{binding:a.binding,texture:a.texture}}function ve(a){return{samplerBindings:a.samplerBindings&&pe(a.samplerBindings,De),uniformBufferBindings:a.uniformBufferBindings&&pe(a.uniformBufferBindings,Pe),storageBufferBindings:a.storageBufferBindings&&pe(a.storageBufferBindings,Pe),storageTextureBindings:a.storageTextureBindings&&pe(a.storageTextureBindings,be),pipeline:a.pipeline}}function Ge(a){var e=a.inputLayout,t=a.program,r=a.topology;return{inputLayout:e,megaStateDescriptor:a.megaStateDescriptor&&Re(a.megaStateDescriptor),program:t,topology:r,colorAttachmentFormats:a.colorAttachmentFormats.slice(),depthStencilAttachmentFormat:a.depthStencilAttachmentFormat,sampleCount:a.sampleCount}}function ye(a){return{shaderLocation:a.shaderLocation,format:a.format,offset:a.offset,divisor:a.divisor}}function xe(a){return Object(y.a)(a)?a:{arrayStride:a.arrayStride,stepMode:a.stepMode,attributes:pe(a.attributes,ye)}}function Xe(a){return{vertexBufferDescriptors:pe(a.vertexBufferDescriptors,xe),indexBufferFormat:a.indexBufferFormat,program:a.program}}var we=/([^[]*)(\[[0-9]+\])?/;function We(e){if("]"!==e[e.length-1])return{name:e,length:1,isArray:!1};var t=e.match(we);if(!t||t.length<2)throw new Error("Failed to parse GLSL uniform name ".concat(e));return{name:t[1],length:Number(t[2])||1,isArray:Boolean(t[2])}}function He(){var e=null;return function(t,r,n){var o=e!==n;return o&&(t.uniform1i(r,n),e=n),o}}function Ve(e,t,r,n){var o=null,_=null;return function(E,c,R){var l=t(R,r),T=l.length,A=!1;if(null===o)o=new Float32Array(T),_=T,A=!0;else{Q(_===T,"Uniform length cannot change.");for(var i=0;i<T;++i)if(l[i]!==o[i]){A=!0;break}}return A&&(n(E,e,c,l),o.set(l)),A}}function ke(e,t,r,n){e[t](r,n)}function Ye(e,t,r,n){e[t](r,!1,n)}var Ke={},je={},ze={},qe=[0];function Ze(e,t,r,n){1===t&&"boolean"==typeof e&&(e=e?1:0),Number.isFinite(e)&&(qe[0]=e,e=qe);var o=e.length;if(e instanceof r)return e;var _=n[o];_||(_=new r(o),n[o]=_);for(var i=0;i<o;i++)_[i]=e[i];return _}function Qe(e,t){return Ze(e,t,Float32Array,Ke)}function $e(e,t){return Ze(e,t,Int32Array,je)}function Je(e,t){return Ze(e,t,Uint32Array,ze)}var et=((Ae={})[n.FLOAT]=Ve.bind(null,"uniform1fv",Qe,1,ke),Ae[n.FLOAT_VEC2]=Ve.bind(null,"uniform2fv",Qe,2,ke),Ae[n.FLOAT_VEC3]=Ve.b
1ind(null,"uniform3fv",Qe,3,ke),Ae[n.FLOAT_VEC4]=Ve.bind(null,"uniform4fv",Qe,4,ke),Ae[n.INT]=Ve.bind(null,"uniform1iv",$e,1,ke),Ae[n.INT_VEC2]=Ve.bind(null,"uniform2iv",$e,2,ke),Ae[n.INT_VEC3]=Ve.bind(null,"uniform3iv",$e,3,ke),Ae[n.INT_VEC4]=Ve.bind(null,"uniform4iv",$e,4,ke),Ae[n.BOOL]=Ve.bind(null,"uniform1iv",$e,1,ke),Ae[n.BOOL_VEC2]=Ve.bind(null,"uniform2iv",$e,2,ke),Ae[n.BOOL_VEC3]=Ve.bind(null,"uniform3iv",$e,3,ke),Ae[n.BOOL_VEC4]=Ve.bind(null,"uniform4iv",$e,4,ke),Ae[n.FLOAT_MAT2]=Ve.bind(null,"uniformMatrix2fv",Qe,4,Ye),Ae[n.FLOAT_MAT3]=Ve.bind(null,"uniformMatrix3fv",Qe,9,Ye),Ae[n.FLOAT_MAT4]=Ve.bind(null,"uniformMatrix4fv",Qe,16,Ye),Ae[n.UNSIGNED_INT]=Ve.bind(null,"uniform1uiv",Je,1,ke),Ae[n.UNSIGNED_INT_VEC2]=Ve.bind(null,"uniform2uiv",Je,2,ke),Ae[n.UNSIGNED_INT_VEC3]=Ve.bind(null,"uniform3uiv",Je,3,ke),Ae[n.UNSIGNED_INT_VEC4]=Ve.bind(null,"uniform4uiv",Je,4,ke),Ae[n.FLOAT_MAT2x3]=Ve.bind(null,"uniformMatrix2x3fv",Qe,6,Ye),Ae[n.FLOAT_MAT2x4]=Ve.bind(null,"uniformMatrix2x4fv",Qe,8,Ye),Ae[n.FLOAT_MAT3x2]=Ve.bind(null,"uniformMatrix3x2fv",Qe,6,Ye),Ae[n.FLOAT_MAT3x4]=Ve.bind(null,"uniformMatrix3x4fv",Qe,12,Ye),Ae[n.FLOAT_MAT4x2]=Ve.bind(null,"uniformMatrix4x2fv",Qe,8,Ye),Ae[n.FLOAT_MAT4x3]=Ve.bind(null,"uniformMatrix4x3fv",Qe,12,Ye),Ae[n.SAMPLER_2D]=He,Ae[n.SAMPLER_CUBE]=He,Ae[n.SAMPLER_3D]=He,Ae[n.SAMPLER_2D_SHADOW]=He,Ae[n.SAMPLER_2D_ARRAY]=He,Ae[n.SAMPLER_2D_ARRAY_SHADOW]=He,Ae[n.SAMPLER_CUBE_SHADOW]=He,Ae[n.INT_SAMPLER_2D]=He,Ae[n.INT_SAMPLER_3D]=He,Ae[n.INT_SAMPLER_CUBE]=He,Ae[n.INT_SAMPLER_2D_ARRAY]=He,Ae[n.UNSIGNED_INT_SAMPLER_2D]=He,Ae[n.UNSIGNED_INT_SAMPLER_3D]=He,Ae[n.UNSIGNED_INT_SAMPLER_CUBE]=He,Ae[n.UNSIGNED_INT_SAMPLER_2D_ARRAY]=He,Ae);function tt(e,t,r){var n=et[r.type];if(!n)throw new Error("Unknown GLSL uniform type ".concat(r.type));return n().bind(null,e,t)}var nt={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121};function it(e,t){return"#define ".concat(e," ").concat(t)}function ot(e){if(void 0===e)return null;var g=/binding\s*=\s*(\d+)/.exec(e);if(null!==g){var t=parseInt(g[1],10);if(!Number.isNaN(t))return t}return null}function at(e){return[e,""]}function st(e,t,source,r,n){var o;void 0===r&&(r=null),void 0===n&&(n=!0);var _="#version 100"===e.glslVersion,E="frag"===t&&(null===(o=source.match(/^\s*layout\(location\s*=\s*\d*\)\s*out\s+vec4\s*(.*);$/gm))||void 0===o?void 0:o.length)>1,c=source.replace("\r\n","\n").split("\n").map((function(e){return e.replace(/[/][/].*$/,"")})).filter((function(e){return!(!e||/^\s+$/.test(e))})),R="";null!==r&&(R=Object.keys(r).map((function(e){return it(e,r[e])})).join("\n"));var l=c.find((function(line){return line.startsWith("precision")}))||"precision mediump float;",T=n?c.filter((function(line){return!line.startsWith("precision")})).join("\n"):c.join("\n"),A="";if(e.viewportOrigin===M.UPPER_LEFT&&(A+="".concat(it("VIEWPORT_ORIGIN_TL","1"),"\n")),e.clipSpaceNearZ===U.ZERO&&(A+="".concat(it("CLIPSPACE_NEAR_ZERO","1"),"\n")),e.explicitBindingLocations){var d=0,f=0,h=0;T=T.replace(/^\s*(layout\((.*)\))?\s*uniform(.+{)$/gm,(function(e,t,r,n){var o=r?"".concat(r,", "):"";return"layout(".concat(o,"set = ").concat(d,", binding = ").concat(f++,") uniform ").concat(n)})),d++,f=0,Q(e.separateSamplerTextures),T=T.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,(function(e,r,n,o,_){var E=ot(n);null===E&&(E=f++);var c=Object(w.e)(at(o),2),R=c[0],l=c[1];return"frag"===t?"\nlayout(set = ".concat(d,", binding = ").concat(2*E+0,") uniform texture").concat(R," T_").concat(_,";\nlayout(set = ").concat(d,", binding = ").concat(2*E+1,") uniform sampler").concat(l," S_").concat(_,";").trim():""})),T=T.replace("frag"===t?/^\s*\b(varying|in)\b/gm:/^\s*\b(varying|out)\b/gm,(function(e,t){return"layout(location = ".concat(h++,") ").concat(t)})),A+="".concat(it("gl_VertexID","gl_VertexIndex"),"\n"),A+="".concat(it("gl_InstanceID","gl_InstanceIndex"),"\n"),l=l.replace(/^precision (.*) sampler(.*);$/gm,"")}else{var S=0;T=T.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,(function(e,t,r,n,o){var _=ot(r);return null===_&&(_=S++),"uniform sampler".concat(n," ").concat(o,"; // BINDING=").concat(_)}))}if(T=(T=(T=T.replace(/\bPU_SAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){return"SAMPLER_".concat(t,"(P_").concat(r,")")}))).replace(/\bPF_SAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){return"PP_SAMPLER_".concat(t,"(P_").concat(r,")")}))).replace(/\bPU_TEXTURE\((.*?)\)/g,(function(e,t){return"TEXTURE(P_".concat(t,")")})),e.separateSamplerTextures)T=T.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){var n=Object(w.e)(at(t),2),o=n[0],_=n[1];return"texture".concat(o," T_P_").concat(r,", sampler").concat(_," S_P_").concat(r)})),T=(T=(T=T.replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){return"T_".concat(r,", S_").concat(r)}))).replace(/\bSAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){return"sampler".concat(t,"(T_").concat(r,", S_").concat(r,")")}))).replace(/\bTEXTURE\((.*?)\)/g,(function(e,t){return"T_".concat(t)}));else{var N=[];T=(T=(T=T.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){return"sampler".concat(t," P_").concat(r)}))).replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){return r}))).replace(/\bSAMPLER_(\w+)\((.*?)\)/g,(function(e,t,r){return N.push([r,t]),r}
1)),_&&N.forEach((function(e){var t=Object(w.e)(e,2),r=t[0],n=t[1];T=T.replace(new RegExp("texture\\(".concat(r),"g"),(function(){return"texture".concat(n,"(").concat(r)}))})),T=T.replace(/\bTEXTURE\((.*?)\)/g,(function(e,t){return t}))}var B="".concat(_?"":e.glslVersion,"\n").concat(_&&E?"#extension GL_EXT_draw_buffers : require\n":"","\n").concat(_&&"frag"===t?"#extension GL_OES_standard_derivatives : enable\n":"").concat(n?l:"","\n").concat(A||"").concat(R?R+"\n":"","\n").concat(T,"\n").trim();if(e.explicitBindingLocations&&"frag"===t&&(B=B.replace(/^\b(out)\b/g,(function(e,t){return"layout(location = 0) ".concat(t)}))),_){if("frag"===t&&(B=B.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"varying ".concat(t," ").concat(r,";\n")}))),"vert"===t&&(B=(B=B.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"varying ".concat(t," ").concat(r,";\n")}))).replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return"attribute ".concat(t," ").concat(r,";\n")}))),B=B.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,(function(e,t){return t.trim().replace(/^.*$/gm,(function(e){var t=e.trim();return t.startsWith("#")?t:e?"uniform ".concat(t):""}))})),"frag"===t)if(E){var F=[],C=(B=B.replace(/^\s*layout\(location\s*=\s*\d*\)\s*out\s+vec4\s*(.*);$/gm,(function(e,t){return F.push(t),"vec4 ".concat(t,";\n")}))).lastIndexOf("}");B=B.substring(0,C)+"\n ".concat(F.map((function(e,i){return"gl_FragData[".concat(i,"] = ").concat(e,";\n ")})).join("\n"))+B.substring(C)}else{var O;if(B=B.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,(function(e,t,r){return O=r,"".concat(t," ").concat(r,";\n")})),O){C=B.lastIndexOf("}");B=B.substring(0,C)+"\n gl_FragColor = vec4(".concat(O,");\n")+B.substring(C)}}B=B.replace(/^\s*layout\((.*)\)/gm,"")}return B}var _t,Et=function(e){function t(t){var r=t.id,n=t.device,o=e.call(this)||this;return o.id=r,o.device=n,null!==o.device.resourceCreationTracker&&o.device.resourceCreationTracker.trackResourceCreated(o),o}return Object(w.c)(t,e),t.prototype.destroy=function(){null!==this.device.resourceCreationTracker&&this.device.resourceCreationTracker.trackResourceDestroyed(this)},t}(H.a),ut=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;E.type=o.Bindings;var c=_.uniformBufferBindings,R=_.samplerBindings;return E.uniformBufferBindings=c||[],E.samplerBindings=R||[],E.bindingLayouts=E.createBindingLayouts(),E}return Object(w.c)(t,e),t.prototype.createBindingLayouts=function(){var e=0,t=0,r=[],n=this.uniformBufferBindings.length,o=this.samplerBindings.length;return r.push({firstUniformBuffer:e,numUniformBuffers:n,firstSampler:t,numSamplers:o}),{numUniformBuffers:e+=n,numSamplers:t+=o,bindingLayoutTables:r}},t}(Et);function ct(e){return void 0!==_t?_t:"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext?(_t=!0,!0):_t=Boolean(e&&2===e._version)}function Rt(e){switch(Y(e)){case D.BC1:case D.BC2:case D.BC3:case D.BC4_UNORM:case D.BC4_SNORM:case D.BC5_UNORM:case D.BC5_SNORM:return!0;default:return!1}}function lt(e){if(K(e)&v.Normalized)return!1;var t=Y(e);return t===D.S8||t===D.S16||t===D.S32||(t===D.U8||t===D.U16||t===D.U32)}function Tt(e){return e&h.INDEX?n.ELEMENT_ARRAY_BUFFER:e&h.VERTEX?n.ARRAY_BUFFER:e&h.UNIFORM?n.UNIFORM_BUFFER:void 0}function At(e){var t=Y(e),r=k(e),o=K(e),_=function(e){switch(e){case D.U8:return n.UNSIGNED_BYTE;case D.U16:return n.UNSIGNED_SHORT;case D.U32:return n.UNSIGNED_INT;case D.S8:return n.BYTE;case D.S16:return n.SHORT;case D.S32:return n.INT;case D.F16:return n.HALF_FLOAT;case D.F32:return n.FLOAT;default:throw new Error("whoops")}}(t),E=function(e){switch(e){case P.R:return 1;case P.RG:return 2;case P.RGB:return 3;case P.RGBA:return 4;default:return 1}}(r);return{size:E,type:_,normalized:!!(o&v.Normalized)}}function ft(e){switch(e){case T.CLAMP_TO_EDGE:return n.CLAMP_TO_EDGE;case T.REPEAT:return n.REPEAT;case T.MIRRORED_REPEAT:return n.MIRRORED_REPEAT;default:throw new Error("whoops")}}function pt(filter,e){if(e===d.LINEAR&&filter===A.BILINEAR)return n.LINEAR_MIPMAP_LINEAR;
1if(e===d.LINEAR&&filter===A.POINT)return n.NEAREST_MIPMAP_LINEAR;if(e===d.NEAREST&&filter===A.BILINEAR)return n.LINEAR_MIPMAP_NEAREST;if(e===d.NEAREST&&filter===A.POINT)return n.NEAREST_MIPMAP_NEAREST;if(e===d.NO_MIP&&filter===A.BILINEAR)return n.LINEAR;if(e===d.NO_MIP&&filter===A.POINT)return n.NEAREST;throw new Error("Unknown texture filter mode")}function ht(e,t){void 0===t&&(t=0);var r=e;return r.gl_buffer_pages[t/r.pageByteSize|0]}function St(e){return e.gl_texture}function Nt(e){return e.gl_sampler}function Bt(e,t){e.name=t,e.__SPECTOR_Metadata={name:t}}function Ft(e,t){for(var r=[];;){var n=t.exec(e);if(!n)break;r.push(n)}return r}function Ct(e){return e.blendMode==l.ADD&&e.blendSrcFactor==R.ONE&&e.blendDstFactor===R.ZERO}function Ot(e){if(e===F.TEXTURE_2D)return n.TEXTURE_2D;if(e===F.TEXTURE_2D_ARRAY)return n.TEXTURE_2D_ARRAY;if(e===F.TEXTURE_CUBE_MAP)return n.TEXTURE_CUBE_MAP;if(e===F.TEXTURE_3D)return n.TEXTURE_3D;throw new Error("whoops")}function gt(e,t,r,n){return e%r==0&&t%n==0}var mt,It=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;E.type=o.Buffer;var c=_.viewOrSize,R=_.usage,l=_.hint,T=void 0===l?S.STATIC:l,A=n.uniformBufferMaxPageByteSize,d=n.gl,f=R&h.UNIFORM;f||(ct(d)?d.bindVertexArray(null):n.OES_vertex_array_object.bindVertexArrayOES(null));var N,B=Object(x.a)(c)?se(c,4):se(c.byteLength,4);if(E.gl_buffer_pages=[],f){for(var F=B;F>0;)E.gl_buffer_pages.push(E.createBufferPage(Math.min(F,A),R,T)),F-=A;N=A}else E.gl_buffer_pages.push(E.createBufferPage(B,R,T)),N=B;return E.pageByteSize=N,E.byteSize=B,E.usage=R,E.gl_target=Tt(R),Object(x.a)(c)||E.setSubData(0,new Uint8Array(c.buffer)),f||(ct(d)?d.bindVertexArray(E.device.currentBoundVAO):n.OES_vertex_array_object.bindVertexArrayOES(E.device.currentBoundVAO)),E}return Object(w.c)(t,e),t.prototype.setSubData=function(e,data,t,r){void 0===t&&(t=0),void 0===r&&(r=data.byteLength-t);for(var n=this.device.gl,o=this.pageByteSize,_=e+r,E=e,c=e%o;E<_;){var R=ct(n)?n.COPY_WRITE_BUFFER:this.gl_target,l=ht(this,E);if(l.ubo)return;n.bindBuffer(R,l),ct(n)?n.bufferSubData(R,c,data,t,Math.min(_-E,o)):n.bufferSubData(R,c,data),E+=o,c=0,t+=o,this.device.debugGroupStatisticsBufferUpload()}},t.prototype.destroy=function(){e.prototype.destroy.call(this);for(var i=0;i<this.gl_buffer_pages.length;i++)this.gl_buffer_pages[i].ubo||this.device.gl.deleteBuffer(this.gl_buffer_pages[i]);this.gl_buffer_pages=[]},t.prototype.createBufferPage=function(e,t,r){var o=this.device.gl,_=t&h.UNIFORM;if(!ct(o)&&_)return{ubo:!0};var E=this.device.ensureResourceExists(o.createBuffer()),c=Tt(t),R=function(e){switch(e){case S.STATIC:return n.STATIC_DRAW;case S.DYNAMIC:return n.DYNAMIC_DRAW}}(r);return o.bindBuffer(c,E),o.bufferData(c,e,R),E},t}(Et),Mt=function(e){function t(t){var r,_,E,c,R,l=t.id,T=t.device,A=t.descriptor,d=e.call(this,{id:l,device:T})||this;d.type=o.InputLayout;var f=A.vertexBufferDescriptors,h=A.indexBufferFormat,S=A.program;Q(h===G.U16_R||h===G.U32_R||null===h);var B=null!==h?function(e){switch(e){case G.U8_R:return n.UNSIGNED_BYTE;case G.U16_R:return n.UNSIGNED_SHORT;case G.U32_R:return n.UNSIGNED_INT;default:throw new Error("whoops")}}(h):null,F=null!==h?z(h):null,C=d.device.gl,O=d.device.ensureResourceExists(ct(C)?C.createVertexArray():T.OES_vertex_array_object.createVertexArrayOES());ct(C)?C.bindVertexArray(O):T.OES_vertex_array_object.bindVertexArrayOES(O),C.bindBuffer(C.ARRAY_BUFFER,ht(d.device.fallbackVertexBuffer));try{for(var m=Object(w.h)(A.vertexBufferDescriptors),I=m.next();!I.done;I=m.next()){var M=I.value,U=M.stepMode,L=M.attributes;try{for(var D=(E=void 0,Object(w.h)(L)),P=D.next();!P.done;P=D.next()){var v=P.value,x=v.shaderLocation,X=v.format,W=v.divisor,H=void 0===W?1:W,V=ct(C)?x:null===(R=S.attributes[x])||void 0===R?void 0:R.location,k=At(X);if(v.vertexFormat=k,!Object(y.a)(V)){lt(X);var Y=k.size,K=k.type,j=k.normalized;C.vertexAttribPointer(V,Y,K,j,0,0),U===N.INSTANCE&&(ct(C)?C.vertexAttribDivisor(V,H):T.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(V,H)),C.enableVertexAttribArray(V)}}}catch(e){E={error:e}}finally{try{P&&!P.done&&(c=D.return)&&c.call(D)}finally{if(E)throw E.error}}}}catch(e){r={error:e}}finally{try{I&&!I.done&&(_=m.return)&&_.call(m)}finally{if(r)throw r.error}}return ct(C)?C.bindVertexArray(null):T.OES_vertex_array_object.bindVertexArrayOES(null),d.vertexBufferDescriptors=f,d.vao=O,d.indexBufferFormat=h,d.indexBufferType=B,d.indexBufferCompByteSize=F,d.program=S,d}return Object(w.c)(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this),this.device.currentBoundVAO===this.vao&&(ct(this.device.gl)?(this.device.gl.bindVertexArray(null),this.device.gl.deleteVertexArray(this.vao)):(this.device.OES_vertex_array_object.bindVertexArrayOES(null),this.device.OES_vertex_array_object.deleteVertexArrayOES(this.vao)),this.device.currentBoundVAO=null)},t}(Et),Ut=function(e){function t(t){var r=t.id,_=t.device,E=t.descriptor,c=t.fake,R=e.call(this,{id:r,device:_})||this;R.type=o.Texture,E=Object(w.a)({dimension:F.TEXTURE_2D,depthOrArrayLayers:1,mipLevelCount:1},E);var l,T,A=R.device.gl,d=R.clampmipLevelCount(E);if(R.immutable=E.usage===C.RENDER_TARGET,R.pixelStore=E.pixelStore,R.format=E.format,R.dimension=E.dimension,R.formatKind=Z(E.format),R.width=E.width,R.height=E.height,R.depthOrArrayLayers=E.depthOrArrayLayers,R.mipmaps=d>=1,!c){T=R.device.ensureResourceExists(A.createTexture());var f=R.device.translateTextureType(E.format),h=R.device.translateTextureInternalFormat(E.format);if(R.device.setActiveTexture(A.TEXTURE0),R.device.currentTextures[0]=null,R.preprocessImage(),E.dimension===F.TEXTURE_2D){if(l=n.TEXTURE_2D,A.bindTexture(l,T),R.immutable)if(ct(A))A.texStorage2D(l,d,h,E.width,E.height);else{var S=(h===n.DEPTH_COMPONENT||R.isNPOT(),0);(R.format!==G.D32F&&R.format!==G.D24_S8||ct(A)||_.WEBGL_depth_texture)&&(A.texImage2D(l,S,h,E.width,E.height,0,h,f,null),R.mipmaps&&(R.mipmaps=!1,A.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
1INEAR),A.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),A.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE)))}Q(1===E.depthOrArrayLayers)}else if(E.dimension===F.TEXTURE_2D_ARRAY)l=n.TEXTURE_2D_ARRAY,A.bindTexture(l,T),R.immutable&&ct(A)&&A.texStorage3D(l,d,h,E.width,E.height,E.depthOrArrayLayers);else if(E.dimension===F.TEXTURE_3D)l=n.TEXTURE_3D,A.bindTexture(l,T),R.immutable&&ct(A)&&A.texStorage3D(l,d,h,E.width,E.height,E.depthOrArrayLayers);else{if(E.dimension!==F.TEXTURE_CUBE_MAP)throw new Error("whoops");l=n.TEXTURE_CUBE_MAP,A.bindTexture(l,T),R.immutable&&ct(A)&&A.texStorage2D(l,d,h,E.width,E.height),Q(6===E.depthOrArrayLayers)}}return R.gl_texture=T,R.gl_target=l,R.mipLevelCount=d,R}return Object(w.c)(t,e),t.prototype.setImageData=function(e,t){void 0===t&&(t=0);var r=this.device.gl;Rt(this.format);var o,_=this.gl_target===n.TEXTURE_3D||this.gl_target===n.TEXTURE_2D_ARRAY,E=this.gl_target===n.TEXTURE_CUBE_MAP,c=(o=e[0],Object.prototype.toString.call(o)in nt);this.device.setActiveTexture(r.TEXTURE0),this.device.currentTextures[0]=null;var R,l,data=e[0];c?(R=this.width,l=this.height):(R=data.width,l=data.height,this.width=R,this.height=l),r.bindTexture(this.gl_target,this.gl_texture);var T=this.device.translateTextureFormat(this.format),A=ct(r)?this.device.translateInternalTextureFormat(this.format):T,d=this.device.translateTextureType(this.format);this.preprocessImage();for(var f=0;f<this.depthOrArrayLayers;f++){var h=e[f],S=this.gl_target;E&&(S=n.TEXTURE_CUBE_MAP_POSITIVE_X+f%6),this.immutable?r.texSubImage2D(S,t,0,0,R,l,T,d,h):ct(r)?_?r.texImage3D(S,t,A,R,l,this.depthOrArrayLayers,0,T,d,h):r.texImage2D(S,t,A,R,l,0,T,d,h):c?r.texImage2D(S,t,T,R,l,0,T,d,h):r.texImage2D(S,t,T,T,d,h)}this.mipmaps&&this.generateMipmap(_)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.device.gl.deleteTexture(St(this))},t.prototype.clampmipLevelCount=function(e){if(e.dimension===F.TEXTURE_2D_ARRAY&&e.depthOrArrayLayers>1&&Y(e.format)===D.BC1)for(var t=e.width,r=e.height,i=0;i<e.mipLevelCount;i++){if(t<=2||r<=2)return i-1;t=Math.max(t/2|0,1),r=Math.max(r/2|0,1)}return e.mipLevelCount},t.prototype.preprocessImage=function(){var e=this.device.gl;this.pixelStore&&(this.pixelStore.unpackFlipY&&e.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,!0),this.pixelStore.packAlignment&&e.pixelStorei(n.PACK_ALIGNMENT,this.pixelStore.packAlignment),this.pixelStore.unpackAlignment&&e.pixelStorei(n.UNPACK_ALIGNMENT,this.pixelStore.unpackAlignment))},t.prototype.generateMipmap=function(e){void 0===e&&(e=!1);var t=this.device.gl;return!ct(t)&&this.isNPOT()||this.gl_texture&&this.gl_target&&(t.bindTexture(this.gl_target,this.gl_texture),e?(t.texParameteri(this.gl_target,n.TEXTURE_BASE_LEVEL,0),t.texParameteri(this.gl_target,n.TEXTURE_MAX_LEVEL,Math.log2(this.width)),t.texParameteri(this.gl_target,n.TEXTURE_MIN_FILTER,n.L
1INEAR_MIPMAP_LINEAR),t.texParameteri(this.gl_target,n.TEXTURE_MAG_FILTER,n.LINEAR)):t.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST_MIPMAP_LINEAR),t.generateMipmap(this.gl_target),t.bindTexture(this.gl_target,null)),this},t.prototype.isNPOT=function(){return!ct(this.device.gl)&&(!oe(this.width)||!oe(this.height))},t}(Et),Lt=function(e){function t(t){var r=t.id,_=t.device,E=t.descriptor,c=e.call(this,{id:r,device:_})||this;c.type=o.RenderTarget,c.gl_renderbuffer=null,c.texture=null;var R=c.device.gl,l=E.format,T=E.width,A=E.height,d=E.sampleCount,f=void 0===d?1:d,h=E.texture,S=!1;if(l!==G.D32F&&l!==G.D24_S8||!h||ct(R)||_.WEBGL_depth_texture||(h.destroy(),c.texture=null,S=!0),!S&&h)c.texture=h;else{c.gl_renderbuffer=c.device.ensureResourceExists(R.createRenderbuffer()),R.bindRenderbuffer(R.RENDERBUFFER,c.gl_renderbuffer);var N=c.device.translateTextureInternalFormat(l,!0);ct(R)&&f>1?R.renderbufferStorageMultisample(n.RENDERBUFFER,f,N,T,A):R.renderbufferStorage(n.RENDERBUFFER,N,T,A)}return c.format=l,c.width=T,c.height=A,c.sampleCount=f,c}return Object(w.c)(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this),null!==this.gl_renderbuffer&&this.device.gl.deleteRenderbuffer(this.gl_renderbuffer),this.texture&&this.texture.destroy()},t}(Et);!function(e){e[e.NeedsCompile=0]="NeedsCompile",e[e.Compiling=1]="Compiling",e[e.NeedsBind=2]="NeedsBind",e[e.ReadyToUse=3]="ReadyToUse"}(mt||(mt={}));var Dt=function(e){function t(t,r){var n=t.id,_=t.device,E=t.descriptor,c=e.call(this,{id:n,device:_})||this;c.rawVertexGLSL=r,c.type=o.Program,c.uniformSetters={},c.attributes=[];var R=c.device.gl;return c.descriptor=E,c.gl_program=c.device.ensureResourceExists(R.createProgram()),c.gl_shader_vert=null,c.gl_shader_frag=null,c.compileState=mt.NeedsCompile,c.tryCompileProgram(),c}return Object(w.c)(t,e),t.prototype.destroy=function(){e.prototype.destroy.call(this),this.device.gl.deleteProgram(this.gl_program),this.device.gl.deleteShader(this.gl_shader_vert),this.device.gl.deleteShader(this.gl_shader_frag)},t.prototype.tryCompileProgram=function(){Q(this.compileState===mt.NeedsCompile);var e=this.descriptor,t=e.vertex,r=e.fragment,n=this.device.gl;(null==t?void 0:t.glsl)&&(null==r?void 0:r.glsl)&&(this.gl_shader_vert=this.compileShader(t.postprocess?t.postprocess(t.glsl):t.glsl,n.VERTEX_SHADER),this.gl_shader_frag=this.compileShader(r.postprocess?r.postprocess(r.glsl):r.glsl,n.FRAGMENT_SHADER),n.attachShader(this.gl_program,this.gl_shader_vert),n.attachShader(this.gl_program,this.gl_shader_frag),n.linkProgram(this.gl_program),this.compileState=mt.Compiling,ct(n)||(this.readUniformLocationsFromLinkedProgram(),this.readAttributesFromLinkedProgram()))},t.prototype.readAttributesFromLinkedProgram=function(){for(var e,t=this.device.gl,r=t.getProgramParameter(this.gl_program,t.ACTIVE_ATTRIBUTES),n=function(e){var t={};return e.replace(/^\s*#define\s*(\S*)\s*(\S*)\s*$/gm,(function(e,r,n){var o=Number(n);return t[r]=isNaN(o)?n:o,""})),t}(this.descriptor.vertex.glsl),o=function(e,t){var r=[];return e.replace(/^\s*layout\(location\s*=\s*(\S*)\)\s*in\s+\S+\s*(.*);$/gm,(function(e,n,o){var _=Number(n);return r.push({location:isNaN(_)?t[n]:_,name:o}),""})),r}(this.rawVertexGLSL,n),_=function(r){var n=t.getActiveAttrib(E.gl_program,r),_=n.name,c=n.type,R=n.size,l=t.getAttribLocation(E.gl_program,_),T=null===(e=o.find((function(e){return e.name===_})))||void 0===e?void 0:e.location;l>=0&&!Object(y.a)(T)&&(E.attributes[T]={name:_,location:l,type:c,size:R})},E=this,c=0;c<r;c++)_(c)},t.prototype.readUniformLocationsFromLinkedProgram=function(){for(var e=this.device.gl,t=e.getProgramParameter(this.gl_program,e.ACTIVE_UNIFORMS),i=0;i<t;i++){var r=e.getActiveUniform(this.gl_program,i),n=We(r.name).name,o=e.getUniformLocation(this.gl_program,n);if(this.uniformSetters[n]=tt(e,o,r),r&&r.size>1)for(var _=0;_<r.size;_++)o=e.getUniformLocation(this.gl_program,"".concat(n,"[").concat(_,"]")),this.uniformSetters["".concat(n,"[").concat(_,"]")]=tt(e,o,r)}},t.prototype.compileShader=function(e,t){var r=this.device.gl,n=this.device.ensureResourceExists(r.createShader(t));return r.shaderSource(n,e),r.compileShader(n),n},t.prototype.setUniformsLegacy=function(e){void 0===e&&(e={});var t=this.device.gl;if(!ct(t)){var r=!1;for(var n in e){r||(t.useProgram(this.gl_program),r=!0);var o=e[n],_=this.uniformSetters[n];if(_){var E=o;E instanceof Ut&&(E=E.textureIndex),_(E)}}}return this},t}(Et),Pt=function(e){function t(t){var r=t.id,_=t.device,E=t.descriptor,c=e.call(this,{id:r,device:_})||this;c.type=o.QueryPool;var R=c.device.gl;if(ct(R)){var l=E.elemCount,T=E.type;c.gl_query=function(e,t){for(var r=new Array(e),i=0;i<e;i++)r[i]=t();return r}(l,(function(){return c.device.ensureResourceExists(R.createQuery())})),c.gl_query_type=function(e){if(e===L.OcclusionConservative)return n.ANY_SAMPLES_PASSED_CONSERVATIVE;throw new Error("whoops")}(T)}return c}return Object(w.c)(t,e),t.prototype.queryResultOcclusion=function(e){var t=this.device.gl;if(ct(t)){var r=this.gl_query[e];return t.getQueryParameter(r,t.QUERY_RESULT_AVAILABLE)?!!t.getQueryParameter(r,t.QUERY_RESULT):null}return null},t.prototype.destroy=function(){e.prototype.destroy.call(this);var t=this.device.gl;if(ct(t))for(var i=0;i<this.gl_query.length;i++)t.deleteQuery(this.gl_query[i])},t}(Et),bt=function(e){function t(t){var r=t.id,n=t.device,_=e.call(this,{id:r,device:n})||this;return _.type=o.Readback,_.gl_pbo=null,_.gl_sync=null,_}return Object(w.c)(t,e),t.prototype.clientWaitAsync=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=10);var n=this.device.gl;return new Promise((function(o,_){!function E(){var c=n.clientWaitSync(e,t,0);c!=n.WAIT_FAILED?c!=n.TIMEOUT_EXPIRED?o():setTimeout(E,Object(X.a)(r,0,n.MAX_CLIENT_WAIT_TIMEOUT_WEBGL)):_()}()}))},t.prototype.getBufferSubDataAsync=function(e,t,r,n,o,_){return Object(w.b)(this,void 0,void 0,(function(){var E;return Object(w.d)(this,(function(c){switch(c.label){case 0:return ct(E=this.device.gl)?(this.gl_sync=E.fenceSync(E.SYNC_GPU_COMMANDS_COMPLETE,0),E.flush(),[4,this.clientWaitAsync(this.gl_sync,0,10)]):[3,2];case 1:return c.sent(),E.bindBuffer(e,t),E.getBufferSubData(e,r,n,o,_),E.bindBuffer(e,null),[2,n];case 2:return[2]}}
1))}))},t.prototype.readTexture=function(e,t,r,o,_,E,c,R){return void 0===c&&(c=0),void 0===R&&(R=E.byteLength||0),Object(w.b)(this,void 0,void 0,(function(){var l,T,A,d,f;return Object(w.d)(this,(function(h){var S;return l=this.device.gl,T=e,A=this.device.translateTextureFormat(T.format),d=this.device.translateTextureType(T.format),S=T.format,f=j(Y(S))*k(S),ct(l)?(this.gl_pbo=this.device.ensureResourceExists(l.createBuffer()),l.bindBuffer(l.PIXEL_PACK_BUFFER,this.gl_pbo),l.bufferData(l.PIXEL_PACK_BUFFER,R,l.STREAM_READ),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),l.bindFramebuffer(n.READ_FRAMEBUFFER,this.device.readbackFramebuffer),l.framebufferTexture2D(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,T.gl_texture,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,this.gl_pbo),l.readPixels(t,r,o,_,A,d,c*f),l.bindBuffer(l.PIXEL_PACK_BUFFER,null),[2,this.getBufferSubDataAsync(l.PIXEL_PACK_BUFFER,this.gl_pbo,0,E,c,0)]):[2,this.readTextureSync(e,t,r,o,_,E,c,R)]}))}))},t.prototype.readTextureSync=function(e,t,r,o,_,E,c,R){void 0===R&&(R=E.byteLength||0);var l=this.device.gl,T=e,A=this.device.translateTextureType(T.format);return l.bindFramebuffer(n.FRAMEBUFFER,this.device.readbackFramebuffer),l.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,T.gl_texture,0),l.pixelStorei(l.PACK_ALIGNMENT,4),l.readPixels(t,r,o,_,l.RGBA,A,E),E},t.prototype.readBuffer=function(b,e,t,r,n){return Object(w.b)(this,void 0,void 0,(function(){var o;return Object(w.d)(this,(function(_){return ct(o=this.device.gl)?[2,this.getBufferSubDataAsync(o.ARRAY_BUFFER,ht(b,e),e,t,r,n)]:[2,Promise.reject()]}))}))},t.prototype.destroy=function(){e.prototype.destroy.call(this),ct(this.device.gl)&&(null!==this.gl_sync&&this.device.gl.deleteSync(this.gl_sync),null!==this.gl_pbo&&this.device.gl.deleteBuffer(this.gl_pbo))},t}(Et),vt=function(e){function t(t){var r,_,E=t.id,c=t.device,R=t.descriptor,l=e.call(this,{id:E,device:c})||this;return l.type=o.RenderPipeline,l.drawMode=function(e){switch(e){case f.TRIANGLES:return n.TRIANGLES;case f.POINTS:return n.POINTS;case f.TRIANGLE_STRIP:return n.TRIANGLE_STRIP;case f.LINES:return n.LINES;case f.LINE_STRIP:return n.LINE_STRIP;default:throw new Error("Unknown primitive topology mode")}}(null!==(r=R.topology)&&void 0!==r?r:f.TRIANGLES),l.program=R.program,l.inputLayout=R.inputLayout,l.megaState=Object(w.a)(Object(w.a)({},Re(Te)),R.megaStateDescriptor),l.colorAttachmentFormats=R.colorAttachmentFormats.slice(),l.depthStencilAttachmentFormat=R.depthStencilAttachmentFormat,l.sampleCount=null!==(_=R.sampleCount)&&void 0!==_?_:1,l}return Object(w.c)(t,e),t}(Et),Gt=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;return E.type=o.ComputePipeline,E.descriptor=_,E}return Object(w.c)(t,e),t}(Et),yt=function(){function e(){this.liveObjects=new Set,this.creationStacks=new Map,this.deletionStacks=new Map}return e.prototype.trackResourceCreated=function(e){this.creationStacks.set(e,(new Error).stack),this.liveObjects.add(e)},e.prototype.trackResourceDestroyed=function(e){this.deletionStacks.has(e)&&console.warn("Object double freed:",e,"\n\nCreation stack: ",this.creationStacks.get(e),"\n\nDeletion stack: ",this.deletionStacks.get(e),"\n\nThis stack: ",(ne
1w Error).stack),this.deletionStacks.set(e,(new Error).stack),this.liveObjects.delete(e)},e.prototype.checkForLeaks=function(){var e,t;try{for(var r=Object(w.h)(this.liveObjects.values()),n=r.next();!n.done;n=r.next()){var o=n.value;console.warn("Object leaked:",o,"Creation stack:",this.creationStacks.get(o))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.setResourceLeakCheck=function(e,t){t?this.liveObjects.add(e):this.liveObjects.delete(e)},e}(),xt=function(e){function t(t){var r,_,E=t.id,c=t.device,R=t.descriptor,l=e.call(this,{id:E,device:c})||this;l.type=o.Sampler;var T=l.device.gl;if(ct(T)){var f=l.device.ensureResourceExists(T.createSampler());T.samplerParameteri(f,n.TEXTURE_WRAP_S,ft(R.addressModeU)),T.samplerParameteri(f,n.TEXTURE_WRAP_T,ft(R.addressModeV)),T.samplerParameteri(f,n.TEXTURE_WRAP_R,ft(null!==(r=R.addressModeW)&&void 0!==r?r:R.addressModeU)),T.samplerParameteri(f,n.TEXTURE_MIN_FILTER,pt(R.minFilter,R.mipmapFilter)),T.samplerParameteri(f,n.TEXTURE_MAG_FILTER,pt(R.magFilter,d.NO_MIP)),void 0!==R.lodMinClamp&&T.samplerParameterf(f,n.TEXTURE_MIN_LOD,R.lodMinClamp),void 0!==R.lodMaxClamp&&T.samplerParameterf(f,n.TEXTURE_MAX_LOD,R.lodMaxClamp),void 0!==R.compareFunction&&(T.samplerParameteri(f,T.TEXTURE_COMPARE_MODE,T.COMPARE_REF_TO_TEXTURE),T.samplerParameteri(f,T.TEXTURE_COMPARE_FUNC,R.compareFunction));var h=null!==(_=R.maxAnisotropy)&&void 0!==_?_:1;h>1&&null!==l.device.EXT_texture_filter_anisotropic&&(Q(R.minFilter===A.BILINEAR&&R.magFilter===A.BILINEAR&&R.mipmapFilter===d.LINEAR),T.samplerParameterf(f,l.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,h)),l.gl_sampler=f}else l.descriptor=R;return l}return Object(w.c)(t,e),t.prototype.setTextureParameters=function(e,t,r){var o,_=this.device.gl,E=this.descriptor;this.isNPOT(t,r)?_.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.L
1INEAR):_.texParameteri(e,n.TEXTURE_MIN_FILTER,pt(E.minFilter,E.mipmapFilter)),_.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,ft(E.addressModeU)),_.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,ft(E.addressModeV)),_.texParameteri(e,n.TEXTURE_MAG_FILTER,pt(E.magFilter,d.NO_MIP));var c=null!==(o=E.maxAnisotropy)&&void 0!==o?o:1;c>1&&null!==this.device.EXT_texture_filter_anisotropic&&(Q(E.minFilter===A.BILINEAR&&E.magFilter===A.BILINEAR&&E.mipmapFilter===d.LINEAR),_.texParameteri(e,this.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c))},t.prototype.destroy=function(){e.prototype.destroy.call(this),ct(this.device.gl)&&this.device.gl.deleteSampler(Nt(this))},t.prototype.isNPOT=function(e,t){return!oe(e)||!oe(t)},t}(Et),Xt=function(){function e(){}return e.prototype.dispatchWorkgroups=function(e,t,r){},e.prototype.dispatchWorkgroupsIndirect=function(e,t){},e.prototype.setPipeline=function(e){},e.prototype.setBindings=function(e){},e.prototype.pushDebugGroup=function(e){},e.prototype.popDebugGroup=function(){},e.prototype.insertDebugMarker=function(e){},e}(),wt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=o.RenderBundle,t.commands=[],t}return Object(w.c)(t,e),t.prototype.push=function(e){this.commands.push(e)},t.prototype.replay=function(){this.commands.forEach((function(e){return e()}))},t}(Et),Wt=/uniform(?:\s+)(\w+)(?:\s?){([^]*?)}/g,Ht=function(){function e(e,t){void 0===t&&(t={}),this.shaderDebug=!1,this.OES_vertex_array_object=null,this.ANGLE_instanced_arrays=null,this.OES_texture_float=null,this.OES_draw_buffers_indexed=null,this.WEBGL_draw_buffers=null,this.WEBGL_depth_texture=null,this.WEBGL_color_buffer_float=null,this.EXT_color_buffer_half_float=null,this.WEBGL_compressed_texture_s3tc=null,this.WEBGL_compressed_texture_s3tc_srgb=null,this.EXT_texture_compression_rgtc=null,this.EXT_texture_filter_anisotropic=null,this.KHR_parallel_shader_compile=null,this.EXT_texture_norm16=null,this.EXT_color_buffer_float=null,this.OES_texture_float_linear=null,this.OES_texture_half_float_linear=null,this.scTexture=null,this.scPlatformFramebuffer=null,this.currentActiveTexture=null,this.currentBoundVAO=null,this.currentProgram=null,this.resourceCreationTracker=null,this.resourceUniqueId=0,this.currentColorAttachments=[],this.currentColorAttachmentLevels=[],this.currentColorResolveTos=[],this.currentColorResolveToLevels=[],this.currentSampleCount=-1,this.currentIndexBufferByteOffset=null,this.currentMegaState=Re(Te),this.currentSamplers=[],this.currentTextures=[],this.currentUniformBuffers=[],this.currentUniformBufferByteOffsets=[],this.currentUniformBufferByteSizes=[],this.currentScissorEnabled=!1,this.currentStencilRef=null,this.currentRenderPassDescriptor=null,this.currentRenderPassDescriptorStack=[],this.debugGroupStack=[],this.resolveColorAttachmentsChanged=!1,this.resolveDepthStencilAttachmentsChanged=!1,this.explicitBindingLocations=!1,this.separateSamplerTextures=!1,this.viewportOrigin=M.LOWER_LEFT,this.clipSpaceNearZ=U.NEGATIVE_ONE,this.supportMRT=!1,this.inBlitRenderPass=!1,this.supportedSampleCounts=[],this.occlusionQueriesRecommended=!1,this.computeShadersSupported=!1,this.gl=e,this.contextAttributes=$(e.getContextAttributes()),ct(e)?(this.EXT_texture_norm16=e.getExtension("EXT_texture_norm16"),this.EXT_color_buffer_float=e.getExtension("EXT_color_buffer_float")):(this.OES_vertex_array_object=e.getExtension("OES_vertex_array_object"),this.ANGLE_instanced_arrays=e.getExtension("ANGLE_instanced_arrays"),this.OES_texture_float=e.getExtension("OES_texture_float"),this.WEBGL_draw_buffers=e.getExtension("WEBGL_draw_buffers"),this.WEBGL_depth_texture=e.getExtension("WEBGL_depth_texture"),this.WEBGL_color_buffer_float=e.getExtension("WEBGL_color_buffer_float"),this.EXT_color_buffer_half_float=e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_frag_depth"),e.getExtension("OES_element_index_uint"),e.getExtension("OES_standard_derivatives")),this.WEBGL_compressed_texture_s3tc=e.getExtension("WEBGL_compressed_texture_s3tc"),this.WEBGL_compressed_texture_s3tc_srgb=e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),this.EXT_texture_compression_rgtc=e.getExtension("EXT_texture_compression_rgtc"),this.EXT_texture_filter_anisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.EXT_texture_norm16=e.getExtension("EXT_texture_norm16"),this.OES_texture_float_linear=e.getExtension("OES_texture_float_linear"),this.OES_texture_half_float_linear=e.getExtension("OES_texture_half_float_linear"),this.KHR_parallel_shader_compile=e.getExtension("KHR_parallel_shader_compile"),ct(e)?(this.platformString="WebGL2",this.glslVersion="#version 300 es"):(this.platformString="WebGL1",this.glslVersion="#version 100"),this.scTexture=new Ut({id:this.getNextUniqueId(),device:this,descriptor:{width:0,height:0,depthOrArrayLayers:1,dimension:F.TEXTURE_2D,mipLevelCount:1,usage:C.RENDER_TARGET,format:!1===this.contextAttributes.alpha?G.U8_RGB_RT:G.U8_RGBA_RT},fake:!0}),this.scTexture.formatKind=I.Float,this.scTexture.gl_target=null,this.scTexture.gl_texture=null,this.resolveColorReadFramebuffer=this.ensureResourceExists(e.createFramebuffer()),this.resolveColorDrawFramebuffer=this.ensureResourceExists(e.createFramebuffer()),this.resolveDepthStencilReadFramebuffer=this.ensureResourceExists(e.createFramebuffer()),this.resolveDepthStencilDrawFramebuffer=this.ensureResourceExists(e.createFramebuffer()),this.renderPassDrawFramebuffer=this.ensureResourceExists(e.createFramebuffer()),this.readbackFramebuffer=this.ensureResourceExists(e.createFramebuffer()),this.fallbackTexture2D=this.createFallbackTexture(F.TEXTURE_2D,I.Float),this.fallbackTexture2DDepth=this.createFallbackTexture(F.TEXTURE_2D,I.Depth),this.fallbackVertexBuffer=this.createBuffer({viewOrSize:1,usage:h.VERTEX,hint:S.STATIC}),ct(e)&&(this.fallbackTexture2DArray=this.createFallbackTexture(F.TEXTURE_2D_ARRAY,I.Float),this.fallbackTexture3D=this.createFallbackTexture(F.TEXTURE_3D,I.Float),this.fallbackTextureCube=this.createFallbackTexture(F.TEXTURE_CUBE_MAP,I.Float)),this.currentMegaState.depthCompare=_.LESS,this.currentMegaState.depthWrite=!1,this.currentMegaState.attachmentsState[0].channelWriteMask=O.ALL,e.enable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),this.checkLimits(),t.shaderDebug&&(this.shaderDebug=!0),t.trackResources&&(this.resourceCreationTracker=new yt)}return e.prototype.destroy=function(){this.blitBindings&&this.blitBindings.destroy(),this.blitInputLayout&&this.blitInputLayout.destroy(),this.blitRenderPipeline&&this.blitRenderPipeline.destroy(),this.blitVertexBuffer&&this.blitVertexBuffer.destroy(),this.blitProgram&&this.blitProgram.destroy()},e.prototype.createFallbackTexture=function(e,t){var r=e===F.TEXTURE_CUBE_MAP?6:1,n=t===I.Depth?G.D32F:G.U8_RGBA_NORM,o=this.createTexture({dimension:e,format:n,usage:C.SAMPLED,width:1,height:1,depthOrArrayLayers:r,mipLevelCount:1});return t===I.Float&&o.setImageData([new Uint8Array(4*r)]),St(o)},e.prototype.getNextUniqueId=function(){return++this.resourceUniqueId},e.prototype.checkLimits=function(){var e=this.gl;if(this.maxVertexAttribs=e.getParameter(n.MAX_VERTEX_ATTRIBS),ct(e)){this.uniformBufferMaxPageByteSize=Math.min(e.getParameter(n.MAX_UNIFORM_BLOCK_SIZE),65536),this.uniformBufferWordAlignment=e.getParameter(e.UNIFORM_BUFFER_OFFSET_ALIGNMENT)/4;var t=e.getInternalformatParameter(e.RENDERBUFFER,e.DEPTH32F_STENCIL8,e.SAMPLES);this.supportedSampleCounts=t?Object(w.g)([],Object(w.e)(t),!1):[],this.occlusionQueriesRecommended=!0}else this.uniformBufferWordAlignment=64,this.uniformBufferMaxPageByteSize=65536;this.uniformBufferMaxPageWordSize=this.uniformBufferMaxPageByteSize/4,this.supportedSampleCounts.includes(1)||this.supportedSampleCounts.push(1),this.supportedSampleCounts.sort((function(a,b){return a-b}))},e.prototype.configureSwapChain=function(e,t,r){var n,o=this.scTexture;o.width=e,o.height=t,this.scPlatformFramebuffer=void 0===(n=r)?null:n},e.prototype.getDevice=function(){return this},e.prototype.getCanvas=function(){return this.gl.canvas},e.prototype.getOnscreenTexture=function(){return this.scTexture},e.prototype.beginFrame=function(){},e.prototype.endFrame=function(){},e.prototype.translateTextureInternalFormat=function(e,t){switch(void 0===t&&(t=!1),e){case G.ALPHA:return n.ALPHA;case G.U8_LUMINANCE:case G.F16_LUMINANCE:case G.F32_LUMINANCE:return n.LUMINANCE;case G.F16_R:return n.R16F;case G.F16_RG:return n.RG16F;case G.F16_RGB:return n.RGB16F;case G.F16_RGBA:return n.RGBA16F;case G.F32_R:return n.R32F;case G.F32_RG:return n.RG32F;case G.F32_RGB:return n.RGB32F;case G.F32_RGBA:return ct(this.gl)?n.RGBA32F:t?this.WEBGL_color_buffer_float.RGBA32F_EXT:n.RGBA;case G.U8_R_NORM:return n.R8;case G.U8_RG_NORM:return n.RG8;case G.U8_RGB_NORM:case G.U8_RGB_RT:return n.RGB8;case G.U8_RGB_SRGB:return n.SRGB8;case G.U8_RGBA_NORM:case G.U8_RGBA_RT:return ct(this.gl)?n.RGBA8:t?n.RGBA4:n.RGBA;case G.U8_RGBA:return n.RGBA;case G.U8_RGBA_SRGB:case G.U8_RGBA_RT_SRGB:return n.SRGB8_ALPHA8;case G.U16_R:return n.R16UI;case G.U16_R_NORM:return this.EXT_texture_norm16.R16_EXT;case G.U16_RG_NORM:return this.EXT_texture_norm16.RG16_EXT;case G.U16_RGBA_NORM:return this.EXT_texture_norm16.RGBA16_EXT;case G.U16_RGBA_5551:return n.RGB5_A1;case G.U16_RGB_565:return n.RGB565;case G.U32_R:return n.R32UI;case G.S8_RGBA_NORM:return n.RGBA8_SNORM;case G.S8_RG_NORM:return n.RG8_SNORM;case G.BC1:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT;case G.BC1_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;case G.BC2:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT;case G.BC2_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;case G.BC3:return this.WEBGL_compressed_texture_s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT;case G.BC3_SRGB:return this.WEBGL_compressed_texture_s3tc_srgb.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;case G.BC4_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_RGT
1C1_EXT;case G.BC4_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT;case G.BC5_UNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT;case G.BC5_SNORM:return this.EXT_texture_compression_rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT;case G.D32F_S8:return ct(this.gl)?n.DEPTH32F_STENCIL8:this.WEBGL_depth_texture?n.DEPTH_STENCIL:n.DEPTH_COMPONENT16;case G.D24_S8:return ct(this.gl)?n.DEPTH24_STENCIL8:this.WEBGL_depth_texture?n.DEPTH_STENCIL:n.DEPTH_COMPONENT16;case G.D32F:return ct(this.gl)?n.DEPTH_COMPONENT32F:this.WEBGL_depth_texture?n.DEPTH_COMPONENT:n.DEPTH_COMPONENT16;case G.D24:return ct(this.gl)?n.DEPTH_COMPONENT24:this.WEBGL_depth_texture?n.DEPTH_COMPONENT:n.DEPTH_COMPONENT16;default:throw new Error("whoops")}},e.prototype.translateTextureType=function(e){switch(Y(e)){case D.U8:return n.UNSIGNED_BYTE;case D.U16:return n.UNSIGNED_SHORT;case D.U32:return n.UNSIGNED_INT;case D.S8:return n.BYTE;case D.F16:return n.HALF_FLOAT;case D.F32:return n.FLOAT;case D.U16_PACKED_5551:return n.UNSIGNED_SHORT_5_5_5_1;case D.D32F:return ct(this.gl)?n.FLOAT:this.WEBGL_depth_texture?n.UNSIGNED_INT:n.UNSIGNED_BYTE;case D.D24:return ct(this.gl)?n.UNSIGNED_INT_24_8:this.WEBGL_depth_texture?n.UNSIGNED_SHORT:n.UNSIGNED_BYTE;case D.D24S8:return ct(this.gl)?n.UNSIGNED_INT_24_8:this.WEBGL_depth_texture?n.UNSIGNED_INT_24_8_WEBGL:n.UNSIGNED_BYTE;case D.D32FS8:return n.FLOAT_32_UNSIGNED_INT_24_8_REV;default:throw new Error("whoops")}},e.prototype.translateInternalTextureFormat=function(e){switch(e){case G.F32_R:return n.R32F;case G.F32_RG:return n.RG32F;case G.F32_RGB:return n.RGB32F;case G.F32_RGBA:return n.RGBA32F;case G.F16_R:return n.R16F;case G.F16_RG:return n.RG16F;case G.F16_RGB:return n.RGB16F;case G.F16_RGBA:return n.RGBA16F}return this.translateTextureFormat(e)},e.prototype.translateTextureFormat=function(e){if(Rt(e)||e===G.F32_LUMINANCE||e===G.U8_LUMINANCE)return this.translateTextureInternalFormat(e);var t=ct(this.gl)||!ct(this.gl)&&!!this.WEBGL_depth_texture;switch(e){case G.D24_S8:case G.D32F_S8:return t?n.DEPTH_STENCIL:n.RGBA;case G.D24:case G.D32F:return t?n.DEPTH_COMPONENT:n.RGBA}var r=lt(e);switch(k(e)){case P.A:return n.ALPHA;case P.R:return r?n.RED_INTEGER:n.RED;case P.RG:return r?n.RG_INTEGER:n.RG;case P.RGB:return r?n.RGB_INTEGER:n.RGB;case P.RGBA:return n.RGBA}},e.prototype.setActiveTexture=function(e){this.currentActiveTexture!==e&&(this.gl.activeTexture(e),this.currentActiveTexture=e)},e.prototype.bindVAO=function(e){this.currentBoundVAO!==e&&(ct(this.gl)?this.gl.bindVertexArray(e):this.OES_vertex_array_object.bindVertexArrayOES(e),this.currentBoundVAO=e)},e.prototype.programCompiled=function(e){Q(e.compileState!==mt.NeedsCompile),e.compileState===mt.Compiling&&(e.compileState=mt.NeedsBind,this.shaderDebug&&this.checkProgramCompilationForErrors(e))},e.prototype.useProgram=function(e){this.currentProgram!==e&&(this.programCompiled(e),this.gl.useProgram(e.gl_program),this.currentProgram=e)},e.prototype.ensureResourceExists=function(e){if(null===e){var t=this.gl.getError();throw new Error("Created resource is null; GL error encountered: ".concat(t))}return e},e.prototype.createBuffer=function(e){return new It({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createTexture=function(e){return new Ut({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createSampler=function(e){return new xt({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createRenderTarget=function(e){return new Lt({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createRenderTargetFromTexture=function(e){var t=e,r=t.format,n=t.width,o=t.height;return Q(1===t.mipLevelCount),this.createRenderTarget({format:r,width:n,height:o,sampleCount:1,texture:e})},e.prototype.createProgram=function(e){var t,r,n,o=null===(t=e.vertex)||void 0===t?void 0:t.glsl;return(null===(r=e.vertex)||void 0===r?void 0:r.glsl)&&(e.vertex.glsl=st(this.queryVendorInfo(),"vert",e.vertex.glsl)),(null===(n=e.fragment)||void 0===n?void 0:n.glsl)&&(e.fragment.glsl=st(this.queryVendorInfo(),"frag",e.fragment.glsl)),this.createProgramSimple(e,o)},e.prototype.createProgramSimple=function(e,t){return new Dt({id:this.getNextUniqueId(),device:this,descriptor:e},t)},e.prototype.createBindings=function(e){return new ut({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createInputLayout=function(e){return new Mt({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createRenderPipeline=function(e){return new vt({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createComputePass=function(){return new Xt},e.prototype.createComputePipeline=function(e){return new Gt({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createReadback=function(){return new bt({id:this.getNextUniqueId(),device:this})},e.prototype.createQueryPool=function(e,t){return new Pt({id:this.getNextUniqueId(),device:this,descriptor:{type:e,elemCount:t}})},e.prototype.formatRenderPassDescriptor=function(e){var t,r,n,o,_,E,c=e.colorAttachment;e.depthClearValue=null!==(t=e.depthClearValue)&&void 0!==t?t:"load",e.stencilClearValue=null!==(r=e.stencilClearValue)&&void 0!==r?r:"load";for(var i=0;i<c.length;i++)e.colorAttachmentLevel||(e.colorAttachmentLevel=[]),e.colorAttachmentLevel[i]=null!==(n=e.colorAttachmentLevel[i])&&void 0!==n?n:0,e.colorResolveToLevel||(e.colorResolveToLevel=[]),e.colorResolveToLevel[i]=null!==(o=e.colorResolveToLevel[i])&&void 0!==o?o:0,e.colorClearColor||(e.colorClearColor=[]),e.colorClearColor[i]=null!==(_=e.colorClearColor[i])&&void 0!==_?_:"load",e.colorStore||(e.colorStore=[]),e.colorStore[i]=null!==(E=e.colorStore[i])&&void 0!==E&&E},e.prototype.createRenderBundle=function(){return new wt({id:this.getNextUniqueId(),device:this})},e.prototype.beginBundle=function(e){this.renderBundle=e},e.prototype.endBundle=function(){this.renderBundle=void 0},e.prototype.executeBundles=function(e){e.forEach((function(e){e.replay()}))},e.prototype.createRenderPass=function(e){null!==this.currentRenderPassDescriptor&&this.currentRenderPassDescriptorStack.push(this.currentRenderPassDescriptor),this.currentRenderPassDescriptor=e,this.formatRenderPassDescriptor(e);var t=e.colorAttachment,r=e.colorAttachmentLevel,n=e.colorClearColor,o=e.colorResolveTo,_=e.colorResolveToLevel,E=e.depthStencilAttachment,c=e.depthClearValue,R=e.stencilClearValue,l=e.depthStencilResolveTo,T=o&&1===o.length&&o[0]===this.scTexture;this.setRenderPassParametersBegin(t.length,T);for(var i=0;i<t.length;i++)this.setRenderPassParametersColor(i,t[i],r[i],o[i],_[i],T);this.setRenderPassParametersDepthStencil(E,l,T),this.validateCurrentAttachments();for(i=0;i<t.length;i++){var A=n[i];"load"!==A&&this.setRenderPassParametersClearColor(i,A.r,A.g,A.b,A.a)}return this.setRenderPassParametersClearDepthStencil(c,R),this},e.prototype.submitPass=function(e){Q(null!==this.currentRenderPassDescriptor),this.endPass(),this.currentRenderPassDescriptorStack.length?this.currentRenderPassDescriptor=this.currentRenderPassDescriptorStack.pop():this.currentRenderPassDescriptor=null},e.prototype.copySubTexture2D=function(e,t,r,n,o,_){var E=this.gl,c=e,R=n;if(Q(1===R.mipLevelCount),Q(1===c.mipLevelCount),ct(E))c===this.scTexture?E.bindFramebuffer(E.DRAW_FRAMEBUFFER,this.scPlatformFramebuffer):(E.bindFramebuffer(E.DRAW_FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.bindFramebufferAttachment(E.DRAW_FRAMEBUFFER,E.COLOR_ATTACHMENT0,c,0)),E.bindFramebuffer(E.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.bindFramebufferAttachment(E.READ_FRAMEBUFFER,E.COLOR_ATTACHMENT0,R,0),E.blitFramebuffer(o,_,o+R.width,_+R.height,t,r,t+R.width,r+R.height,E.COLOR_BUFFER_BIT,E.LINEAR),E.bindFramebuffer(E.READ_FRAMEBUFFER,null),E.bindFramebuffer(E.DRAW_FRAMEBUFFER,null);else if(c===this.scTexture){var rt=this.createRenderTargetFromTexture(n);
1this.submitBlitRenderPass(rt,c)}},e.prototype.queryLimits=function(){return this},e.prototype.queryTextureFormatSupported=function(e,t,r){switch(e){case G.BC1_SRGB:case G.BC2_SRGB:case G.BC3_SRGB:return null!==this.WEBGL_compressed_texture_s3tc_srgb&>(t,r,4,4);case G.BC1:case G.BC2:case G.BC3:return null!==this.WEBGL_compressed_texture_s3tc&>(t,r,4,4);case G.BC4_UNORM:case G.BC4_SNORM:case G.BC5_UNORM:case G.BC5_SNORM:return null!==this.EXT_texture_compression_rgtc&>(t,r,4,4);case G.U16_R_NORM:case G.U16_RG_NORM:case G.U16_RGBA_NORM:return null!==this.EXT_texture_norm16;case G.F32_R:case G.F32_RG:case G.F32_RGB:case G.F32_RGBA:return null!==this.OES_texture_float_linear;case G.F16_R:case G.F16_RG:case G.F16_RGB:case G.F16_RGBA:return null!==this.OES_texture_half_float_linear;default:return!0}},e.prototype.queryProgramReady=function(e){var t=this.gl;if(e.compileState===mt.NeedsCompile)throw new Error("whoops");if(e.compileState===mt.Compiling){var r=void 0;return(r=null===this.KHR_parallel_shader_compile||t.getProgramParameter(e.gl_program,this.KHR_parallel_shader_compile.COMPLETION_STATUS_KHR))&&this.programCompiled(e),r}return e.compileState===mt.NeedsBind||e.compileState===mt.ReadyToUse},e.prototype.queryPlatformAvailable=function(){return this.gl.isContextLost()},e.prototype.queryVendorInfo=function(){return this},e.prototype.queryRenderPass=function(e){return this.currentRenderPassDescriptor},e.prototype.queryRenderTarget=function(e){return e},e.prototype.setResourceName=function(e,t){if(e.name=t,e.type===o.Buffer)for(var r=e.gl_buffer_pages,i=0;i<r.length;i++)Bt(r[i],"".concat(t," Page ").concat(i));else if(e.type===o.Texture)Bt(St(e),t);else if(e.type===o.Sampler)Bt(Nt(e),t);else if(e.type===o.RenderTarget){var n=e.gl_renderbuffer;null!==n&&Bt(n,t)}else e.type===o.InputLayout&&Bt(e.vao,t)},e.prototype.setResourceLeakCheck=function(e,t){null!==this.resourceCreationTracker&&this.resourceCreationTracker.setResourceLeakCheck(e,t)},e.prototype.checkForLeaks=function(){null!==this.resourceCreationTracker&&this.resourceCreationTracker.checkForLeaks()},e.prototype.pushDebugGroup=function(e){},e.prototype.popDebugGroup=function(){},e.prototype.insertDebugMarker=function(e){},e.prototype.programPatched=function(e,t){Q(this.shaderDebug)},e.prototype.getBufferData=function(e,t,r){void 0===r&&(r=0);var n=this.gl;ct(n)&&(n.bindBuffer(n.COPY_READ_BUFFER,ht(e,4*r)),n.getBufferSubData(n.COPY_READ_BUFFER,4*r,t))},e.prototype.debugGroupStatisticsDrawCall=function(e){void 0===e&&(e=1);for(var i=this.debugGroupStack.length-1;i>=0;i--)this.debugGroupStack[i].drawCallCount+=e},e.prototype.debugGroupStatisticsBufferUpload=function(e){void 0===e&&(e=1);for(var i=this.debugGroupStack.length-1;i>=0;i--)this.debugGroupStack[i].bufferUploadCount+=e},e.prototype.debugGroupStatisticsTextureBind=function(e){void 0===e&&(e=1);for(var i=this.debugGroupStack.length-1;i>=0;i--)this.debugGroupStack[i].textureBindCount+=e},e.prototype.debugGroupStatisticsTriangles=function(e){for(var i=this.debugGroupStack.length-1;i>=0;i--)this.debugGroupStack[i].triangleCount+=e},e.prototype.reportShaderError=function(e,t){var r=this.gl,n=r.getShaderParameter(e,r.COMPILE_STATUS);if(!n){console.error(function(e,t){return void 0===t&&(t=1),e.split("\n").map((function(s,i){return"".concat(function(e,t,r){for(void 0===r&&(r="0");e.length<t;)e="".concat(r).concat(e);return e}(""+(t+i),4," ")," ").concat(s)})).join("\n")}(t));var o=r.getExtension("WEBGL_debug_shaders");o&&console.error(o.getTranslatedShaderSource(e)),console.error(r.getShaderInfoLog(e))}return n},e.prototype.checkProgramCompilationForErrors=function(e){var t=this.gl,r=e.gl_program;if(!t.getProgramParameter(r,t.LINK_STATUS)){var n=e.descriptor;if(!this.reportShaderError(e.gl_shader_vert,n.vertex.glsl))return;if(!this.reportShaderError(e.gl_shader_frag,n.fragment.glsl))return;console.error(t.getProgramInfoLog(e.gl_program))}},e.prototype.bindFramebufferAttachment=function(e,t,r,_){var E=this.gl;if(Object(y.a)(r))E.framebufferRenderbuffer(e,t,E.RENDERBUFFER,null);else if(r.type===o.RenderTarget)null!==r.gl_renderbuffer?E.framebufferRenderbuffer(e,t,E.RENDERBUFFER,r.gl_renderbuffer):null!==r.texture&&E.framebufferTexture2D(e,t,n.TEXTURE_2D,St(r.texture),_);else if(r.type===o.Texture){var c=St(r);r.dimension===F.TEXTURE_2D?E.framebufferTexture2D(e,t,n.TEXTURE_2D,c,_):ct(E)&&(r.dimension,F.TEXTURE_2D_ARRAY)}},e.prototype.bindFramebufferDepthStencilAttachment=function(e,t){var r=this.gl,n=Object(y.a)(t)?v.Depth|v.Stencil:K(t.format),o=!!(n&v.Depth),_=!!(n&v.Stencil);o&&_?ct(this.gl)||!ct(this.gl)&&!!this.WEBGL_depth_texture?this.bindFramebufferAttachment(e,r.DEPTH_STENCIL_ATTACHMENT,t,0):this.bindFramebufferAttachment(e,r.DEPTH_ATTACHMENT,t,0):o?(this.bindFramebufferAttachment(e,r.DEPTH_ATTACHMENT,t,0),this.bindFramebufferAttachment(e,r.STENCIL_ATTACHMENT,null,0)):_&&(this.bindFramebufferAttachment(e,r.STENCIL_ATTACHMENT,t,0),this.bindFramebufferAttachment(e,r.DEPTH_ATTACHMENT,null,0))},e.prototype.validateCurrentAttachments=function(){for(var e=-1,t=-1,r=-1,i=0;i<this.currentColorAttachments.length;i++){var n=this.currentColorAttachments[i];null!==n&&(-1===e?(e=n.sampleCount,t=n.width,r=n.height):(Q(e===n.sampleCount),Q(t===n.width),Q(r===n.height)))}this.currentDepthStencilAttachment&&(-1===e?e=this.currentDepthStencilAttachment.sampleC
1ount:(Q(e===this.currentDepthStencilAttachment.sampleCount),Q(t===this.currentDepthStencilAttachment.width),Q(r===this.currentDepthStencilAttachment.height))),this.currentSampleCount=e},e.prototype.setRenderPassParametersBegin=function(e,t){void 0===t&&(t=!1);var r=this.gl;if(t)r.bindFramebuffer(n.FRAMEBUFFER,null);else if(ct(r)?r.bindFramebuffer(n.DRAW_FRAMEBUFFER,this.renderPassDrawFramebuffer):this.inBlitRenderPass||r.bindFramebuffer(n.FRAMEBUFFER,this.renderPassDrawFramebuffer),ct(r)?r.drawBuffers([n.COLOR_ATTACHMENT0,n.COLOR_ATTACHMENT1,n.COLOR_ATTACHMENT2,n.COLOR_ATTACHMENT3]):!this.inBlitRenderPass&&this.WEBGL_draw_buffers&&this.WEBGL_draw_buffers.drawBuffersWEBGL([n.COLOR_ATTACHMENT0_WEBGL,n.COLOR_ATTACHMENT1_WEBGL,n.COLOR_ATTACHMENT2_WEBGL,n.COLOR_ATTACHMENT3_WEBGL]),!this.inBlitRenderPass)for(var i=e;i<this.currentColorAttachments.length;i++){var o=ct(r)?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,_=ct(r)?n.COLOR_ATTACHMENT0:n.COLOR_ATTACHMENT0_WEBGL;r.framebufferRenderbuffer(o,_+i,n.RENDERBUFFER,null),r.framebufferTexture2D(o,_+i,n.TEXTURE_2D,null,0)}this.currentColorAttachments.length=e},e.prototype.setRenderPassParametersColor=function(i,e,t,r,o,_){void 0===_&&(_=!1);var E=ct(this.gl);this.currentColorAttachments[i]===e&&this.currentColorAttachmentLevels[i]===t||(this.currentColorAttachments[i]=e,this.currentColorAttachmentLevels[i]=t,!_&&(E||!E&&this.WEBGL_draw_buffers)&&this.bindFramebufferAttachment(E?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,(E?n.COLOR_ATTACHMENT0:n.COLOR_ATTACHMENT0_WEBGL)+i,e,t),this.resolveColorAttachmentsChanged=!0),this.currentColorResolveTos[i]===r&&this.currentColorResolveToLevels[i]===o||(this.currentColorResolveTos[i]=r,this.currentColorResolveToLevels[i]=o,null!==r&&(this.resolveColorAttachmentsChanged=!0))},e.prototype.setRenderPassParametersDepthStencil=function(e,t,r){void 0===r&&(r=!1);var o=this.gl;this.currentDepthStencilAttachment!==e&&(this.currentDepthStencilAttachment=e,r||this.inBlitRenderPass||this.bindFramebufferDepthStencilAttachment(ct(o)?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,this.currentDepthStencilAttachment),this.resolveDepthStencilAttachmentsChanged=!0),this.currentDepthStencilResolveTo!==t&&(this.currentDepthStencilResolveTo=t,t&&(this.resolveDepthStencilAttachmentsChanged=!0))},e.prototype.setRenderPassParametersClearColor=function(slot,e,g,b,a){var t,r=this.gl;null!==this.OES_draw_buffers_indexed?(t=this.currentMegaState.attachmentsState[slot])&&t.channelWriteMask!==O.ALL&&(this.OES_draw_buffers_indexed.colorMaskiOES(slot,!0,!0,!0,!0),t.channelWriteMask=O.ALL):(t=this.currentMegaState.attachmentsState[0])&&t.channelWriteMask!==O.ALL&&(r.colorMask(!0,!0,!0,!0),t.channelWriteMask=O.ALL);this.setScissorRectEnabled(!1),ct(r)?r.clearBufferfv(r.COLOR,slot,[e,g,b,a
1]):(r.clearColor(e,g,b,a),r.clear(r.COLOR_BUFFER_BIT))},e.prototype.setRenderPassParametersClearDepthStencil=function(e,t){void 0===e&&(e="load"),void 0===t&&(t="load");var r=this.gl;"load"!==e&&(Q(!!this.currentDepthStencilAttachment),this.currentMegaState.depthWrite||(r.depthMask(!0),this.currentMegaState.depthWrite=!0),ct(r)?r.clearBufferfv(r.DEPTH,0,[e]):(r.clearDepth(e),r.clear(r.DEPTH_BUFFER_BIT))),"load"!==t&&(Q(!!this.currentDepthStencilAttachment),this.currentMegaState.stencilWrite||(r.enable(r.STENCIL_TEST),r.stencilMask(255),this.currentMegaState.stencilWrite=!0),ct(r)?r.clearBufferiv(r.STENCIL,0,[t]):(r.clearStencil(t),r.clear(r.STENCIL_BUFFER_BIT)))},e.prototype.setBindings=function(e){var t,r=this;if(this.renderBundle)this.renderBundle.push((function(){return r.setBindings(e)}));else{var n=this.gl,o=e,_=o.uniformBufferBindings,E=o.samplerBindings,c=o.bindingLayouts;Q(0<c.bindingLayoutTables.length);var R=c.bindingLayoutTables[0];Q(_.length>=R.numUniformBuffers),Q(E.length>=R.numSamplers);for(var i=0;i<_.length;i++){if(0!==(S=_[i]).size){var l=R.firstUniformBuffer+i,T=S.buffer,A=S.offset||0,d=S.size||T.byteSize;if(T!==this.currentUniformBuffers[l]||A!==this.currentUniformBufferByteOffsets[l]||d!==this.currentUniformBufferByteSizes[l]){var f=A%T.pageByteSize,h=T.gl_buffer_pages[A/T.pageByteSize|0];Q(f+d<=T.pageByteSize),ct(n)&&n.bindBufferRange(n.UNIFORM_BUFFER,l,h,f,d),this.currentUniformBuffers[l]=T,this.currentUniformBufferByteOffsets[l]=A,this.currentUniformBufferByteSizes[l]=d}}}for(i=0;i<R.numSamplers;i++){var S=E[i],N=R.firstSampler+i,B=null!==S&&null!==S.sampler?Nt(S.sampler):null,F=null!==S&&null!==S.texture?St(S.texture):null;if(this.currentSamplers[N]!==B&&(ct(n)&&n.bindSampler(N,B),this.currentSamplers[N]=B),this.currentTextures[N]!==F){if(this.setActiveTexture(n.TEXTURE0+N),null!==F){var C=$(S).texture,O=C.gl_target,m=C.width,I=C.height;S.texture.textureIndex=N,n.bindTexture(O,F),ct(n)||null===(t=S.sampler)||void 0===t||t.setTextureParameters(O,m,I),this.debugGroupStatisticsTextureBind()}else{var M=Object(w.a)(Object(w.a)({},S),de),U=M.dimension,L=M.formatKind;O=Ot(U);n.bindTexture(O,this.getFallbackTexture(Object(w.a)({gl_target:O,formatKind:L},M)))}this.currentTextures[N]=F}}}},e.prototype.setViewport=function(e,t,r,n){this.gl.viewport(e,t,r,n)},e.prototype.setScissorRect=function(e,t,r,n){var o=this.gl;this.setScissorRectEnabled(!0),o.scissor(e,t,r,n)},e.prototype.applyAttachmentStateIndexed=function(i,e,t){var r=this.gl,n=this.OES_draw_buffers_indexed;e.channelWriteMask!==t.channelWriteMask&&(n.colorMaskiOES(i,!!(t.channelWriteMask&O.RED),!!(t.channelWriteMask&O.GREEN),!!(t.channelWriteMask&O.BLUE),!!(t.channelWriteMask&O.ALPHA)),e.channelWriteMask=t.channelWriteMask);var o=e.rgbBlendState.blendMode!==t.rgbBlendState.blendMode||e.alphaBlendState.blendMode!==t.alphaBlendState.blendMode,_=e.rgbBlendState.blendSrcFactor!==t.rgbBlendState.blendSrcFactor||e.alphaBlendState.blendSrcFactor!==t.alphaBlendState.blendSrcFactor||e.rgbBlendState.blendDstFactor!==t.rgbBlendState.blendDstFactor||e.alphaBlendState.blendDstFactor!==t.alphaBlendState.blendDstFactor;(_||o)&&(Ct(e.rgbBlendState)&&Ct(e.alphaBlendState)?n.enableiOES(i,r.BLEND):Ct(t.rgbBlendState)&&Ct(t.alphaBlendState)&&n.disableiOES(i,r.BLEND)),o&&(n.blendEquationSeparateiOES(i,t.rgbBlendState.blendMode,t.alphaBlendState.blendMode),e.rgbBlendState.blendMode=t.rgbBlendState.blendMode,e.alphaBlendState.blendMode=t.alphaBlendState.blendMode),_&&(n.blendFuncSeparateiOES(i,t.rgbBlendState.blendSrcFactor,t.rgbBlendState.blendDstFactor,t.alphaBlendState.blendSrcFactor,t.alphaBlendState.blendDstFactor),e.rgbBlendState.blendSrcFactor=t.rgbBlendState.blendSrcFactor,e.alphaBlendState.blendSrcFactor=t.alphaBlendState.blendSrcFactor,e.rgbBlendState.blendDstFactor=t.rgbBlendState.blendDstFactor,e.alphaBlendState.blendDstFactor=t.alphaBlendState.blendDstFactor)},e.prototype.applyAttachmentState=function(e,t){var r=this.gl;e.channelWriteMask!==t.channelWriteMask&&(r.colorMask(!!(t.channelWriteMask&O.RED),!!(t.channelWriteMask&O.GREEN),!!(t.channelWriteMask&O.BLUE),!!(t.channelWriteMask&O.ALPHA)),e.channelWriteMask=t.channelWriteMask);var n=e.rgbBlendState.blendMode!==t.rgbBlendState.blendMode||e.alphaBlendState.blendMode!==t.alphaBlendState.blendMode,o=e.rgbBlendState.blendSrcFactor!==t.rgbBlendState.blendSrcFactor||e.alphaBlendState.blendSrcFactor!==t.alphaBlendState.blendSrcFactor||e.rgbBlendState.blendDstFactor!==t.rgbBlendState.blendDstFactor||e.alphaBlendState.blendDstFactor!==t.alphaBlendState.blendDstFactor;(o||n)&&(Ct(e.rgbBlendState)&&Ct(e.alphaBlendState)?r.enable(r.BLEND):Ct(t.rgbBlendState)&&Ct(t.alphaBlendState)&&r.disable(r.BLEND)),n&&(r.blendEquationSeparate(t.rgbBlendState.blendMode,t.alphaBlendState.blendMode),e.rgbBlendState.blendMode=t.rgbBlendState.blendMode,e.alphaBlendState.blendMode=t.alphaBlendState.blendMode),o&&(r.blendFuncSeparate(t.rgbBlendState.blendSrcFactor,t.rgbBlendState.blendDstFactor,t.alphaBlendState.blendSrcFactor,t.alphaBlendState.blendDstFactor),e.rgbBlendState.blendSrcFactor=t.rgbBlendState.blendSrcFactor,e.alphaBlendState.blendSrcFactor=t.alphaBlendState.blendSrcFactor,e.rgbBlendState.blendDstFactor=t.rgbBlendState.blendDstFactor,e.alphaBlendState.blendDstFactor=t.alphaBlendState.blendDstFactor)},e.prototype.setMegaState=function(e){var t=this.gl,r=this.currentMegaState;if(null!==this.OES_draw_buffers_indexed)for(var i=0;i<e.attachmentsState.length;i++)this.applyAttachmentStateIndexed(i,r.attachmentsState[0],e.attachmentsState[0]);else Q(1===e.attachmentsState.length),this.applyAttachmentState(r.attachmentsState[0],e.attachmentsState[0]);
1J(r.blendConstant,e.blendConstant)||(t.blendColor(e.blendConstant.r,e.blendConstant.g,e.blendConstant.b,e.blendConstant.a),ee(r.blendConstant,e.blendConstant)),r.depthCompare!==e.depthCompare&&(t.depthFunc(e.depthCompare),r.depthCompare=e.depthCompare),!!r.depthWrite!=!!e.depthWrite&&(t.depthMask(e.depthWrite),r.depthWrite=e.depthWrite),!!r.stencilWrite!=!!e.stencilWrite&&(t.stencilMask(e.stencilWrite?255:0),r.stencilWrite=e.stencilWrite);var n=!1;if(!Oe(r.stencilFront,e.stencilFront)){n=!0;var o=e.stencilFront,_=o.passOp,E=o.failOp,R=o.depthFailOp,l=o.compare;r.stencilFront.passOp===_&&r.stencilFront.failOp===E&&r.stencilFront.depthFailOp===R||(t.stencilOpSeparate(t.FRONT,E,R,_),r.stencilFront.passOp=_,r.stencilFront.failOp=E,r.stencilFront.depthFailOp=R),r.stencilFront.compare!==l&&(this.setStencilReference(0),r.stencilFront.compare=l)}if(!Oe(r.stencilBack,e.stencilBack)){n=!0;var T=e.stencilBack;_=T.passOp,E=T.failOp,R=T.depthFailOp,l=T.compare;r.stencilBack.passOp===_&&r.stencilBack.failOp===E&&r.stencilBack.depthFailOp===R||(t.stencilOpSeparate(t.BACK,E,R,_),r.stencilBack.passOp=_,r.stencilBack.failOp=E,r.stencilBack.depthFailOp=R),r.stencilBack.compare!==l&&(this.setStencilReference(0),r.stencilBack.compare=l)}r.stencilFront.mask===e.stencilFront.mask&&r.stencilBack.mask===e.stencilBack.mask||(n=!0,r.stencilFront.mask=e.stencilFront.mask,r.stencilBack.mask=e.stencilBack.mask),n&&this.applyStencil(),r.cullMode!==e.cullMode&&(r.cullMode===c.NONE?t.enable(t.CULL_FACE):e.cullMode===c.NONE&&t.disable(t.CULL_FACE),e.cullMode===c.BACK?t.cullFace(t.BACK):e.cullMode===c.FRONT?t.cullFace(t.FRONT):e.cullMode===c.FRONT_AND_BACK&&t.cullFace(t.FRONT_AND_BACK),r.cullMode=e.cullMode),r.frontFace!==e.frontFace&&(t.frontFace(e.frontFace),r.frontFace=e.frontFace),r.polygonOffset!==e.polygonOffset&&(e.polygonOffset?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),r.polygonOffset=e.polygonOffset),r.polygonOffsetFactor===e.polygonOffsetFactor&&r.polygonOffsetUnits===e.polygonOffsetUnits||(t.polygonOffset(e.polygonOffsetFactor,e.polygonOffsetUnits),r.polygonOffsetFactor=e.polygonOffsetFactor,r.polygonOffsetUnits=e.polygonOffsetUnits)},e.prototype.validatePipelineFormats=function(e){for(var i=0;i<this.currentColorAttachments.length;i++)this.currentColorAttachments[i];this.currentDepthStencilAttachment&&Q(this.currentDepthStencilAttachment.format===e.depthStencilAttachmentFormat),-1!==this.currentSampleCount&&Q(this.currentSampleCount===e.sampleCount)},e.prototype.setPipeline=function(e){var t=this;if(this.renderBundle)this.renderBundle.push((function(){return t.setPipeline(e)}));else{this.currentPipeline=e,this.validatePipelineFormats(this.currentPipeline),this.setMegaState(this.currentPipeline.megaState);var r=this.currentPipeline.program;if(this.useProgram(r),r.compileState===mt.NeedsBind){var n=this.gl,o=r.gl_program,_=r.descriptor,E=Ft(_.vertex.glsl,Wt);if(ct(n))for(var i=0;i<E.length;i++){var c=Object(w.e)(E[i],2)[1],R=n.getUniformBlockIndex(o,c);-1!==R&&4294967295!==R&&n.uniformBlockBinding(o,R,i)}var l=Ft(_.fragment.glsl,/^uniform .*sampler\S+ (\w+);\s* \/\/ BINDING=(\d+)$/gm);for(i=0;i<l.length;i++){var T=Object(w.e)(l[i],3),A=T[1],d=T[2],f=n.getUniformLocation(o,A);n.uniform1i(f,parseInt(d))}r.compileState=mt.ReadyToUse}}},e.prototype.setVertexInput=function(e,t,r){var n,o,_,E=this;if(this.renderBundle)this.renderBundle.push((function(){return E.setVertexInput(e,t,r)}));else if(null!==e){Q(this.currentPipeline.inputLayout===e);var c=e;this.bindVAO(c.vao);for(var R=this.gl,i=0;i<c.vertexBufferDescriptors.length;i++){var l=c.vertexBufferDescriptors[i],T=l.arrayStride,A=l.attributes;try{for(var d=(n=void 0,Object(w.h)(A)),f=d.next();!f.done;f=d.next()){var S=f.value,N=S.shaderLocation,B=S.offset,F=ct(R)?N:null===(_=c.program.attributes[N])||void 0===_?void 0:_.location;if(!Object(y.a)(F)){var C=t[i];if(null===C)continue;var O=S.vertexFormat;R.bindBuffer(R.ARRAY_BUFFER,ht(C.buffer));var m=(C.offset||0)+B;R.vertexAttribPointer(F,O.size,O.type,O.normalized,T,m)}}}catch(e){n={error:e}}
1finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(Q(null!==r==(null!==c.indexBufferFormat)),null!==r){var I=r.buffer;Q(I.usage===h.INDEX),R.bindBuffer(R.ELEMENT_ARRAY_BUFFER,ht(I)),this.currentIndexBufferByteOffset=r.offset||0}else this.currentIndexBufferByteOffset=null}else Q(null===this.currentPipeline.inputLayout),Q(null===r),this.bindVAO(null),this.currentIndexBufferByteOffset=0},e.prototype.setStencilReference=function(e){this.currentStencilRef!==e&&(this.currentStencilRef=e,this.applyStencil())},e.prototype.draw=function(e,t,r,n){var o,_=this;if(this.renderBundle)this.renderBundle.push((function(){return _.draw(e,t,r,n)}));else{var E=this.gl,c=this.currentPipeline;if(t){var R=[c.drawMode,r||0,e,t];ct(E)?E.drawArraysInstanced.apply(E,Object(w.g)([],Object(w.e)(R),!1)):(o=this.ANGLE_instanced_arrays).drawArraysInstancedANGLE.apply(o,Object(w.g)([],Object(w.e)(R),!1))}else E.drawArrays(c.drawMode,r,e);this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(e/3*Math.max(t,1))}},e.prototype.drawIndexed=function(e,t,r,n,o){var _,E=this;if(this.renderBundle)this.renderBundle.push((function(){return E.drawIndexed(e,t,r,n,o)}));else{var c=this.gl,R=this.currentPipeline,l=$(R.inputLayout),T=$(this.currentIndexBufferByteOffset)+r*l.indexBufferCompByteSize;if(t){var A=[R.drawMode,e,l.indexBufferType,T,t];ct(c)?c.drawElementsInstanced.apply(c,Object(w.g)([],Object(w.e)(A),!1)):(_=this.ANGLE_instanced_arrays).drawElementsInstancedANGLE.apply(_,Object(w.g)([],Object(w.e)(A),!1))}else c.drawElements(R.drawMode,e,l.indexBufferType,T);this.debugGroupStatisticsDrawCall(),this.debugGroupStatisticsTriangles(e/3*Math.max(t,1))}},e.prototype.drawIndirect=function(e,t){},e.prototype.drawIndexedIndirect=function(e,t){},e.prototype.beginOcclusionQuery=function(e){var t=this.gl;if(ct(t)){var r=this.currentRenderPassDescriptor.occlusionQueryPool;t.beginQuery(r.gl_query_type,r.gl_query[e])}},e.prototype.endOcclusionQuery=function(){var e=this.gl;if(ct(e)){var t=this.currentRenderPassDescriptor.occlusionQueryPool;e.endQuery(t.gl_query_type)}},e.prototype.pipelineQueryReady=function(e){var t=e;return this.queryProgramReady(t.program)},e.prototype.pipelineForceReady=function(e){},e.prototype.endPass=function(){for(var e=this.gl,t=ct(e),r=1===this.currentColorResolveTos.length&&this.currentColorResolveTos[0]===this.scTexture,o=!1,i=0;i<this.currentColorAttachments.length;i++){var _=this.currentColorAttachments[i];if(null!==_){var E=this.currentColorResolveTos[i],c=!1;null!==E&&(Q(_.width===E.width&&_.height===E.height),this.setScissorRectEnabled(!1),r||(t&&e.bindFramebuffer(e.READ_FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&t&&this.bindFramebufferAttachment(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,_,this.currentColorAttachmentLevels[i])),c=!0,r||(E===this.scTexture?e.bindFramebuffer(t?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,this.scPlatformFramebuffer):(e.bindFramebuffer(t?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,this.resolveColorDrawFramebuffer),this.resolveColorAttachmentsChanged&&e.framebufferTexture2D(t?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,E.gl_texture,this.currentColorResolveToLevels[i]))),r||(t?(e.blitFramebuffer(0,0,_.width,_.height,0,0,E.width,E.height,e.COLOR_BUFFER_BIT,e.LINEAR),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null)):this.submitBlitRenderPass(_,E)),o=!0),this.currentRenderPassDescriptor.colorStore[i]||r||c||(e.bindFramebuffer(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,this.resolveColorReadFramebuffer),this.resolveColorAttachmentsChanged&&this.bindFramebufferAttachment(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,e.COLOR_ATTACHMENT0,_,this.currentColorAttachmentLevels[i])),r||e.bindFramebuffer(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,null)}}this.resolveColorAttachmentsChanged=!1;var R=this.currentDepthStencilAttachment;if(R){var l=this.currentDepthStencilResolveTo;c=!1;l&&(Q(R.width===l.width&&R.height===l.height),this.setScissorRectEnabled(!1),r||(e.bindFramebuffer(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),e.bindFramebuffer(t?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,this.resolveDepthStencilDrawFramebuffer),this.resolveDepthStencilAttachmentsChanged&&(this.bindFramebufferDepthStencilAttachment(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,R),this.bindFramebufferDepthStencilAttachment(t?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,l))),c=!0,r||(t&&e.blitFramebuffer(0,0,R.width,R.height,0,0,l.width,l.height,e.DEPTH_BUFFER_BIT,e.NEAREST),e.bindFramebuffer(t?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,null)),o=!0),r||this.currentRenderPassDescriptor.depthStencilStore||(c||(e.bindFramebuffer(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,this.resolveDepthStencilReadFramebuffer),this.resolveDepthStencilAttachmentsChanged&&this.bindFramebufferDepthStencilAttachment(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,R),c=!0),t&&e.invali
1dateFramebuffer(e.READ_FRAMEBUFFER,[e.DEPTH_STENCIL_ATTACHMENT])),!r&&c&&e.bindFramebuffer(t?n.READ_FRAMEBUFFER:n.FRAMEBUFFER,null),this.resolveDepthStencilAttachmentsChanged=!1}r||o||e.bindFramebuffer(t?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,null)},e.prototype.setScissorRectEnabled=function(e){if(this.currentScissorEnabled!==e){var t=this.gl;e?t.enable(t.SCISSOR_TEST):t.disable(t.SCISSOR_TEST),this.currentScissorEnabled=e}},e.prototype.applyStencil=function(){Object(y.a)(this.currentStencilRef)||(this.gl.stencilFuncSeparate(n.FRONT,this.currentMegaState.stencilFront.compare,this.currentStencilRef,this.currentMegaState.stencilFront.mask||255),this.gl.stencilFuncSeparate(n.BACK,this.currentMegaState.stencilBack.compare,this.currentStencilRef,this.currentMegaState.stencilBack.mask||255))},e.prototype.getFallbackTexture=function(e){var t=e.gl_target,r=e.formatKind;if(t===n.TEXTURE_2D)return r===I.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(t===n.TEXTURE_2D_ARRAY)return this.fallbackTexture2DArray;if(t===n.TEXTURE_3D)return this.fallbackTexture3D;if(t===n.TEXTURE_CUBE_MAP)return this.fallbackTextureCube;throw new Error("whoops")},e.prototype.submitBlitRenderPass=function(e,t){this.blitRenderPipeline||(this.blitProgram=this.createProgram({vertex:{glsl:"layout(location = 0) in vec2 a_Position;\nout vec2 v_TexCoord;\nvoid main() {\n v_TexCoord = 0.5 * (a_Position + 1.0);\n gl_Position = vec4(a_Position, 0., 1.);\n\n #ifdef VIEWPORT_ORIGIN_TL\n v_TexCoord.y = 1.0 - v_TexCoord.y;\n #endif\n}"},fragment:{glsl:"uniform sampler2D u_Texture;\nin vec2 v_TexCoord;\nout vec4 outputColor;\nvoid main() {\n outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);\n}"}}),this.blitVertexBuffer=this.createBuffer({usage:h.VERTEX|h.COPY_DST,viewOrSize:new Float32Array([-4,-4,4,-4,0,4])}),this.blitInputLayout=this.createInputLayout({vertexBufferDescriptors:[{arrayStride:8,stepMode:N.VERTEX,attributes:[{format:G.F32_RG,offset:0,shaderLocation:0}]}],indexBufferFormat:null,program:this.blitProgram}),this.blitRenderPipeline=this.createRenderPipeline({topology:f.TRIANGLES,sampleCount:1,program:this.blitProgram,colorAttachmentFormats:[G.
1U8_RGBA_RT],depthStencilAttachmentFormat:null,inputLayout:this.blitInputLayout,megaStateDescriptor:Re(Te)}),this.blitBindings=this.createBindings({samplerBindings:[{sampler:null,texture:e.texture}],uniformBufferBindings:[]}),this.blitProgram.setUniformsLegacy({u_Texture:e}));var r=this.currentRenderPassDescriptor;this.currentRenderPassDescriptor=null,this.inBlitRenderPass=!0;var n=this.createRenderPass({colorAttachment:[e],colorResolveTo:[t],colorClearColor:[ie]}),o=this.getCanvas(),_=o.width,E=o.height;n.setPipeline(this.blitRenderPipeline),n.setBindings(this.blitBindings),n.setVertexInput(this.blitInputLayout,[{buffer:this.blitVertexBuffer}],null),n.setViewport(0,0,_,E),this.gl.disable(this.gl.BLEND),n.draw(3,0),this.gl.enable(this.gl.BLEND),this.currentRenderPassDescriptor=r,this.inBlitRenderPass=!1},e}(),Vt=function(){function e(e){this.pluginOptions=e}return e.prototype.createSwapChain=function(e){return Object(w.b)(this,void 0,void 0,(function(){var t,r,n,o,_,E,c,R,l,T,A,d,f;return Object(w.d)(this,(function(h){return t=this.pluginOptions,r=t.targets,n=t.xrCompatible,o=t.antialias,_=void 0!==o&&o,E=t.preserveDrawingBuffer,c=void 0!==E&&E,R=t.premultipliedAlpha,l=void 0===R||R,T=t.shaderDebug,A=t.trackResources,d={antialias:_,preserveDrawingBuffer:c,stencil:!0,premultipliedAlpha:l,xrCompatible:n},this.handleContextEvents(e),r.includes("webgl2")&&(f=e.getContext("webgl2",d)||e.getContext("experimental-webgl2",d)),!f&&r.includes("webgl1")&&(f=e.getContext("webgl",d)||e.getContext("experimental-webgl",d)),[2,new Ht(f,{shaderDebug:T,trackResources:A})]}))}))},e.prototype.handleContextEvents=function(e){var t=this.pluginOptions,r=t.onContextLost,n=t.onContextRestored,o=t.onContextCreationError;o&&e.addEventListener("webglcontextcreationerror",o,!1),r&&e.addEventListener("webglcontextlost",r,!1),n&&e.addEventListener("webglcontextrestored",n,!1)},e}();let kt;const Yt="undefined"!=typeof TextDecoder?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};"undefined"!=typeof TextDecoder&&Yt.decode();let Kt=null;function jt(){return null!==Kt&&0!==Kt.byteLength||(Kt=new Uint8Array(kt.memory.buffer)),Kt}function zt(e,t){return e>>>=0,Yt.decode(jt().subarray(e,e+t))}const qt=new Array(128).fill(void 0);qt.push(void 0,null,!0,!1);let Zt=qt.length;function Qt(e){return qt[e]}function $t(e){const t=Qt(e);return function(e){e<132||(qt[e]=Zt,Zt=e)}(e),t}let Jt=0;const er="undefined"!=typeof TextEncoder?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},rr="function"==typeof er.encodeInto?function(e,view){return er.encodeInto(e,view)}:function(e,view){const t=er.encode(e);return view.set(t),{read:e.length,written:t.length}};function nr(e,t,r){if(void 0===r){const r=er.encode(e),n=t(r.length,1)>>>0;return jt().subarray(n,n+r.length).set(r),Jt=r.length,n}let n=e.length,o=t(n,1)>>>0;const _=jt();let E=0;for(;E<n;E++){const code=e.charCodeAt(E);if(code>127)break;_[o+E]=code}if(E!==n){0!==E&&(e=e.slice(E)),o=r(o,n,n=E+3*e.length,1)>>>0;const view=jt().subarray(o+E,o+n);E+=rr(e,view).written}return Jt=E,o}let ir=null;function or(){return null!==ir&&0!==ir.byteLength||(ir=new Int32Array(kt.memory.buffer)),ir}function ar(source,e,t){let r,n;try{const E=kt.__wbindgen_add_to_stack_pointer(-16),c=nr(source,kt.__wbindgen_malloc,kt.__wbindgen_realloc),R=Jt,l=nr(e,kt.__wbindgen_malloc,kt.__wbindgen_realloc),T=Jt;kt.glsl_compile(E,c,R,l,T,t);var o=or()[E/4+0],_=or()[E/4+1];return r=o,n=_,zt(o,_)}finally{kt.__wbindgen_add_to_stack_pointer(16),kt.__wbindgen_free(r,n,1)}}class sr{static __wrap(e){e>>>=0;const t=Object.create(sr.prototype);return t.__wbg_ptr=e,t}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();kt.__wbg_wgslcomposer_free(e)}constructor(){const e=kt.wgslcomposer_new();return sr.__wrap(e)}load_composable(source){const e=nr(source,kt.__wbindgen_malloc,kt.__wbindgen_realloc),t=Jt;kt.wgslcomposer_load_composable(this.__wbg_ptr,e,t)}wgsl_compile(source){let e,t;try{const o=kt.__wbindgen_add_to_stack_pointer(-16),_=nr(source,kt.__wbindgen_malloc,kt.__wbindgen_realloc),E=Jt;kt.wgslcomposer_wgsl_compile(o,this.__wbg_ptr,_,E);var r=or()[o/4+0],n=or()[o/4+1];return e=r,t=n,zt(r,n)}finally{kt.__wbindgen_add_to_stack_pointer(16),kt.__wbindgen_free(e,t,1)}}}function _r(){const e={wbg:{}};return e.wbg.__wbindgen_string_new=function(e,t){return function(e){Zt===qt.length&&qt.push(qt.length+1);const t=Zt;return Zt=qt[t],qt[t]=e,t}(zt(e,t))},e.wbg.__wbindgen_object_drop_ref=function(e){$t(e)},e.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(Qt(e))}
1,e.wbg.__wbg_log_576ca876af0d4a77=function(e,t){console.log(Qt(e),Qt(t))},e.wbg.__wbindgen_throw=function(e,t){throw new Error(zt(e,t))},e}async function Er(input){if(void 0!==kt)return kt;const e=_r();("string"==typeof input||"function"==typeof Request&&input instanceof Request||"function"==typeof URL&&input instanceof URL)&&(input=fetch(input));const{instance:t,module:r}=await async function(e,t){if("function"==typeof Response&&e instanceof Response){if("function"==typeof WebAssembly.instantiateStreaming)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){if("application/wasm"==e.headers.get("Content-Type"))throw t;console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t)}const r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}{const r=await WebAssembly.instantiate(e,t);return r instanceof WebAssembly.Instance?{instance:r,module:e}:r}}(await input,e);return function(e,t){return kt=e.exports,Er.__wbindgen_wasm_module=t,ir=null,Kt=null,kt}(t,r)}var ur,cr;function Rr(e){if(e===G.U8_R_NORM)return"r8unorm";if(e===G.S8_R_NORM)return"r8snorm";if(e===G.U8_RG_NORM)return"rg8unorm";if(e===G.S8_RG_NORM)return"rg8snorm";if(e===G.U32_R)return"r32uint";if(e===G.S32_R)return"r32sint";if(e===G.F32_R)return"r32float";if(e===G.U16_RG)return"rg16uint";if(e===G.S16_RG)return"rg16sint";if(e===G.F16_RG)return"rg16float";if(e===G.U8_RGBA_RT)return"bgra8unorm";if(e===G.U8_RGBA_RT_SRGB)return"bgra8unorm-srgb";if(e===G.U8_RGBA_NORM)return"rgba8unorm";if(e===G.U8_RGBA_SRGB)return"rgba8unorm-srgb";if(e===G.S8_RGBA_NORM)return"rgba8snorm";if(e===G.U32_RG)return"rg32uint";if(e===G.S32_RG)return"rg32sint";if(e===G.F32_RG)return"rg32float";if(e===G.U16_RGBA)return"rgba16uint";if(e===G.S16_RGBA)return"rgba16sint";if(e===G.F16_RGBA)return"rgba16float";if(e===G.F32_RGBA)return"rgba32float";if(e===G.U32_RGBA)return"rgba32uint";if(e===G.S32_RGBA)return"rgba32sint";if(e===G.D24)return"depth24plus";if(e===G.D24_S8)return"depth24plus-stencil8";if(e===G.D32F)return"depth32float";if(e===G.D32F_S8)return"depth32float-stencil8";if(e===G.BC1)return"bc1-rgba-unorm";if(e===G.BC1_SRGB)return"bc1-rgba-unorm-srgb";if(e===G.BC2)return"bc2-rgba-unorm";if(e===G.BC2_SRGB)return"bc2-rgba-unorm-srgb";if(e===G.BC3)return"bc3-rgba-unorm";if(e===G.BC3_SRGB)return"bc3-rgba-unorm-srgb";if(e===G.BC4_SNORM)return"bc4-r-snorm";if(e===G.BC4_UNORM)return"bc4-r-unorm";if(e===G.BC5_SNORM)return"bc5-rg-snorm";if(e===G.BC5_UNORM)return"bc5-rg-unorm";throw"whoops"}function lr(e){if(e===F.TEXTURE_2D)return"2d";if(e===F.TEXTURE_CUBE_MAP)return"cube";if(e===F.TEXTURE_2D_ARRAY)return"2d-array";if(e===F.TEXTURE_3D)return"3d";throw new Error("whoops")}function Tr(e){if(e===T.CLAMP_TO_EDGE)return"clamp-to-edge";if(e===T.REPEAT)return"repeat";if(e===T.MIRRORED_REPEAT)return"mirror-repeat";throw new Error("whoops")}function Ar(e){if(e===A.BILINEAR)return"linear";if(e===A.POINT)return"nearest";throw new Error("whoops")}function dr(e){if(e===d.LINEAR)return"linear";if(e===d.NEAREST)return"nearest";if(e===d.NO_MIP)return"nearest";throw new Error("whoops")}function fr(e){return e.gpuBuffer}function pr(e){if(e===L.OcclusionConservative)return"occlusion";throw new Error("whoops")}function Sr(e){switch(e){case f.TRIANGLES:return"triangle-list";case f.POINTS:return"point-list";case f.TRIANGLE_STRIP:return"triangle-strip";case f.LINES:return"line-list";case f.LINE_STRIP:return"line-strip";default:throw new Error("Unknown primitive topology mode")}}function Nr(e){if(e===c.NONE)return"none";if(e===c.FRONT)return"front";if(e===c.BACK)return"back";throw new Error("whoops")}function Br(e){if(e===E.CCW)return"ccw";if(e===E.CW)return"cw";throw new Error("whoops")}function Fr(e){if(e===R.ZERO)return"zero";if(e===R.ONE)return"one";if(e===R.SRC)return"src";if(e===R.ONE_MINUS_SRC)return"one-minus-src";if(e===R.DST)return"dst";if(e===R.ONE_MINUS_DST)return"one-minus-dst";if(e===R.SRC_ALPHA)return"src-alpha";if(e===R.ONE_MINUS_SRC_ALPHA)return"one-minus-src-alpha";if(e===R.DST_ALPHA)return"dst-alpha";if(e===R.ONE_MINUS_DST_ALPHA)return"one-minus-dst-alpha";if(e===R.CONST)return"constant";if(e===R.ONE_MINUS_CONSTANT)return"one-minus-constant";if(e===R.SRC_ALPHA_SATURATE)return"src-alpha-saturated";throw new Error("whoops")}function Cr(e){if(e===l.ADD)return"add";if(e===l.SUBSTRACT)return"subtract";if(e===l.REVERSE_SUBSTRACT)return"reverse-subtract";if(e===l.MIN)return"min";if(e===l.MAX)return"max";throw new Error("whoops")}function Or(e){return{operation:Cr(e.blendMode),srcFactor:Fr(e.blendSrcFactor),dstFactor:Fr(e.blendDstFactor)}}function gr(e){return e.blendMode===l.ADD&&e.blendSrcFactor===R.ONE&&e.blendDstFactor===R.ZERO}function mr(e){return gr(e.rgbBlendState)&&gr(e.alphaBlendState)?void 0:{color:Or(e.rgbBlendState),alpha:Or(e.alphaBlendState)}}function Ir(e,t){return t.attachmentsState.map((function(t,i){return function(e,t){return{format:Rr(t),blend:mr(e),writeMask:e.channelWriteMask}}(t,e[i])}))}function Mr(e){if(e===_.NEVER)return"never";if(e===_.LESS)return"less";if(e===_.EQUAL)return"equal";if(e===_.LEQUAL)return"less-equal";if(e===_.GREATER)return"greater";if(e===_.NOTEQUAL)return"not-equal";if(e===_.GEQUAL)return"greater-equal";if(e===_.ALWAYS)return"always";throw new Error("whoops")}function Ur(e){if(e===m.KEEP)return"keep";if(e===m.REPLACE)return"replace";if(e===m.ZERO)return"zero";if(e===m.DECREMENT_CLAMP)return"decrement-clamp";if(e===m.DECREMENT_WRAP)return"decrement-wrap";if(e===m.INCREMENT_CLAMP)return"increment-clamp";if(e===m.INCREMENT_WRAP)return"increment-wrap";if(e===m.INVERT)return"invert";throw new Error("whoops")}function Lr(e){if(e===N.VERTEX)return"vertex";if(e===N.INSTANCE)return"instance";throw new Error("whoops")}function Dr(e){if(e===G.U8_R)return"uint8x2";if(e===G.U8_RG)return"uint8x2";if(e===G.U8_RGB)return"uint8x4";if(e===G.U8_RGBA)return"uint8x4";if(e===G.U8_RG_NORM)return"unorm8x2";if(e===G.U8_RGBA_NORM)return"unorm8x4";if(e===G.S8_RGB_NORM)return"snorm8x4";if(e===G.S8_RGBA_NORM)return"snorm8x4";if(e===G.U16_RG_NORM)return"unorm16x2";if(e===G.U16_RGBA_NORM)return"unorm16x4";if(e===G.S16_RG_NORM)return"snorm16x2";if(e===G.S16_RGBA_NORM)return"snorm16x4";if(e===G.S16_RG)return"uint16x2";if(e===G.F16_RG)return"float16x2";if(e===G.F16_RGBA)return"float16x4";if(e===G.F32_R)return"float32";if(e===G.F32_RG)return"float32x2";if(e===G.F32_RGB)return"float32x3";if(e===G.F32_RGBA)return"float32x4";throw"whoops"}function Pr(e,t,r,n){switch(void 0===r&&(r=!1),e){case G.S8_R:case G.S8_R_NORM:case G.S8_RG_NORM:case G.S8_RGB_NORM:case G.S8_RGBA_NORM:var o=(ArrayBuffer,new Int8Array(t));return n&&o.set(new Int8Array(n)),o;case G.U8_R:case G.U8_R_NORM:case G.U8_RG:case G.U8_RG_NORM:case G.U8_RGB:case G.U8_RGB_NORM:case G.U8_RGB_SRGB:case G.U8_RGBA:case G.U8_RGBA_NORM:case G.U8_RGBA_SRGB:var _=(ArrayBuffer,new Uint8Array(t));return n&&_.set(new Uint8Array(n)),_;
1case G.S16_R:case G.S16_RG:case G.S16_RG_NORM:case G.S16_RGB_NORM:case G.S16_RGBA:case G.S16_RGBA_NORM:var E=t instanceof ArrayBuffer?new Int16Array(t):new Int16Array(r?t/2:t);return n&&E.set(new Int16Array(n)),E;case G.U16_R:case G.U16_RGB:case G.U16_RGBA_5551:case G.U16_RGBA_NORM:case G.U16_RG_NORM:case G.U16_R_NORM:var c=t instanceof ArrayBuffer?new Uint16Array(t):new Uint16Array(r?t/2:t);return n&&c.set(new Uint16Array(n)),c;case G.S32_R:var R=t instanceof ArrayBuffer?new Int32Array(t):new Int32Array(r?t/4:t);return n&&R.set(new Int32Array(n)),R;case G.U32_R:case G.U32_RG:var l=t instanceof ArrayBuffer?new Uint32Array(t):new Uint32Array(r?t/4:t);return n&&l.set(new Uint32Array(n)),l;case G.F32_R:case G.F32_RG:case G.F32_RGB:case G.F32_RGBA:var T=t instanceof ArrayBuffer?new Float32Array(t):new Float32Array(r?t/4:t);return n&&T.set(new Float32Array(n)),T}var A=(ArrayBuffer,new Uint8Array(t));return n&&A.set(new Uint8Array(n)),A}function vr(e){switch(e){case"r8unorm":case"r8snorm":case"r8uint":case"r8sint":return{width:1,height:1,length:1};case"r16uint":case"r16sint":case"r16float":case"rg8unorm":case"rg8snorm":case"rg8uint":case"rg8sint":case"depth16unorm":return{width:1,height:1,length:2};case"r32uint":case"r32sint":case"r32float":case"rg16uint":case"rg16sint":case"rg16float":case"rgba8unorm":case"rgba8unorm-srgb":case"rgba8snorm":case"rgba8uint":case"rgba8sint":case"bgra8unorm":case"bgra8unorm-srgb":case"rgb9e5ufloat":case"rgb10a2unorm":case"rg11b10ufloat":case"depth32float":default:return{width:1,height:1,length:4};case"rg32uint":case"rg32sint":case"rg32float":case"rgba16uint":case"rgba16sint":case"rgba16float":return{width:1,height:1,length:8};case"rgba32uint":case"rgba32sint":case"rgba32float":return{width:1,height:1,length:16};case"stencil8":throw new Error("No fixed size for Stencil8 format!");case"depth24plus":throw new Error("No fixed size for Depth24Plus format!");case"depth24plus-stencil8":throw new Error("No fixed size for Depth24PlusStencil8 format!");case"depth32float-stencil8":return{width:1,height:1,length:5};case"bc7-rgba-unorm":case"bc7-rgba-unorm-srgb":case"bc6h-rgb-ufloat":case"bc6h-rgb-float":case"bc2-rgba-unorm":case"bc2-rgba-unorm-srgb":case"bc3-rgba-unorm":case"bc3-rgba-unorm-srgb":case"bc5-rg-unorm":case"bc5-rg-snorm":return{width:4,height:4,length:16};case"bc4-r-unorm":case"bc4-r-snorm":case"bc1-rgba-unorm":case"bc1-rgba-unorm-srgb":return{width:4,height:4,length:8}}}!function(e){e[e.COPY_SRC=1]="COPY_SRC",e[e.COPY_DST=2]="COPY_DST",e[e.TEXTURE_BINDING=4]="TEXTURE_BINDING",e[e.STORAGE_BINDING=8]="STORAGE_BINDING",e[e.STORAGE=8]="STORAGE",e[e.RENDER_ATTACHMENT=16]="RENDER_ATTACHMENT"}(ur||(ur={})),function(e){e[e.READ=1]="READ",e[e.WRITE=2]="WRITE"}(cr||(cr={}));var Gr=function(e){function t(t){var r=t.id,n=t.device,o=e.call(this)||this;return o.id=r,o.device=n,o}return Object(w.c)(t,e),t.prototype.destroy=function(){},t}(H.a),yr=function(e){function t(t){var r,n,_=t.id,E=t.device,c=t.descriptor,R=e.call(this,{id:_,device:E})||this;R.type=o.Bindings;var l=c.pipeline;Q(!!l);var T=c.uniformBufferBindings,A=c.storageBufferBindings,d=c.samplerBindings,f=c.storageTextureBindings;R.numUniformBuffers=(null==T?void 0:T.length)||0;var h=[[],[],[],[]],S=0;if(T&&T.length)for(var i=0;i<T.length;i++){var N=c.uniformBufferBindings[i],B=N.binding,F=N.size,C=N.offset,O={buffer:fr(N.buffer),offset:null!=C?C:0,size:F};h[0].push({binding:null!=B?B:S++,resource:O})}if(d&&d.length){S=0;for(i=0;i<d.length;i++){var m=Object(w.a)(Object(w.a)({},d[i]),de),I=null!==(B=c.samplerBindings[i]).texture?B.texture:R.device.getFallbackTexture(m);m.dimension=I.dimension,m.formatKind=Z(I.format);var M=I.gpuTextureView;if(h[1].push({binding:null!==(r=B.textureBinding)&&void 0!==r?r:S++,resource:M}),-1!==B.samplerBinding){var U=null!==B.sampler?B.sampler:R.device.getFallbackSampler(m),L=U.gpuSampler;h[1].push({binding:null!==(n=B.samplerBinding)&&void 0!==n?n:S++,resource:L})}}}if(A&&A.length){S=0;for(i=0;i<A.length;i++){var D=c.storageBufferBindings[i];B=D.binding,F=D.size,C=D.offset,O={buffer:fr(D.buffer),offset:null!=C?C:0,size:F};h[2].push({binding:null!=B?B:S++,resource:O})}}if(f&&f.length){S=0;for(i=0;i<f.length;i++){var P=c.storageTextureBindings[i];B=P.binding,M=(I=P.texture).gpuTextureView;h[3].push({binding:null!=B?B:S++,resource:M})}}var v=h.findLastIndex((function(e){return!!e.length}));return R.gpuBindGroup=h.map((function(e,i){return i<=v&&R.device.device.createBindGroup({layout:l.getBindGroupLayout(i),entr
1ies:e})})),R}return Object(w.c)(t,e),t}(Gr),xr=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;E.type=o.Buffer;var c=_.usage,R=_.viewOrSize,l=!!(c&h.MAP_READ);E.usage=function(e){var t=0;return e&h.INDEX&&(t|=GPUBufferUsage.INDEX),e&h.VERTEX&&(t|=GPUBufferUsage.VERTEX),e&h.UNIFORM&&(t|=GPUBufferUsage.UNIFORM),e&h.STORAGE&&(t|=GPUBufferUsage.STORAGE),e&h.COPY_SRC&&(t|=GPUBufferUsage.COPY_SRC),e&h.INDIRECT&&(t|=GPUBufferUsage.INDIRECT),t|GPUBufferUsage.COPY_DST}(c),l&&(E.usage=h.MAP_READ|h.COPY_DST);var T=!Object(x.a)(R);(E.view=Object(x.a)(R)?null:R,E.size=Object(x.a)(R)?se(R,4):se(R.byteLength,4),Object(x.a)(R))?E.gpuBuffer=E.device.device.createBuffer({usage:E.usage,size:E.size,mappedAtCreation:!!l&&T}):(E.gpuBuffer=E.device.device.createBuffer({usage:E.usage,size:E.size,mappedAtCreation:!0}),new(R&&R.constructor||Float32Array)(E.gpuBuffer.getMappedRange()).set(R),E.gpuBuffer.unmap());return E}return Object(w.c)(t,e),t.prototype.setSubData=function(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var o=this.gpuBuffer;n=n||t.byteLength,n=Math.min(n,this.size-e);var _=t.byteOffset+r,E=_+n,c=n+3&-4;if(c!==n){var R=new Uint8Array(t.buffer.slice(_,E));(t=new Uint8Array(c)).set(R),r=0,_=0,E=c,n=c}for(var l=15728640,T=0;E-(_+T)>l;)this.device.device.queue.writeBuffer(o,e+T,t.buffer,_+T,l),T+=l;this.device.device.queue.writeBuffer(o,e+T,t.buffer,_+T,n-T)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.gpuBuffer.destroy()},t}(Gr),Xr=function(){function e(){this.gpuComputePassEncoder=null}return e.prototype.dispatchWorkgroups=function(e,t,r){this.gpuComputePassEncoder.dispatchWorkgroups(e,t,r)},e.prototype.dispatchWorkgroupsIndirect=function(e,t){this.gpuComputePassEncoder.dispatchWorkgroupsIndirect(e.gpuBuffer,t)},e.prototype.finish=function(){this.gpuComputePassEncoder.end(),this.gpuComputePassEncoder=null,this.frameCommandEncoder=null},e.prototype.beginComputePass=function(e){Q(null===this.gpuComputePassEncoder),this.frameCommandEncoder=e,this.gpuComputePassEncoder=this.frameCommandEncoder.beginComputePass(this.gpuComputePassDescriptor)},e.prototype.setPipeline=function(e){var t=$(e.gpuComputePipeline);this.gpuComputePassEncoder.setPipeline(t)},e.prototype.setBindings=function(e){var t=this,r=e;r.gpuBindGroup.forEach((function(e,i){e&&t.gpuComputePassEncoder.setBindGroup(i,r.gpuBindGroup[i])}))},e.prototype.pushDebugGroup=function(e){this.gpuComputePassEncoder.pushDebugGroup(e)},e.prototype.popDebugGroup=function(){this.gpuComputePassEncoder.popDebugGroup()},e.prototype.insertDebugMarker=function(e){this.gpuComputePassEncoder.insertDebugMarker(e)},e}(),wr=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;E.type=o.ComputePipeline,E.gpuComputePipeline=null,E.descriptor=_;var c=_.program.computeStage;if(null===c)return E;var R={layout:"auto",compute:Object(w.a)({},c)};return E.gpuComputePipeline=E.device.device.createComputePipeline(R),void 0!==E.name&&(E.gpuComputePipeline.label=E.name),E}return Object(w.c)(t,e),t.prototype.getBindGroupLayout=function(e){return this.gpuComputePipeline.getBindGroupLayout(e)},t}(Gr),Wr=function(e){function t(t){var r,n,_,E,c=t.id,R=t.device,l=t.descriptor,T=e.call(this,{id:c,device:R})||this;T.type=o.InputLayout;var A=[];try{for(var d=Object(w.h)(l.vertexBufferDescriptors),f=d.next();!f.done;f=d.next()){var h=f.value,S=h.arrayStride,N=h.stepMode,B=h.attributes;A.push({arrayStride:S,stepMode:Lr(N),attributes:[]});try{for(var F=(_=void 0,Object(w.h)(B)),C=F.next();!C.done;C=F.next()){var O=C.value,m=O.shaderLocation,I=O.format,M=O.offset;A[A.length-1].attributes.push({shaderLocation:m,format:Dr(I),offset:M})}}catch(e){_={error:e}}finally{try{C&&!C.done&&(E=F.return)&&E.call(F)}finally{if(_)throw _.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return T.indexFormat=function(e){if(null!==e){if(e===G.U16_R)return"uint16";if(e===G.U32_R)return"uint32";throw new Error("whoops")}}(l.indexBufferFormat),T.buffers=A,T}return Object(w.c)(t,e),t}(Gr),Hr=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;return E.type=o.Program,E.vertexStage=null,E.fragmentStage=null,E.computeStage=null,E.descriptor=_,_.vertex&&(E.vertexStage=E.createShaderStage(_.vertex,"vertex")),_.fragment&&(E.fragmentStage=E.createShaderStage(_.fragment,"fragment")),_.compute&&(E.computeStage=E.createShaderStage(_.compute,"compute")),E}return Object(w.c)(t,e),t.prototype.setUniformsLegacy=function(e){},t.prototype.createShaderStage=function(e,t){var r,n,o=e.glsl,_=e.wgsl,E=e.entryPoint,c=e.postprocess,code=_;if(!code)try{code=this.device.glsl_compile(o,t,!1)}catch(e){throw console.error(e,o),new Error("whoops")}var R=function(e){if(!code.includes(e))return"continue";code=(code=code.replace("var T_".concat(e,": texture_2d<f32>;"),"var T_".concat(e,": texture_depth_2d;"))).replace(new RegExp("textureSample\\(T_".concat(e,"(.*)\\);$"),"gm"),(function(sub,t){return"vec4<f32>(textureSample(T_".concat(e).concat(t,"), 0.0, 0.0, 0.0);")}))};try{for(var l=Object(w.h)(["u_TextureFramebufferDepth"]),T=l.next();!T.done;T=l.next()){R(T.value)}}catch(e){r={error:e}}finally{try{T&&!T.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return c&&(code=c(code)),{module:this.device.device.createShaderModule({code:code}),entryPoint:E||"main"}},t}(Gr),Vr=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;E.type=o.QueryPool;var c=_.elemCount,R=_.type;return E.querySet=E.device.device.createQuerySet({type:pr(R),count:c}
1),E.resolveBuffer=E.device.device.createBuffer({size:8*c,usage:GPUBufferUsage.QUERY_RESOLVE|GPUBufferUsage.COPY_SRC}),E.cpuBuffer=E.device.device.createBuffer({size:8*c,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),E.results=null,E}return Object(w.c)(t,e),t.prototype.queryResultOcclusion=function(e){return null===this.results?null:this.results[e]!==BigInt(0)},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.querySet.destroy(),this.resolveBuffer.destroy(),this.cpuBuffer.destroy()},t}(Gr),kr=function(e){function t(t){var r=t.id,n=t.device,_=e.call(this,{id:r,device:n})||this;return _.type=o.Readback,_}return Object(w.c)(t,e),t.prototype.readTexture=function(e,t,r,n,o,_,E,c){return void 0===E&&(E=0),Object(w.b)(this,void 0,void 0,(function(){var c,R,l,T,A,d,f;return Object(w.d)(this,(function(N){return 0,R=vr((c=e).gpuTextureformat),l=Math.ceil(n/R.width)*R.length,T=256*Math.ceil(l/256),A=T*o,d=this.device.createBuffer({usage:h.STORAGE|h.MAP_READ|h.COPY_DST,hint:S.STATIC,viewOrSize:A}),(f=this.device.device.createCommandEncoder()).copyTextureToBuffer({texture:c.gpuTexture,mipLevel:0,origin:{x:t,y:r,z:Math.max(0,0)}},{buffer:d.gpuBuffer,offset:0,bytesPerRow:T},{width:n,height:o,depthOrArrayLayers:1}),this.device.device.queue.submit([f.finish()]),[2,this.readBuffer(d,0,_.byteLength===A?_:null,E,A,c.format,!0,!1,l,T,o)]}))}))},t.prototype.readTextureSync=function(e,t,r,n,o,_,E,c){throw new Error("ERROR_MSG_METHOD_NOT_IMPLEMENTED")},t.prototype.readBuffer=function(b,e,t,r,n,o,_,E,c,R,l){var T=this;void 0===e&&(e=0),void 0===t&&(t=null),void 0===n&&(n=0),void 0===o&&(o=G.U8_RGB),void 0===_&&(_=!1),void 0===c&&(c=0),void 0===R&&(R=0),void 0===l&&(l=0);var A=b,d=n||A.size,f=t||A.view,N=f&&f.constructor&&f.constructor.BYTES_PER_ELEMENT||z(o),B=A;if(!(A.usage&h.MAP_READ&&A.usage&h.COPY_DST)){var F=this.device.device.createCommandEncoder();B=this.device.createBuffer({usage:h.STORAGE|h.MAP_READ|h.COPY_DST,hint:S.STATIC,viewOrSize:d}),F.copyBufferToBuffer(A.gpuBuffer,e,B.gpuBuffer,0,d),this.device.device.queue.submit([F.finish()])}return new Promise((function(t,r){B.gpuBuffer.mapAsync(cr.READ,e,d).then((function(){var r=B.gpuBuffer.getMappedRange(e,d),data=f;if(_)data=null===data?Pr(o,d,!0,r):Pr(o,data.buffer,void 0,r);else if(null===data)switch(N){case 1:(data=new Uint8Array(d)).set(new Uint8Array(r));break;case 2:data=T.getHalfFloatAsFloatRGBAArrayBuffer(d/2,r);break;case 4:(data=new Float32Array(d/4)).set(new Float32Array(r))}else switch(N){case 1:(data=new Uint8Array(data.buffer)).set(new Uint8Array(r));break;case 2:data=T.getHalfFloatAsFloatRGBAArrayBuffer(d/2,r,f);break;case 4:var n=f&&f.constructor||Float32Array;(data=new n(data.buffer)).set(new n(r))}if(c!==R){1!==N||_||(c*=2,R*=2);for(var E=new Uint8Array(data.buffer),A=c,h=0,S=1;S<l;++S){h=S*R;for(var F=0;F<c;++F)E[A++]=E[h++]}data=0===N||_?new Uint8Array(E.buffer,0,A):new Float32Array(E.buffer,0,A/4)}B.gpuBuffer.unmap(),t(data)}),(function(e){return r(e)}))}))},t.prototype.getHalfFloatAsFloatRGBAArrayBuffer=function(e,t,r){r||(r=new Float32Array(e));for(var n,s,o,_,E=new Uint16Array(t);e--;)r[e]=(n=E[e],s=void 0,o=void 0,_=void 0,s=(32768&n)>>15,_=1023&n,0===(o=(31744&n)>>10)?(s?-1:1)*Math.pow(2,-14)*(_/Math.pow(2,10)):31==o?_?NaN:1/0*(s?-1:1):(s?-1:1)*Math.pow(2,o-15)*(1+_/Math.pow(2,10)));return r},t}(Gr),Yr=function(){function e(e){this.device=e,this.gpuRenderPassEncoder=null,this.gfxColorAttachment=[],this.gfxColorAttachmentLevel=[],this.gfxColorResolveTo=[],this.gfxColorResolveToLevel=[],this.gfxDepthStencilAttachment=null,this.gfxDepthStencilResolveTo=null,this.gpuColorAttachments=[],this.gpuDepthStencilAttachment={view:null,depthLoadOp:"load",depthStoreOp:"store",stencilLoadOp:"load",stencilStoreOp:"store"},this.gpuRenderPassDescriptor={colorAttachments:this.gpuColorAttachments,depthStencilAttachment:this.gpuDepthStencilAttachment}}return e.prototype.getEncoder=function(){var e;return(null===(e=this.renderBundle)||void 0===e?void 0:e.renderBundleEncoder)||this.gpuRenderPassEncoder},e.prototype.getTextureView=function(e,t){return Q(t<e.mipLevelCount),1===e.mipLevelCount?e.gpuTextureView:e.gpuTexture.createView({baseMipLevel:t,mipLevelCount:1})},e.prototype.setRenderPassDescriptor=function(e){var t,r,n,o,_,E;this.descriptor=e,this.gpuRenderPassDescriptor.colorAttachments=this.gpuColorAttachments;var c=e.colorAttachment.length;this.gfxColorAttachment.length=c,this.gfxColorResolveTo.length=c;for(var i=0;i<e.colorAttachment.length;i++){var R=e.colorAttachment[i],l=e.colorResolveTo[i];if(null===R&&null!==l&&(R=l,l=null),this.gfxColorAttachment[i]=R,this.gfxColorResolveTo[i]=l,this.gfxColorAttachmentLevel[i]=(null===(t=e.colorAttachmentLevel)||void 0===t?void 0:t[i])||0,this.gfxColorResolveToLevel[i]=(null===(r=e.colorResolveToLevel)||void 0===r?void 0:r[i])||0,null===R){this.gpuColorAttachments.length=i,this.gfxColorAttachment.length=i,this.gfxColorResolveTo.length=i;break}void 0===this.gpuColorAttachments[i]&&(this.gpuColorAttachments[i]={}),(A=this.gpuColorAttachments[i]).view=this.getTextureView(R,(null===(n=this.gfxColorAttachmentLevel)||void 0===n?void 0:n[i])||0);var T=null!==(_=null===(o=e.colorClearColor)||void 0===o?void 0:o[i])&&void 0!==_?_:"load";"load"===T?A.loadOp="load":(A.loadOp="clear",A.clearValue=T),A.storeOp=(null===(E=e.colorStore)||void 0===E?void 0:E[i])?"store":"discard",A.resolveTarget=void 0,null!==l&&(R.sampleCount>1?A.resolveTarget=this.getTextureView(l,this.gfxColorResolveToLevel[i]):A.storeOp="store")}if(this.gfxDepthStencilAttachment=e.depthStencilAttachment,this.gfxDepthStencilResolveTo=e.depthStencilResolveTo,e.depthStencilAttachment){var A,d=e.depthStencilAttachment;(A=this.gpuDepthStencilAttachment).view=d.gpuTextureView,!!(K(d.format)&v.Depth)?("load"===e.depthClearValue?A.depthLoadOp="load":(A.depthLoadOp="clear",A.depthClearValue=e.depthClearValue),e.depthStencilStore||null!==this.gfxDepthStencilResolveTo?A.depthStoreOp="store":A.depthStoreOp="discard"):(A.depthLoadOp=void 0,A.depthStoreOp=void 0),!!(K(d.format)&v.Stencil)?("load"===e.stencilClearValue?A.stencilLoadOp="load":(A.stencilLoadOp="clear",A.stencilClearValue=e.stencilClearValue),e.depthStencilStore||null!==this.gfxDepthStencilResolveTo?A.stencilStoreOp="store":A.stencilStoreOp="discard"):(A.stencilLoadOp=void 0,A.stencilStoreOp=void 0),this.gpuRenderPassDescriptor.depthStencilAttachment=this.gpuDepthStencilAttachment}else this.gpuRenderPassDescriptor.depthStencilAttachment=void 0;this.gpuRenderPassDescriptor.occlusionQuerySet=Object(y.a)(e.occlusionQueryPool)?void 0:e.occlusionQueryPool.querySet},e.prototype.beginRenderPass=function(e,t){Q(null===this.gpuRenderPassEncoder),this.setRenderPassDescriptor(t),this.frameCommandEncoder=e,this.gpuRenderPassEncoder=this.frameCommandEncoder.beginRenderPass(this.gpuRenderPassDescriptor)},e.prototype.flipY=function(e,t){return this.device.swapChainHeight-e-t},e.prototype.setViewport=function(e,t,r,n,o,_){void 0===o&&(o=0),void 0===_&&(_=1),this.gpuRenderPassEncoder.setViewport(e,this.flipY(t,n),r,n,o,_)},e.prototype.setScissorRect=function(e,t,r,n){this.gpuRenderPassEncoder.setScissorRect
1(e,this.flipY(t,n),r,n)},e.prototype.setPipeline=function(e){var t=$(e.gpuRenderPipeline);this.getEncoder().setPipeline(t)},e.prototype.setVertexInput=function(e,t,r){if(null!==e){var n=this.getEncoder(),o=e;null!==r&&n.setIndexBuffer(fr(r.buffer),$(o.indexFormat),r.offset);for(var i=0;i<t.length;i++){var b=t[i];null!==b&&n.setVertexBuffer(i,fr(b.buffer),b.offset)}}},e.prototype.setBindings=function(e){var t=e,r=this.getEncoder();t.gpuBindGroup.forEach((function(e,i){e&&r.setBindGroup(i,t.gpuBindGroup[i])}))},e.prototype.setStencilReference=function(e){this.gpuRenderPassEncoder.setStencilReference(e)},e.prototype.draw=function(e,t,r,n){this.getEncoder().draw(e,t,r,n)},e.prototype.drawIndexed=function(e,t,r,n,o){this.getEncoder().drawIndexed(e,t,r,n,o)},e.prototype.drawIndirect=function(e,t){this.getEncoder().drawIndirect(fr(e),t)},e.prototype.drawIndexedIndirect=function(e,t){this.getEncoder().drawIndexedIndirect(fr(e),t)},e.prototype.beginOcclusionQuery=function(e){this.gpuRenderPassEncoder.beginOcclusionQuery(e)},e.prototype.endOcclusionQuery=function(){this.gpuRenderPassEncoder.endOcclusionQuery()},e.prototype.pushDebugGroup=function(e){this.gpuRenderPassEncoder.pushDebugGroup(e)},e.prototype.popDebugGroup=function(){this.gpuRenderPassEncoder.popDebugGroup()},e.prototype.insertDebugMarker=function(e){this.gpuRenderPassEncoder.insertDebugMarker(e)},e.prototype.beginBundle=function(e){this.renderBundle=e},e.prototype.endBundle=function(){this.renderBundle.finish()},e.prototype.executeBundles=function(e){this.gpuRenderPassEncoder.executeBundles(e.map((function(e){return e.renderBundle})))},e.prototype.finish=function(){var e;null===(e=this.gpuRenderPassEncoder)||void 0===e||e.end(),this.gpuRenderPassEncoder=null;for(var i=0;i<this.gfxColorAttachment.length;i++){var t=this.gfxColorAttachment[i],r=this.gfxColorResolveTo[i];null!==t&&null!==r&&1===t.sampleCount&&this.copyAttachment(r,this.gfxColorAttachmentLevel[i],t,this.gfxColorResolveToLevel[i])}this.gfxDepthStencilAttachment&&this.gfxDepthStencilResolveTo&&(this.gfxDepthStencilAttachment.sampleCount>1||this.copyAttachment(this.gfxDepthStencilResolveTo,0,this.gfxDepthStencilAttachment,0)),this.frameCommandEncoder=null},e.prototype.copyAttachment=function(e,t,r,n){Q(1===r.sampleCount);var o={texture:r.gpuTexture,mipLevel:n},_={texture:e.gpuTexture,mipLevel:t};Q(r.width>>>n==e.width>>>t),Q(r.height>>>n==e.height>>>t),Q(!!(r.usage&ur.COPY_SRC)),Q(!!(e.usage&ur.COPY_DST)),this.frameCommandEncoder.copyTextureToTexture(o,_,[e.width,e.height,1])},e}(),Kr=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=e.call(this,{id:r,device:n})||this;return E.type=o.RenderPipeline,E.isCreatingAsync=!1,E.gpuRenderPipeline=null,E.descriptor=_,E.device.createRenderPipelineInternal(E,!1),E}return Object(w.c)(t,e),t.prototype.getBindGroupLayout=function(e){return this.gpuRenderPipeline.getBindGroupLayout(e)},t}(Gr),jr=function(e){function t(t){var r,n,_=t.id,E=t.device,c=t.descriptor,R=e.call(this,{id:_,device:E})||this;R.type=o.Sampler;var l=c.lodMinClamp,T=c.mipmapFilter===d.NO_MIP?c.lodMinClamp:c.lodMaxClamp,f=null!==(r=c.maxAnisotropy)&&void 0!==r?r:1;return f>1&&Q(c.minFilter===A.BILINEAR&&c.magFilter===A.BILINEAR&&c.mipmapFilter===d.LINEAR),R.gpuSampler=R.device.device.createSampler({addressModeU:Tr(c.addressModeU),addressModeV:Tr(c.addressModeV),addressModeW:Tr(null!==(n=c.addressModeW)&&void 0!==n?n:c.addressModeU),lodMinClamp:l,lodMaxClamp:T,minFilter:Ar(c.minFilter),magFilter:Ar(c.magFilter),mipmapFilter:dr(c.mipmapFilter),compare:void 0!==c.compareFunction?Mr(c.compareFunction):void 0,maxAnisotropy:f}),R}return Object(w.c)(t,e),t}(Gr),zr=function(e){function t(t){var r=t.id,n=t.device,_=t.descriptor,E=t.skipCreate,c=t.sampleCount,R=e.call(this,{id:r,device:n})||this;R.type=o.Texture,R.flipY=!1;var l=_.format,T=_.dimension,A=_.width,d=_.height,f=_.depthOrArrayLayers,h=_.mipLevelCount,S=_.usage,N=_.pixelStore;return R.flipY=!!(null==N?void 0:N.unpackFlipY),R.device.createTextureShared({format:l,dimension:null!=T?T:F.TEXTURE_2D,width:A,height:d,depthOrArrayLayers:null!=f?f:1,mipLevelCount:null!=h?h:1,usage:S,sampleCount:null!=c?c:1},R,E),R}return Object(w.c)(t,e),t.prototype.textureFromImageBitmapOrCanvas=function(e,t,r){for(var n=t[0].width,o=t[0].height,_={size:{width:n,height:o,depthOrArrayLayers:r},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT},E=e.createTexture(_),i=0;i<t.length;i++)e.queue.copyExternalImageToTexture({source:t[i],flipY:this.flipY},{texture:E,origin:[0,0,i]},[n,o]);return[E,n,o]},t.prototype.isImageBitmapOrCanvases=function(e){var data=e[0];return data instanceof ImageBitmap||data instanceof HTMLCanvasElement||data instanceof OffscreenCanvas},t.prototype.isVideo=function(e){return e[0]instanceof HTMLVideoElement},t.prototype.setImageData=function(e,t){var r,n,o,_,E=this,c=this.device.device;if(this.isImageBitmapOrCanvases(e))n=(r=Object(w.e)(this.textureFromImageBitmapOrCanvas(c,e,this.depthOrArrayLayers),3))[0],o=r[1],_=r[2];else if(this.isVideo(e))n=c.importExternalTexture({source:e[0]});else{var R=vr(this.gpuTextureformat),l=Math.ceil(this.width/R.width)*
1R.length;e.forEach((function(data){c.queue.writeTexture({texture:E.gpuTexture},data,{bytesPerRow:l},{width:E.width,height:E.height})}))}this.width=o,this.height=_,n&&(this.gpuTexture=n),this.gpuTextureView=this.gpuTexture.createView({dimension:lr(this.dimension)})},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.gpuTexture.destroy()},t}(Gr),qr=function(e){function t(t){var r=t.id,n=t.device,_=e.call(this,{id:r,device:n})||this;return _.type=o.RenderBundle,_.renderBundleEncoder=_.device.device.createRenderBundleEncoder({colorFormats:[_.device.swapChainFormat]}),_}return Object(w.c)(t,e),t.prototype.finish=function(){this.renderBundle=this.renderBundleEncoder.finish()},t}(Gr),Zr=function(){function e(e,t,canvas,r,n,o){this.swapChainWidth=0,this.swapChainHeight=0,this.swapChainTextureUsage=ur.RENDER_ATTACHMENT|ur.COPY_DST,this._resourceUniqueId=0,this.renderPassPool=[],this.computePassPool=[],this.frameCommandEncoderPool=[],this.featureTextureCompressionBC=!1,this.platformString="WebGPU",this.glslVersion="#version 440",this.explicitBindingLocations=!0,this.separateSamplerTextures=!0,this.viewportOrigin=M.UPPER_LEFT,this.clipSpaceNearZ=U.ZERO,this.supportsSyncPipelineCompilation=!1,this.supportMRT=!0,this.device=t,this.canvas=canvas,this.canvasContext=r,this.glsl_compile=n,this.WGSLComposer=o,this.fallbackTexture2D=this.createFallbackTexture(F.TEXTURE_2D,I.Float),this.setResourceName(this.fallbackTexture2D,"Fallback Texture2D"),this.fallbackTexture2DDepth=this.createFallbackTexture(F.TEXTURE_2D,I.Depth),this.setResourceName(this.fallbackTexture2DDepth,"Fallback Depth Texture2D"),this.fallbackTexture2DArray=this.createFallbackTexture(F.TEXTURE_2D_ARRAY,I.Float),this.setResourceName(this.fallbackTexture2DArray,"Fallback Texture2DArray"),this.fallbackTexture3D=this.createFallbackTexture(F.TEXTURE_3D,I.Float),this.setResourceName(this.fallbackTexture3D,"Fallback Texture3D"),this.fallbackTextureCube=this.createFallbackTexture(F.TEXTURE_CUBE_MAP,I.Float),this.setResourceName(this.fallbackTextureCube,"Fallback TextureCube"),this.fallbackSamplerFiltering=this.createSampler({addressModeU:T.REPEAT,addressModeV:T.REPEAT,minFilter:A.POINT,magFilter:A.POINT,mipmapFilter:d.NEAREST}),this.setResourceName(this.fallbackSamplerFiltering,"Fallback Sampler Filtering"),this.fallbackSamplerComparison=this.createSampler({addressModeU:T.REPEAT,addressModeV:T.REPEAT,minFilter:A.POINT,magFilter:A.POINT,mipmapFilter:d.NEAREST,compareFunction:_.ALWAYS}),this.setResourceName(this.fallbackSamplerComparison,"Fallback Sampler Comparison Filtering"),this.device.features&&(this.featureTextureCompressionBC=this.device.features.has("texture-compression-bc")),this.device.onuncapturederror=function(e){console.error(e.error)},this.swapChainFormat=navigator.gpu.getPreferredCanvasFormat(),this.canvasContext.configure({device:this.device,format:this.swapChainFormat,usage:this.swapChainTextureUsage,alphaMode:"premultiplied"})}return e.prototype.destroy=function(){},e.prototype.configureSwapChain=function(e,t){this.swapChainWidth===e&&this.swapChainHeight===t||(this.swapChainWidth=e,this.swapChainHeight=t)},e.prototype.getOnscreenTexture=function(){var e=this.canvasContext.getCurrentTexture(),t=e.createView(),r=new zr({id:0,device:this,descriptor:{format:G.U8_RGBA_RT,width:this.swapChainWidth,height:this.swapChainHeight,depthOrArrayLayers:0,dimension:F.TEXTURE_2D,mipLevelCount:1,usage:this.swapChainTextureUsage},skipCreate:!0});return r.depthOrArrayLayers=1,r.sampleCount=1,r.gpuTexture=e,r.gpuTextureView=t,r.name="Onscreen",this.setResourceName(r,"Onscreen Texture"),r},e.prototype.getDevice=function(){return this},e.prototype.getCanvas=function(){return this.canvas},e.prototype.beginFrame=function(){Q(0===this.frameCommandEncoderPool.length)},e.prototype.endFrame=function(){Q(this.frameCommandEncoderPool.every((function(e){return null!==e}))),this.device.queue.submit(this.frameCommandEncoderPool.map((function(e){return e.finish()}))),this.frameCommandEncoderPool=[]},e.prototype.getNextUniqueId=function(){return++this._resourceUniqueId},e.prototype.createBuffer=function(e){return new xr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createTexture=function(e){return new zr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createSampler=function(e){return new jr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createRenderTarget=function(e){var t=new zr({id:this.getNextUniqueId(),device:this,descriptor:Object(w.a)(Object(w.a)({},e),{dimension:F.TEXTURE_2D,mipLevelCount:1,depthOrArrayLayers:1,usage:C.RENDER_TARGET}
1),sampleCount:e.sampleCount});return t.depthOrArrayLayers=1,t.type=o.RenderTarget,t},e.prototype.createRenderTargetFromTexture=function(e){var t=e,r=t.format,n=t.width,o=t.height,_=t.depthOrArrayLayers,E=t.sampleCount,c=t.mipLevelCount,R=t.gpuTexture,l=t.gpuTextureView,T=t.usage;Q(!!(T&ur.RENDER_ATTACHMENT));var A=new zr({id:this.getNextUniqueId(),device:this,descriptor:{format:r,width:n,height:o,depthOrArrayLayers:_,dimension:F.TEXTURE_2D,mipLevelCount:c,usage:T},skipCreate:!0});return A.depthOrArrayLayers=_,A.sampleCount=E,A.gpuTexture=R,A.gpuTextureView=l,A},e.prototype.createProgram=function(e){var t,r;return(null===(t=e.vertex)||void 0===t?void 0:t.glsl)&&(e.vertex.glsl=st(this.queryVendorInfo(),"vert",e.vertex.glsl)),(null===(r=e.fragment)||void 0===r?void 0:r.glsl)&&(e.fragment.glsl=st(this.queryVendorInfo(),"frag",e.fragment.glsl)),new Hr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createProgramSimple=function(e){return new Hr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createTextureShared=function(e,t,r){var n={width:e.width,height:e.height,depthOrArrayLayers:e.depthOrArrayLayers},o=e.mipLevelCount,_=Rr(e.format),E=function(e){if(e===F.TEXTURE_2D)return"2d";if(e===F.TEXTURE_CUBE_MAP)return"2d";if(e===F.TEXTURE_2D_ARRAY)return"2d";if(e===F.TEXTURE_3D)return"3d";throw new Error("whoops")}(e.dimension),c=function(e){var t=0;return e&C.SAMPLED&&(t|=ur.TEXTURE_BINDING|ur.COPY_DST|ur.COPY_SRC),e&C.STORAGE&&(t|=ur.TEXTURE_BINDING|ur.STORAGE_BINDING|ur.COPY_SRC|ur.COPY_DST),e&C.RENDER_TARGET&&(t|=ur.RENDER_ATTACHMENT|ur.TEXTURE_BINDING|ur.COPY_SRC|ur.COPY_DST),t}(e.usage);if(t.gpuTextureformat=_,t.dimension=e.dimension,t.format=e.format,t.width=e.width,t.height=e.height,t.depthOrArrayLayers=e.depthOrArrayLayers,t.mipLevelCount=o,t.usage=c,t.sampleCount=e.sampleCount,!r){var R=this.device.createTexture({size:n,mipLevelCount:o,format:_,dimension:E,sampleCount:e.sampleCount,usage:c}),l=R.createView();t.gpuTexture=R,t.gpuTextureView=l}},e.prototype.getFallbackSampler=function(e){return e.formatKind===I.Depth&&e.comparison?this.fallbackSamplerComparison:this.fallbackSamplerFiltering},e.prototype.getFallbackTexture=function(e){var t=e.dimension,r=e.formatKind;if(t===F.TEXTURE_2D)return r===I.Depth?this.fallbackTexture2DDepth:this.fallbackTexture2D;if(t===F.TEXTURE_2D_ARRAY)return this.fallbackTexture2DArray;if(t===F.TEXTURE_3D)return this.fallbackTexture3D;if(t===F.TEXTURE_CUBE_MAP)return this.fallbackTextureCube;throw new Error("whoops")},e.prototype.createFallbackTexture=function(e,t){var r=e===F.TEXTURE_CUBE_MAP?6:1,n=t===I.Float?G.U8_RGBA_NORM:G.D24;return this.createTexture({dimension:e,format:n,usage:C.SAMPLED,width:1,height:1,depthOrArrayLayers:r,mipLevelCount:1})},e.prototype.createBindings=function(e){return new yr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createInputLayout=function(e){return new Wr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createComputePipeline=function(e){return new wr({id:this.getNextUniqueId(),device:this,descriptor:e})},e.prototype.createRenderPipeline=function(e){return new Kr({id:this.getNextUniqueId(),device:this,descriptor:Object(w.a)({},e)})},e.prototype.createQueryPool=function(e,t){return new Vr({id:this.getNextUniqueId(),device:this,descriptor:{type:e,elemCount:t}})},e.prototype.createRenderPipelineInternal=function(e,t){var r;if(null===e.gpuRenderPipeline){var n=e.descriptor,o=n.program,_=o.vertexStage,E=o.fragmentStage;if(null!==_&&null!==E){var c=n.megaStateDescriptor||{},R=c.stencilBack,l=c.stencilFront,T=Object(w.f)(c,["stencilBack","stencilFront"]),A=Re(Te);n.megaStateDescriptor=Object(w.a)(Object(w.a)(Object(w.a)({},A),{stencilBack:Object(w.a)(Object(w.a)({},A.stencilBack),R),stencilFront:Object(w.a)(Object(w.a)({},A.stencilFront),l)}),T);var d=n.megaStateDescriptor.attachmentsState[0];n.colorAttachmentFormats.forEach((function(e,i){n.megaStateDescriptor.attachmentsState[i]||(n.megaStateDescriptor.attachmentsState[i]=ue(void 0,d))}));var h,S,N=(h=null!==(r=n.topology)&&void 0!==r?r:f.TRIANGLES,S=n.megaStateDescriptor,{topology:Sr(h),cullMode:Nr(S.cullMode),frontFace:Br(S.frontFace)}),B=Ir(n.colorAttachmentFormats,n.megaStateDescriptor),F=function(e,t){if(!Object(y.a)(e))return{format:Rr(e),depthWriteEnabled:!!t.depthWrite,depthCompare:Mr(t.depthCompare),depthBias:t.polygonOffset?t.polygonOffsetUnits:0,depthBiasSlopeScale:t.polygonOffset?t.polygonOffsetFactor:0,stencilFront:{compare:Mr(t.stencilFront.compare),passOp:Ur(t.stencilFront.passOp),failOp:Ur(t.stencilFront.failOp),depthFailOp:Ur(t.stencilFront.depthFailOp)},stencilBack:{compare:Mr(t.stencilBack.compare),passOp:Ur(t.stencilBack.passOp),failOp:Ur(t.stencilBack.failOp),depthFailOp:Ur(t.stencilBack.depthFailOp)},stencilReadMask:4294967295,stencilWriteMask:4294967295}}(n.depthStencilAttachmentFormat,n.megaStateDescriptor),C=void 0;null!==n.inputLayout&&(C=n.inputLayout.buffers);var O=n.sampleCount,m={layout:"auto",vertex:Object(w.a)(Object(w.a)({},_),{buffers:C}),primitive:N,depthStencil:F,multisample:{count:O},fragment:Object(w.a)(Object(w.a)({},E),{targets:B})};e.gpuRenderPipeline=this.device.createRenderPipeline(m)}}},e.prototype.createReadback=function(){return new kr({id:this.getNextUniqueId(),device:this})},e.prototype.createRenderBundle=function(){return new qr({id:this.getNextUniqueId(),device:this})},e.prototype.createRenderPass=function(e){var t=this.renderPassPool.pop();void 0===t&&(t=new Yr(this));var r=this.frameCommandEncoderPool.pop();return void 0===r&&(r=this.device.createCommandEncoder()),t.beginRenderPass(r,e),t},e.prototype.createComputePass=function(){var e=this.computePassPool.pop();void 0===e&&(e=new Xr);var t=this.frameCommandEncoderPool.pop();return void 0===t&&(t=this.device.createCommandEncoder()),e.beginComputePass(t),e},e.prototype.submitPass=function(e){var t=e;t instanceof Yr?(this.frameCommandEncoderPool.push(t.frameCommandEncoder),t.finish(),this.renderPassPool.push(t)):t instanceof Xr&&(this.frameCommandEncoderPool.push(t.frameCommandEncoder),t.finish(),this.computePassPool.push(t))},e.prototype.copySubTexture2D=function(e,t,r,n,o,_,E){var c=this.device.createCommandEncoder(),R=e,l=n,T={texture:l.gpuTexture,origin:[o,_,0],mipLevel:0,aspect:"all"},A={texture:R.gpuTexture,origin:[t,r,0],mipLevel:0,aspect:"all"};Q(!!(l.usage&ur.COPY_SRC)),Q(!!(R.usage&ur.COPY_DST)),c.copyTextureToTexture(T,A,[l.width,l.height,E||1]),this.device.queue.submit([c.finish()])},e.prototype.queryLimits=function(){return{uniformBufferMaxPageWordSize:this.device.limits.maxUniformBufferBindingSize>>>2,uniformBufferWordAlignment:this.device.limits.minUniformBufferOffsetAlignment>>>2,supportedSampleCounts:[1],occlusionQueriesRecommended:!0,computeShadersSupported:!0}
1},e.prototype.queryTextureFormatSupported=function(e,t,r){if(function(e){switch(Y(e)){case D.BC1:case D.BC2:case D.BC3:case D.BC4_SNORM:case D.BC4_UNORM:case D.BC5_SNORM:case D.BC5_UNORM:return!0;default:return!1}}(e)){if(!this.featureTextureCompressionBC)return!1;var n=function(e){switch(Y(e)){case D.BC1:case D.BC2:case D.BC3:case D.BC4_SNORM:case D.BC4_UNORM:case D.BC5_SNORM:case D.BC5_UNORM:return 4;default:return 1}}(e);return t%n==0&&r%n==0&&this.featureTextureCompressionBC}switch(e){case G.U16_RGBA_NORM:case G.F32_RGBA:return!1}return!0},e.prototype.queryPlatformAvailable=function(){return!0},e.prototype.queryVendorInfo=function(){return this},e.prototype.queryRenderPass=function(e){return e.descriptor},e.prototype.queryRenderTarget=function(e){return e},e.prototype.setResourceName=function(e,s){if(e.name=s,e.type===o.Buffer)(t=e).gpuBuffer.label=s;else if(e.type===o.Texture){(t=e).gpuTexture.label=s,t.gpuTextureView.label=s}else if(e.type===o.RenderTarget){(t=e).gpuTexture.label=s,t.gpuTextureView.label=s}else if(e.type===o.Sampler){(t=e).gpuSampler.label=s}else if(e.type===o.RenderPipeline){var t;null!==(t=e).gpuRenderPipeline&&(t.gpuRenderPipeline.label=s)}},e.prototype.setResourceLeakCheck=function(e,t){},e.prototype.checkForLeaks=function(){},e.prototype.programPatched=function(e){},e.prototype.pipelineQueryReady=function(e){return null!==e.gpuRenderPipeline},e.prototype.pipelineForceReady=function(e){var t=e;this.createRenderPipelineInternal(t,!1)},e}(),Qr=function(){function e(e){this.pluginOptions=e}return e.prototype.createSwapChain=function(e){return Object(w.b)(this,void 0,void 0,(function(){var t,r,n,o,_,E,c;return Object(w.d)(this,(function(R){switch(R.label){case 0:if(void 0===globalThis.navigator.gpu)return[2,null];t=null,R.label=1;case 1:return R.trys.push([1,3,,4]),r=this.pluginOptions.xrCompatible,[4,globalThis.navigator.gpu.requestAdapter({xrCompatible:r})];case 2:return t=R.sent(),[3,4];case 3:return n=R.sent(),console.log(n),[3,4];case 4:return null===t?[2,null]:(o=["depth32float-stencil8","texture-compression-bc","float32-filterable"].filter((function(e){return t.features.has(e)})),[4,t.requestDevice({requiredFeatures:o})]);case 5:if((_=R.sent())&&(E=this.pluginOptions.onContextLost,_.lost.then((function(){E&&E()}))),null===_)return[2,null];if(!(c=e.getContext("webgpu")))return[2,null];R.label=6;case 6:return R.trys.push([6,8,,9]),[4,Er(this.pluginOptions.shaderCompilerPath)];case 7:case 8:return R.sent(),[3,9];case 9:return[2,new Zr(t,_,e,c,ar,sr&&new sr)]}}))}))},e}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.