(function(da,ea){"object"===typeof exports&&"undefined"!==typeof module?module.exports=ea():"function"===typeof define&&define.amd?define(ea):da.createREGL=ea()})(this,function(){function da(a,b){this.id=Db++;this.type=a;this.data=b}function ea(a){if(0===a.length)return[];var b=a.charAt(0),c=a.charAt(a.length-1);if(1>>=b;c=(255>>=c;b|=c;c=(15>>=c;b|=c;c=(3>>c>>1}function gb(){function a(a){a:{for(var b=16;268435456>=b;b*=16)if(a<=b){a=b;break a}a=0}b=c[fb(a)>>2];return 0>2].push(a)}var c=S(8,function(){return[]});return{alloc:a,free:b,allocType:function(b,c){var e=null;switch(b){case 5120:e=new Int8Array(a(c),0,c);break;case 5121:e=new Uint8Array(a(c),0,c);break;case 5122:e=new Int16Array(a(2*c),0,c);break;case 5123:e=new Uint16Array(a(2*c),0,c);break;case 5124:e=new Int32Array(a(4*c),0,c);break;case 5125:e=new Uint32Array(a(4*c),0,c);break;case 5126:e=new Float32Array(a(4*c),0,c);break;default:return null}return e.length!== c?e.subarray(0,c):e},freeType:function(a){b(a.buffer)}}}function fa(a){return!!a&&"object"===typeof a&&Array.isArray(a.shape)&&Array.isArray(a.stride)&&"number"===typeof a.offset&&a.shape.length===a.stride.length&&(Array.isArray(a.data)||P(a.data))}function hb(a,b,c,d,f,e){for(var m=0;me&&(e=d.buffer.byteLength,5123===k?e>>=1:5125===k&&(e>>=2));d.vertCount=e;e=l;0>l&&(e=4,l=d.buffer.dimension,1===l&&(e=0),2===l&&(e=1),3===l&&(e=4));d.primType=e}function m(a){d.elementsCount--;delete q[a.id];a.buffer.destroy();a.buffer=null}var q={},u=0,r={uint8:5121,uint16:5123};b.oes_element_index_uint&&(r.uint32=5125);f.prototype.bind=function(){this.buffer.bind()};var k=[];return{create:function(a, b){function g(a){if(a)if("number"===typeof a)l(a),h.primType=4,h.vertCount=a|0,h.type=5121;else{var b=null,c=35044,d=-1,f=-1,n=0,k=0;if(Array.isArray(a)||P(a)||fa(a))b=a;else if("data"in a&&(b=a.data),"usage"in a&&(c=mb[a.usage]),"primitive"in a&&(d=Ka[a.primitive]),"count"in a&&(f=a.count|0),"type"in a&&(k=r[a.type]),"length"in a)n=a.length|0;else if(n=f,5123===k||5122===k)n*=2;else if(5125===k||5124===k)n*=4;e(h,b,c,d,f,n,k)}else l(),h.primType=4,h.vertCount=0,h.type=5121;return g}var l=c.create(null, 34963,!0),h=new f(l._buffer);d.elementsCount++;g(a);g._reglType="elements";g._elements=h;g.subdata=function(a,b){l.subdata(a,b);return g};g.destroy=function(){m(h)};return g},createStream:function(a){var b=k.pop();b||(b=new f(c.create(null,34963,!0,!1)._buffer));e(b,a,35040,-1,-1,0,0);return b},destroyStream:function(a){k.push(a)},getElements:function(a){return"function"===typeof a&&a._elements instanceof f?a._elements:null},clear:function(){T(q).forEach(m)}}}function ob(a){for(var b=B.allocType(5123, a.length),c=0;c>>31<<15,e=(d<<1>>>24)-127,d=d>>13&1023;b[c]=-24>e?f:-14>e?f+(d+1024>>-14-e):15>=e,c.height>>=e,t(c,d[e]),a.mipmask|=1<b;++b)a.images[b]=null;return a}function wa(a){for(var b=a.images,c=0;cb){for(var c=0;c=--this.refCount&&A(this)}});m.profile&&(e.getTotalTextureSize=function(){var a=0;Object.keys(ka).forEach(function(b){a+=ka[b].stats.size});return a});return{create2D:function(b,c){function d(a,b){var c=f.texInfo;E.call(c);var e=z();"number"===typeof a?"number"===typeof b?y(e,a|0,b|0):y(e,a|0,a|0):a?(nb(c,a),C(e,a)):y(e,1,1);c.genMipmaps&&(e.mipmask=(e.width<<1)-1);f.mipmask=e.mipmask;u(f, e);f.internalformat=e.internalformat;d.width=e.width;d.height=e.height;ba(f);w(e,3553);D(c,3553);za();wa(e);m.profile&&(f.stats.size=La(f.internalformat,f.type,e.width,e.height,c.genMipmaps,!1));d.format=H[f.internalformat];d.type=xa[f.type];d.mag=L[c.magFilter];d.min=pa[c.minFilter];d.wrapS=ga[c.wrapS];d.wrapT=ga[c.wrapT];return d}var f=new v(3553);ka[f.id]=f;e.textureCount++;d(b,c);d.subimage=function(a,b,c,e){b|=0;c|=0;e|=0;var v=l();u(v,f);v.width=0;v.height=0;t(v,a);v.width=v.width||(f.width>> e)-b;v.height=v.height||(f.height>>e)-c;ba(f);g(v,3553,b,c,e);za();h(v);return d};d.resize=function(b,c){var e=b|0,h=c|0||e;if(e===f.width&&h===f.height)return d;d.width=f.width=e;d.height=f.height=h;ba(f);for(var g=0;f.mipmask>>g;++g){var v=e>>g,l=h>>g;if(!v||!l)break;a.texImage2D(3553,g,f.format,v,l,0,f.format,f.type,null)}za();m.profile&&(f.stats.size=La(f.internalformat,f.type,e,h,!1,!1));return d};d._reglType="texture2d";d._texture=f;m.profile&&(d.stats=f.stats);d.destroy=function(){f.decRef()}; return d},createCube:function(b,c,d,f,k,n){function p(a,b,c,d,e,h){var f,g=A.texInfo;E.call(g);for(f=0;6>f;++f)J[f]=z();if("number"===typeof a||!a)for(a=a|0||1,f=0;6>f;++f)y(J[f],a,a);else if("object"===typeof a)if(b)C(J[0],a),C(J[1],b),C(J[2],c),C(J[3],d),C(J[4],e),C(J[5],h);else if(nb(g,a),r(A,a),"faces"in a)for(a=a.faces,f=0;6>f;++f)u(J[f],A),C(J[f],a[f]);else for(f=0;6>f;++f)C(J[f],a);u(A,J[0]);A.mipmask=g.genMipmaps?(J[0].width<<1)-1:J[0].mipmask;A.internalformat=J[0].internalformat;p.width= J[0].width;p.height=J[0].height;ba(A);for(f=0;6>f;++f)w(J[f],34069+f);D(g,34067);za();m.profile&&(A.stats.size=La(A.internalformat,A.type,p.width,p.height,g.genMipmaps,!0));p.format=H[A.internalformat];p.type=xa[A.type];p.mag=L[g.magFilter];p.min=pa[g.minFilter];p.wrapS=ga[g.wrapS];p.wrapT=ga[g.wrapT];for(f=0;6>f;++f)wa(J[f]);return p}var A=new v(34067);ka[A.id]=A;e.cubeCount++;var J=Array(6);p(b,c,d,f,k,n);p.subimage=function(a,b,c,d,e){c|=0;d|=0;e|=0;var f=l();u(f,A);f.width=0;f.height=0;t(f,b); f.width=f.width||(A.width>>e)-c;f.height=f.height||(A.height>>e)-d;ba(A);g(f,34069+a,c,d,e);za();h(f);return p};p.resize=function(b){b|=0;if(b!==A.width){p.width=A.width=b;p.height=A.height=b;ba(A);for(var c=0;6>c;++c)for(var x=0;A.mipmask>>x;++x)a.texImage2D(34069+c,x,A.format,b>>x,b>>x,0,A.format,A.type,null);za();m.profile&&(A.stats.size=La(A.internalformat,A.type,p.width,p.height,!1,!0));return p}};p._reglType="textureCube";p._texture=A;m.profile&&(p.stats=A.stats);p.destroy=function(){A.decRef()}; return p},clear:function(){for(var b=0;bc;++c)if(0!==(b.mipmask&1<>c,b.height>>c,0,b.internalformat, b.type,null);else for(var d=0;6>d;++d)a.texImage2D(34069+d,c,b.internalformat,b.width>>c,b.height>>c,0,b.internalformat,b.type,null);D(b.texInfo,b.target)})},refresh:function(){for(var b=0;be;++e){for(k=0;ka;++a)c[a].resize(d);b.width=b.height=d;return b},_reglType:"framebufferCube",destroy:function(){c.forEach(function(a){a.destroy()})}})}, clear:function(){T(D).forEach(p)},restore:function(){w.cur=null;w.next=null;w.dirty=!0;T(D).forEach(function(b){b.framebuffer=a.createFramebuffer();y(b)})}})}function Za(){this.w=this.z=this.y=this.x=this.state=0;this.buffer=null;this.size=0;this.normalized=!1;this.type=5126;this.divisor=this.stride=this.offset=0}function Rb(a,b,c,d,f,e,m){function q(a){if(a!==p.currentVAO){var c=b.oes_vertex_array_object;a?c.bindVertexArrayOES(a.vao):c.bindVertexArrayOES(null);p.currentVAO=a}}function u(c){if(c!== p.currentVAO){if(c)c.bindAttrs();else{for(var d=b.angle_instanced_arrays,e=0;e=n.byteLength?p.subdata(n):(p.destroy(),c.buffers[h]=null));c.buffers[h]||(p=c.buffers[h]=f.create(l,34962,!1,!0));k.buffer=f.getBuffer(p);k.size=k.buffer.dimension|0;k.normalized=!1;k.type=k.buffer.dtype;k.offset=0;k.stride=0;k.divisor=0;k.state=1;a[h]=1}else f.getBuffer(l)?(k.buffer=f.getBuffer(l),k.size=k.buffer.dimension|0,k.normalized=!1,k.type=k.buffer.dtype,k.offset=0,k.stride=0,k.divisor=0,k.state=1):f.getBuffer(l.buffer)?(k.buffer=f.getBuffer(l.buffer),k.size=(+l.size|| k.buffer.dimension)|0,k.normalized=!!l.normalized||!1,k.type="type"in l?Ja[l.type]:k.buffer.dtype,k.offset=(l.offset||0)|0,k.stride=(l.stride||0)|0,k.divisor=(l.divisor||0)|0,k.state=1):"x"in l&&(k.x=+l.x||0,k.y=+l.y||0,k.z=+l.z||0,k.w=+l.w||0,k.state=2)}for(p=0;pa&&(a=b.stats.uniformsCount)});return a},c.getMaxAttributesCount=function(){var a=0;t.forEach(function(b){b.stats.attributesCount>a&&(a=b.stats.attributesCount)});return a});return{clear:function(){var b=a.deleteShader.bind(a);T(r).forEach(b);r={};T(k).forEach(b); k={};t.forEach(function(b){a.deleteProgram(b.program)});t.length=0;n={};c.shaderCount=0},program:function(b,d,e,f){var g=n[d];g||(g=n[d]={});var m=g[b];if(m&&(m.refCount++,!f))return m;var z=new q(d,b);c.shaderCount++;u(z,e,f);m||(g[b]=z);t.push(z);return O(z,{destroy:function(){z.refCount--;if(0>=z.refCount){a.deleteProgram(z.program);var b=t.indexOf(z);t.splice(b,1);c.shaderCount--}0>=g[z.vertId].refCount&&(a.deleteShader(k[z.vertId]),delete k[z.vertId],delete n[z.fragId][z.vertId]);Object.keys(n[z.fragId]).length|| (a.deleteShader(r[z.fragId]),delete r[z.fragId],delete n[z.fragId])}})},restore:function(){r={};k={};for(var a=0;a>2),c=0;c>5]|=(a.charCodeAt(c/8)&255)<<24-c%32;var d=8*a.length;a=[1779033703,-1150833019,1013904242, -1521486534,1359893119,-1694144372,528734635,1541459225];var c=Array(64),f,e,m,q,u,r,k,n,t,g,l;b[d>>5]|=128<<24-d%32;b[(d+64>>9<<4)+15]=d;for(n=0;nt;t++){if(16>t)c[t]=b[t+n];else{g=t;l=c[t-2];l=Y(l,17)^Y(l,19)^l>>>10;l=H(l,c[t-7]);var h;h=c[t-15];h=Y(h,7)^Y(h,18)^h>>>3;c[g]=H(H(l,h),c[t-16])}g=q;g=Y(g,6)^Y(g,11)^Y(g,25);g=H(H(H(H(k,g),q&u^~q&r),Vb[t]),c[t]);k=d;k=Y(k,2)^Y(k,13)^Y(k,22);l=H(k,d&f^d&e^f&e);k=r;r=u;u= q;q=H(m,g);m=e;e=f;f=d;d=H(g,l)}a[0]=H(d,a[0]);a[1]=H(f,a[1]);a[2]=H(e,a[2]);a[3]=H(m,a[3]);a[4]=H(q,a[4]);a[5]=H(u,a[5]);a[6]=H(r,a[6]);a[7]=H(k,a[7])}b="";for(c=0;c<32*a.length;c+=8)b+=String.fromCharCode(a[c>>5]>>>24-c%32&255);return b}function Wb(a){for(var b="",c,d=0;d>>4&15)+"0123456789abcdef".charAt(c&15);return b}function Xb(a){for(var b="",c=-1,d,f;++c= d&&56320<=f&&57343>=f&&(d=65536+((d&1023)<<10)+(f&1023),c++),127>=d?b+=String.fromCharCode(d):2047>=d?b+=String.fromCharCode(192|d>>>6&31,128|d&63):65535>=d?b+=String.fromCharCode(224|d>>>12&15,128|d>>>6&63,128|d&63):2097151>=d&&(b+=String.fromCharCode(240|d>>>18&7,128|d>>>12&63,128|d>>>6&63,128|d&63));return b}function Y(a,b){return a>>>b|a<<32-b}function H(a,b){var c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535}function Aa(a){return Array.prototype.slice.call(a)}function Ba(a){return Aa(a).join("")} function Yb(a){function b(){var a=[],b=[];return O(function(){a.push.apply(a,Aa(arguments))},{def:function(){var c="v"+f++;b.push(c);0"+b+"?"+e+".constant["+b+"]:0;"}).join(""),"}}else{", "if(",x,"(",e,".buffer)){",k,"=",f,".createStream(",34962,",",e,".buffer);","}else{",k,"=",f,".getBuffer(",e,".buffer);","}",l,'="type" in ',e,"?",g.glTypes,"[",e,".type]:",k,".dtype;",F.normalized,"=!!",e,".normalized;");d("size");d("offset");d("stride");d("divisor");c("}}");c.exit("if(",F.isStream,"){",f,".destroyStream(",k,");","}");return F})});return g}function J(a){var b=a["static"],c=a.dynamic,d={};Object.keys(b).forEach(function(a){var c=b[a];d[a]=E(function(a,b){return"number"===typeof c|| "boolean"===typeof c?""+c:a.link(c)})});Object.keys(c).forEach(function(a){var b=c[a];d[a]=L(b,function(a,c){return a.invoke(c,b)})});return d}function oa(a,b,d,e,f){function g(a){var b=l[a];b&&(m[a]=b)}var k=G(a,b),h=B(a,f),l=H(a,h,f),n=v(a,f),m=ba(a,f),q=D(a,f,k);g("viewport");g(p("scissor.box"));var t=0>1)",r],");")}function b(){c(u,".drawArraysInstancedANGLE(",[p,q,t,r],");")}m&&"null"!==m?y?a():(c("if(",m,"){"),a(),c("}else{"),b(),c("}")):b()}function g(){function a(){c(k+".drawElements("+[p,t,v,q+"<<(("+v+"-5121)>>1)"]+");")}function b(){c(k+".drawArrays("+[p,q,t]+");")}m&&"null"!== m?y?a():(c("if(",m,"){"),a(),c("}else{"),b(),c("}")):b()}var h=a.shared,k=h.gl,l=h.draw,n=d.draw,m=function(){var e=n.elements,f=b;if(e){if(e.contextDep&&d.contextDynamic||e.propDep)f=c;e=e.append(a,f);n.elementsActive&&f("if("+e+")"+k+".bindBuffer(34963,"+e+".buffer.buffer);")}else e=f.def(),f(e,"=",l,".","elements",";","if(",e,"){",k,".bindBuffer(",34963,",",e,".buffer.buffer);}","else if(",h.vao,".currentVAO){",e,"=",a.shared.elements+".getElements("+h.vao,".currentVAO.elements);",ja?"":"if("+ e+")"+k+".bindBuffer(34963,"+e+".buffer.buffer);","}");return e}(),p=e("primitive"),q=e("offset"),t=function(){var e=n.count,f=b;if(e){if(e.contextDep&&d.contextDynamic||e.propDep)f=c;e=e.append(a,f)}else e=f.def(l,".","count");return e}();if("number"===typeof t){if(0===t)return}else c("if(",t,"){"),c.exit("}");var r,u;sa&&(r=e("instances"),u=a.instancing);var v=m+".type",y=n.elements&&la(n.elements)&&!n.vaoActive;sa&&("number"!==typeof r||0<=r)?"string"===typeof r?(c("if(",r,">0){"),f(),c("}else if(", r,"<0){"),g(),c("}")):f():g()}function xa(a,b,c,d,e){b=w();e=b.proc("body",e);sa&&(b.instancing=e.def(b.shared.extensions,".angle_instanced_arrays"));a(b,e,c,d);return b.compile().body}function da(a,b,c,d){Q(a,b);c.useVAO?c.drawVAO?b(a.shared.vao,".setVAO(",c.drawVAO.append(a,b),");"):b(a.shared.vao,".setVAO(",a.shared.vao,".targetVAO);"):(b(a.shared.vao,".setVAO(null);"),M(a,b,c,d.attributes,function(){return!0}));U(a,b,c,d.uniforms,function(){return!0},!1);Y(a,b,b,c)}function pa(a,b){var c=a.proc("draw", 1);Q(a,c);na(a,c,b.context);V(a,c,b.framebuffer);T(a,c,b);W(a,c,b.state);I(a,c,b,!1,!0);var d=b.shader.progVar.append(a,c);c(a.shared.gl,".useProgram(",d,".program);");if(b.shader.program)da(a,c,b,b.shader.program);else{c(a.shared.vao,".setVAO(null);");var e=a.global.def("{}"),f=c.def(d,".id"),g=c.def(e,"[",f,"]");c(a.cond(g).then(g,".call(this,a0);")["else"](g,"=",e,"[",f,"]=",a.link(function(c){return xa(da,a,b,c,1)}),"(",d,");",g,".call(this,a0);"))}0= --this.refCount&&m(this)};f.profile&&(d.getTotalRenderbufferSize=function(){var a=0;Object.keys(k).forEach(function(b){a+=k[b].stats.size});return a});return{create:function(b,c){function g(b,c){var d=0,e=0,k=32854;"object"===typeof b&&b?("shape"in b?(e=b.shape,d=e[0]|0,e=e[1]|0):("radius"in b&&(d=e=b.radius|0),"width"in b&&(d=b.width|0),"height"in b&&(e=b.height|0)),"format"in b&&(k=q[b.format])):"number"===typeof b?(d=b|0,e="number"===typeof c?c|0:d):b||(d=e=1);if(d!==l.width||e!==l.height||k!== l.format)return g.width=l.width=d,g.height=l.height=e,l.format=k,a.bindRenderbuffer(36161,l.renderbuffer),a.renderbufferStorage(36161,k,d,e),f.profile&&(l.stats.size=M[l.format]*l.width*l.height),g.format=u[l.format],g}var l=new e(a.createRenderbuffer());k[l.id]=l;d.renderbufferCount++;g(b,c);g.resize=function(b,c){var d=b|0,e=c|0||d;if(d===l.width&&e===l.height)return g;g.width=l.width=d;g.height=l.height=e;a.bindRenderbuffer(36161,l.renderbuffer);a.renderbufferStorage(36161,l.format,d,e);f.profile&& (l.stats.size=M[l.format]*l.width*l.height);return g};g._reglType="renderbuffer";g._renderbuffer=l;f.profile&&(g.stats=l.stats);g.destroy=function(){l.decRef()};return g},clear:function(){T(k).forEach(m)},restore:function(){T(k).forEach(function(b){b.renderbuffer=a.createRenderbuffer();a.bindRenderbuffer(36161,b.renderbuffer);a.renderbufferStorage(36161,b.format,b.width,b.height)});a.bindRenderbuffer(36161,null)}}},Ya=[];Ya[6408]=4;Ya[6407]=3;var Ra=[];Ra[5121]=1;Ra[5126]=4;Ra[36193]=2;var Vb=[1116352408, 1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387, 275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998],Ca=["x","y","z","w"],ac="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),Ga={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775, "dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},$a={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Ta={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},zb={cw:2304,ccw:2305}, Ab=new K(!1,!1,!1,function(){}),dc=function(a,b){function c(){this.endQueryIndex=this.startQueryIndex=-1;this.sum=0;this.stats=null}function d(a,b,d){var e=m.pop()||new c;e.startQueryIndex=a;e.endQueryIndex=b;e.sum=0;e.stats=d;q.push(e)}if(!b.ext_disjoint_timer_query)return null;var f=[],e=[],m=[],q=[],u=[],r=[];return{beginQuery:function(a){var c=f.pop()||b.ext_disjoint_timer_query.createQueryEXT();b.ext_disjoint_timer_query.beginQueryEXT(35007,c);e.push(c);d(e.length-1,e.length,a)},endQuery:function(){b.ext_disjoint_timer_query.endQueryEXT(35007)}, pushScopeStats:d,update:function(){var a,c;a=e.length;if(0!==a){r.length=Math.max(r.length,a+1);u.length=Math.max(u.length,a+1);u[0]=0;var d=r[0]=0;for(c=a=0;c=I.length&&d()}var c=Bb(I,a);I[c]=b}}}function r(){var a=W.viewport,b=W.scissor_box; a[0]=a[1]=b[0]=b[1]=0;D.viewportWidth=D.framebufferWidth=D.drawingBufferWidth=a[2]=b[2]=g.drawingBufferWidth;D.viewportHeight=D.framebufferHeight=D.drawingBufferHeight=a[3]=b[3]=g.drawingBufferHeight}function k(){D.tick+=1;D.time=t();r();M.procs.poll()}function n(){L.refresh();r();M.procs.refresh();z&&z.update()}function t(){return(Cb()-E)/1E3}a=Hb(a);if(!a)return null;var g=a.gl,l=g.getContextAttributes();g.isContextLost();var h=Ib(g,a);if(!h)return null;var p=Eb(),y={vaoCount:0,bufferCount:0,elementsCount:0, framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},C=a.cachedCode||{},w=h.extensions,z=dc(g,w),E=Cb(),B=g.drawingBufferWidth,H=g.drawingBufferHeight,D={tick:0,time:0,viewportWidth:B,viewportHeight:H,framebufferWidth:B,framebufferHeight:H,drawingBufferWidth:B,drawingBufferHeight:H,pixelRatio:a.pixelRatio},B={elements:null,primitive:4,count:-1,offset:0,instances:-1},v=bc(g,w),G=Jb(g,y,a,function(a){return A.destroyBuffer(a)}),K=Kb(g,w,G,y),A=Rb(g,w,v, y,G,K,B),J=Sb(g,p,y,a),L=Nb(g,w,v,function(){M.procs.poll()},D,y,a),P=cc(g,w,v,y,a),V=Qb(g,w,v,L,P,y),M=Zb(g,p,w,v,G,K,L,V,{},A,J,B,D,z,C,a),p=Tb(g,V,M.procs.poll,D,l,w,v),W=M.next,Q=g.canvas,I=[],S=[],T=[],U=[a.onDestroy],R=null;Q&&(Q.addEventListener("webglcontextlost",f,!1),Q.addEventListener("webglcontextrestored",e,!1));var Y=V.setFBO=m({framebuffer:Z.define.call(null,1,"framebuffer")});n();l=O(m,{clear:function(a){if("framebuffer"in a)if(a.framebuffer&&"framebufferCube"===a.framebuffer_reglType)for(var b= 0;6>b;++b)Y(O({framebuffer:a.framebuffer.faces[b]},a),q);else Y(a,q);else q(null,a)},prop:Z.define.bind(null,1),context:Z.define.bind(null,2),"this":Z.define.bind(null,3),draw:m({}),buffer:function(a){return G.create(a,34962,!1,!1)},elements:function(a){return K.create(a,!1)},texture:L.create2D,cube:L.createCube,renderbuffer:P.create,framebuffer:V.create,framebufferCube:V.createCube,vao:A.createVAO,attributes:l,frame:u,on:function(a,b){var c;switch(a){case "frame":return u(b);case "lost":c=S;break; case "restore":c=T;break;case "destroy":c=U}c.push(b);return{cancel:function(){for(var a=0;a