cajonzero 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +49 -27
- package/dist/bin/cj0.js +14877 -89
- package/dist/catalog-BRO-mQoP.d.ts +67 -0
- package/dist/{config-BOzAyP7m.d.ts → config-glwUbUbx.d.ts} +1 -1
- package/dist/core.d.ts +19 -8
- package/dist/core.js +15300 -415
- package/dist/index.d.ts +7 -5
- package/dist/index.js +32123 -9901
- package/dist/maps.d.ts +182 -0
- package/dist/maps.js +14062 -0
- package/dist/{providers-BX7e4pNW.d.ts → providers-Bu0-iMVs.d.ts} +129 -56
- package/dist/quickjs.wasm +0 -0
- package/dist/scaffold.d.ts +73 -6
- package/dist/scaffold.js +334 -51
- package/dist/serve.d.ts +2 -1
- package/dist/serve.js +33010 -10788
- package/dist/ui/assets/index-Bf4Kjuyg.js +4404 -0
- package/dist/ui/assets/index-ZzhH55rc.css +2 -0
- package/dist/ui/assets/{main-BeABKxzY.js → main-DB66UjcY.js} +16 -16
- package/dist/ui/assets/{voxel.worker-CvX1GY4o.js → voxel.worker-BFiKMi1W.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/package.json +103 -95
- package/dist/ui/assets/index-Bhv7LV8L.css +0 -2
- package/dist/ui/assets/index-CaAHje8X.js +0 -4404
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as g,S as _,T as v,U as y,V as b,W as x,X as S,Z as C,_ as w,a as T,at as E,b as D,c as O,d as k,et as A,f as ee,g as j,h as M,i as N,it as P,j as F,k as te,l as I,m as ne,n as re,nt as ie,o as ae,ot as oe,p as se,q as L,r as ce,rt as R,s as z,t as B,u as le,v as V,w as H,x as ue,y as de,z as fe}from"./index-
|
|
1
|
+
import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,I as s,J as c,K as l,L as u,M as d,N as f,O as p,P as m,Q as h,R as g,S as _,T as v,U as y,V as b,W as x,X as S,Z as C,_ as w,a as T,at as E,b as D,c as O,d as k,et as A,f as ee,g as j,h as M,i as N,it as P,j as F,k as te,l as I,m as ne,n as re,nt as ie,o as ae,ot as oe,p as se,q as L,r as ce,rt as R,s as z,t as B,u as le,v as V,w as H,x as ue,y as de,z as fe}from"./index-Bf4Kjuyg.js";var pe=oe(E(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):n.createREGL=r()})(n,(function(){var e=function(e){return e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array||e instanceof Uint8ClampedArray},t=function(e,t){for(var n=Object.keys(t),r=0;r<n.length;++r)e[n[r]]=t[n[r]];return e},n=`
|
|
2
2
|
`;function r(e){return typeof atob<`u`?atob(e):`base64:`+e}function i(e){var t=Error(`(regl) `+e);throw console.error(t),t}function a(e,t){e||i(t)}function o(e){return e?`: `+e:``}function s(e,t,n){e in t||i(`unknown parameter (`+e+`)`+o(n)+`. possible values: `+Object.keys(t).join())}function c(t,n){e(t)||i(`invalid parameter type`+o(n)+`. must be a typed array`)}function l(e,t){switch(t){case`number`:return typeof e==`number`;case`object`:return typeof e==`object`;case`string`:return typeof e==`string`;case`boolean`:return typeof e==`boolean`;case`function`:return typeof e==`function`;case`undefined`:return e===void 0;case`symbol`:return typeof e==`symbol`}}function u(e,t,n){l(e,t)||i(`invalid parameter type`+o(n)+`. expected `+t+`, got `+typeof e)}function d(e,t){e>=0&&(e|0)===e||i(`invalid parameter type, (`+e+`)`+o(t)+`. must be a nonnegative integer`)}function f(e,t,n){t.indexOf(e)<0&&i(`invalid value`+o(n)+`. must be one of: `+t)}var p=[`gl`,`canvas`,`container`,`attributes`,`pixelRatio`,`extensions`,`optionalExtensions`,`profile`,`onDone`];function m(e){Object.keys(e).forEach(function(e){p.indexOf(e)<0&&i(`invalid regl constructor argument "`+e+`". must be one of `+p)})}function h(e,t){for(e+=``;e.length<t;)e=` `+e;return e}function g(){this.name=`unknown`,this.lines=[],this.index={},this.hasErrors=!1}function _(e,t){this.number=e,this.line=t,this.errors=[]}function v(e,t,n){this.file=e,this.line=t,this.message=n}function y(){var e=Error(),t=(e.stack||e).toString(),n=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(t);if(n)return n[1];var r=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(t);return r?r[1]:`unknown`}function b(){var e=Error(),t=(e.stack||e).toString(),n=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(t);if(n)return n[1];var r=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(t);return r?r[1]:`unknown`}function x(e,t){var n=e.split(`
|
|
3
3
|
`),i=1,a=0,o={unknown:new g,0:new g};o.unknown.name=o[0].name=t||y(),o.unknown.lines.push(new _(0,``));for(var s=0;s<n.length;++s){var c=n[s],l=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(c);if(l)switch(l[1]){case`line`:var u=/(\d+)(\s+\d+)?/.exec(l[2]);u&&(i=u[1]|0,u[2]&&(a=u[2]|0,a in o||(o[a]=new g)));break;case`define`:var d=/SHADER_NAME(_B64)?\s+(.*)$/.exec(l[2]);d&&(o[a].name=d[1]?r(d[2]):d[2])}o[a].lines.push(new _(i++,c))}return Object.keys(o).forEach(function(e){var t=o[e];t.lines.forEach(function(e){t.index[e.number]=e})}),o}function S(e){var t=[];return e.split(`
|
|
4
4
|
`).forEach(function(e){if(!(e.length<5)){var n=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(e);n?t.push(new v(n[1]|0,n[2]|0,n[3].trim())):e.length>0&&t.push(new v(`unknown`,0,e))}}),t}function C(e,t){t.forEach(function(t){var n=e[t.file];if(n){var r=n.index[t.line];if(r){r.errors.push(t),n.hasErrors=!0;return}}e.unknown.hasErrors=!0,e.unknown.lines[0].errors.push(t)})}function w(e,t,r,i,o){if(!e.getShaderParameter(t,e.COMPILE_STATUS)){var s=e.getShaderInfoLog(t),c=i===e.FRAGMENT_SHADER?`fragment`:`vertex`;ee(r,`string`,c+` shader source must be a string`,o);var l=x(r,o);C(l,S(s)),Object.keys(l).forEach(function(e){var t=l[e];if(!t.hasErrors)return;var r=[``],i=[``];function a(e,t){r.push(e),i.push(t||``)}a(`file number `+e+`: `+t.name+`
|
|
5
5
|
`,`color:red;text-decoration:underline;font-weight:bold`),t.lines.forEach(function(e){if(e.errors.length>0){a(h(e.number,4)+`| `,`background-color:yellow; font-weight:bold`),a(e.line+n,`color:red; background-color:yellow; font-weight:bold`);var t=0;e.errors.forEach(function(r){var i=r.message,o=/^\s*'(.*)'\s*:\s*(.*)$/.exec(i);if(o){var s=o[1];i=o[2],s===`assign`&&(s=`=`),t=Math.max(e.line.indexOf(s,t),0)}else t=0;a(h(`| `,6)),a(h(`^^^`,t+3)+n,`font-weight:bold`),a(h(`| `,6)),a(i+n,`font-weight:bold`)}),a(h(`| `,6)+n)}else a(h(e.number,4)+`| `),a(e.line+n,`color:red`)}),typeof document<`u`&&!window.chrome?(i[0]=r.join(`%c`),console.log.apply(console,i)):console.log(r.join(``))}),a.raise(`Error compiling `+c+` shader, `+l[0].name)}}function T(e,t,r,i,o){if(!e.getProgramParameter(t,e.LINK_STATUS)){var s=e.getProgramInfoLog(t),c=x(r,o),l=`Error linking program with vertex shader, "`+x(i,o)[0].name+`", and fragment shader "`+c[0].name+`"`;typeof document<`u`?console.log(`%c`+l+n+`%c`+s,`color:red;text-decoration:underline;font-weight:bold`,`color:red`):console.log(l+n+s),a.raise(l)}}function E(e){e._commandRef=y()}function D(e,t,n,r){E(e);function i(e){return e?r.id(e):0}e._fragId=i(e.static.frag),e._vertId=i(e.static.vert);function a(e,t){Object.keys(t).forEach(function(t){e[r.id(t)]=!0})}var o=e._uniformSet={};a(o,t.static),a(o,t.dynamic);var s=e._attributeSet={};a(s,n.static),a(s,n.dynamic),e._hasCount=`count`in e.static||`count`in e.dynamic||`elements`in e.static||`elements`in e.dynamic}function O(e,t){var n=b();i(e+` in command `+(t||y())+(n===`unknown`?``:` called from `+n))}function k(e,t,n){e||O(t,n||y())}function A(e,t,n,r){e in t||O(`unknown parameter (`+e+`)`+o(n)+`. possible values: `+Object.keys(t).join(),r||y())}function ee(e,t,n,r){l(e,t)||O(`invalid parameter type`+o(n)+`. expected `+t+`, got `+typeof e,r||y())}function j(e){e()}function M(e,t,n){e.texture?f(e.texture._texture.internalformat,t,`unsupported texture format for attachment`):f(e.renderbuffer._renderbuffer.format,n,`unsupported renderbuffer format for attachment`)}var N=33071,P=9728,F=9984,te=9985,I=9986,ne=9987,re=5120,ie=5121,ae=5122,oe=5123,se=5124,L=5125,ce=5126,R=32819,z=32820,B=33635,le=34042,V=36193,H={};H[re]=H[ie]=1,H[ae]=H[oe]=H[V]=H[B]=H[R]=H[z]=2,H[se]=H[L]=H[ce]=H[le]=4;function ue(e,t){return e===z||e===R||e===B?2:e===le?4:H[e]*t}function de(e){return!(e&e-1)&&!!e}function fe(e,t,n){var r,i=t.width,o=t.height,s=t.channels;a(i>0&&i<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,`invalid texture shape`),(e.wrapS!==N||e.wrapT!==N)&&a(de(i)&&de(o),`incompatible wrap mode for texture, both width and height must be power of 2`),t.mipmask===1?i!==1&&o!==1&&a(e.minFilter!==F&&e.minFilter!==I&&e.minFilter!==te&&e.minFilter!==ne,`min filter requires mipmap`):(a(de(i)&&de(o),`texture must be a square power of 2 to support mipmapping`),a(t.mipmask===(i<<1)-1,`missing or incomplete mipmap data`)),t.type===ce&&(n.extensions.indexOf(`oes_texture_float_linear`)<0&&a(e.minFilter===P&&e.magFilter===P,`filter not supported, must enable oes_texture_float_linear`),a(!e.genMipmaps,`mipmap generation not supported with float textures`));var c=t.images;for(r=0;r<16;++r)if(c[r]){var l=i>>r,u=o>>r;a(t.mipmask&1<<r,`missing mipmap data`);var d=c[r];if(a(d.width===l&&d.height===u,`invalid shape for mip images`),a(d.format===t.format&&d.internalformat===t.internalformat&&d.type===t.type,`incompatible type for mip image`),!d.compressed){if(d.data){var f=Math.ceil(ue(d.type,s)*l/d.unpackAlignment)*d.unpackAlignment;a(d.data.byteLength===f*u,`invalid data for image, buffer size is inconsistent with image format`)}else d.element||d.copy}}else e.genMipmaps||a(!(t.mipmask&1<<r),`extra mipmap data`);t.compressed&&a(!e.genMipmaps,`mipmap generation for compressed images not supported`)}function pe(e,t,n,r){var i=e.width,o=e.height,s=e.channels;a(i>0&&i<=r.maxTextureSize&&o>0&&o<=r.maxTextureSize,`invalid texture shape`),a(i===o,`cube map must be square`),a(t.wrapS===N&&t.wrapT===N,`wrap mode not supported by cube map`);for(var c=0;c<n.length;++c){var l=n[c];a(l.width===i&&l.height===o,`inconsistent cube map face shape`),t.genMipmaps&&(a(!l.compressed,`can not generate mipmap for compressed textures`),a(l.mipmask===1,`can not specify mipmaps and generate mipmaps`));for(var u=l.images,d=0;d<16;++d){var f=u[d];if(f){var p=i>>d,m=o>>d;a(l.mipmask&1<<d,`missing mipmap data`),a(f.width===p&&f.height===m,`invalid shape for mip images`),a(f.format===e.format&&f.internalformat===e.internalformat&&f.type===e.type,`incompatible type for mip image`),f.compressed||(f.data?a(f.data.byteLength===p*m*Math.max(ue(f.type,s),f.unpackAlignment),`invalid data for image, buffer size is inconsistent with image format`):f.element||f.copy)}}}}var U=t(a,{optional:j,raise:i,commandRaise:O,command:k,parameter:s,commandParameter:A,constructor:m,type:u,commandType:ee,isTypedArray:c,nni:d,oneOf:f,shaderError:w,linkError:T,callSite:b,saveCommandRef:E,saveDrawInfo:D,framebufferFormat:M,guessCommand:y,texture2D:fe,textureCube:pe}),me=0,he=0,ge=5,_e=6;function W(e,t){this.id=me++,this.type=e,this.data=t}function ve(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}function ye(e){if(e.length===0)return[];var t=e.charAt(0),n=e.charAt(e.length-1);if(e.length>1&&t===n&&(t===`"`||t===`'`))return[`"`+ve(e.substr(1,e.length-2))+`"`];var r=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(e);if(r)return ye(e.substr(0,r.index)).concat(ye(r[1])).concat(ye(e.substr(r.index+r[0].length)));var i=e.split(`.`);if(i.length===1)return[`"`+ve(e)+`"`];for(var a=[],o=0;o<i.length;++o)a=a.concat(ye(i[o]));return a}function be(e){return`[`+ye(e).join(`][`)+`]`}function xe(e,t){return new W(e,be(t+``))}function Se(e){return typeof e==`function`&&!e._reglType||e instanceof W}function Ce(e,t){if(typeof e==`function`)return new W(he,e);if(typeof e==`number`||typeof e==`boolean`)return new W(ge,e);if(Array.isArray(e))return new W(_e,e.map(function(e,n){return Ce(e,t+`[`+n+`]`)}));if(e instanceof W)return e;U(!1,`invalid option type in uniform `+t)}var G={DynamicVariable:W,define:xe,isDynamic:Se,unbox:Ce,accessor:be},we={next:typeof requestAnimationFrame==`function`?function(e){return requestAnimationFrame(e)}:function(e){return setTimeout(e,16)},cancel:typeof cancelAnimationFrame==`function`?function(e){return cancelAnimationFrame(e)}:clearTimeout},Te=typeof performance<`u`&&performance.now?function(){return performance.now()}:function(){return+new Date};function Ee(){var e={"":0},t=[``];return{id:function(n){var r=e[n];return r||(r=e[n]=t.length,t.push(n),r)},str:function(e){return t[e]}}}function De(e,n,r){var i=document.createElement(`canvas`);t(i.style,{border:0,margin:0,padding:0,top:0,left:0}),e.appendChild(i),e===document.body&&(i.style.position=`absolute`,t(e.style,{margin:0,padding:0}));function a(){var n=window.innerWidth,a=window.innerHeight;if(e!==document.body){var o=e.getBoundingClientRect();n=o.right-o.left,a=o.bottom-o.top}i.width=r*n,i.height=r*a,t(i.style,{width:n+`px`,height:a+`px`})}var o;e!==document.body&&typeof ResizeObserver==`function`?(o=new ResizeObserver(function(){setTimeout(a)}),o.observe(e)):window.addEventListener(`resize`,a,!1);function s(){o?o.disconnect():window.removeEventListener(`resize`,a),e.removeChild(i)}return a(),{canvas:i,onDestroy:s}}function Oe(e,t){function n(n){try{return e.getContext(n,t)}catch{return null}}return n(`webgl`)||n(`experimental-webgl`)||n(`webgl-experimental`)}function ke(e){return typeof e.nodeName==`string`&&typeof e.appendChild==`function`&&typeof e.getBoundingClientRect==`function`}function Ae(e){return typeof e.drawArrays==`function`||typeof e.drawElements==`function`}function je(e){return typeof e==`string`?e.split():(U(Array.isArray(e),`invalid extension array`),e)}function Me(e){return typeof e==`string`?(U(typeof document<`u`,`not supported outside of DOM`),document.querySelector(e)):e}function Ne(e){var t=e||{},n,r,i,a,o={},s=[],c=[],l=typeof window>`u`?1:window.devicePixelRatio,u=!1,d=function(e){e&&U.raise(e)},f=function(){};if(typeof t==`string`?(U(typeof document<`u`,`selector queries only supported in DOM enviroments`),n=document.querySelector(t),U(n,`invalid query string for element`)):typeof t==`object`?ke(t)?n=t:Ae(t)?(a=t,i=a.canvas):(U.constructor(t),`gl`in t?a=t.gl:`canvas`in t?i=Me(t.canvas):`container`in t&&(r=Me(t.container)),`attributes`in t&&(o=t.attributes,U.type(o,`object`,`invalid context attributes`)),`extensions`in t&&(s=je(t.extensions)),`optionalExtensions`in t&&(c=je(t.optionalExtensions)),`onDone`in t&&(U.type(t.onDone,`function`,`invalid or missing onDone callback`),d=t.onDone),`profile`in t&&(u=!!t.profile),`pixelRatio`in t&&(l=+t.pixelRatio,U(l>0,`invalid pixel ratio`))):U.raise(`invalid arguments to regl`),n&&(n.nodeName.toLowerCase()===`canvas`?i=n:r=n),!a){if(!i){U(typeof document<`u`,`must manually specify webgl context outside of DOM environments`);var p=De(r||document.body,d,l);if(!p)return null;i=p.canvas,f=p.onDestroy}o.premultipliedAlpha===void 0&&(o.premultipliedAlpha=!0),a=Oe(i,o)}return a?{gl:a,canvas:i,container:r,extensions:s,optionalExtensions:c,pixelRatio:l,profile:u,onDone:d,onDestroy:f}:(f(),d(`webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org`),null)}function Pe(e,t){var n={};function r(t){U.type(t,`string`,`extension name must be string`);var r=t.toLowerCase(),i;try{i=n[r]=e.getExtension(r)}catch{}return!!i}for(var i=0;i<t.extensions.length;++i){var a=t.extensions[i];if(!r(a))return t.onDestroy(),t.onDone(`"`+a+`" extension is not supported by the current WebGL context, try upgrading your system or a different browser`),null}return t.optionalExtensions.forEach(r),{extensions:n,restore:function(){Object.keys(n).forEach(function(e){if(n[e]&&!r(e))throw Error(`(regl): error restoring extension `+e)})}}}function K(e,t){for(var n=Array(e),r=0;r<e;++r)n[r]=t(r);return n}var Fe=5120,Ie=5121,Le=5122,Re=5123,ze=5124,Be=5125,Ve=5126;function He(e){for(var t=16;t<=1<<28;t*=16)if(e<=t)return t;return 0}function Ue(e){var t=(e>65535)<<4,n;return e>>>=t,n=(e>255)<<3,e>>>=n,t|=n,n=(e>15)<<2,e>>>=n,t|=n,n=(e>3)<<1,e>>>=n,t|=n,t|e>>1}function We(){var e=K(8,function(){return[]});function t(t){var n=He(t),r=e[Ue(n)>>2];return r.length>0?r.pop():new ArrayBuffer(n)}function n(t){e[Ue(t.byteLength)>>2].push(t)}function r(e,n){var r=null;switch(e){case Fe:r=new Int8Array(t(n),0,n);break;case Ie:r=new Uint8Array(t(n),0,n);break;case Le:r=new Int16Array(t(2*n),0,n);break;case Re:r=new Uint16Array(t(2*n),0,n);break;case ze:r=new Int32Array(t(4*n),0,n);break;case Be:r=new Uint32Array(t(4*n),0,n);break;case Ve:r=new Float32Array(t(4*n),0,n);break;default:return null}return r.length===n?r:r.subarray(0,n)}function i(e){n(e.buffer)}return{alloc:t,free:n,allocType:r,freeType:i}}var q=We();q.zero=We();var Ge=3408,Ke=3410,qe=3411,Je=3412,Ye=3413,Xe=3414,Ze=3415,Qe=33901,$e=33902,et=3379,tt=3386,nt=34921,rt=36347,it=36348,at=35661,ot=35660,st=34930,ct=36349,lt=34076,ut=34024,dt=7936,ft=7937,pt=7938,mt=35724,ht=34047,gt=36063,_t=34852,vt=3553,yt=34067,bt=34069,xt=33984,St=6408,Ct=5126,wt=5121,Tt=36160,Et=36053,Dt=36064,Ot=16384,kt=function(e,t){var n=1;t.ext_texture_filter_anisotropic&&(n=e.getParameter(ht));var r=1,i=1;t.webgl_draw_buffers&&(r=e.getParameter(_t),i=e.getParameter(gt));var a=!!t.oes_texture_float;if(a){var o=e.createTexture();e.bindTexture(vt,o),e.texImage2D(vt,0,St,1,1,0,St,Ct,null);var s=e.createFramebuffer();if(e.bindFramebuffer(Tt,s),e.framebufferTexture2D(Tt,Dt,vt,o,0),e.bindTexture(vt,null),e.checkFramebufferStatus(Tt)!==Et)a=!1;else{e.viewport(0,0,1,1),e.clearColor(1,0,0,1),e.clear(Ot);var c=q.allocType(Ct,4);e.readPixels(0,0,1,1,St,Ct,c),e.getError()?a=!1:(e.deleteFramebuffer(s),e.deleteTexture(o),a=c[0]===1),q.freeType(c)}}var l=typeof navigator<`u`&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent)),u=!0;if(!l){var d=e.createTexture(),f=q.allocType(wt,36);e.activeTexture(xt),e.bindTexture(yt,d),e.texImage2D(bt,0,St,3,3,0,St,wt,f),q.freeType(f),e.bindTexture(yt,null),e.deleteTexture(d),u=!e.getError()}return{colorBits:[e.getParameter(Ke),e.getParameter(qe),e.getParameter(Je),e.getParameter(Ye)],depthBits:e.getParameter(Xe),stencilBits:e.getParameter(Ze),subpixelBits:e.getParameter(Ge),extensions:Object.keys(t).filter(function(e){return!!t[e]}),maxAnisotropic:n,maxDrawbuffers:r,maxColorAttachments:i,pointSizeDims:e.getParameter(Qe),lineWidthDims:e.getParameter($e),maxViewportDims:e.getParameter(tt),maxCombinedTextureUnits:e.getParameter(at),maxCubeMapSize:e.getParameter(lt),maxRenderbufferSize:e.getParameter(ut),maxTextureUnits:e.getParameter(st),maxTextureSize:e.getParameter(et),maxAttributes:e.getParameter(nt),maxVertexUniforms:e.getParameter(rt),maxVertexTextureUnits:e.getParameter(ot),maxVaryingVectors:e.getParameter(it),maxFragmentUniforms:e.getParameter(ct),glsl:e.getParameter(mt),renderer:e.getParameter(ft),vendor:e.getParameter(dt),version:e.getParameter(pt),readFloat:a,npotTextureCube:u}};function At(t){return!!t&&typeof t==`object`&&Array.isArray(t.shape)&&Array.isArray(t.stride)&&typeof t.offset==`number`&&t.shape.length===t.stride.length&&(Array.isArray(t.data)||e(t.data))}var J=function(e){return Object.keys(e).map(function(t){return e[t]})},jt={shape:Lt,flatten:It};function Mt(e,t,n){for(var r=0;r<t;++r)n[r]=e[r]}function Nt(e,t,n,r){for(var i=0,a=0;a<t;++a)for(var o=e[a],s=0;s<n;++s)r[i++]=o[s]}function Pt(e,t,n,r,i,a){for(var o=a,s=0;s<t;++s)for(var c=e[s],l=0;l<n;++l)for(var u=c[l],d=0;d<r;++d)i[o++]=u[d]}function Ft(e,t,n,r,i){for(var a=1,o=n+1;o<t.length;++o)a*=t[o];var s=t[n];if(t.length-n===4){var c=t[n+1],l=t[n+2],u=t[n+3];for(o=0;o<s;++o)Pt(e[o],c,l,u,r,i),i+=a}else for(o=0;o<s;++o)Ft(e[o],t,n+1,r,i),i+=a}function It(e,t,n,r){var i=1;if(t.length)for(var a=0;a<t.length;++a)i*=t[a];else i=0;var o=r||q.allocType(n,i);switch(t.length){case 0:break;case 1:Mt(e,t[0],o);break;case 2:Nt(e,t[0],t[1],o);break;case 3:Pt(e,t[0],t[1],t[2],o,0);break;default:Ft(e,t,0,o,0)}return o}function Lt(e){for(var t=[],n=e;n.length;n=n[0])t.push(n.length);return t}var Rt={"[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},zt={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Bt={dynamic:35048,stream:35040,static:35044},Vt=jt.flatten,Ht=jt.shape,Ut=35044,Wt=35040,Gt=5121,Kt=5126,qt=[];qt[5120]=1,qt[5122]=2,qt[5124]=4,qt[5121]=1,qt[5123]=2,qt[5125]=4,qt[5126]=4;function Jt(e){return Rt[Object.prototype.toString.call(e)]|0}function Yt(e,t){for(var n=0;n<t.length;++n)e[n]=t[n]}function Xt(e,t,n,r,i,a,o){for(var s=0,c=0;c<n;++c)for(var l=0;l<r;++l)e[s++]=t[i*c+a*l+o]}function Zt(t,n,r,i){var a=0,o={};function s(e){this.id=a++,this.buffer=t.createBuffer(),this.type=e,this.usage=Ut,this.byteLength=0,this.dimension=1,this.dtype=Gt,this.persistentData=null,r.profile&&(this.stats={size:0})}s.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},s.prototype.destroy=function(){p(this)};var c=[];function l(e,t){var n=c.pop();return n||=new s(e),n.bind(),f(n,t,Wt,0,1,!1),n}function u(e){c.push(e)}function d(e,n,r){e.byteLength=n.byteLength,t.bufferData(e.type,n,r)}function f(t,n,r,i,a,o){var s;if(t.usage=r,Array.isArray(n)){if(t.dtype=i||Kt,n.length>0){var c;if(Array.isArray(n[0])){s=Ht(n);for(var l=1,u=1;u<s.length;++u)l*=s[u];t.dimension=l,c=Vt(n,s,t.dtype),d(t,c,r),o?t.persistentData=c:q.freeType(c)}else if(typeof n[0]==`number`){t.dimension=a;var f=q.allocType(t.dtype,n.length);Yt(f,n),d(t,f,r),o?t.persistentData=f:q.freeType(f)}else e(n[0])?(t.dimension=n[0].length,t.dtype=i||Jt(n[0])||Kt,c=Vt(n,[n.length,n[0].length],t.dtype),d(t,c,r),o?t.persistentData=c:q.freeType(c)):U.raise(`invalid buffer data`)}}else if(e(n))t.dtype=i||Jt(n),t.dimension=a,d(t,n,r),o&&(t.persistentData=new Uint8Array(new Uint8Array(n.buffer)));else if(At(n)){s=n.shape;var p=n.stride,m=n.offset,h=0,g=0,_=0,v=0;s.length===1?(h=s[0],g=1,_=p[0],v=0):s.length===2?(h=s[0],g=s[1],_=p[0],v=p[1]):U.raise(`invalid shape`),t.dtype=i||Jt(n.data)||Kt,t.dimension=g;var y=q.allocType(t.dtype,h*g);Xt(y,n.data,h,g,_,v,m),d(t,y,r),o?t.persistentData=y:q.freeType(y)}else n instanceof ArrayBuffer?(t.dtype=Gt,t.dimension=a,d(t,n,r),o&&(t.persistentData=new Uint8Array(new Uint8Array(n)))):U.raise(`invalid buffer data`)}function p(e){n.bufferCount--,i(e);var r=e.buffer;U(r,`buffer must not be deleted already`),t.deleteBuffer(r),e.buffer=null,delete o[e.id]}function m(i,a,c,l){n.bufferCount++;var u=new s(a);o[u.id]=u;function d(n){var i=Ut,a=null,o=0,s=0,c=1;return Array.isArray(n)||e(n)||At(n)||n instanceof ArrayBuffer?a=n:typeof n==`number`?o=n|0:n&&(U.type(n,`object`,`buffer arguments must be an object, a number or an array`),`data`in n&&(U(a===null||Array.isArray(a)||e(a)||At(a),`invalid data for buffer`),a=n.data),`usage`in n&&(U.parameter(n.usage,Bt,`invalid buffer usage`),i=Bt[n.usage]),`type`in n&&(U.parameter(n.type,zt,`invalid buffer type`),s=zt[n.type]),`dimension`in n&&(U.type(n.dimension,`number`,`invalid dimension`),c=n.dimension|0),`length`in n&&(U.nni(o,`buffer length must be a nonnegative integer`),o=n.length|0)),u.bind(),a?f(u,a,i,s,c,l):(o&&t.bufferData(u.type,o,i),u.dtype=s||Gt,u.usage=i,u.dimension=c,u.byteLength=o),r.profile&&(u.stats.size=u.byteLength*qt[u.dtype]),d}function m(e,n){U(n+e.byteLength<=u.byteLength,`invalid buffer subdata call, buffer is too small. Can't write data of size `+e.byteLength+` starting from offset `+n+` to a buffer of size `+u.byteLength),t.bufferSubData(u.type,n,e)}function h(t,n){var r=(n||0)|0,i;if(u.bind(),e(t)||t instanceof ArrayBuffer)m(t,r);else if(Array.isArray(t)){if(t.length>0){if(typeof t[0]==`number`){var a=q.allocType(u.dtype,t.length);Yt(a,t),m(a,r),q.freeType(a)}else if(Array.isArray(t[0])||e(t[0])){i=Ht(t);var o=Vt(t,i,u.dtype);m(o,r),q.freeType(o)}else U.raise(`invalid buffer data`)}}else if(At(t)){i=t.shape;var s=t.stride,c=0,l=0,f=0,p=0;i.length===1?(c=i[0],l=1,f=s[0],p=0):i.length===2?(c=i[0],l=i[1],f=s[0],p=s[1]):U.raise(`invalid shape`);var h=Array.isArray(t.data)?u.dtype:Jt(t.data),g=q.allocType(h,c*l);Xt(g,t.data,c,l,f,p,t.offset),m(g,r),q.freeType(g)}else U.raise(`invalid data for buffer subdata`);return d}return c||d(i),d._reglType=`buffer`,d._buffer=u,d.subdata=h,r.profile&&(d.stats=u.stats),d.destroy=function(){p(u)},d}function h(){J(o).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})}return r.profile&&(n.getTotalBufferSize=function(){var e=0;return Object.keys(o).forEach(function(t){e+=o[t].stats.size}),e}),{create:m,createStream:l,destroyStream:u,clear:function(){J(o).forEach(p),c.forEach(p)},getBuffer:function(e){return e&&e._buffer instanceof s?e._buffer:null},restore:h,_initBuffer:f}}var Qt={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},$t=0,en=1,tn=4,nn=5120,rn=5121,an=5122,on=5123,sn=5124,cn=5125,ln=34963,un=35040,dn=35044;function fn(t,n,r,i){var a={},o=0,s={uint8:rn,uint16:on};n.oes_element_index_uint&&(s.uint32=cn);function c(e){this.id=o++,a[this.id]=this,this.buffer=e,this.primType=tn,this.vertCount=0,this.type=0}c.prototype.bind=function(){this.buffer.bind()};var l=[];function u(e){var t=l.pop();return t||=new c(r.create(null,ln,!0,!1)._buffer),f(t,e,un,-1,-1,0,0),t}function d(e){l.push(e)}function f(i,a,o,s,c,l,u){i.buffer.bind();var d;if(a){var f=u;!u&&(!e(a)||At(a)&&!e(a.data))&&(f=n.oes_element_index_uint?cn:on),r._initBuffer(i.buffer,a,o,f,3)}else t.bufferData(ln,l,o),i.buffer.dtype=d||rn,i.buffer.usage=o,i.buffer.dimension=3,i.buffer.byteLength=l;if(d=u,!u){switch(i.buffer.dtype){case rn:case nn:d=rn;break;case on:case an:d=on;break;case cn:case sn:d=cn;break;default:U.raise(`unsupported type for element array`)}i.buffer.dtype=d}i.type=d,U(d!==cn||!!n.oes_element_index_uint,`32 bit element buffers not supported, enable oes_element_index_uint first`);var p=c;p<0&&(p=i.buffer.byteLength,d===on?p>>=1:d===cn&&(p>>=2)),i.vertCount=p;var m=s;if(s<0){m=tn;var h=i.buffer.dimension;h===1&&(m=$t),h===2&&(m=en),h===3&&(m=tn)}i.primType=m}function p(e){i.elementsCount--,U(e.buffer!==null,`must not double destroy elements`),delete a[e.id],e.buffer.destroy(),e.buffer=null}function m(t,n){var a=r.create(null,ln,!0),o=new c(a._buffer);i.elementsCount++;function l(t){if(!t)a(),o.primType=tn,o.vertCount=0,o.type=rn;else if(typeof t==`number`)a(t),o.primType=tn,o.vertCount=t|0,o.type=rn;else{var n=null,r=dn,i=-1,c=-1,u=0,d=0;Array.isArray(t)||e(t)||At(t)?n=t:(U.type(t,`object`,`invalid arguments for elements`),`data`in t&&(n=t.data,U(Array.isArray(n)||e(n)||At(n),`invalid data for element buffer`)),`usage`in t&&(U.parameter(t.usage,Bt,`invalid element buffer usage`),r=Bt[t.usage]),`primitive`in t&&(U.parameter(t.primitive,Qt,`invalid element buffer primitive`),i=Qt[t.primitive]),`count`in t&&(U(typeof t.count==`number`&&t.count>=0,`invalid vertex count for elements`),c=t.count|0),`type`in t&&(U.parameter(t.type,s,`invalid buffer type`),d=s[t.type]),`length`in t?u=t.length|0:(u=c,d===on||d===an?u*=2:(d===cn||d===sn)&&(u*=4))),f(o,n,r,i,c,u,d)}return l}return l(t),l._reglType=`elements`,l._elements=o,l.subdata=function(e,t){return a.subdata(e,t),l},l.destroy=function(){p(o)},l}return{create:m,createStream:u,destroyStream:d,getElements:function(e){return typeof e==`function`&&e._elements instanceof c?e._elements:null},clear:function(){J(a).forEach(p)}}}var pn=new Float32Array(1),mn=new Uint32Array(pn.buffer),hn=5123;function gn(e){for(var t=q.allocType(hn,e.length),n=0;n<e.length;++n)if(isNaN(e[n]))t[n]=65535;else if(e[n]===1/0)t[n]=31744;else if(e[n]===-1/0)t[n]=64512;else{pn[0]=e[n];var r=mn[0],i=r>>>31<<15,a=(r<<1>>>24)-127,o=r>>13&1023;if(a<-24)t[n]=i;else if(a<-14){var s=-14-a;t[n]=i+(o+1024>>s)}else a>15?t[n]=i+31744:t[n]=i+(a+15<<10)+o}return t}function Y(t){return Array.isArray(t)||e(t)}var _n=function(e){return!(e&e-1)&&!!e},vn=34467,yn=3553,bn=34067,xn=34069,Sn=6408,Cn=6406,wn=6407,Tn=6409,En=6410,Dn=32854,On=32855,kn=36194,An=32819,jn=32820,Mn=33635,Nn=34042,Pn=6402,Fn=34041,In=35904,Ln=35906,Rn=36193,zn=33776,Bn=33777,Vn=33778,Hn=33779,Un=35986,Wn=35987,Gn=34798,Kn=35840,qn=35841,Jn=35842,Yn=35843,Xn=36196,Zn=5121,Qn=5123,$n=5125,er=5126,tr=10242,nr=10243,rr=10497,ir=33071,ar=33648,or=10240,sr=10241,cr=9728,lr=9729,ur=9984,dr=9985,fr=9986,pr=9987,mr=33170,hr=4352,gr=4353,_r=4354,vr=34046,yr=3317,br=37440,xr=37441,Sr=37443,Cr=37444,wr=33984,Tr=[ur,fr,dr,pr],Er=[0,Tn,En,wn,Sn],Dr={};Dr[Tn]=Dr[Cn]=Dr[Pn]=1,Dr[Fn]=Dr[En]=2,Dr[wn]=Dr[In]=3,Dr[Sn]=Dr[Ln]=4;function Or(e){return`[object `+e+`]`}var kr=Or(`HTMLCanvasElement`),Ar=Or(`OffscreenCanvas`),jr=Or(`CanvasRenderingContext2D`),Mr=Or(`ImageBitmap`),Nr=Or(`HTMLImageElement`),Pr=Or(`HTMLVideoElement`),Fr=Object.keys(Rt).concat([kr,Ar,jr,Mr,Nr,Pr]),Ir=[];Ir[Zn]=1,Ir[er]=4,Ir[Rn]=2,Ir[Qn]=2,Ir[$n]=4;var X=[];X[Dn]=2,X[On]=2,X[kn]=2,X[Fn]=4,X[zn]=.5,X[Bn]=.5,X[Vn]=1,X[Hn]=1,X[Un]=.5,X[Wn]=1,X[Gn]=1,X[Kn]=.5,X[qn]=.25,X[Jn]=.5,X[Yn]=.25,X[Xn]=.5;function Lr(e){return Array.isArray(e)&&(e.length===0||typeof e[0]==`number`)}function Rr(e){return!(!Array.isArray(e)||e.length===0||!Y(e[0]))}function zr(e){return Object.prototype.toString.call(e)}function Br(e){return zr(e)===kr}function Vr(e){return zr(e)===Ar}function Hr(e){return zr(e)===jr}function Ur(e){return zr(e)===Mr}function Wr(e){return zr(e)===Nr}function Gr(e){return zr(e)===Pr}function Kr(e){if(!e)return!1;var t=zr(e);return Fr.indexOf(t)>=0||Lr(e)||Rr(e)||At(e)}function qr(e){return Rt[Object.prototype.toString.call(e)]|0}function Jr(e,t){var n=t.length;switch(e.type){case Zn:case Qn:case $n:case er:var r=q.allocType(e.type,n);r.set(t),e.data=r;break;case Rn:e.data=gn(t);break;default:U.raise(`unsupported texture type, must specify a typed array`)}}function Yr(e,t){return q.allocType(e.type===Rn?er:e.type,t)}function Xr(e,t){e.type===Rn?(e.data=gn(t),q.freeType(t)):e.data=t}function Zr(e,t,n,r,i,a){for(var o=e.width,s=e.height,c=e.channels,l=Yr(e,o*s*c),u=0,d=0;d<s;++d)for(var f=0;f<o;++f)for(var p=0;p<c;++p)l[u++]=t[n*f+r*d+i*p+a];Xr(e,l)}function Qr(e,t,n,r,i,a){var o=X[e]===void 0?Dr[e]*Ir[t]:X[e];if(a&&(o*=6),i){for(var s=0,c=n;c>=1;)s+=o*c*c,c/=2;return s}return o*n*r}function $r(n,r,i,a,o,s,c){var l={"don't care":hr,"dont care":hr,nice:_r,fast:gr},u={repeat:rr,clamp:ir,mirror:ar},d={nearest:cr,linear:lr},f=t({mipmap:pr,"nearest mipmap nearest":ur,"linear mipmap nearest":dr,"nearest mipmap linear":fr,"linear mipmap linear":pr},d),p={none:0,browser:Cr},m={uint8:Zn,rgba4:An,rgb565:Mn,"rgb5 a1":jn},h={alpha:Cn,luminance:Tn,"luminance alpha":En,rgb:wn,rgba:Sn,rgba4:Dn,"rgb5 a1":On,rgb565:kn},g={};r.ext_srgb&&(h.srgb=In,h.srgba=Ln),r.oes_texture_float&&(m.float32=m.float=er),r.oes_texture_half_float&&(m.float16=m[`half float`]=Rn),r.webgl_depth_texture&&(t(h,{depth:Pn,"depth stencil":Fn}),t(m,{uint16:Qn,uint32:$n,"depth stencil":Nn})),r.webgl_compressed_texture_s3tc&&t(g,{"rgb s3tc dxt1":zn,"rgba s3tc dxt1":Bn,"rgba s3tc dxt3":Vn,"rgba s3tc dxt5":Hn}),r.webgl_compressed_texture_atc&&t(g,{"rgb atc":Un,"rgba atc explicit alpha":Wn,"rgba atc interpolated alpha":Gn}),r.webgl_compressed_texture_pvrtc&&t(g,{"rgb pvrtc 4bppv1":Kn,"rgb pvrtc 2bppv1":qn,"rgba pvrtc 4bppv1":Jn,"rgba pvrtc 2bppv1":Yn}),r.webgl_compressed_texture_etc1&&(g[`rgb etc1`]=Xn);var _=Array.prototype.slice.call(n.getParameter(vn));Object.keys(g).forEach(function(e){var t=g[e];_.indexOf(t)>=0&&(h[e]=t)});var v=Object.keys(h);i.textureFormats=v;var y=[];Object.keys(h).forEach(function(e){var t=h[e];y[t]=e});var b=[];Object.keys(m).forEach(function(e){var t=m[e];b[t]=e});var x=[];Object.keys(d).forEach(function(e){var t=d[e];x[t]=e});var S=[];Object.keys(f).forEach(function(e){var t=f[e];S[t]=e});var C=[];Object.keys(u).forEach(function(e){var t=u[e];C[t]=e});var w=v.reduce(function(e,t){var n=h[t];return e[n]=n===Tn||n===Cn||n===Tn||n===En||n===Pn||n===Fn||r.ext_srgb&&(n===In||n===Ln)?n:n===On||t.indexOf(`rgba`)>=0?Sn:wn,e},{});function T(){this.internalformat=Sn,this.format=Sn,this.type=Zn,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=Cr,this.width=0,this.height=0,this.channels=0}function E(e,t){e.internalformat=t.internalformat,e.format=t.format,e.type=t.type,e.compressed=t.compressed,e.premultiplyAlpha=t.premultiplyAlpha,e.flipY=t.flipY,e.unpackAlignment=t.unpackAlignment,e.colorSpace=t.colorSpace,e.width=t.width,e.height=t.height,e.channels=t.channels}function D(e,t){if(typeof t==`object`&&t){if(`premultiplyAlpha`in t&&(U.type(t.premultiplyAlpha,`boolean`,`invalid premultiplyAlpha`),e.premultiplyAlpha=t.premultiplyAlpha),`flipY`in t&&(U.type(t.flipY,`boolean`,`invalid texture flip`),e.flipY=t.flipY),`alignment`in t&&(U.oneOf(t.alignment,[1,2,4,8],`invalid texture unpack alignment`),e.unpackAlignment=t.alignment),`colorSpace`in t&&(U.parameter(t.colorSpace,p,`invalid colorSpace`),e.colorSpace=p[t.colorSpace]),`type`in t){var n=t.type;U(r.oes_texture_float||n!==`float`&&n!==`float32`,`you must enable the OES_texture_float extension in order to use floating point textures.`),U(r.oes_texture_half_float||n!==`half float`&&n!==`float16`,`you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures.`),U(r.webgl_depth_texture||n!==`uint16`&&n!==`uint32`&&n!==`depth stencil`,`you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures.`),U.parameter(n,m,`invalid texture type`),e.type=m[n]}var a=e.width,o=e.height,s=e.channels,c=!1;`shape`in t?(U(Array.isArray(t.shape)&&t.shape.length>=2,`shape must be an array`),a=t.shape[0],o=t.shape[1],t.shape.length===3&&(s=t.shape[2],U(s>0&&s<=4,`invalid number of channels`),c=!0),U(a>=0&&a<=i.maxTextureSize,`invalid width`),U(o>=0&&o<=i.maxTextureSize,`invalid height`)):(`radius`in t&&(a=o=t.radius,U(a>=0&&a<=i.maxTextureSize,`invalid radius`)),`width`in t&&(a=t.width,U(a>=0&&a<=i.maxTextureSize,`invalid width`)),`height`in t&&(o=t.height,U(o>=0&&o<=i.maxTextureSize,`invalid height`)),`channels`in t&&(s=t.channels,U(s>0&&s<=4,`invalid number of channels`),c=!0)),e.width=a|0,e.height=o|0,e.channels=s|0;var l=!1;if(`format`in t){var u=t.format;U(r.webgl_depth_texture||u!==`depth`&&u!==`depth stencil`,`you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures.`),U.parameter(u,h,`invalid texture format`),e.format=w[e.internalformat=h[u]],u in m&&(`type`in t||(e.type=m[u])),u in g&&(e.compressed=!0),l=!0}!c&&l?e.channels=Dr[e.format]:c&&!l?e.channels!==Er[e.format]&&(e.format=e.internalformat=Er[e.channels]):l&&c&&U(e.channels===Dr[e.format],`number of channels inconsistent with specified format`)}}function O(e){n.pixelStorei(br,e.flipY),n.pixelStorei(xr,e.premultiplyAlpha),n.pixelStorei(Sr,e.colorSpace),n.pixelStorei(yr,e.unpackAlignment)}function k(){T.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function A(t,n){var r=null;if(Kr(n)?r=n:n&&(U.type(n,`object`,`invalid pixel data type`),D(t,n),`x`in n&&(t.xOffset=n.x|0),`y`in n&&(t.yOffset=n.y|0),Kr(n.data)&&(r=n.data)),U(!t.compressed||r instanceof Uint8Array,`compressed texture data must be stored in a uint8array`),n.copy){U(!r,`can not specify copy and data field for the same texture`);var a=o.viewportWidth,s=o.viewportHeight;t.width=t.width||a-t.xOffset,t.height=t.height||s-t.yOffset,t.needsCopy=!0,U(t.xOffset>=0&&t.xOffset<a&&t.yOffset>=0&&t.yOffset<s&&t.width>0&&t.width<=a&&t.height>0&&t.height<=s,`copy texture read out of bounds`)}else if(!r)t.width=t.width||1,t.height=t.height||1,t.channels=t.channels||4;else if(e(r))t.channels=t.channels||4,t.data=r,!(`type`in n)&&t.type===Zn&&(t.type=qr(r));else if(Lr(r))t.channels=t.channels||4,Jr(t,r),t.alignment=1,t.needsFree=!0;else if(At(r)){var c=r.data;!Array.isArray(c)&&t.type===Zn&&(t.type=qr(c));var l=r.shape,u=r.stride,d,f,p,m,h,g;l.length===3?(p=l[2],g=u[2]):(U(l.length===2,`invalid ndarray pixel data, must be 2 or 3D`),p=1,g=1),d=l[0],f=l[1],m=u[0],h=u[1],t.alignment=1,t.width=d,t.height=f,t.channels=p,t.format=t.internalformat=Er[p],t.needsFree=!0,Zr(t,c,m,h,g,r.offset)}else if(Br(r)||Vr(r)||Hr(r))t.element=Br(r)||Vr(r)?r:r.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(Ur(r))t.element=r,t.width=r.width,t.height=r.height,t.channels=4;else if(Wr(r))t.element=r,t.width=r.naturalWidth,t.height=r.naturalHeight,t.channels=4;else if(Gr(r))t.element=r,t.width=r.videoWidth,t.height=r.videoHeight,t.channels=4;else if(Rr(r)){var _=t.width||r[0].length,v=t.height||r.length,y=t.channels;Y(r[0][0])?y||=r[0][0].length:y||=1;for(var b=jt.shape(r),x=1,S=0;S<b.length;++S)x*=b[S];var C=Yr(t,x);jt.flatten(r,b,``,C),Xr(t,C),t.alignment=1,t.width=_,t.height=v,t.channels=y,t.format=t.internalformat=Er[y],t.needsFree=!0}t.type===er?U(i.extensions.indexOf(`oes_texture_float`)>=0,`oes_texture_float extension not enabled`):t.type===Rn&&U(i.extensions.indexOf(`oes_texture_half_float`)>=0,`oes_texture_half_float extension not enabled`)}function ee(e,t,r){var i=e.element,o=e.data,s=e.internalformat,c=e.format,l=e.type,u=e.width,d=e.height;O(e),i?n.texImage2D(t,r,c,c,l,i):e.compressed?n.compressedTexImage2D(t,r,s,u,d,0,o):e.needsCopy?(a(),n.copyTexImage2D(t,r,c,e.xOffset,e.yOffset,u,d,0)):n.texImage2D(t,r,c,u,d,0,c,l,o||null)}function j(e,t,r,i,o){var s=e.element,c=e.data,l=e.internalformat,u=e.format,d=e.type,f=e.width,p=e.height;O(e),s?n.texSubImage2D(t,o,r,i,u,d,s):e.compressed?n.compressedTexSubImage2D(t,o,r,i,l,f,p,c):e.needsCopy?(a(),n.copyTexSubImage2D(t,o,r,i,e.xOffset,e.yOffset,f,p)):n.texSubImage2D(t,o,r,i,f,p,u,d,c)}var M=[];function N(){return M.pop()||new k}function P(e){e.needsFree&&q.freeType(e.data),k.call(e),M.push(e)}function F(){T.call(this),this.genMipmaps=!1,this.mipmapHint=hr,this.mipmask=0,this.images=Array(16)}function te(e,t,n){var r=e.images[0]=N();e.mipmask=1,r.width=e.width=t,r.height=e.height=n,r.channels=e.channels=4}function I(e,t){var n=null;if(Kr(t))n=e.images[0]=N(),E(n,e),A(n,t),e.mipmask=1;else if(D(e,t),Array.isArray(t.mipmap))for(var r=t.mipmap,i=0;i<r.length;++i)n=e.images[i]=N(),E(n,e),n.width>>=i,n.height>>=i,A(n,r[i]),e.mipmask|=1<<i;else n=e.images[0]=N(),E(n,e),A(n,t),e.mipmask=1;E(e,e.images[0]),e.compressed&&(e.internalformat===zn||e.internalformat===Bn||e.internalformat===Vn||e.internalformat===Hn)&&U(e.width%4==0&&e.height%4==0,`for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4`)}function ne(e,t){for(var n=e.images,r=0;r<n.length;++r){if(!n[r])return;ee(n[r],t,r)}}var re=[];function ie(){var e=re.pop()||new F;T.call(e),e.mipmask=0;for(var t=0;t<16;++t)e.images[t]=null;return e}function ae(e){for(var t=e.images,n=0;n<t.length;++n)t[n]&&P(t[n]),t[n]=null;re.push(e)}function oe(){this.minFilter=cr,this.magFilter=cr,this.wrapS=ir,this.wrapT=ir,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=hr}function se(e,t){if(`min`in t){var n=t.min;U.parameter(n,f),e.minFilter=f[n],Tr.indexOf(e.minFilter)>=0&&!(`faces`in t)&&(e.genMipmaps=!0)}if(`mag`in t){var r=t.mag;U.parameter(r,d),e.magFilter=d[r]}var a=e.wrapS,o=e.wrapT;if(`wrap`in t){var s=t.wrap;typeof s==`string`?(U.parameter(s,u),a=o=u[s]):Array.isArray(s)&&(U.parameter(s[0],u),U.parameter(s[1],u),a=u[s[0]],o=u[s[1]])}else{if(`wrapS`in t){var c=t.wrapS;U.parameter(c,u),a=u[c]}if(`wrapT`in t){var p=t.wrapT;U.parameter(p,u),o=u[p]}}if(e.wrapS=a,e.wrapT=o,`anisotropic`in t){var m=t.anisotropic;U(typeof m==`number`&&m>=1&&m<=i.maxAnisotropic,`aniso samples must be between 1 and `),e.anisotropic=t.anisotropic}if(`mipmap`in t){var h=!1;switch(typeof t.mipmap){case`string`:U.parameter(t.mipmap,l,`invalid mipmap hint`),e.mipmapHint=l[t.mipmap],e.genMipmaps=!0,h=!0;break;case`boolean`:h=e.genMipmaps=t.mipmap;break;case`object`:U(Array.isArray(t.mipmap),`invalid mipmap type`),e.genMipmaps=!1,h=!0;break;default:U.raise(`invalid mipmap type`)}h&&!(`min`in t)&&(e.minFilter=ur)}}function L(e,t){n.texParameteri(t,sr,e.minFilter),n.texParameteri(t,or,e.magFilter),n.texParameteri(t,tr,e.wrapS),n.texParameteri(t,nr,e.wrapT),r.ext_texture_filter_anisotropic&&n.texParameteri(t,vr,e.anisotropic),e.genMipmaps&&(n.hint(mr,e.mipmapHint),n.generateMipmap(t))}var ce=0,R={},z=i.maxTextureUnits,B=Array(z).map(function(){return null});function le(e){T.call(this),this.mipmask=0,this.internalformat=Sn,this.id=ce++,this.refCount=1,this.target=e,this.texture=n.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new oe,c.profile&&(this.stats={size:0})}function V(e){n.activeTexture(wr),n.bindTexture(e.target,e.texture)}function H(){var e=B[0];e?n.bindTexture(e.target,e.texture):n.bindTexture(yn,null)}function ue(e){var t=e.texture;U(t,`must not double destroy texture`);var r=e.unit,i=e.target;r>=0&&(n.activeTexture(wr+r),n.bindTexture(i,null),B[r]=null),n.deleteTexture(t),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete R[e.id],s.textureCount--}t(le.prototype,{bind:function(){var e=this;e.bindCount+=1;var t=e.unit;if(t<0){for(var r=0;r<z;++r){var i=B[r];if(i){if(i.bindCount>0)continue;i.unit=-1}B[r]=e,t=r;break}t>=z&&U.raise(`insufficient number of texture units`),c.profile&&s.maxTextureUnits<t+1&&(s.maxTextureUnits=t+1),e.unit=t,n.activeTexture(wr+t),n.bindTexture(e.target,e.texture)}return t},unbind:function(){--this.bindCount},decRef:function(){--this.refCount<=0&&ue(this)}});function de(e,t){var r=new le(yn);R[r.id]=r,s.textureCount++;function a(e,t){var n=r.texInfo;oe.call(n);var o=ie();return typeof e==`number`?typeof t==`number`?te(o,e|0,t|0):te(o,e|0,e|0):e?(U.type(e,`object`,`invalid arguments to regl.texture`),se(n,e),I(o,e)):te(o,1,1),n.genMipmaps&&(o.mipmask=(o.width<<1)-1),r.mipmask=o.mipmask,E(r,o),U.texture2D(n,o,i),r.internalformat=o.internalformat,a.width=o.width,a.height=o.height,V(r),ne(o,yn),L(n,yn),H(),ae(o),c.profile&&(r.stats.size=Qr(r.internalformat,r.type,o.width,o.height,n.genMipmaps,!1)),a.format=y[r.internalformat],a.type=b[r.type],a.mag=x[n.magFilter],a.min=S[n.minFilter],a.wrapS=C[n.wrapS],a.wrapT=C[n.wrapT],a}function o(e,t,n,i){U(!!e,`must specify image data`);var o=t|0,s=n|0,c=i|0,l=N();return E(l,r),l.width=0,l.height=0,A(l,e),l.width=l.width||(r.width>>c)-o,l.height=l.height||(r.height>>c)-s,U(r.type===l.type&&r.format===l.format&&r.internalformat===l.internalformat,`incompatible format for texture.subimage`),U(o>=0&&s>=0&&o+l.width<=r.width&&s+l.height<=r.height,`texture.subimage write out of bounds`),U(r.mipmask&1<<c,`missing mipmap data`),U(l.data||l.element||l.needsCopy,`missing image data`),V(r),j(l,yn,o,s,c),H(),P(l),a}function l(e,t){var i=e|0,o=t|0||i;if(i===r.width&&o===r.height)return a;a.width=r.width=i,a.height=r.height=o,V(r);for(var s=0;r.mipmask>>s;++s){var l=i>>s,u=o>>s;if(!l||!u)break;n.texImage2D(yn,s,r.format,l,u,0,r.format,r.type,null)}return H(),c.profile&&(r.stats.size=Qr(r.internalformat,r.type,i,o,!1,!1)),a}return a(e,t),a.subimage=o,a.resize=l,a._reglType=`texture2d`,a._texture=r,c.profile&&(a.stats=r.stats),a.destroy=function(){r.decRef()},a}function fe(e,t,r,a,o,l){var u=new le(bn);R[u.id]=u,s.cubeCount++;var d=[,,,,,,];function f(e,t,n,r,a,o){var s,l=u.texInfo;for(oe.call(l),s=0;s<6;++s)d[s]=ie();if(typeof e==`number`||!e){var p=e|0||1;for(s=0;s<6;++s)te(d[s],p,p)}else if(typeof e==`object`){if(t)I(d[0],e),I(d[1],t),I(d[2],n),I(d[3],r),I(d[4],a),I(d[5],o);else if(se(l,e),D(u,e),`faces`in e){var m=e.faces;for(U(Array.isArray(m)&&m.length===6,`cube faces must be a length 6 array`),s=0;s<6;++s)U(typeof m[s]==`object`&&!!m[s],`invalid input for cube map face`),E(d[s],u),I(d[s],m[s])}else for(s=0;s<6;++s)I(d[s],e)}else U.raise(`invalid arguments to cube map`);for(E(u,d[0]),U.optional(function(){i.npotTextureCube||U(_n(u.width)&&_n(u.height),`your browser does not support non power or two texture dimensions`)}),u.mipmask=l.genMipmaps?(d[0].width<<1)-1:d[0].mipmask,U.textureCube(u,l,d,i),u.internalformat=d[0].internalformat,f.width=d[0].width,f.height=d[0].height,V(u),s=0;s<6;++s)ne(d[s],xn+s);for(L(l,bn),H(),c.profile&&(u.stats.size=Qr(u.internalformat,u.type,f.width,f.height,l.genMipmaps,!0)),f.format=y[u.internalformat],f.type=b[u.type],f.mag=x[l.magFilter],f.min=S[l.minFilter],f.wrapS=C[l.wrapS],f.wrapT=C[l.wrapT],s=0;s<6;++s)ae(d[s]);return f}function p(e,t,n,r,i){U(!!t,`must specify image data`),U(typeof e==`number`&&e===(e|0)&&e>=0&&e<6,`invalid face`);var a=n|0,o=r|0,s=i|0,c=N();return E(c,u),c.width=0,c.height=0,A(c,t),c.width=c.width||(u.width>>s)-a,c.height=c.height||(u.height>>s)-o,U(u.type===c.type&&u.format===c.format&&u.internalformat===c.internalformat,`incompatible format for texture.subimage`),U(a>=0&&o>=0&&a+c.width<=u.width&&o+c.height<=u.height,`texture.subimage write out of bounds`),U(u.mipmask&1<<s,`missing mipmap data`),U(c.data||c.element||c.needsCopy,`missing image data`),V(u),j(c,xn+e,a,o,s),H(),P(c),f}function m(e){var t=e|0;if(t!==u.width){f.width=u.width=t,f.height=u.height=t,V(u);for(var r=0;r<6;++r)for(var i=0;u.mipmask>>i;++i)n.texImage2D(xn+r,i,u.format,t>>i,t>>i,0,u.format,u.type,null);return H(),c.profile&&(u.stats.size=Qr(u.internalformat,u.type,f.width,f.height,!1,!0)),f}}return f(e,t,r,a,o,l),f.subimage=p,f.resize=m,f._reglType=`textureCube`,f._texture=u,c.profile&&(f.stats=u.stats),f.destroy=function(){u.decRef()},f}function pe(){for(var e=0;e<z;++e)n.activeTexture(wr+e),n.bindTexture(yn,null),B[e]=null;J(R).forEach(ue),s.cubeCount=0,s.textureCount=0}c.profile&&(s.getTotalTextureSize=function(){var e=0;return Object.keys(R).forEach(function(t){e+=R[t].stats.size}),e});function me(){for(var e=0;e<z;++e){var t=B[e];t&&(t.bindCount=0,t.unit=-1,B[e]=null)}J(R).forEach(function(e){e.texture=n.createTexture(),n.bindTexture(e.target,e.texture);for(var t=0;t<32;++t)if(e.mipmask&1<<t){if(e.target===yn)n.texImage2D(yn,t,e.internalformat,e.width>>t,e.height>>t,0,e.internalformat,e.type,null);else for(var r=0;r<6;++r)n.texImage2D(xn+r,t,e.internalformat,e.width>>t,e.height>>t,0,e.internalformat,e.type,null)}L(e.texInfo,e.target)})}function he(){for(var e=0;e<z;++e){var t=B[e];t&&(t.bindCount=0,t.unit=-1,B[e]=null),n.activeTexture(wr+e),n.bindTexture(yn,null),n.bindTexture(bn,null)}}return{create2D:de,createCube:fe,clear:pe,getTexture:function(e){return null},restore:me,refresh:he}}var ei=36161,ti=32854,ni=32855,ri=36194,ii=33189,ai=36168,oi=34041,si=35907,ci=34836,li=34842,ui=34843,di=[];di[ti]=2,di[ni]=2,di[ri]=2,di[ii]=2,di[ai]=1,di[oi]=4,di[si]=4,di[ci]=16,di[li]=8,di[ui]=6;function fi(e,t,n){return di[e]*t*n}var pi=function(e,t,n,r,i){var a={rgba4:ti,rgb565:ri,"rgb5 a1":ni,depth:ii,stencil:ai,"depth stencil":oi};t.ext_srgb&&(a.srgba=si),t.ext_color_buffer_half_float&&(a.rgba16f=li,a.rgb16f=ui),t.webgl_color_buffer_float&&(a.rgba32f=ci);var o=[];Object.keys(a).forEach(function(e){var t=a[e];o[t]=e});var s=0,c={};function l(e){this.id=s++,this.refCount=1,this.renderbuffer=e,this.format=ti,this.width=0,this.height=0,i.profile&&(this.stats={size:0})}l.prototype.decRef=function(){--this.refCount<=0&&u(this)};function u(t){var n=t.renderbuffer;U(n,`must not double destroy renderbuffer`),e.bindRenderbuffer(ei,null),e.deleteRenderbuffer(n),t.renderbuffer=null,t.refCount=0,delete c[t.id],r.renderbufferCount--}function d(t,s){var u=new l(e.createRenderbuffer());c[u.id]=u,r.renderbufferCount++;function d(t,r){var s=0,c=0,l=ti;if(typeof t==`object`&&t){var f=t;if(`shape`in f){var p=f.shape;U(Array.isArray(p)&&p.length>=2,`invalid renderbuffer shape`),s=p[0]|0,c=p[1]|0}else`radius`in f&&(s=c=f.radius|0),`width`in f&&(s=f.width|0),`height`in f&&(c=f.height|0);`format`in f&&(U.parameter(f.format,a,`invalid renderbuffer format`),l=a[f.format])}else typeof t==`number`?(s=t|0,c=typeof r==`number`?r|0:s):t?U.raise(`invalid arguments to renderbuffer constructor`):s=c=1;if(U(s>0&&c>0&&s<=n.maxRenderbufferSize&&c<=n.maxRenderbufferSize,`invalid renderbuffer size`),s!==u.width||c!==u.height||l!==u.format)return d.width=u.width=s,d.height=u.height=c,u.format=l,e.bindRenderbuffer(ei,u.renderbuffer),e.renderbufferStorage(ei,l,s,c),U(e.getError()===0,`invalid render buffer format`),i.profile&&(u.stats.size=fi(u.format,u.width,u.height)),d.format=o[u.format],d}function f(t,r){var a=t|0,o=r|0||a;return a===u.width&&o===u.height||(U(a>0&&o>0&&a<=n.maxRenderbufferSize&&o<=n.maxRenderbufferSize,`invalid renderbuffer size`),d.width=u.width=a,d.height=u.height=o,e.bindRenderbuffer(ei,u.renderbuffer),e.renderbufferStorage(ei,u.format,a,o),U(e.getError()===0,`invalid render buffer format`),i.profile&&(u.stats.size=fi(u.format,u.width,u.height))),d}return d(t,s),d.resize=f,d._reglType=`renderbuffer`,d._renderbuffer=u,i.profile&&(d.stats=u.stats),d.destroy=function(){u.decRef()},d}i.profile&&(r.getTotalRenderbufferSize=function(){var e=0;return Object.keys(c).forEach(function(t){e+=c[t].stats.size}),e});function f(){J(c).forEach(function(t){t.renderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(ei,t.renderbuffer),e.renderbufferStorage(ei,t.format,t.width,t.height)}),e.bindRenderbuffer(ei,null)}return{create:d,clear:function(){J(c).forEach(u)},restore:f}},mi=36160,hi=36161,gi=3553,_i=34069,vi=36064,yi=36096,bi=36128,xi=33306,Si=36053,Ci=36054,wi=36055,Ti=36057,Ei=36061,Di=36193,Oi=5121,ki=5126,Ai=6407,ji=6408,Mi=6402,Ni=[Ai,ji],Pi=[];Pi[ji]=4,Pi[Ai]=3;var Fi=[];Fi[Oi]=1,Fi[ki]=4,Fi[Di]=2;var Ii=32854,Li=32855,Ri=36194,zi=33189,Bi=36168,Vi=34041,Hi=[Ii,Li,Ri,35907,34842,34843,34836],Ui={};Ui[Si]=`complete`,Ui[Ci]=`incomplete attachment`,Ui[Ti]=`incomplete dimensions`,Ui[wi]=`incomplete, missing attachment`,Ui[Ei]=`unsupported`;function Wi(e,n,r,i,a,o){var s={cur:null,next:null,dirty:!1,setFBO:null},c=[`rgba`],l=[`rgba4`,`rgb565`,`rgb5 a1`];n.ext_srgb&&l.push(`srgba`),n.ext_color_buffer_half_float&&l.push(`rgba16f`,`rgb16f`),n.webgl_color_buffer_float&&l.push(`rgba32f`);var u=[`uint8`];n.oes_texture_half_float&&u.push(`half float`,`float16`),n.oes_texture_float&&u.push(`float`,`float32`);function d(e,t,n){this.target=e,this.texture=t,this.renderbuffer=n;var r=0,i=0;t?(r=t.width,i=t.height):n&&(r=n.width,i=n.height),this.width=r,this.height=i}function f(e){e&&(e.texture&&e.texture._texture.decRef(),e.renderbuffer&&e.renderbuffer._renderbuffer.decRef())}function p(e,t,n){if(e){if(e.texture){var r=e.texture._texture,i=Math.max(1,r.width),a=Math.max(1,r.height);U(i===t&&a===n,`inconsistent width/height for supplied texture`),r.refCount+=1}else{var o=e.renderbuffer._renderbuffer;U(o.width===t&&o.height===n,`inconsistent width/height for renderbuffer`),o.refCount+=1}}}function m(t,n){n&&(n.texture?e.framebufferTexture2D(mi,t,n.target,n.texture._texture.texture,0):e.framebufferRenderbuffer(mi,t,hi,n.renderbuffer._renderbuffer.renderbuffer))}function h(e){var t=gi,n=null,r=null,i=e;typeof e==`object`&&(i=e.data,`target`in e&&(t=e.target|0)),U.type(i,`function`,`invalid attachment data`);var a=i._reglType;return a===`texture2d`?(n=i,U(t===gi)):a===`textureCube`?(n=i,U(t>=_i&&t<_i+6,`invalid cube map target`)):a===`renderbuffer`?(r=i,t=hi):U.raise(`invalid regl object for attachment`),new d(t,n,r)}function g(e,t,n,r,o){if(n){var s=i.create2D({width:e,height:t,format:r,type:o});return s._texture.refCount=0,new d(gi,s,null)}var c=a.create({width:e,height:t,format:r});return c._renderbuffer.refCount=0,new d(hi,null,c)}function _(e){return e&&(e.texture||e.renderbuffer)}function v(e,t,n){e&&(e.texture?e.texture.resize(t,n):e.renderbuffer&&e.renderbuffer.resize(t,n),e.width=t,e.height=n)}var y=0,b={};function x(){this.id=y++,b[this.id]=this,this.framebuffer=e.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function S(e){e.colorAttachments.forEach(f),f(e.depthAttachment),f(e.stencilAttachment),f(e.depthStencilAttachment)}function C(t){var n=t.framebuffer;U(n,`must not double destroy framebuffer`),e.deleteFramebuffer(n),t.framebuffer=null,o.framebufferCount--,delete b[t.id]}function w(t){var n;e.bindFramebuffer(mi,t.framebuffer);var i=t.colorAttachments;for(n=0;n<i.length;++n)m(vi+n,i[n]);for(n=i.length;n<r.maxColorAttachments;++n)e.framebufferTexture2D(mi,vi+n,gi,null,0);e.framebufferTexture2D(mi,xi,gi,null,0),e.framebufferTexture2D(mi,yi,gi,null,0),e.framebufferTexture2D(mi,bi,gi,null,0),m(yi,t.depthAttachment),m(bi,t.stencilAttachment),m(xi,t.depthStencilAttachment);var a=e.checkFramebufferStatus(mi);!e.isContextLost()&&a!==Si&&U.raise(`framebuffer configuration not supported, status = `+Ui[a]),e.bindFramebuffer(mi,s.next?s.next.framebuffer:null),s.cur=s.next,e.getError()}function T(e,i){var a=new x;o.framebufferCount++;function d(e,t){var i;U(s.next!==a,`can not update framebuffer which is currently in use`);var o=0,f=0,m=!0,v=!0,y=null,b=!0,x=`rgba`,C=`uint8`,T=1,E=null,D=null,O=null,k=!1;if(typeof e==`number`)o=e|0,f=t|0||o;else if(!e)o=f=1;else{U.type(e,`object`,`invalid arguments for framebuffer`);var A=e;if(`shape`in A){var ee=A.shape;U(Array.isArray(ee)&&ee.length>=2,`invalid shape for framebuffer`),o=ee[0],f=ee[1]}else`radius`in A&&(o=f=A.radius),`width`in A&&(o=A.width),`height`in A&&(f=A.height);(`color`in A||`colors`in A)&&(y=A.color||A.colors,Array.isArray(y)&&U(y.length===1||n.webgl_draw_buffers,`multiple render targets not supported`)),y||(`colorCount`in A&&(T=A.colorCount|0,U(T>0,`invalid color buffer count`)),`colorTexture`in A&&(b=!!A.colorTexture,x=`rgba4`),`colorType`in A&&(C=A.colorType,b?(U(n.oes_texture_float||C!==`float`&&C!==`float32`,`you must enable OES_texture_float in order to use floating point framebuffer objects`),U(n.oes_texture_half_float||C!==`half float`&&C!==`float16`,`you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects`)):C===`half float`||C===`float16`?(U(n.ext_color_buffer_half_float,`you must enable EXT_color_buffer_half_float to use 16-bit render buffers`),x=`rgba16f`):(C===`float`||C===`float32`)&&(U(n.webgl_color_buffer_float,`you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers`),x=`rgba32f`),U.oneOf(C,u,`invalid color type`)),`colorFormat`in A&&(x=A.colorFormat,c.indexOf(x)>=0?b=!0:l.indexOf(x)>=0?b=!1:U.optional(function(){b?U.oneOf(A.colorFormat,c,`invalid color format for texture`):U.oneOf(A.colorFormat,l,`invalid color format for renderbuffer`)}))),(`depthTexture`in A||`depthStencilTexture`in A)&&(k=!!(A.depthTexture||A.depthStencilTexture),U(!k||n.webgl_depth_texture,`webgl_depth_texture extension not supported`)),`depth`in A&&(typeof A.depth==`boolean`?m=A.depth:(E=A.depth,v=!1)),`stencil`in A&&(typeof A.stencil==`boolean`?v=A.stencil:(D=A.stencil,m=!1)),`depthStencil`in A&&(typeof A.depthStencil==`boolean`?m=v=A.depthStencil:(O=A.depthStencil,m=!1,v=!1))}var j=null,M=null,N=null,P=null;if(Array.isArray(y))j=y.map(h);else if(y)j=[h(y)];else for(j=Array(T),i=0;i<T;++i)j[i]=g(o,f,b,x,C);U(n.webgl_draw_buffers||j.length<=1,`you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers.`),U(j.length<=r.maxColorAttachments,`too many color attachments, not supported`),o||=j[0].width,f||=j[0].height,E?M=h(E):m&&!v&&(M=g(o,f,k,`depth`,`uint32`)),D?N=h(D):v&&!m&&(N=g(o,f,!1,`stencil`,`uint8`)),O?P=h(O):!E&&!D&&v&&m&&(P=g(o,f,k,`depth stencil`,`depth stencil`)),U(!!E+!!D+!!O<=1,`invalid framebuffer configuration, can specify exactly one depth/stencil attachment`);var F=null;for(i=0;i<j.length;++i)if(p(j[i],o,f),U(!j[i]||j[i].texture&&Ni.indexOf(j[i].texture._texture.format)>=0||j[i].renderbuffer&&Hi.indexOf(j[i].renderbuffer._renderbuffer.format)>=0,`framebuffer color attachment `+i+` is invalid`),j[i]&&j[i].texture){var te=Pi[j[i].texture._texture.format]*Fi[j[i].texture._texture.type];F===null?F=te:U(F===te,`all color attachments much have the same number of bits per pixel.`)}return p(M,o,f),U(!M||M.texture&&M.texture._texture.format===Mi||M.renderbuffer&&M.renderbuffer._renderbuffer.format===zi,`invalid depth attachment for framebuffer object`),p(N,o,f),U(!N||N.renderbuffer&&N.renderbuffer._renderbuffer.format===Bi,`invalid stencil attachment for framebuffer object`),p(P,o,f),U(!P||P.texture&&P.texture._texture.format===Vi||P.renderbuffer&&P.renderbuffer._renderbuffer.format===Vi,`invalid depth-stencil attachment for framebuffer object`),S(a),a.width=o,a.height=f,a.colorAttachments=j,a.depthAttachment=M,a.stencilAttachment=N,a.depthStencilAttachment=P,d.color=j.map(_),d.depth=_(M),d.stencil=_(N),d.depthStencil=_(P),d.width=a.width,d.height=a.height,w(a),d}function f(e,t){U(s.next!==a,`can not resize a framebuffer which is currently in use`);var n=Math.max(e|0,1),r=Math.max(t|0||n,1);if(n===a.width&&r===a.height)return d;for(var i=a.colorAttachments,o=0;o<i.length;++o)v(i[o],n,r);return v(a.depthAttachment,n,r),v(a.stencilAttachment,n,r),v(a.depthStencilAttachment,n,r),a.width=d.width=n,a.height=d.height=r,w(a),d}return d(e,i),t(d,{resize:f,_reglType:`framebuffer`,_framebuffer:a,destroy:function(){C(a),S(a)},use:function(e){s.setFBO({framebuffer:d},e)}})}function E(e){var a=[,,,,,,];function o(e){var r;U(a.indexOf(s.next)<0,`can not update framebuffer which is currently in use`);var l={color:null},d=0,f=null,p=`rgba`,m=`uint8`,h=1;if(typeof e==`number`)d=e|0;else if(!e)d=1;else{U.type(e,`object`,`invalid arguments for framebuffer`);var g=e;if(`shape`in g){var _=g.shape;U(Array.isArray(_)&&_.length>=2,`invalid shape for framebuffer`),U(_[0]===_[1],`cube framebuffer must be square`),d=_[0]}else`radius`in g&&(d=g.radius|0),`width`in g?(d=g.width|0,`height`in g&&U(g.height===d,`must be square`)):`height`in g&&(d=g.height|0);(`color`in g||`colors`in g)&&(f=g.color||g.colors,Array.isArray(f)&&U(f.length===1||n.webgl_draw_buffers,`multiple render targets not supported`)),f||(`colorCount`in g&&(h=g.colorCount|0,U(h>0,`invalid color buffer count`)),`colorType`in g&&(U.oneOf(g.colorType,u,`invalid color type`),m=g.colorType),`colorFormat`in g&&(p=g.colorFormat,U.oneOf(g.colorFormat,c,`invalid color format for texture`))),`depth`in g&&(l.depth=g.depth),`stencil`in g&&(l.stencil=g.stencil),`depthStencil`in g&&(l.depthStencil=g.depthStencil)}var v;if(f){if(Array.isArray(f))for(v=[],r=0;r<f.length;++r)v[r]=f[r];else v=[f]}else{v=Array(h);var y={radius:d,format:p,type:m};for(r=0;r<h;++r)v[r]=i.createCube(y)}for(l.color=Array(v.length),r=0;r<v.length;++r){var b=v[r];U(typeof b==`function`&&b._reglType===`textureCube`,`invalid cube map`),d||=b.width,U(b.width===d&&b.height===d,`invalid cube map shape`),l.color[r]={target:_i,data:v[r]}}for(r=0;r<6;++r){for(var x=0;x<v.length;++x)l.color[x].target=_i+r;r>0&&(l.depth=a[0].depth,l.stencil=a[0].stencil,l.depthStencil=a[0].depthStencil),a[r]?a[r](l):a[r]=T(l)}return t(o,{width:d,height:d,color:v})}function l(e){var t,n=e|0;if(U(n>0&&n<=r.maxCubeMapSize,`invalid radius for cube fbo`),n===o.width)return o;var i=o.color;for(t=0;t<i.length;++t)i[t].resize(n);for(t=0;t<6;++t)a[t].resize(n);return o.width=o.height=n,o}return o(e),t(o,{faces:a,resize:l,_reglType:`framebufferCube`,destroy:function(){a.forEach(function(e){e.destroy()})}})}function D(){s.cur=null,s.next=null,s.dirty=!0,J(b).forEach(function(t){t.framebuffer=e.createFramebuffer(),w(t)})}return t(s,{getFramebuffer:function(e){if(typeof e==`function`&&e._reglType===`framebuffer`){var t=e._framebuffer;if(t instanceof x)return t}return null},create:T,createCube:E,clear:function(){J(b).forEach(C)},restore:D})}var Gi=5126,Ki=34962,qi=34963,Ji=[`attributes`,`elements`,`offset`,`count`,`primitive`,`instances`];function Yi(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=Gi,this.offset=0,this.stride=0,this.divisor=0}function Xi(t,n,r,i,a,o,s){for(var c=r.maxAttributes,l=Array(c),u=0;u<c;++u)l[u]=new Yi;var d=0,f={},p={Record:Yi,scope:{},state:l,currentVAO:null,targetVAO:null,restore:h()?S:function(){},createVAO:C,getVAO:_,destroyBuffer:m,setVAO:h()?v:y,clear:h()?b:function(){}};function m(e){for(var n=0;n<l.length;++n){var r=l[n];r.buffer===e&&(t.disableVertexAttribArray(n),r.buffer=null)}}function h(){return n.oes_vertex_array_object}function g(){return n.angle_instanced_arrays}function _(e){return typeof e==`function`&&e._vao?e._vao:null}function v(e){if(e!==p.currentVAO){var t=h();e?t.bindVertexArrayOES(e.vao):t.bindVertexArrayOES(null),p.currentVAO=e}}function y(e){if(e!==p.currentVAO){if(e)e.bindAttrs();else{for(var n=g(),r=0;r<l.length;++r){var i=l[r];i.buffer?(t.enableVertexAttribArray(r),i.buffer.bind(),t.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offfset),n&&i.divisor&&n.vertexAttribDivisorANGLE(r,i.divisor)):(t.disableVertexAttribArray(r),t.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}s.elements?t.bindBuffer(qi,s.elements.buffer.buffer):t.bindBuffer(qi,null)}p.currentVAO=e}}function b(){J(f).forEach(function(e){e.destroy()})}function x(){this.id=++d,this.attributes=[],this.elements=null,this.ownsElements=!1,this.count=0,this.offset=0,this.instances=-1,this.primitive=4;var e=h();this.vao=e?e.createVertexArrayOES():null,f[this.id]=this,this.buffers=[]}x.prototype.bindAttrs=function(){for(var e=g(),n=this.attributes,r=0;r<n.length;++r){var i=n[r];i.buffer?(t.enableVertexAttribArray(r),t.bindBuffer(Ki,i.buffer.buffer),t.vertexAttribPointer(r,i.size,i.type,i.normalized,i.stride,i.offset),e&&i.divisor&&e.vertexAttribDivisorANGLE(r,i.divisor)):(t.disableVertexAttribArray(r),t.vertexAttrib4f(r,i.x,i.y,i.z,i.w))}for(var a=n.length;a<c;++a)t.disableVertexAttribArray(a);var s=o.getElements(this.elements);s?t.bindBuffer(qi,s.buffer.buffer):t.bindBuffer(qi,null)},x.prototype.refresh=function(){var e=h();e&&(e.bindVertexArrayOES(this.vao),this.bindAttrs(),p.currentVAO=this)},x.prototype.destroy=function(){if(this.vao){var e=h();this===p.currentVAO&&(p.currentVAO=null,e.bindVertexArrayOES(null)),e.deleteVertexArrayOES(this.vao),this.vao=null}this.ownsElements&&=(this.elements.destroy(),this.elements=null,!1),f[this.id]&&(delete f[this.id],--i.vaoCount)};function S(){h()&&J(f).forEach(function(e){e.refresh()})}function C(t){var r=new x;i.vaoCount+=1;function s(t){var i;if(Array.isArray(t))i=t,r.elements&&r.ownsElements&&r.elements.destroy(),r.elements=null,r.ownsElements=!1,r.offset=0,r.count=0,r.instances=-1,r.primitive=4;else{if(U(typeof t==`object`,`invalid arguments for create vao`),U(`attributes`in t,`must specify attributes for vao`),t.elements){var l=t.elements;r.ownsElements?typeof l==`function`&&l._reglType===`elements`?(r.elements.destroy(),r.ownsElements=!1):(r.elements(l),r.ownsElements=!1):o.getElements(t.elements)?(r.elements=t.elements,r.ownsElements=!1):(r.elements=o.create(t.elements),r.ownsElements=!0)}else r.elements=null,r.ownsElements=!1;i=t.attributes,r.offset=0,r.count=-1,r.instances=-1,r.primitive=4,r.elements&&(r.count=r.elements._elements.vertCount,r.primitive=r.elements._elements.primType),`offset`in t&&(r.offset=t.offset|0),`count`in t&&(r.count=t.count|0),`instances`in t&&(r.instances=t.instances|0),`primitive`in t&&(U(t.primitive in Qt,`bad primitive type: `+t.primitive),r.primitive=Qt[t.primitive]),U.optional(()=>{for(var e=Object.keys(t),n=0;n<e.length;++n)U(Ji.indexOf(e[n])>=0,`invalid option for vao: "`+e[n]+`" valid options are `+Ji)}),U(Array.isArray(i),`attributes must be an array`)}U(i.length<c,`too many attributes`),U(i.length>0,`must specify at least one attribute`);var u={},d=r.attributes;d.length=i.length;for(var f=0;f<i.length;++f){var p=i[f],m=d[f]=new Yi,h=p.data||p;if(Array.isArray(h)||e(h)||At(h)){var g;r.buffers[f]&&(g=r.buffers[f],e(h)&&g._buffer.byteLength>=h.byteLength?g.subdata(h):(g.destroy(),r.buffers[f]=null)),r.buffers[f]||(g=r.buffers[f]=a.create(p,Ki,!1,!0)),m.buffer=a.getBuffer(g),m.size=m.buffer.dimension|0,m.normalized=!1,m.type=m.buffer.dtype,m.offset=0,m.stride=0,m.divisor=0,m.state=1,u[f]=1}else a.getBuffer(p)?(m.buffer=a.getBuffer(p),m.size=m.buffer.dimension|0,m.normalized=!1,m.type=m.buffer.dtype,m.offset=0,m.stride=0,m.divisor=0,m.state=1):a.getBuffer(p.buffer)?(m.buffer=a.getBuffer(p.buffer),m.size=(+p.size||m.buffer.dimension)|0,m.normalized=!!p.normalized||!1,`type`in p?(U.parameter(p.type,zt,`invalid buffer type`),m.type=zt[p.type]):m.type=m.buffer.dtype,m.offset=(p.offset||0)|0,m.stride=(p.stride||0)|0,m.divisor=(p.divisor||0)|0,m.state=1,U(m.size>=1&&m.size<=4,`size must be between 1 and 4`),U(m.offset>=0,`invalid offset`),U(m.stride>=0&&m.stride<=255,`stride must be between 0 and 255`),U(m.divisor>=0,`divisor must be positive`),U(!m.divisor||!!n.angle_instanced_arrays,`ANGLE_instanced_arrays must be enabled to use divisor`)):`x`in p?(U(f>0,`first attribute must not be a constant`),m.x=+p.x||0,m.y=+p.y||0,m.z=+p.z||0,m.w=+p.w||0,m.state=2):U(!1,`invalid attribute spec for location `+f)}for(var _=0;_<r.buffers.length;++_)!u[_]&&r.buffers[_]&&(r.buffers[_].destroy(),r.buffers[_]=null);return r.refresh(),s}return s.destroy=function(){for(var e=0;e<r.buffers.length;++e)r.buffers[e]&&r.buffers[e].destroy();r.buffers.length=0,r.ownsElements&&=(r.elements.destroy(),r.elements=null,!1),r.destroy()},s._vao=r,s._reglType=`vao`,s(t)}return p}var Zi=35632,Qi=35633,$i=35718,ea=35721;function ta(e,n,r,i){var a={},o={};function s(e,t,n,r){this.name=e,this.id=t,this.location=n,this.info=r}function c(e,t){for(var n=0;n<e.length;++n)if(e[n].id===t.id){e[n].location=t.location;return}e.push(t)}function l(t,r,i){var s=t===Zi?a:o,c=s[r];if(!c){var l=n.str(r);c=e.createShader(t),e.shaderSource(c,l),e.compileShader(c),U.shaderError(e,c,l,t,i),s[r]=c}return c}var u={},d=[],f=0;function p(e,t){this.id=f++,this.fragId=e,this.vertId=t,this.program=null,this.uniforms=[],this.attributes=[],this.refCount=1,i.profile&&(this.stats={uniformsCount:0,attributesCount:0})}function m(t,r,a){var o,u,d=l(Zi,t.fragId),f=l(Qi,t.vertId),p=t.program=e.createProgram();if(e.attachShader(p,d),e.attachShader(p,f),a)for(o=0;o<a.length;++o){var m=a[o];e.bindAttribLocation(p,m[0],m[1])}e.linkProgram(p),U.linkError(e,p,n.str(t.fragId),n.str(t.vertId),r);var h=e.getProgramParameter(p,$i);i.profile&&(t.stats.uniformsCount=h);var g=t.uniforms;for(o=0;o<h;++o)if(u=e.getActiveUniform(p,o),u){if(u.size>1)for(var _=0;_<u.size;++_){var v=u.name.replace(`[0]`,`[`+_+`]`);c(g,new s(v,n.id(v),e.getUniformLocation(p,v),u))}else c(g,new s(u.name,n.id(u.name),e.getUniformLocation(p,u.name),u))}var y=e.getProgramParameter(p,ea);i.profile&&(t.stats.attributesCount=y);var b=t.attributes;for(o=0;o<y;++o)u=e.getActiveAttrib(p,o),u&&c(b,new s(u.name,n.id(u.name),e.getAttribLocation(p,u.name),u))}i.profile&&(r.getMaxUniformsCount=function(){var e=0;return d.forEach(function(t){t.stats.uniformsCount>e&&(e=t.stats.uniformsCount)}),e},r.getMaxAttributesCount=function(){var e=0;return d.forEach(function(t){t.stats.attributesCount>e&&(e=t.stats.attributesCount)}),e});function h(){a={},o={};for(var e=0;e<d.length;++e)m(d[e],null,d[e].attributes.map(function(e){return[e.location,e.name]}))}return{clear:function(){var t=e.deleteShader.bind(e);J(a).forEach(t),a={},J(o).forEach(t),o={},d.forEach(function(t){e.deleteProgram(t.program)}),d.length=0,u={},r.shaderCount=0},program:function(n,i,s,c){U.command(n>=0,`missing vertex shader`,s),U.command(i>=0,`missing fragment shader`,s);var l=u[i];l||=u[i]={};var f=l[n];if(f&&(f.refCount++,!c))return f;var h=new p(i,n);return r.shaderCount++,m(h,s,c),f||(l[n]=h),d.push(h),t(h,{destroy:function(){if(h.refCount--,h.refCount<=0){e.deleteProgram(h.program);var t=d.indexOf(h);d.splice(t,1),r.shaderCount--}l[h.vertId].refCount<=0&&(e.deleteShader(o[h.vertId]),delete o[h.vertId],delete u[h.fragId][h.vertId]),Object.keys(u[h.fragId]).length||(e.deleteShader(a[h.fragId]),delete a[h.fragId],delete u[h.fragId])}})},restore:h,shader:l,frag:-1,vert:-1}}var na=6408,ra=5121,ia=3333,aa=5126;function oa(t,n,r,i,a,o,s){function c(c){var l;n.next===null?(U(a.preserveDrawingBuffer,`you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer`),l=ra):(U(n.next.colorAttachments[0].texture!==null,`You cannot read from a renderbuffer`),l=n.next.colorAttachments[0].texture._texture.type,U.optional(function(){o.oes_texture_float?(U(l===ra||l===aa,`Reading from a framebuffer is only allowed for the types 'uint8' and 'float'`),l===aa&&U(s.readFloat,`Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float`)):U(l===ra,`Reading from a framebuffer is only allowed for the type 'uint8'`)}));var u=0,d=0,f=i.framebufferWidth,p=i.framebufferHeight,m=null;e(c)?m=c:c&&(U.type(c,`object`,`invalid arguments to regl.read()`),u=c.x|0,d=c.y|0,U(u>=0&&u<i.framebufferWidth,`invalid x offset for regl.read`),U(d>=0&&d<i.framebufferHeight,`invalid y offset for regl.read`),f=(c.width||i.framebufferWidth-u)|0,p=(c.height||i.framebufferHeight-d)|0,m=c.data||null),m&&(l===ra?U(m instanceof Uint8Array,`buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'`):l===aa&&U(m instanceof Float32Array,`buffer must be 'Float32Array' when reading from a framebuffer of type 'float'`)),U(f>0&&f+u<=i.framebufferWidth,`invalid width for read pixels`),U(p>0&&p+d<=i.framebufferHeight,`invalid height for read pixels`),r();var h=f*p*4;return m||(l===ra?m=new Uint8Array(h):l===aa&&(m||=new Float32Array(h))),U.isTypedArray(m,`data buffer for regl.read() must be a typedarray`),U(m.byteLength>=h,`data buffer for regl.read() too small`),t.pixelStorei(ia,4),t.readPixels(u,d,f,p,na,l,m),m}function l(e){var t;return n.setFBO({framebuffer:e.framebuffer},function(){t=c(e)}),t}function u(e){return!e||!(`framebuffer`in e)?c(e):l(e)}return u}function sa(e){return Array.prototype.slice.call(e)}function ca(e){return sa(e).join(``)}function la(){var e=0,n=[],r=[];function i(t){for(var i=0;i<r.length;++i)if(r[i]===t)return n[i];var a=`g`+e++;return n.push(a),r.push(t),a}function a(){var n=[];function r(){n.push.apply(n,sa(arguments))}var i=[];function a(){var t=`v`+e++;return i.push(t),arguments.length>0&&(n.push(t,`=`),n.push.apply(n,sa(arguments)),n.push(`;`)),t}return t(r,{def:a,toString:function(){return ca([i.length>0?`var `+i.join(`,`)+`;`:``,ca(n)])}})}function o(){var e=a(),n=a(),r=e.toString,i=n.toString;function o(t,r){n(t,r,`=`,e.def(t,r),`;`)}return t(function(){e.apply(e,sa(arguments))},{def:e.def,entry:e,exit:n,save:o,set:function(t,n,r){o(t,n),e(t,n,`=`,r,`;`)},toString:function(){return r()+i()}})}function s(){var e=ca(arguments),n=o(),r=o(),i=n.toString,a=r.toString;return t(n,{then:function(){return n.apply(n,sa(arguments)),this},else:function(){return r.apply(r,sa(arguments)),this},toString:function(){var t=a();return t&&=`else{`+t+`}`,ca([`if(`,e,`){`,i(),`}`,t])}})}var c=a(),l={};function u(e,n){var r=[];function i(){var e=`a`+r.length;return r.push(e),e}n||=0;for(var a=0;a<n;++a)i();var s=o(),c=s.toString;return l[e]=t(s,{arg:i,toString:function(){return ca([`function(`,r.join(),`){`,c(),`}`])}})}function d(){var e=[`"use strict";`,c,`return {`];Object.keys(l).forEach(function(t){e.push(`"`,t,`":`,l[t].toString(),`,`)}),e.push(`}`);var t=ca(e).replace(/;/g,`;
|
|
6
6
|
`).replace(/}/g,`}
|
|
7
7
|
`).replace(/{/g,`{
|
|
8
|
-
`);return Function.apply(null,n.concat(t)).apply(null,r)}return{global:c,link:i,block:a,proc:u,scope:o,cond:s,compile:d}}var ua=`xyzw`.split(``),da=5121,fa=1,pa=2,ma=0,ha=1,ga=2,_a=3,va=4,ya=5,ba=6,xa=`dither`,Sa=`blend.enable`,Ca=`blend.color`,wa=`blend.equation`,Ta=`blend.func`,Ea=`depth.enable`,Da=`depth.func`,Oa=`depth.range`,ka=`depth.mask`,Aa=`colorMask`,ja=`cull.enable`,Ma=`cull.face`,Na=`frontFace`,Pa=`lineWidth`,Fa=`polygonOffset.enable`,Ia=`polygonOffset.offset`,La=`sample.alpha`,Ra=`sample.enable`,za=`sample.coverage`,Ba=`stencil.enable`,Va=`stencil.mask`,Ha=`stencil.func`,Ua=`stencil.opFront`,Wa=`stencil.opBack`,Ga=`scissor.enable`,Ka=`scissor.box`,qa=`viewport`,Ja=`profile`,Ya=`framebuffer`,Xa=`vert`,Za=`frag`,Qa=`elements`,$a=`primitive`,eo=`count`,to=`offset`,no=`instances`,ro=`vao`,io=`Width`,ao=`Height`,oo=Ya+io,so=Ya+ao,co=qa+io,lo=qa+ao,uo=`drawingBuffer`,fo=uo+io,po=uo+ao,mo=[Ta,wa,Ha,Ua,Wa,za,qa,Ka,Ia],ho=34962,go=34963,_o=35632,vo=35633,yo=3553,bo=34067,xo=2884,So=3042,Co=3024,wo=2960,To=2929,Eo=3089,Do=32823,Oo=32926,ko=32928,Ao=5126,jo=35664,Mo=35665,No=35666,Po=5124,Fo=35667,Io=35668,Lo=35669,Ro=35670,zo=35671,Bo=35672,Vo=35673,Ho=35674,Uo=35675,Wo=35676,Go=35678,Ko=35680,qo=4,Jo=1028,Yo=1029,Xo=2304,Zo=2305,Qo=32775,$o=32776,es=519,ts=7680,ns=0,rs=1,is=32774,as=513,os=36160,ss=36064,cs={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},ls=[`constant color, constant alpha`,`one minus constant color, constant alpha`,`constant color, one minus constant alpha`,`one minus constant color, one minus constant alpha`,`constant alpha, constant color`,`constant alpha, one minus constant color`,`one minus constant alpha, constant color`,`one minus constant alpha, one minus constant color`],us={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},ds={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},fs={frag:_o,vert:vo},ps={cw:Xo,ccw:Zo};function ms(t){return Array.isArray(t)||e(t)||At(t)}function hs(e){return e.sort(function(e,t){return e===qa?-1:t===qa?1:e<t?-1:1})}function Z(e,t,n,r){this.thisDep=e,this.contextDep=t,this.propDep=n,this.append=r}function gs(e){return e&&!(e.thisDep||e.contextDep||e.propDep)}function Q(e){return new Z(!1,!1,!1,e)}function $(e,t){var n=e.type;if(n===ma){var r=e.data.length;return new Z(!0,r>=1,r>=2,t)}if(n===va){var i=e.data;return new Z(i.thisDep,i.contextDep,i.propDep,t)}if(n===ya)return new Z(!1,!1,!1,t);if(n===ba){for(var a=!1,o=!1,s=!1,c=0;c<e.data.length;++c){var l=e.data[c];if(l.type===ha)s=!0;else if(l.type===ga)o=!0;else if(l.type===_a)a=!0;else if(l.type===ma){a=!0;var u=l.data;u>=1&&(o=!0),u>=2&&(s=!0)}else l.type===va&&(a||=l.data.thisDep,o||=l.data.contextDep,s||=l.data.propDep)}return new Z(a,o,s,t)}return new Z(n===_a,n===ga,n===ha,t)}var _s=new Z(!1,!1,!1,function(){});function vs(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=u.Record,_={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(_.min=Qo,_.max=$o);var v=r.angle_instanced_arrays,y=r.webgl_draw_buffers,b=r.oes_vertex_array_object,x={dirty:!0,profile:h.profile},S={},C=[],w={},T={};function E(e){return e.replace(`.`,`_`)}function D(e,t,n){var r=E(e);C.push(e),S[r]=x[r]=!!n,w[r]=t}function O(e,t,n){var r=E(e);C.push(e),Array.isArray(n)?(x[r]=n.slice(),S[r]=n.slice()):x[r]=S[r]=n,T[r]=t}D(xa,Co),D(Sa,So),O(Ca,`blendColor`,[0,0,0,0]),O(wa,`blendEquationSeparate`,[is,is]),O(Ta,`blendFuncSeparate`,[rs,ns,rs,ns]),D(Ea,To,!0),O(Da,`depthFunc`,as),O(Oa,`depthRange`,[0,1]),O(ka,`depthMask`,!0),O(Aa,Aa,[!0,!0,!0,!0]),D(ja,xo),O(Ma,`cullFace`,Yo),O(Na,Na,Zo),O(Pa,Pa,1),D(Fa,Do),O(Ia,`polygonOffset`,[0,0]),D(La,Oo),D(Ra,ko),O(za,`sampleCoverage`,[1,!1]),D(Ba,wo),O(Va,`stencilMask`,-1),O(Ha,`stencilFunc`,[es,0,-1]),O(Ua,`stencilOpSeparate`,[Jo,ts,ts,ts]),O(Wa,`stencilOpSeparate`,[Yo,ts,ts,ts]),D(Ga,Eo),O(Ka,`scissor`,[0,0,e.drawingBufferWidth,e.drawingBufferHeight]),O(qa,qa,[0,0,e.drawingBufferWidth,e.drawingBufferHeight]);var k={gl:e,context:p,strings:n,next:S,current:x,draw:f,elements:o,buffer:a,shader:d,attributes:u.state,vao:u,uniforms:l,framebuffer:c,extensions:r,timer:m,isBufferArgs:ms},A={primTypes:Qt,compareFuncs:us,blendFuncs:cs,blendEquations:_,stencilOps:ds,glTypes:zt,orientationType:ps};U.optional(function(){k.isArrayLike=Y}),y&&(A.backBuffer=[Yo],A.drawBuffer=K(i.maxDrawbuffers,function(e){return e===0?[0]:K(e,function(e){return ss+e})}));var ee=0;function j(){var e=la(),t=e.link,r=e.global;e.id=ee++,e.batchId=`0`;var i=t(k),a=e.shared={props:`a0`};Object.keys(k).forEach(function(e){a[e]=r.def(i,`.`,e)}),U.optional(function(){e.CHECK=t(U),e.commandStr=U.guessCommand(),e.command=t(e.commandStr),e.assert=function(e,n,r){e(`if(!(`,n,`))`,this.CHECK,`.commandRaise(`,t(r),`,`,this.command,`);`)},A.invalidBlendCombinations=ls});var o=e.next={},s=e.current={};Object.keys(T).forEach(function(e){Array.isArray(x[e])&&(o[e]=r.def(a.next,`.`,e),s[e]=r.def(a.current,`.`,e))});var c=e.constants={};Object.keys(A).forEach(function(e){c[e]=r.def(JSON.stringify(A[e]))}),e.invoke=function(n,r){switch(r.type){case ma:var i=[`this`,a.context,a.props,e.batchId];return n.def(t(r.data),`.call(`,i.slice(0,Math.max(r.data.length+1,4)),`)`);case ha:return n.def(a.props,r.data);case ga:return n.def(a.context,r.data);case _a:return n.def(`this`,r.data);case va:return r.data.append(e,n),r.data.ref;case ya:return r.data.toString();case ba:return r.data.map(function(t){return e.invoke(n,t)})}},e.attribCache={};var l={};return e.scopeAttrib=function(e){var r=n.id(e);if(r in l)return l[r];var i=u.scope[r];return i||=u.scope[r]=new g,l[r]=t(i)},e}function M(e){var t=e.static,n=e.dynamic,r;if(Ja in t){var i=!!t[Ja];r=Q(function(e,t){return i}),r.enable=i}else if(Ja in n){var a=n[Ja];r=$(a,function(e,t){return e.invoke(t,a)})}return r}function N(e,t){var n=e.static,r=e.dynamic;if(Ya in n){var i=n[Ya];return i?(i=c.getFramebuffer(i),U.command(i,`invalid framebuffer object`),Q(function(e,t){var n=e.link(i),r=e.shared;t.set(r.framebuffer,`.next`,n);var a=r.context;return t.set(a,`.`+oo,n+`.width`),t.set(a,`.`+so,n+`.height`),n})):Q(function(e,t){var n=e.shared;t.set(n.framebuffer,`.next`,`null`);var r=n.context;return t.set(r,`.`+oo,r+`.`+fo),t.set(r,`.`+so,r+`.`+po),`null`})}if(Ya in r){var a=r[Ya];return $(a,function(e,t){var n=e.invoke(t,a),r=e.shared,i=r.framebuffer,o=t.def(i,`.getFramebuffer(`,n,`)`);U.optional(function(){e.assert(t,`!`+n+`||`+o,`invalid framebuffer object`)}),t.set(i,`.next`,o);var s=r.context;return t.set(s,`.`+oo,o+`?`+o+`.width:`+s+`.`+fo),t.set(s,`.`+so,o+`?`+o+`.height:`+s+`.`+po),o})}return null}function P(e,t,n){var r=e.static,i=e.dynamic;function a(e){if(e in r){var a=r[e];U.commandType(a,`object`,`invalid `+e,n.commandStr);var o=!0,s=a.x|0,c=a.y|0,l,u;return`width`in a?(l=a.width|0,U.command(l>=0,`invalid `+e,n.commandStr)):o=!1,`height`in a?(u=a.height|0,U.command(u>=0,`invalid `+e,n.commandStr)):o=!1,new Z(!o&&t&&t.thisDep,!o&&t&&t.contextDep,!o&&t&&t.propDep,function(e,t){var n=e.shared.context,r=l;`width`in a||(r=t.def(n,`.`,oo,`-`,s));var i=u;return`height`in a||(i=t.def(n,`.`,so,`-`,c)),[s,c,r,i]})}if(e in i){var d=i[e],f=$(d,function(t,n){var r=t.invoke(n,d);U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid `+e)});var i=t.shared.context,a=n.def(r,`.x|0`),o=n.def(r,`.y|0`),s=n.def(`"width" in `,r,`?`,r,`.width|0:`,`(`,i,`.`,oo,`-`,a,`)`),c=n.def(`"height" in `,r,`?`,r,`.height|0:`,`(`,i,`.`,so,`-`,o,`)`);return U.optional(function(){t.assert(n,s+`>=0&&`+c+`>=0`,`invalid `+e)}),[a,o,s,c]});return t&&(f.thisDep=f.thisDep||t.thisDep,f.contextDep=f.contextDep||t.contextDep,f.propDep=f.propDep||t.propDep),f}return t?new Z(t.thisDep,t.contextDep,t.propDep,function(e,t){var n=e.shared.context;return[0,0,t.def(n,`.`,oo),t.def(n,`.`,so)]}):null}var o=a(qa);if(o){var s=o;o=new Z(o.thisDep,o.contextDep,o.propDep,function(e,t){var n=s.append(e,t),r=e.shared.context;return t.set(r,`.`+co,n[2]),t.set(r,`.`+lo,n[3]),n})}return{viewport:o,scissor_box:a(Ka)}}function F(e,t){var n=e.static;if(typeof n[Za]==`string`&&typeof n[Xa]==`string`){if(Object.keys(t.dynamic).length>0)return null;var r=t.static,i=Object.keys(r);if(i.length>0&&typeof r[i[0]]==`number`){for(var a=[],o=0;o<i.length;++o)U(typeof r[i[o]]==`number`,`must specify all vertex attribute locations when using vaos`),a.push([r[i[o]]|0,i[o]]);return a}}return null}function te(e,t,r){var i=e.static,a=e.dynamic;function o(e){if(e in i){var t=n.id(i[e]);U.optional(function(){d.shader(fs[e],t,U.guessCommand())});var r=Q(function(){return t});return r.id=t,r}if(e in a){var o=a[e];return $(o,function(t,n){var r=t.invoke(n,o),i=n.def(t.shared.strings,`.id(`,r,`)`);return U.optional(function(){n(t.shared.shader,`.shader(`,fs[e],`,`,i,`,`,t.command,`);`)}),i})}return null}var s=o(Za),c=o(Xa),l=null,u;return gs(s)&&gs(c)?(l=d.program(c.id,s.id,null,r),u=Q(function(e,t){return e.link(l)})):u=new Z(s&&s.thisDep||c&&c.thisDep,s&&s.contextDep||c&&c.contextDep,s&&s.propDep||c&&c.propDep,function(e,t){var n=e.shared.shader,r=s?s.append(e,t):t.def(n,`.`,Za),i=c?c.append(e,t):t.def(n,`.`,Xa),a=n+`.program(`+i+`,`+r;return U.optional(function(){a+=`,`+e.command}),t.def(a+`)`)}),{frag:s,vert:c,progVar:u,program:l}}function I(e,t){var n=e.static,r=e.dynamic,i={},a=!1,s=!1;function c(){if(ro in n){U(!n.elements&&!r.elements,`cannot specify elements with vao`);var e=n[ro];return e!==null&&u.getVAO(e)===null&&(e=u.createVAO(e)),a=!0,s=!!e,i.vao=e,Q(function(t){var n=u.getVAO(e);return n?t.link(n):`null`})}if(ro in r){U(!n.elements&&!r.elements,`cannot specify elements with vao`),a=!0,s=!0;var t=r[ro];return $(t,function(e,n){var r=e.invoke(n,t);return n.def(e.shared.vao+`.getVAO(`+r+`)`)})}return null}var l=c(),d=!1;function f(){if(Qa in n){U(!s,`must not specify vao and elements`);var e=n[Qa];if(i.elements=e,ms(e)){var c=i.elements=o.create(e,!0);e=o.getElements(c),d=!0}else e&&(e=o.getElements(e),d=!0,U.command(e,`invalid elements`,t.commandStr));var u=Q(function(t,n){if(e){var r=t.link(e);return t.ELEMENTS=r,r}return t.ELEMENTS=null,null});return u.value=e,u}if(Qa in r){U(!s,`must not specify vao and elements`),d=!0;var f=r[Qa];return $(f,function(e,t){var n=e.shared,r=n.isBufferArgs,i=n.elements,a=e.invoke(t,f),o=t.def(`null`),s=t.def(r,`(`,a,`)`),c=e.cond(s).then(o,`=`,i,`.createStream(`,a,`);`).else(o,`=`,i,`.getElements(`,a,`);`);return U.optional(function(){e.assert(c.else,`!`+a+`||`+o,`invalid elements`)}),t.entry(c),t.exit(e.cond(s).then(i,`.destroyStream(`,o,`);`)),e.ELEMENTS=o,o})}return a?new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.elements+`.getElements(`+e.shared.vao+`.currentVAO.elements):null`)}):null}var p=f();d&&(l=Q(function(){return`null`}));function m(){if($a in n){var e=n[$a];return i.primitive=e,U.commandParameter(e,Qt,`invalid primitve`,t.commandStr),Q(function(t,n){return Qt[e]})}if($a in r){var o=r[$a];return $(o,function(e,t){var n=e.constants.primTypes,r=e.invoke(t,o);return U.optional(function(){e.assert(t,r+` in `+n,`invalid primitive, must be one of `+Object.keys(Qt))}),t.def(n,`[`,r,`]`)})}return d?gs(p)?p.value?Q(function(e,t){return t.def(e.ELEMENTS,`.primType`)}):Q(function(){return qo}):new Z(p.thisDep,p.contextDep,p.propDep,function(e,t){var n=e.ELEMENTS;return t.def(n,`?`,n,`.primType:`,qo)}):a?new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.vao+`.currentVAO.primitive:`+qo)}):null}function h(e,o){if(e in n){var s=n[e]|0;return o?i.offset=s:i.instances=s,U.command(!o||s>=0,`invalid `+e,t.commandStr),Q(function(e,t){return o&&(e.OFFSET=s),s})}if(e in r){var c=r[e];return $(c,function(t,n){var r=t.invoke(n,c);return o&&(t.OFFSET=r,U.optional(function(){t.assert(n,r+`>=0`,`invalid `+e)})),r})}if(o){if(d)return Q(function(e,t){return e.OFFSET=0,0});if(a)return new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.vao+`.currentVAO.offset:0`)})}else if(a)return new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.vao+`.currentVAO.instances:-1`)});return null}var g=h(to,!0);function _(){if(eo in n){var e=n[eo]|0;return i.count=e,U.command(typeof e==`number`&&e>=0,`invalid vertex count`,t.commandStr),Q(function(){return e})}if(eo in r){var o=r[eo];return $(o,function(e,t){var n=e.invoke(t,o);return U.optional(function(){e.assert(t,`typeof `+n+`==="number"&&`+n+`>=0&&`+n+`===(`+n+`|0)`,`invalid vertex count`)}),n})}if(d){if(gs(p)){if(p)return g?new Z(g.thisDep,g.contextDep,g.propDep,function(e,t){var n=t.def(e.ELEMENTS,`.vertCount-`,e.OFFSET);return U.optional(function(){e.assert(t,n+`>=0`,`invalid vertex offset/element buffer too small`)}),n}):Q(function(e,t){return t.def(e.ELEMENTS,`.vertCount`)});var s=Q(function(){return-1});return U.optional(function(){s.MISSING=!0}),s}var c=new Z(p.thisDep||g.thisDep,p.contextDep||g.contextDep,p.propDep||g.propDep,function(e,t){var n=e.ELEMENTS;return e.OFFSET?t.def(n,`?`,n,`.vertCount-`,e.OFFSET,`:-1`):t.def(n,`?`,n,`.vertCount:-1`)});return U.optional(function(){c.DYNAMIC=!0}),c}return a?new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao,`.currentVAO?`,e.shared.vao,`.currentVAO.count:-1`)}):null}return{elements:p,primitive:m(),count:_(),instances:h(no,!1),offset:g,vao:l,vaoActive:a,elementsActive:d,static:i}}function ne(e,t){var n=e.static,r=e.dynamic,a={};return C.forEach(function(e){var o=E(e);function s(t,i){if(e in n){var s=t(n[e]);a[o]=Q(function(){return s})}else if(e in r){var c=r[e];a[o]=$(c,function(e,t){return i(e,t,e.invoke(t,c))})}}switch(e){case ja:case Sa:case xa:case Ba:case Ea:case Ga:case Fa:case La:case Ra:case ka:return s(function(n){return U.commandType(n,`boolean`,e,t.commandStr),n},function(t,n,r){return U.optional(function(){t.assert(n,`typeof `+r+`==="boolean"`,`invalid flag `+e,t.commandStr)}),r});case Da:return s(function(n){return U.commandParameter(n,us,`invalid `+e,t.commandStr),us[n]},function(t,n,r){var i=t.constants.compareFuncs;return U.optional(function(){t.assert(n,r+` in `+i,`invalid `+e+`, must be one of `+Object.keys(us))}),n.def(i,`[`,r,`]`)});case Oa:return s(function(e){return U.command(Y(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`&&e[0]<=e[1],`depth range is 2d array`,t.commandStr),e},function(e,t,n){return U.optional(function(){e.assert(t,e.shared.isArrayLike+`(`+n+`)&&`+n+`.length===2&&typeof `+n+`[0]==="number"&&typeof `+n+`[1]==="number"&&`+n+`[0]<=`+n+`[1]`,`depth range must be a 2d array`)}),[t.def(`+`,n,`[0]`),t.def(`+`,n,`[1]`)]});case Ta:return s(function(e){U.commandType(e,`object`,`blend.func`,t.commandStr);var n=`srcRGB`in e?e.srcRGB:e.src,r=`srcAlpha`in e?e.srcAlpha:e.src,i=`dstRGB`in e?e.dstRGB:e.dst,a=`dstAlpha`in e?e.dstAlpha:e.dst;return U.commandParameter(n,cs,o+`.srcRGB`,t.commandStr),U.commandParameter(r,cs,o+`.srcAlpha`,t.commandStr),U.commandParameter(i,cs,o+`.dstRGB`,t.commandStr),U.commandParameter(a,cs,o+`.dstAlpha`,t.commandStr),U.command(ls.indexOf(n+`, `+i)===-1,`unallowed blending combination (srcRGB, dstRGB) = (`+n+`, `+i+`)`,t.commandStr),[cs[n],cs[i],cs[r],cs[a]]},function(t,n,r){var i=t.constants.blendFuncs;U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid blend func, must be an object`)});function a(a,o){var s=n.def(`"`,a,o,`" in `,r,`?`,r,`.`,a,o,`:`,r,`.`,a);return U.optional(function(){t.assert(n,s+` in `+i,`invalid `+e+`.`+a+o+`, must be one of `+Object.keys(cs))}),s}var o=a(`src`,`RGB`),s=a(`dst`,`RGB`);U.optional(function(){var e=t.constants.invalidBlendCombinations;t.assert(n,e+`.indexOf(`+o+`+", "+`+s+`) === -1 `,`unallowed blending combination for (srcRGB, dstRGB)`)});var c=n.def(i,`[`,o,`]`),l=n.def(i,`[`,a(`src`,`Alpha`),`]`);return[c,n.def(i,`[`,s,`]`),l,n.def(i,`[`,a(`dst`,`Alpha`),`]`)]});case wa:return s(function(n){if(typeof n==`string`)return U.commandParameter(n,_,`invalid `+e,t.commandStr),[_[n],_[n]];if(typeof n==`object`)return U.commandParameter(n.rgb,_,e+`.rgb`,t.commandStr),U.commandParameter(n.alpha,_,e+`.alpha`,t.commandStr),[_[n.rgb],_[n.alpha]];U.commandRaise(`invalid blend.equation`,t.commandStr)},function(t,n,r){var i=t.constants.blendEquations,a=n.def(),o=n.def(),s=t.cond(`typeof `,r,`==="string"`);return U.optional(function(){function n(e,n,r){t.assert(e,r+` in `+i,`invalid `+n+`, must be one of `+Object.keys(_))}n(s.then,e,r),t.assert(s.else,r+`&&typeof `+r+`==="object"`,`invalid `+e),n(s.else,e+`.rgb`,r+`.rgb`),n(s.else,e+`.alpha`,r+`.alpha`)}),s.then(a,`=`,o,`=`,i,`[`,r,`];`),s.else(a,`=`,i,`[`,r,`.rgb];`,o,`=`,i,`[`,r,`.alpha];`),n(s),[a,o]});case Ca:return s(function(e){return U.command(Y(e)&&e.length===4,`blend.color must be a 4d array`,t.commandStr),K(4,function(t){return+e[t]})},function(e,t,n){return U.optional(function(){e.assert(t,e.shared.isArrayLike+`(`+n+`)&&`+n+`.length===4`,`blend.color must be a 4d array`)}),K(4,function(e){return t.def(`+`,n,`[`,e,`]`)})});case Va:return s(function(e){return U.commandType(e,`number`,o,t.commandStr),e|0},function(e,t,n){return U.optional(function(){e.assert(t,`typeof `+n+`==="number"`,`invalid stencil.mask`)}),t.def(n,`|0`)});case Ha:return s(function(n){U.commandType(n,`object`,o,t.commandStr);var r=n.cmp||`keep`,i=n.ref||0,a=`mask`in n?n.mask:-1;return U.commandParameter(r,us,e+`.cmp`,t.commandStr),U.commandType(i,`number`,e+`.ref`,t.commandStr),U.commandType(a,`number`,e+`.mask`,t.commandStr),[us[r],i,a]},function(e,t,n){var r=e.constants.compareFuncs;return U.optional(function(){function i(){e.assert(t,Array.prototype.join.call(arguments,``),`invalid stencil.func`)}i(n+`&&typeof `,n,`==="object"`),i(`!("cmp" in `,n,`)||(`,n,`.cmp in `,r,`)`)}),[t.def(`"cmp" in `,n,`?`,r,`[`,n,`.cmp]`,`:`,ts),t.def(n,`.ref|0`),t.def(`"mask" in `,n,`?`,n,`.mask|0:-1`)]});case Ua:case Wa:return s(function(n){U.commandType(n,`object`,o,t.commandStr);var r=n.fail||`keep`,i=n.zfail||`keep`,a=n.zpass||`keep`;return U.commandParameter(r,ds,e+`.fail`,t.commandStr),U.commandParameter(i,ds,e+`.zfail`,t.commandStr),U.commandParameter(a,ds,e+`.zpass`,t.commandStr),[e===Wa?Yo:Jo,ds[r],ds[i],ds[a]]},function(t,n,r){var i=t.constants.stencilOps;U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid `+e)});function a(a){return U.optional(function(){t.assert(n,`!("`+a+`" in `+r+`)||(`+r+`.`+a+` in `+i+`)`,`invalid `+e+`.`+a+`, must be one of `+Object.keys(ds))}),n.def(`"`,a,`" in `,r,`?`,i,`[`,r,`.`,a,`]:`,ts)}return[e===Wa?Yo:Jo,a(`fail`),a(`zfail`),a(`zpass`)]});case Ia:return s(function(e){U.commandType(e,`object`,o,t.commandStr);var n=e.factor|0,r=e.units|0;return U.commandType(n,`number`,o+`.factor`,t.commandStr),U.commandType(r,`number`,o+`.units`,t.commandStr),[n,r]},function(t,n,r){return U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid `+e)}),[n.def(r,`.factor|0`),n.def(r,`.units|0`)]});case Ma:return s(function(e){var n=0;return e===`front`?n=Jo:e===`back`&&(n=Yo),U.command(!!n,o,t.commandStr),n},function(e,t,n){return U.optional(function(){e.assert(t,n+`==="front"||`+n+`==="back"`,`invalid cull.face`)}),t.def(n,`==="front"?`,Jo,`:`,Yo)});case Pa:return s(function(e){return U.command(typeof e==`number`&&e>=i.lineWidthDims[0]&&e<=i.lineWidthDims[1],`invalid line width, must be a positive number between `+i.lineWidthDims[0]+` and `+i.lineWidthDims[1],t.commandStr),e},function(e,t,n){return U.optional(function(){e.assert(t,`typeof `+n+`==="number"&&`+n+`>=`+i.lineWidthDims[0]+`&&`+n+`<=`+i.lineWidthDims[1],`invalid line width`)}),n});case Na:return s(function(e){return U.commandParameter(e,ps,o,t.commandStr),ps[e]},function(e,t,n){return U.optional(function(){e.assert(t,n+`==="cw"||`+n+`==="ccw"`,`invalid frontFace, must be one of cw,ccw`)}),t.def(n+`==="cw"?`+Xo+`:`+Zo)});case Aa:return s(function(e){return U.command(Y(e)&&e.length===4,`color.mask must be length 4 array`,t.commandStr),e.map(function(e){return!!e})},function(e,t,n){return U.optional(function(){e.assert(t,e.shared.isArrayLike+`(`+n+`)&&`+n+`.length===4`,`invalid color.mask`)}),K(4,function(e){return`!!`+n+`[`+e+`]`})});case za:return s(function(e){U.command(typeof e==`object`&&e,o,t.commandStr);var n=`value`in e?e.value:1,r=!!e.invert;return U.command(typeof n==`number`&&n>=0&&n<=1,`sample.coverage.value must be a number between 0 and 1`,t.commandStr),[n,r]},function(e,t,n){return U.optional(function(){e.assert(t,n+`&&typeof `+n+`==="object"`,`invalid sample.coverage`)}),[t.def(`"value" in `,n,`?+`,n,`.value:1`),t.def(`!!`,n,`.invert`)]})}}),a}function re(e,t){var n=e.static,r=e.dynamic,i={};return Object.keys(n).forEach(function(e){var r=n[e],a;if(typeof r==`number`||typeof r==`boolean`)a=Q(function(){return r});else if(typeof r==`function`){var o=r._reglType;o===`texture2d`||o===`textureCube`?a=Q(function(e){return e.link(r)}):o===`framebuffer`||o===`framebufferCube`?(U.command(r.color.length>0,`missing color attachment for framebuffer sent to uniform "`+e+`"`,t.commandStr),a=Q(function(e){return e.link(r.color[0])})):U.commandRaise(`invalid data for uniform "`+e+`"`,t.commandStr)}else Y(r)?a=Q(function(t){return t.global.def(`[`,K(r.length,function(n){return U.command(typeof r[n]==`number`||typeof r[n]==`boolean`,`invalid uniform `+e,t.commandStr),r[n]}),`]`)}):U.commandRaise(`invalid or missing data for uniform "`+e+`"`,t.commandStr);a.value=r,i[e]=a}),Object.keys(r).forEach(function(e){var t=r[e];i[e]=$(t,function(e,n){return e.invoke(n,t)})}),i}function ie(e,t){var r=e.static,i=e.dynamic,o={};return Object.keys(r).forEach(function(e){var i=r[e],s=n.id(e),c=new g;if(ms(i))c.state=fa,c.buffer=a.getBuffer(a.create(i,ho,!1,!0)),c.type=0;else{var l=a.getBuffer(i);if(l)c.state=fa,c.buffer=l,c.type=0;else if(U.command(typeof i==`object`&&i,`invalid data for attribute `+e,t.commandStr),`constant`in i){var u=i.constant;c.buffer=`null`,c.state=pa,typeof u==`number`?c.x=u:(U.command(Y(u)&&u.length>0&&u.length<=4,`invalid constant for attribute `+e,t.commandStr),ua.forEach(function(e,t){t<u.length&&(c[e]=u[t])}))}else{l=ms(i.buffer)?a.getBuffer(a.create(i.buffer,ho,!1,!0)):a.getBuffer(i.buffer),U.command(!!l,`missing buffer for attribute "`+e+`"`,t.commandStr);var d=i.offset|0;U.command(d>=0,`invalid offset for attribute "`+e+`"`,t.commandStr);var f=i.stride|0;U.command(f>=0&&f<256,`invalid stride for attribute "`+e+`", must be integer betweeen [0, 255]`,t.commandStr);var p=i.size|0;U.command(!(`size`in i)||p>0&&p<=4,`invalid size for attribute "`+e+`", must be 1,2,3,4`,t.commandStr);var m=!!i.normalized,h=0;`type`in i&&(U.commandParameter(i.type,zt,`invalid type for attribute `+e,t.commandStr),h=zt[i.type]);var _=i.divisor|0;U.optional(function(){`divisor`in i&&(U.command(_===0||v,`cannot specify divisor for attribute "`+e+`", instancing not supported`,t.commandStr),U.command(_>=0,`invalid divisor for attribute "`+e+`"`,t.commandStr));var n=t.commandStr,r=[`buffer`,`offset`,`divisor`,`normalized`,`type`,`size`,`stride`];Object.keys(i).forEach(function(t){U.command(r.indexOf(t)>=0,`unknown parameter "`+t+`" for attribute pointer "`+e+`" (valid parameters are `+r+`)`,n)})}),c.buffer=l,c.state=fa,c.size=p,c.normalized=m,c.type=h||l.dtype,c.offset=d,c.stride=f,c.divisor=_}}o[e]=Q(function(e,t){var n=e.attribCache;if(s in n)return n[s];var r={isStream:!1};return Object.keys(c).forEach(function(e){r[e]=c[e]}),c.buffer&&(r.buffer=e.link(c.buffer),r.type=r.type||r.buffer+`.dtype`),n[s]=r,r})}),Object.keys(i).forEach(function(e){var t=i[e];function n(n,r){var i=n.invoke(r,t),a=n.shared,o=n.constants,s=a.isBufferArgs,c=a.buffer;U.optional(function(){n.assert(r,i+`&&(typeof `+i+`==="object"||typeof `+i+`==="function")&&(`+s+`(`+i+`)||`+c+`.getBuffer(`+i+`)||`+c+`.getBuffer(`+i+`.buffer)||`+s+`(`+i+`.buffer)||("constant" in `+i+`&&(typeof `+i+`.constant==="number"||`+a.isArrayLike+`(`+i+`.constant))))`,`invalid dynamic attribute "`+e+`"`)});var l={isStream:r.def(!1)},u=new g;u.state=fa,Object.keys(u).forEach(function(e){l[e]=r.def(``+u[e])});var d=l.buffer,f=l.type;r(`if(`,s,`(`,i,`)){`,l.isStream,`=true;`,d,`=`,c,`.createStream(`,ho,`,`,i,`);`,f,`=`,d,`.dtype;`,`}else{`,d,`=`,c,`.getBuffer(`,i,`);`,`if(`,d,`){`,f,`=`,d,`.dtype;`,`}else if("constant" in `,i,`){`,l.state,`=`,pa,`;`,`if(typeof `+i+`.constant === "number"){`,l[ua[0]],`=`,i,`.constant;`,ua.slice(1).map(function(e){return l[e]}).join(`=`),`=0;`,`}else{`,ua.map(function(e,t){return l[e]+`=`+i+`.constant.length>`+t+`?`+i+`.constant[`+t+`]:0;`}).join(``),`}}else{`,`if(`,s,`(`,i,`.buffer)){`,d,`=`,c,`.createStream(`,ho,`,`,i,`.buffer);`,`}else{`,d,`=`,c,`.getBuffer(`,i,`.buffer);`,`}`,f,`="type" in `,i,`?`,o.glTypes,`[`,i,`.type]:`,d,`.dtype;`,l.normalized,`=!!`,i,`.normalized;`);function p(e){r(l[e],`=`,i,`.`,e,`|0;`)}return p(`size`),p(`offset`),p(`stride`),p(`divisor`),r(`}}`),r.exit(`if(`,l.isStream,`){`,c,`.destroyStream(`,d,`);`,`}`),l}o[e]=$(t,n)}),o}function ae(e){var t=e.static,n=e.dynamic,r={};return Object.keys(t).forEach(function(e){var n=t[e];r[e]=Q(function(e,t){return typeof n==`number`||typeof n==`boolean`?``+n:e.link(n)})}),Object.keys(n).forEach(function(e){var t=n[e];r[e]=$(t,function(e,n){return e.invoke(n,t)})}),r}function oe(e,t,n,i,a){var o=e.static,s=e.dynamic;U.optional(function(){var e=[Ya,Xa,Za,Qa,$a,to,eo,no,Ja,ro].concat(C);function t(t){Object.keys(t).forEach(function(t){U.command(e.indexOf(t)>=0,`unknown parameter "`+t+`"`,a.commandStr)})}t(o),t(s)});var c=F(e,t),l=N(e,a),d=P(e,l,a),f=I(e,a),p=ne(e,a),m=te(e,a,c);function h(e){var t=d[e];t&&(p[e]=t)}h(qa),h(E(Ka));var g={framebuffer:l,draw:f,shader:m,state:p,dirty:Object.keys(p).length>0,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(g.profile=M(e,a),g.uniforms=re(n,a),g.drawVAO=g.scopeVAO=f.vao,!g.drawVAO&&m.program&&!c&&r.angle_instanced_arrays&&f.static.elements){var _=!0,v=m.program.attributes.map(function(e){var n=t.static[e];return _&&=!!n,n});if(_&&v.length>0){var y=u.getVAO(u.createVAO({attributes:v,elements:f.static.elements}));g.drawVAO=new Z(null,null,null,function(e,t){return e.link(y)}),g.useVAO=!0}}return c?(U(!f.elementsActive,`can not combine elements and vertex array objects. element binding state must be specified in vertex array object`),g.useVAO=!0):g.attributes=ie(t,a),g.context=ae(i,a),g}function se(e,t,n){var r=e.shared.context,i=e.scope();Object.keys(n).forEach(function(a){t.save(r,`.`+a);var o=n[a].append(e,t);Array.isArray(o)?i(r,`.`,a,`=[`,o.join(),`];`):i(r,`.`,a,`=`,o,`;`)}),t(i)}function L(e,t,n,r){var i=e.shared,a=i.gl,o=i.framebuffer,s;y&&(s=t.def(i.extensions,`.webgl_draw_buffers`));var c=e.constants,l=c.drawBuffer,u=c.backBuffer,d=n?n.append(e,t):t.def(o,`.next`);r||t(`if(`,d,`!==`,o,`.cur){`),t(`if(`,d,`){`,a,`.bindFramebuffer(`,os,`,`,d,`.framebuffer);`),y&&t(s,`.drawBuffersWEBGL(`,l,`[`,d,`.colorAttachments.length]);`),t(`}else{`,a,`.bindFramebuffer(`,os,`,null);`),y&&t(s,`.drawBuffersWEBGL(`,u,`);`),t(`}`,o,`.cur=`,d,`;`),r||t(`}`)}function ce(e,t,n){var r=e.shared,i=r.gl,a=e.current,o=e.next,s=r.current,c=r.next,l=e.cond(s,`.dirty`);C.forEach(function(t){var r=E(t);if(!(r in n.state)){var u,d;if(r in o){u=o[r],d=a[r];var f=K(x[r].length,function(e){return l.def(u,`[`,e,`]`)});l(e.cond(f.map(function(e,t){return e+`!==`+d+`[`+t+`]`}).join(`||`)).then(i,`.`,T[r],`(`,f,`);`,f.map(function(e,t){return d+`[`+t+`]=`+e}).join(`;`),`;`))}else{u=l.def(c,`.`,r);var p=e.cond(u,`!==`,s,`.`,r);l(p),r in w?p(e.cond(u).then(i,`.enable(`,w[r],`);`).else(i,`.disable(`,w[r],`);`),s,`.`,r,`=`,u,`;`):p(i,`.`,T[r],`(`,u,`);`,s,`.`,r,`=`,u,`;`)}}}),Object.keys(n.state).length===0&&l(s,`.dirty=false;`),t(l)}function R(e,t,n,r){var i=e.shared,a=e.current,o=i.current,s=i.gl;hs(Object.keys(n)).forEach(function(i){var c=n[i];if(!r||r(c)){var l=c.append(e,t);if(w[i]){var u=w[i];gs(c)?l?t(s,`.enable(`,u,`);`):t(s,`.disable(`,u,`);`):t(e.cond(l).then(s,`.enable(`,u,`);`).else(s,`.disable(`,u,`);`)),t(o,`.`,i,`=`,l,`;`)}else if(Y(l)){var d=a[i];t(s,`.`,T[i],`(`,l,`);`,l.map(function(e,t){return d+`[`+t+`]=`+e}).join(`;`),`;`)}else t(s,`.`,T[i],`(`,l,`);`,o,`.`,i,`=`,l,`;`)}})}function z(e,t){v&&(e.instancing=t.def(e.shared.extensions,`.angle_instanced_arrays`))}function B(e,t,n,r,i){var a=e.shared,o=e.stats,s=a.current,c=a.timer,l=n.profile;function u(){return typeof performance>`u`?`Date.now()`:`performance.now()`}var d,f;function p(e){d=t.def(),e(d,`=`,u(),`;`),typeof i==`string`?e(o,`.count+=`,i,`;`):e(o,`.count++;`),m&&(r?(f=t.def(),e(f,`=`,c,`.getNumPendingQueries();`)):e(c,`.beginQuery(`,o,`);`))}function h(e){e(o,`.cpuTime+=`,u(),`-`,d,`;`),m&&(r?e(c,`.pushScopeStats(`,f,`,`,c,`.getNumPendingQueries(),`,o,`);`):e(c,`.endQuery();`))}function g(e){var n=t.def(s,`.profile`);t(s,`.profile=`,e,`;`),t.exit(s,`.profile=`,n,`;`)}var _;if(l){if(gs(l)){l.enable?(p(t),h(t.exit),g(`true`)):g(`false`);return}_=l.append(e,t),g(_)}else _=t.def(s,`.profile`);var v=e.block();p(v),t(`if(`,_,`){`,v,`}`);var y=e.block();h(y),t.exit(`if(`,_,`){`,y,`}`)}function le(e,t,n,r,i){var a=e.shared;function o(e){switch(e){case jo:case Fo:case zo:return 2;case Mo:case Io:case Bo:return 3;case No:case Lo:case Vo:return 4;default:return 1}}function s(n,r,i){var o=a.gl,s=t.def(n,`.location`),c=t.def(a.attributes,`[`,s,`]`),l=i.state,u=i.buffer,d=[i.x,i.y,i.z,i.w],f=[`buffer`,`normalized`,`offset`,`stride`];function p(){t(`if(!`,c,`.buffer){`,o,`.enableVertexAttribArray(`,s,`);}`);var n=i.type,a=i.size?t.def(i.size,`||`,r):r;if(t(`if(`,c,`.type!==`,n,`||`,c,`.size!==`,a,`||`,f.map(function(e){return c+`.`+e+`!==`+i[e]}).join(`||`),`){`,o,`.bindBuffer(`,ho,`,`,u,`.buffer);`,o,`.vertexAttribPointer(`,[s,a,n,i.normalized,i.stride,i.offset],`);`,c,`.type=`,n,`;`,c,`.size=`,a,`;`,f.map(function(e){return c+`.`+e+`=`+i[e]+`;`}).join(``),`}`),v){var l=i.divisor;t(`if(`,c,`.divisor!==`,l,`){`,e.instancing,`.vertexAttribDivisorANGLE(`,[s,l],`);`,c,`.divisor=`,l,`;}`)}}function m(){t(`if(`,c,`.buffer){`,o,`.disableVertexAttribArray(`,s,`);`,c,`.buffer=null;`,`}if(`,ua.map(function(e,t){return c+`.`+e+`!==`+d[t]}).join(`||`),`){`,o,`.vertexAttrib4f(`,s,`,`,d,`);`,ua.map(function(e,t){return c+`.`+e+`=`+d[t]+`;`}).join(``),`}`)}l===fa?p():l===pa?m():(t(`if(`,l,`===`,fa,`){`),p(),t(`}else{`),m(),t(`}`))}r.forEach(function(r){var a=r.name,c=n.attributes[a],l;if(c){if(!i(c))return;l=c.append(e,t)}else{if(!i(_s))return;var u=e.scopeAttrib(a);U.optional(function(){e.assert(t,u+`.state`,`missing attribute `+a)}),l={},Object.keys(new g).forEach(function(e){l[e]=t.def(u,`.`,e)})}s(e.link(r),o(r.info.type),l)})}function V(e,t,r,i,a,o){for(var s=e.shared,c=s.gl,l,u=0;u<i.length;++u){var d=i[u],f=d.name,p=d.info.type,m=r.uniforms[f],h=e.link(d)+`.location`,g;if(m){if(!a(m))continue;if(gs(m)){var _=m.value;if(U.command(_!=null,`missing uniform "`+f+`"`,e.commandStr),p===Go||p===Ko){U.command(typeof _==`function`&&(p===Go&&(_._reglType===`texture2d`||_._reglType===`framebuffer`)||p===Ko&&(_._reglType===`textureCube`||_._reglType===`framebufferCube`)),`invalid texture for uniform `+f,e.commandStr);var v=e.link(_._texture||_.color[0]._texture);t(c,`.uniform1i(`,h,`,`,v+`.bind());`),t.exit(v,`.unbind();`)}else if(p===Ho||p===Uo||p===Wo){U.optional(function(){U.command(Y(_),`invalid matrix for uniform `+f,e.commandStr),U.command(p===Ho&&_.length===4||p===Uo&&_.length===9||p===Wo&&_.length===16,`invalid length for matrix uniform `+f,e.commandStr)});var y=e.global.def(`new Float32Array([`+Array.prototype.slice.call(_)+`])`),b=2;p===Uo?b=3:p===Wo&&(b=4),t(c,`.uniformMatrix`,b,`fv(`,h,`,false,`,y,`);`)}else{switch(p){case Ao:U.commandType(_,`number`,`uniform `+f,e.commandStr),l=`1f`;break;case jo:U.command(Y(_)&&_.length===2,`uniform `+f,e.commandStr),l=`2f`;break;case Mo:U.command(Y(_)&&_.length===3,`uniform `+f,e.commandStr),l=`3f`;break;case No:U.command(Y(_)&&_.length===4,`uniform `+f,e.commandStr),l=`4f`;break;case Ro:U.commandType(_,`boolean`,`uniform `+f,e.commandStr),l=`1i`;break;case Po:U.commandType(_,`number`,`uniform `+f,e.commandStr),l=`1i`;break;case zo:U.command(Y(_)&&_.length===2,`uniform `+f,e.commandStr),l=`2i`;break;case Fo:U.command(Y(_)&&_.length===2,`uniform `+f,e.commandStr),l=`2i`;break;case Bo:U.command(Y(_)&&_.length===3,`uniform `+f,e.commandStr),l=`3i`;break;case Io:U.command(Y(_)&&_.length===3,`uniform `+f,e.commandStr),l=`3i`;break;case Vo:U.command(Y(_)&&_.length===4,`uniform `+f,e.commandStr),l=`4i`;break;case Lo:U.command(Y(_)&&_.length===4,`uniform `+f,e.commandStr),l=`4i`}t(c,`.uniform`,l,`(`,h,`,`,Y(_)?Array.prototype.slice.call(_):_,`);`)}continue}g=m.append(e,t)}else{if(!a(_s))continue;g=t.def(s.uniforms,`[`,n.id(f),`]`)}p===Go?(U(!Array.isArray(g),`must specify a scalar prop for textures`),t(`if(`,g,`&&`,g,`._reglType==="framebuffer"){`,g,`=`,g,`.color[0];`,`}`)):p===Ko&&(U(!Array.isArray(g),`must specify a scalar prop for cube maps`),t(`if(`,g,`&&`,g,`._reglType==="framebufferCube"){`,g,`=`,g,`.color[0];`,`}`)),U.optional(function(){function n(n,r){e.assert(t,n,`bad data or missing for uniform "`+f+`". `+r)}function r(e){U(!Array.isArray(g),`must not specify an array type for uniform`),n(`typeof `+g+`==="`+e+`"`,`invalid type, expected `+e)}function i(t,r){Array.isArray(g)?U(g.length===t,`must have length `+t):n(s.isArrayLike+`(`+g+`)&&`+g+`.length===`+t,`invalid vector, should have length `+t,e.commandStr)}function a(t){U(!Array.isArray(g),`must not specify a value type`),n(`typeof `+g+`==="function"&&`+g+`._reglType==="texture`+(t===yo?`2d`:`Cube`)+`"`,`invalid texture type`,e.commandStr)}switch(p){case Po:r(`number`);break;case Fo:i(2,`number`);break;case Io:i(3,`number`);break;case Lo:i(4,`number`);break;case Ao:r(`number`);break;case jo:i(2,`number`);break;case Mo:i(3,`number`);break;case No:i(4,`number`);break;case Ro:r(`boolean`);break;case zo:i(2,`boolean`);break;case Bo:i(3,`boolean`);break;case Vo:i(4,`boolean`);break;case Ho:i(4,`number`);break;case Uo:i(9,`number`);break;case Wo:i(16,`number`);break;case Go:a(yo);break;case Ko:a(bo)}});var x=1;switch(p){case Go:case Ko:var S=t.def(g,`._texture`);t(c,`.uniform1i(`,h,`,`,S,`.bind());`),t.exit(S,`.unbind();`);continue;case Po:case Ro:l=`1i`;break;case Fo:case zo:l=`2i`,x=2;break;case Io:case Bo:l=`3i`,x=3;break;case Lo:case Vo:l=`4i`,x=4;break;case Ao:l=`1f`;break;case jo:l=`2f`,x=2;break;case Mo:l=`3f`,x=3;break;case No:l=`4f`,x=4;break;case Ho:l=`Matrix2fv`;break;case Uo:l=`Matrix3fv`;break;case Wo:l=`Matrix4fv`}if(l.charAt(0)===`M`){t(c,`.uniform`,l,`(`,h,`,`);var C=(p-Ho+2)**2,w=e.global.def(`new Float32Array(`,C,`)`);Array.isArray(g)?t(`false,(`,K(C,function(e){return w+`[`+e+`]=`+g[e]}),`,`,w,`)`):t(`false,(Array.isArray(`,g,`)||`,g,` instanceof Float32Array)?`,g,`:(`,K(C,function(e){return w+`[`+e+`]=`+g+`[`+e+`]`}),`,`,w,`)`),t(`);`)}else if(x>1){for(var T=[],E=[],D=0;D<x;++D)Array.isArray(g)?E.push(g[D]):E.push(t.def(g+`[`+D+`]`)),o&&T.push(t.def());o&&t(`if(!`,e.batchId,`||`,T.map(function(e,t){return e+`!==`+E[t]}).join(`||`),`){`,T.map(function(e,t){return e+`=`+E[t]+`;`}).join(``)),t(c,`.uniform`,l,`(`,h,`,`,E.join(`,`),`);`),o&&t(`}`)}else{if(U(!Array.isArray(g),`uniform value must not be an array`),o){var O=t.def();t(`if(!`,e.batchId,`||`,O,`!==`,g,`){`,O,`=`,g,`;`)}t(c,`.uniform`,l,`(`,h,`,`,g,`);`),o&&t(`}`)}}}function H(e,t,n,r){var i=e.shared,a=i.gl,o=i.draw,s=r.draw;function c(){var c=s.elements,l,u=t;return c?((c.contextDep&&r.contextDynamic||c.propDep)&&(u=n),s.vaoActive?l=c.append(e,u):(l=c.append(e,u),u(`if(`+l+`)`+a+`.bindBuffer(`+go+`,`+l+`.buffer.buffer);`))):(l=u.def(),u(`if(`,i.vao,`.currentVAO){`,l,`=`,e.shared.elements+`.getElements(`+i.vao,`.currentVAO.elements);`,b?``:`if(`+l+`)`+a+`.bindBuffer(`+go+`,`+l+`.buffer.buffer);`,`}else{`,l,`=`,o,`.`,Qa,`;`,`if(`,l,`){`,a,`.bindBuffer(`,go,`,`,l,`.buffer.buffer);}}`)),l}function l(){var i=s.count,a,c=t;return i?((i.contextDep&&r.contextDynamic||i.propDep)&&(c=n),a=i.append(e,c),U.optional(function(){i.MISSING&&e.assert(t,`false`,`missing vertex count`),i.DYNAMIC&&e.assert(c,a+`>=0`,`missing vertex count`)})):(a=c.def(o,`.`,eo),U.optional(function(){e.assert(c,a+`>=0`,`missing vertex count`)})),a}var u=c();function d(i){var a=s[i];return a?a.contextDep&&r.contextDynamic||a.propDep?a.append(e,n):a.append(e,t):t.def(o,`.`,i)}var f=d($a),p=d(to),m=l();if(typeof m==`number`){if(m===0)return}else n(`if(`,m,`){`),n.exit(`}`);var h,g;v&&(h=d(no),g=e.instancing);var _=u+`.type`,y=s.elements&&gs(s.elements)&&!s.vaoActive;function x(){function e(){n(g,`.drawElementsInstancedANGLE(`,[f,m,_,p+`<<((`+_+`-`+da+`)>>1)`,h],`);`)}function t(){n(g,`.drawArraysInstancedANGLE(`,[f,p,m,h],`);`)}u&&u!==`null`?y?e():(n(`if(`,u,`){`),e(),n(`}else{`),t(),n(`}`)):t()}function S(){function e(){n(a+`.drawElements(`+[f,m,_,p+`<<((`+_+`-`+da+`)>>1)`]+`);`)}function t(){n(a+`.drawArrays(`+[f,p,m]+`);`)}u&&u!==`null`?y?e():(n(`if(`,u,`){`),e(),n(`}else{`),t(),n(`}`)):t()}v&&(typeof h!=`number`||h>=0)?typeof h==`string`?(n(`if(`,h,`>0){`),x(),n(`}else if(`,h,`<0){`),S(),n(`}`)):x():S()}function ue(e,t,n,r,i){var a=j(),o=a.proc(`body`,i);return U.optional(function(){a.commandStr=t.commandStr,a.command=a.link(t.commandStr)}),v&&(a.instancing=o.def(a.shared.extensions,`.angle_instanced_arrays`)),e(a,o,n,r),a.compile().body}function de(e,t,n,r){z(e,t),n.useVAO?n.drawVAO?t(e.shared.vao,`.setVAO(`,n.drawVAO.append(e,t),`);`):t(e.shared.vao,`.setVAO(`,e.shared.vao,`.targetVAO);`):(t(e.shared.vao,`.setVAO(null);`),le(e,t,n,r.attributes,function(){return!0})),V(e,t,n,r.uniforms,function(){return!0},!1),H(e,t,t,n)}function fe(e,t){var n=e.proc(`draw`,1);z(e,n),se(e,n,t.context),L(e,n,t.framebuffer),ce(e,n,t),R(e,n,t.state),B(e,n,t,!1,!0);var r=t.shader.progVar.append(e,n);if(n(e.shared.gl,`.useProgram(`,r,`.program);`),t.shader.program)de(e,n,t,t.shader.program);else{n(e.shared.vao,`.setVAO(null);`);var i=e.global.def(`{}`),a=n.def(r,`.id`),o=n.def(i,`[`,a,`]`);n(e.cond(o).then(o,`.call(this,a0);`).else(o,`=`,i,`[`,a,`]=`,e.link(function(n){return ue(de,e,t,n,1)}),`(`,r,`);`,o,`.call(this,a0);`))}Object.keys(t.state).length>0&&n(e.shared.current,`.dirty=true;`)}function pe(e,t,n,r){e.batchId=`a1`,z(e,t);function i(){return!0}le(e,t,n,r.attributes,i),V(e,t,n,r.uniforms,i,!1),H(e,t,t,n)}function me(e,t,n,r){z(e,t);var i=n.contextDep,a=t.def(),o=`a0`,s=`a1`,c=t.def();e.shared.props=c,e.batchId=a;var l=e.scope(),u=e.scope();t(l.entry,`for(`,a,`=0;`,a,`<`,s,`;++`,a,`){`,c,`=`,o,`[`,a,`];`,u,`}`,l.exit);function d(e){return e.contextDep&&i||e.propDep}function f(e){return!d(e)}if(n.needsContext&&se(e,u,n.context),n.needsFramebuffer&&L(e,u,n.framebuffer),R(e,u,n.state,d),n.profile&&d(n.profile)&&B(e,u,n,!1,!0),r)n.useVAO?n.drawVAO?d(n.drawVAO)?u(e.shared.vao,`.setVAO(`,n.drawVAO.append(e,u),`);`):l(e.shared.vao,`.setVAO(`,n.drawVAO.append(e,l),`);`):l(e.shared.vao,`.setVAO(`,e.shared.vao,`.targetVAO);`):(l(e.shared.vao,`.setVAO(null);`),le(e,l,n,r.attributes,f),le(e,u,n,r.attributes,d)),V(e,l,n,r.uniforms,f,!1),V(e,u,n,r.uniforms,d,!0),H(e,l,u,n);else{var p=e.global.def(`{}`),m=n.shader.progVar.append(e,u),h=u.def(m,`.id`),g=u.def(p,`[`,h,`]`);u(e.shared.gl,`.useProgram(`,m,`.program);`,`if(!`,g,`){`,g,`=`,p,`[`,h,`]=`,e.link(function(t){return ue(pe,e,n,t,2)}),`(`,m,`);}`,g,`.call(this,a0[`,a,`],`,a,`);`)}}function he(e,t){var n=e.proc(`batch`,2);e.batchId=`0`,z(e,n);var r=!1,i=!0;Object.keys(t.context).forEach(function(e){r||=t.context[e].propDep}),r||(se(e,n,t.context),i=!1);var a=t.framebuffer,o=!1;a?(a.propDep?r=o=!0:a.contextDep&&r&&(o=!0),o||L(e,n,a)):L(e,n,null),t.state.viewport&&t.state.viewport.propDep&&(r=!0);function s(e){return e.contextDep&&r||e.propDep}ce(e,n,t),R(e,n,t.state,function(e){return!s(e)}),t.profile&&s(t.profile)||B(e,n,t,!1,`a1`),t.contextDep=r,t.needsContext=i,t.needsFramebuffer=o;var c=t.shader.progVar;if(c.contextDep&&r||c.propDep)me(e,n,t,null);else{var l=c.append(e,n);if(n(e.shared.gl,`.useProgram(`,l,`.program);`),t.shader.program)me(e,n,t,t.shader.program);else{n(e.shared.vao,`.setVAO(null);`);var u=e.global.def(`{}`),d=n.def(l,`.id`),f=n.def(u,`[`,d,`]`);n(e.cond(f).then(f,`.call(this,a0,a1);`).else(f,`=`,u,`[`,d,`]=`,e.link(function(n){return ue(me,e,t,n,2)}),`(`,l,`);`,f,`.call(this,a0,a1);`))}}Object.keys(t.state).length>0&&n(e.shared.current,`.dirty=true;`)}function ge(e,t){var r=e.proc(`scope`,3);e.batchId=`a2`;var i=e.shared,a=i.current;se(e,r,t.context),t.framebuffer&&t.framebuffer.append(e,r),hs(Object.keys(t.state)).forEach(function(n){var a=t.state[n].append(e,r);Y(a)?a.forEach(function(t,i){r.set(e.next[n],`[`+i+`]`,t)}):r.set(i.next,`.`+n,a)}),B(e,r,t,!0,!0),[Qa,to,eo,no,$a].forEach(function(n){var a=t.draw[n];a&&r.set(i.draw,`.`+n,``+a.append(e,r))}),Object.keys(t.uniforms).forEach(function(a){var o=t.uniforms[a].append(e,r);Array.isArray(o)&&(o=`[`+o.join()+`]`),r.set(i.uniforms,`[`+n.id(a)+`]`,o)}),Object.keys(t.attributes).forEach(function(n){var i=t.attributes[n].append(e,r),a=e.scopeAttrib(n);Object.keys(new g).forEach(function(e){r.set(a,`.`+e,i[e])})}),t.scopeVAO&&r.set(i.vao,`.targetVAO`,t.scopeVAO.append(e,r));function o(n){var a=t.shader[n];a&&r.set(i.shader,`.`+n,a.append(e,r))}o(Xa),o(Za),Object.keys(t.state).length>0&&(r(a,`.dirty=true;`),r.exit(a,`.dirty=true;`)),r(`a1(`,e.shared.context,`,a0,`,e.batchId,`);`)}function _e(e){if(!(typeof e!=`object`||Y(e))){for(var t=Object.keys(e),n=0;n<t.length;++n)if(G.isDynamic(e[t[n]]))return!0;return!1}}function W(e,t,n){var r=t.static[n];if(!r||!_e(r))return;var i=e.global,a=Object.keys(r),o=!1,s=!1,c=!1,l=e.global.def(`{}`);a.forEach(function(t){var n=r[t];if(G.isDynamic(n)){typeof n==`function`&&(n=r[t]=G.unbox(n));var a=$(n,null);o||=a.thisDep,c||=a.propDep,s||=a.contextDep}else{switch(i(l,`.`,t,`=`),typeof n){case`number`:i(n);break;case`string`:i(`"`,n,`"`);break;case`object`:Array.isArray(n)&&i(`[`,n.join(),`]`);break;default:i(e.link(n))}i(`;`)}});function u(e,t){a.forEach(function(n){var i=r[n];G.isDynamic(i)&&t(l,`.`,n,`=`,e.invoke(t,i),`;`)})}t.dynamic[n]=new G.DynamicVariable(va,{thisDep:o,contextDep:s,propDep:c,ref:l,append:u}),delete t.static[n]}function ve(e,n,r,i,a){var o=j();o.stats=o.link(a),Object.keys(n.static).forEach(function(e){W(o,n,e)}),mo.forEach(function(t){W(o,e,t)});var s=oe(e,n,r,i,o);return fe(o,s),ge(o,s),he(o,s),t(o.compile(),{destroy:function(){s.shader.program.destroy()}})}return{next:S,current:x,procs:(function(){var e=j(),t=e.proc(`poll`),n=e.proc(`refresh`),a=e.block();t(a),n(a);var o=e.shared,s=o.gl,c=o.next,l=o.current;a(l,`.dirty=false;`),L(e,t),L(e,n,null,!0);var u;v&&(u=e.link(v)),r.oes_vertex_array_object&&n(e.link(r.oes_vertex_array_object),`.bindVertexArrayOES(null);`);for(var d=0;d<i.maxAttributes;++d){var f=n.def(o.attributes,`[`,d,`]`),p=e.cond(f,`.buffer`);p.then(s,`.enableVertexAttribArray(`,d,`);`,s,`.bindBuffer(`,ho,`,`,f,`.buffer.buffer);`,s,`.vertexAttribPointer(`,d,`,`,f,`.size,`,f,`.type,`,f,`.normalized,`,f,`.stride,`,f,`.offset);`).else(s,`.disableVertexAttribArray(`,d,`);`,s,`.vertexAttrib4f(`,d,`,`,f,`.x,`,f,`.y,`,f,`.z,`,f,`.w);`,f,`.buffer=null;`),n(p),v&&n(u,`.vertexAttribDivisorANGLE(`,d,`,`,f,`.divisor);`)}return n(e.shared.vao,`.currentVAO=null;`,e.shared.vao,`.setVAO(`,e.shared.vao,`.targetVAO);`),Object.keys(w).forEach(function(r){var i=w[r],o=a.def(c,`.`,r),u=e.block();u(`if(`,o,`){`,s,`.enable(`,i,`)}else{`,s,`.disable(`,i,`)}`,l,`.`,r,`=`,o,`;`),n(u),t(`if(`,o,`!==`,l,`.`,r,`){`,u,`}`)}),Object.keys(T).forEach(function(r){var i=T[r],o=x[r],u,d,f=e.block();if(f(s,`.`,i,`(`),Y(o)){var p=o.length;u=e.global.def(c,`.`,r),d=e.global.def(l,`.`,r),f(K(p,function(e){return u+`[`+e+`]`}),`);`,K(p,function(e){return d+`[`+e+`]=`+u+`[`+e+`];`}).join(``)),t(`if(`,K(p,function(e){return u+`[`+e+`]!==`+d+`[`+e+`]`}).join(`||`),`){`,f,`}`)}else u=a.def(c,`.`,r),d=a.def(l,`.`,r),f(u,`);`,l,`.`,r,`=`,u,`;`),t(`if(`,u,`!==`,d,`){`,f,`}`);n(f)}),e.compile()})(),compile:ve}}function ys(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var bs=34918,xs=34919,Ss=35007,Cs=function(e,t){if(!t.ext_disjoint_timer_query)return null;var n=[];function r(){return n.pop()||t.ext_disjoint_timer_query.createQueryEXT()}function i(e){n.push(e)}var a=[];function o(e){var n=r();t.ext_disjoint_timer_query.beginQueryEXT(Ss,n),a.push(n),p(a.length-1,a.length,e)}function s(){t.ext_disjoint_timer_query.endQueryEXT(Ss)}function c(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var l=[];function u(){return l.pop()||new c}function d(e){l.push(e)}var f=[];function p(e,t,n){var r=u();r.startQueryIndex=e,r.endQueryIndex=t,r.sum=0,r.stats=n,f.push(r)}var m=[],h=[];function g(){var e,n,r=a.length;if(r!==0){h.length=Math.max(h.length,r+1),m.length=Math.max(m.length,r+1),m[0]=0,h[0]=0;var o=0;for(e=0,n=0;n<a.length;++n){var s=a[n];t.ext_disjoint_timer_query.getQueryObjectEXT(s,xs)?(o+=t.ext_disjoint_timer_query.getQueryObjectEXT(s,bs),i(s)):a[e++]=s,m[n+1]=o,h[n+1]=e}for(a.length=e,e=0,n=0;n<f.length;++n){var c=f[n],l=c.startQueryIndex,u=c.endQueryIndex;c.sum+=m[u]-m[l];var p=h[l],g=h[u];g===p?(c.stats.gpuTime+=c.sum/1e6,d(c)):(c.startQueryIndex=p,c.endQueryIndex=g,f[e++]=c)}f.length=e}}return{beginQuery:o,endQuery:s,pushScopeStats:p,update:g,getNumPendingQueries:function(){return a.length},clear:function(){n.push.apply(n,a);for(var e=0;e<n.length;e++)t.ext_disjoint_timer_query.deleteQueryEXT(n[e]);a.length=0,n.length=0},restore:function(){a.length=0,n.length=0}}},ws=16384,Ts=256,Es=1024,Ds=34962,Os=`webglcontextlost`,ks=`webglcontextrestored`,As=1,js=2,Ms=3;function Ns(e,t){for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}function Ps(e){var n=Ne(e);if(!n)return null;var r=n.gl,i=r.getContextAttributes(),a=r.isContextLost(),o=Pe(r,n);if(!o)return null;var s=Ee(),c=ys(),l=o.extensions,u=Cs(r,l),d=Te(),f=r.drawingBufferWidth,p=r.drawingBufferHeight,m={tick:0,time:0,viewportWidth:f,viewportHeight:p,framebufferWidth:f,framebufferHeight:p,drawingBufferWidth:f,drawingBufferHeight:p,pixelRatio:n.pixelRatio},h={},g={elements:null,primitive:4,count:-1,offset:0,instances:-1},_=kt(r,l),v=Zt(r,c,n,x),y=fn(r,l,v,c),b=Xi(r,l,_,c,v,y,g);function x(e){return b.destroyBuffer(e)}var S=ta(r,s,c,n),C=$r(r,l,_,function(){E.procs.poll()},m,c,n),w=pi(r,l,_,c,n),T=Wi(r,l,_,C,w,c),E=vs(r,s,l,_,v,y,C,T,h,b,S,g,m,u,n),D=oa(r,T,E.procs.poll,m,i,l,_),O=E.next,k=r.canvas,A=[],ee=[],j=[],M=[n.onDestroy],N=null;function P(){if(A.length===0)u&&u.update(),N=null;else{N=we.next(P),R();for(var e=A.length-1;e>=0;--e){var t=A[e];t&&t(m,null,0)}r.flush(),u&&u.update()}}function F(){!N&&A.length>0&&(N=we.next(P))}function te(){N&&=(we.cancel(P),null)}function I(e){e.preventDefault(),a=!0,te(),ee.forEach(function(e){e()})}function ne(e){r.getError(),a=!1,o.restore(),S.restore(),v.restore(),C.restore(),w.restore(),T.restore(),b.restore(),u&&u.restore(),E.procs.refresh(),F(),j.forEach(function(e){e()})}k&&(k.addEventListener(Os,I,!1),k.addEventListener(ks,ne,!1));function re(){A.length=0,te(),k&&(k.removeEventListener(Os,I),k.removeEventListener(ks,ne)),S.clear(),T.clear(),w.clear(),b.clear(),C.clear(),y.clear(),v.clear(),u&&u.clear(),M.forEach(function(e){e()})}function ie(e){U(!!e,`invalid args to regl({...})`),U.type(e,`object`,`invalid args to regl({...})`);function n(e){var n=t({},e);delete n.uniforms,delete n.attributes,delete n.context,delete n.vao,`stencil`in n&&n.stencil.op&&(n.stencil.opBack=n.stencil.opFront=n.stencil.op,delete n.stencil.op);function r(e){if(e in n){var t=n[e];delete n[e],Object.keys(t).forEach(function(r){n[e+`.`+r]=t[r]})}}return r(`blend`),r(`depth`),r(`cull`),r(`stencil`),r(`polygonOffset`),r(`scissor`),r(`sample`),`vao`in e&&(n.vao=e.vao),n}function r(e,t){var n={},r={};return Object.keys(e).forEach(function(i){var a=e[i];if(G.isDynamic(a))r[i]=G.unbox(a,i);else{if(t&&Array.isArray(a)){for(var o=0;o<a.length;++o)if(G.isDynamic(a[o])){r[i]=G.unbox(a,i);return}}n[i]=a}}),{dynamic:r,static:n}}var i=r(e.context||{},!0),o=r(e.uniforms||{},!0),s=r(e.attributes||{},!1),c=r(n(e),!1),l={gpuTime:0,cpuTime:0,count:0},u=E.compile(c,s,o,i,l),d=u.draw,f=u.batch,p=u.scope,m=[];function h(e){for(;m.length<e;)m.push(null);return m}function g(e,t){var n;if(a&&U.raise(`context lost`),typeof e==`function`)return p.call(this,null,e,0);if(typeof t==`function`){if(typeof e==`number`)for(n=0;n<e;++n)p.call(this,null,t,n);else if(Array.isArray(e))for(n=0;n<e.length;++n)p.call(this,e[n],t,n);else return p.call(this,e,t,0)}else if(typeof e==`number`){if(e>0)return f.call(this,h(e|0),e|0)}else if(Array.isArray(e)){if(e.length)return f.call(this,e,e.length)}else return d.call(this,e)}return t(g,{stats:l,destroy:function(){u.destroy()}})}var ae=T.setFBO=ie({framebuffer:G.define.call(null,As,`framebuffer`)});function oe(e,t){var n=0;E.procs.poll();var i=t.color;i&&(r.clearColor(+i[0]||0,+i[1]||0,+i[2]||0,+i[3]||0),n|=ws),`depth`in t&&(r.clearDepth(+t.depth),n|=Ts),`stencil`in t&&(r.clearStencil(t.stencil|0),n|=Es),U(!!n,`called regl.clear with no buffer specified`),r.clear(n)}function se(e){if(U(typeof e==`object`&&e,`regl.clear() takes an object as input`),`framebuffer`in e){if(e.framebuffer&&e.framebuffer_reglType===`framebufferCube`)for(var n=0;n<6;++n)ae(t({framebuffer:e.framebuffer.faces[n]},e),oe);else ae(e,oe)}else oe(null,e)}function L(e){U.type(e,`function`,`regl.frame() callback must be a function`),A.push(e);function t(){var t=Ns(A,e);U(t>=0,`cannot cancel a frame twice`);function n(){var e=Ns(A,n);A[e]=A[A.length-1],--A.length,A.length<=0&&te()}A[t]=n}return F(),{cancel:t}}function ce(){var e=O.viewport,t=O.scissor_box;e[0]=e[1]=t[0]=t[1]=0,m.viewportWidth=m.framebufferWidth=m.drawingBufferWidth=e[2]=t[2]=r.drawingBufferWidth,m.viewportHeight=m.framebufferHeight=m.drawingBufferHeight=e[3]=t[3]=r.drawingBufferHeight}function R(){m.tick+=1,m.time=B(),ce(),E.procs.poll()}function z(){C.refresh(),ce(),E.procs.refresh(),u&&u.update()}function B(){return(Te()-d)/1e3}z();function le(e,t){U.type(t,`function`,`listener callback must be a function`);var n;switch(e){case`frame`:return L(t);case`lost`:n=ee;break;case`restore`:n=j;break;case`destroy`:n=M;break;default:U.raise(`invalid event, must be one of frame,lost,restore,destroy`)}return n.push(t),{cancel:function(){for(var e=0;e<n.length;++e)if(n[e]===t){n[e]=n[n.length-1],n.pop();return}}}}var V=t(ie,{clear:se,prop:G.define.bind(null,As),context:G.define.bind(null,js),this:G.define.bind(null,Ms),draw:ie({}),buffer:function(e){return v.create(e,Ds,!1,!1)},elements:function(e){return y.create(e,!1)},texture:C.create2D,cube:C.createCube,renderbuffer:w.create,framebuffer:T.create,framebufferCube:T.createCube,vao:b.createVAO,attributes:i,frame:L,on:le,limits:_,hasExtension:function(e){return _.extensions.indexOf(e.toLowerCase())>=0},read:D,destroy:re,_gl:r,_refresh:z,poll:function(){R(),u&&u.update()},now:B,stats:c});return n.onDone(null,V),V}return Ps}))}))(),1),U=`precision highp float;
|
|
8
|
+
`);return Function.apply(null,n.concat(t)).apply(null,r)}return{global:c,link:i,block:a,proc:u,scope:o,cond:s,compile:d}}var ua=`xyzw`.split(``),da=5121,fa=1,pa=2,ma=0,ha=1,ga=2,_a=3,va=4,ya=5,ba=6,xa=`dither`,Sa=`blend.enable`,Ca=`blend.color`,wa=`blend.equation`,Ta=`blend.func`,Ea=`depth.enable`,Da=`depth.func`,Oa=`depth.range`,ka=`depth.mask`,Aa=`colorMask`,ja=`cull.enable`,Ma=`cull.face`,Na=`frontFace`,Pa=`lineWidth`,Fa=`polygonOffset.enable`,Ia=`polygonOffset.offset`,La=`sample.alpha`,Ra=`sample.enable`,za=`sample.coverage`,Ba=`stencil.enable`,Va=`stencil.mask`,Ha=`stencil.func`,Ua=`stencil.opFront`,Wa=`stencil.opBack`,Ga=`scissor.enable`,Ka=`scissor.box`,qa=`viewport`,Ja=`profile`,Ya=`framebuffer`,Xa=`vert`,Za=`frag`,Qa=`elements`,$a=`primitive`,eo=`count`,to=`offset`,no=`instances`,ro=`vao`,io=`Width`,ao=`Height`,oo=Ya+io,so=Ya+ao,co=qa+io,lo=qa+ao,uo=`drawingBuffer`,fo=uo+io,po=uo+ao,mo=[Ta,wa,Ha,Ua,Wa,za,qa,Ka,Ia],ho=34962,go=34963,_o=35632,vo=35633,yo=3553,bo=34067,xo=2884,So=3042,Co=3024,wo=2960,To=2929,Eo=3089,Do=32823,Oo=32926,ko=32928,Ao=5126,jo=35664,Mo=35665,No=35666,Po=5124,Fo=35667,Io=35668,Lo=35669,Ro=35670,zo=35671,Bo=35672,Vo=35673,Ho=35674,Uo=35675,Wo=35676,Go=35678,Ko=35680,qo=4,Jo=1028,Yo=1029,Xo=2304,Zo=2305,Qo=32775,$o=32776,es=519,ts=7680,ns=0,rs=1,is=32774,as=513,os=36160,ss=36064,cs={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},ls=[`constant color, constant alpha`,`one minus constant color, constant alpha`,`constant color, one minus constant alpha`,`one minus constant color, one minus constant alpha`,`constant alpha, constant color`,`constant alpha, one minus constant color`,`one minus constant alpha, constant color`,`one minus constant alpha, one minus constant color`],us={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},ds={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},fs={frag:_o,vert:vo},ps={cw:Xo,ccw:Zo};function ms(t){return Array.isArray(t)||e(t)||At(t)}function hs(e){return e.sort(function(e,t){return e===qa?-1:t===qa?1:e<t?-1:1})}function Z(e,t,n,r){this.thisDep=e,this.contextDep=t,this.propDep=n,this.append=r}function gs(e){return e&&!(e.thisDep||e.contextDep||e.propDep)}function Q(e){return new Z(!1,!1,!1,e)}function $(e,t){var n=e.type;if(n===ma){var r=e.data.length;return new Z(!0,r>=1,r>=2,t)}if(n===va){var i=e.data;return new Z(i.thisDep,i.contextDep,i.propDep,t)}if(n===ya)return new Z(!1,!1,!1,t);if(n===ba){for(var a=!1,o=!1,s=!1,c=0;c<e.data.length;++c){var l=e.data[c];if(l.type===ha)s=!0;else if(l.type===ga)o=!0;else if(l.type===_a)a=!0;else if(l.type===ma){a=!0;var u=l.data;u>=1&&(o=!0),u>=2&&(s=!0)}else l.type===va&&(a||=l.data.thisDep,o||=l.data.contextDep,s||=l.data.propDep)}return new Z(a,o,s,t)}return new Z(n===_a,n===ga,n===ha,t)}var _s=new Z(!1,!1,!1,function(){});function vs(e,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=u.Record,_={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(_.min=Qo,_.max=$o);var v=r.angle_instanced_arrays,y=r.webgl_draw_buffers,b=r.oes_vertex_array_object,x={dirty:!0,profile:h.profile},S={},C=[],w={},T={};function E(e){return e.replace(`.`,`_`)}function D(e,t,n){var r=E(e);C.push(e),S[r]=x[r]=!!n,w[r]=t}function O(e,t,n){var r=E(e);C.push(e),Array.isArray(n)?(x[r]=n.slice(),S[r]=n.slice()):x[r]=S[r]=n,T[r]=t}D(xa,Co),D(Sa,So),O(Ca,`blendColor`,[0,0,0,0]),O(wa,`blendEquationSeparate`,[is,is]),O(Ta,`blendFuncSeparate`,[rs,ns,rs,ns]),D(Ea,To,!0),O(Da,`depthFunc`,as),O(Oa,`depthRange`,[0,1]),O(ka,`depthMask`,!0),O(Aa,Aa,[!0,!0,!0,!0]),D(ja,xo),O(Ma,`cullFace`,Yo),O(Na,Na,Zo),O(Pa,Pa,1),D(Fa,Do),O(Ia,`polygonOffset`,[0,0]),D(La,Oo),D(Ra,ko),O(za,`sampleCoverage`,[1,!1]),D(Ba,wo),O(Va,`stencilMask`,-1),O(Ha,`stencilFunc`,[es,0,-1]),O(Ua,`stencilOpSeparate`,[Jo,ts,ts,ts]),O(Wa,`stencilOpSeparate`,[Yo,ts,ts,ts]),D(Ga,Eo),O(Ka,`scissor`,[0,0,e.drawingBufferWidth,e.drawingBufferHeight]),O(qa,qa,[0,0,e.drawingBufferWidth,e.drawingBufferHeight]);var k={gl:e,context:p,strings:n,next:S,current:x,draw:f,elements:o,buffer:a,shader:d,attributes:u.state,vao:u,uniforms:l,framebuffer:c,extensions:r,timer:m,isBufferArgs:ms},A={primTypes:Qt,compareFuncs:us,blendFuncs:cs,blendEquations:_,stencilOps:ds,glTypes:zt,orientationType:ps};U.optional(function(){k.isArrayLike=Y}),y&&(A.backBuffer=[Yo],A.drawBuffer=K(i.maxDrawbuffers,function(e){return e===0?[0]:K(e,function(e){return ss+e})}));var ee=0;function j(){var e=la(),t=e.link,r=e.global;e.id=ee++,e.batchId=`0`;var i=t(k),a=e.shared={props:`a0`};Object.keys(k).forEach(function(e){a[e]=r.def(i,`.`,e)}),U.optional(function(){e.CHECK=t(U),e.commandStr=U.guessCommand(),e.command=t(e.commandStr),e.assert=function(e,n,r){e(`if(!(`,n,`))`,this.CHECK,`.commandRaise(`,t(r),`,`,this.command,`);`)},A.invalidBlendCombinations=ls});var o=e.next={},s=e.current={};Object.keys(T).forEach(function(e){Array.isArray(x[e])&&(o[e]=r.def(a.next,`.`,e),s[e]=r.def(a.current,`.`,e))});var c=e.constants={};Object.keys(A).forEach(function(e){c[e]=r.def(JSON.stringify(A[e]))}),e.invoke=function(n,r){switch(r.type){case ma:var i=[`this`,a.context,a.props,e.batchId];return n.def(t(r.data),`.call(`,i.slice(0,Math.max(r.data.length+1,4)),`)`);case ha:return n.def(a.props,r.data);case ga:return n.def(a.context,r.data);case _a:return n.def(`this`,r.data);case va:return r.data.append(e,n),r.data.ref;case ya:return r.data.toString();case ba:return r.data.map(function(t){return e.invoke(n,t)})}},e.attribCache={};var l={};return e.scopeAttrib=function(e){var r=n.id(e);if(r in l)return l[r];var i=u.scope[r];return i||=u.scope[r]=new g,l[r]=t(i)},e}function M(e){var t=e.static,n=e.dynamic,r;if(Ja in t){var i=!!t[Ja];r=Q(function(e,t){return i}),r.enable=i}else if(Ja in n){var a=n[Ja];r=$(a,function(e,t){return e.invoke(t,a)})}return r}function N(e,t){var n=e.static,r=e.dynamic;if(Ya in n){var i=n[Ya];return i?(i=c.getFramebuffer(i),U.command(i,`invalid framebuffer object`),Q(function(e,t){var n=e.link(i),r=e.shared;t.set(r.framebuffer,`.next`,n);var a=r.context;return t.set(a,`.`+oo,n+`.width`),t.set(a,`.`+so,n+`.height`),n})):Q(function(e,t){var n=e.shared;t.set(n.framebuffer,`.next`,`null`);var r=n.context;return t.set(r,`.`+oo,r+`.`+fo),t.set(r,`.`+so,r+`.`+po),`null`})}if(Ya in r){var a=r[Ya];return $(a,function(e,t){var n=e.invoke(t,a),r=e.shared,i=r.framebuffer,o=t.def(i,`.getFramebuffer(`,n,`)`);U.optional(function(){e.assert(t,`!`+n+`||`+o,`invalid framebuffer object`)}),t.set(i,`.next`,o);var s=r.context;return t.set(s,`.`+oo,o+`?`+o+`.width:`+s+`.`+fo),t.set(s,`.`+so,o+`?`+o+`.height:`+s+`.`+po),o})}return null}function P(e,t,n){var r=e.static,i=e.dynamic;function a(e){if(e in r){var a=r[e];U.commandType(a,`object`,`invalid `+e,n.commandStr);var o=!0,s=a.x|0,c=a.y|0,l,u;return`width`in a?(l=a.width|0,U.command(l>=0,`invalid `+e,n.commandStr)):o=!1,`height`in a?(u=a.height|0,U.command(u>=0,`invalid `+e,n.commandStr)):o=!1,new Z(!o&&t&&t.thisDep,!o&&t&&t.contextDep,!o&&t&&t.propDep,function(e,t){var n=e.shared.context,r=l;`width`in a||(r=t.def(n,`.`,oo,`-`,s));var i=u;return`height`in a||(i=t.def(n,`.`,so,`-`,c)),[s,c,r,i]})}if(e in i){var d=i[e],f=$(d,function(t,n){var r=t.invoke(n,d);U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid `+e)});var i=t.shared.context,a=n.def(r,`.x|0`),o=n.def(r,`.y|0`),s=n.def(`"width" in `,r,`?`,r,`.width|0:`,`(`,i,`.`,oo,`-`,a,`)`),c=n.def(`"height" in `,r,`?`,r,`.height|0:`,`(`,i,`.`,so,`-`,o,`)`);return U.optional(function(){t.assert(n,s+`>=0&&`+c+`>=0`,`invalid `+e)}),[a,o,s,c]});return t&&(f.thisDep=f.thisDep||t.thisDep,f.contextDep=f.contextDep||t.contextDep,f.propDep=f.propDep||t.propDep),f}return t?new Z(t.thisDep,t.contextDep,t.propDep,function(e,t){var n=e.shared.context;return[0,0,t.def(n,`.`,oo),t.def(n,`.`,so)]}):null}var o=a(qa);if(o){var s=o;o=new Z(o.thisDep,o.contextDep,o.propDep,function(e,t){var n=s.append(e,t),r=e.shared.context;return t.set(r,`.`+co,n[2]),t.set(r,`.`+lo,n[3]),n})}return{viewport:o,scissor_box:a(Ka)}}function F(e,t){var n=e.static;if(typeof n[Za]==`string`&&typeof n[Xa]==`string`){if(Object.keys(t.dynamic).length>0)return null;var r=t.static,i=Object.keys(r);if(i.length>0&&typeof r[i[0]]==`number`){for(var a=[],o=0;o<i.length;++o)U(typeof r[i[o]]==`number`,`must specify all vertex attribute locations when using vaos`),a.push([r[i[o]]|0,i[o]]);return a}}return null}function te(e,t,r){var i=e.static,a=e.dynamic;function o(e){if(e in i){var t=n.id(i[e]);U.optional(function(){d.shader(fs[e],t,U.guessCommand())});var r=Q(function(){return t});return r.id=t,r}if(e in a){var o=a[e];return $(o,function(t,n){var r=t.invoke(n,o),i=n.def(t.shared.strings,`.id(`,r,`)`);return U.optional(function(){n(t.shared.shader,`.shader(`,fs[e],`,`,i,`,`,t.command,`);`)}),i})}return null}var s=o(Za),c=o(Xa),l=null,u;return gs(s)&&gs(c)?(l=d.program(c.id,s.id,null,r),u=Q(function(e,t){return e.link(l)})):u=new Z(s&&s.thisDep||c&&c.thisDep,s&&s.contextDep||c&&c.contextDep,s&&s.propDep||c&&c.propDep,function(e,t){var n=e.shared.shader,r=s?s.append(e,t):t.def(n,`.`,Za),i=c?c.append(e,t):t.def(n,`.`,Xa),a=n+`.program(`+i+`,`+r;return U.optional(function(){a+=`,`+e.command}),t.def(a+`)`)}),{frag:s,vert:c,progVar:u,program:l}}function I(e,t){var n=e.static,r=e.dynamic,i={},a=!1,s=!1;function c(){if(ro in n){U(!n.elements&&!r.elements,`cannot specify elements with vao`);var e=n[ro];return e!==null&&u.getVAO(e)===null&&(e=u.createVAO(e)),a=!0,s=!!e,i.vao=e,Q(function(t){var n=u.getVAO(e);return n?t.link(n):`null`})}if(ro in r){U(!n.elements&&!r.elements,`cannot specify elements with vao`),a=!0,s=!0;var t=r[ro];return $(t,function(e,n){var r=e.invoke(n,t);return n.def(e.shared.vao+`.getVAO(`+r+`)`)})}return null}var l=c(),d=!1;function f(){if(Qa in n){U(!s,`must not specify vao and elements`);var e=n[Qa];if(i.elements=e,ms(e)){var c=i.elements=o.create(e,!0);e=o.getElements(c),d=!0}else e&&(e=o.getElements(e),d=!0,U.command(e,`invalid elements`,t.commandStr));var u=Q(function(t,n){if(e){var r=t.link(e);return t.ELEMENTS=r,r}return t.ELEMENTS=null,null});return u.value=e,u}if(Qa in r){U(!s,`must not specify vao and elements`),d=!0;var f=r[Qa];return $(f,function(e,t){var n=e.shared,r=n.isBufferArgs,i=n.elements,a=e.invoke(t,f),o=t.def(`null`),s=t.def(r,`(`,a,`)`),c=e.cond(s).then(o,`=`,i,`.createStream(`,a,`);`).else(o,`=`,i,`.getElements(`,a,`);`);return U.optional(function(){e.assert(c.else,`!`+a+`||`+o,`invalid elements`)}),t.entry(c),t.exit(e.cond(s).then(i,`.destroyStream(`,o,`);`)),e.ELEMENTS=o,o})}return a?new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.elements+`.getElements(`+e.shared.vao+`.currentVAO.elements):null`)}):null}var p=f();d&&(l=Q(function(){return`null`}));function m(){if($a in n){var e=n[$a];return i.primitive=e,U.commandParameter(e,Qt,`invalid primitve`,t.commandStr),Q(function(t,n){return Qt[e]})}if($a in r){var o=r[$a];return $(o,function(e,t){var n=e.constants.primTypes,r=e.invoke(t,o);return U.optional(function(){e.assert(t,r+` in `+n,`invalid primitive, must be one of `+Object.keys(Qt))}),t.def(n,`[`,r,`]`)})}return d?gs(p)?p.value?Q(function(e,t){return t.def(e.ELEMENTS,`.primType`)}):Q(function(){return qo}):new Z(p.thisDep,p.contextDep,p.propDep,function(e,t){var n=e.ELEMENTS;return t.def(n,`?`,n,`.primType:`,qo)}):a?new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.vao+`.currentVAO.primitive:`+qo)}):null}function h(e,o){if(e in n){var s=n[e]|0;return o?i.offset=s:i.instances=s,U.command(!o||s>=0,`invalid `+e,t.commandStr),Q(function(e,t){return o&&(e.OFFSET=s),s})}if(e in r){var c=r[e];return $(c,function(t,n){var r=t.invoke(n,c);return o&&(t.OFFSET=r,U.optional(function(){t.assert(n,r+`>=0`,`invalid `+e)})),r})}if(o){if(d)return Q(function(e,t){return e.OFFSET=0,0});if(a)return new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.vao+`.currentVAO.offset:0`)})}else if(a)return new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao+`.currentVAO?`+e.shared.vao+`.currentVAO.instances:-1`)});return null}var g=h(to,!0);function _(){if(eo in n){var e=n[eo]|0;return i.count=e,U.command(typeof e==`number`&&e>=0,`invalid vertex count`,t.commandStr),Q(function(){return e})}if(eo in r){var o=r[eo];return $(o,function(e,t){var n=e.invoke(t,o);return U.optional(function(){e.assert(t,`typeof `+n+`==="number"&&`+n+`>=0&&`+n+`===(`+n+`|0)`,`invalid vertex count`)}),n})}if(d){if(gs(p)){if(p)return g?new Z(g.thisDep,g.contextDep,g.propDep,function(e,t){var n=t.def(e.ELEMENTS,`.vertCount-`,e.OFFSET);return U.optional(function(){e.assert(t,n+`>=0`,`invalid vertex offset/element buffer too small`)}),n}):Q(function(e,t){return t.def(e.ELEMENTS,`.vertCount`)});var s=Q(function(){return-1});return U.optional(function(){s.MISSING=!0}),s}var c=new Z(p.thisDep||g.thisDep,p.contextDep||g.contextDep,p.propDep||g.propDep,function(e,t){var n=e.ELEMENTS;return e.OFFSET?t.def(n,`?`,n,`.vertCount-`,e.OFFSET,`:-1`):t.def(n,`?`,n,`.vertCount:-1`)});return U.optional(function(){c.DYNAMIC=!0}),c}return a?new Z(l.thisDep,l.contextDep,l.propDep,function(e,t){return t.def(e.shared.vao,`.currentVAO?`,e.shared.vao,`.currentVAO.count:-1`)}):null}return{elements:p,primitive:m(),count:_(),instances:h(no,!1),offset:g,vao:l,vaoActive:a,elementsActive:d,static:i}}function ne(e,t){var n=e.static,r=e.dynamic,a={};return C.forEach(function(e){var o=E(e);function s(t,i){if(e in n){var s=t(n[e]);a[o]=Q(function(){return s})}else if(e in r){var c=r[e];a[o]=$(c,function(e,t){return i(e,t,e.invoke(t,c))})}}switch(e){case ja:case Sa:case xa:case Ba:case Ea:case Ga:case Fa:case La:case Ra:case ka:return s(function(n){return U.commandType(n,`boolean`,e,t.commandStr),n},function(t,n,r){return U.optional(function(){t.assert(n,`typeof `+r+`==="boolean"`,`invalid flag `+e,t.commandStr)}),r});case Da:return s(function(n){return U.commandParameter(n,us,`invalid `+e,t.commandStr),us[n]},function(t,n,r){var i=t.constants.compareFuncs;return U.optional(function(){t.assert(n,r+` in `+i,`invalid `+e+`, must be one of `+Object.keys(us))}),n.def(i,`[`,r,`]`)});case Oa:return s(function(e){return U.command(Y(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`&&e[0]<=e[1],`depth range is 2d array`,t.commandStr),e},function(e,t,n){return U.optional(function(){e.assert(t,e.shared.isArrayLike+`(`+n+`)&&`+n+`.length===2&&typeof `+n+`[0]==="number"&&typeof `+n+`[1]==="number"&&`+n+`[0]<=`+n+`[1]`,`depth range must be a 2d array`)}),[t.def(`+`,n,`[0]`),t.def(`+`,n,`[1]`)]});case Ta:return s(function(e){U.commandType(e,`object`,`blend.func`,t.commandStr);var n=`srcRGB`in e?e.srcRGB:e.src,r=`srcAlpha`in e?e.srcAlpha:e.src,i=`dstRGB`in e?e.dstRGB:e.dst,a=`dstAlpha`in e?e.dstAlpha:e.dst;return U.commandParameter(n,cs,o+`.srcRGB`,t.commandStr),U.commandParameter(r,cs,o+`.srcAlpha`,t.commandStr),U.commandParameter(i,cs,o+`.dstRGB`,t.commandStr),U.commandParameter(a,cs,o+`.dstAlpha`,t.commandStr),U.command(ls.indexOf(n+`, `+i)===-1,`unallowed blending combination (srcRGB, dstRGB) = (`+n+`, `+i+`)`,t.commandStr),[cs[n],cs[i],cs[r],cs[a]]},function(t,n,r){var i=t.constants.blendFuncs;U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid blend func, must be an object`)});function a(a,o){var s=n.def(`"`,a,o,`" in `,r,`?`,r,`.`,a,o,`:`,r,`.`,a);return U.optional(function(){t.assert(n,s+` in `+i,`invalid `+e+`.`+a+o+`, must be one of `+Object.keys(cs))}),s}var o=a(`src`,`RGB`),s=a(`dst`,`RGB`);U.optional(function(){var e=t.constants.invalidBlendCombinations;t.assert(n,e+`.indexOf(`+o+`+", "+`+s+`) === -1 `,`unallowed blending combination for (srcRGB, dstRGB)`)});var c=n.def(i,`[`,o,`]`),l=n.def(i,`[`,a(`src`,`Alpha`),`]`);return[c,n.def(i,`[`,s,`]`),l,n.def(i,`[`,a(`dst`,`Alpha`),`]`)]});case wa:return s(function(n){if(typeof n==`string`)return U.commandParameter(n,_,`invalid `+e,t.commandStr),[_[n],_[n]];if(typeof n==`object`)return U.commandParameter(n.rgb,_,e+`.rgb`,t.commandStr),U.commandParameter(n.alpha,_,e+`.alpha`,t.commandStr),[_[n.rgb],_[n.alpha]];U.commandRaise(`invalid blend.equation`,t.commandStr)},function(t,n,r){var i=t.constants.blendEquations,a=n.def(),o=n.def(),s=t.cond(`typeof `,r,`==="string"`);return U.optional(function(){function n(e,n,r){t.assert(e,r+` in `+i,`invalid `+n+`, must be one of `+Object.keys(_))}n(s.then,e,r),t.assert(s.else,r+`&&typeof `+r+`==="object"`,`invalid `+e),n(s.else,e+`.rgb`,r+`.rgb`),n(s.else,e+`.alpha`,r+`.alpha`)}),s.then(a,`=`,o,`=`,i,`[`,r,`];`),s.else(a,`=`,i,`[`,r,`.rgb];`,o,`=`,i,`[`,r,`.alpha];`),n(s),[a,o]});case Ca:return s(function(e){return U.command(Y(e)&&e.length===4,`blend.color must be a 4d array`,t.commandStr),K(4,function(t){return+e[t]})},function(e,t,n){return U.optional(function(){e.assert(t,e.shared.isArrayLike+`(`+n+`)&&`+n+`.length===4`,`blend.color must be a 4d array`)}),K(4,function(e){return t.def(`+`,n,`[`,e,`]`)})});case Va:return s(function(e){return U.commandType(e,`number`,o,t.commandStr),e|0},function(e,t,n){return U.optional(function(){e.assert(t,`typeof `+n+`==="number"`,`invalid stencil.mask`)}),t.def(n,`|0`)});case Ha:return s(function(n){U.commandType(n,`object`,o,t.commandStr);var r=n.cmp||`keep`,i=n.ref||0,a=`mask`in n?n.mask:-1;return U.commandParameter(r,us,e+`.cmp`,t.commandStr),U.commandType(i,`number`,e+`.ref`,t.commandStr),U.commandType(a,`number`,e+`.mask`,t.commandStr),[us[r],i,a]},function(e,t,n){var r=e.constants.compareFuncs;return U.optional(function(){function i(){e.assert(t,Array.prototype.join.call(arguments,``),`invalid stencil.func`)}i(n+`&&typeof `,n,`==="object"`),i(`!("cmp" in `,n,`)||(`,n,`.cmp in `,r,`)`)}),[t.def(`"cmp" in `,n,`?`,r,`[`,n,`.cmp]`,`:`,ts),t.def(n,`.ref|0`),t.def(`"mask" in `,n,`?`,n,`.mask|0:-1`)]});case Ua:case Wa:return s(function(n){U.commandType(n,`object`,o,t.commandStr);var r=n.fail||`keep`,i=n.zfail||`keep`,a=n.zpass||`keep`;return U.commandParameter(r,ds,e+`.fail`,t.commandStr),U.commandParameter(i,ds,e+`.zfail`,t.commandStr),U.commandParameter(a,ds,e+`.zpass`,t.commandStr),[e===Wa?Yo:Jo,ds[r],ds[i],ds[a]]},function(t,n,r){var i=t.constants.stencilOps;U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid `+e)});function a(a){return U.optional(function(){t.assert(n,`!("`+a+`" in `+r+`)||(`+r+`.`+a+` in `+i+`)`,`invalid `+e+`.`+a+`, must be one of `+Object.keys(ds))}),n.def(`"`,a,`" in `,r,`?`,i,`[`,r,`.`,a,`]:`,ts)}return[e===Wa?Yo:Jo,a(`fail`),a(`zfail`),a(`zpass`)]});case Ia:return s(function(e){U.commandType(e,`object`,o,t.commandStr);var n=e.factor|0,r=e.units|0;return U.commandType(n,`number`,o+`.factor`,t.commandStr),U.commandType(r,`number`,o+`.units`,t.commandStr),[n,r]},function(t,n,r){return U.optional(function(){t.assert(n,r+`&&typeof `+r+`==="object"`,`invalid `+e)}),[n.def(r,`.factor|0`),n.def(r,`.units|0`)]});case Ma:return s(function(e){var n=0;return e===`front`?n=Jo:e===`back`&&(n=Yo),U.command(!!n,o,t.commandStr),n},function(e,t,n){return U.optional(function(){e.assert(t,n+`==="front"||`+n+`==="back"`,`invalid cull.face`)}),t.def(n,`==="front"?`,Jo,`:`,Yo)});case Pa:return s(function(e){return U.command(typeof e==`number`&&e>=i.lineWidthDims[0]&&e<=i.lineWidthDims[1],`invalid line width, must be a positive number between `+i.lineWidthDims[0]+` and `+i.lineWidthDims[1],t.commandStr),e},function(e,t,n){return U.optional(function(){e.assert(t,`typeof `+n+`==="number"&&`+n+`>=`+i.lineWidthDims[0]+`&&`+n+`<=`+i.lineWidthDims[1],`invalid line width`)}),n});case Na:return s(function(e){return U.commandParameter(e,ps,o,t.commandStr),ps[e]},function(e,t,n){return U.optional(function(){e.assert(t,n+`==="cw"||`+n+`==="ccw"`,`invalid frontFace, must be one of cw,ccw`)}),t.def(n+`==="cw"?`+Xo+`:`+Zo)});case Aa:return s(function(e){return U.command(Y(e)&&e.length===4,`color.mask must be length 4 array`,t.commandStr),e.map(function(e){return!!e})},function(e,t,n){return U.optional(function(){e.assert(t,e.shared.isArrayLike+`(`+n+`)&&`+n+`.length===4`,`invalid color.mask`)}),K(4,function(e){return`!!`+n+`[`+e+`]`})});case za:return s(function(e){U.command(typeof e==`object`&&e,o,t.commandStr);var n=`value`in e?e.value:1,r=!!e.invert;return U.command(typeof n==`number`&&n>=0&&n<=1,`sample.coverage.value must be a number between 0 and 1`,t.commandStr),[n,r]},function(e,t,n){return U.optional(function(){e.assert(t,n+`&&typeof `+n+`==="object"`,`invalid sample.coverage`)}),[t.def(`"value" in `,n,`?+`,n,`.value:1`),t.def(`!!`,n,`.invert`)]})}}),a}function re(e,t){var n=e.static,r=e.dynamic,i={};return Object.keys(n).forEach(function(e){var r=n[e],a;if(typeof r==`number`||typeof r==`boolean`)a=Q(function(){return r});else if(typeof r==`function`){var o=r._reglType;o===`texture2d`||o===`textureCube`?a=Q(function(e){return e.link(r)}):o===`framebuffer`||o===`framebufferCube`?(U.command(r.color.length>0,`missing color attachment for framebuffer sent to uniform "`+e+`"`,t.commandStr),a=Q(function(e){return e.link(r.color[0])})):U.commandRaise(`invalid data for uniform "`+e+`"`,t.commandStr)}else Y(r)?a=Q(function(t){return t.global.def(`[`,K(r.length,function(n){return U.command(typeof r[n]==`number`||typeof r[n]==`boolean`,`invalid uniform `+e,t.commandStr),r[n]}),`]`)}):U.commandRaise(`invalid or missing data for uniform "`+e+`"`,t.commandStr);a.value=r,i[e]=a}),Object.keys(r).forEach(function(e){var t=r[e];i[e]=$(t,function(e,n){return e.invoke(n,t)})}),i}function ie(e,t){var r=e.static,i=e.dynamic,o={};return Object.keys(r).forEach(function(e){var i=r[e],s=n.id(e),c=new g;if(ms(i))c.state=fa,c.buffer=a.getBuffer(a.create(i,ho,!1,!0)),c.type=0;else{var l=a.getBuffer(i);if(l)c.state=fa,c.buffer=l,c.type=0;else if(U.command(typeof i==`object`&&i,`invalid data for attribute `+e,t.commandStr),`constant`in i){var u=i.constant;c.buffer=`null`,c.state=pa,typeof u==`number`?c.x=u:(U.command(Y(u)&&u.length>0&&u.length<=4,`invalid constant for attribute `+e,t.commandStr),ua.forEach(function(e,t){t<u.length&&(c[e]=u[t])}))}else{l=ms(i.buffer)?a.getBuffer(a.create(i.buffer,ho,!1,!0)):a.getBuffer(i.buffer),U.command(!!l,`missing buffer for attribute "`+e+`"`,t.commandStr);var d=i.offset|0;U.command(d>=0,`invalid offset for attribute "`+e+`"`,t.commandStr);var f=i.stride|0;U.command(f>=0&&f<256,`invalid stride for attribute "`+e+`", must be integer betweeen [0, 255]`,t.commandStr);var p=i.size|0;U.command(!(`size`in i)||p>0&&p<=4,`invalid size for attribute "`+e+`", must be 1,2,3,4`,t.commandStr);var m=!!i.normalized,h=0;`type`in i&&(U.commandParameter(i.type,zt,`invalid type for attribute `+e,t.commandStr),h=zt[i.type]);var _=i.divisor|0;U.optional(function(){`divisor`in i&&(U.command(_===0||v,`cannot specify divisor for attribute "`+e+`", instancing not supported`,t.commandStr),U.command(_>=0,`invalid divisor for attribute "`+e+`"`,t.commandStr));var n=t.commandStr,r=[`buffer`,`offset`,`divisor`,`normalized`,`type`,`size`,`stride`];Object.keys(i).forEach(function(t){U.command(r.indexOf(t)>=0,`unknown parameter "`+t+`" for attribute pointer "`+e+`" (valid parameters are `+r+`)`,n)})}),c.buffer=l,c.state=fa,c.size=p,c.normalized=m,c.type=h||l.dtype,c.offset=d,c.stride=f,c.divisor=_}}o[e]=Q(function(e,t){var n=e.attribCache;if(s in n)return n[s];var r={isStream:!1};return Object.keys(c).forEach(function(e){r[e]=c[e]}),c.buffer&&(r.buffer=e.link(c.buffer),r.type=r.type||r.buffer+`.dtype`),n[s]=r,r})}),Object.keys(i).forEach(function(e){var t=i[e];function n(n,r){var i=n.invoke(r,t),a=n.shared,o=n.constants,s=a.isBufferArgs,c=a.buffer;U.optional(function(){n.assert(r,i+`&&(typeof `+i+`==="object"||typeof `+i+`==="function")&&(`+s+`(`+i+`)||`+c+`.getBuffer(`+i+`)||`+c+`.getBuffer(`+i+`.buffer)||`+s+`(`+i+`.buffer)||("constant" in `+i+`&&(typeof `+i+`.constant==="number"||`+a.isArrayLike+`(`+i+`.constant))))`,`invalid dynamic attribute "`+e+`"`)});var l={isStream:r.def(!1)},u=new g;u.state=fa,Object.keys(u).forEach(function(e){l[e]=r.def(``+u[e])});var d=l.buffer,f=l.type;r(`if(`,s,`(`,i,`)){`,l.isStream,`=true;`,d,`=`,c,`.createStream(`,ho,`,`,i,`);`,f,`=`,d,`.dtype;`,`}else{`,d,`=`,c,`.getBuffer(`,i,`);`,`if(`,d,`){`,f,`=`,d,`.dtype;`,`}else if("constant" in `,i,`){`,l.state,`=`,pa,`;`,`if(typeof `+i+`.constant === "number"){`,l[ua[0]],`=`,i,`.constant;`,ua.slice(1).map(function(e){return l[e]}).join(`=`),`=0;`,`}else{`,ua.map(function(e,t){return l[e]+`=`+i+`.constant.length>`+t+`?`+i+`.constant[`+t+`]:0;`}).join(``),`}}else{`,`if(`,s,`(`,i,`.buffer)){`,d,`=`,c,`.createStream(`,ho,`,`,i,`.buffer);`,`}else{`,d,`=`,c,`.getBuffer(`,i,`.buffer);`,`}`,f,`="type" in `,i,`?`,o.glTypes,`[`,i,`.type]:`,d,`.dtype;`,l.normalized,`=!!`,i,`.normalized;`);function p(e){r(l[e],`=`,i,`.`,e,`|0;`)}return p(`size`),p(`offset`),p(`stride`),p(`divisor`),r(`}}`),r.exit(`if(`,l.isStream,`){`,c,`.destroyStream(`,d,`);`,`}`),l}o[e]=$(t,n)}),o}function ae(e){var t=e.static,n=e.dynamic,r={};return Object.keys(t).forEach(function(e){var n=t[e];r[e]=Q(function(e,t){return typeof n==`number`||typeof n==`boolean`?``+n:e.link(n)})}),Object.keys(n).forEach(function(e){var t=n[e];r[e]=$(t,function(e,n){return e.invoke(n,t)})}),r}function oe(e,t,n,i,a){var o=e.static,s=e.dynamic;U.optional(function(){var e=[Ya,Xa,Za,Qa,$a,to,eo,no,Ja,ro].concat(C);function t(t){Object.keys(t).forEach(function(t){U.command(e.indexOf(t)>=0,`unknown parameter "`+t+`"`,a.commandStr)})}t(o),t(s)});var c=F(e,t),l=N(e,a),d=P(e,l,a),f=I(e,a),p=ne(e,a),m=te(e,a,c);function h(e){var t=d[e];t&&(p[e]=t)}h(qa),h(E(Ka));var g={framebuffer:l,draw:f,shader:m,state:p,dirty:Object.keys(p).length>0,scopeVAO:null,drawVAO:null,useVAO:!1,attributes:{}};if(g.profile=M(e,a),g.uniforms=re(n,a),g.drawVAO=g.scopeVAO=f.vao,!g.drawVAO&&m.program&&!c&&r.angle_instanced_arrays&&f.static.elements){var _=!0,v=m.program.attributes.map(function(e){var n=t.static[e];return _&&=!!n,n});if(_&&v.length>0){var y=u.getVAO(u.createVAO({attributes:v,elements:f.static.elements}));g.drawVAO=new Z(null,null,null,function(e,t){return e.link(y)}),g.useVAO=!0}}return c?(U(!f.elementsActive,`can not combine elements and vertex array objects. element binding state must be specified in vertex array object`),g.useVAO=!0):g.attributes=ie(t,a),g.context=ae(i,a),g}function se(e,t,n){var r=e.shared.context,i=e.scope();Object.keys(n).forEach(function(a){t.save(r,`.`+a);var o=n[a].append(e,t);Array.isArray(o)?i(r,`.`,a,`=[`,o.join(),`];`):i(r,`.`,a,`=`,o,`;`)}),t(i)}function L(e,t,n,r){var i=e.shared,a=i.gl,o=i.framebuffer,s;y&&(s=t.def(i.extensions,`.webgl_draw_buffers`));var c=e.constants,l=c.drawBuffer,u=c.backBuffer,d=n?n.append(e,t):t.def(o,`.next`);r||t(`if(`,d,`!==`,o,`.cur){`),t(`if(`,d,`){`,a,`.bindFramebuffer(`,os,`,`,d,`.framebuffer);`),y&&t(s,`.drawBuffersWEBGL(`,l,`[`,d,`.colorAttachments.length]);`),t(`}else{`,a,`.bindFramebuffer(`,os,`,null);`),y&&t(s,`.drawBuffersWEBGL(`,u,`);`),t(`}`,o,`.cur=`,d,`;`),r||t(`}`)}function ce(e,t,n){var r=e.shared,i=r.gl,a=e.current,o=e.next,s=r.current,c=r.next,l=e.cond(s,`.dirty`);C.forEach(function(t){var r=E(t);if(!(r in n.state)){var u,d;if(r in o){u=o[r],d=a[r];var f=K(x[r].length,function(e){return l.def(u,`[`,e,`]`)});l(e.cond(f.map(function(e,t){return e+`!==`+d+`[`+t+`]`}).join(`||`)).then(i,`.`,T[r],`(`,f,`);`,f.map(function(e,t){return d+`[`+t+`]=`+e}).join(`;`),`;`))}else{u=l.def(c,`.`,r);var p=e.cond(u,`!==`,s,`.`,r);l(p),r in w?p(e.cond(u).then(i,`.enable(`,w[r],`);`).else(i,`.disable(`,w[r],`);`),s,`.`,r,`=`,u,`;`):p(i,`.`,T[r],`(`,u,`);`,s,`.`,r,`=`,u,`;`)}}}),Object.keys(n.state).length===0&&l(s,`.dirty=false;`),t(l)}function R(e,t,n,r){var i=e.shared,a=e.current,o=i.current,s=i.gl;hs(Object.keys(n)).forEach(function(i){var c=n[i];if(!r||r(c)){var l=c.append(e,t);if(w[i]){var u=w[i];gs(c)?l?t(s,`.enable(`,u,`);`):t(s,`.disable(`,u,`);`):t(e.cond(l).then(s,`.enable(`,u,`);`).else(s,`.disable(`,u,`);`)),t(o,`.`,i,`=`,l,`;`)}else if(Y(l)){var d=a[i];t(s,`.`,T[i],`(`,l,`);`,l.map(function(e,t){return d+`[`+t+`]=`+e}).join(`;`),`;`)}else t(s,`.`,T[i],`(`,l,`);`,o,`.`,i,`=`,l,`;`)}})}function z(e,t){v&&(e.instancing=t.def(e.shared.extensions,`.angle_instanced_arrays`))}function B(e,t,n,r,i){var a=e.shared,o=e.stats,s=a.current,c=a.timer,l=n.profile;function u(){return typeof performance>`u`?`Date.now()`:`performance.now()`}var d,f;function p(e){d=t.def(),e(d,`=`,u(),`;`),typeof i==`string`?e(o,`.count+=`,i,`;`):e(o,`.count++;`),m&&(r?(f=t.def(),e(f,`=`,c,`.getNumPendingQueries();`)):e(c,`.beginQuery(`,o,`);`))}function h(e){e(o,`.cpuTime+=`,u(),`-`,d,`;`),m&&(r?e(c,`.pushScopeStats(`,f,`,`,c,`.getNumPendingQueries(),`,o,`);`):e(c,`.endQuery();`))}function g(e){var n=t.def(s,`.profile`);t(s,`.profile=`,e,`;`),t.exit(s,`.profile=`,n,`;`)}var _;if(l){if(gs(l)){l.enable?(p(t),h(t.exit),g(`true`)):g(`false`);return}_=l.append(e,t),g(_)}else _=t.def(s,`.profile`);var v=e.block();p(v),t(`if(`,_,`){`,v,`}`);var y=e.block();h(y),t.exit(`if(`,_,`){`,y,`}`)}function le(e,t,n,r,i){var a=e.shared;function o(e){switch(e){case jo:case Fo:case zo:return 2;case Mo:case Io:case Bo:return 3;case No:case Lo:case Vo:return 4;default:return 1}}function s(n,r,i){var o=a.gl,s=t.def(n,`.location`),c=t.def(a.attributes,`[`,s,`]`),l=i.state,u=i.buffer,d=[i.x,i.y,i.z,i.w],f=[`buffer`,`normalized`,`offset`,`stride`];function p(){t(`if(!`,c,`.buffer){`,o,`.enableVertexAttribArray(`,s,`);}`);var n=i.type,a=i.size?t.def(i.size,`||`,r):r;if(t(`if(`,c,`.type!==`,n,`||`,c,`.size!==`,a,`||`,f.map(function(e){return c+`.`+e+`!==`+i[e]}).join(`||`),`){`,o,`.bindBuffer(`,ho,`,`,u,`.buffer);`,o,`.vertexAttribPointer(`,[s,a,n,i.normalized,i.stride,i.offset],`);`,c,`.type=`,n,`;`,c,`.size=`,a,`;`,f.map(function(e){return c+`.`+e+`=`+i[e]+`;`}).join(``),`}`),v){var l=i.divisor;t(`if(`,c,`.divisor!==`,l,`){`,e.instancing,`.vertexAttribDivisorANGLE(`,[s,l],`);`,c,`.divisor=`,l,`;}`)}}function m(){t(`if(`,c,`.buffer){`,o,`.disableVertexAttribArray(`,s,`);`,c,`.buffer=null;`,`}if(`,ua.map(function(e,t){return c+`.`+e+`!==`+d[t]}).join(`||`),`){`,o,`.vertexAttrib4f(`,s,`,`,d,`);`,ua.map(function(e,t){return c+`.`+e+`=`+d[t]+`;`}).join(``),`}`)}l===fa?p():l===pa?m():(t(`if(`,l,`===`,fa,`){`),p(),t(`}else{`),m(),t(`}`))}r.forEach(function(r){var a=r.name,c=n.attributes[a],l;if(c){if(!i(c))return;l=c.append(e,t)}else{if(!i(_s))return;var u=e.scopeAttrib(a);U.optional(function(){e.assert(t,u+`.state`,`missing attribute `+a)}),l={},Object.keys(new g).forEach(function(e){l[e]=t.def(u,`.`,e)})}s(e.link(r),o(r.info.type),l)})}function V(e,t,r,i,a,o){for(var s=e.shared,c=s.gl,l,u=0;u<i.length;++u){var d=i[u],f=d.name,p=d.info.type,m=r.uniforms[f],h=e.link(d)+`.location`,g;if(m){if(!a(m))continue;if(gs(m)){var _=m.value;if(U.command(_!=null,`missing uniform "`+f+`"`,e.commandStr),p===Go||p===Ko){U.command(typeof _==`function`&&(p===Go&&(_._reglType===`texture2d`||_._reglType===`framebuffer`)||p===Ko&&(_._reglType===`textureCube`||_._reglType===`framebufferCube`)),`invalid texture for uniform `+f,e.commandStr);var v=e.link(_._texture||_.color[0]._texture);t(c,`.uniform1i(`,h,`,`,v+`.bind());`),t.exit(v,`.unbind();`)}else if(p===Ho||p===Uo||p===Wo){U.optional(function(){U.command(Y(_),`invalid matrix for uniform `+f,e.commandStr),U.command(p===Ho&&_.length===4||p===Uo&&_.length===9||p===Wo&&_.length===16,`invalid length for matrix uniform `+f,e.commandStr)});var y=e.global.def(`new Float32Array([`+Array.prototype.slice.call(_)+`])`),b=2;p===Uo?b=3:p===Wo&&(b=4),t(c,`.uniformMatrix`,b,`fv(`,h,`,false,`,y,`);`)}else{switch(p){case Ao:U.commandType(_,`number`,`uniform `+f,e.commandStr),l=`1f`;break;case jo:U.command(Y(_)&&_.length===2,`uniform `+f,e.commandStr),l=`2f`;break;case Mo:U.command(Y(_)&&_.length===3,`uniform `+f,e.commandStr),l=`3f`;break;case No:U.command(Y(_)&&_.length===4,`uniform `+f,e.commandStr),l=`4f`;break;case Ro:U.commandType(_,`boolean`,`uniform `+f,e.commandStr),l=`1i`;break;case Po:U.commandType(_,`number`,`uniform `+f,e.commandStr),l=`1i`;break;case zo:U.command(Y(_)&&_.length===2,`uniform `+f,e.commandStr),l=`2i`;break;case Fo:U.command(Y(_)&&_.length===2,`uniform `+f,e.commandStr),l=`2i`;break;case Bo:U.command(Y(_)&&_.length===3,`uniform `+f,e.commandStr),l=`3i`;break;case Io:U.command(Y(_)&&_.length===3,`uniform `+f,e.commandStr),l=`3i`;break;case Vo:U.command(Y(_)&&_.length===4,`uniform `+f,e.commandStr),l=`4i`;break;case Lo:U.command(Y(_)&&_.length===4,`uniform `+f,e.commandStr),l=`4i`}t(c,`.uniform`,l,`(`,h,`,`,Y(_)?Array.prototype.slice.call(_):_,`);`)}continue}g=m.append(e,t)}else{if(!a(_s))continue;g=t.def(s.uniforms,`[`,n.id(f),`]`)}p===Go?(U(!Array.isArray(g),`must specify a scalar prop for textures`),t(`if(`,g,`&&`,g,`._reglType==="framebuffer"){`,g,`=`,g,`.color[0];`,`}`)):p===Ko&&(U(!Array.isArray(g),`must specify a scalar prop for cube maps`),t(`if(`,g,`&&`,g,`._reglType==="framebufferCube"){`,g,`=`,g,`.color[0];`,`}`)),U.optional(function(){function n(n,r){e.assert(t,n,`bad data or missing for uniform "`+f+`". `+r)}function r(e){U(!Array.isArray(g),`must not specify an array type for uniform`),n(`typeof `+g+`==="`+e+`"`,`invalid type, expected `+e)}function i(t,r){Array.isArray(g)?U(g.length===t,`must have length `+t):n(s.isArrayLike+`(`+g+`)&&`+g+`.length===`+t,`invalid vector, should have length `+t,e.commandStr)}function a(t){U(!Array.isArray(g),`must not specify a value type`),n(`typeof `+g+`==="function"&&`+g+`._reglType==="texture`+(t===yo?`2d`:`Cube`)+`"`,`invalid texture type`,e.commandStr)}switch(p){case Po:r(`number`);break;case Fo:i(2,`number`);break;case Io:i(3,`number`);break;case Lo:i(4,`number`);break;case Ao:r(`number`);break;case jo:i(2,`number`);break;case Mo:i(3,`number`);break;case No:i(4,`number`);break;case Ro:r(`boolean`);break;case zo:i(2,`boolean`);break;case Bo:i(3,`boolean`);break;case Vo:i(4,`boolean`);break;case Ho:i(4,`number`);break;case Uo:i(9,`number`);break;case Wo:i(16,`number`);break;case Go:a(yo);break;case Ko:a(bo)}});var x=1;switch(p){case Go:case Ko:var S=t.def(g,`._texture`);t(c,`.uniform1i(`,h,`,`,S,`.bind());`),t.exit(S,`.unbind();`);continue;case Po:case Ro:l=`1i`;break;case Fo:case zo:l=`2i`,x=2;break;case Io:case Bo:l=`3i`,x=3;break;case Lo:case Vo:l=`4i`,x=4;break;case Ao:l=`1f`;break;case jo:l=`2f`,x=2;break;case Mo:l=`3f`,x=3;break;case No:l=`4f`,x=4;break;case Ho:l=`Matrix2fv`;break;case Uo:l=`Matrix3fv`;break;case Wo:l=`Matrix4fv`}if(l.charAt(0)===`M`){t(c,`.uniform`,l,`(`,h,`,`);var C=(p-Ho+2)**2,w=e.global.def(`new Float32Array(`,C,`)`);Array.isArray(g)?t(`false,(`,K(C,function(e){return w+`[`+e+`]=`+g[e]}),`,`,w,`)`):t(`false,(Array.isArray(`,g,`)||`,g,` instanceof Float32Array)?`,g,`:(`,K(C,function(e){return w+`[`+e+`]=`+g+`[`+e+`]`}),`,`,w,`)`),t(`);`)}else if(x>1){for(var T=[],E=[],D=0;D<x;++D)Array.isArray(g)?E.push(g[D]):E.push(t.def(g+`[`+D+`]`)),o&&T.push(t.def());o&&t(`if(!`,e.batchId,`||`,T.map(function(e,t){return e+`!==`+E[t]}).join(`||`),`){`,T.map(function(e,t){return e+`=`+E[t]+`;`}).join(``)),t(c,`.uniform`,l,`(`,h,`,`,E.join(`,`),`);`),o&&t(`}`)}else{if(U(!Array.isArray(g),`uniform value must not be an array`),o){var O=t.def();t(`if(!`,e.batchId,`||`,O,`!==`,g,`){`,O,`=`,g,`;`)}t(c,`.uniform`,l,`(`,h,`,`,g,`);`),o&&t(`}`)}}}function H(e,t,n,r){var i=e.shared,a=i.gl,o=i.draw,s=r.draw;function c(){var c=s.elements,l,u=t;return c?((c.contextDep&&r.contextDynamic||c.propDep)&&(u=n),s.vaoActive?l=c.append(e,u):(l=c.append(e,u),u(`if(`+l+`)`+a+`.bindBuffer(`+go+`,`+l+`.buffer.buffer);`))):(l=u.def(),u(`if(`,i.vao,`.currentVAO){`,l,`=`,e.shared.elements+`.getElements(`+i.vao,`.currentVAO.elements);`,b?``:`if(`+l+`)`+a+`.bindBuffer(`+go+`,`+l+`.buffer.buffer);`,`}else{`,l,`=`,o,`.`,Qa,`;`,`if(`,l,`){`,a,`.bindBuffer(`,go,`,`,l,`.buffer.buffer);}}`)),l}function l(){var i=s.count,a,c=t;return i?((i.contextDep&&r.contextDynamic||i.propDep)&&(c=n),a=i.append(e,c),U.optional(function(){i.MISSING&&e.assert(t,`false`,`missing vertex count`),i.DYNAMIC&&e.assert(c,a+`>=0`,`missing vertex count`)})):(a=c.def(o,`.`,eo),U.optional(function(){e.assert(c,a+`>=0`,`missing vertex count`)})),a}var u=c();function d(i){var a=s[i];return a?a.contextDep&&r.contextDynamic||a.propDep?a.append(e,n):a.append(e,t):t.def(o,`.`,i)}var f=d($a),p=d(to),m=l();if(typeof m==`number`){if(m===0)return}else n(`if(`,m,`){`),n.exit(`}`);var h,g;v&&(h=d(no),g=e.instancing);var _=u+`.type`,y=s.elements&&gs(s.elements)&&!s.vaoActive;function x(){function e(){n(g,`.drawElementsInstancedANGLE(`,[f,m,_,p+`<<((`+_+`-`+da+`)>>1)`,h],`);`)}function t(){n(g,`.drawArraysInstancedANGLE(`,[f,p,m,h],`);`)}u&&u!==`null`?y?e():(n(`if(`,u,`){`),e(),n(`}else{`),t(),n(`}`)):t()}function S(){function e(){n(a+`.drawElements(`+[f,m,_,p+`<<((`+_+`-`+da+`)>>1)`]+`);`)}function t(){n(a+`.drawArrays(`+[f,p,m]+`);`)}u&&u!==`null`?y?e():(n(`if(`,u,`){`),e(),n(`}else{`),t(),n(`}`)):t()}v&&(typeof h!=`number`||h>=0)?typeof h==`string`?(n(`if(`,h,`>0){`),x(),n(`}else if(`,h,`<0){`),S(),n(`}`)):x():S()}function ue(e,t,n,r,i){var a=j(),o=a.proc(`body`,i);return U.optional(function(){a.commandStr=t.commandStr,a.command=a.link(t.commandStr)}),v&&(a.instancing=o.def(a.shared.extensions,`.angle_instanced_arrays`)),e(a,o,n,r),a.compile().body}function de(e,t,n,r){z(e,t),n.useVAO?n.drawVAO?t(e.shared.vao,`.setVAO(`,n.drawVAO.append(e,t),`);`):t(e.shared.vao,`.setVAO(`,e.shared.vao,`.targetVAO);`):(t(e.shared.vao,`.setVAO(null);`),le(e,t,n,r.attributes,function(){return!0})),V(e,t,n,r.uniforms,function(){return!0},!1),H(e,t,t,n)}function fe(e,t){var n=e.proc(`draw`,1);z(e,n),se(e,n,t.context),L(e,n,t.framebuffer),ce(e,n,t),R(e,n,t.state),B(e,n,t,!1,!0);var r=t.shader.progVar.append(e,n);if(n(e.shared.gl,`.useProgram(`,r,`.program);`),t.shader.program)de(e,n,t,t.shader.program);else{n(e.shared.vao,`.setVAO(null);`);var i=e.global.def(`{}`),a=n.def(r,`.id`),o=n.def(i,`[`,a,`]`);n(e.cond(o).then(o,`.call(this,a0);`).else(o,`=`,i,`[`,a,`]=`,e.link(function(n){return ue(de,e,t,n,1)}),`(`,r,`);`,o,`.call(this,a0);`))}Object.keys(t.state).length>0&&n(e.shared.current,`.dirty=true;`)}function pe(e,t,n,r){e.batchId=`a1`,z(e,t);function i(){return!0}le(e,t,n,r.attributes,i),V(e,t,n,r.uniforms,i,!1),H(e,t,t,n)}function me(e,t,n,r){z(e,t);var i=n.contextDep,a=t.def(),o=`a0`,s=`a1`,c=t.def();e.shared.props=c,e.batchId=a;var l=e.scope(),u=e.scope();t(l.entry,`for(`,a,`=0;`,a,`<`,s,`;++`,a,`){`,c,`=`,o,`[`,a,`];`,u,`}`,l.exit);function d(e){return e.contextDep&&i||e.propDep}function f(e){return!d(e)}if(n.needsContext&&se(e,u,n.context),n.needsFramebuffer&&L(e,u,n.framebuffer),R(e,u,n.state,d),n.profile&&d(n.profile)&&B(e,u,n,!1,!0),r)n.useVAO?n.drawVAO?d(n.drawVAO)?u(e.shared.vao,`.setVAO(`,n.drawVAO.append(e,u),`);`):l(e.shared.vao,`.setVAO(`,n.drawVAO.append(e,l),`);`):l(e.shared.vao,`.setVAO(`,e.shared.vao,`.targetVAO);`):(l(e.shared.vao,`.setVAO(null);`),le(e,l,n,r.attributes,f),le(e,u,n,r.attributes,d)),V(e,l,n,r.uniforms,f,!1),V(e,u,n,r.uniforms,d,!0),H(e,l,u,n);else{var p=e.global.def(`{}`),m=n.shader.progVar.append(e,u),h=u.def(m,`.id`),g=u.def(p,`[`,h,`]`);u(e.shared.gl,`.useProgram(`,m,`.program);`,`if(!`,g,`){`,g,`=`,p,`[`,h,`]=`,e.link(function(t){return ue(pe,e,n,t,2)}),`(`,m,`);}`,g,`.call(this,a0[`,a,`],`,a,`);`)}}function he(e,t){var n=e.proc(`batch`,2);e.batchId=`0`,z(e,n);var r=!1,i=!0;Object.keys(t.context).forEach(function(e){r||=t.context[e].propDep}),r||(se(e,n,t.context),i=!1);var a=t.framebuffer,o=!1;a?(a.propDep?r=o=!0:a.contextDep&&r&&(o=!0),o||L(e,n,a)):L(e,n,null),t.state.viewport&&t.state.viewport.propDep&&(r=!0);function s(e){return e.contextDep&&r||e.propDep}ce(e,n,t),R(e,n,t.state,function(e){return!s(e)}),(!t.profile||!s(t.profile))&&B(e,n,t,!1,`a1`),t.contextDep=r,t.needsContext=i,t.needsFramebuffer=o;var c=t.shader.progVar;if(c.contextDep&&r||c.propDep)me(e,n,t,null);else{var l=c.append(e,n);if(n(e.shared.gl,`.useProgram(`,l,`.program);`),t.shader.program)me(e,n,t,t.shader.program);else{n(e.shared.vao,`.setVAO(null);`);var u=e.global.def(`{}`),d=n.def(l,`.id`),f=n.def(u,`[`,d,`]`);n(e.cond(f).then(f,`.call(this,a0,a1);`).else(f,`=`,u,`[`,d,`]=`,e.link(function(n){return ue(me,e,t,n,2)}),`(`,l,`);`,f,`.call(this,a0,a1);`))}}Object.keys(t.state).length>0&&n(e.shared.current,`.dirty=true;`)}function ge(e,t){var r=e.proc(`scope`,3);e.batchId=`a2`;var i=e.shared,a=i.current;se(e,r,t.context),t.framebuffer&&t.framebuffer.append(e,r),hs(Object.keys(t.state)).forEach(function(n){var a=t.state[n].append(e,r);Y(a)?a.forEach(function(t,i){r.set(e.next[n],`[`+i+`]`,t)}):r.set(i.next,`.`+n,a)}),B(e,r,t,!0,!0),[Qa,to,eo,no,$a].forEach(function(n){var a=t.draw[n];a&&r.set(i.draw,`.`+n,``+a.append(e,r))}),Object.keys(t.uniforms).forEach(function(a){var o=t.uniforms[a].append(e,r);Array.isArray(o)&&(o=`[`+o.join()+`]`),r.set(i.uniforms,`[`+n.id(a)+`]`,o)}),Object.keys(t.attributes).forEach(function(n){var i=t.attributes[n].append(e,r),a=e.scopeAttrib(n);Object.keys(new g).forEach(function(e){r.set(a,`.`+e,i[e])})}),t.scopeVAO&&r.set(i.vao,`.targetVAO`,t.scopeVAO.append(e,r));function o(n){var a=t.shader[n];a&&r.set(i.shader,`.`+n,a.append(e,r))}o(Xa),o(Za),Object.keys(t.state).length>0&&(r(a,`.dirty=true;`),r.exit(a,`.dirty=true;`)),r(`a1(`,e.shared.context,`,a0,`,e.batchId,`);`)}function _e(e){if(!(typeof e!=`object`||Y(e))){for(var t=Object.keys(e),n=0;n<t.length;++n)if(G.isDynamic(e[t[n]]))return!0;return!1}}function W(e,t,n){var r=t.static[n];if(!r||!_e(r))return;var i=e.global,a=Object.keys(r),o=!1,s=!1,c=!1,l=e.global.def(`{}`);a.forEach(function(t){var n=r[t];if(G.isDynamic(n)){typeof n==`function`&&(n=r[t]=G.unbox(n));var a=$(n,null);o||=a.thisDep,c||=a.propDep,s||=a.contextDep}else{switch(i(l,`.`,t,`=`),typeof n){case`number`:i(n);break;case`string`:i(`"`,n,`"`);break;case`object`:Array.isArray(n)&&i(`[`,n.join(),`]`);break;default:i(e.link(n))}i(`;`)}});function u(e,t){a.forEach(function(n){var i=r[n];G.isDynamic(i)&&t(l,`.`,n,`=`,e.invoke(t,i),`;`)})}t.dynamic[n]=new G.DynamicVariable(va,{thisDep:o,contextDep:s,propDep:c,ref:l,append:u}),delete t.static[n]}function ve(e,n,r,i,a){var o=j();o.stats=o.link(a),Object.keys(n.static).forEach(function(e){W(o,n,e)}),mo.forEach(function(t){W(o,e,t)});var s=oe(e,n,r,i,o);return fe(o,s),ge(o,s),he(o,s),t(o.compile(),{destroy:function(){s.shader.program.destroy()}})}return{next:S,current:x,procs:(function(){var e=j(),t=e.proc(`poll`),n=e.proc(`refresh`),a=e.block();t(a),n(a);var o=e.shared,s=o.gl,c=o.next,l=o.current;a(l,`.dirty=false;`),L(e,t),L(e,n,null,!0);var u;v&&(u=e.link(v)),r.oes_vertex_array_object&&n(e.link(r.oes_vertex_array_object),`.bindVertexArrayOES(null);`);for(var d=0;d<i.maxAttributes;++d){var f=n.def(o.attributes,`[`,d,`]`),p=e.cond(f,`.buffer`);p.then(s,`.enableVertexAttribArray(`,d,`);`,s,`.bindBuffer(`,ho,`,`,f,`.buffer.buffer);`,s,`.vertexAttribPointer(`,d,`,`,f,`.size,`,f,`.type,`,f,`.normalized,`,f,`.stride,`,f,`.offset);`).else(s,`.disableVertexAttribArray(`,d,`);`,s,`.vertexAttrib4f(`,d,`,`,f,`.x,`,f,`.y,`,f,`.z,`,f,`.w);`,f,`.buffer=null;`),n(p),v&&n(u,`.vertexAttribDivisorANGLE(`,d,`,`,f,`.divisor);`)}return n(e.shared.vao,`.currentVAO=null;`,e.shared.vao,`.setVAO(`,e.shared.vao,`.targetVAO);`),Object.keys(w).forEach(function(r){var i=w[r],o=a.def(c,`.`,r),u=e.block();u(`if(`,o,`){`,s,`.enable(`,i,`)}else{`,s,`.disable(`,i,`)}`,l,`.`,r,`=`,o,`;`),n(u),t(`if(`,o,`!==`,l,`.`,r,`){`,u,`}`)}),Object.keys(T).forEach(function(r){var i=T[r],o=x[r],u,d,f=e.block();if(f(s,`.`,i,`(`),Y(o)){var p=o.length;u=e.global.def(c,`.`,r),d=e.global.def(l,`.`,r),f(K(p,function(e){return u+`[`+e+`]`}),`);`,K(p,function(e){return d+`[`+e+`]=`+u+`[`+e+`];`}).join(``)),t(`if(`,K(p,function(e){return u+`[`+e+`]!==`+d+`[`+e+`]`}).join(`||`),`){`,f,`}`)}else u=a.def(c,`.`,r),d=a.def(l,`.`,r),f(u,`);`,l,`.`,r,`=`,u,`;`),t(`if(`,u,`!==`,d,`){`,f,`}`);n(f)}),e.compile()})(),compile:ve}}function ys(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var bs=34918,xs=34919,Ss=35007,Cs=function(e,t){if(!t.ext_disjoint_timer_query)return null;var n=[];function r(){return n.pop()||t.ext_disjoint_timer_query.createQueryEXT()}function i(e){n.push(e)}var a=[];function o(e){var n=r();t.ext_disjoint_timer_query.beginQueryEXT(Ss,n),a.push(n),p(a.length-1,a.length,e)}function s(){t.ext_disjoint_timer_query.endQueryEXT(Ss)}function c(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null}var l=[];function u(){return l.pop()||new c}function d(e){l.push(e)}var f=[];function p(e,t,n){var r=u();r.startQueryIndex=e,r.endQueryIndex=t,r.sum=0,r.stats=n,f.push(r)}var m=[],h=[];function g(){var e,n,r=a.length;if(r!==0){h.length=Math.max(h.length,r+1),m.length=Math.max(m.length,r+1),m[0]=0,h[0]=0;var o=0;for(e=0,n=0;n<a.length;++n){var s=a[n];t.ext_disjoint_timer_query.getQueryObjectEXT(s,xs)?(o+=t.ext_disjoint_timer_query.getQueryObjectEXT(s,bs),i(s)):a[e++]=s,m[n+1]=o,h[n+1]=e}for(a.length=e,e=0,n=0;n<f.length;++n){var c=f[n],l=c.startQueryIndex,u=c.endQueryIndex;c.sum+=m[u]-m[l];var p=h[l],g=h[u];g===p?(c.stats.gpuTime+=c.sum/1e6,d(c)):(c.startQueryIndex=p,c.endQueryIndex=g,f[e++]=c)}f.length=e}}return{beginQuery:o,endQuery:s,pushScopeStats:p,update:g,getNumPendingQueries:function(){return a.length},clear:function(){n.push.apply(n,a);for(var e=0;e<n.length;e++)t.ext_disjoint_timer_query.deleteQueryEXT(n[e]);a.length=0,n.length=0},restore:function(){a.length=0,n.length=0}}},ws=16384,Ts=256,Es=1024,Ds=34962,Os=`webglcontextlost`,ks=`webglcontextrestored`,As=1,js=2,Ms=3;function Ns(e,t){for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}function Ps(e){var n=Ne(e);if(!n)return null;var r=n.gl,i=r.getContextAttributes(),a=r.isContextLost(),o=Pe(r,n);if(!o)return null;var s=Ee(),c=ys(),l=o.extensions,u=Cs(r,l),d=Te(),f=r.drawingBufferWidth,p=r.drawingBufferHeight,m={tick:0,time:0,viewportWidth:f,viewportHeight:p,framebufferWidth:f,framebufferHeight:p,drawingBufferWidth:f,drawingBufferHeight:p,pixelRatio:n.pixelRatio},h={},g={elements:null,primitive:4,count:-1,offset:0,instances:-1},_=kt(r,l),v=Zt(r,c,n,x),y=fn(r,l,v,c),b=Xi(r,l,_,c,v,y,g);function x(e){return b.destroyBuffer(e)}var S=ta(r,s,c,n),C=$r(r,l,_,function(){E.procs.poll()},m,c,n),w=pi(r,l,_,c,n),T=Wi(r,l,_,C,w,c),E=vs(r,s,l,_,v,y,C,T,h,b,S,g,m,u,n),D=oa(r,T,E.procs.poll,m,i,l,_),O=E.next,k=r.canvas,A=[],ee=[],j=[],M=[n.onDestroy],N=null;function P(){if(A.length===0)u&&u.update(),N=null;else{N=we.next(P),R();for(var e=A.length-1;e>=0;--e){var t=A[e];t&&t(m,null,0)}r.flush(),u&&u.update()}}function F(){!N&&A.length>0&&(N=we.next(P))}function te(){N&&=(we.cancel(P),null)}function I(e){e.preventDefault(),a=!0,te(),ee.forEach(function(e){e()})}function ne(e){r.getError(),a=!1,o.restore(),S.restore(),v.restore(),C.restore(),w.restore(),T.restore(),b.restore(),u&&u.restore(),E.procs.refresh(),F(),j.forEach(function(e){e()})}k&&(k.addEventListener(Os,I,!1),k.addEventListener(ks,ne,!1));function re(){A.length=0,te(),k&&(k.removeEventListener(Os,I),k.removeEventListener(ks,ne)),S.clear(),T.clear(),w.clear(),b.clear(),C.clear(),y.clear(),v.clear(),u&&u.clear(),M.forEach(function(e){e()})}function ie(e){U(!!e,`invalid args to regl({...})`),U.type(e,`object`,`invalid args to regl({...})`);function n(e){var n=t({},e);delete n.uniforms,delete n.attributes,delete n.context,delete n.vao,`stencil`in n&&n.stencil.op&&(n.stencil.opBack=n.stencil.opFront=n.stencil.op,delete n.stencil.op);function r(e){if(e in n){var t=n[e];delete n[e],Object.keys(t).forEach(function(r){n[e+`.`+r]=t[r]})}}return r(`blend`),r(`depth`),r(`cull`),r(`stencil`),r(`polygonOffset`),r(`scissor`),r(`sample`),`vao`in e&&(n.vao=e.vao),n}function r(e,t){var n={},r={};return Object.keys(e).forEach(function(i){var a=e[i];if(G.isDynamic(a))r[i]=G.unbox(a,i);else{if(t&&Array.isArray(a)){for(var o=0;o<a.length;++o)if(G.isDynamic(a[o])){r[i]=G.unbox(a,i);return}}n[i]=a}}),{dynamic:r,static:n}}var i=r(e.context||{},!0),o=r(e.uniforms||{},!0),s=r(e.attributes||{},!1),c=r(n(e),!1),l={gpuTime:0,cpuTime:0,count:0},u=E.compile(c,s,o,i,l),d=u.draw,f=u.batch,p=u.scope,m=[];function h(e){for(;m.length<e;)m.push(null);return m}function g(e,t){var n;if(a&&U.raise(`context lost`),typeof e==`function`)return p.call(this,null,e,0);if(typeof t==`function`){if(typeof e==`number`)for(n=0;n<e;++n)p.call(this,null,t,n);else if(Array.isArray(e))for(n=0;n<e.length;++n)p.call(this,e[n],t,n);else return p.call(this,e,t,0)}else if(typeof e==`number`){if(e>0)return f.call(this,h(e|0),e|0)}else if(Array.isArray(e)){if(e.length)return f.call(this,e,e.length)}else return d.call(this,e)}return t(g,{stats:l,destroy:function(){u.destroy()}})}var ae=T.setFBO=ie({framebuffer:G.define.call(null,As,`framebuffer`)});function oe(e,t){var n=0;E.procs.poll();var i=t.color;i&&(r.clearColor(+i[0]||0,+i[1]||0,+i[2]||0,+i[3]||0),n|=ws),`depth`in t&&(r.clearDepth(+t.depth),n|=Ts),`stencil`in t&&(r.clearStencil(t.stencil|0),n|=Es),U(!!n,`called regl.clear with no buffer specified`),r.clear(n)}function se(e){if(U(typeof e==`object`&&e,`regl.clear() takes an object as input`),`framebuffer`in e){if(e.framebuffer&&e.framebuffer_reglType===`framebufferCube`)for(var n=0;n<6;++n)ae(t({framebuffer:e.framebuffer.faces[n]},e),oe);else ae(e,oe)}else oe(null,e)}function L(e){U.type(e,`function`,`regl.frame() callback must be a function`),A.push(e);function t(){var t=Ns(A,e);U(t>=0,`cannot cancel a frame twice`);function n(){var e=Ns(A,n);A[e]=A[A.length-1],--A.length,A.length<=0&&te()}A[t]=n}return F(),{cancel:t}}function ce(){var e=O.viewport,t=O.scissor_box;e[0]=e[1]=t[0]=t[1]=0,m.viewportWidth=m.framebufferWidth=m.drawingBufferWidth=e[2]=t[2]=r.drawingBufferWidth,m.viewportHeight=m.framebufferHeight=m.drawingBufferHeight=e[3]=t[3]=r.drawingBufferHeight}function R(){m.tick+=1,m.time=B(),ce(),E.procs.poll()}function z(){C.refresh(),ce(),E.procs.refresh(),u&&u.update()}function B(){return(Te()-d)/1e3}z();function le(e,t){U.type(t,`function`,`listener callback must be a function`);var n;switch(e){case`frame`:return L(t);case`lost`:n=ee;break;case`restore`:n=j;break;case`destroy`:n=M;break;default:U.raise(`invalid event, must be one of frame,lost,restore,destroy`)}return n.push(t),{cancel:function(){for(var e=0;e<n.length;++e)if(n[e]===t){n[e]=n[n.length-1],n.pop();return}}}}var V=t(ie,{clear:se,prop:G.define.bind(null,As),context:G.define.bind(null,js),this:G.define.bind(null,Ms),draw:ie({}),buffer:function(e){return v.create(e,Ds,!1,!1)},elements:function(e){return y.create(e,!1)},texture:C.create2D,cube:C.createCube,renderbuffer:w.create,framebuffer:T.create,framebufferCube:T.createCube,vao:b.createVAO,attributes:i,frame:L,on:le,limits:_,hasExtension:function(e){return _.extensions.indexOf(e.toLowerCase())>=0},read:D,destroy:re,_gl:r,_refresh:z,poll:function(){R(),u&&u.update()},now:B,stats:c});return n.onDone(null,V),V}return Ps}))}))(),1),U=`precision highp float;
|
|
9
9
|
#define GLSLIFY 1
|
|
10
10
|
|
|
11
11
|
varying highp vec2 uv;
|
|
@@ -2778,7 +2778,7 @@ struct LightProperties {
|
|
|
2778
2778
|
|
|
2779
2779
|
struct PostData {
|
|
2780
2780
|
#ifdef GLSLIFY_HACK
|
|
2781
|
-
float
|
|
2781
|
+
float foo_0;
|
|
2782
2782
|
#endif
|
|
2783
2783
|
mediump float gamma, exposure;
|
|
2784
2784
|
mediump vec4 fogParams, fogParams2, fogParams3;
|
|
@@ -2786,7 +2786,7 @@ struct PostData {
|
|
|
2786
2786
|
|
|
2787
2787
|
struct PostFrag {
|
|
2788
2788
|
#ifdef GLSLIFY_HACK
|
|
2789
|
-
float
|
|
2789
|
+
float foo_3;
|
|
2790
2790
|
#endif
|
|
2791
2791
|
highp vec3 eye, position;
|
|
2792
2792
|
mediump vec4 color;
|
|
@@ -3477,7 +3477,7 @@ uniform lowp vec3 pbrMod;
|
|
|
3477
3477
|
|
|
3478
3478
|
struct SurfaceProperties {
|
|
3479
3479
|
#ifdef GLSLIFY_HACK
|
|
3480
|
-
float
|
|
3480
|
+
float foo_1;
|
|
3481
3481
|
#endif
|
|
3482
3482
|
highp vec3 position;
|
|
3483
3483
|
mediump vec3 normal, faceU, faceV;
|
|
@@ -3494,7 +3494,7 @@ struct SurfaceProperties {
|
|
|
3494
3494
|
|
|
3495
3495
|
struct LightProperties {
|
|
3496
3496
|
#ifdef GLSLIFY_HACK
|
|
3497
|
-
float
|
|
3497
|
+
float foo_2;
|
|
3498
3498
|
#endif
|
|
3499
3499
|
mediump vec3 direction, color, skyLeft, skyRight, skyTop, skyBottom, skyFront, skyBack;
|
|
3500
3500
|
mediump float globalLight;
|
|
@@ -3502,7 +3502,7 @@ struct LightProperties {
|
|
|
3502
3502
|
|
|
3503
3503
|
struct PostData {
|
|
3504
3504
|
#ifdef GLSLIFY_HACK
|
|
3505
|
-
float
|
|
3505
|
+
float foo_0;
|
|
3506
3506
|
#endif
|
|
3507
3507
|
mediump float gamma, exposure;
|
|
3508
3508
|
mediump vec4 fogParams, fogParams2, fogParams3;
|
|
@@ -3510,7 +3510,7 @@ struct PostData {
|
|
|
3510
3510
|
|
|
3511
3511
|
struct PostFrag {
|
|
3512
3512
|
#ifdef GLSLIFY_HACK
|
|
3513
|
-
float
|
|
3513
|
+
float foo_3;
|
|
3514
3514
|
#endif
|
|
3515
3515
|
highp vec3 eye, position;
|
|
3516
3516
|
mediump vec4 color;
|
|
@@ -4455,7 +4455,7 @@ struct LightProperties {
|
|
|
4455
4455
|
|
|
4456
4456
|
struct PostData {
|
|
4457
4457
|
#ifdef GLSLIFY_HACK
|
|
4458
|
-
float
|
|
4458
|
+
float foo_2;
|
|
4459
4459
|
#endif
|
|
4460
4460
|
mediump float gamma, exposure;
|
|
4461
4461
|
mediump vec4 fogParams, fogParams2, fogParams3;
|
|
@@ -4463,7 +4463,7 @@ struct PostData {
|
|
|
4463
4463
|
|
|
4464
4464
|
struct PostFrag {
|
|
4465
4465
|
#ifdef GLSLIFY_HACK
|
|
4466
|
-
float
|
|
4466
|
+
float foo_0;
|
|
4467
4467
|
#endif
|
|
4468
4468
|
highp vec3 eye, position;
|
|
4469
4469
|
mediump vec4 color;
|
|
@@ -4594,7 +4594,7 @@ uniform sampler2D tRGBA;
|
|
|
4594
4594
|
|
|
4595
4595
|
struct LightProperties {
|
|
4596
4596
|
#ifdef GLSLIFY_HACK
|
|
4597
|
-
float
|
|
4597
|
+
float foo_1;
|
|
4598
4598
|
#endif
|
|
4599
4599
|
mediump vec3 direction, color, skyLeft, skyRight, skyTop, skyBottom, skyFront, skyBack;
|
|
4600
4600
|
mediump float globalLight;
|
|
@@ -4602,7 +4602,7 @@ struct LightProperties {
|
|
|
4602
4602
|
|
|
4603
4603
|
struct PostData {
|
|
4604
4604
|
#ifdef GLSLIFY_HACK
|
|
4605
|
-
float
|
|
4605
|
+
float foo_2;
|
|
4606
4606
|
#endif
|
|
4607
4607
|
mediump float gamma, exposure;
|
|
4608
4608
|
mediump vec4 fogParams, fogParams2, fogParams3;
|
|
@@ -5132,7 +5132,7 @@ varying highp vec3 position;
|
|
|
5132
5132
|
|
|
5133
5133
|
struct LightProperties {
|
|
5134
5134
|
#ifdef GLSLIFY_HACK
|
|
5135
|
-
float
|
|
5135
|
+
float foo_1;
|
|
5136
5136
|
#endif
|
|
5137
5137
|
mediump vec3 direction, color, skyLeft, skyRight, skyTop, skyBottom, skyFront, skyBack;
|
|
5138
5138
|
mediump float globalLight;
|
|
@@ -5140,7 +5140,7 @@ struct LightProperties {
|
|
|
5140
5140
|
|
|
5141
5141
|
struct PostData {
|
|
5142
5142
|
#ifdef GLSLIFY_HACK
|
|
5143
|
-
float
|
|
5143
|
+
float foo_2;
|
|
5144
5144
|
#endif
|
|
5145
5145
|
mediump float gamma, exposure;
|
|
5146
5146
|
mediump vec4 fogParams, fogParams2, fogParams3;
|
|
@@ -6831,7 +6831,7 @@ void main(void) {
|
|
|
6831
6831
|
|
|
6832
6832
|
struct LightProperties {
|
|
6833
6833
|
#ifdef GLSLIFY_HACK
|
|
6834
|
-
float
|
|
6834
|
+
float foo_1;
|
|
6835
6835
|
#endif
|
|
6836
6836
|
mediump vec3 direction, color, skyLeft, skyRight, skyTop, skyBottom, skyFront, skyBack;
|
|
6837
6837
|
mediump float globalLight;
|
|
@@ -6839,7 +6839,7 @@ struct LightProperties {
|
|
|
6839
6839
|
|
|
6840
6840
|
struct PostData {
|
|
6841
6841
|
#ifdef GLSLIFY_HACK
|
|
6842
|
-
float
|
|
6842
|
+
float foo_2;
|
|
6843
6843
|
#endif
|
|
6844
6844
|
mediump float gamma, exposure;
|
|
6845
6845
|
mediump vec4 fogParams, fogParams2, fogParams3;
|