text: !function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=42)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={get:function(){return this[0]},set:function(t){return this[0]=t,t}},o={get:function(){return this[1]},set:function(t){return this[1]=t,t}},i={get:function(){return this[2]},set:function(t){return this[2]=t,t}};e.v3=function(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0);var u=[t,e,n];return Object.defineProperty(u,"x",r),Object.defineProperty(u,"y",o),Object.defineProperty(u,"z",i),u},e.UP=e.v3(0,1),e.ZERO=e.v3(),e.distance=function(t,e){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)+(e.z-t.z)*(e.z-t.z))},e.distanceSquared=function(t,e){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)+(e.z-t.z)*(e.z-t.z)},e.dot=function(t,e){return t.x*e.x+t.y*e.y+t.z+e.z},e.sum=function(t,n){return e.v3(t.x+n.x,t.y+n.y,t.z+n.z)},e.sub=function(t,n){return e.v3(t.x-n.x,t.y-n.y,t.z-n.z)},e.mult=function(t,n){return e.v3(t.x*n.x,t.y*n.y,t.z*n.z)},e.divide=function(t,n){return e.v3(t.x/n.x,t.y/n.y,t.z/n.z)},e.normalize=function(t){var n=e.distance(e.ZERO,t);return e.v3(t.x/n,t.y/n,t.z/n)},e.normal=function(t,n){return e.v3(t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0])},e.cross=e.normal},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r={get:function(){return this[0]},set:function(t){return this[0]=t,t}},o={get:function(){return this[1]},set:function(t){return this[1]=t,t}};Array.prototype.x||(Object.defineProperty(Array.prototype,"x",r),Object.defineProperty(Array.prototype,"y",o),Object.defineProperty(Array.prototype,"add",{value:function(t){return this[0]+=t[0],this[1]+=t[1],this}}),Object.defineProperty(Array.prototype,"sub",{value:function(t){return this[0]-=t[0],this[1]-=t[1],this}}),Object.defineProperty(Array.prototype,"magnitude",{value:function(){return e.magnitude(this)}}),Object.defineProperty(Array.prototype,"normalize",{value:function(t){var n=e.distance(e.ZERO,t);return this[0]/=n,this[1]/=n,this}})),e.v2=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=0),[t,e]},e.ZERO=e.v2(),e.distance=function(t,e){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))},e.distanceSquared=function(t,e){return(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y)},e.magnitude=function(t){return e.distance(t,e.ZERO)},e.ccw=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)},e.angle2=function(t,e){return Math.atan2(e.y-t.y,e.x-t.x)},e.angle3=function(t,e,n){return Math.atan2(t.y-e.y,t.x-e.x)-Math.atan2(n.y-e.y,n.x-e.x)},e.piNum=Math.PI/180,e.numPi=180/Math.PI,e.degToRad=function(t){return t*e.piNum},e.radToDeg=function(t){return t*e.numPi},e.dot=function(t,e){return t.x*e.x+t.y*e.y},e.sum=function(t,n){return e.v2(t.x+n.x,t.y+n.y)},e.sub=function(t,n){return e.v2(t.x-n.x,t.y-n.y)},e.mult=function(t,n){return e.v2(t.x*n.x,t.y*n.y)},e.divide=function(t,n){return e.v2(t.x/n.x,t.y/n.y)},e.normalize=function(t){var n=e.distance(e.ZERO,t);return e.v2(t.x/n,t.y/n)},e.normal=function(t,n){var r=n.x-t.x,o=n.y-t.y;return e.v2(-o,r)},e.cross=e.normal,e.orthogonal=function(t){return e.v2(-t.y,t.x)},e.scalarMultiply=function(t,n){return e.v2(t.x*n,t.y*n)},e.scalarSum=function(t,n){return e.v2(t.x+n,t.y+n)}},function(t,e,n){"use strict";var r,o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],u=0,a=i.length;u<a;u++,o++)r[o]=i[u];return r};Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.Fragment="FRAGMENT",t.Vertex="VERTEX"}(r=e.ShaderTypes||(e.ShaderTypes={}));var i=function(t,e,n){this.location=t,this.type=e,this.size=n},u=function(){function t(e,n,u,a){var s=this;for(var c in this.gl=e,this.vertexSource=n,this.fragmentSource=u,this.attributes=a,this.uniformLocations={},this.bindAttributes=function(){for(var t in s.attributes){var e=s.attributes[t];s.gl.enableVertexAttribArray(e.location),s.gl.bindBuffer(s.gl.ARRAY_BUFFER,e.buffer),s.gl.vertexAttribPointer(e.location,e.vertexAttributeMetadata.dimension,e.vertexAttributeMetadata.type,e.vertexAttributeMetadata.normalize,e.vertexAttributeMetadata.stride,e.vertexAttributeMetadata.offset)}},this.setUniform=function(e){for(var n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];if(!s.uniformLocations[e])throw new Error("Uniform '"+e+"' not referenced in source program");var u=s.uniformLocations[e],a=u.location,c=u.type;(n=s.gl)[t.typeToLocationMap[c]].apply(n,o([a],r))},this.useProgram=function(){return s.gl.useProgram(s.program)},this.drawUsingAttribute=function(t,e,n){void 0===e&&(e=s.gl.TRIANGLES),void 0===n&&(n=0);var r=s.attributes[t];s.bindAttributes(),s.gl.drawArrays(e,n,r.data.length/r.vertexAttributeMetadata.dimension)},this.compileShader=function(t,e){var n=s.gl,o=n.createShader(e===r.Fragment?n.FRAGMENT_SHADER:n.VERTEX_SHADER);if(n.shaderSource(o,t),n.compileShader(o),!n.getShaderParameter(o,n.COMPILE_STATUS)){var i=new Error(n.getShaderInfoLog(o));throw n.deleteShader(o),i}return o},this.initShaderProgram=function(t,e){var n=s.gl,r=n.createProgram();if(n.attachShader(r,t),n.attachShader(r,e),n.linkProgram(r),!n.getProgramParameter(r,n.LINK_STATUS)){var o=new Error(n.getProgramInfoLog(r));throw n.deleteProgram(r),o}return r},t.typeToLocationMap||t.setTypeToLocationMap(e),this.vertexShader=this.compileShader(n,r.Vertex),this.fragmentShader=this.compileShader(u,r.Fragment),this.program=this.initShaderProgram(this.vertexShader,this.fragmentShader),a){var f=this.gl.getAttribLocation(this.program,c);a[c].location=f}for(var l=e.getProgramParameter(this.program,e.ACTIVE_UNIFORMS),h=0;h<l;h++){var d=e.getActiveUniform(this.program,h),v=d.name,p=d.type,y=d.size,m=y>1,g=this.gl.getUniformLocation(this.program,v);this.uniformLocations[v]=new i(g,p*(+m+1),y)}}return t.setTypeToLocationMap=function(e){var n;t.typeToLocationMap=((n={})[e.FLOAT]="uniform1f",n[e.INT]="uniform1i",n[e.INT_VEC2]="uniform2i",n[2*e.INT_VEC2]="uniform2iv",n[e.INT_VEC3]="uniform3i",n[2*e.INT_VEC3]="uniform3iv",n[e.INT_VEC4]="uniform4i",n[2*e.INT_VEC4]="uniform4iv",n[2*e.FLOAT]="uniform1fv",n[e.FLOAT_VEC2]="uniform2f",n[2*e.FLOAT_VEC2]="uniform2fv",n[e.FLOAT_VEC3]="uniform3f",n[2*e.FLOAT_VEC3]="uniform3fv",n[e.FLOAT_VEC4]="uniform4f",n[2*e.FLOAT_VEC4]="uniform4fv",n[e.FLOAT_MAT2]="uniformMatrix2fv",n[e.FLOAT_MAT3]="uniformMatrix3fv",n[e.FLOAT_MAT4]="uniformMatrix4fv",n[e.SAMPLER_2D]="uniform1i",n)},t}();e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t,e,n,r){var o=n.dimension,i=n.type,u=void 0===i?t.FLOAT:i,a=n.normalize,s=void 0!==a&&a,c=n.stride,f=void 0===c?0:c,l=n.offset,h=void 0===l?0:l;void 0===r&&(r=t.STATIC_DRAW),this.data=e,this.location=null;var d=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,d),t.bufferData(t.ARRAY_BUFFER,e,r),this.buffer=d,this.vertexAttributeMetadata={dimension:o,type:u,normalize:s,stride:f,offset:h}};e.default=r},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],u=0,a=i.length;u<a;u++,o++)r[o]=i[u];return r};Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),a=function(t,e){var n=this;this.element=t,this.settings=e,this.mouse=u.v2(),this.mouseMovement=u.v2(),this.mouseButtons=Array(),this.mouseMoved=!1,this.keys=new Set,this.touches=[],this.updateTouches=function(t){t.preventDefault(),n.touches=i(t.touches).map((function(t){return u.v2(t.pageX,t.pageY)}))},this.then=0,this.render=function(t){var e=(t-n.then)/(1e3/n.settings.fps);n.then=t,n.draw(n.gl,n,e),n.mouseMoved&&(n.mouseMovement.x=0,n.mouseMovement.y=0,n.mouseMoved=!1),window.requestAnimationFrame(n.render)},this.start=function(){return r(n,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,this.init(this.gl,this)];case 1:return t.sent(),this.RAF=requestAnimationFrame(this.render),[2]}}))}))},this.draw=function(t,e,n){},this.init=function(t,e){return r(n,void 0,void 0,(function(){return o(this,(function(t){return[2]}))}))},this.onResize=function(t,e){},this.onClick=function(t,e){},this.onMouseDown=function(t,e){},this.onMouseUp=function(t,e){},this.onKeyDown=function(t,e,n){},this.onKeyUp=function(t,e,n){},this.setCanvasDimensions=function(t,e){var r=n.element;r.width=t,r.height=e,r.style.width=String(t),r.style.height=String(e)},this.setCanvasSize=function(t){t.fullscreen&&(t.width=window.innerWidth,t.height=window.innerHeight),n.setCanvasDimensions(t.width,t.height)},e.fps=e.fps||60,this.setCanvasSize(e);var a=this.gl=this.element.getContext("webgl");if(a||(a=this.gl=this.element.getContext("experimental-webgl")),!a)throw new Error("Could not find webgl context");window.addEventListener("resize",(function(){n.setCanvasSize(e),a.viewport(0,0,e.width,e.height),n.onResize(a,n)})),t.addEventListener("mousemove",(function(t){n.mouseMoved=!0,(t.offsetX||t.offsetY)&&(n.mouse.x=t.offsetX,n.mouse.y=t.offsetY),n.mouseMovement.x=t.movementX||0,n.mouseMovement.y=t.movementY||0})),t.addEventListener("mousedown",(function(t){n.mouseButtons[t.button]=!0,n.onMouseDown(a,n)})),t.addEventListener("mouseup",(function(t){n.mouseButtons[t.button]=!1,n.onMouseUp(a,n)})),t.addEventListener("mouseleave",(function(t){n.mouseButtons=Array(),n.onMouseUp(a,n)})),t.addEventListener("click",(function(t){n.onClick(a,n)})),t.addEventListener("touchstart",(function(t){n.updateTouches(t);for(var e=0;e<t.changedTouches.length;e++){var r=t.changedTouches[e];0===e&&(n.mouse.x=r.pageX,n.mouse.y=r.pageY)}n.onMouseDown(a,n)})),t.addEventListener("touchend",(function(t){n.updateTouches(t);for(var e=0;e<t.changedTouches.length;e++){var r=t.changedTouches[e];0===e&&(n.mouse.x=r.pageX,n.mouse.y=r.pageY)}n.onMouseUp(a,n),n.onClick(a,n)})),t.addEventListener("touchmove",(function(t){n.updateTouches(t);for(var e=0;e<t.changedTouches.length;e++){var r=t.changedTouches[e];0===e&&(n.mouse.x=r.pageX,n.mouse.y=r.pageY)}})),t.addEventListener("keydown",(function(t){t.preventDefault();var e=t.keyCode;n.keys.add(e),n.onKeyDown(n.gl,n,e)})),t.addEventListener("keyup",(function(t){t.preventDefault();var e=t.keyCode;n.keys.delete(e),n.onKeyUp(n.gl,n,e)})),t.addEventListener("contextmenu",(function(t){return t.preventDefault()})),t.addEventListener("dragenter",(function(t){return t.preventDefault()}))};e.default=a},function(t,e,n){"use strict";var r=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],u=0,a=i.length;u<a;u++,o++)r[o]=i[u];return r};Object.defineProperty(e,"__esModule",{value:!0});var o=n(0);e.SimpleRectangle=new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.generateSphere=function(t,e,n){void 0===t&&(t=10),void 0===e&&(e=10),void 0===n&&(n=10);var i=[],u=(1+Math.sqrt(5))/2;i.push(o.v3(-1,u,0)),i.push(o.v3(1,u,0)),i.push(o.v3(-1,-u,0)),i.push(o.v3(1,-u,0)),i.push(o.v3(0,-1,u)),i.push(o.v3(0,1,u)),i.push(o.v3(0,-1,-u)),i.push(o.v3(0,1,-u)),i.push(o.v3(u,0,-1)),i.push(o.v3(u,0,1)),i.push(o.v3(-u,0,-1)),i.push(o.v3(-u,0,1));var a=[];return a.push(0,11,5),a.push(0,5,1),a.push(0,1,7),a.push(0,7,10),a.push(0,10,11),a.push(1,5,9),a.push(5,11,4),a.push(11,10,2),a.push(10,7,6),a.push(7,1,8),a.push(3,9,4),a.push(3,4,2),a.push(3,2,6),a.push(3,6,8),a.push(3,8,9),a.push(4,9,5),a.push(2,4,11),a.push(6,2,10),a.push(8,6,7),a.push(9,8,1),a=a.map((function(t){return i[t]})).reduce((function(t,e){return r(t,e)}),[]),new Float32Array(a.map((function(t){return t*n})))}},,function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=0,u=-1/0,a=function(){function t(){this.textureSource=i++,this.loaded=!0}return Object.defineProperty(t.prototype,"textureUnit",{get:function(){return this.textureSource%u},enumerable:!0,configurable:!0}),t.prototype.setTexture=function(t){if(u<0&&(u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS)),!this.loaded)throw new Error("Attempted to bind image to texture before it loads. Make sure the image is loaded by the time you call bindTexture");var e=t.createTexture();return this._texture=e,this.bindTexture(t),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.texture),e},t.prototype.bindTexture=function(t){t.activeTexture(t.TEXTURE0+this.textureUnit),t.bindTexture(t.TEXTURE_2D,this._texture)},t.prototype.delete=function(t){t.deleteTexture(this._texture),this.loaded=!1},t}();e.default=a;var s=function(t){function e(e){var n=t.call(this)||this;return n.texture=e.canvas,n.height=e.canvas.height,n.width=e.canvas.width,n}return o(e,t),e.prototype.rebindTexture=function(t){this.bindTexture(t),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.texture)},e}(a);e.CanvasTexture=s;var c=function(t){function e(e){var n=t.call(this)||this;n.source=e,n.loaded=!1;var r=new Image;return r.src=e,n.width=r.width,n.height=r.height,n.load=new Promise((function(t,e){r.onload=function(){n.loaded=!0,n.width=r.width,n.height=r.height,t(n)},r.onerror=function(t){n.loaded=!1,n.width=r.width,n.height=r.height,e(t)}})),n.texture=r,n}return o(e,t),e}(a);e.ImageTexture=c},,function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e,n){this.name=t,this.setup=e,this.draw=n}return t.prototype.onload=function(t){return r(this,void 0,void 0,(function(){var e;return o(this,(function(n){switch(n.label){case 0:return e=this,[4,this.setup(t)];case 1:return e.material=n.sent(),[2]}}))}))},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.makeOffscreenCanvas=function(t,e){var n=document.createElement("canvas").getContext("2d");return n.canvas.width=t,n.canvas.height=e,n}},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),u=n(3),a=n(9),s=n(12),c=n(13),f=new a.default("Mouse Gradient",(function(t){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){return[2,new i.default(t,c,s,{aPosition:new u.default(t,new Float32Array([0,0,1,1,0,.5,0,1,.5,0,1,.5,1,0,.5,1,1,0]),{dimension:3})})]}))}))}),(function(t,e,n){t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),e.useProgram(),e.setUniform("uColor",n.mouse.x/n.settings.width,.42,n.mouse.y/n.settings.height),e.drawUsingAttribute("aPosition")}));e.default=f},function(t,e){t.exports="precision mediump float;\nvarying float vColor;\nuniform vec3 uColor;\nvoid main () {\n  gl_FragColor = vec4(uColor * vColor, 1);\n}"},function(t,e){t.exports="precision mediump float;\nattribute vec3 aPosition;\nvarying float vColor;\nvoid main () {\n  vColor = aPosition.z;\n  vec2 pos = (aPosition.xy * 2.0 - 1.0) * vec2(1, -1);\n  gl_Position = vec4(pos, 0, 1);\n}"},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function u(t){try{s(r.next(t))}catch(t){i(t)}}function a(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,a)}s((r=r.apply(t,e||[])).next())}))},o=this&&this.__generator||function(t,e){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return u.label++,{value:i[1],done:!1};case 5:u.label++,r=i[1],i=[0];continue;case 7:i=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){u=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){u.label=i[1];break}if(6===i[0]&&u.label<o[1]){u.label=o[1],o=i;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(i);break}o[2]&&u.ops.pop(),u.trys.pop();continue}i=e.call(t,u)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(4),u=n(2),a=n(3),s=n(7),c=n(10),f=n(5),l=n(11),h=n(43),d=n(44),v=[];window.onload=function(){var t,e,n=new i.default(document.getElementById("webgl"),{fullscreen:!0});n.init=function(i){return r(void 0,void 0,void 0,(function(){var r;return o(this,(function(o){switch(o.label){case 0:return t=c.makeOffscreenCanvas(n.settings.width,n.settings.height),(e=new s.CanvasTexture(t)).setTexture(i),r=new u.default(i,d,h,{aPosition:new a.default(i,f.SimpleRectangle,{dimension:2}),aTextcoord:new a.default(i,f.SimpleRectangle,{dimension:2})}),[4,l.default.onload(i)];case 1:return o.sent(),v.push(l.default.material),v.push(r),[2]}}))}))};var p=0;n.draw=function(n,r,o){t.canvas.width=1*r.settings.width,t.canvas.height=1*r.settings.height,t.fillStyle="red",p+=.25,t.font="32px sans-serif",t.fillText("Hello Canvas",100+p,32),t.fillText(String(o),0,32),t.fillText(String(1*r.mouse.x)+", "+String(1*r.mouse.y),1*r.mouse.x,1*r.mouse.y),t.beginPath();for(var i=Math.floor(r.mouse.x/r.settings.width*50)+3,u=r.mouse.y/r.settings.height*Math.PI,a=[],s=0;s<i;s++){var c=400*Math.cos(2*Math.PI*s/i)*Math.sin(u),f=400*Math.sin(2*Math.PI*s/i)*Math.sin(u);a.push([c,f])}for(s=0;s<a.length;s++){var l=a[s],h=l[0];f=l[1];0===s?t.moveTo(h+400,f+400):t.lineTo(h+400,f+400)}t.lineTo(a[0][0]+400,a[0][1]+400),t.stroke(),e.rebindTexture(n),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.enable(n.BLEND),n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);for(var d=0,y=v;d<y.length;d++){var m=y[d];m.useProgram(),m.uniformLocations.uColor&&m.setUniform("uColor",r.mouse[0]/r.settings.width,.42,r.mouse[1]/r.settings.height),m.drawUsingAttribute("aPosition")}},n.start()}},function(t,e){t.exports="precision mediump float;\nvarying vec2 vTextcoord;\nuniform sampler2D uImage;\n\nvoid main () {\n  gl_FragColor = texture2D(uImage, vTextcoord);\n}\n"},function(t,e){t.exports="precision mediump float;\nattribute vec2 aPosition;\nattribute vec2 aTextcoord;\nvarying vec2 vTextcoord;\n\nvoid main () {\n  vTextcoord = aTextcoord;\n  // Moving from a -1 => 1 to 0 => 1\n  vec2 pos = (aPosition * 2.0 - 1.0) * vec2(1, -1);\n  gl_Position = vec4(pos, 0, 1);\n}"}]);