(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{555:function(e,t,r){e.exports=function(){function e(e,t){this.id=H++,this.type=e,this.data=t}function t(e){return"["+function e(t){if(0===t.length)return[];var r=t.charAt(0),n=t.charAt(t.length-1);if(1>>=t))<<3,(t|=r=(15<(e>>>=r))<<2)|(r=(3<(e>>>=r))<<1)|e>>>r>>1}function o(){function e(e){e:{for(var t=16;268435456>=t;t*=16)if(e<=t){e=t;break e}e=0}return 0<(t=r[f(e)>>2]).length?t.pop():new ArrayBuffer(e)}function t(e){r[f(e.byteLength)>>2].push(e)}var r=a(8,(function(){return[]}));return{alloc:e,free:t,allocType:function(t,r){var n=null;switch(t){case 5120:n=new Int8Array(e(r),0,r);break;case 5121:n=new Uint8Array(e(r),0,r);break;case 5122:n=new Int16Array(e(2*r),0,r);break;case 5123:n=new Uint16Array(e(2*r),0,r);break;case 5124:n=new Int32Array(e(4*r),0,r);break;case 5125:n=new Uint32Array(e(4*r),0,r);break;case 5126:n=new Float32Array(e(4*r),0,r);break;default:return null}return n.length!==r?n.subarray(0,r):n},freeType:function(e){t(e.buffer)}}}function u(e){return!!e&&"object"==typeof e&&Array.isArray(e.shape)&&Array.isArray(e.stride)&&"number"==typeof e.offset&&e.shape.length===e.stride.length&&(Array.isArray(e.data)||G(e.data))}function s(e,t,r,n,i,a){for(var f=0;f(i=o)&&(i=n.buffer.byteLength,5123===l?i>>=1:5125===l&&(i>>=2)),n.vertCount=i,i=f,0>f&&(i=4,1===(f=n.buffer.dimension)&&(i=0),2===f&&(i=1),3===f&&(i=4)),n.primType=i}function f(e){n.elementsCount--,delete o[e.id],e.buffer.destroy(),e.buffer=null}var o={},s=0,c={uint8:5121,uint16:5123};t.oes_element_index_uint&&(c.uint32=5125),i.prototype.bind=function(){this.buffer.bind()};var l=[];return{create:function(e,t){function o(e){if(e)if("number"==typeof e)s(e),l.primType=4,l.vertCount=0|e,l.type=5121;else{var t=null,r=35044,n=-1,i=-1,f=0,p=0;Array.isArray(e)||G(e)||u(e)?t=e:("data"in e&&(t=e.data),"usage"in e&&(r=Z[e.usage]),"primitive"in e&&(n=re[e.primitive]),"count"in e&&(i=0|e.count),"type"in e&&(p=c[e.type]),"length"in e?f=0|e.length:(f=i,5123===p||5122===p?f*=2:5125!==p&&5124!==p||(f*=4))),a(l,t,r,n,i,f,p)}else s(),l.primType=4,l.vertCount=0,l.type=5121;return o}var s=r.create(null,34963,!0),l=new i(s._buffer);return n.elementsCount++,o(e),o._reglType="elements",o._elements=l,o.subdata=function(e,t){return s.subdata(e,t),o},o.destroy=function(){f(l)},o},createStream:function(e){var t=l.pop();return t||(t=new i(r.create(null,34963,!0,!1)._buffer)),a(t,e,35040,-1,-1,0,0),t},destroyStream:function(e){l.push(e)},getElements:function(e){return"function"==typeof e&&e._elements instanceof i?e._elements:null},clear:function(){Y(o).forEach(f)}}}function m(e){for(var t=q.allocType(5123,e.length),r=0;r>>31<<15,i=(a<<1>>>24)-127,a=a>>13&1023;t[r]=-24>i?n:-14>i?n+(a+1024>>-14-i):15>=i,r.height>>=i,d(r,n[i]),e.mipmask|=1<t;++t)e.images[t]=null;return e}function C(e){for(var t=e.images,r=0;rt){for(var r=0;r=--this.refCount&&P(this)}}),f.profile&&(a.getTotalTextureSize=function(){var e=0;return Object.keys(ye).forEach((function(t){e+=ye[t].stats.size})),e}),{create2D:function(t,r){function n(e,t){var r=i.texInfo;j.call(r);var a=S();return"number"==typeof e?E(a,0|e,"number"==typeof t?0|t:0|e):e?(V(r,e),D(a,e)):E(a,1,1),r.genMipmaps&&(a.mipmask=(a.width<<1)-1),i.mipmask=a.mipmask,s(i,a),i.internalformat=a.internalformat,n.width=a.width,n.height=a.height,z(i),T(a,3553),F(r,3553),I(),C(a),f.profile&&(i.stats.size=k(i.internalformat,i.type,a.width,a.height,r.genMipmaps,!1)),n.format=ee[i.internalformat],n.type=te[i.type],n.mag=re[r.magFilter],n.min=ne[r.minFilter],n.wrapS=ie[r.wrapS],n.wrapT=ie[r.wrapT],n}var i=new B(3553);return ye[i.id]=i,a.textureCount++,n(t,r),n.subimage=function(e,t,r,a){t|=0,r|=0,a|=0;var f=g();return s(f,i),f.width=0,f.height=0,d(f,e),f.width=f.width||(i.width>>a)-t,f.height=f.height||(i.height>>a)-r,z(i),h(f,3553,t,r,a),I(),_(f),n},n.resize=function(t,r){var a=0|t,o=0|r||a;if(a===i.width&&o===i.height)return n;n.width=i.width=a,n.height=i.height=o,z(i);for(var u=0;i.mipmask>>u;++u){var s=a>>u,c=o>>u;if(!s||!c)break;e.texImage2D(3553,u,i.format,s,c,0,i.format,i.type,null)}return I(),f.profile&&(i.stats.size=k(i.internalformat,i.type,a,o,!1,!1)),n},n._reglType="texture2d",n._texture=i,f.profile&&(n.stats=i.stats),n.destroy=function(){i.decRef()},n},createCube:function(t,r,n,i,o,u){function l(e,t,r,n,i,a){var o,u=p.texInfo;for(j.call(u),o=0;6>o;++o)m[o]=S();if("number"!=typeof e&&e){if("object"==typeof e)if(t)D(m[0],e),D(m[1],t),D(m[2],r),D(m[3],n),D(m[4],i),D(m[5],a);else if(V(u,e),c(p,e),"faces"in e)for(e=e.faces,o=0;6>o;++o)s(m[o],p),D(m[o],e[o]);else for(o=0;6>o;++o)D(m[o],e)}else for(e=0|e||1,o=0;6>o;++o)E(m[o],e,e);for(s(p,m[0]),p.mipmask=u.genMipmaps?(m[0].width<<1)-1:m[0].mipmask,p.internalformat=m[0].internalformat,l.width=m[0].width,l.height=m[0].height,z(p),o=0;6>o;++o)T(m[o],34069+o);for(F(u,34067),I(),f.profile&&(p.stats.size=k(p.internalformat,p.type,l.width,l.height,u.genMipmaps,!0)),l.format=ee[p.internalformat],l.type=te[p.type],l.mag=re[u.magFilter],l.min=ne[u.minFilter],l.wrapS=ie[u.wrapS],l.wrapT=ie[u.wrapT],o=0;6>o;++o)C(m[o]);return l}var p=new B(34067);ye[p.id]=p,a.cubeCount++;var m=Array(6);return l(t,r,n,i,o,u),l.subimage=function(e,t,r,n,i){r|=0,n|=0,i|=0;var a=g();return s(a,p),a.width=0,a.height=0,d(a,t),a.width=a.width||(p.width>>i)-r,a.height=a.height||(p.height>>i)-n,z(p),h(a,34069+e,r,n,i),I(),_(a),l},l.resize=function(t){if((t|=0)!==p.width){l.width=p.width=t,l.height=p.height=t,z(p);for(var r=0;6>r;++r)for(var n=0;p.mipmask>>n;++n)e.texImage2D(34069+r,n,p.format,t>>n,t>>n,0,p.format,p.type,null);return I(),f.profile&&(p.stats.size=k(p.internalformat,p.type,l.width,l.height,!1,!0)),l}},l._reglType="textureCube",l._texture=p,f.profile&&(l.stats=p.stats),l.destroy=function(){p.decRef()},l},clear:function(){for(var t=0;tr;++r)if(0!=(t.mipmask&1<>r,t.height>>r,0,t.internalformat,t.type,null);else for(var n=0;6>n;++n)e.texImage2D(34069+n,r,t.internalformat,t.width>>r,t.height>>r,0,t.internalformat,t.type,null);F(t.texInfo,t.target)}))},refresh:function(){for(var t=0;ti;++i){for(s=0;se;++e)r[e].resize(n);return t.width=t.height=n,t},_reglType:"framebufferCube",destroy:function(){r.forEach((function(e){e.destroy()}))}})},clear:function(){Y(_).forEach(b)},restore:function(){v.cur=null,v.next=null,v.dirty=!0,Y(_).forEach((function(t){t.framebuffer=e.createFramebuffer(),g(t)}))}})}function E(){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 D(e,t,r,n,i,a,f){function o(){this.id=++l,this.attributes=[],this.elements=null,this.ownsElements=!1,this.offset=this.count=0,this.instances=-1,this.primitive=4;var e=t.oes_vertex_array_object;this.vao=e?e.createVertexArrayOES():null,p[this.id]=this,this.buffers=[]}var s=r.maxAttributes,c=Array(s);for(r=0;r=p.byteLength?s.subdata(p):(s.destroy(),r.buffers[o]=null)),r.buffers[o]||(s=r.buffers[o]=i.create(c,34962,!1,!0)),l.buffer=i.getBuffer(s),l.size=0|l.buffer.dimension,l.normalized=!1,l.type=l.buffer.dtype,l.offset=0,l.stride=0,l.divisor=0,l.state=1,e[o]=1):i.getBuffer(c)?(l.buffer=i.getBuffer(c),l.size=0|l.buffer.dimension,l.normalized=!1,l.type=l.buffer.dtype,l.offset=0,l.stride=0,l.divisor=0,l.state=1):i.getBuffer(c.buffer)?(l.buffer=i.getBuffer(c.buffer),l.size=0|(+c.size||l.buffer.dimension),l.normalized=!!c.normalized||!1,l.type="type"in c?K[c.type]:l.buffer.dtype,l.offset=0|(c.offset||0),l.stride=0|(c.stride||0),l.divisor=0|(c.divisor||0),l.state=1):"x"in c&&(l.x=+c.x||0,l.y=+c.y||0,l.z=+c.z||0,l.w=+c.w||0,l.state=2)}for(s=0;se&&(e=t.stats.uniformsCount)})),e},r.getMaxAttributesCount=function(){var e=0;return p.forEach((function(t){t.stats.attributesCount>e&&(e=t.stats.attributesCount)})),e}),{clear:function(){var t=e.deleteShader.bind(e);Y(s).forEach(t),s={},Y(c).forEach(t),c={},p.forEach((function(t){e.deleteProgram(t.program)})),p.length=0,l={},r.shaderCount=0},program:function(t,n,i,a){var f=l[n];f||(f=l[n]={});var d=f[t];if(d&&(d.refCount++,!a))return d;var h=new o(n,t);return r.shaderCount++,u(h,i,a),d||(f[t]=h),p.push(h),R(h,{destroy:function(){if(h.refCount--,0>=h.refCount){e.deleteProgram(h.program);var t=p.indexOf(h);p.splice(t,1),r.shaderCount--}0>=f[h.vertId].refCount&&(e.deleteShader(c[h.vertId]),delete c[h.vertId],delete l[h.fragId][h.vertId]),Object.keys(l[h.fragId]).length||(e.deleteShader(s[h.fragId]),delete s[h.fragId],delete l[h.fragId])}})},restore:function(){s={},c={};for(var e=0;e"+t+"?"+i+".constant["+t+"]:0;"})).join(""),"}}else{","if(",o,"(",i,".buffer)){",c,"=",a,".createStream(",34962,",",i,".buffer);","}else{",c,"=",a,".getBuffer(",i,".buffer);","}",l,'="type" in ',i,"?",f.glTypes,"[",i,".type]:",c,".dtype;",u.normalized,"=!!",i,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",u.isStream,"){",a,".destroyStream(",c,");","}"),u}))})),f}function O(e,t,n,i,f){function o(e){var t=s[e];t&&(p[e]=t)}var u=function(e,t){if("string"==typeof(r=e.static).frag&&"string"==typeof r.vert){if(0>1)",o],");")}function t(){r(u,".drawArraysInstancedANGLE(",[h,m,b,o],");")}d&&"null"!==d?y?e():(r("if(",d,"){"),e(),r("}else{"),t(),r("}")):t()}function f(){function e(){r(c+".drawElements("+[h,b,g,m+"<<(("+g+"-5121)>>1)"]+");")}function t(){r(c+".drawArrays("+[h,m,b]+");")}d&&"null"!==d?y?e():(r("if(",d,"){"),e(),r("}else{"),t(),r("}")):t()}var o,u,s=e.shared,c=s.gl,l=s.draw,p=n.draw,d=function(){var i=p.elements,a=t;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),p.vaoActive?i=i.append(e,a):a("if("+(i=i.append(e,a))+")"+c+".bindBuffer(34963,"+i+".buffer.buffer);")):(i=a.def(),a("if(",s.vao,".currentVAO){",i,"=",e.shared.elements+".getElements("+s.vao,".currentVAO.elements);",ne?"":"if("+i+")"+c+".bindBuffer(34963,"+i+".buffer.buffer);","}else{",i,"=",l,".","elements",";","if(",i,"){",c,".bindBuffer(",34963,",",i,".buffer.buffer);}}")),i}(),h=i("primitive"),m=i("offset"),b=function(){var i=p.count,a=t;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(e,a)):i=a.def(l,".","count"),i}();if("number"==typeof b){if(0===b)return}else r("if(",b,"){"),r.exit("}");ee&&(o=i("instances"),u=e.instancing);var g=d+".type",y=p.elements&&z(p.elements)&&!p.vaoActive;ee&&("number"!=typeof o||0<=o)?"string"==typeof o?(r("if(",o,">0){"),a(),r("}else if(",o,"<0){"),f(),r("}")):a():f()}function q(e,t,r,n,i){return i=(t=x()).proc("body",i),ee&&(t.instancing=i.def(t.shared.extensions,".angle_instanced_arrays")),e(t,i,r,n),t.compile().body}function Q(e,t,r,n){L(e,t),r.useVAO?r.drawVAO?t(e.shared.vao,".setVAO(",r.drawVAO.append(e,t),");"):t(e.shared.vao,".setVAO(",e.shared.vao,".targetVAO);"):(t(e.shared.vao,".setVAO(null);"),H(e,t,r,n.attributes,(function(){return!0}))),U(e,t,r,n.uniforms,(function(){return!0}),!1),N(e,t,t,r)}function G(e,t,r,n){function i(){return!0}e.batchId="a1",L(e,t),H(e,t,r,n.attributes,i),U(e,t,r,n.uniforms,i,!1),N(e,t,t,r)}function Y(e,t,r,n){function i(e){return e.contextDep&&f||e.propDep}function a(e){return!i(e)}L(e,t);var f=r.contextDep,o=t.def(),u=t.def();e.shared.props=u,e.batchId=o;var s=e.scope(),c=e.scope();t(s.entry,"for(",o,"=0;",o,"<","a1",";++",o,"){",u,"=","a0","[",o,"];",c,"}",s.exit),r.needsContext&&E(e,c,r.context),r.needsFramebuffer&&D(e,c,r.framebuffer),S(e,c,r.state,i),r.profile&&i(r.profile)&&M(e,c,r,!1,!0),n?(r.useVAO?r.drawVAO?i(r.drawVAO)?c(e.shared.vao,".setVAO(",r.drawVAO.append(e,c),");"):s(e.shared.vao,".setVAO(",r.drawVAO.append(e,s),");"):s(e.shared.vao,".setVAO(",e.shared.vao,".targetVAO);"):(s(e.shared.vao,".setVAO(null);"),H(e,s,r,n.attributes,a),H(e,c,r,n.attributes,i)),U(e,s,r,n.uniforms,a,!1),U(e,c,r,n.uniforms,i,!0),N(e,s,c,r)):(t=e.global.def("{}"),n=r.shader.progVar.append(e,c),u=c.def(n,".id"),s=c.def(t,"[",u,"]"),c(e.shared.gl,".useProgram(",n,".program);","if(!",s,"){",s,"=",t,"[",u,"]=",e.link((function(t){return q(G,e,r,t,2)})),"(",n,");}",s,".call(this,a0[",o,"],",o,");"))}function X(e,r){function n(t){var n=r.shader[t];n&&i.set(a.shader,"."+t,n.append(e,i))}var i=e.proc("scope",3);e.batchId="a2";var a=e.shared,f=a.current;E(e,i,r.context),r.framebuffer&&r.framebuffer.append(e,i),F(Object.keys(r.state)).forEach((function(t){var n=r.state[t].append(e,i);b(n)?n.forEach((function(r,n){i.set(e.next[t],"["+n+"]",r)})):i.set(a.next,"."+t,n)})),M(e,i,r,!0,!0),["elements","offset","count","instances","primitive"].forEach((function(t){var n=r.draw[t];n&&i.set(a.draw,"."+t,""+n.append(e,i))})),Object.keys(r.uniforms).forEach((function(n){var f=r.uniforms[n].append(e,i);Array.isArray(f)&&(f="["+f.join()+"]"),i.set(a.uniforms,"["+t.id(n)+"]",f)})),Object.keys(r.attributes).forEach((function(t){var n=r.attributes[t].append(e,i),a=e.scopeAttrib(t);Object.keys(new Z).forEach((function(e){i.set(a,"."+e,n[e])}))})),r.scopeVAO&&i.set(a.vao,".targetVAO",r.scopeVAO.append(e,i)),n("vert"),n("frag"),0=--this.refCount&&f(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var e=0;return Object.keys(c).forEach((function(t){e+=c[t].stats.size})),e}),{create:function(t,r){function f(t,r){var n=0,a=0,c=32854;if("object"==typeof t&&t?("shape"in t?(n=0|(a=t.shape)[0],a=0|a[1]):("radius"in t&&(n=a=0|t.radius),"width"in t&&(n=0|t.width),"height"in t&&(a=0|t.height)),"format"in t&&(c=o[t.format])):"number"==typeof t?(n=0|t,a="number"==typeof r?0|r:n):t||(n=a=1),n!==s.width||a!==s.height||c!==s.format)return f.width=s.width=n,f.height=s.height=a,s.format=c,e.bindRenderbuffer(36161,s.renderbuffer),e.renderbufferStorage(36161,c,n,a),i.profile&&(s.stats.size=ge[s.format]*s.width*s.height),f.format=u[s.format],f}var s=new a(e.createRenderbuffer());return c[s.id]=s,n.renderbufferCount++,f(t,r),f.resize=function(t,r){var n=0|t,a=0|r||n;return n===s.width&&a===s.height||(f.width=s.width=n,f.height=s.height=a,e.bindRenderbuffer(36161,s.renderbuffer),e.renderbufferStorage(36161,s.format,n,a),i.profile&&(s.stats.size=ge[s.format]*s.width*s.height)),f},f._reglType="renderbuffer",f._renderbuffer=s,i.profile&&(f.stats=s.stats),f.destroy=function(){s.decRef()},f},clear:function(){Y(c).forEach(f)},restore:function(){Y(c).forEach((function(t){t.renderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,t.renderbuffer),e.renderbufferStorage(36161,t.format,t.width,t.height)})),e.bindRenderbuffer(36161,null)}}},ve=[];ve[6408]=4,ve[6407]=3;var xe=[];xe[5121]=1,xe[5126]=4,xe[36193]=2;var we=["x","y","z","w"],Ae="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),ke={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},_e={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},Oe={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Ee={cw:2304,ccw:2305},De=new B(!1,!1,!1,(function(){}));return function(e){function t(){if(0===J.length)A&&A.update(),ee=null;else{ee=U.next(t),l();for(var e=J.length-1;0<=e;--e){var r=J[e];r&&r(j,null,0)}b.flush(),A&&A.update()}}function r(){!ee&&0=J.length&&n()}}}}function c(){var e=Y.viewport,t=Y.scissor_box;e[0]=e[1]=t[0]=t[1]=0,j.viewportWidth=j.framebufferWidth=j.drawingBufferWidth=e[2]=t[2]=b.drawingBufferWidth,j.viewportHeight=j.framebufferHeight=j.drawingBufferHeight=e[3]=t[3]=b.drawingBufferHeight}function l(){j.tick+=1,j.time=m(),c(),G.procs.poll()}function p(){P.refresh(),c(),G.procs.refresh(),A&&A.update()}function m(){return(N()-k)/1e3}if(!(e=i(e)))return null;var b=e.gl,g=b.getContextAttributes();b.isContextLost();var y=function(e,t){function r(t){var r;t=t.toLowerCase();try{r=n[t]=e.getExtension(t)}catch(e){}return!!r}for(var n={},i=0;it;++t)te(R({framebuffer:e.framebuffer.faces[t]},e),u);else te(e,u);else u(0,e)},prop:W.define.bind(null,1),context:W.define.bind(null,2),this:W.define.bind(null,3),draw:o({}),buffer:function(e){return F.create(e,34962,!1,!1)},elements:function(e){return B.create(e,!1)},texture:P.create2D,cube:P.createCube,renderbuffer:H.create,framebuffer:q.create,framebufferCube:q.createCube,vao:z.createVAO,attributes:g,frame:s,on:function(e,t){var r;switch(e){case"frame":return s(t);case"lost":r=K;break;case"restore":r=Z;break;case"destroy":r=$}return r.push(t),{cancel:function(){for(var e=0;e