/*!
 * @license twgl.js 4.14.2 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
 * Available via the MIT license.
 * see: http://github.com/greggman/twgl.js for details
 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.twgl=t():e.twgl=t()}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";t.__esModule=!0,t.copyExistingProperties=function(e,t){Object.keys(t).forEach((function(r){t.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(t[r]=e[r])}))},t.copyNamedProperties=function(e,t,r){e.forEach((function(e){var n=t[e];void 0!==n&&(r[e]=n)}))},t.error=function(){var e;(e=console).error.apply(e,arguments)},t.warn=function(){var e;(e=console).warn.apply(e,arguments)},t.isBuffer=function(e,t){return"undefined"!=typeof WebGLBuffer&&t instanceof WebGLBuffer},t.isRenderbuffer=function(e,t){return"undefined"!=typeof WebGLRenderbuffer&&t instanceof WebGLRenderbuffer},t.isShader=function(e,t){return"undefined"!=typeof WebGLShader&&t instanceof WebGLShader},t.isTexture=function(e,t){return"undefined"!=typeof WebGLTexture&&t instanceof WebGLTexture},t.isSampler=function(e,t){return"undefined"!=typeof WebGLSampler&&t instanceof WebGLSampler}},function(e,t,r){"use strict";t.__esModule=!0,t.getGLTypeForTypedArray=function(e){if(e instanceof Int8Array)return 5120;if(e instanceof Uint8Array)return 5121;if(e instanceof Uint8ClampedArray)return 5121;if(e instanceof Int16Array)return 5122;if(e instanceof Uint16Array)return 5123;if(e instanceof Int32Array)return 5124;if(e instanceof Uint32Array)return 5125;if(e instanceof Float32Array)return 5126;throw new Error("unsupported typed array type")},t.getGLTypeForTypedArrayType=function(e){if(e===Int8Array)return 5120;if(e===Uint8Array)return 5121;if(e===Uint8ClampedArray)return 5121;if(e===Int16Array)return 5122;if(e===Uint16Array)return 5123;if(e===Int32Array)return 5124;if(e===Uint32Array)return 5125;if(e===Float32Array)return 5126;throw new Error("unsupported typed array type")},t.getTypedArrayTypeForGLType=function(e){var t=n[e];if(!t)throw new Error("unknown gl type");return t},t.isArrayBuffer=void 0;var n={},o=n;o[5120]=Int8Array,o[5121]=Uint8Array,o[5122]=Int16Array,o[5123]=Uint16Array,o[5124]=Int32Array,o[5125]=Uint32Array,o[5126]=Float32Array,o[32819]=Uint16Array,o[32820]=Uint16Array,o[33635]=Uint16Array,o[5131]=Uint16Array,o[33640]=Uint32Array,o[35899]=Uint32Array,o[35902]=Uint32Array,o[36269]=Uint32Array,o[34042]=Uint32Array;var u="undefined"!=typeof SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};t.isArrayBuffer=u},function(e,t,r){"use strict";t.__esModule=!0,t.isWebGL1=function(e){return!e.texStorage2D},t.isWebGL2=function(e){return!!e.texStorage2D},t.glEnumToString=void 0;var n,o,u=(n={},o={},function(e,t){return function(e){var t=e.constructor.name;if(!n[t]){for(var r in e)if("number"==typeof e[r]){var u=o[e[r]];o[e[r]]=u?"".concat(u," | ").concat(r):r}n[t]=!0}}(e),o[t]||"0x"+t.toString(16)});t.glEnumToString=u},function(e,t,r){"use strict";t.__esModule=!0,t.createAttributeSetters=D,t.createProgram=z,t.createProgramFromScripts=function(e,t,r,n,o){for(var u=j(r,n,o),i=[],a=0;a<t.length;++a){var f=g(e,t[a],e[P[a]],u.errorCallback);if(!f)return null;i.push(f)}return z(e,i,u)},t.createProgramFromSources=C,t.createProgramInfo=function(e,t,r,n,o){var u=j(r,n,o),i=!0;if(t=t.map((function(e){if(e.indexOf("\n")<0){var t=l(e);t?e=t.text:(u.errorCallback("no element with id: "+e),i=!1)}return e})),!i)return null;var a=C(e,t,u);if(!a)return null;return H(e,a)},t.createProgramInfoFromProgram=H,t.createUniformSetters=U,t.createUniformBlockSpecFromProgram=W,t.createUniformBlockInfoFromProgram=B,t.createUniformBlockInfo=function(e,t,r){return B(e,t.program,t.uniformBlockSpec,r)},t.createTransformFeedback=function(e,t,r){var n=e.createTransformFeedback();return e.bindTransformFeedback(36386,n),e.useProgram(t.program),M(e,t,r),e.bindTransformFeedback(36386,null),n},t.createTransformFeedbackInfo=k,t.bindTransformFeedbackInfo=M,t.setAttributes=N,t.setBuffersAndAttributes=function(e,t,r){r.vertexArrayObject?e.bindVertexArray(r.vertexArrayObject):(N(t.attribSetters||t,r.attribs),r.indices&&e.bindBuffer(34963,r.indices))},t.setUniforms=G,t.setUniformBlock=function(e,t,r){L(e,t,r)&&e.bufferData(35345,r.array,35048)},t.setBlockUniforms=function(e,t){var r=e.uniforms;for(var n in t){var o=r[n];if(o){var u=t[n];u.length?o.set(u):o[0]=u}}},t.bindUniformBlock=L,t.setUniformsAndBindTextures=void 0;var n=i(r(2)),o=i(r(0));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function i(e){if(e&&e.__esModule)return e;var t=u();if(t&&t.has(e))return t.get(e);var r={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}}return r.default=e,t&&t.set(e,r),r}var a=o.error,f=o.warn;function l(e){return"undefined"!=typeof document&&document.getElementById?document.getElementById(e):null}var c={};function s(e,t){return c[t].bindPoint}function y(e,t){return function(r){e.uniform1i(t,r)}}function b(e,t){return function(r){e.uniform1iv(t,r)}}function v(e,t){return function(r){e.uniform2iv(t,r)}}function m(e,t){return function(r){e.uniform3iv(t,r)}}function d(e,t){return function(r){e.uniform4iv(t,r)}}function p(e,t,r,u){var i=s(0,t);return n.isWebGL2(e)?function(t){var n,a;o.isTexture(e,t)?(n=t,a=null):(n=t.texture,a=t.sampler),e.uniform1i(u,r),e.activeTexture(33984+r),e.bindTexture(i,n),e.bindSampler(r,a)}:function(t){e.uniform1i(u,r),e.activeTexture(33984+r),e.bindTexture(i,t)}}function x(e,t,r,u,i){for(var a=s(0,t),f=new Int32Array(i),l=0;l<i;++l)f[l]=r+l;return n.isWebGL2(e)?function(t){e.uniform1iv(u,f),t.forEach((function(t,n){var u,i;e.activeTexture(33984+f[n]),o.isTexture(e,t)?(u=t,i=null):(u=t.texture,i=t.sampler),e.bindSampler(r,i),e.bindTexture(a,u)}))}:function(t){e.uniform1iv(u,f),t.forEach((function(t,r){e.activeTexture(33984+f[r]),e.bindTexture(a,t)}))}}function F(e,t){return function(r){if(r.value)switch(e.disableVertexAttribArray(t),r.value.length){case 4:e.vertexAttrib4fv(t,r.value);break;case 3:e.vertexAttrib3fv(t,r.value);break;case 2:e.vertexAttrib2fv(t,r.value);break;case 1:e.vertexAttrib1fv(t,r.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else e.bindBuffer(34962,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribPointer(t,r.numComponents||r.size,r.type||5126,r.normalize||!1,r.stride||0,r.offset||0),void 0!==r.divisor&&e.vertexAttribDivisor(t,r.divisor)}}function E(e,t){return function(r){if(r.value){if(e.disableVertexAttribArray(t),4!==r.value.length)throw new Error("The length of an integer constant value must be 4!");e.vertexAttrib4iv(t,r.value)}else e.bindBuffer(34962,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||5124,r.stride||0,r.offset||0),void 0!==r.divisor&&e.vertexAttribDivisor(t,r.divisor)}}function _(e,t){return function(r){if(r.value){if(e.disableVertexAttribArray(t),4!==r.value.length)throw new Error("The length of an unsigned integer constant value must be 4!");e.vertexAttrib4uiv(t,r.value)}else e.bindBuffer(34962,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||5125,r.stride||0,r.offset||0),void 0!==r.divisor&&e.vertexAttribDivisor(t,r.divisor)}}function w(e,t,r){var n=r.size,o=r.count;return function(r){e.bindBuffer(34962,r.buffer);for(var u=r.size||r.numComponents||n,i=u/o,a=r.type||5126,f=c[a].size*u,l=r.normalize||!1,s=r.offset||0,y=f/o,b=0;b<o;++b)e.enableVertexAttribArray(t+b),e.vertexAttribPointer(t+b,i,a,l,f,s+y*b),void 0!==r.divisor&&e.vertexAttribDivisor(t+b,r.divisor)}}c[5126]={Type:Float32Array,size:4,setter:function(e,t){return function(r){e.uniform1f(t,r)}},arraySetter:function(e,t){return function(r){e.uniform1fv(t,r)}}},c[35664]={Type:Float32Array,size:8,setter:function(e,t){return function(r){e.uniform2fv(t,r)}}},c[35665]={Type:Float32Array,size:12,setter:function(e,t){return function(r){e.uniform3fv(t,r)}}},c[35666]={Type:Float32Array,size:16,setter:function(e,t){return function(r){e.uniform4fv(t,r)}}},c[5124]={Type:Int32Array,size:4,setter:y,arraySetter:b},c[35667]={Type:Int32Array,size:8,setter:v},c[35668]={Type:Int32Array,size:12,setter:m},c[35669]={Type:Int32Array,size:16,setter:d},c[5125]={Type:Uint32Array,size:4,setter:function(e,t){return function(r){e.uniform1ui(t,r)}},arraySetter:function(e,t){return function(r){e.uniform1uiv(t,r)}}},c[36294]={Type:Uint32Array,size:8,setter:function(e,t){return function(r){e.uniform2uiv(t,r)}}},c[36295]={Type:Uint32Array,size:12,setter:function(e,t){return function(r){e.uniform3uiv(t,r)}}},c[36296]={Type:Uint32Array,size:16,setter:function(e,t){return function(r){e.uniform4uiv(t,r)}}},c[35670]={Type:Uint32Array,size:4,setter:y,arraySetter:b},c[35671]={Type:Uint32Array,size:8,setter:v},c[35672]={Type:Uint32Array,size:12,setter:m},c[35673]={Type:Uint32Array,size:16,setter:d},c[35674]={Type:Float32Array,size:16,setter:function(e,t){return function(r){e.uniformMatrix2fv(t,!1,r)}}},c[35675]={Type:Float32Array,size:36,setter:function(e,t){return function(r){e.uniformMatrix3fv(t,!1,r)}}},c[35676]={Type:Float32Array,size:64,setter:function(e,t){return function(r){e.uniformMatrix4fv(t,!1,r)}}},c[35685]={Type:Float32Array,size:24,setter:function(e,t){return function(r){e.uniformMatrix2x3fv(t,!1,r)}}},c[35686]={Type:Float32Array,size:32,setter:function(e,t){return function(r){e.uniformMatrix2x4fv(t,!1,r)}}},c[35687]={Type:Float32Array,size:24,setter:function(e,t){return function(r){e.uniformMatrix3x2fv(t,!1,r)}}},c[35688]={Type:Float32Array,size:48,setter:function(e,t){return function(r){e.uniformMatrix3x4fv(t,!1,r)}}},c[35689]={Type:Float32Array,size:32,setter:function(e,t){return function(r){e.uniformMatrix4x2fv(t,!1,r)}}},c[35690]={Type:Float32Array,size:48,setter:function(e,t){return function(r){e.uniformMatrix4x3fv(t,!1,r)}}},c[35678]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:3553},c[35680]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:34067},c[35679]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:32879},c[35682]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:3553},c[36289]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:35866},c[36292]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:35866},c[36293]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:34067},c[36298]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:3553},c[36299]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:32879},c[36300]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:34067},c[36303]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:35866},c[36306]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:3553},c[36307]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:32879},c[36308]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:34067},c[36311]={Type:null,size:0,setter:p,arraySetter:x,bindPoint:35866};var A={};A[5126]={size:4,setter:F},A[35664]={size:8,setter:F},A[35665]={size:12,setter:F},A[35666]={size:16,setter:F},A[5124]={size:4,setter:E},A[35667]={size:8,setter:E},A[35668]={size:12,setter:E},A[35669]={size:16,setter:E},A[5125]={size:4,setter:_},A[36294]={size:8,setter:_},A[36295]={size:12,setter:_},A[36296]={size:16,setter:_},A[35670]={size:4,setter:E},A[35671]={size:8,setter:E},A[35672]={size:12,setter:E},A[35673]={size:16,setter:E},A[35674]={size:4,setter:w,count:2},A[35675]={size:9,setter:w,count:3},A[35676]={size:16,setter:w,count:4};var O=/^[ \t]*\n/;function h(e,t,r,n){var o=n||a,u=e.createShader(r),i=0;if(O.test(t)&&(i=1,t=t.replace(O,"")),e.shaderSource(u,t),e.compileShader(u),!e.getShaderParameter(u,35713)){var f=e.getShaderInfoLog(u);return o(function(e,t){return t=t||0,++t,e.split("\n").map((function(e,r){return r+t+": "+e})).join("\n")}(t,i)+"\n*** Error compiling shader: "+f),e.deleteShader(u),null}return u}function j(e,t,r){var n,o;if("function"==typeof t&&(r=t,t=void 0),"function"==typeof e)r=e,e=void 0;else if(e&&!Array.isArray(e)){if(e.errorCallback)return e;var u=e;r=u.errorCallback,e=u.attribLocations,n=u.transformFeedbackVaryings,o=u.transformFeedbackMode}var i={errorCallback:r||a,transformFeedbackVaryings:n,transformFeedbackMode:o};if(e){var f={};Array.isArray(e)?e.forEach((function(e,r){f[e]=t?t[r]:r})):f=e,i.attribLocations=f}return i}var P=["VERTEX_SHADER","FRAGMENT_SHADER"];function R(e,t){return t.indexOf("frag")>=0?35632:t.indexOf("vert")>=0?35633:void 0}function T(e,t){t.forEach((function(t){e.deleteShader(t)}))}function z(e,t,r,n,u){for(var i=j(r,n,u),a=[],f=[],c=0;c<t.length;++c){var s=t[c];if("string"==typeof s){var y=l(s),b=y?y.text:s,v=e[P[c]];y&&y.type&&(v=R(0,y.type)||v),s=h(e,b,v,i.errorCallback),f.push(s)}o.isShader(e,s)&&a.push(s)}if(a.length!==t.length)return i.errorCallback("not enough shaders for program"),T(e,f),null;var m=e.createProgram();a.forEach((function(t){e.attachShader(m,t)})),i.attribLocations&&Object.keys(i.attribLocations).forEach((function(t){e.bindAttribLocation(m,i.attribLocations[t],t)}));var d=i.transformFeedbackVaryings;if(d&&(d.attribs&&(d=d.attribs),Array.isArray(d)||(d=Object.keys(d)),e.transformFeedbackVaryings(m,d,i.transformFeedbackMode||35981)),e.linkProgram(m),!e.getProgramParameter(m,35714)){var p=e.getProgramInfoLog(m);return i.errorCallback("Error in program linking:"+p),e.deleteProgram(m),T(e,f),null}return m}function g(e,t,r,n){var o,u=l(t);if(!u)throw new Error("unknown script element: ".concat(t));o=u.text;var i=r||R(0,u.type);if(!i)throw new Error("unknown shader type");return h(e,o,i,n)}function C(e,t,r,n,o){for(var u=j(r,n,o),i=[],a=0;a<t.length;++a){var f=h(e,t[a],e[P[a]],u.errorCallback);if(!f)return null;i.push(f)}return z(e,i,u)}function S(e){var t=e.name;return t.startsWith("gl_")||t.startsWith("webgl_")}function U(e,t){var r=0;function n(t,n){var o,u=e.getUniformLocation(t,n.name),i=n.size>1&&"[0]"===n.name.substr(-3),a=n.type,f=c[a];if(!f)throw new Error("unknown type: 0x".concat(a.toString(16)));if(f.bindPoint){var l=r;r+=n.size,o=i?f.arraySetter(e,a,l,u,n.size):f.setter(e,a,l,u,n.size)}else o=f.arraySetter&&i?f.arraySetter(e,u):f.setter(e,u);return o.location=u,o}for(var o={},u=e.getProgramParameter(t,35718),i=0;i<u;++i){var a=e.getActiveUniform(t,i);if(!S(a)){var f=a.name;"[0]"===f.substr(-3)&&(f=f.substr(0,f.length-3));var l=n(t,a);o[f]=l}}return o}function k(e,t){for(var r={},n=e.getProgramParameter(t,35971),o=0;o<n;++o){var u=e.getTransformFeedbackVarying(t,o);r[u.name]={index:o,type:u.type,size:u.size}}return r}function M(e,t,r){for(var n in t.transformFeedbackInfo&&(t=t.transformFeedbackInfo),r.attribs&&(r=r.attribs),r){var o=t[n];if(o){var u=r[n];u.offset?e.bindBufferRange(35982,o.index,u.buffer,u.offset,u.size):e.bindBufferBase(35982,o.index,u.buffer)}}}function W(e,t){for(var r=e.getProgramParameter(t,35718),n=[],o=[],u=0;u<r;++u){o.push(u),n.push({});var i=e.getActiveUniform(t,u);if(S(i))break;n[u].name=i.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach((function(r){var u=r[0],i=r[1];e.getActiveUniforms(t,o,e[u]).forEach((function(e,t){n[t][i]=e}))}));for(var a={},f=e.getProgramParameter(t,35382),l=0;l<f;++l){var c=e.getActiveUniformBlockName(t,l),s={index:l,usedByVertexShader:e.getActiveUniformBlockParameter(t,l,35396),usedByFragmentShader:e.getActiveUniformBlockParameter(t,l,35398),size:e.getActiveUniformBlockParameter(t,l,35392),uniformIndices:e.getActiveUniformBlockParameter(t,l,35395)};s.used=s.usedByVertexShader||s.usedByFragmentShader,a[c]=s}return{blockSpecs:a,uniformData:n}}var I=/\[\d+\]\.$/;function B(e,t,r,n){var o=r.blockSpecs,u=r.uniformData,i=o[n];if(!i)return f("no uniform block object named:",n),{name:n,uniforms:{}};var a=new ArrayBuffer(i.size),l=e.createBuffer(),s=i.index;e.bindBuffer(35345,l),e.uniformBlockBinding(t,i.index,s);var y=n+".";I.test(y)&&(y=y.replace(I,"."));var b={};return i.uniformIndices.forEach((function(e){var t=u[e],r=c[t.type],n=r.Type,o=t.size*r.size,i=t.name;i.substr(0,y.length)===y&&(i=i.substr(y.length)),b[i]=new n(a,t.offset,o/n.BYTES_PER_ELEMENT)})),{name:n,array:a,asFloat:new Float32Array(a),buffer:l,uniforms:b}}function L(e,t,r){var n=(t.uniformBlockSpec||t).blockSpecs[r.name];if(n){var o=n.index;return e.bindBufferRange(35345,o,r.buffer,r.offset||0,r.array.byteLength),!0}return!1}function G(e,t){for(var r=e.uniformSetters||e,n=arguments.length,o=1;o<n;++o){var u=arguments[o];if(Array.isArray(u))for(var i=u.length,a=0;a<i;++a)G(r,u[a]);else for(var f in u){var l=r[f];l&&l(u[f])}}}var X=G;function D(e,t){for(var r={},n=e.getProgramParameter(t,35721),o=0;o<n;++o){var u=e.getActiveAttrib(t,o);if(!S(u)){var i=e.getAttribLocation(t,u.name),a=A[u.type],f=a.setter(e,i,a);f.location=i,r[u.name]=f}}return r}function N(e,t){for(var r in t){var n=e[r];n&&n(t[r])}}function H(e,t){var r={program:t,uniformSetters:U(e,t),attribSetters:D(e,t)};return n.isWebGL2(e)&&(r.uniformBlockSpec=W(e,t),r.transformFeedbackInfo=k(e,t)),r}t.setUniformsAndBindTextures=X},function(e,t,r){"use strict";t.__esModule=!0,t.setTextureDefaults_=function(e){u.copyExistingProperties(e,l),e.textureColor&&h(e.textureColor)},t.createSampler=U,t.createSamplers=function(e,t){var r={};return Object.keys(t).forEach((function(n){r[n]=U(e,t[n])})),r},t.setSamplerParameters=S,t.createTexture=Z,t.setEmptyTexture=K,t.setTextureFromArray=Y,t.loadTextureFromUrl=H,t.setTextureFromElement=B,t.setTextureFilteringForSize=k,t.setTextureParameters=C,t.setDefaultTextureColor=h,t.createTextures=function(e,t,r){r=r||L;var n=0,o=[],u={},i={};function a(){0===n&&setTimeout((function(){r(o.length?o:void 0,u,i)}),0)}return Object.keys(t).forEach((function(r){var f,l,c=t[r];("string"==typeof(l=c.src)||Array.isArray(l)&&"string"==typeof l[0])&&(f=function(e,t,u){i[r]=u,--n,e&&o.push(e),a()},++n),u[r]=Z(e,c,f)})),a(),u},t.resizeTexture=function(e,t,r,n,o,u){n=n||r.width,o=o||r.height,u=u||r.depth;var i=r.target||3553;e.bindTexture(i,t);var a,f=r.level||0,l=r.internalFormat||r.format||6408,s=F(l),y=r.format||s.format,b=r.src;a=b&&(c(b)||Array.isArray(b)&&"number"==typeof b[0])?r.type||A(e,b,s.type):r.type||s.type;if(34067===i)for(var v=0;v<6;++v)e.texImage2D(34069+v,f,l,n,o,0,y,a,null);else 32879===i||35866===i?e.texImage3D(i,f,l,n,o,u,0,y,a,null):e.texImage2D(i,f,l,n,o,0,y,a,null)},t.canGenerateMipmap=_,t.canFilter=w,t.getNumComponentsForFormat=function(e){var t=m[e];if(!t)throw"unknown format: "+e;return t.u},t.getBytesPerElementForInternalFormat=x,t.getFormatAndTypeForInternalFormat=F;var n=a(r(2)),o=a(r(1)),u=a(r(0));function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function a(e){if(e&&e.__esModule)return e;var t=i();if(t&&t.has(e))return t.get(e);var r={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=n?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o]}}return r.default=e,t&&t.set(e,r),r}var f,l={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},c=o.isArrayBuffer;function s(){return f=f||("undefined"!=typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null)}var y,b=6407,v=33319,m={},d=m;function p(e){if(!y){var t={6406:{v:6406,F:!0,_:!0,A:[1,2,2,4],type:[5121,5131,36193,5126]},6409:{v:6409,F:!0,_:!0,A:[1,2,2,4],type:[5121,5131,36193,5126]},6410:{v:6410,F:!0,_:!0,A:[2,4,4,8],type:[5121,5131,36193,5126]}};t[b]={v:b,F:!0,_:!0,A:[3,6,6,12,2],type:[5121,5131,36193,5126,33635]},t[6408]={v:6408,F:!0,_:!0,A:[4,8,8,16,2,2],type:[5121,5131,36193,5126,32819,32820]},t[33321]={v:6403,F:!0,_:!0,A:[1],type:[5121]},t[36756]={v:6403,F:!1,_:!0,A:[1],type:[5120]},t[33325]={v:6403,F:!1,_:!0,A:[4,2],type:[5126,5131]},t[33326]={v:6403,F:!1,_:!1,A:[4],type:[5126]},t[33330]={v:36244,F:!0,_:!1,A:[1],type:[5121]},t[33329]={v:36244,F:!0,_:!1,A:[1],type:[5120]},t[33332]={v:36244,F:!0,_:!1,A:[2],type:[5123]},t[33331]={v:36244,F:!0,_:!1,A:[2],type:[5122]},t[33334]={v:36244,F:!0,_:!1,A:[4],type:[5125]},t[33333]={v:36244,F:!0,_:!1,A:[4],type:[5124]},t[33323]={v:v,F:!0,_:!0,A:[2],type:[5121]},t[36757]={v:v,F:!1,_:!0,A:[2],type:[5120]},t[33327]={v:v,F:!1,_:!0,A:[8,4],type:[5126,5131]},t[33328]={v:v,F:!1,_:!1,A:[8],type:[5126]},t[33336]={v:33320,F:!0,_:!1,A:[2],type:[5121]},t[33335]={v:33320,F:!0,_:!1,A:[2],type:[5120]},t[33338]={v:33320,F:!0,_:!1,A:[4],type:[5123]},t[33337]={v:33320,F:!0,_:!1,A:[4],type:[5122]},t[33340]={v:33320,F:!0,_:!1,A:[8],type:[5125]},t[33339]={v:33320,F:!0,_:!1,A:[8],type:[5124]},t[32849]={v:b,F:!0,_:!0,A:[3],type:[5121]},t[35905]={v:b,F:!1,_:!0,A:[3],type:[5121]},t[36194]={v:b,F:!0,_:!0,A:[3,2],type:[5121,33635]},t[36758]={v:b,F:!1,_:!0,A:[3],type:[5120]},t[35898]={v:b,F:!1,_:!0,A:[12,6,4],type:[5126,5131,35899]},t[35901]={v:b,F:!1,_:!0,A:[12,6,4],type:[5126,5131,35902]},t[34843]={v:b,F:!1,_:!0,A:[12,6],type:[5126,5131]},t[34837]={v:b,F:!1,_:!1,A:[12],type:[5126]},t[36221]={v:36248,F:!1,_:!1,A:[3],type:[5121]},t[36239]={v:36248,F:!1,_:!1,A:[3],type:[5120]},t[36215]={v:36248,F:!1,_:!1,A:[6],type:[5123]},t[36233]={v:36248,F:!1,_:!1,A:[6],type:[5122]},t[36209]={v:36248,F:!1,_:!1,A:[12],type:[5125]},t[36227]={v:36248,F:!1,_:!1,A:[12],type:[5124]},t[32856]={v:6408,F:!0,_:!0,A:[4],type:[5121]},t[35907]={v:6408,F:!0,_:!0,A:[4],type:[5121]},t[36759]={v:6408,F:!1,_:!0,A:[4],type:[5120]},t[32855]={v:6408,F:!0,_:!0,A:[4,2,4],type:[5121,32820,33640]},t[32854]={v:6408,F:!0,_:!0,A:[4,2],type:[5121,32819]},t[32857]={v:6408,F:!0,_:!0,A:[4],type:[33640]},t[34842]={v:6408,F:!1,_:!0,A:[16,8],type:[5126,5131]},t[34836]={v:6408,F:!1,_:!1,A:[16],type:[5126]},t[36220]={v:36249,F:!0,_:!1,A:[4],type:[5121]},t[36238]={v:36249,F:!0,_:!1,A:[4],type:[5120]},t[36975]={v:36249,F:!0,_:!1,A:[4],type:[33640]},t[36214]={v:36249,F:!0,_:!1,A:[8],type:[5123]},t[36232]={v:36249,F:!0,_:!1,A:[8],type:[5122]},t[36226]={v:36249,F:!0,_:!1,A:[16],type:[5124]},t[36208]={v:36249,F:!0,_:!1,A:[16],type:[5125]},t[33189]={v:6402,F:!0,_:!1,A:[2,4],type:[5123,5125]},t[33190]={v:6402,F:!0,_:!1,A:[4],type:[5125]},t[36012]={v:6402,F:!0,_:!1,A:[4],type:[5126]},t[35056]={v:34041,F:!0,_:!1,A:[4],type:[34042]},t[36013]={v:34041,F:!0,_:!1,A:[4],type:[36269]},Object.keys(t).forEach((function(e){var r=t[e];r.bytesPerElementMap={},r.A.forEach((function(e,t){var n=r.type[t];r.bytesPerElementMap[n]=e}))})),y=t}return y[e]}function x(e,t){var r=p(e);if(!r)throw"unknown internal format";var n=r.bytesPerElementMap[t];if(void 0===n)throw"unknown internal format";return n}function F(e){var t=p(e);if(!t)throw"unknown internal format";return{format:t.v,type:t.type[0]}}function E(e){return 0==(e&e-1)}function _(e,t,r,o){if(!n.isWebGL2(e))return E(t)&&E(r);var u=p(o);if(!u)throw"unknown internal format";return u.F&&u._}function w(e){var t=p(e);if(!t)throw"unknown internal format";return t._}function A(e,t,r){return c(t)?o.getGLTypeForTypedArray(t):r||5121}function O(e,t,r,n,o){if(o%1!=0)throw"can't guess dimensions";if(r||n){if(n){if(!r&&(r=o/n)%1)throw"can't guess dimensions"}else if((n=o/r)%1)throw"can't guess dimensions"}else{var u=Math.sqrt(o/(34067===t?6:1));u%1==0?(r=u,n=u):(r=o,n=1)}return{width:r,height:n}}function h(e){l.textureColor=new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}d[6406]={u:1},d[6409]={u:1},d[6410]={u:2},d[b]={u:3},d[6408]={u:4},d[6403]={u:1},d[36244]={u:1},d[v]={u:2},d[33320]={u:2},d[b]={u:3},d[36248]={u:3},d[6408]={u:4},d[36249]={u:4},d[6402]={u:1},d[34041]={u:2};var j={};function P(e,t){void 0!==t.colorspaceConversion&&(j.colorspaceConversion=e.getParameter(37443),e.pixelStorei(37443,t.colorspaceConversion)),void 0!==t.premultiplyAlpha&&(j.premultiplyAlpha=e.getParameter(37441),e.pixelStorei(37441,t.premultiplyAlpha)),void 0!==t.flipY&&(j.flipY=e.getParameter(37440),e.pixelStorei(37440,t.flipY))}function R(e,t){void 0!==t.colorspaceConversion&&e.pixelStorei(37443,j.colorspaceConversion),void 0!==t.premultiplyAlpha&&e.pixelStorei(37441,j.premultiplyAlpha),void 0!==t.flipY&&e.pixelStorei(37440,j.flipY)}function T(e){j.unpackAlignment=e.getParameter(3317),n.isWebGL2(e)&&(j.unpackRowLength=e.getParameter(3314),j.unpackImageHeight=e.getParameter(32878),j.unpackSkipPixels=e.getParameter(3316),j.unpackSkipRows=e.getParameter(3315),j.unpackSkipImages=e.getParameter(32877))}function z(e){e.pixelStorei(3317,j.unpackAlignment),n.isWebGL2(e)&&(e.pixelStorei(3314,j.unpackRowLength),e.pixelStorei(32878,j.unpackImageHeight),e.pixelStorei(3316,j.unpackSkipPixels),e.pixelStorei(3315,j.unpackSkipRows),e.pixelStorei(32877,j.unpackSkipImages))}function g(e,t,r,n){n.minMag&&(r.call(e,t,10241,n.minMag),r.call(e,t,10240,n.minMag)),n.min&&r.call(e,t,10241,n.min),n.mag&&r.call(e,t,10240,n.mag),n.wrap&&(r.call(e,t,10242,n.wrap),r.call(e,t,10243,n.wrap),(32879===t||u.isSampler(e,t))&&r.call(e,t,32882,n.wrap)),n.wrapR&&r.call(e,t,32882,n.wrapR),n.wrapS&&r.call(e,t,10242,n.wrapS),n.wrapT&&r.call(e,t,10243,n.wrapT),n.minLod&&r.call(e,t,33082,n.minLod),n.maxLod&&r.call(e,t,33083,n.maxLod),n.baseLevel&&r.call(e,t,33084,n.baseLevel),n.maxLevel&&r.call(e,t,33085,n.maxLevel)}function C(e,t,r){var n=r.target||3553;e.bindTexture(n,t),g(e,n,e.texParameteri,r)}function S(e,t,r){g(e,t,e.samplerParameteri,r)}function U(e,t){var r=e.createSampler();return S(e,r,t),r}function k(e,t,r,n,o,u){u=u||6408;var i=(r=r||l.textureOptions).target||3553;if(n=n||r.width,o=o||r.height,e.bindTexture(i,t),_(e,n,o,u))e.generateMipmap(i);else{var a=w(u)?9729:9728;e.texParameteri(i,10241,a),e.texParameteri(i,10240,a),e.texParameteri(i,10242,33071),e.texParameteri(i,10243,33071)}}function M(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function W(e,t){return(t=t||{}).cubeFaceOrder||[34069,34070,34071,34072,34073,34074]}function I(e,t){var r=W(0,t).map((function(e,t){return{face:e,ndx:t}}));return r.sort((function(e,t){return e.face-t.face})),r}function B(e,t,r,n){var o=(n=n||l.textureOptions).target||3553,u=n.level||0,i=r.width,a=r.height,f=n.internalFormat||n.format||6408,c=F(f),y=n.format||c.format,b=n.type||c.type;if(P(e,n),e.bindTexture(o,t),34067===o){var v,m,d=r.width,p=r.height;if(d/6===p)v=p,m=[0,0,1,0,2,0,3,0,4,0,5,0];else if(p/6===d)v=d,m=[0,0,0,1,0,2,0,3,0,4,0,5];else if(d/3==p/2)v=d/3,m=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(d/2!=p/3)throw"can't figure out cube map from element: "+(r.src?r.src:r.nodeName);v=d/2,m=[0,0,1,0,0,1,1,1,0,2,1,2]}var x=s();x?(x.canvas.width=v,x.canvas.height=v,i=v,a=v,I(0,n).forEach((function(t){var n=m[2*t.ndx+0]*v,o=m[2*t.ndx+1]*v;x.drawImage(r,n,o,v,v,0,0,v,v),e.texImage2D(t.face,u,f,y,b,x.canvas)})),x.canvas.width=1,x.canvas.height=1):"undefined"!=typeof createImageBitmap&&(i=v,a=v,I(0,n).forEach((function(l){var c=m[2*l.ndx+0]*v,s=m[2*l.ndx+1]*v;e.texImage2D(l.face,u,f,v,v,0,y,b,null),createImageBitmap(r,c,s,v,v,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(r){P(e,n),e.bindTexture(o,t),e.texImage2D(l.face,u,f,y,b,r),R(e,n),M(n)&&k(e,t,n,i,a,f)}))})))}else if(32879===o||35866===o){var E=Math.min(r.width,r.height),_=Math.max(r.width,r.height),w=_/E;if(w%1!=0)throw"can not compute 3D dimensions of element";var A=r.width===_?1:0,O=r.height===_?1:0;T(e),e.pixelStorei(3317,1),e.pixelStorei(3314,r.width),e.pixelStorei(32878,0),e.pixelStorei(32877,0),e.texImage3D(o,u,f,E,E,E,0,y,b,null);for(var h=0;h<w;++h){var j=h*E*A,g=h*E*O;e.pixelStorei(3316,j),e.pixelStorei(3315,g),e.texSubImage3D(o,u,0,0,h,E,E,1,y,b,r)}z(e)}else e.texImage2D(o,u,f,y,b,r);R(e,n),M(n)&&k(e,t,n,i,a,f),C(e,t,n)}function L(){}function G(e,t){return void 0!==t||function(e){if("undefined"!=typeof document){var t=document.createElement("a");return t.href=e,t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol}var r=new URL(location.href).origin;return new URL(e,location.href).origin===r}(e)?t:"anonymous"}function X(e){return"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof ImageData&&e instanceof ImageData||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement}function D(e,t,r){return X(e)?(setTimeout((function(){r(null,e)})),e):function(e,t,r){var n;if(r=r||L,t=void 0!==t?t:l.crossOrigin,t=G(e,t),"undefined"!=typeof Image){n=new Image,void 0!==t&&(n.crossOrigin=t);var o=function(){n.removeEventListener("error",i),n.removeEventListener("load",a),n=null},i=function(){var t="couldn't load image: "+e;u.error(t),r(t,n),o()},a=function(){r(null,n),o()};return n.addEventListener("error",i),n.addEventListener("load",a),n.src=e,n}if("undefined"!=typeof ImageBitmap){var f,c,s=function(){r(f,c)},y={};t&&(y.mode="cors"),fetch(e,y).then((function(e){if(!e.ok)throw e;return e.blob()})).then((function(e){return createImageBitmap(e,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(e){c=e,setTimeout(s)})).catch((function(e){f=e,setTimeout(s)})),n=null}return n}(e,t,r)}function N(e,t,r){var n=(r=r||l.textureOptions).target||3553;if(e.bindTexture(n,t),!1!==r.color){var o=function(e){return e=e||l.textureColor,c(e)?e:new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}(r.color);if(34067===n)for(var u=0;u<6;++u)e.texImage2D(34069+u,0,6408,1,1,0,6408,5121,o);else 32879===n||35866===n?e.texImage3D(n,0,6408,1,1,1,0,6408,5121,o):e.texImage2D(n,0,6408,1,1,0,6408,5121,o)}}function H(e,t,r,n){return n=n||L,r=r||l.textureOptions,N(e,t,r),D((r=Object.assign({},r)).src,r.crossOrigin,(function(o,u){o?n(o,t,u):(B(e,t,u,r),n(null,t,u))}))}function q(e,t,r,n){n=n||L;var o=r.src;if(6!==o.length)throw"there must be 6 urls for a cubemap";var u=r.level||0,i=r.internalFormat||r.format||6408,a=F(i),f=r.format||a.format,l=r.type||5121,c=r.target||3553;if(34067!==c)throw"target must be TEXTURE_CUBE_MAP";N(e,t,r),r=Object.assign({},r);var s,y=6,b=[],v=W(0,r);s=o.map((function(o,a){return D(o,r.crossOrigin,(m=v[a],function(o,a){--y,o?b.push(o):a.width!==a.height?b.push("cubemap face img is not a square: "+a.src):(P(e,r),e.bindTexture(c,t),5===y?W().forEach((function(t){e.texImage2D(t,u,i,f,l,a)})):e.texImage2D(m,u,i,f,l,a),R(e,r),M(r)&&e.generateMipmap(c)),0===y&&n(b.length?b:void 0,t,s)}));var m}))}function V(e,t,r,n){n=n||L;var o=r.src,u=r.internalFormat||r.format||6408,i=F(u),a=r.format||i.format,f=r.type||5121,l=r.target||35866;if(32879!==l&&35866!==l)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";N(e,t,r),r=Object.assign({},r);var c,y=o.length,b=[],v=r.level||0,m=r.width,d=r.height,p=o.length,x=!0;c=o.map((function(o,i){return D(o,r.crossOrigin,(F=i,function(o,i){if(--y,o)b.push(o);else{if(P(e,r),e.bindTexture(l,t),x){x=!1,m=r.width||i.width,d=r.height||i.height,e.texImage3D(l,v,u,m,d,p,0,a,f,null);for(var E=0;E<p;++E)e.texSubImage3D(l,v,0,0,E,m,d,1,a,f,i)}else{var _,w=i;i.width===m&&i.height===d||(w=(_=s()).canvas,_.canvas.width=m,_.canvas.height=d,_.drawImage(i,0,0,m,d)),e.texSubImage3D(l,v,0,0,F,m,d,1,a,f,w),_&&w===_.canvas&&(_.canvas.width=0,_.canvas.height=0)}R(e,r),M(r)&&e.generateMipmap(l)}0===y&&n(b.length?b:void 0,t,c)}));var F}))}function Y(e,t,r,u){var i=(u=u||l.textureOptions).target||3553;e.bindTexture(i,t);var a=u.width,f=u.height,s=u.depth,y=u.level||0,b=u.internalFormat||u.format||6408,v=F(b),m=u.format||v.format,d=u.type||A(0,r,v.type);if(c(r))r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));else{var p=o.getTypedArrayTypeForGLType(d);r=new p(r)}var E,_=x(b,d),w=r.byteLength/_;if(w%1)throw"length wrong size for format: "+n.glEnumToString(e,m);if(32879===i||35866===i)if(a||f||s)!a||f&&s?!f||a&&s?(E=O(0,i,a,f,w/s),a=E.width,f=E.height):(E=O(0,i,a,s,w/f),a=E.width,s=E.height):(E=O(0,i,f,s,w/a),f=E.width,s=E.height);else{var h=Math.cbrt(w);if(h%1!=0)throw"can't guess cube size of array of numElements: "+w;a=h,f=h,s=h}else E=O(0,i,a,f,w),a=E.width,f=E.height;if(T(e),e.pixelStorei(3317,u.unpackAlignment||1),P(e,u),34067===i){var j=w/6*(_/r.BYTES_PER_ELEMENT);I(0,u).forEach((function(t){var n=j*t.ndx,o=r.subarray(n,n+j);e.texImage2D(t.face,y,b,a,f,0,m,d,o)}))}else 32879===i||35866===i?e.texImage3D(i,y,b,a,f,s,0,m,d,r):e.texImage2D(i,y,b,a,f,0,m,d,r);return R(e,u),z(e),{width:a,height:f,depth:s,type:d}}function K(e,t,r){var n=r.target||3553;e.bindTexture(n,t);var o=r.level||0,u=r.internalFormat||r.format||6408,i=F(u),a=r.format||i.format,f=r.type||i.type;if(P(e,r),34067===n)for(var l=0;l<6;++l)e.texImage2D(34069+l,o,u,r.width,r.height,0,a,f,null);else 32879===n||35866===n?e.texImage3D(n,o,u,r.width,r.height,r.depth,0,a,f,null):e.texImage2D(n,o,u,r.width,r.height,0,a,f,null);R(e,r)}function Z(e,t,r){r=r||L,t=t||l.textureOptions;var n=e.createTexture(),o=t.target||3553,u=t.width||1,i=t.height||1,a=t.internalFormat||6408;e.bindTexture(o,n),34067===o&&(e.texParameteri(o,10242,33071),e.texParameteri(o,10243,33071));var f=t.src;if(f)if("function"==typeof f&&(f=f(e,t)),"string"==typeof f)H(e,n,t,r);else if(c(f)||Array.isArray(f)&&("number"==typeof f[0]||Array.isArray(f[0])||c(f[0]))){var s=Y(e,n,f,t);u=s.width,i=s.height}else if(Array.isArray(f)&&("string"==typeof f[0]||X(f[0])))34067===o?q(e,n,t,r):V(e,n,t,r);else{if(!X(f))throw"unsupported src type";B(e,n,f,t),u=f.width,i=f.height}else K(e,n,t);return M(t)&&k(e,n,t,u,i,a),C(e,n,t),n}},function(e,t,r){"use strict";t.__esModule=!0;var n=r(6);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(t[e]=n[e])}))},function(e,t,r){"use strict";t.__esModule=!0;var n={addExtensionsToContext:!0,getContext:!0,getWebGLContext:!0,resizeCanvasToDisplaySize:!0,setDefaults:!0,attributes:!0,textures:!0,utils:!0,draw:!0,framebuffers:!0,programs:!0,typedarrays:!0,vertexArrays:!0};t.addExtensionsToContext=F,t.getContext=function(e,t){return function(e,t){for(var r=["webgl2","webgl","experimental-webgl"],n=null,o=0;o<r.length;++o)if(n=e.getContext(r[o],t)){m.addExtensionsToContext&&F(n);break}return n}(e,t)},t.getWebGLContext=function(e,t){return function(e,t){for(var r=["webgl","experimental-webgl"],n=null,o=0;o<r.length;++o)if(n=e.getContext(r[o],t)){m.addExtensionsToContext&&F(n);break}return n}(e,t)},t.resizeCanvasToDisplaySize=function(e,t){t=t||1,t=Math.max(0,t);var r=e.clientWidth*t|0,n=e.clientHeight*t|0;if(e.width!==r||e.height!==n)return e.width=r,e.height=n,!0;return!1},t.setDefaults=function(e){i.copyExistingProperties(e,m),o.setAttributeDefaults_(e),u.setTextureDefaults_(e)},t.vertexArrays=t.typedarrays=t.programs=t.framebuffers=t.draw=t.utils=t.textures=t.attributes=void 0;var o=v(r(7));t.attributes=o,Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=o[e]))}));var u=v(r(4));t.textures=u,Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=u[e]))}));var i=v(r(0)),a=v(r(2));t.utils=a,Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=a[e]))}));var f=v(r(8));t.draw=f,Object.keys(f).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=f[e]))}));var l=v(r(9));t.framebuffers=l,Object.keys(l).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=l[e]))}));var c=v(r(3));t.programs=c,Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=c[e]))}));var s=v(r(1));t.typedarrays=s,Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=s[e]))}));var y=v(r(10));function b(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return b=function(){return e},e}function v(e){if(e&&e.__esModule)return e;var t=b();if(t&&t.has(e))return t.get(e);var r={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=n?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o]}}return r.default=e,t&&t.set(e,r),r}t.vertexArrays=y,Object.keys(y).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||(t[e]=y[e]))}));var m={addExtensionsToContext:!0};var d=/^(.*?)_/;function p(e,t){a.glEnumToString(e,0);var r=e.getExtension(t);if(r){var n={},o=d.exec(t)[1],u="_"+o;for(var f in r){var l=r[f],c="function"==typeof l,s=c?o:u,y=f;f.endsWith(s)&&(y=f.substring(0,f.length-s.length)),void 0!==e[y]?c||e[y]===l||i.warn(y,e[y],l,f):c?e[y]=function(e){return function(){return e.apply(r,arguments)}}(l):(e[y]=l,n[y]=l)}n.constructor={name:r.constructor.name},a.glEnumToString(n,0)}return r}var x=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function F(e){for(var t=0;t<x.length;++t)p(e,x[t])}},function(e,t,r){"use strict";t.__esModule=!0,t.createAttribsFromArrays=p,t.createBuffersFromArrays=function(e,t){var r={};Object.keys(t).forEach((function(n){r[n]=F(e,t[n],n)})),t.indices?(r.numElements=t.indices.length,r.elementType=n.getGLTypeForTypedArray(d(t.indices),"indices")):r.numElements=function(e){var t,r;for(r=0;r<x.length&&!((t=x[r])in e);++r);r===x.length&&(t=Object.keys(e)[0]);var n=e[t],o=s(n).length,u=m(n,t),i=o/u;if(o%u>0)throw new Error("numComponents ".concat(u," not correct for length ").concat(o));return i}(t);return r},t.createBufferFromArray=F,t.createBufferFromTypedArray=l,t.createBufferInfoFromArrays=function(e,t,r){var o=p(e,t),u=Object.assign({},r||{});u.attribs=Object.assign({},r?r.attribs:{},o);var i=t.indices;if(i){var f=d(i,"indices");u.indices=l(e,f,34963),u.numElements=f.length,u.elementType=n.getGLTypeForTypedArray(f)}else u.numElements||(u.numElements=function(e,t){var r,n;for(n=0;n<x.length&&!((r=x[n])in t)&&!((r=a.attribPrefix+r)in t);++n);n===x.length&&(r=Object.keys(t)[0]);var o=t[r];e.bindBuffer(34962,o.buffer);var u=e.getBufferParameter(34962,34660);e.bindBuffer(34962,null);var i=(s=o.type,5120===s?1:5121===s?1:5122===s?2:5123===s?2:5124===s?4:5125===s?4:5126===s?4:0),f=u/i,l=o.numComponents||o.size,c=f/l;var s;if(c%1!=0)throw new Error("numComponents ".concat(l," not correct for length ").concat(length));return c}(e,u.attribs));return u},t.setAttribInfoBufferFromArray=function(e,t,r,n){r=d(r),void 0!==n?(e.bindBuffer(34962,t.buffer),e.bufferSubData(34962,n,r)):f(e,34962,t.buffer,r,t.drawType)},t.setAttributePrefix=function(e){a.attribPrefix=e},t.setAttributeDefaults_=function(e){o.copyExistingProperties(e,a)},t.getNumComponents_=m,t.getArray_=s;var n=i(r(1)),o=i(r(0));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function i(e){if(e&&e.__esModule)return e;var t=u();if(t&&t.has(e))return t.get(e);var r={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}}return r.default=e,t&&t.set(e,r),r}var a={attribPrefix:""};function f(e,t,r,n,o){e.bindBuffer(t,r),e.bufferData(t,n,o||35044)}function l(e,t,r,n){if(o.isBuffer(e,t))return t;r=r||34962;var u=e.createBuffer();return f(e,r,u,t,n),u}function c(e){return"indices"===e}function s(e){return e.length?e:e.data}var y=/coord|texture/i,b=/color|colour/i;function v(e,t){var r;if(t%(r=y.test(e)?2:b.test(e)?4:3)>0)throw new Error("Can not guess numComponents for attribute '".concat(e,"'. Tried ").concat(r," but ").concat(t," values is not evenly divisible by ").concat(r,". You should specify it."));return r}function m(e,t){return e.numComponents||e.size||v(t,s(e).length)}function d(e,t){if(n.isArrayBuffer(e))return e;if(n.isArrayBuffer(e.data))return e.data;Array.isArray(e)&&(e={data:e});var r=e.type;return r||(r=c(t)?Uint16Array:Float32Array),new r(e.data)}function p(e,t){var r={};return Object.keys(t).forEach((function(o){if(!c(o)){var u=t[o],i=u.attrib||u.name||u.attribName||a.attribPrefix+o;if(u.value){if(!Array.isArray(u.value)&&!n.isArrayBuffer(u.value))throw new Error("array.value is not array or typedarray");r[i]={value:u.value}}else{var f,s,y,b;if(u.buffer&&u.buffer instanceof WebGLBuffer)f=u.buffer,b=u.numComponents||u.size,s=u.type,y=u.normalize;else if("number"==typeof u||"number"==typeof u.data){var p=u.data||u,x=u.type||Float32Array,F=p*x.BYTES_PER_ELEMENT;s=n.getGLTypeForTypedArrayType(x),y=void 0!==u.normalize?u.normalize:(_=x)===Int8Array||_===Uint8Array,b=u.numComponents||u.size||v(o,p),f=e.createBuffer(),e.bindBuffer(34962,f),e.bufferData(34962,F,u.drawType||35044)}else{var E=d(u,o);f=l(e,E,void 0,u.drawType),s=n.getGLTypeForTypedArray(E),y=void 0!==u.normalize?u.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(E),b=m(u,o)}r[i]={buffer:f,numComponents:b,type:s,normalize:y,stride:u.stride||0,offset:u.offset||0,divisor:void 0===u.divisor?void 0:u.divisor,drawType:u.drawType}}}var _})),e.bindBuffer(34962,null),r}var x=["position","positions","a_position"];function F(e,t,r){var n="indices"===r?34963:34962;return l(e,d(t,r),n)}},function(e,t,r){"use strict";t.__esModule=!0,t.drawBufferInfo=u,t.drawObjectList=function(e,t){var r=null,o=null;t.forEach((function(t){if(!1!==t.active){var i=t.programInfo,a=t.vertexArrayInfo||t.bufferInfo,f=!1,l=void 0===t.type?4:t.type;i!==r&&(r=i,e.useProgram(i.program),f=!0),(f||a!==o)&&(o&&o.vertexArrayObject&&!a.vertexArrayObject&&e.bindVertexArray(null),o=a,n.setBuffersAndAttributes(e,i,a)),n.setUniforms(i,t.uniforms),u(e,a,l,t.count,t.offset,t.instanceCount)}})),o&&o.vertexArrayObject&&e.bindVertexArray(null)};var n=function(e){if(e&&e.__esModule)return e;var t=o();if(t&&t.has(e))return t.get(e);var r={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){var i=n?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(r,u,i):r[u]=e[u]}}r.default=e,t&&t.set(e,r);return r}(r(3));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function u(e,t,r,n,o,u){r=void 0===r?4:r;var i=t.indices,a=t.elementType,f=void 0===n?t.numElements:n;o=void 0===o?0:o,a||i?void 0!==u?e.drawElementsInstanced(r,f,void 0===a?5123:t.elementType,o,u):e.drawElements(r,f,void 0===a?5123:t.elementType,o):void 0!==u?e.drawArraysInstanced(r,o,f,u):e.drawArrays(r,o,f)}},function(e,t,r){"use strict";t.__esModule=!0,t.bindFramebufferInfo=function(e,t,r){r=r||36160,t?(e.bindFramebuffer(r,t.framebuffer),e.viewport(0,0,t.width,t.height)):(e.bindFramebuffer(r,null),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight))},t.createFramebufferInfo=function(e,t,r,u){var i=e.createFramebuffer();e.bindFramebuffer(36160,i),r=r||e.drawingBufferWidth,u=u||e.drawingBufferHeight;var c=0,s={framebuffer:i,attachments:[],width:r,height:u};return(t=t||a).forEach((function(t){var i=t.attachment,a=t.format,y=function(e){return f[e]}(a);if(y||(y=36064+c++),!i)if(function(e){return l[e]}(a))i=e.createRenderbuffer(),e.bindRenderbuffer(36161,i),e.renderbufferStorage(36161,a,r,u);else{var b=Object.assign({},t);b.width=r,b.height=u,void 0===b.auto&&(b.auto=!1,b.min=b.min||b.minMag||9729,b.mag=b.mag||b.minMag||9729,b.wrapS=b.wrapS||b.wrap||33071,b.wrapT=b.wrapT||b.wrap||33071),i=n.createTexture(e,b)}if(o.isRenderbuffer(e,i))e.framebufferRenderbuffer(36160,y,36161,i);else{if(!o.isTexture(e,i))throw new Error("unknown attachment type");void 0!==t.layer?e.framebufferTextureLayer(36160,y,i,t.level||0,t.layer):e.framebufferTexture2D(36160,y,t.texTarget||3553,i,t.level||0)}s.attachments.push(i)})),s},t.resizeFramebufferInfo=function(e,t,r,u,i){u=u||e.drawingBufferWidth,i=i||e.drawingBufferHeight,t.width=u,t.height=i,(r=r||a).forEach((function(r,a){var f=t.attachments[a],l=r.format;if(o.isRenderbuffer(e,f))e.bindRenderbuffer(36161,f),e.renderbufferStorage(36161,l,u,i);else{if(!o.isTexture(e,f))throw new Error("unknown attachment type");n.resizeTexture(e,f,r,u,i)}}))};var n=i(r(4)),o=i(r(0));function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}function i(e){if(e&&e.__esModule)return e;var t=u();if(t&&t.has(e))return t.get(e);var r={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}}return r.default=e,t&&t.set(e,r),r}var a=[{format:6408,type:5121,min:9729,wrap:33071},{format:34041}],f={};f[34041]=33306,f[6401]=36128,f[36168]=36128,f[6402]=36096,f[33189]=36096;var l={};l[32854]=!0,l[32855]=!0,l[36194]=!0,l[34041]=!0,l[33189]=!0,l[6401]=!0,l[36168]=!0},function(e,t,r){"use strict";t.__esModule=!0,t.createVertexArrayInfo=function(e,t,r){var o=e.createVertexArray();e.bindVertexArray(o),t.length||(t=[t]);return t.forEach((function(t){n.setBuffersAndAttributes(e,t,r)})),e.bindVertexArray(null),{numElements:r.numElements,elementType:r.elementType,vertexArrayObject:o}},t.createVAOAndSetAttributes=u,t.createVAOFromBufferInfo=function(e,t,r){return u(e,t.attribSetters||t,r.attribs,r.indices)};var n=function(e){if(e&&e.__esModule)return e;var t=o();if(t&&t.has(e))return t.get(e);var r={};if(null!=e){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)){var i=n?Object.getOwnPropertyDescriptor(e,u):null;i&&(i.get||i.set)?Object.defineProperty(r,u,i):r[u]=e[u]}}r.default=e,t&&t.set(e,r);return r}(r(3));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function u(e,t,r,o){var u=e.createVertexArray();return e.bindVertexArray(u),n.setAttributes(t,r),o&&e.bindBuffer(34963,o),e.bindVertexArray(null),u}}])}));