0x77b35947…cc7dsent to0x2758442e…81ae·#25,448,147·view on Etherscan
HA);break;case n.ADD:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE);break;case n.REMOVE:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_ALPHA);break;case n.MULTIPLY:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA);break;case n.SCREEN:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_COLOR);break;case n.EXCLUSION:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE_MINUS_DST_COLOR,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE);break;case n.REPLACE:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO);break;case n.SUBTRACT:e.blendEquationSeparate(e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case n.DARKEST:this.blendExt?(e.blendEquationSeparate(this.blendExt.MIN||this.blendExt.MIN_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(DARKEST) does not work in your browser in WEBGL mode.");break;case n.LIGHTEST:this.blendExt?(e.blendEquationSeparate(this.blendExt.MAX||this.blendExt.MAX_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(LIGHTEST) does not work in your browser in WEBGL mode.");break;default:console.error("Oops! Somehow RendererGL set curBlendMode to an unsupported mode.")}this._isErasing||(this._cachedBlendMode=this.curBlendMode)}};var s=u.default;r.default=s},{"../core/constants":272,"../core/main":283,"./p5.Texture":343,"core-js/modules/es.array.includes":163,"core-js/modules/es.array.iterator":165,"core-js/modules/es.array.join":166,"core-js/modules/es.object.get-own-property-descriptor":186,"core-js/modules/es.object.to-string":190,"core-js/modules/es.string.includes":199,"core-js/modules/es.string.iterator":200,"core-js/modules/es.symbol":212,"core-js/modules/es.symbol.description":210,"core-js/modules/es.symbol.iterator":211,"core-js/modules/es.weak-map":244,"core-js/modules/web.dom-collections.iterator":246}],332:[function(e,t,r){"use strict";e("core-js/modules/es.array.slice"),e("core-js/modules/es.math.hypot"),e("core-js/modules/es.string.sub"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.math.hypot"),e("core-js/modules/es.string.sub"),Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var j=(e=e("../core/main"))&&e.__esModule?e:{default:e};function n(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}j.default.prototype.camera=function(){var e;this._assert3d("camera");for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return j.default._validateParameters("camera",r),(e=this._renderer._curCamera).camera.apply(e,r),this},j.default.prototype.perspective=function(){var e;this._assert3d("perspective");for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return j.default._validateParameters("perspective",r),(e=this._renderer._curCamera).perspective.apply(e,r),this},j.default.prototype.linePerspective=function(e){if(j.default._validateParameters("linePerspective",arguments),!(this._renderer instanceof j.default.RendererGL))throw new Error("linePerspective() must be called in WebGL mode.");if(void 0===e)return this._renderer._curCamera.useLinePerspective;this._renderer._curCamera.useLinePerspective=e},j.default.prototype.ortho=function(){var e;this._assert3d("ortho");for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return j.default._validateParameters("ortho",r),(e=this._renderer._curCamera).ortho.apply(e,r),this},j.default.prototype.frustum=function(){var e;this._assert3d("frustum");for(var t=arguments.length,r=new Array(t),o=0;o<t;o++)r[o]=arguments[o];return j.default._validateParameters("frustum",r),(e=this._renderer._curCamera).frustum.apply(e,r),this},j.default.prototype.createCamera=function(){this._assert3d("createCamera");var e=new j.default.Camera(this._renderer);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),this._renderer._curCamera=e},j.default.Camera=function(){function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");this._renderer=e,this.cameraType="default",this.useLinePerspective=!0,this.cameraMatrix=new j.default.Matrix,this.projMatrix=new j.default.Matrix,this.yScale=1}var e,r,o;return e=t,(r=[{key:"perspective",value:function(e,t,r,o){this.cameraType=0<arguments.length?"custom":"default",void 0===e?(e=this.defaultCameraFOV,this.cameraFOV=e):this.cameraFOV=this._renderer._pInst._toRadians(e),void 0===t&&(t=this.defaultAspectRatio),void 0===r&&(r=this.defaultCameraNear),void 0===o&&(o=this.defaultCameraFar),r<=1e-4&&(r=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),o<r&&console.log("Perspective far plane value is less than near plane value. Nothing will be shown."),this.aspectRatio=t,this.cameraNear=r,this.cameraFar=o,this.projMatrix=j.default.Matrix.identity();var e=1/Math.tan(this.cameraFOV/2),n=1/(this.cameraNear-this.cameraFar);this.projMatrix.set(e/t,0,0,0,0,-e*this.yScale,0,0,0,0,(o+r)*n,-1,0,0,2*o*r*n,0),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix)}},{key:"ortho",value:function(e,t,r,o,n,s){var i=this.fbo||this._renderer,i=(void 0===e&&(e=-i.width/2),void 0===t&&(t=+i.width/2),void 0===r&&(r=-i.height/2),void 0===o&&(o=+i.height/2),void 0===n&&(n=0),void 0===s&&(s=Math.max(i.width,i.height)+800),this.cameraNear=n,t-e),a=o-r,l=(this.cameraFar=s)-n,u=2/i,c=2/a*this.yScale,d=-2/l,t=-(t+e)/i,e=-(o+r)/a,i=-(s+n)/l;this.projMatrix=j.default.Matrix.identity(),this.projMatrix.set(u,0,0,0,0,-c,0,0,0,0,d,0,t,e,i,1),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix),this.cameraType="custom"}},{key:"frustum",value:function(e,t,r,o,n,s){void 0===e&&(e=.05*-this._renderer.width),void 0===t&&(t=.05*+this._renderer.width),void 0===r&&(r=.05*+this._renderer.height),void 0===o&&(o=.05*-this._renderer.height),void 0===n&&(n=this.defaultCameraNear),void 0===s&&(s=this.defaultCameraFar),this.cameraNear=n;var i=t-e,a=o-r,l=(this.cameraFar=s)-n,u=2*n/i,c=2*n/a*this.yScale,d=-2*s*n/l,t=(t+e)/i,e=(o+r)/a,i=-(s+n)/l;this.projMatrix=j.default.Matrix.identity(),this.projMatrix.set(u,0,0,0,0,-c,0,0,t,e,i,-1,0,0,d,0),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix),this.cameraType="custom"}},{key:"_rotateView",value:function(e,t,r,o){var n=this.centerX,s=this.centerY,i=this.centerZ,a=(n-=this.eyeX,s-=this.eyeY,i-=this.eyeZ,j.default.Matrix.identity(this._renderer._pInst)),e=(a.rotate(this._renderer._pInst._toRadians(e),t,r,o),[n*a.mat4[0]+s*a.mat4[4]+i*a.mat4[8],n*a.mat4[1]+s*a.mat4[5]+i*a.mat4[9],n*a.mat4[2]+s*a.mat4[6]+i*a.mat4[10]]),t=(e[0]+=this.eyeX,e[1]+=this.eyeY,e[2]+=this.eyeZ,this.upX*a.mat4[0]+this.upY*a.mat4[4]+this.upZ*a.mat4[8]),r=this.upX*a.mat4[1]+this.upY*a.mat4[5]+this.upZ*a.mat4[9],o=this.upX*a.mat4[2]+this.upY*a.mat4[6]+this.upZ*a.mat4[10];this.camera(this.eyeX,this.eyeY,this.eyeZ,e[0],e[1],e[2],t,r,o)}},{key:"roll",value:function(e){var t=this._getLocalAxes(),e=j.default.Quat.fromAxisAngle(this._renderer._pInst._toRadians(e),t.z[0],t.z[1],t.z[2]).rotateVector(new j.default.Vector(this.upX,this.upY,this.upZ));this.camera(this.eyeX,this.eyeY,this.eyeZ,this.centerX,this.centerY,this.centerZ,e.x,e.y,e.z)}},{key:"pan",value:function(e){var t=this._getLocalAxes();this._rotateView(e,t.y[0],t.y[1],t.y[2])}},{key:"tilt",value:function(e){var t=this._getLocalAxes();this._rotateView(e,t.x[0],t.x[1],t.x[2])}},{key:"lookAt",value:function(e,t,r){this.camera(this.eyeX,this.eyeY,this.eyeZ,e,t,r,this.upX,this.upY,this.upZ)}},{key:"camera",value:function(e,t,r,o,n,s,i,a,l){void 0===e&&(e=this.defaultEyeX,t=this.defaultEyeY,r=this.defaultEyeZ,o=e,n=t,a=1,l=i=s=0),this.eyeX=e,this.eyeY=t,this.eyeZ=r,void 0!==o&&(this.centerX=o,this.centerY=n,this.centerZ=s),void 0!==i&&(this.upX=i,this.upY=a,this.upZ=l);o=this._getLocalAxes(),this.cameraMatrix.set(o.x[0],o.y[0],o.z[0],0,o.x[1],o.y[1],o.z[1],0,o.x[2],o.y[2],o.z[2],0,0,0,0,1),n=-e;return this.cameraMatrix.translate([n,-t,-r]),this._isActive()&&this._renderer.uViewMatrix.set(this.cameraMatrix),this}},{key:"move",value:function(e,t,r){var o=this._getLocalAxes(),e=[o.x[0]*e,o.x[1]*e,o.x[2]*e],t=[o.y[0]*t,o.y[1]*t,o.y[2]*t],o=[o.z[0]*r,o.z[1]*r,o.z[2]*r];this.camera(this.eyeX+e[0]+t[0]+o[0],this.eyeY+e[1]+t[1]+o[1],this.eyeZ+e[2]+t[2]+o[2],this.centerX+e[0]+t[0]+o[0],this.centerY+e[1]+t[1]+o[1],this.centerZ+e[2]+t[2]+o[2],this.upX,this.upY,this.upZ)}},{key:"setPosition",value:function(e,t,r){var o=e-this.eyeX,n=t-this.eyeY,s=r-this.eyeZ;this.camera(e,t,r,this.centerX+o,this.centerY+n,this.centerZ+s,this.upX,this.upY,this.upZ)}},{key:"set",value:function(e){for(var t=0,r=["eyeX","eyeY","eyeZ","centerX","centerY","centerZ","upX","upY","upZ","cameraFOV","aspectRatio","cameraNear","cameraFar","cameraType","yScale","useLinePerspective"];t<r.length;t++){var o=r[t];this[o]=e[o]}this.cameraMatrix=e.cameraMatrix.copy(),this.projMatrix=e.projMatrix.copy(),this._isActive()&&(this._renderer.uModelMatrix.reset(),this._renderer.uViewMatrix.set(this.cameraMatrix),this._renderer.uPMatrix.set(this.projMatrix))}},{key:"slerp",value:function(e,t,r){var o,n,s,i,a,l,u,c,d,h,f,p,m,y,g,v,b,_;0===r?this.set(e):1===r?this.set(t):(0!==this.projMatrix.mat4[15]&&(this.projMatrix.mat4[0]=e.projMatrix.mat4[0]*Math.pow(t.projMatrix.mat4[0]/e.projMatrix.mat4[0],r),this.projMatrix.mat4[5]=e.projMatrix.mat4[5]*Math.pow(t.projMatrix.mat4[5]/e.projMatrix.mat4[5],r),this._isActive()&&(this._renderer.uPMatrix.mat4=this.projMatrix.mat4.slice())),i=new j.default.Vector(e.eyeX,e.eyeY,e.eyeZ),a=new j.default.Vector(t.eyeX,t.eyeY,t.eyeZ),v=new j.default.Vector(e.centerX,e.centerY,e.centerZ),_=new j.default.Vector(t.centerX,t.centerY,t.centerZ),s=j.default.Vector.dist(i,v),o=j.default.Vector.dist(a,_),o=s*Math.pow(o/s,r),s=j.default.Vector.sub(i,a),n=1,1e-6<(b=(y=i.copy().sub(a).sub(v).add(_)).magSq())&&(n=j.default.Vector.dot(s,y)/b,n=Math.max(0,Math.min(n,1))),s=j.default.Vector.lerp(j.default.Vector.lerp(i,v,n),j.default.Vector.lerp(a,_,n),r),y=e.cameraMatrix.createSubMatrix3x3(),b=t.cameraMatrix.createSubMatrix3x3(),i=y.row(2),v=b.row(2),a=y.row(1),_=b.row(1),e=new j.default.Vector,t=new j.default.Vector,l=new j.default.Vector,u=new j.default.Vector,1-(c=.5*((y=(b=b.mult3x3(y.copy().transpose3x3())).diagonal())[0]+y[1]+y[2]-1))<1e-7?(e.set(j.default.Vector.lerp(i,v,r)).normalize(),l.set(e).mult(n*o).add(s),u.set(e).mult((n-1)*o).add(s),t.set(j.default.Vector.lerp(a,_,r)).normalize()):(v=1/(1-c),_=Math.max(y[0],y[1],y[2]),p=b.mat3[1]+b.mat3[3],m=b.mat3[2]+b.mat3[6],g=b.mat3[5]+b.mat3[7],_=_===y[0]?(h=.5*p*(v/=d=Math.sqrt((y[0]-c)*v)),f=.5*m*v,.5*(b.mat3[7]-b.mat3[5])/d):_===y[1]?(f=.5*g*(v/=h=Math.sqrt((y[1]-c)*v)),d=.5*p*v,.5*(b.mat3[2]-b.mat3[6])/h):(d=.5*m*(v/=f=Math.sqrt((y[2]-c)*v)),h=.5*g*v,.5*(b.mat3[3]-b.mat3[1])/f),p=r*Math.atan2(_,c),m=Math.cos(p),y=Math.sin(p),(_=new j.default.Matrix("mat3",[m+(g=1-m)*d*d,g*(v=d*h)+y*f,g*(b=f*d)-y*h,g*v-y*f,m+g*h*h,g*(r=h*f)+y*d,g*b+y*h,g*r-y*d,m+g*f*f])).multiplyVec3(i,e),l.set(e).mult(n*o).add(s),u.set(e).mult((n-1)*o).add(s),_.multiplyVec3(a,t)),this.camera(l.x,l.y,l.z,u.x,u.y,u.z,t.x,t.y,t.z))}},{key:"_computeCameraDefaultSettings",value:function(){this.defaultAspectRatio=this._renderer.width/this._renderer.height,this.defaultEyeX=0,this.defaultEyeY=0,this.defaultEyeZ=800,this.defaultCameraFOV=2*Math.atan(this._renderer.height/2/this.defaultEyeZ),this.defaultCenterX=0,this.defaultCenterY=0,this.defaultCenterZ=0,this.defaultCameraNear=.1*this.defaultEyeZ,this.defaultCameraFar=10*this.defaultEyeZ}},{key:"_setDefaultCamera",value:function(){this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.eyeX=this.defaultEyeX,this.eyeY=this.defaultEyeY,this.eyeZ=this.defaultEyeZ,this.centerX=this.defaultCenterX,this.centerY=this.defaultCenterY,this.centerZ=this.defaultCenterZ,this.upX=0,this.upY=1,this.upZ=0,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.perspective(),this.camera(),this.cameraType="default"}},{key:"_resize",value:function(){"default"===this.cameraType&&(this._computeCameraDefaultSettings(),this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.perspective())}},{key:"copy",value:function(){var e=new j.default.Camera(this._renderer);return e.cameraFOV=this.cameraFOV,e.aspectRatio=this.aspectRatio,e.eyeX=this.eyeX,e.eyeY=this.eyeY,e.eyeZ=this.eyeZ,e.centerX=this.centerX,e.centerY=this.centerY,e.centerZ=this.centerZ,e.upX=this.upX,e.upY=this.upY,e.upZ=this.upZ,e.cameraNear=this.cameraNear,e.cameraFar=this.cameraFar,e.cameraType=this.cameraType,e.useLinePerspective=this.useLinePerspective,e.cameraMatrix=this.cameraMatrix.copy(),e.projMatrix=this.projMatrix.copy(),e.yScale=this.yScale,e}},{key:"_getLocalAxes",value:function(){var e=this.eyeX-this.centerX,t=this.eyeY-this.centerY,r=this.eyeZ-this.centerZ,o=Math.sqrt(e*e+t*t+r*r),o=(0!==o&&(e/=o,t/=o,r/=o),this.upX),n=(a=this.upY)*r-(l=this.upZ)*t,s=-o*r+l*e,i=o*t-a*e,o=t*i-r*s,a=-e*i+r*n,l=e*s-t*n,u=Math.sqrt(n*n+s*s+i*i),u=(0!==u&&(n/=u,s/=u,i/=u),Math.sqrt(o*o+a*a+l*l));return 0!==u&&(o/=u,a/=u,l/=u),{x:[n,s,i],y:[o,a,l],z:[e,t,r]}}},{key:"_orbit",value:function(e,t,r){var o=this.eyeX-this.centerX,n=this.eyeY-this.centerY,s=this.eyeZ-this.centerZ,i=Math.hypot(o,n,s),o=new j.default.Vector(o,n,s).normalize(),n=new j.default.Vector(this.upX,this.upY,this.upZ).normalize(),s=j.default.Vector.cross(n,o).normalize(),a=j.default.Vector.cross(s,n),r=((i=(i*=Math.pow(10,r))<this.cameraNear?this.cameraNear:i)>this.cameraFar&&(i=this.cameraFar),Math.acos(Math.max(-1,Math.min(1,j.default.Vector.dot(o,n))))+t),t=e;(r<=0||r>=Math.PI)&&(this.upX*=-1,this.upY*=-1,this.upZ*=-1),n.mult(Math.cos(r)),a.mult(Math.cos(t)*Math.sin(r)),s.mult(Math.sin(t)*Math.sin(r)),o.set(n).add(a).add(s),this.eyeX=i*o.x+this.centerX,this.eyeY=i*o.y+this.centerY,this.eyeZ=i*o.z+this.centerZ,this.camera(this.eyeX,this.eyeY,this.eyeZ,this.centerX,this.centerY,this.centerZ,this.upX,this.upY,this.upZ)}},{key:"_orbitFree",value:function(e,t,r){var o=this.eyeX-this.centerX,n=this.eyeY-this.centerY,s=this.eyeZ-this.centerZ,i=Math.hypot(o,n,s),o=new j.default.Vector(o,n,s).normalize(),n=new j.default.Vector(this.upX,this.upY,this.upZ),s=j.default.Vector.cross(n,o).normalize(),a=j.default.Vector.cross(o,s),l=Math.atan2(t,e),l=(a.mult(Math.sin(l)),s.mult(Math.cos(l)).add(a),Math.sqrt(e*e+t*t)),a=j.default.Vector.cross(o,s),e=((i=(i*=Math.pow(10,r))<this.cameraNear?this.cameraNear:i)>this.cameraFar&&(i=this.cameraFar),Math.cos(l)),t=Math.sin(l),r=n.dot(o),l=n.dot(s),u=r*e+l*t,r=-r*t+l*e,l=n.dot(a);n.x=u*o.x+r*s.x+l*a.x,n.y=u*o.y+r*s.y+l*a.y,n.z=u*o.z+r*s.z+l*a.z,s.mult(-t),o.mult(e).add(s).mult(i),this.camera(o.x+this.centerX,o.y+this.centerY,o.z+this.centerZ,this.centerX,this.centerY,this.centerZ,n.x,n.y,n.z)}},{key:"_isActive",value:function(){return this===this._renderer._curCamera}}])&&n(e.prototype,r),o&&n(e,o),t}(),j.default.prototype.setCamera=function(e){this._renderer._curCamera=e,this._renderer.uPMatrix.set(e.projMatrix),this._renderer.uViewMatrix.set(e.cameraMatrix)};e=j.default.Camera;r.default=e},{"../core/main":283,"core-js/modules/es.array.slice":169,"core-js/modules/es.math.hypot":176,"core-js/modules/es.string.sub":208}],333:[function(e,t,r){"use strict";e("core-js/modules/es.array.iterator"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.math.log2"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.typed-array.float32-array"),e("core-js/modules/es.typed-array.copy-within"),e("core-js/modules/es.typed-array.every"),e("core-js/modules/es.typed-array.fill"),e("core-js/modules/es.typed-array.filter"),e("core-js/modules/es.typed-array.find"),e("core-js/modules/es.typed-array.find-index"),e("core-js/modules/es.typed-array.for-each"),e("core-js/modules/es.typed-array.includes"),e("core-js/modules/es.typed-array.index-of"),e("core-js/modules/es.typed-array.iterator"),e("core-js/modules/es.typed-array.join"),e("core-js/modules/es.typed-array.last-index-of"),e("core-js/modules/es.typed-array.map"),e("core-js/modules/es.typed-array.reduce"),e("core-js/modules/es.typed-array.reduce-right"),e("core-js/modules/es.typed-array.reverse"),e("core-js/modules/es.typed-array.set"),e("core-js/modules/es.typed-array.slice"),e("core-js/modules/es.typed-array.some"),e("core-js/modules/es.typed-array.sort"),e("core-js/modules/es.typed-array.subarray"),e("core-js/modules/es.typed-array.to-locale-string"),e("core-js/modules/es.typed-array.to-string"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.math.log2"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.typed-array.float32-array"),e("core-js/modules/es.typed-array.copy-within"),e("core-js/modules/es.typed-array.every"),e("core-js/modules/es.typed-array.fill"),e("core-js/modules/es.typed-array.filter"),e("core-js/modules/es.typed-array.find"),e("core-js/modules/es.typed-array.find-index"),e("core-js/modules/es.typed-array.for-each"),e("core-js/modules/es.typed-array.includes"),e("core-js/modules/es.typed-array.index-of"),e("core-js/modules/es.typed-array.iterator"),e("core-js/modules/es.typed-array.join"),e("core-js/modules/es.typed-array.last-index-of"),e("core-js/modules/es.typed-array.map"),e("core-js/modules/es.typed-array.reduce"),e("core-js/modules/es.typed-array.reduce-right"),e("core-js/modules/es.typed-array.reverse"),e("core-js/modules/es.typed-array.set"),e("core-js/modules/es.typed-array.slice"),e("core-js/modules/es.typed-array.some"),e("core-js/modules/es.typed-array.sort"),e("core-js/modules/es.typed-array.subarray"),e("core-js/modules/es.typed-array.to-locale-string"),e("core-js/modules/es.typed-array.to-string"),Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;e=(e=e("../core/main"))&&e.__esModule?e:{default:e};function n(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.default.DataArray=function(){function o(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:128,t=this,r=o;if(!(t instanceof r))throw new TypeError("Cannot call a class as a function");this.length=0,this.data=new Float32Array(e),this.initialLength=e}var e,t,r;return e=o,(t=[{key:"dataArray",value:function(){return this.subArray(0,this.length)}},{key:"clear",value:function(){this.length=0}},{key:"rescale",value:function(){var e;this.length<this.data.length/2&&(e=1<<Math.ceil(Math.log2(this.length)),(e=new Float32Array(e)).set(this.data.subarray(0,this.length),0),this.data=e)}},{key:"reset",value:function(){this.clear(),this.data=new Float32Array(this.initialLength)}},{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.ensureLength(this.length+t.length),this.data.set(t,this.length),this.length+=t.length}},{key:"slice",value:function(e,t){return this.data.slice(e,Math.min(t,this.length))}},{key:"subArray",value:function(e,t){return this.data.subarray(e,Math.min(t,this.length))}},{key:"ensureLength",value:function(e){for(;this.data.length<e;){var t=new Float32Array(2*this.data.length);t.set(this.data,0),this.data=t}}}])&&n(e.prototype,t),r&&n(e,r),o}();e=e.default.DataArray;r.default=e},{"../core/main":283,"core-js/modules/es.array.iterator":165,"core-js/modules/es.array.slice":169,"core-js/modules/es.math.log2":177,"core-js/modules/es.object.to-string":190,"core-js/modules/es.typed-array.copy-within":213,"core-js/modules/es.typed-array.every":214,"core-js/modules/es.typed-array.fill":215,"core-js/modules/es.typed-array.filter":216,"core-js/modules/es.typed-array.find":218,"core-js/modules/es.typed-array.find-index":217,"core-js/modules/es.typed-array.float32-array":219,"core-js/modules/es.typed-array.for-each":221,"core-js/modules/es.typed-array.includes":222,"core-js/modules/es.typed-array.index-of":223,"core-js/modules/es.typed-array.iterator":226,"core-js/modules/es.typed-array.join":227,"core-js/modules/es.typed-array.last-index-of":228,"core-js/modules/es.typed-array.map":229,"core-js/modules/es.typed-array.reduce":231,"core-js/modules/es.typed-array.reduce-right":230,"core-js/modules/es.typed-array.reverse":232,"core-js/modules/es.typed-array.set":233,"core-js/modules/es.typed-array.slice":234,"core-js/modules/es.typed-array.some":235,"core-js/modules/es.typed-array.sort":236,"core-js/modules/es.typed-array.subarray":237,"core-js/modules/es.typed-array.to-locale-string":238,"core-js/modules/es.typed-array.to-string":239}],334:[function(e,t,r){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.fill"),e("core-js/modules/es.array.includes"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.object.get-own-property-descriptor"),e("core-js/modules/es.object.get-prototype-of"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.reflect.construct"),e("core-js/modules/es.reflect.get"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/es.string.includes"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.typed-array.float32-array"),e("core-js/modules/es.typed-array.uint8-array"),e("core-js/modules/es.typed-array.uint8-clamped-array"),e("core-js/modules/es.typed-array.copy-within"),e("core-js/modules/es.typed-array.every"),e("core-js/modules/es.typed-array.fill"),e("core-js/modules/es.typed-array.filter"),e("core-js/modules/es.typed-array.find"),e("core-js/modules/es.typed-array.find-index"),e("core-js/modules/es.typed-array.for-each"),e("core-js/modules/es.typed-array.includes"),e("core-js/modules/es.typed-array.index-of"),e("core-js/modules/es.typed-array.iterator"),e("core-js/modules/es.typed-array.join"),e("core-js/modules/es.typed-array.last-index-of"),e("core-js/modules/es.typed-array.map"),e("core-js/modules/es.typed-array.reduce"),e("core-js/modules/es.typed-array.reduce-right"),e("core-js/modules/es.typed-array.reverse"),e("core-js/modules/es.typed-array.set"),e("core-js/modules/es.typed-array.slice"),e("core-js/modules/es.typed-array.some"),e("core-js/modules/es.typed-array.sort"),e("core-js/modules/es.typed-array.subarray"),e("core-js/modules/es.typed-array.to-locale-string"),e("core-js/modules/es.typed-array.to-string"),e("core-js/modules/es.weak-map"),e("core-js/modules/web.dom-collections.iterator"),e("core-js/modules/es.array.fill"),e("core-js/modules/es.array.includes"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.object.get-prototype-of"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.string.includes"),e("core-js/modules/es.typed-array.float32-array"),e("core-js/modules/es.typed-array.uint8-array"),e("core-js/modules/es.typed-array.uint8-clamped-array"),e("core-js/modules/es.typed-array.copy-within"),e("core-js/modules/es.typed-array.every"),e("core-js/modules/es.typed-array.fill"),e("core-js/modules/es.typed-array.filter"),e("core-js/modules/es.typed-array.find"),e("core-js/modules/es.typed-array.find-index"),e("core-js/modules/es.typed-array.for-each"),e("core-js/modules/es.typed-array.includes"),e("core-js/modules/es.typed-array.index-of"),e("core-js/modules/es.typed-array.iterator"),e("core-js/modules/es.typed-array.join"),e("core-js/modules/es.typed-array.last-index-of"),e("core-js/modules/es.typed-array.map"),e("core-js/modules/es.typed-array.reduce"),e("core-js/modules/es.typed-array.reduce-right"),e("core-js/modules/es.typed-array.reverse"),e("core-js/modules/es.typed-array.set"),e("core-js/modules/es.typed-array.slice"),e("core-js/modules/es.typed-array.some"),e("core-js/modules/es.typed-array.sort"),e("core-js/modules/es.typed-array.subarray"),e("core-js/modules/es.typed-array.to-locale-string"),e("core-js/modules/es.typed-array.to-string"),Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var f=(j=e("../core/main"))&&j.__esModule?j:{default:j},a=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var t=l();if(t&&t.has(e))return t.get(e);var r,o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e){var s;Object.prototype.hasOwnProperty.call(e,r)&&((s=n?Object.getOwnPropertyDescriptor(e,r):null)&&(s.get||s.set)?Object.defineProperty(o,r,s):o[r]=e[r])}o.default=e,t&&t.set(e,o);return o}(e("../core/constants")),n=e("./p5.Texture"),p=e("./p5.RendererGL");function l(){var e;return"function"!=typeof WeakMap?null:(e=new WeakMap,l=function(){return e},e)}function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],o=!0,n=!1,s=void 0;try{for(var i,a=e[Symbol.iterator]();!(o=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);o=!0);}catch(e){n=!0,s=e}finally{try{o||null==a.return||a.return()}finally{if(n)throw s}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function c(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function h(e,t,r){t&&s(e.prototype,t),r&&s(e,r)}function m(e,t,r){return(m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var e=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=v(e)););return e}(e,t);if(e)return(e=Object.getOwnPropertyDescriptor(e,t)).get?e.get.call(r):e.value})(e,t,r||e)}function y(e,t){return(y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(r){return function(){var e,t=v(r),t=(e=function(){if("undefined"!=typeof Reflect&&Reflect.construct&&!Reflect.construct.sham){if("function"==typeof Proxy)return 1;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),1}catch(e){}}}()?(e=v(this).constructor,Reflect.construct(t,arguments,e)):t.apply(this,arguments),this);if(!e||"object"!==i(e)&&"function"!=typeof e){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return e}}function v(e){return(v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var b=function(e){var t=o;if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e);var r=g(o);function o(e){var t;return d(this,o),(t=r.call(this,e.target._renderer)).fbo=e,t.yScale=-1,t}return h(o,[{key:"_computeCameraDefaultSettings",value:function(){m(v(o.prototype),"_computeCameraDefaultSettings",this).call(this),this.defaultAspectRatio=this.fbo.width/this.fbo.height,this.defaultCameraFOV=2*Math.atan(this.fbo.height/2/this.defaultEyeZ)}}]),o}(f.default.Camera),_=(f.default.FramebufferCamera=b,function(){function r(e,t){d(this,r),this.framebuffer=e,this.property=t}return h(r,[{key:"rawTexture",value:function(){return this.framebuffer[this.property]}},{key:"width",get:function(){return this.framebuffer.width*this.framebuffer.density}},{key:"height",get:function(){return this.framebuffer.height*this.framebuffer.density}}]),r}()),j=(f.default.FramebufferTexture=_,function(){function s(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=(d(this,s),this.target=e,this.target._renderer.framebuffers.add(this),this._isClipApplied=!1,this.pixels=[],this.format=r.format||a.UNSIGNED_BYTE,this.channels=r.channels||(e._renderer._pInst._glAttributes.alpha?a.RGBA:a.RGB),this.useDepth=void 0===r.depth||r.depth,this.depthFormat=r.depthFormat||a.FLOAT,this.textureFiltering=r.textureFiltering||a.LINEAR,void 0===r.antialias?this.antialiasSamples=e._renderer._pInst._glAttributes.antialias?2:0:"number"==typeof r.antialias?this.antialiasSamples=r.antialias:this.antialiasSamples=r.antialias?2:0,this.antialias=0<this.antialiasSamples,this.antialias&&e.webglVersion!==a.WEBGL2&&(console.warn("Antialiasing is unsupported in a WebGL 1 context"),this.antialias=!1),this.density=r.density||e.pixelDensity(),e._renderer.GL);if(this.gl=o,r.width&&r.height?(n=e._renderer._adjustDimensions(r.width,r.height),this.width=n.adjustedWidth,this.height=n.adjustedHeight,this._autoSized=!1):(void 0===r.width!=(void 0===r.height)&&console.warn("Please supply both width and height for a framebuffer to give it a size. Only one was given, so the framebuffer will match the size of its canvas."),this.width=e.width,this.height=e.height,this._autoSized=!0),this._checkIfFormatsAvailable(),r.stencil&&!this.useDepth&&console.warn("A stencil buffer can only be used if also using depth. Since the framebuffer has no depth buffer, the stencil buffer will be ignored."),this.useStencil=this.useDepth&&(void 0===r.stencil||r.stencil),this.framebuffer=o.createFramebuffer(),!this.framebuffer)throw new Error("Unable to create a framebuffer");if(this.antialias&&(this.aaFramebuffer=o.createFramebuffer(),!this.aaFramebuffer))throw new Error("Unable to create a framebuffer for antialiasing");this._recreateTextures();var n=this.target._renderer._curCamera;this.defaultCamera=this.createCamera(),this.filterCamera=this.createCamera(),this.target._renderer._curCamera=n,this.draw(function(){return t.target.clear()})}return h(s,[{key:"resize",value:function(e,t){this._autoSized=!1;var r=this.target._renderer._adjustDimensions(e,t);e=r.adjustedWidth,t=r.adjustedHeight,this.width=e,this.height=t,this._handleResize()}},{key:"pixelDensity",value:function(e){if(!e)return this.density;this._autoSized=!1,this.density=e,this._handleResize()}},{key:"autoSized",value:function(e){if(void 0===e)return this._autoSized;this._autoSized=e,this._handleResize()}},{key:"_checkIfFormatsAvailable",value:function(){var e=this.gl,e=(this.useDepth&&this.target.webglVersion===a.WEBGL&&!e.getExtension("WEBGL_depth_texture")&&(console.warn("Unable to create depth textures in this environment. Falling back to a framebuffer without depth."),this.useDepth=!1),this.useDepth&&this.target.webglVersion===a.WEBGL&&this.depthFormat===a.FLOAT&&(console.warn("FLOAT depth format is unavailable in WebGL 1. Defaulting to UNSIGNED_INT."),this.depthFormat=a.UNSIGNED_INT),[a.UNSIGNED_BYTE,a.FLOAT,a.HALF_FLOAT].includes(this.format)||(console.warn("Unknown Framebuffer format. Please use UNSIGNED_BYTE, FLOAT, or HALF_FLOAT. Defaulting to UNSIGNED_BYTE."),this.format=a.UNSIGNED_BYTE),this.useDepth&&![a.UNSIGNED_INT,a.FLOAT].includes(this.depthFormat)&&(console.warn("Unknown Framebuffer depth format. Please use UNSIGNED_INT or FLOAT. Defaulting to FLOAT."),this.depthFormat=a.FLOAT),(0,n.checkWebGLCapabilities)(this.target._renderer));e.float||this.format!==a.FLOAT||(console.warn("This environment does not support FLOAT textures. Falling back to UNSIGNED_BYTE."),this.format=a.UNSIGNED_BYTE),this.useDepth&&!e.float&&this.depthFormat===a.FLOAT&&(console.warn("This environment does not support FLOAT depth textures. Falling back to UNSIGNED_INT."),this.depthFormat=a.UNSIGNED_INT),e.halfFloat||this.format!==a.HALF_FLOAT||(console.warn("This environment does not support HALF_FLOAT textures. Falling back to UNSIGNED_BYTE."),this.format=a.UNSIGNED_BYTE),this.channels===a.RGB&&[a.FLOAT,a.HALF_FLOAT].includes(this.format)&&(console.warn("FLOAT and HALF_FLOAT formats do not work cross-platform with only RGB channels. Falling back to RGBA."),this.channels=a.RGBA)}},{key:"_recreateTextures",value:function(){var e=this.gl,t=(this._updateSize(),e.getParameter(e.TEXTURE_BINDING_2D)),r=e.getParameter(e.FRAMEBUFFER_BINDING),o=e.createTexture();if(!o)throw new Error("Unable to create color texture");e.bindTexture(e.TEXTURE_2D,o);var n=this._glColorFormat();if(e.texImage2D(e.TEXTURE_2D,0,n.internalFormat,this.width*this.density,this.height*this.density,0,n.format,n.type,null),this.colorTexture=o,e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,o,0),this.useDepth){var o=e.createTexture();if(!o)throw new Error("Unable to create depth texture");var s=this._glDepthFormat();e.bindTexture(e.TEXTURE_2D,o),e.texImage2D(e.TEXTURE_2D,0,s.internalFormat,this.width*this.density,this.height*this.density,0,s.format,s.type,null),e.framebufferTexture2D(e.FRAMEBUFFER,this.useStencil?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0),this.depthTexture=o}this.antialias&&(this.colorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.colorRenderbuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,Math.max(0,Math.min(this.antialiasSamples,e.getParameter(e.MAX_SAMPLES))),n.internalFormat,this.width*this.density,this.height*this.density),this.useDepth&&(s=this._glDepthFormat(),this.depthRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,this.depthRenderbuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,Math.max(0,Math.min(this.antialiasSamples,e.getParameter(e.MAX_SAMPLES))),s.internalFormat,this.width*this.density,this.height*this.density)),e.bindFramebuffer(e.FRAMEBUFFER,this.aaFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,this.colorRenderbuffer),this.useDepth&&e.framebufferRenderbuffer(e.FRAMEBUFFER,this.useStencil?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,e.RENDERBUFFER,this.depthRenderbuffer)),this.useDepth&&(this.depth=new _(this,"depthTexture"),o=e.NEAREST,this.depthP5Texture=new f.default.Texture(this.target._renderer,this.depth,{minFilter:o,magFilter:o}),this.target._renderer.textures.set(this.depth,this.depthP5Texture)),this.color=new _(this,"colorTexture");n=this.textureFiltering===a.LINEAR?e.LINEAR:e.NEAREST;this.colorP5Texture=new f.default.Texture(this.target._renderer,this.color,{minFilter:n,magFilter:n}),this.target._renderer.textures.set(this.color,this.colorP5Texture),e.bindTexture(e.TEXTURE_2D,t),e.bindFramebuffer(e.FRAMEBUFFER,r)}},{key:"_glColorFormat",value:function(){var e,t,r=this.gl,o=this.format===a.FLOAT?r.FLOAT:this.format===a.HALF_FLOAT?this.target.webglVersion===a.WEBGL2?r.HALF_FLOAT:r.getExtension("OES_texture_half_float").HALF_FLOAT_OES:r.UNSIGNED_BYTE,n=this.channels===a.RGBA?r.RGBA:r.RGB;return{internalFormat:this.target.webglVersion===a.WEBGL2?(c(t={},r.FLOAT,c({},r.RGBA,r.RGBA32F)),c(t,r.HALF_FLOAT,c({},r.RGBA,r.RGBA16F)),c(t,r.UNSIGNED_BYTE,(c(e={},r.RGBA,r.RGBA8),c(e,r.RGB,r.RGB8),e)),t[o][n]):this.format===a.HALF_FLOAT?r.RGBA:n,format:n,type:o}}},{key:"_glDepthFormat",value:function(){var e=this.gl,t=this.useStencil?this.depthFormat===a.FLOAT?e.FLOAT_32_UNSIGNED_INT_24_8_REV:this.target.webglVersion===a.WEBGL2?e.UNSIGNED_INT_24_8:e.getExtension("WEBGL_depth_texture").UNSIGNED_INT_24_8_WEBGL:this.depthFormat===a.FLOAT?e.FLOAT:e.UNSIGNED_INT,r=this.useStencil?e.DEPTH_STENCIL:e.DEPTH_COMPONENT,e=this.useStencil?this.depthFormat===a.FLOAT?e.DEPTH32F_STENCIL8:this.target.webglVersion===a.WEBGL2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL:this.target.webglVersion===a.WEBGL2?this.depthFormat===a.FLOAT?e.DEPTH_COMPONENT32F:e.DEPTH_COMPONENT24:e.DEPTH_COMPONENT;return{internalFormat:e,format:r,type:t}}},{key:"_updateSize",value:function(){this._autoSized&&(this.width=this.target.width,this.height=this.target.height,this.density=this.target.pixelDensity())}},{key:"_canvasSizeChanged",value:function(){this._autoSized&&this._handleResize()}},{key:"_handleResize",value:function(){var e=this.color,t=this.depth,r=this.colorRenderbuffer,o=this.depthRenderbuffer,e=(this._deleteTexture(e),t&&this._deleteTexture(t),this.gl);r&&e.deleteRenderbuffer(r),o&&e.deleteRenderbuffer(o),this._recreateTextures(),this.defaultCamera._resize()}},{key:"createCamera",value:function(){var e=new b(this);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),this.target._renderer._curCamera=e}},{key:"_deleteTexture",value:function(e){this.gl.deleteTexture(e.rawTexture()),this.target._renderer.textures.delete(e)}},{key:"remove",value:function(){var e=this.gl;this._deleteTexture(this.color),this.depth&&this._deleteTexture(this.depth),e.deleteFramebuffer(this.framebuffer),this.aaFramebuffer&&e.deleteFramebuffer(this.aaFramebuffer),this.depthRenderbuffer&&e.deleteRenderbuffer(this.depthRenderbuffer),this.colorRenderbuffer&&e.deleteRenderbuffer(this.colorRenderbuffer),this.target._renderer.framebuffers.delete(this)}},{key:"begin",value:function(){this.prevFramebuffer=this.target._renderer.activeFramebuffer(),this.prevFramebuffer&&this.prevFramebuffer._beforeEnd(),this.target._renderer.activeFramebuffers.push(this),this._beforeBegin(),this.target.push(),this.target.setCamera(this.defaultCamera),this.target.resetMatrix(),this.target._renderer.uViewMatrix.set(this.target._renderer._curCamera.cameraMatrix),this.target._renderer.uModelMatrix.reset(),this.target._renderer._applyStencilTestIfClipping()}},{key:"_framebufferToBind",value:function(){return this.antialias?this.aaFramebuffer:this.framebuffer}},{key:"_beforeBegin",value:function(){var e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,this._framebufferToBind()),this.target._renderer.viewport(this.width*this.density,this.height*this.density)}},{key:"_beforeEnd",value:function(){if(this.antialias){var e=this.gl,t=(e.bindFramebuffer(e.READ_FRAMEBUFFER,this.aaFramebuffer),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,this.framebuffer),[[e.COLOR_BUFFER_BIT,this.colorP5Texture.glMagFilter]]);this.useDepth&&t.push([e.DEPTH_BUFFER_BIT,this.depthP5Texture.glMagFilter]);for(var r=0,o=t;r<o.length;r++){var n=u(o[r],2),s=n[0],n=n[1];e.blitFramebuffer(0,0,this.width*this.density,this.height*this.density,0,0,this.width*this.density,this.height*this.density,s,n)}}}},{key:"end",value:function(){var e=this.gl;if(this.target.pop(),this.target._renderer.activeFramebuffers.pop()!==this)throw new Error("It looks like you've called end() while another Framebuffer is active.");this._beforeEnd(),this.prevFramebuffer?this.prevFramebuffer._beforeBegin():(e.bindFramebuffer(e.FRAMEBUFFER,null),this.target._renderer.viewport(this.target._renderer._origViewport.width,this.target._renderer._origViewport.height)),this.target._renderer._applyStencilTestIfClipping()}},{key:"draw",value:function(e){this.begin(),e(),this.end()}},{key:"loadPixels",value:function(){var e=this.gl,t=this.target._renderer.activeFramebuffer(),r=(e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),this._glColorFormat());this.pixels=(0,p.readPixelsWebGL)(this.pixels,e,this.framebuffer,0,0,this.width*this.density,this.height*this.density,r.format,r.type),t?e.bindFramebuffer(e.FRAMEBUFFER,t._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null)}},{key:"get",value:function(e,t,r,o){f.default._validateParameters("p5.Framebuffer.get",arguments);var n=this._glColorFormat();if(void 0===e&&void 0===t)t=e=0,r=this.width,o=this.height;else if(void 0===r&&void 0===o)return(e<0||t<0||e>=this.width||t>=this.height)&&(console.warn("The x and y values passed to p5.Framebuffer.get are outside of its range and will be clamped."),e=this.target.constrain(e,0,this.width-1),t=this.target.constrain(t,0,this.height-1)),(0,p.readPixelWebGL)(this.gl,this.framebuffer,e*this.density,t*this.density,n.format,n.type);e=this.target.constrain(e,0,this.width-1),t=this.target.constrain(t,0,this.height-1),r=this.target.constrain(r,1,this.width-e),o=this.target.constrain(o,1,this.height-t);for(var s=(0,p.readPixelsWebGL)(void 0,this.gl,this.framebuffer,e*this.density,t*this.density,r*this.density,o*this.density,n.format,n.type),i=new Uint8ClampedArray(r*o*this.density*this.density*4),a=(i.fill(255),n.type===this.gl.RGB?3:4),l=0;l<o*this.density;l++)for(var u=0;u<r*this.density;u++)for(var c=0;c<4;c++){var d,h=4*(l*r*this.density+u)+c;c<a&&(d=4==a?h:(l*r*this.density+u)*a+c,i[h]=s[d])}e=new f.default.Image(r*this.density,o*this.density);return e.imageData=e.canvas.getContext("2d").createImageData(e.width,e.height),e.imageData.data.set(i),e.pixels=e.imageData.data,e.updatePixels(),1!==this.density&&e.resize(r,o),e}},{key:"updatePixels",value:function(){var e=this.gl,t=(this.colorP5Texture.bindTexture(),this._glColorFormat()),r=t.format===e.RGBA?4:3,r=this.width*this.height*this.density*this.density*r,o=t.type===e.UNSIGNED_BYTE?Uint8Array:Float32Array;if(!(this.pixels instanceof o)||this.pixels.length!==r)throw new Error("The pixels array has not been set correctly. Please call loadPixels() before updatePixels().");e.texImage2D(e.TEXTURE_2D,0,t.internalFormat,this.width*this.density,this.height*this.density,0,t.format,t.type,this.pixels),this.colorP5Texture.unbindTexture();o=this.target._renderer.activeFramebuffer();this.antialias?(this.begin(),this.target.push(),this.target.imageMode(this.target.CENTER),this.target.resetMatrix(),this.target.noStroke(),this.target.clear(),this.target.image(this,0,0),this.target.pop(),this.useDepth&&(e.clearDepth(1),e.clear(e.DEPTH_BUFFER_BIT)),this.end()):(e.bindFramebuffer(e.FRAMEBUFFER,this.framebuffer),this.useDepth&&(e.clearDepth(1),e.clear(e.DEPTH_BUFFER_BIT)),o?e.bindFramebuffer(e.FRAMEBUFFER,o._framebufferToBind()):e.bindFramebuffer(e.FRAMEBUFFER,null))}}]),s}()),e=f.default.Framebuffer=j;r.default=e},{"../core/constants":272,"../core/main":283,"./p5.RendererGL":341,"./p5.Texture":343,"core-js/modules/es.array.fill":156,"core-js/modules/es.array.includes":163,"core-js/modules/es.array.iterator":165,"core-js/modules/es.object.get-own-property-descriptor":186,"core-js/modules/es.object.get-prototype-of":188,"core-js/modules/es.object.to-string":190,"core-js/modules/es.reflect.construct":192,"core-js/modules/es.reflect.get":193,"core-js/modules/es.regexp.to-string":196,"core-js/modules/es.string.includes":199,"core-js/modules/es.string.iterator":200,"core-js/modules/es.symbol":212,"core-js/modules/es.symbol.description":210,"core-js/modules/es.symbol.iterator":211,"core-js/modules/es.typed-array.copy-within":213,"core-js/modules/es.typed-array.every":214,"core-js/modules/es.typed-array.fill":215,"core-js/modules/es.typed-array.filter":216,"core-js/modules/es.typed-array.find":218,"core-js/modules/es.typed-array.find-index":217,"core-js/modules/es.typed-array.float32-array":219,"core-js/modules/es.typed-array.for-each":221,"core-js/modules/es.typed-array.includes":222,"core-js/modules/es.typed-array.index-of":223,"core-js/modules/es.typed-array.iterator":226,"core-js/modules/es.typed-array.join":227,"core-js/modules/es.typed-array.last-index-of":228,"core-js/modules/es.typed-array.map":229,"core-js/modules/es.typed-array.reduce":231,"core-js/modules/es.typed-array.reduce-right":230,"core-js/modules/es.typed-array.reverse":232,"core-js/modules/es.typed-array.set":233,"core-js/modules/es.typed-array.slice":234,"core-js/modules/es.typed-array.some":235,"core-js/modules/es.typed-array.sort":236,"core-js/modules/es.typed-array.subarray":237,"core-js/modules/es.typed-array.to-locale-string":238,"core-js/modules/es.typed-array.to-string":239,"core-js/modules/es.typed-array.uint8-array":242,"core-js/modules/es.typed-array.uint8-clamped-array":243,"core-js/modules/es.weak-map":244,"core-js/modules/web.dom-collections.iterator":246}],335:[function(e,t,r){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return(i="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":o(e)})(e)}e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.flat"),e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.from"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.array.last-index-of"),e("core-js/modules/es.array.map"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.array.unscopables.flat"),e("core-js/modules/es.array-buffer.constructor"),e("core-js/modules/es.map"),e("core-js/modules/es.number.constructor"),e("core-js/modules/es.object.entries"),e("core-js/modules/es.object.get-own-property-descriptor"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.regexp.to-string"),e("core-js/modules/es.set"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.string.sub"),e("core-js/modules/es.weak-map"),e("core-js/modules/web.dom-collections.for-each"),e("core-js/modules/web.dom-collections.iterator"),e("core-js/modules/es.symbol"),e("core-js/modules/es.symbol.description"),e("core-js/modules/es.symbol.iterator"),e("core-js/modules/es.array.concat"),e("core-js/modules/es.array.flat"),e("core-js/modules/es.array.for-each"),e("core-js/modules/es.array.iterator"),e("core-js/modules/es.array.last-index-of"),e("core-js/modules/es.array.map"),e("core-js/modules/es.array.slice"),e("core-js/modules/es.array.unscopables.flat"),e("core-js/modules/es.array-buffer.constructor"),e("core-js/modules/es.map"),e("core-js/modules/es.number.constructor"),e("core-js/modules/es.object.entries"),e("core-js/modules/es.object.to-string"),e("core-js/modules/es.set"),e("core-js/modules/es.string.iterator"),e("core-js/modules/es.string.sub"),e("core-js/modules/web.dom-collections.for-each"),e("core-js/modules/web.dom-collections.iterator"),Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var F=(s=e("../core/main"))&&s.__esModule?s:{default:s},m=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var t=a();if(t&&t.has(e))return t.get(e);var r,o={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(r in e){var s;Object.prototype.hasOwnProperty.call(e,r)&&((s=n?Object.getOwnPropertyDescriptor(e,r):null)&&(s.get||s.set)?Object.defineProperty(o,r,s):o[r]=e[r])}o.default=e,t&&t.set(e,o);return o}(e("../core/constants"));function a(){var e;return"function"!=typeof WeakMap?null:(e=new WeakMap,a=function(){return e},e)}function c(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function U(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var r=[],o=!0,n=!1,s=void 0;try{for(var i,a=e[Symbol.iterator]();!(o=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);o=!0);}catch(e){n=!0,s=e}finally{try{o||null==a.return||a.return()}finally{if(n)throw s}}return r}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function n(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}F.default.Geometry=function(){function o(e,t,r){if(!(this instanceof o))throw new TypeError("Cannot call a class as a function");this.vertices=[],this.boundingBoxCache=null,this.lineVertices=new F.default.DataArray,this.lineTangentsIn=ne