-
Notifications
You must be signed in to change notification settings - Fork 0
/
c.min.js
27 lines (26 loc) · 77.1 KB
/
c.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*C-2.0.0 - 2024-05-05
* License: MIT */
!function r(i,a,o){function s(e,t){if(!a[e]){if(!i[e]){var n="function"==typeof require&&require;if(!t&&n)return n(e,!0);if(l)return l(e,!0);throw(t=new Error("Cannot find module '"+e+"'")).code="MODULE_NOT_FOUND",t}n=a[e]={exports:{}},i[e][0].call(n.exports,function(t){return s(i[e][1][t]||t)},n,n.exports,r,i,a,o)}return a[e].exports}for(var l="function"==typeof require&&require,t=0;t<o.length;t++)s(o[t]);return s}({1:[function(t,e,n){"use strict";function o(t){let e;return e=Array.isArray(t[0])&&16==t[0].length?t[0]:16==t.length?t:t[0]instanceof C?t[0].mat:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],new Float32Array(e)}Object.defineProperty(n,"__esModule",{value:!0}),n.m4=void 0;const x=1e-6;class C{constructor(t){return this.mat=o(arguments),this}multiply(t){var e=o(arguments),n=this.mat[0],r=this.mat[1],i=this.mat[2],a=this.mat[3];return this.mat[0]=n*e[0]+r*e[4]+i*e[8]+a*e[12],this.mat[1]=n*e[1]+r*e[5]+i*e[9]+a*e[13],this.mat[2]=n*e[2]+r*e[6]+i*e[10]+a*e[14],this.mat[3]=n*e[3]+r*e[7]+i*e[11]+a*e[15],n=this.mat[4],r=this.mat[5],i=this.mat[6],a=this.mat[7],this.mat[4]=n*e[0]+r*e[4]+i*e[8]+a*e[12],this.mat[5]=n*e[1]+r*e[5]+i*e[9]+a*e[13],this.mat[6]=n*e[2]+r*e[6]+i*e[10]+a*e[14],this.mat[7]=n*e[3]+r*e[7]+i*e[11]+a*e[15],n=this.mat[8],r=this.mat[9],i=this.mat[10],a=this.mat[11],this.mat[8]=n*e[0]+r*e[4]+i*e[8]+a*e[12],this.mat[9]=n*e[1]+r*e[5]+i*e[9]+a*e[13],this.mat[10]=n*e[2]+r*e[6]+i*e[10]+a*e[14],this.mat[11]=n*e[3]+r*e[7]+i*e[11]+a*e[15],n=this.mat[12],r=this.mat[13],i=this.mat[14],a=this.mat[15],this.mat[12]=n*e[0]+r*e[4]+i*e[8]+a*e[12],this.mat[13]=n*e[1]+r*e[5]+i*e[9]+a*e[13],this.mat[14]=n*e[2]+r*e[6]+i*e[10]+a*e[14],this.mat[15]=n*e[3]+r*e[7]+i*e[11]+a*e[15],this}rotate(t,e,n,r){e instanceof Array&&(n=e[1],r=e[2],e=e[0]);var i=Math.sqrt(e*e+n*n+r*r),i=(e*=1/i,n*=1/i,r*=1/i,this.mat[0]),a=this.mat[1],o=this.mat[2],s=this.mat[3],l=this.mat[4],c=this.mat[5],f=this.mat[6],u=this.mat[7],d=this.mat[8],h=this.mat[9],g=this.mat[10],m=this.mat[11],p=Math.sin(t),t=Math.cos(t),b=1-t,v=e*e*b+t,x=n*e*b+r*p,C=r*e*b-n*p,y=e*n*b-r*p,P=n*n*b+t,k=r*n*b+e*p,w=e*r*b+n*p,n=n*r*b-e*p,e=r*r*b+t;return this.mat[0]=i*v+l*x+d*C,this.mat[1]=a*v+c*x+h*C,this.mat[2]=o*v+f*x+g*C,this.mat[3]=s*v+u*x+m*C,this.mat[4]=i*y+l*P+d*k,this.mat[5]=a*y+c*P+h*k,this.mat[6]=o*y+f*P+g*k,this.mat[7]=s*y+u*P+m*k,this.mat[8]=i*w+l*n+d*e,this.mat[9]=a*w+c*n+h*e,this.mat[10]=o*w+f*n+g*e,this.mat[11]=s*w+u*n+m*e,this}scale(t,e,n){return t instanceof Array&&(e=t[1],n=t[2],t=t[0]),this.mat[0]*=t,this.mat[1]*=t,this.mat[2]*=t,this.mat[3]*=t,this.mat[4]*=e,this.mat[5]*=e,this.mat[6]*=e,this.mat[7]*=e,this.mat[8]*=n,this.mat[9]*=n,this.mat[10]*=n,this.mat[11]*=n,this}rotateX(t){return this.rotate(t,1,0,0),this}rotateY(t){return this.rotate(t,0,1,0),this}rotateZ(t){return this.rotate(t,0,0,1),this}translate(t,e,n=0){return this.mat[12]+=this.mat[0]*t+this.mat[4]*e+this.mat[8]*n,this.mat[13]+=this.mat[1]*t+this.mat[5]*e+this.mat[9]*n,this.mat[14]+=this.mat[2]*t+this.mat[6]*e+this.mat[10]*n,this.mat[15]+=this.mat[3]*t+this.mat[7]*e+this.mat[11]*n,this}clone(){var e=[];for(let t=0;t<this.mat.length;t++)e.push(this.mat[t]);return new C(e)}static lookAt(t,e,n){let r,i,a,o,s,l,c,f,u,d;var h=t[0],g=t[1],t=t[2],m=n[0],p=n[1],n=n[2],b=e[0],v=e[1],e=e[2];if(Math.abs(h-b)<x&&Math.abs(g-v)<x&&Math.abs(t-e)<x)return C.identity();c=h-b,f=g-v,u=t-e,c*=d=1/Math.hypot(c,f,u),f*=d,u*=d,r=p*u-n*f,i=n*c-m*u,a=m*f-p*c,(d=Math.hypot(r,i,a))?(d=1/d,r*=d,i*=d,a*=d):(r=0,i=0,a=0),o=f*a-u*i,s=u*r-c*a,l=c*i-f*r,(d=Math.hypot(o,s,l))?(d=1/d,o*=d,s*=d,l*=d):(o=0,s=0,l=0);b=new Float32Array(16);return b[0]=r,b[1]=o,b[2]=c,b[3]=0,b[4]=i,b[5]=s,b[6]=f,b[7]=0,b[8]=a,b[9]=l,b[10]=u,b[11]=0,b[12]=-(r*h+i*g+a*t),b[13]=-(o*h+s*g+l*t),b[14]=-(c*h+f*g+u*t),b[15]=1,new C(b)}static identity(){return new C(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)}static perspective(t,e,n,r,i){var e=1/Math.tan(e/2),a=t.mat;return a[0]=e/n,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=e,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[11]=-1,a[12]=0,a[13]=0,a[15]=0,null!=i&&i!==1/0?(a[10]=(i+r)*(n=1/(r-i)),a[14]=2*i*r*n):(a[10]=-1,a[14]=-2*r),t}}n.m4=C},{}],2:[function(t,e,n){"use strict";var r=t("../color/color_reader.js"),l=t("./m4.js"),t=t("./webgl.js");function c(e,t){let n=[],r=!1;if(e.length%t!=0)throw Error("excess component in points");if(e.length/t==2){r=!0;for(let t=0;t<e.length;t+=2)n.push(e[t],e[t+1],0)}else n=e;return[n,r]}t.WebGL.prototype.background=function(t,e,n,r){return this.gl.clearColor(t,e,n,r),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT),this},t.WebGL.prototype.clear=function(){return this.background(0,0,0,0),this},t.WebGL.prototype.putBufferData=function(t,e=this.gl.ARRAY_BUFFER,n=this.gl.STATIC_DRAW){var r=this.gl.createBuffer();return this.gl.bindBuffer(e,r),this.gl.bufferData(e,new Float32Array(t),n),r},t.WebGL.prototype.setGeometry=function(t,e=3,n=0,r=this.gl.TRIANGLES,i=this.gl.ARRAY_BUFFER,a=this.gl.STATIC_DRAW){var o=this.gl,s=this.program;return this.computeMatrix(),o.uniformMatrix4fv(s.uniforms.matrix,!1,this.matrix.mat),o.uniform4fv(s.uniforms.vertexColor,this.styles.fillColor),this.putBufferData(c(t,e)[0]),o.enableVertexAttribArray(s.attributes.vertexPosition),o.vertexAttribPointer(s.attributes.vertexPosition,3,o.FLOAT,!1,0,0),o.drawArrays(r,n,e),this},t.WebGL.prototype.computeMatrix=function(){this.matrix=this.projectionMatrix.clone(),this.matrix.multiply(this.viewMatrix).multiply(this.worldMatrix)},t.WebGL.prototype.line=function(){var t,e,n,r,i,[a,o]=c(arguments,2),s=this.styles.fillColor;return this.styles.fillColor=this.styles.strokeColor,1==this.styles.lineWidth?this.setGeometry(a,2,0,this.gl.LINES):o&&(o=a[0],t=a[1],e=a[3],a=a[4],i=Math.atan2(a-t,e-o)+Math.PI/2,n=this.styles.lineWidth/2,r=Math.cos(i)*n,i=Math.sin(i)*n,this.setGeometry([o-r,t-i,0,o+r,t+i,0,e+r,a+i,0,e+r,a+i,0,e-r,a-i,0,o-r,t-i,0],6)),this.styles.fillColor=s,this},t.WebGL.prototype.rotateX=function(t){return this.worldMatrix.rotateX(t),this},t.WebGL.prototype.rotateY=function(t){return this.worldMatrix.rotateY(t),this},t.WebGL.prototype.rotateZ=function(t){return this.worldMatrix.rotateZ(t),this},t.WebGL.prototype.translate=function(t,e=0,n=0){return this.worldMatrix.translate(t,e,n),this},t.WebGL.prototype.scale=function(t,e=t,n=1){return this.worldMatrix.scale(t,e,n),this},t.WebGL.prototype.fill=function(...t){t=(0,r.readColor)(t).rgbaA;this.styles.fillColor=[t[0]/255,t[1]/255,t[2]/255,t[3]]},t.WebGL.prototype.fillRect=function(){let t,e,n,r,i,a=0;t=arguments[a++],e=arguments[a++],n=4==arguments.length?0:arguments[a++],r=arguments[a++],i=arguments[a++],this.setGeometry([t,e,n,t+r,e,n,t+r,e+i,n,t+r,e+i,n,t,e+i,n,t,e,n],6)},t.WebGL.prototype.triangle=function(...t){this.setGeometry(t,3)},t.WebGL.prototype.lineWidth=function(t){this.styles.lineWidth=t},t.WebGL.prototype.stroke=function(...t){t=(0,r.readColor)(t).rgbaA;this.styles.strokeColor=[t[0]/255,t[1]/255,t[2]/255,t[3]]},t.WebGL.prototype.cube=function(t=200){for(var e=this.gl,n=(this.putBufferData([-1*t,-1*t,+t,+t,-1*t,+t,+t,+t,+t,-1*t,+t,+t,-1*t,-1*t,-1*t,-1*t,+t,-1*t,+t,+t,-1*t,+t,-1*t,-1*t,-1*t,+t,-1*t,-1*t,+t,+t,+t,+t,+t,+t,+t,-1*t,-1*t,-1*t,-1*t,+t,-1*t,-1*t,+t,-1*t,+t,-1*t,-1*t,+t,+t,-1*t,-1*t,+t,+t,-1*t,+t,+t,+t,+t,-1*t,+t,-1*t,-1*t,-1*t,-1*t,-1*t,+t,-1*t,+t,+t,-1*t,+t,-1*t]),[[1,1,1,1],[1,0,0,1],[0,1,0,1],[0,0,1,1],[1,1,0,1],[1,0,1,1]]),r=[],i=0;i<n.length;++i)var a=n[i],r=r.concat(a,a,a,a);this.putBufferData(r);var t=this.putBufferData([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23],e.ELEMENT_ARRAY_BUFFER),o=(e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),45*Math.PI/180),s=e.canvas.clientWidth/e.canvas.clientHeight,o=(l.m4.perspective(this.projectionMatrix,o,s,.1,100),this.worldMatrix.translate(-0,0,-6),this.worldMatrix.rotateZ(0),this.worldMatrix.rotateX(0),e.vertexAttribPointer(this.program.attributes.vertexPosition,3,e.FLOAT,!1,0,0),e.enableVertexAttribArray(this.program.attributes.vertexPosition),e.vertexAttribPointer(this.program.uniforms.vertexColor,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.useProgram("multiColor"),this.computeMatrix(),e.uniformMatrix4fv(this.program.uniforms.matrix,!1,this.matrix.mat),e.UNSIGNED_SHORT);e.drawElements(e.TRIANGLES,36,o,0)},t.WebGL.prototype.lookAt=function(t,e=[0,0,0],n=[0,1,0]){this.viewMatrix=l.m4.lookAt(t,e,n)},t.WebGL.prototype.perspective=function(t,e,n,r){l.m4.perspective(this.projectionMatrix,t,e,n,r)}},{"../color/color_reader.js":6,"./m4.js":1,"./webgl.js":3}],3:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.WebGL=void 0,n.createWebGL=function(t){var e=a.C.workingContext;var n=a.C.workingCanvas;t=(0,o.applyDefault)({deleteOld:!1,dpr:Math.ceil(globalThis.devicePixelRatio),width:n.rWidth,height:n.rHeight},t);var n=e.canvas.parentElement,r=a.C.makeCanvas(t);t.deleteOld?n.removeChild(e.canvas):(n.style.position="relative",r.style.position="absolute",r.style.top="0",r.style.left="0");for(var i in e.canvas.events)r.addEventListener(i,e.canvas.events[i]);return n.appendChild(r),new s(r)};var a=t("../main.js"),o=t("../utils.js"),r=t("./m4.js");class s{constructor(t){let e=t.getContext("webgl");if(!(e=e||t.getContext("experimental-webgl")))throw new Error("WebGL is not supported");for(var n in e.viewport(0,0,t.width,t.height),this.gl=e,this.canvas=t,this.width=t.rWidth,this.height=t.rHeight,this.dpr=t.dpr||Math.ceil(globalThis.devicePixelRatio),this.canvas=t,this.sources={singleColor:{vertex:`attribute vec3 a_position;
uniform vec2 u_resolution;
uniform mat4 u_matrix;
void main() {
gl_Position = u_matrix * vec4(a_position, 1) / vec4(u_resolution, 1, 1);
}`,fragment:`precision mediump float;
uniform vec4 u_color;
void main() {
gl_FragColor = u_color;
}`,uniforms:{resolution:"u_resolution",matrix:"u_matrix",vertexColor:"u_color"},attributes:{vertexPosition:"a_position"},program:null},multiColor:{vertex:`attribute vec3 a_position;
attribute vec4 aVertexColor;
uniform vec2 u_resolution;
uniform mat4 u_matrix;
varying lowp vec4 vColor;
void main() {
gl_Position = u_matrix * vec4(a_position, 1);
// / vec4(u_resolution, 1, 1);
vColor = aVertexColor;
}`,fragment:`precision mediump float;
varying lowp vec4 vColor;
void main(void) {
gl_FragColor = vColor;
}`,uniforms:{resolution:"u_resolution",matrix:"u_matrix"},attributes:{vertexPosition:"a_position",vertexColor:"aVertexColor"},program:null}},this.sources)this.sources[n]=this.createCustomProgram(this.sources[n]);this.program=this.sources.singleColor,e.useProgram(this.program.program),this.projectionMatrix=new r.m4,this.worldMatrix=new r.m4,this.viewMatrix=new r.m4,this.matrix=new r.m4,e.uniform2f(this.program.uniforms.resolution,t.width/2/this.dpr,t.height/2/this.dpr),this.styles={fillColor:[1,0,1,1],strokeColor:[1,1,0,1],lineWidth:1}}useProgram(t){if(this.sources[t])this.program=this.sources[t],this.gl.useProgram(this.program.program),this.gl.uniform2f(this.program.uniforms.resolution,this.canvas.width/2/this.dpr,this.canvas.height/2/this.dpr);else{if(!t.program)throw new Error(t+" not fouund");this.program=t,this.gl.useProgram(t.program)}}createShader(t,e){t=this.gl.createShader(t);return this.gl.shaderSource(t,e),this.gl.compileShader(t),this.gl.getShaderParameter(t,this.gl.COMPILE_STATUS)?t:(console.error(this.gl.getShaderInfoLog(t)),this.gl.deleteShader(t),null)}createProgram(t,e){var n=this.gl.createProgram();return this.gl.attachShader(n,t),this.gl.attachShader(n,e),this.gl.linkProgram(n),this.gl.getProgramParameter(n,this.gl.LINK_STATUS)?n:(console.error(this.gl.getProgramInfoLog(n)),this.gl.deleteProgram(n),null)}createProgramFromSource(t,e){t=this.createShader(this.gl.VERTEX_SHADER,t),e=this.createShader(this.gl.FRAGMENT_SHADER,e);return this.createProgram(t,e)}resizeCanvas(t=300,e=300){var n=globalThis.devicePixelRatio,r=Math.round(t*n),n=Math.round(e*n);this.canvas.style.width=t+"px",this.canvas.style.height=e+"px",this.canvas.width=r,this.canvas.height=n}putProperties(){var t=this.gl,e=t.FLOAT,n=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,n),t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(this.program.attributes.vertexPosition,3,e,!1,0,0),t.enableVertexAttribArray(this.program.attributes.vertexPosition),e=t.FLOAT,t.bindBuffer(t.ARRAY_BUFFER,this.program.uniforms.vertexColor),t.vertexAttribPointer(this.program.uniforms.vertexColor,4,e,!1,0,0)}createCustomProgram(t){var e,n,r,i=this.gl,a={},o={};for(n in t.vertex instanceof HTMLScriptElement&&(t.vertex=t.vertex.textContent.trim()),t.fragment instanceof HTMLScriptElement&&(t.fragment=t.fragment.textContent.trim()),e=this.createProgramFromSource(t.vertex,t.fragment),t.attributes){var s=t.attributes[n];o[n]=i.getAttribLocation(e,s)}for(r in t.uniforms){var l=t.uniforms[r];a[r]=i.getUniformLocation(e,l)}return{program:e,uniforms:a,attributes:o,vertex:t.vertex,fragment:t.fragment}}attribUsage(t,e=3,n=this.gl.FLOAT,r=!1,i=0,a=0){this.gl.enableVertexAttribArray(t),this.gl.vertexAttribPointer(t,e,n,r,i,a)}}n.WebGL=s},{"../main.js":16,"../utils.js":37,"./m4.js":1}],4:[function(t,e,n){"use strict";var r=t("./utils.js"),i=t("./main.js"),a=R(t("./settings.js")),o=R(t("./constants/math.js")),s=R(t("./constants/drawing.js")),l=R(t("./constants/color_palettes.js")),c=R(t("./color/gradients.js")),f=R(t("./color/random.js")),u=R(t("./color/color_reader.js")),d=R(t("./color/interpolation.js")),h=R(t("./color/color_converters.js")),g=R(t("./image/image.js")),m=R(t("./image/processing.js")),p=R(t("./objects/tex.js")),b=R(t("./objects/text.js")),v=R(t("./objects/braces.js")),x=R(t("./objects/arrows.js")),C=R(t("./objects/geometry.js")),y=R(t("./objects/functions.js")),P=R(t("./objects/coordinate_systems/axes.js")),k=R(t("./objects/coordinate_systems/number_line.js")),w=R(t("./objects/coordinate_systems/number_plane.js")),M=R(t("./objects/coordinate_systems/polar_plane.js")),j=R(t("./objects/more_shapes.js")),T=R(t("./math/functions.js")),S=R(t("./math/points.js")),A=R(t("./math/random.js")),I=R(t("./math/aritmetics.js")),_=R(t("./math/rate_functions.js")),L=R(t("./WebGL/webgl.js")),t=R(t("./WebGL/settings.js"));function E(t){var e,n;return"function"!=typeof WeakMap?null:(e=new WeakMap,n=new WeakMap,(E=function(t){return t?n:e})(t))}function R(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};e=E(e);if(e&&e.has(t))return e.get(t);var n,r,i={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(n in t)"default"!==n&&{}.hasOwnProperty.call(t,n)&&((r=a?Object.getOwnPropertyDescriptor(t,n):null)&&(r.get||r.set)?Object.defineProperty(i,n,r):i[n]=t[n]);return i.default=t,e&&e.set(t,i),i}[{defineProperties:r.defineProperties,C:i.C},a,o,s,l,c,f,u,d,h,g,m,p,b,v,x,C,y,P,k,w,M,j,T,S,A,I,_,L,t].forEach(t=>(0,r.defineProperties)(t))},{"./WebGL/settings.js":2,"./WebGL/webgl.js":3,"./color/color_converters.js":5,"./color/color_reader.js":6,"./color/gradients.js":7,"./color/interpolation.js":8,"./color/random.js":9,"./constants/color_palettes.js":10,"./constants/drawing.js":12,"./constants/math.js":13,"./image/image.js":14,"./image/processing.js":15,"./main.js":16,"./math/aritmetics.js":17,"./math/functions.js":18,"./math/points.js":19,"./math/random.js":20,"./math/rate_functions.js":21,"./objects/arrows.js":22,"./objects/braces.js":23,"./objects/coordinate_systems/axes.js":24,"./objects/coordinate_systems/number_line.js":26,"./objects/coordinate_systems/number_plane.js":27,"./objects/coordinate_systems/polar_plane.js":28,"./objects/functions.js":30,"./objects/geometry.js":31,"./objects/more_shapes.js":32,"./objects/tex.js":33,"./objects/text.js":34,"./settings.js":36,"./utils.js":37}],5:[function(t,e,n){"use strict";function o(t,e,n){return n<0&&(n+=1),1<n&&--n,n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+(e-t)*(2/3-n)*6:t}Object.defineProperty(n,"__esModule",{value:!0}),n.HSLToRGB=function(t,e,n){let r,i,a;t/=360,0===e?r=i=a=n:(e=2*n-(n=n<.5?n*(1+e):n+e-n*e),r=o(e,n,t+1/3),i=o(e,n,t),a=o(e,n,t-1/3));return[r,i,a]},n.HSVToRGB=function(t,e,n){let r,i,a,o=Math.floor(t/60),s=t/60-o,l=n*(1-e),c=n*(1-s*e),f=n*(1-(1-s)*e);0==(o%=6)?(r=n,i=f,a=l):1==o?(r=c,i=n,a=l):2==o?(r=l,i=n,a=f):3==o?(r=l,i=c,a=n):4==o?(r=f,i=l,a=n):5==o&&(r=n,i=l,a=c);return[r,i,a]},n.RGBToHSL=function(t,e,n){let r=Math.max(t,e,n),i=Math.min(t,e,n),a,o,s=(r+i)/2;{var l;r===i?a=o=0:(l=r-i,o=.5<s?l/(2-r-i):l/(r+i),r==t?a=(e-n)/l+(e<n?6:0):r==e?a=(n-t)/l+2:r==n&&(a=(t-e)/l+4),a/=6)}return[a,o,s]},n.RGBToHSV=function(t,e,n){let r=Math.max(t,e,n),i=Math.min(t,e,n),a,o=r,s=r-i,l=0===r?0:s/r;r===i?a=0:(r==t?a=(e-n)/s+(e<n?6:0):r==e?a=(n-t)/s+2:r==n&&(a=(t-e)/s+4),a/=6);return[a,l,o]},n.hue2RGB=o},{}],6:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.readColor=function(...t){let e;Array.isArray(t[0])&&(t=t[0]);var n=t[0];if("number"==typeof n)1===t.length?e=[n,n,n,1]:2===t.length?e=[n,t[1],0,1]:3===t.length?e=[n,t[1],t[2],1]:4===t.length&&(e=[n,t[1],t[2],t[3]]);else{if("string"!=typeof n)return{rgbaA:e=n,rgba:e,hex6:e,hex8:e,hex:e,hsl:e};t=n.replace(/\s/g,"").toLowerCase();if(s.Colors[t])e=s.Colors[t],e=[parseInt(e.substr(1,2),16),parseInt(e.substr(3,2),16),parseInt(e.substr(5,2),16),1];else if(l.test(t))(e=l.exec(t).slice(1).map(t=>parseInt(t+t,16)))[3]=1;else if(f.test(t))(e=f.exec(t).slice(1).map(t=>parseInt(t,16)))[3]=1;else if(c.test(t))(e=c.exec(t).slice(1).map(t=>parseInt(t+t,16)))[3]/=255;else if(u.test(t))(e=u.exec(t).slice(1).map(t=>parseInt(t,16)))[3]/=255;else if(d.test(t))(e=d.exec(t).slice(1).map(t=>parseInt(t,10)))[3]=1;else{if(!h.test(t))throw new Error("Cannot convert given value to color: "+t);e=h.exec(t).slice(1).map((t,e)=>3==e?parseFloat(t):parseInt(t,10))}}let r=e[3],i=(e[3]*=255,"#"),a=e,o=(a.map((t,e)=>{e<3&&(e=Math.round(t).toString(16),i+=1==e.length?"0"+e:e)}),"#");return(a=e).map((t,e)=>{e<4&&(e=Math.round(t).toString(16),o+=1==e.length?"0"+e:e)}),e[3]=r,{rgbaA:e,rgba:`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]})`,hex6:i,hex8:o,hex:o,hsl:`hsl(${e[0]}, ${e[1]}, ${e[2]})`}};var s=t("../constants/colors.js");let l=/^#([a-f0-9])([a-f0-9])([a-f0-9])$/i,c=/^#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])$/i,f=/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i,u=/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i,d=/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/i,h=/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(?:(\d+(?:\.\d+)?)|(?:\.\d+))\)$/i},{"../constants/colors.js":11}],7:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.linearGradient=function(t,e,n){var r=l.C.workingContext,i=r.createLinearGradient(t[0],t[1],e[0],e[1]);if("Array"==(0,c.type)(n)){var a={},o=1/n.length;for(let t=0;t<n.length;t++)a[o*t]=n[t];n=a}else if("Object"!=(0,c.type)(n))throw new Error("Color Stops must be an Array or an Object");for(let t=Object.keys(n||{}),e=0;e<t.length;e++){var s=Number(t[e]);i.addColorStop(s,n[s])}return i};var l=t("../main.js"),c=t("../utils.js")},{"../main.js":16,"../utils.js":37}],8:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getInterpolatedColorList=function(e,n=0,t=5,r){if(e.length<2)throw new Error("Atleast 2 colors are needed to create interpolatable object");var i=(t-n)/(e.length-1),a={};for(let t=0;t<e.length;t++){var o=n+t*i,s=(0,l.readColor)(e[t]).rgbaA;s[3]=isNaN(r)?s[3]:r,a[o]=s}return a},n.lerpColor=s,n.lerpColorArray=function(t,e,n=0,r=1){var i=t.length-1;if(r<=e)return t[i];if(e<=n)return t[0];r=(e=(e-n)/(r-n))*i,n=Math.floor(r);return s(t[n],t[n+1],r-n)},n.lerpColorObject=function(e,n){var r=Object.keys(e||{}).sort(),t=Math.min(...r),i=Math.max(...r);let a="#000000";if(i<=n)return e[i];if(n<=t)return e[t];for(let t=0;t<r.length-1;t++){var o=r[t];if(o<n){a=s(e[o],e[r[t+1]],(n-o)/(r[t+1]-o));break}if(n==o){a=e[o];break}}return a};var l=t("./color_reader.js");function s(t,e,n){t=(0,l.readColor)(t).rgbaA,e=(0,l.readColor)(e).rgbaA;return(0,l.readColor)(Math.min(Math.max(0,(e[0]-t[0])*n+t[0]),255),Math.min(Math.max(0,(e[1]-t[1])*n+t[1]),255),Math.min(Math.max(0,(e[2]-t[2])*n+t[2]),255),Math.min(Math.max(0,(e[3]-t[3])*n+t[3]),255)).hex8}},{"./color_reader.js":6}],9:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.randomColor=function(){let e="#";for(let t=0;t<3;t++){var n=(0,i.randomInt)(255).toString(16);n=1===n.length?0+n:n,e+=n}return e},n.randomDefinedColor=function(){return r.Colors[a[(0,i.randomInt)(a.length-1)]]};var r=t("../constants/colors.js"),i=t("../math/random.js");let a=Object.keys(r.Colors);n=a.indexOf("TRANSPARENT");a=a.slice(0,n).concat(a.slice(n+1))},{"../constants/colors.js":11,"../math/random.js":20}],10:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ColorPalettes=void 0;var r,i=n.ColorPalettes={YlGn:"#ffffe5 #f7fcb9 #d9f0a3 #addd8e #78c679 #41ab5d #238443 #006837 #004529",GnBu:"#f7fcf0 #e0f3db #ccebc5 #a8ddb5 #7bccc4 #4eb3d3 #2b8cbe #0868ac #084081",BuGn:"#f7fcfd #e5f5f9 #ccece6 #99d8c9 #66c2a4 #41ae76 #238b45 #006d2c #00441b",PuBu:"#fff7fb #ece7f2 #d0d1e6 #a6bddb #74a9cf #3690c0 #0570b0 #045a8d #023858",BuPu:"#f7fcfd #e0ecf4 #bfd3e6 #9ebcda #8c96c6 #8c6bb1 #88419d #810f7c #4d004b",RdPu:"#fff7f3 #fde0dd #fcc5c0 #fa9fb5 #f768a1 #dd3497 #ae017e #7a0177 #49006a",PuRd:"#f7f4f9 #e7e1ef #d4b9da #c994c7 #df65b0 #e7298a #ce1256 #980043 #67001f",OrRd:"#fff7ec #fee8c8 #fdd49e #fdbb84 #fc8d59 #ef6548 #d7301f #b30000 #7f0000",Reds:"#fff5f0 #fee0d2 #fcbba1 #fc9272 #fb6a4a #ef3b2c #cb181d #a50f15 #67000d",Blues:"#f7fbff #deebf7 #c6dbef #9ecae1 #6baed6 #4292c6 #2171b5 #08519c #08306b",Greys:"#ffffff #f0f0f0 #d9d9d9 #bdbdbd #969696 #737373 #525252 #252525 #000000",YlGnBu:"#ffffd9 #edf8b1 #c7e9b4 #7fcdbb #41b6c4 #1d91c0 #225ea8 #253494 #081d58",PuBuGn:"#fff7fb #ece2f0 #d0d1e6 #a6bddb #67a9cf #3690c0 #02818a #016c59 #014636",YlOrRd:"#ffffcc #ffeda0 #fed976 #feb24c #fd8d3c #fc4e2a #e31a1c #bd0026 #800026",YlOrBr:"#ffffe5 #fff7bc #fee391 #fec44f #fe9929 #ec7014 #cc4c02 #993404 #662506",Greens:"#f7fcf5 #e5f5e0 #c7e9c0 #a1d99b #74c476 #41ab5d #238b45 #006d2c #00441b",Purples:"#fcfbfd #efedf5 #dadaeb #bcbddc #9e9ac8 #807dba #6a51a3 #54278f #3f007d",Oranges:"#fff5eb #fee6ce #fdd0a2 #fdae6b #fd8d3c #f16913 #d94801 #a63603 #7f2704",PuOr:"#7f3b08 #b35806 #e08214 #fdb863 #fee0b6 #f7f7f7 #d8daeb #b2abd2 #8073ac #542788 #2d004b",BrBG:"#543005 #8c510a #bf812d #dfc27d #f6e8c3 #f5f5f5 #c7eae5 #80cdc1 #35978f #01665e #003c30",PRGn:"#40004b #762a83 #9970ab #c2a5cf #e7d4e8 #f7f7f7 #d9f0d3 #a6dba0 #5aae61 #1b7837 #00441b",PiYG:"#8e0152 #c51b7d #de77ae #f1b6da #fde0ef #f7f7f7 #e6f5d0 #b8e186 #7fbc41 #4d9221 #276419",RdBu:"#67001f #b2182b #d6604d #f4a582 #fddbc7 #f7f7f7 #d1e5f0 #92c5de #4393c3 #2166ac #053061",RdGy:"#67001f #b2182b #d6604d #f4a582 #fddbc7 #ffffff #e0e0e0 #bababa #878787 #4d4d4d #1a1a1a",RdYlBu:"#a50026 #d73027 #f46d43 #fdae61 #fee090 #ffffbf #e0f3f8 #abd9e9 #74add1 #4575b4 #313695",RdYlGn:"#a50026 #d73027 #f46d43 #fdae61 #fee08b #ffffbf #d9ef8b #a6d96a #66bd63 #1a9850 #006837",Spectral:"#9e0142 #d53e4f #f46d43 #fdae61 #fee08b #ffffbf #e6f598 #abdda4 #66c2a5 #3288bd #5e4fa2",Heat:"#0000ff #00ffff #00ff00 #ffff00 #ff0000",Jet:"#000080 #0000ff #0080ff #00ffff #80ff80 #ffff00 #ff8000 #ff0000 #800000",Parula:"#352a87 #2450d0 #0a72de #128ad2 #06a4ca #1ab2b1 #51bd90 #92bf72 #c6bc5e #f6ba46 #f9d528 #f9fb0e",Magma:"#000004 #120d31 #331067 #5a167e #7e2482 #a3307e #c83e73 #e95462 #f97b5d #fea973 #fed395 #fcfdbf",Inferno:"#000004 #140b34 #390963 #61136e #85216b #a92e5e #cb4149 #e65d2f #f78212 #fcae12 #f5db4c #fcffa4",Plasma:"#0d0887 #3e049c #6300a7 #8707a6 #a62098 #c03a83 #d5546e #e76f5a #f58c46 #fdae32 #fcd225 #f0f921",Viridis:"#440154 #482173 #433e85 #38598c #2d708e #25858e #1e9b8a #2ab07f #50c46a #86d549 #c2df23 #fde725",Cividis:"#00204d #00306f #2a406c #48526b #5e626e #727374 #878479 #9e9677 #b6a971 #d0be67 #ead357 #ffea46",GitHub:"#eeeeee #c6e48b #7bc96f #239a3b #196127",Turbo:"#30123b #4454c3 #448ffe #1fc9dd #2aefa1 #7dff56 #c1f334 #f1cb3a #fe932a #ea4e0d #be2102 #7a0403",Grey:"#000000 #ffffff",Gray:"#000000 #ffffff"};for(r in i)i[r]=i[r].split(" ")},{}],11:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.Colors=void 0;n.Colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}},{}],12:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ULTRA_EXPANDED=n.ULTRA_CONDENSED=n.TOP=n.START=n.SQUARE=n.SEMI_EXPANDED=n.SEMI_CONDENSED=n.ROUND=n.RIGHT=n.OBLIQUE=n.NORMAL=n.MITER=n.MILTER=n.MIDDLE=n.LEFT=n.ITALIC=n.IDEOGRAPHIC=n.HANGING=n.EXTRA_EXPANDED=n.EXTRA_CONDENSED=n.EXPANDED=n.END=n.CONDENSED=n.CENTER=n.BUTT=n.BOTTOM=n.BEVEL=n.ALPHABETIC=void 0;n.BUTT="butt",n.SQUARE="square",n.ROUND="round",n.MILTER="milter",n.BEVEL="bevel",n.MITER="miter",n.LEFT="left",n.RIGHT="right",n.CENTER="center",n.START="start",n.END="end",n.TOP="top",n.HANGING="hanging",n.MIDDLE="middle",n.ALPHABETIC="alphabetic",n.IDEOGRAPHIC="ideographic",n.BOTTOM="bottom",n.ULTRA_CONDENSED="ultra-condensed",n.EXTRA_CONDENSED="extra-condensed",n.CONDENSED="condensed",n.SEMI_CONDENSED="semi-condensed",n.NORMAL="normal",n.SEMI_EXPANDED="semi-expanded",n.EXPANDED="expanded",n.EXTRA_EXPANDED="extra-expanded",n.ULTRA_EXPANDED="ultra-expanded",n.ITALIC="italic",n.OBLIQUE="oblique"},{}],13:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.UNIT_VEC=n.TWO_PI=n.TIERCE_PI=n.TAU=n.SQRT2=n.RAD=n.QUATER_PI=n.PI=n.PHI=n.ORIGIN=n.LN2=n.LN10=n.HALF_PI=n.E=n.DEG=void 0;n.E=2.718281828459045,n.LN2=.6931471805599453,n.LN10=2.302585092994046,n.PI=3.141592653589793,n.HALF_PI=1.5707963267948966,n.TIERCE_PI=1.0471975511965976,n.QUATER_PI=.7853981633974483,n.TAU=6.283185307179586,n.TWO_PI=6.283185307179586,n.SQRT2=1.4142135623730951,n.PHI=1.618033988749894,n.DEG=Math.PI/180,n.RAD=180/Math.PI,n.ORIGIN=[0,0],n.UNIT_VEC=[1,1]},{}],14:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.drawImage=function(t){let e=a.C.workingContext,n,r;r=arguments.length<6?(n=arguments[1],arguments[2]):(n=arguments[5],arguments[6]);e.save(),e.translate(n,r),e.yAxisInverted&&e.scale(1,-1);e.XAxisInverted&&e.scale(-1,1);e.drawImage(t,0,0,...Array.prototype.slice.call(arguments,3)),e.restore()},n.loadImage=r,n.loadImagePromise=function(n){return new Promise((t,e)=>{r(n,t,e)})},n.pixel=function(t,e,n,r){var i=a.C.workingContext;n&&(i.fillStyle=n);r=r||1/a.C.dpr;i.fillRect(t,e,r,r)};var a=t("../main.js");function r(t,e,n){var r=new Image;return r.src=t,"function"==typeof e&&r.addEventListener("load",()=>e(r),!1),"function"==typeof n&&r.addEventListener("error",t=>n(t,r),!1),r}},{"../main.js":16}],15:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getPixelColor=function(t,e,n){n=t.width*n+e;return t.data.subarray(n,n+4)},n.hasNeighbourColor=function(n,t,r,i){var a=t.data,o=t.width;for(let e=r-1;e<=r+1;e++)for(let t=i-1;t<=i+1;t++)if(e!==r||t!==i){var s=o*i+r,s=a.subarray(s,s+4);if(s[0]===n[0]&&s[1]===n[1]&&s[2]===n[2]&&s[3]===n[3])return!0}return!1},n.imageDataToColorArray=function(t){var e=t.width,n=t.height,r=Array.from(t.data),i=[];for(var a=0;a<n;a++){i.push([]);for(var o=0;o<e;o++){var s=n*a+o,l=r[s],c=r[s+1],f=r[s+2],s=r[s+3];i[a].push([l,c,f,s])}}return i},n.imageToData=function(t,e,n,r,i,a=!1){var o=document.createElement("canvas"),s=o.getContext("2d"),l=y.C.dpr;return e=e*l||0,n=n*l||0,o.width=r=(isNaN(r)?t.width:r)*l,o.height=i=(isNaN(i)?t.height:i)*l,s.imageSmoothingEnabled=a,s.drawImage(t,0,0,r,i),s.getImageData(e,n,r,i)},n.replaceColorInImage=function(t,e,n,r=!1,i=0){var a=t.data,o=y.C.workingContext.createImageData(t.width,t.height);var[s,l,c,f]=(0,C.readColor)(e).rgbaA,[u,d,h,g]=(0,C.readColor)(n).rgbaA;let m=0;for(let t=0;t<a.length;t+=4){var p=a[t],b=a[t+1],v=a[t+2],x=a[t+3];Math.abs(p-s)<=i&&Math.abs(b-l)<=i&&Math.abs(v-c)<=i&&(!r||Math.abs(x-f)<=i)?(o.data[t]=u,o.data[t+1]=d,o.data[t+2]=h,o.data[t+3]=r?g:255):(o.data[t]=p,o.data[t+1]=b,o.data[t+2]=v,o.data[t+3]=r?x:255,m++)}return o};var C=t("../color/color_reader.js"),y=t("../main.js")},{"../color/color_reader.js":6,"../main.js":16}],16:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.C=g;var h=t("./utils.js");function g(t,e,n={}){const r={width:200,height:200,dpr:Math.ceil(globalThis.devicePixelRatio||1),doFill:!0,doStroke:!0,pathStarted:!1,yAxisInverted:!1,xAxisInverted:!1,pauseAnimations:!1,netRotation:0,currentLoop:void 0,currentLoopName:void 0,textAlign:"start",textBaseline:"alphabetic",fillStyle:"#ffffff",background:"#ffffff",strokeStyle:"#000000",colorMode:"rgba",lineWidth:1,fontSize:"20px",fontFamily:"serif",fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",fontStretch:"normal",lineHeight:1.2,font:"20px serif",events:{}};let i=(0,h.applyDefault)(r,n),a;"string"==typeof e?e=document.querySelector(e):e instanceof HTMLElement||(e=document.body);var n=e.querySelector("canvas"),o=n&&n.id==i.name;a=o?n:g.makeCanvas(i),"number"!=typeof e.CID&&(e.CID=1);let s=e.CID,l=e.id||e.classList.item(0),c=i.name||a.name;"string"!=typeof c&&(c=l+"-C-"+s,i.name=c),a.id=c,a.classList.add(c),e.appendChild(a),o?g.workingContext=a.context:(g.resizeCanvas(a,i),n=a.getContext("2d"),(0,h.defineProperties)(i,n),a.context=n,a.context.setTransform(i.dpr,0,0,i.dpr,0,0),g.workingContext=a.context,g.workingContext.savedStates=r,g.workingContext.delayedAnimations=[]),g.contextList[c]=a.context;var f,u={};for(f in i.events){var d=i.events[f];d&&(a.addEventListener(f,d),u[f]=d)}a.events=u,g.dpr=i.dpr,g.workingCanvas=a,t()}g.contextList={},g.nameID=0,g.workingContext,g.workingCanvas,g.dpr,g.getWindowWidth=function(t=document.body){t=globalThis.getComputedStyle(t);return parseInt(t.width,10)-parseInt(t.paddingRight,10)-parseInt(t.paddingLeft,10)},g.resizeCanvas=function(t,e){var n=e.width,r=e.height,e=e.dpr||globalThis.devicePixelRatio;t.style.width=n+"px",t.style.height=r+"px",t.width=e*n,t.height=e*r,t.rWidth=n,t.rHeight=r},g.makeCanvas=function(t){var e=document.createElement("canvas");return g.resizeCanvas(e,t),e},g.addExtension=function(t){(0,h.defineProperties)(t,globalThis),(0,h.defineProperties)(t,g.extensions,!1)},g.debugAnimations=!1,g.extensions={},g.debug=function(t){g.debugAnimations="boolean"!=typeof t||t},g.getCanvas=function(t){return g.contextList[t]||g.workingContext},g._ANIMATIONLOG_=[],g.functions={},g.COLORLIST={},(0,h.defineConstant)({CENTERX:function(){return g.workingCanvas.rWidth/2},CENTERY:function(){return g.workingCanvas.rHeight/2},WIDTH:function(){return parseInt(g.workingCanvas.rWidth)},HEIGHT:function(){return parseInt(g.workingCanvas.rHeight)}}),globalThis.C=g},{"./utils.js":37}],17:[function(t,e,n){"use strict";function r(t,e){for(;0!=e;){var n=e;e=t%e,t=n}return t}function i(t,e){return t*e/r(t,e)}Object.defineProperty(n,"__esModule",{value:!0}),n.gcd=r,n.gcdArray=function(t){let e=Array.isArray(t)?t:arguments,n=e[0];for(let t=1;t<e.length;++t)n=r(e[t],n);return n},n.lcm=i,n.lcmArray=function(t){let e=1,n=Array.isArray(t)?t:arguments;for(let t=0;t<n.length;++t)e=i(n[t],e);return e}},{}],18:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.sgn=n.round=n.random=n.pow=n.min=n.max=n.log2=n.log10=n.log=n.floor=n.exp=n.cosh=n.cos=n.ceil=n.cbrt=n.atan2=n.atan=n.asin=n.acos=n.abs=void 0,n.sigmoid=function(t){return 1/(1+Math.exp(-t))},n.tanh=n.tan=n.sqrt=n.sin=void 0;var{abs:r,acos:i,asin:a,atan:o,atan2:s,cbrt:l,ceil:c,cos:f,cosh:u,exp:d,floor:h,log:g,log2:m,log10:p,max:b,min:v,pow:x,random:C,round:y,sign:P,sin:k,sqrt:w,tan:M,tanh:j}=Math;n.tanh=j,n.tan=M,n.sqrt=w,n.sin=k,n.sgn=P,n.round=y,n.random=C,n.pow=x,n.min=v,n.max=b,n.log10=p,n.log2=m,n.log=g,n.floor=h,n.exp=d,n.cosh=u,n.cos=f,n.ceil=c,n.cbrt=l,n.atan2=s,n.atan=o,n.asin=a,n.acos=i,n.abs=r},{}],19:[function(t,e,n){"use strict";function a(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function r(t,e,n,r=10){return Array.isArray(t)&&2===t.length&&(e=t[1],t=t[0]),[Math.cos(n)*r+t,Math.sin(n)*r+e]}function i(t,e,n=10){var r=e[0]-t[0],e=e[1]-t[1],i=Math.atan2(e,r),r=Math.sqrt(r*r+e*e)+n;return[t[0]+Math.cos(i)*r,t[1]+Math.sin(i)*r]}Object.defineProperty(n,"__esModule",{value:!0}),n.circleIntersection=function(t,e,n,r){var i=a(t,n),r=(e*e-r*r+i*i)/(2*i),e=Math.sqrt(e*e-r*r),r=r/i,r=[(n[0]-t[0])*r+t[0],(n[1]-t[1])*r+t[1]];return[[r[0]+e*(n[1]-t[1])/i,r[1]-e*(n[0]-t[0])/i],[r[0]-e*(n[1]-t[1])/i,r[1]+e*(n[0]-t[0])/i]]},n.dist=a,n.extendFromOrigin=function(t,e=10){return i([0,0],t,e)},n.extendFromPoint=i,n.lineIntersection=function(t,e,n,r){e=(e[1]-t[1])/(e[0]-t[0]),r=(r[1]-n[1])/(r[0]-n[0]),t=t[1]-t[0]*e,n=n[1]-n[0]*r,n=(n-t)/(e-r),r=e*n+t;return[n,r]},n.rotateAroundOrigin=function(t,e=10){return r(0,0,t,e)},n.rotateAroundPoint=r},{}],20:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.randomInt=function(t=10,e=0){return Math.round(Math.random()*(t-e)+e)}},{}],21:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.doubleSmooth=function(t){return t<.5?.5*f(2*t):.5*(1+f(2*t-1))},n.easeInBack=function(t){return o*t**3-i*t**2},n.easeInBounce=function(t){return 1-c(1-t)},n.easeInCirc=function(t){return 1-Math.sqrt(1-t**2)},n.easeInCubic=function(t){return t**3},n.easeInElastic=function(t){return 0===t?0:1===t?1:-Math.pow(2,10*t-10)*Math.sin((10*t-10.75)*s)},n.easeInExpo=function(t){return 0==t?0:Math.pow(2,10*t-10)},n.easeInOutBack=function(t){return t<.5?(2*t)**2*(2*(a+1)*t-a)/2:((2*t-2)**2*((a+1)*(2*t-2)+a)+2)/2},n.easeInOutBounce=function(t){return t<.5?(1-c(1-2*t))/2:(1+c(2*t-1))/2},n.easeInOutCirc=function(t){return t<.5?(1-Math.sqrt(1-(2*t)**2))/2:(Math.sqrt(1-(2-2*t)**2)+1)/2},n.easeInOutCubic=function(t){return t<.5?4*t**3:1-Math.pow(2-2*t,3)/2},n.easeInOutElastic=function(t){return 0==t?0:1==t?1:t<.5?-(Math.pow(2,20*t-10)*Math.sin((20*t-11.125)*l))/2:Math.pow(2,-20*t+10)*Math.sin((20*t-11.125)*l)/2+1},n.easeInOutExpo=function(t){return 0==t?0:1==t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,10-20*t))/2},n.easeInOutQuad=function(t){return t<.5?2*t**2:1-Math.pow(2-2*t,2)/2},n.easeInOutQuart=function(t){return t<.5?8*t**4:1-Math.pow(2-2*t,4)/2},n.easeInOutQuint=function(t){return t<.5?16*t**5:1-Math.pow(2-2*t,5)/2},n.easeInOutSine=function(t){return-(Math.cos(Math.PI*t)-1)/2},n.easeInQuad=function(t){return t**2},n.easeInQuart=function(t){return t**4},n.easeInQuint=function(t){return t**5},n.easeInSine=function(t){return 1-Math.cos(t*Math.PI/2)},n.easeOutBack=function(t){return 1+o*(t-1)**3+i*(t-1)**2},n.easeOutBounce=c,n.easeOutCirc=function(t){return Math.sqrt(1-(t-1)**2)},n.easeOutCubic=function(t){return 1-(1-t)**3},n.easeOutElastic=function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin((10*t-.75)*s)+1},n.easeOutExpo=function(t){return 1==t?1:1-Math.pow(2,-10*t)},n.easeOutQuad=function(t){return 1-(1-t)**2},n.easeOutQuart=function(t){return 1-(1-t)**4},n.easeOutQuint=function(t){return 1-(1-t)**5},n.easeOutSine=function(t){return Math.sin(t*Math.PI/2)},n.exponentialDecay=function(t,e=.1){return 1-Math.exp(-t/e)},n.linear=function(t){return t},n.lingering=function(t){return d(t=>t,0,.8)(t)},n.notQuiteThere=function(e=f,n=.7){return t=>n*e(t)},n.rushFrom=function(t,e=10){return 2*f(t/2+.5,e)-1},n.rushInto=function(t,e=10){return 2*f(t/2,e)},n.slowInto=function(t){return Math.sqrt(1-(1-t)*(1-t))},n.smooth=f,n.squishRateFunc=d,n.thereAndBack=u,n.thereAndBackWithPause=function(t,e=1/3){var n=1/e;return t<.5-e/2?f(n*t):t<.5+e/2?1:f(n-n*t)},n.wiggle=function(t,e=2){return u(t)*Math.sin(e*Math.PI*t)};var r=t("./functions.js");const i=1.70158,a=1.525*i,o=i+1,s=2*Math.PI/3,l=2*Math.PI/4.5;function c(t){var e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375}function f(t,e=10){var n=(0,r.sigmoid)(-e/2);return Math.min(Math.max(((0,r.sigmoid)(e*(t-.5))-n)/(1-2*n),0),1)}function u(t,e=10){return f(t<.5?2*t:2*(1-t),e)}function d(e,n=.4,r=.6){return function(t){return n==r?n:e(t<n?0:r<t?1:(t-n)/(r-n))}}},{"./functions.js":18}],22:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.arrow=x,n.arrowTip=v,n.curvedArrow=C,n.curvedArrowBetweenPoints=function(t,e,n,r=b,i=r/1.2,a=0,o=0,s=!1,l=!1){var c=g.C.workingContext,f=c.pathStarted;c.save(),f||c.beginPath();var u=(0,m.circleIntersection)(t,n,e,n)[0],t=(t[0]-=u[0],t[1]-=u[1],e[0]-=u[0],e[1]-=u[1],Math.atan2(t[1],t[0])),e=Math.atan2(e[1],e[0]);let d,h;d=s?(h=t,e-t):(h=e,t-e);C(u[0],u[1],n,d,h,r,i,a,o,l),f||c.closePath();return c.restore(),u},n.curvedDoubleArrow=function(t,e,n,r=Math.PI/2,i=0,a=b,o=a/1.2,s=0,l=0){var c=g.C.workingContext,f=(c.save(),a/n),u=[-Math.cos(i+f/2+Math.PI/2),-Math.sin(i+f/2+Math.PI/2)];C(t,e,n,(r-=f)+s/n,(i+=f+2*l)-s/n,a,o,s,l),v(Math.cos(i-s/n)*n,Math.sin(i-s/n)*n,Math.cos(i)*n+a*u[0],Math.sin(i)*n+a*u[1],a,o),c.restore()},n.curvedDoubleArrowBetweenPoints=function(t,e,n,r=b,i=r/1.2,a=0,o=0,s=!1){var l=g.C.workingContext,c=(l.save(),(0,m.circleIntersection)(t,n,e,n)[0]),f=(t[0]-=c[0],t[1]-=c[1],e[0]-=c[0],e[1]-=c[1],r/n),t=Math.atan2(t[1],t[0]),e=Math.atan2(e[1],e[0])+f;let u,d;u=s?(d=t,e-t):(d=e,t-e);a/=n,C(c[0],c[1],n,u+a-o,d-a+o,r,i,a*n,o);s=f-a+o;return d-=f,v(c[0]+n*Math.cos(d+s),c[1]+n*Math.sin(d+s),c[0]+n*Math.cos(d+o),c[1]+n*Math.sin(d+o),r,i),l.restore(),c},n.doubleArrow=function(t,e,n,r,i=b,a=i/1.2,o=0,s=0){var l=Math.atan2(r-e,n-t),c=Math.cos(l)*(i-o),f=Math.sin(l)*(i-o),u=Math.sin(l)*s,l=Math.cos(l)*s;(0,h.startShape)(),x(t+=c+l,e+=f+u,n,r,i,a,o,s),v(t,e,t-c,e-f,i,a),(0,p.doFillAndStroke)(g.C.workingContext),(0,h.endShape)()},n.measurement=function(t){var e=g.C.workingContext,n={background:s,tipLength:b,tipBreadth:b/1.2,innerPadding:3,outerPadding:0,textRotation:0,arrowCurving:0},{p1:n,p2:r}=t=(0,p.applyDefault)(n,t),i=Math.atan2(r[1]-n[1],r[0]-n[0]),a=e.measureText(t.text)["width"],i=[Math.cos(i)*(t.innerPadding+a/2),Math.sin(i)*(t.innerPadding+a/2)],a=[(n[0]+r[0])/2,(n[1]+r[1])/2];x(a[0]-i[0],a[1]-i[1],n[0],n[1],t.tipLength,t.tipBreadth,t.arrowCurving,t.outerPadding),x(a[0]+i[0],a[1]+i[1],r[0],r[1],t.tipLength,t.tipBreadth,t.arrowCurving,t.outerPadding),(0,h.save)(),e.translate(a[0],a[1]),e.textAlign=d.CENTER,e.textBaseline=d.MIDDLE,e.rotate(Math.atan2(r[1]-n[1],r[0]-n[0])+t.textRotation),(0,o.fillText)(t.text,0,0),(0,h.restore)()};var d=t("../constants/drawing.js"),g=t("../main.js"),m=t("../math/points.js"),h=t("../settings.js"),p=t("../utils.js"),o=t("./text.js");const b=15,s="rgba(0,0,0,0)";function v(t,e,n,r,i,a){var o=g.C.workingContext,s=o.lineWidth,l=Math.sqrt((t-n)**2+(e-r)**2),c=(isNaN(i)&&(i=l),a=a||i/1.2,i-l),f=Math.sqrt(c**2+(a/2)**2);let u=Math.atan(a/(2*c));i<l&&(u+=Math.PI);a=Math.atan2(r-e,n-t),c=[t-Math.cos(u+a)*f,e-Math.sin(u+a)*f],i=[t-Math.cos(-u+a)*f,e-Math.sin(-u+a)*f];o.doStroke&&o.lineJoin!=d.BEVEL&&(n-=Math.cos(a)*s,r-=Math.sin(a)*s),o.save(),o.pathStarted||o.beginPath(),o.moveTo(t,e),o.lineTo(c[0],c[1]),o.lineTo(n,r),o.lineTo(i[0],i[1]),o.lineTo(t,e),o.pathStarted||((0,p.doFillAndStroke)(o),o.closePath()),o.restore()}function x(t,e,n,r,i=b,a=i/1.2,o=0,s=0){var l=Math.atan2(r-e,n-t),c=Math.sin(l)*s,s=(n-=Math.cos(l)*s,r-=c,Math.cos(l)*(i-o)),c=Math.sin(l)*(i-o),l=g.C.workingContext,o=l.pathStarted;o||(0,h.startShape)(),l.moveTo(t,e),l.lineTo(n-s,r-c),l.stroke(),v(n-s,r-c,n,r,i,a),o||((0,p.doFillAndStroke)(l),(0,h.endShape)())}function C(t,e,n,r=Math.PI/2,i=0,a=b,o=a/1.2,s=0,l=0,c=!1){var f=g.C.workingContext,u=a/n;f.save();let d=u-(s/=n);f.beginPath(),c?(d+=l,f.arc(t,e,n,d+i,r+i),f.stroke(),f.closePath(),v(t+n*Math.cos(i+d),e+n*Math.sin(i+d),t+n*Math.cos(i+l),e+n*Math.sin(i+l),a,o)):(f.arc(t,e,n,i,(r-=l)-d+i),f.stroke(),f.closePath(),v(t+n*Math.cos(i+r-d),e+n*Math.sin(i+r-d),t+n*Math.cos(i+r),e+n*Math.sin(i+r),a,o)),f.restore()}},{"../constants/drawing.js":12,"../main.js":16,"../math/points.js":19,"../settings.js":36,"../utils.js":37,"./text.js":34}],23:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.arcBrace=function(t,e,n=100,r=Math.PI/2,i=0,a=10,o=a,s=10){var l=v.C.workingContext,c=n-a,o=n+o;return l.save(),l.translate(t,e),l.rotate(i),l.beginPath(),l.moveTo(n,0),l.lineTo(c,0),l.arc(0,0,n,0,r),l.lineTo(c*Math.cos(r),c*Math.sin(r)),l.moveTo(n*Math.cos(r/2),n*Math.sin(r/2)),l.lineTo(o*Math.cos(r/2),o*Math.sin(r/2)),l.stroke(),l.closePath(),l.restore(),[(o+s)*Math.cos(r/2+i)+t,(o+s)*Math.sin(r/2+i)+e]},n.curlyBrace=function(t,e,n,r,i=20,a=.6,o=.8){var s=t-n,l=e-r,c=Math.sqrt(s*s+l*l);s/=c;var f=t+a*i*(l/=c),u=e-a*i*s,d=t-.25*c*s+(1-a)*i*l,h=e-.25*c*l-(1-a)*i*s,g=t-.5*c*s+i*l*o,o=e-.5*c*l-i*s*o,m=n+a*i*l,p=r-a*i*s,b=t-.75*c*s+(1-a)*i*l,c=e-.75*c*l-(1-a)*i*s,l=`M ${t} ${e} `+`Q ${f} ${u} ${d} ${h} `+`T ${g} ${o} `+`M ${n} ${r} `+`Q ${m} ${p} ${b} ${c} `+`T ${g} `+o;return v.C.workingContext.stroke(new Path2D(l)),[g,o]};var v=t("../main.js")},{"../main.js":16}],24:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.axes=function(t={}){var e=i.C.workingContext,n=(t=(0,a.applyDefault)(l.AxesConfigs,t),e.save(),function(t){for(var e of Object.keys(t))"xAxis"==e&&"yAxis"==e||(void 0===t.xAxis[e]&&(t.xAxis[e]=t[e]),void 0===t.yAxis[e]&&(t.yAxis[e]=t[e]))}(t),(0,s.numberLine)(t.xAxis)),r=(0,s.numberLine)(t.yAxis);return e.restore(),(0,o.getCartasianFunctions)({originPosition:t.originPosition,xAxis:n,yAxis:r,unitSpace:[n.unitSpace,r.unitSpace],unitValue:[n.unitValue,r.unitValue]})};var i=t("../../main.js"),a=t("../../utils.js"),o=t("./cartesian_plotters.js"),s=t("./number_line.js"),l=t("./types.js")},{"../../main.js":16,"../../utils.js":37,"./cartesian_plotters.js":25,"./number_line.js":26,"./types.js":29}],25:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getCartasianFunctions=function(n){return Object.assign(n,{plotParametricFunction:function(t){return t.unitSpace=n.unitSpace,t.unitValue=n.unitValue,(0,i.parametricFunction)(t)},plotFunctionGraph:function(t){return t.unitSpace=n.unitSpace,t.unitValue=n.unitValue,(0,i.functionGraph)(t)},plotHeatPlot:function(t){return t.unitSpace=n.unitSpace,console.log(t.unitSpace),t.min=n.min||[n.xAxis.range[0],n.yAxis.range[0]],t.max=n.max||[n.xAxis.range[1],n.yAxis.range[1]],(0,i.heatPlot)(t)},plotPoints:function(t){return t.unitValue=n.unitValue,t.unitSpace=n.unitSpace,(0,i.plotPoints)(t)},scaleCanvas:function(){var t=n.unitSpace[0]/n.unitValue[0],e=n.unitSpace[1]/n.unitValue[1];(0,r.scale)(t,e)}})};var r=t("../../settings.js"),i=t("../functions.js");t("./types.js")},{"../../settings.js":36,"../functions.js":30,"./types.js":29}],26:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.numberLine=function(t={}){var e=s.C.workingContext;t=(0,p.applyDefault)(l.NumberLineConfigs,t),isNaN(t.length)&&(t.length=WIDTH);let{range:n,decimalPlaces:r}=t;{if(!(Array.isArray(n)&&0<n.length))throw new Error("NumberLine: range must be a array that have atleast one item. Got: "+n.toString());2===(n=1===n.length?[0,n[0],1]:n).length&&(n=[n[0],n[1],1])}isNaN(r)&&0<=r&&(t.decimalPlaces=(n[2].toString().split(".")[1]||[]).length);var i=n[2],a=t.length/(n[1]-n[0]),o=(0,p.arange)(n[0],n[1],i);t.tickList=o,(0,m.save)(),e.translate(t.originPosition[0]*a,t.originPosition[1]*a),e.rotate(t.rotation),t.unitSpace=a,t.includeTicks&&function(t,e){var{includeLeftTip:n,includeRightTip:r,tickList:i,numbersToExclude:a,numbersWithElongatedTicks:o,longerTickHeight:s,tickHeight:l,unitSpace:c}=t,e=(e.strokeStyle=t.strokeColor,e.lineWidth=t.strokeWidth,n?1:0),f=i.length-(r?1:0);for(let t=e;t<f;t++){var u,d=i[t];a.includes(d)||(u=o.includes(d)?s:l,(0,v.line)(d*c,-u/2,d*c,u/2))}}(t,e);t.includeLabels&&!function(e,n){var{includeLeftTip:t,includeRightTip:r,tickList:i,numbersToExclude:a,labelsToInclude:o,labelDirection:s,unitSpace:l}=e,c=(n.fillStyle=e.textColor,n.textAlign=e.textAlign,n.textBaseline=e.textBaseline,n.fontFamily=e.fontFamily,0<o.length?o:i),o=t?1:0,f=r?i.length-1:i.length;(0,m.fontSize)(e.fontSize);for(let t=o;t<f&&t<c.length;t++){var u,d,h,g;a.includes(i[t])||(u="number"==typeof c[t]?c[t].toFixed(e.decimalPlaces):c[t],h=(0,p.measureHeight)(u),d=s[0]*h,h=s[1]*h,g=i[t],n.save(),n.translate(g*l+d,h),n.rotate(e.textRotation),e.textRenderer(u,0,0),n.restore())}}(t,e);return function(t,e){let{includeLeftTip:n,includeRightTip:r,unitSpace:i,axisLabelDirection:a,range:o,tipLength:s,tipBreadth:l,axisLabel:c}=t,[f,u]=o,d=((0,m.save)(),(0,m.stroke)(t.strokeColor),e.lineWidth=t.strokeWidth,(0,m.fill)(t.strokeColor),f*i),h=u*i;e.doStroke=!1,n&&((0,b.arrowTip)(d+s,0,d,0,s,l),d+=s);r&&((0,b.arrowTip)(h-s,0,h,0,s,l),h-=s);{var g;(0,v.line)(d,0,h,0),(0,p.isLabel)(c)&&((0,m.fontSize)(t.axisLabelSize),(0,m.fontFamily)(t.fontFamily),(0,m.fill)(t.axisLabelColor),g=(0,p.measureHeight)(c),e.translate(h+a[0]*g,a[1]*g),e.rotate(t.textRotation),t.textRenderer(c,0,0))}(0,m.restore)()}(t,e),(0,m.restore)(t),{range:n,originPosition:t.originPosition,tickList:o,unitValue:i,unitSpace:a}};var s=t("../../main.js"),m=t("../../settings.js"),p=t("../../utils.js"),b=t("../arrows.js"),v=t("../geometry.js"),l=t("./types.js")},{"../../main.js":16,"../../settings.js":36,"../../utils.js":37,"../arrows.js":22,"../geometry.js":31,"./types.js":29}],27:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.numberPlane=function(t={}){const n=x.C.workingContext;let{originPosition:e,subgrids:r,gridStrokeWidth:i,subgridStrokeWidth:a,gridStrokeColor:o}=t=(0,y.applyDefault)(k.NumberPlaneConfigs,t);const s=(0,v.axes)(t),{xAxis:l,yAxis:c}=s,[f,u,d]=l.range,[h,g,m]=c.range,p=s.unitSpace,b=s.unitValue;return(0,C.save)(),s.scaleCanvas(),n.translate(e[0],e[1]),i/=p[1],a/=p[1],function(){n.beginPath(),n.lineWidth=i,n.strokeStyle=o;let e=g-g%m;for(let t=f;t<=u;t+=d)0==t||l.includeLeftTip&&t==f||l.includeRightTip&&t==u||(n.moveTo(t,h),n.lineTo(t,e));e=u-u%d;for(let t=h;t<=g;t+=m)0==t||c.includeLeftTip&&t==h||c.includeRightTip&&t==g||(n.moveTo(f,t),n.lineTo(e,t));n.stroke(),n.closePath();{n.beginPath(),n.lineWidth=a,n.strokeStyle=t.subgridStrokeColor;let e=1/(r[0]+1);for(let t=f;t<=u;t+=e)t%b[0]!=0&&(n.moveTo(t,h),n.lineTo(t,g));e=1/(r[1]+1);for(let t=h;t<=g;t+=e)t%b[1]!=0&&(n.moveTo(f,t),n.lineTo(u,t));n.stroke(),n.closePath()}}(),(0,C.restore)(),(0,P.getCartasianFunctions)({originPosition:e,unitValue:b,unitSpace:p,xAxis:l,yAxis:c,subgridUnit:r})};var v=t("./axes.js"),x=t("../../main.js"),C=t("../../settings.js"),y=t("../../utils.js"),P=t("./cartesian_plotters.js"),k=t("./types.js")},{"../../main.js":16,"../../settings.js":36,"../../utils.js":37,"./axes.js":24,"./cartesian_plotters.js":25,"./types.js":29}],28:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.polarPlane=function(t={}){var e=u.C.workingContext;azimuthUnitsDict={pi:20,tau:20,deg:24,grad:20},t=(0,h.applyDefault)(p.PolarPlaneConfigs,t),isNaN(t.size)&&(t.size=.8*Math.min(WIDTH,HEIGHT));var{originPosition:n,maxRadius:r,size:i,radiusStep:a,azimuthDivisions:o,radiusConfigs:s}=t;var l=i/r/2;t.azimuthUnit=function(t){if(t=t.toLowerCase().trim().replace(/(rad.*|\s*)/,"rad"),/.*(pi|π).*/.test(t))t="pi";else if(/.*(tau|τ).*/.test(t))t="tau";else if(/.*(deg|°).*/.test(t))t="deg";else{if(!/.*(grad|ᵍ).*/.test(t))throw new Error("Invalid azimuth units. Expected one of: PI radians, TAU radians, degrees, gradians.");t="grad"}return t}(t.azimuthUnit),t.azimuthDirection=t.azimuthDirection.toLowerCase(),t.fadedLines++,0!=o&&!isNaN(o)||(t.azimuthDivisions=azimuthUnitsDict[t.azimuthUnit]||20);t.tickList=(0,h.arange)(0,r,a);var c=Array.isArray(s.labelsToInclude)?s.labelsToInclude:t.tickList;var[c,f]=function(t,e,n){var r=[],i=[],a=[...e].reverse().slice(0,t),t=new Array(t).fill("");n.includes(3)?r.push(...a):r.push(...t);n.includes(1)?r.push(...e):r.push(...t);n.includes(4)?i.push(...a):i.push(...t);n.includes(2)?i.push(...e):i.push(...t);return[r,i]}(r,c,s.labelAxis);s.range=[-r,r,a],s.length=i,t.radiusConfigs=s,t.xLabels=c,t.yLabels=f,t.radialSpacing=l;r=(0,h.applyDefault)(s,{labelsToInclude:c,originPosition:n,axisLabel:""}),a=(0,h.applyDefault)(s,{labelsToInclude:f,originPosition:n,axisLabel:""});return(0,d.save)(),e.translate(n[0]*l,n[1]*l),function(t,e){var{azimuthDivisions:n,azimuthDirection:r,azimuthConfigs:i,fadedLines:a}=t;t.labels=function(t){var i=[];var{azimuthUnit:t,radialSpacing:a,azimuthConfigs:o,azimuthDivisions:s,azimuthCompactFraction:l}=t;if("pi"==t||"tau"==t){let e=s,n,r;n=(0,g.tex2svgExists)()?(o.textRenderer=g.tex,r="tau"==t?"\\tau":"\\pi",(0,d.fontSize)(o.fontSize*a),h.texFraction):(console.warn("MathJax not found, using fillText instead"),r="pi"==t?"π":"τ",h.fraction);for(let t=0;t<s;t++)i.push(n(+t,e,!0,l,r))}else if("deg"==t)for(let t=0;t<s;t++)i.push((360*t/s).toFixed(o.decimalPoints)+"°");else if("grad"==t)for(let t=0;t<s;t++)i.push((400*t/s).toFixed(o.decimalPoints)+"ᵍ");return i}(t),t.angleIncrementor=2*Math.PI/n,"cw"==r&&(t.angleIncrementor*=-1);1<a&&!function(t,e){var{maxRadius:n,azimuthoffset:r,angleIncrementor:i,fadedLineConfigs:t,azimuthDivisions:a,fadedLines:o,tickList:s,radialSpacing:l}=t,c=1/o,f=(s.length-1)*o,u=a*o;e.doFill=!1,e.doStroke=!0,e.strokeStyle=t.strokeColor,e.lineWidth=t.strokeWidth,e.beginPath(),e.moveTo(0,0);for(let t=0;t<f;t++)e.arc(0,0,t*c*l,0,2*Math.PI);e.lineWidth=t.strokeWidth;for(let t=0;t<u;t++){var d=t*i*c;e.moveTo(0,0),e.lineTo(Math.cos(d+r)*n*l,Math.sin(d+r)*n*l)}e.stroke()}(t,e);(function(t,e){var{azimuthConfigs:t,tickList:n,azimuthDivisions:r,angleIncrementor:i,azimuthoffset:a,maxRadius:o,radialSpacing:s}=t;e.beginPath(),e.strokeStyle=t.strokeColor,e.lineWidth=t.strokeWidth,e.moveTo(0,0);for(let t=0;t<n.length;t++)e.arc(0,0,t*s,0,2*Math.PI);for(let t=0;t<r;t++){var l=t*i+a;l%(Math.PI/2)!=0&&(e.moveTo(0,0),e.lineTo(Math.cos(l)*o*s,Math.sin(l)*o*s))}e.stroke()})(t,e),i.includeLabels&&function(t){var{azimuthDivisions:e,angleIncrementor:n,azimuthoffset:r,azimuthConfigs:i,maxRadius:a,labels:o,radialSpacing:s}=t;(0,d.fontSize)(i.fontSize),(0,d.fontFamily)(i.fontFamily),(0,d.textAlign)(i.textAlign),(0,d.textBaseline)(i.textBaseline);for(let t=0;t<e;t++){var l=t*n+r;i.numbersToExclude.includes(l)||i.textRenderer(o[t],Math.cos(l)*(a+i.labelBuff)*s,Math.sin(l)*(a+i.labelBuff)*s)}}(t)}(t,e),(0,d.restore)(),(0,m.axes)({xAxis:r,yAxis:a}),function(e){return{plotPoints:function(t){t.radialSpacing=t.radialSpacing||e.radialSpacing,plotPolarPoints(t)},plotParametricFunction:function(t){return t.radialSpacing=t.radialSpacing||e.radialSpacing,polarParametricFunction(t)},plotFunctionGraph:function(t){return t.radialSpacing=t.radialSpacing||e.radialSpacing,polarFuntionGraph(t)},scaleCanvas:function(){(0,d.scale)(e.radialSpacing,e.radialSpacing)}}}({azimuthAnglularSpace:2*Math.PI/o,radialSpacing:l})};var u=t("../../main.js"),d=t("../../settings.js"),h=t("../../utils.js"),g=t("../tex.js"),m=t("./axes.js"),p=t("./types.js")},{"../../main.js":16,"../../settings.js":36,"../../utils.js":37,"../tex.js":33,"./axes.js":24,"./types.js":29}],29:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.ScalarSpaceProperties=n.PolarPlotters=n.PolarPlaneConfigs=n.NumberPlaneConfigs=n.NumberLineConfigs=n.CartesianPlotters=n.AxesConfigs=void 0;var r=t("../text.js"),t=t("../../constants/math.js");n.ScalarSpaceProperties={},n.NumberLineConfigs={rotation:0,strokeWidth:2,originPosition:t.ORIGIN,range:[-5,5,1],strokeColor:"#ffffff88",axisLabel:"",axisLabelSize:24,axisLabelColor:"#fff",axisLabelDirection:[.5,1.5],tipLength:13,tipBreadth:10,fontSize:17,fontFamily:"serif",textRenderer:r.fillText,textBaseline:"middle",textColor:"#fff",textAlign:"center",textRotation:0,labelDirection:[0,-1.6],tickHeight:10,longerTickHeight:15,labelsToInclude:[],numbersToExclude:[],numbersWithElongatedTicks:[],includeTicks:!0,includeLabels:!0,includeLeftTip:!1,includeRightTip:!1},n.CartesianPlotters={},n.NumberPlaneConfigs={includeTicks:!0,includeLabels:!0,includeLeftTip:!1,includeRightTip:!1,excludeOriginTick:!0,subgrids:[1,1],gridStrokeWidth:1.3,subgridStrokeWidth:.8,gridStrokeColor:"#00ffff44",subgridStrokeColor:"#88888850",originPosition:t.ORIGIN},n.AxesConfigs={xAxis:{axisLabel:"x"},yAxis:{axisLabel:"y",rotation:Math.PI/2,textRotation:-Math.PI/2,labelDirection:[0,.8],textAlign:"right",axisLabelDirection:[.3,.5],axisLabelSize:20},originPosition:t.ORIGIN,numbersToExclude:[0],includeTicks:!0,includeLeftTip:!1,includeRightTip:!0},n.PolarPlaneConfigs={originPosition:t.ORIGIN,maxRadius:4,radiusStep:1,azimuthUnit:"PI radians",azimuthDivisions:0,azimuthCompactFraction:!0,azimuthDirection:"ccw",azimuthoffset:0,fadedLines:1,radiusConfigs:{includeLabels:!0,includeTicks:!1,includeRightTip:!1,strokeColor:"#fff",strokeWidth:2,fontSize:16,fontFamily:"serif",labelDirection:[.4,-1],labelAxis:[1],numbersToExclude:[0]},azimuthConfigs:{includeLabels:!0,labelBuff:.45,fontSize:15,fontFamily:"serif",textAlign:"center",textBaseline:"middle",strokeColor:"#58c4ddaa",strokeWidth:1.3,textRenderer:r.fillText,decimalPoints:0,numbersToExclude:[0]},fadedLineConfigs:{strokeColor:"#8888",strokeWidth:1}},n.PolarPlotters={}},{"../../constants/math.js":13,"../text.js":34}],30:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.functionGraph=function(t){let e=t.plotter;return t.plotter=t=>[t,e(t)],r(t)},n.heatPlot=function(t){let{min:n,max:r,colors:o,resolution:i,plotFunction:a,interpolator:s}=t=(0,y.applyDefault)(k.HeatPlotConfigs,t,!1),l=C.C.workingContext,c=t.unitSpace[0]/t.unitValue[0],f=t.unitSpace[1]/t.unitValue[1],u=1/c,d=1/f,h=Object.keys(o).sort();for(var e of h)o[e]=(0,b.readColor)(o[e]).rgbaA;let g=Math.min(...h),m=Math.max(...h);l.save();for(let e=n[0];e<=r[0];e+=i*u)for(let t=n[1];t<=r[1];t+=i*d){var p=a(e,t);l.fillStyle=function(e){if(e>=m)return"rgba("+o[m].join()+")";if(e<=g)return"rgba("+o[g].join()+")";for(let t=0;t<h.length-1;t++){var n,r,i=h[t],a=h[t+1];if(i<=e&&e<a)return n=o[i],r=o[a],a=s((e-i)/(a-i)),"rgba("+[Math.round((r[0]-n[0])*a+n[0]),Math.round((r[1]-n[1])*a+n[1]),Math.round((r[2]-n[2])*a+n[2]),(r[3]-n[3])*a+n[3]].join()+")"}}(p,(m,o,g,h,s)),l.fillRect(e*c,t*f,i,i)}l.restore()},n.parametricFunction=r,n.plotPoints=function(e){var{points:n,unitValue:t,unitSpace:r}=e=(0,y.applyDefault)(PointPlotterConfigs,e),i=C.C.workingContext,a=r[0]/t[0],o=r[1]/t[1];for(let t=0;t<n.length;t++){var s=n[t],l=s.fill||e.fill||i.fillStyle,c=s.stroke||e.stroke||i.strokeStyle,f=s.x*a,u=s.y*o;i.beginPath(),i.fillStyle=l,i.strokeStyle=c,i.arc(f,u,s.radius||e.radius,0,2*Math.PI),i.fill(),i.stroke()}i.closePath()},n.plotPolarPoints=function(e){e=(0,y.applyDefault)(k.PolarPointPlotterConfigs,e);var n=C.C.workingContext,{points:r,radialSpacing:i}=e,a=e.fill||n.fillStyle,o=e.stroke||n.strokeStyle;n.save();for(let t=0;t<r.length;t++){var s=r[t],l=s.fill||a,c=s.stroke||o,f=s.r*Math.cos(s.phi)*i,u=s.r*Math.sin(s.phi)*i;n.beginPath(),n.fillStyle=l,n.strokeStyle=c,n.arc(f,u,s.radius||e.radius,0,2*Math.PI),n.fill(),n.stroke()}n.closePath(),n.restore()},n.polarFuntionGraph=function(t){let e=t.plotter;return t.plotter=t=>[e(t),t],i(t)},n.polarParametricFunction=i;var b=t("../color/color_reader.js"),C=t("../main.js"),x=t("../settings.js"),y=t("../utils.js"),P=t("./geometry.js"),k=t("./types.js");const w={then:function(t){return t(),w}};let M={parametricFunction:1};function r(t){let{plotter:e,range:n,smoothen:r,tension:i,discontinuities:a,closed:o}=t=(0,y.applyDefault)(k.ParametricFunctionConfigs,t),s=(Array.isArray(n)&&2==n.length&&n.push((n[1]-n[0])/20),[[]]);var l,[c,f,u]=n;Array.isArray(a)||(a=[]);let d=0,h=0,g=t.unitSpace[0]/t.unitValue[0],m=t.unitSpace[1]/t.unitValue[1],p=isNaN(t.discontinuityRadius)?u:t.discontinuityRadius;u<p&&(p=u/2);for(let t=c;t<=f+p;t+=u)(0,y.inArray)(t,a,p)?(0,y.inArray)(t+u,a,p)&&(d++,s.push([])):(l=e(t),s[d].push([l[0]*g,l[1]*m]),h++);function b(){var e=C.C.workingContext;for(let t=0;t<s.length;t++){var n=s[t];if(r)(0,P.smoothCurveThroughPoints)(n,i,o);else{e.beginPath(),e.moveTo(n[0][0],n[0][1]);for(let t=1;t<n.length;t++)e.lineTo(n[t][0],n[t][1]);e.closePath(),(0,y.doFillAndStroke)(e)}}}t.draw&&b();let v=C.C.workingContext;return{points:s[0],dur:t.dur,name:"parametric-plot-"+M.parametricFunction++,closed:t.closed,tension:t.tension||1,smoothen:t.smoothen,rateFunction:t.rateFunction,syncWithTime:t.syncWithTime||!1,draw:function(t=2e3){var e=t/h,n=r?function(i){return function(){i>=a.length-2&&((0,x.noLoop)(),v.closePath(),v.doFill)&&b();var t=0<i?a[i-1]:o?a[a.length-2]:a[0],e=a[i],n=a[i+1],r=i!=a.length-2?a[i+2]:o?a[1]:n,t=(0,P.getBezierControlPoints)(t,e,n,r);i++,v.beginPath(),v.moveTo(e[0],e[1]),v.bezierCurveTo(t[0],t[1],t[2],t[3],n[0],n[1]),v.stroke()}}:function(n){return function(){n>=a.length-2&&((0,x.noLoop)(),v.doFill)&&this.draw();var t=a[n],e=a[++n];(0,P.line)(t[0],t[1],e[0],e[1])}};for(let t=0;t<s.length;t++){var a=s[t];(0,x.loop)("parametric-plot-"+M.parametricFunction++,n(0),C.C.workingContext.name,e)}return w}}}function i(t){let{plotter:e,range:n,radialSpacing:r,smoothen:i,tension:a,discontinuities:o,closed:s}=t=(0,y.applyDefault)(k.PolarParametricFunctionConfigs,t);Array.isArray(n)&&2==n.length&&n.push((n[1]-n[0])/20);var l,c=[[]],f=n[0],u=n[1],d=n[2],h=(Array.isArray(o)||(o=[]),isNaN(t.discontinuityRadius)?d:t.discontinuityRadius);let g=0,m=h<d?h:0;for(let t=f;t<=u+d+m;t+=d)(0,y.inArray)(t,o,h)?(0,y.inArray)(t+d,o,h)&&(g++,c.push([])):(l=e(t),c[g].push([l[0]*Math.cos(l[1])*r,l[0]*Math.sin(l[1])*r]));var p=C.C.workingContext,b=[];p.lineWidth=t.strokeWidth;for(let t=0;t<c.length;t++){var v=c[t];if(0!=v.length){b.push(v);var x=t==c.length-1?1:0;if(i)(0,P.smoothCurveThroughPoints)(v,a,s,x);else{p.beginPath(),p.moveTo(v[0][0],v[0][1]);for(let t=1;t<v.length-x;t++)p.lineTo(v[t][0],v[t][1]);p.doStroke&&p.stroke(),p.doFill&&s&&p.fill(),p.closePath()}x&&(c[t]=c[t].slice(0,-1))}}return{points:b,closed:t.closed,tension:t.tension||1,smoothen:t.smoothen}}},{"../color/color_reader.js":6,"../main.js":16,"../settings.js":36,"../utils.js":37,"./geometry.js":31,"./types.js":35}],31:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.angle=function(c,f,u,d,h=20,g=10,m=!1,p=1){let t=(0,l.lineIntersection)(c,f,u,d),b=t[0],v=t[1],x={};{if(isNaN(b)||isNaN(v))throw new Error("No intersection point");{let t,e,n=Math.atan2(c[1]-v,c[0]-b),r=Math.atan2(f[1]-v,f[0]-b),i=Math.atan2(u[1]-v,u[0]-b),a=Math.atan2(d[1]-v,d[0]-b),o={1:[r,a],2:[a,n],3:[n,i],4:[i,r]},s=o[p],l=C.C.workingContext;t=m?(e=s[1],s[0]-s[1]):(e=s[0],s[1]-s[0]),l.doFill&&(l.beginPath(),l.moveTo(b,v),l.arc(b,v,h,e,t+e),l.fill(),l.closePath()),l.doStroke&&(l.beginPath(),l.arc(b,v,h,e,t+e),l.stroke(),l.closePath()),x={center:[b+(h+g)*Math.cos(e+t/2),v+(h+g)*Math.sin(e+t/2)],ang:t}}}return x},n.annulus=function(t,e,n,r){var i=C.C.workingContext;i.beginPath(),i.arc(t,e,n,0,2*Math.PI,!1),i.moveTo(r,0),i.arc(t,e,r,0,2*Math.PI,!0),(0,c.doFillAndStroke)(i)},n.annulusSector=function(t,e,n,r,i,a){var o=C.C.workingContext;o.beginPath(),o.arc(t,e,n,a,a+i,!1),o.arc(t,e,r,a+i,a,!0),(0,c.doFillAndStroke)(o)},n.arc=function(t,e,n,r=Math.PI/2,i=0){var a=C.C.workingContext;a.pathStarted||a.beginPath();a.arc(t,e,n,i,i+r),a.pathStarted||(0,c.doFillAndStroke)(a)},n.arcBetweenPoints=function(t,e,n,r,i,a=!1){t==n&&e==r&&console.error("Can't draw a arc between points. Given points are exactly same");var o=(0,l.circleIntersection)([t,e],i,[n,r],i)[0],s=C.C.workingContext,e=Math.atan2(e-o[1],t-o[0]),t=Math.atan2(r-o[1],n-o[0])-e;s.pathStarted||(s.save(),s.beginPath());s.arc(o[0],o[1],i,e,t+e,!a),s.pathStarted||((0,c.doFillAndStroke)(s),s.restore());return o},n.bezier=function(t,e,n,r,i,a){var o=C.C.workingContext,s=o.pathStarted;s||o.beginPath();o.bezierCurveTo(t,e,n,r,i,a),o.pathStarted||(0,c.doFillAndStroke)(o)},n.circle=function(t,e,n){var r=C.C.workingContext;r.beginPath(),r.arc(t,e,n,0,2*Math.PI),r.doFill&&r.fill();r.doStroke&&r.stroke()},n.circularSegment=function(t,e,n,r=Math.PI/2,i=0){var a=C.C.workingContext;a.pathStarted||a.beginPath();a.arc(t,e,n,i,i+r),a.pathStarted||(0,c.doFillAndStroke)(a)},n.ellipse=function(t,e,n,r,i=0,a=0,o=2*Math.PI){var s=C.C.workingContext;s.pathStarted||s.beginPath();s.ellipse(t,e,n,r,i,a,a+o),s.pathStarted||(0,c.doFillAndStroke)(s)},n.equiTriangle=function(t,e,n,r=0){i(t,e,3,n,r)},n.getBezierControlPoints=f,n.line=function(t,e,n,r){var i=C.C.workingContext;i.beginPath(),i.moveTo(t,e),i.lineTo(n,r),i.stroke(),i.closePath()},n.point=function(t,e,n=10,r=!1){var i=C.C.workingContext;i.beginPath(),i.arc(t,e,n/2,0,2*Math.PI),i.fill(),r&&i.stroke();i.closePath()},n.polygon=function(){var e=arguments;if(2<e.length){var n=C.C.workingContext,t=e[0];n.beginPath(),n.moveTo(t[0],t[1]);for(let t=1;t<e.length;t++)n.lineTo(e[t][0],e[t][1]);n.lineTo(t[0],t[1]),n.doFill&&n.fill(),n.doStroke&&n.stroke(),n.closePath()}},n.quad=function(t,e,n,r){var i=C.C.workingContext;i.beginPath(),i.moveTo(t[0],t[1]),i.lineTo(e[0],e[1]),i.lineTo(n[0],n[1]),i.lineTo(r[0],r[1]),i.lineTo(t[0],t[1]),i.doFill&&i.fill();i.doStroke&&i.stroke();i.closePath()},n.quadraticCurve=function(){var t=C.C.workingContext,e=arguments;4==e.length?t.quadraticCurveTo(e[0],e[1],e[2],e[3]):6==e.length&&(t.beginPath(),t.moveTo(e[0],e[1]),t.quadraticCurveTo(e[2],e[3],e[4],e[5]),(0,c.doFillAndStroke)(t))},n.rect=r,n.regularPolygon=i,n.regularPolygonWithRadius=o,n.sector=function(t,e,n,r=Math.PI/2,i=0){var a=C.C.workingContext;a.beginPath(),a.moveTo(t,e),a.arc(t,e,n,i,i+r),a.lineTo(t,e),(0,c.doFillAndStroke)(a)},n.smoothCurveThroughPoints=function(t,e=1,n=!0,r=0){var i=C.C.workingContext;i.beginPath(),i.moveTo(t[0][0],t[0][1]),a(t,e,n,r),i.doFill&&n&&i.fill();i.doStroke&&i.stroke();i.closePath()},n.smoothCurveThroughPointsTo=a,n.square=function(t,e,n){r(t,e,n,n)},n.triangle=function(t,e,n){var r=C.C.workingContext;r.beginPath(),r.moveTo(t[0],t[1]),r.lineTo(e[0],e[1]),r.lineTo(n[0],n[1]),r.lineTo(t[0],t[1]),r.doFill&&r.fill();r.doStroke&&r.stroke();r.closePath()};var C=t("../main.js"),l=t("../math/points.js"),c=t("../utils.js");function f(t,e,n,r,i=1){return[e[0]+(n[0]-t[0])/6*i,e[1]+(n[1]-t[1])/6*i,n[0]-(r[0]-e[0])/6*i,n[1]-(r[1]-e[1])/6*i]}function a(e,n=1,r=!0,i=0){for(let t=0;t<e.length-1-i;t++){var a=0!=t?e[t-1]:e[0],o=e[t],s=e[t+1],a=f(a,o,s,t!=e.length-2?e[t+2]:r?e[1]:s,n);C.C.workingContext.bezierCurveTo(a[0],a[1],a[2],a[3],s[0],s[1])}}function r(t,e,n,r){var i=C.C.workingContext;i.beginPath(),i.rect(t,e,n,r),i.doFill&&i.fill(),i.doStroke&&i.stroke(),i.closePath()}function i(t,e,n,r,i=0){o(t,e,n,r/(2*Math.sin(Math.PI/n)),i)}function o(t,e,n,r,i=0){let a=0,o=2*Math.PI/n,s=C.C.workingContext;i+=o/2;var l=[Math.cos(i)*r+t,Math.sin(i)*r+e];for(s.beginPath(),s.moveTo(l[0],l[1]);a++<n;)s.lineTo(Math.cos(a*o+i)*r+t,Math.sin(a*o+i)*r+e);s.lineTo(l[0],l[1]),s.closePath(),s.doFill&&s.fill(),s.doStroke&&s.stroke()}},{"../main.js":16,"../math/points.js":19,"../utils.js":37}],32:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.lens=function(t,e,n,r){var i=(0,f.circleIntersection)(t,e,n,r),a=i[0],i=i[1],o=Math.atan2(a[1]-t[1],a[0]-t[0]),s=Math.atan2(i[1]-t[1],i[0]-t[0]),a=Math.atan2(a[1]-n[1],a[0]-n[0]),i=Math.atan2(i[1]-n[1],i[0]-n[0]),l=c.C.workingContext;l.beginPath(),l.arc(t[0],t[1],e,o,s),l.arc(n[0],n[1],r,i,a),l.doStroke&&l.stroke();l.doFill&&l.fill();l.closePath()},n.polygonWithRatioOfCentralAngles=function(t,e,n,r,i=0){Array.isArray(r)||console.error("ratio provided is not array");var a=r.reduce((t,e)=>t+e,0),o=2*Math.PI/a,s=c.C.workingContext;s.save(),s.translate(t,e),s.rotate(i),s.beginPath(),s.moveTo(n,0);for(let t=0;t<r.length;t++)s.rotate(o*r[t]),s.lineTo(n,0);s.doStroke&&s.stroke();s.doFill&&s.fill();s.closePath(),s.restore()};var c=t("../main.js"),f=t("../math/points.js")},{"../main.js":16,"../math/points.js":19}],33:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getImageFromTex=f,n.tex=function(t,n=0,r=0){let i=f(t),a=c.C.workingContext,o=a.textAlign,s=a.textBaseline;return i.onload=function(){a.save();var{width:t,height:e}=i;switch(o){case l.CENTER:a.translate(-t/2,0);break;case l.RIGHT:a.translate(-t,0)}switch(s){case"middle":a.translate(0,e/2);break;case"bottom":a.translate(0,e)}a.translate(n,r),a.yAxisInverted&&a.scale(1,-1),a.xAxisInverted&&a.scale(-1,1),a.drawImage(i,0,0),a.restore()},i},n.tex2svgExists=r;var l=t("../constants/drawing.js"),c=t("../main.js");function r(){return"object"==typeof globalThis.MathJax&&"function"==typeof globalThis.MathJax.tex2svg}function f(t){var e,n;if(r())return e=c.C.workingContext,n=(t=globalThis.MathJax.tex2svg(t).getElementsByTagName("svg")[0]).getElementsByTagName("g")[0],t.style.verticalAlign="1ex",t.style.fontSize=parseFloat(e.font)+"px",n.setAttribute("stroke",e.strokeStyle),n.setAttribute("fill",e.fillStyle),n=t.outerHTML,e=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),t=(globalThis.URL||globalThis.webkitURL).createObjectURL(e),(n=new Image).src=t,n;throw new Error("MathJax is not found. Please include it.")}},{"../constants/drawing.js":12,"../main.js":16}],34:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.fillText=function(t,e=0,n=0,r=void 0){var i=a.C.workingContext;i.save(),i.translate(e,n),i.yAxisInverted&&i.scale(1,-1);i.xAxisInverted&&i.scale(-1,1);i.fillText(t,0,0,r),i.restore()},n.strokeText=function(t,e=0,n=0,r=void 0){var i=a.C.workingContext;i.save(),i.translate(e,n),i.yAxisInverted&&i.scale(1,-1);i.xAxisInverted&&i.scale(-1,1);i.strokeText(t,0,0,r),i.restore()},n.text=function(t,e=0,n=0,r=void 0){var i=a.C.workingContext;i.save(),i.translate(e,n),i.yAxisInverted&&i.scale(1,-1);i.xAxisInverted&&i.scale(-1,1);i.doFill?i.fillText(t,0,0,r):i.doStroke&&i.strokeText(t,0,0,r);i.restore()};var a=t("../main.js")},{"../main.js":16}],35:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.PolarPointPlotterConfigs=n.PolarPoint=n.PolarParametricFunctionRes=n.PolarParametricFunctionConfigs=n.ParametricPlotter=n.ParametricFunctionConfigs=n.HeatPlotConfigs=n.CartesianPointPlotterConfigs=n.CartesianPoint=void 0;t=t("../constants/math.js");n.CartesianPoint={},n.PolarPoint={},n.ParametricPlotter={},n.ParametricFunctionConfigs={tension:1,unitValue:t.UNIT_VEC,unitSpace:t.UNIT_VEC,range:[0,10,.1],discontinuities:[],smoothen:!0,closed:!1,draw:!0,dur:4e3},n.HeatPlotConfigs={min:[-4,-4],max:[4,4],colors:{"-5":"#b36e38b0","-3":"#ff9c52b0","-1":"#ffcea9b0",0:"#dcdcddb0",1:"#9fcaedb0",3:"#3d96dab0",5:"#2b6b99b0"},unitSpace:t.UNIT_VEC,unitValue:t.UNIT_VEC,resolution:1,interpolator:t=>t},n.CartesianPointPlotterConfigs={unitValue:t.UNIT_VEC,unitSpace:t.UNIT_VEC,fill:"#ffffff",stroke:"#00000000",radius:5},n.PolarPointPlotterConfigs={unitValue:t.UNIT_VEC,unitSpace:t.UNIT_VEC,fill:"#ffffff",stroke:"#00000000",radius:5,radialSpacing:2},n.PolarParametricFunctionConfigs={tension:1,radialSpacing:1,range:[0,2*Math.PI,Math.PI/50],discontinuities:[],smoothen:!0,closed:!1,strokeWidth:2},n.PolarParametricFunctionRes={}},{"../constants/math.js":13}],36:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.background=function(...t){var t=(0,r.readColor)(t).hex8,e=u.C.workingContext;e.background=t,e.save(),i(),e.fillStyle=t,e.fillRect(0,0,e.canvas.width,e.canvas.height),e.restore()},n.clear=function(t,e,n,r){var i=u.C.workingContext,a=u.C.dpr;t=t||0,e=e||0,n=n||i.canvas.width,r=r||i.canvas.height,i.save(),i.setTransform(a,0,0,a,0,0),i.clearRect(t,e,n,r),i.restore()},n.cssBackground=function(t){"string"!=typeof t&&(t=s());var e=u.C.workingContext.canvas.style;e.background="url('"+t+"')",e.backgroundPosition="center",e.backgroundSize="cover"},n.endShape=function(){var t=u.C.workingContext;t.closePath(),t.pathStarted=!1},n.fill=function(...t){var e=u.C.workingContext;0!==arguments.length?(e.fillStyle=(0,r.readColor)(t).hex8,e.doFill=!0):e.fill()},n.fontFamily=function(t){var e=u.C.workingContext;e.fontFamily=t,e.font=o(!0)},n.fontSize=function(t){var e=u.C.workingContext;t="number"==typeof t?t+"px":t,e.fontSize=t,e.font=o(!0)},n.fontStretch=function(t){var e=u.C.workingContext;e.fontStretch=t,e.font=o(!0)},n.fontStyle=function(t){var e=u.C.workingContext;e.fontStyle=t,e.font=o(!0)},n.fontVariant=function(t){var e=u.C.workingContext;e.fontVariant=t,e.font=o(!0)},n.fontWeight=function(t){var e=u.C.workingContext;e.fontWeight=t,e.font=o(!0)},n.getCanvasData=s,n.getContextStates=m,n.getFont=o,n.invertXAxis=function(){u.C.workingContext.scale(-1,1),u.C.workingContext.xAxisInverted=!0},n.invertYAxis=function(){u.C.workingContext.scale(1,-1),u.C.workingContext.yAxisInverted=!0},n.lineCap=function(t){u.C.workingContext.lineCap=t},n.lineDash=function(){u.C.workingContext.setLineDash([...arguments])},n.lineHeight=function(t){var e=u.C.workingContext;e.lineHeight=t,e.font=o(!0)},n.lineJoin=function(t){u.C.workingContext.lineJoin=t},n.lineTo=function(t,e){u.C.workingContext.lineTo(t,e)},n.loop=a,n.measureText=function(t){return u.C.workingContext.measureText(t)},n.moveTo=function(t,e){u.C.workingContext.moveTo(t,e)},n.noFill=function(){u.C.workingContext.doFill=!1},n.noLoop=function(n,r){let i=u.C.workingContext;n?i=u.C.contextList[n]:n=i.name;if(clearInterval(i.currentLoop),globalThis.cancelAnimationFrame(i.currentLoop),i.currentLoop=void 0,u.C.debugAnimations){let t=`${n}: ${i.currentLoopName} %cfinished`,e=[g.finished];null!=r&&(t+=`%c in %c${r.toFixed(3)}ms`,e.push(g.keyword,g.number)),console.log(t,...e),u.C._ANIMATIONLOG_.push({canvas:i,animationName:i.currentLoopName,state:"finished",endTime:r})}0<i.delayedAnimations.length&&a((n=i.delayedAnimations.shift()).name,n.functionToRun,n.canvasName,n.timeDelay,n.timeDelaysToRememberm,n.settings,n.dur)},n.noStroke=function(){u.C.workingContext.doStroke=!1},n.putImageData=function(){u.C.workingContext.putImageData(...arguments)},n.rest=i,n.restore=function(){(0,d.defineProperties)(u.C.workingContext.savedStates,u.C.workingContext),u.C.workingContext.restore()},n.rotate=function(t){var e=u.C.workingContext;e.rotate(t),e.netRotation=(e.netRotation+t)%Math.PI*2},n.save=function(){u.C.workingContext.savedStates=m(),u.C.workingContext.save()},n.saveCanvas=function(t="drawing",e="image/png"){var e=s().replace(e,"image/octet-stream"),n=document.createElement("a");n.download=t+".png",n.href=e,n.click()},n.scale=function(t,e=t){u.C.workingContext.scale(t,e)},n.setImageSmoothing=function(t){u.C.workingContext.imageSmoothingEnabled=!!t},n.startShape=function(){var t=u.C.workingContext;t.beginPath(),t.pathStarted=!0},n.stroke=function(...t){var e=u.C.workingContext;0<arguments.length?(e.strokeStyle=(0,r.readColor)(t).hex8,e.doStroke=!0):e.stroke()},n.strokeWidth=function(t){u.C.workingContext.lineWidth=Number(t)},n.textAlign=function(t){u.C.workingContext.textAlign=t},n.textBaseline=function(t){u.C.workingContext.textBaseline=t},n.transform=function(t,e,n,r,i,a){var o=u.C.workingContext;{if(null==t)return u.C.workingContext.getTransform();t instanceof DOMMatrix?o.setTransform(t.a,t.b,t.c,t.d,t.e,t.f):o.setTransform(t||0,e||0,n||0,r||0,i||0,a||0)}o.scale(u.C.dpr,u.C.dpr)},n.translate=function(t,e=0){u.C.workingContext.translate(t,e)};var r=t("./color/color_reader.js"),u=t("./main.js"),d=t("./utils.js");let h={loop:1},g={number:"color: #9afcad;",keyword:"color: #adacdf;",running:"color: yellow;",delayed:"color: orange;",finished:"color: #3aff5f;"};function i(){u.C.workingContext.setTransform(u.C.dpr,0,0,u.C.dpr,0,0)}function m(t){t=u.C.contextList[t]||u.C.workingContext;return{background:t.background,colorMode:t.colorMode,strokeStyle:t.strokeStyle,fillStyle:t.fillStyle,lineWidth:t.lineWidth,doStroke:t.doStroke,doFill:t.doFill,pathStarted:t.pathStarted,yAxisInverted:t.yAxisInverted,xAxisInverted:t.xAxisInverted,netRotation:t.netRotation,fontStyle:t.fontStyle,fontVariant:t.fontVariant,fontWeight:t.fontWeight,fontStretch:t.fontStretch,fontSize:t.fontSize,lineHeight:t.lineHeight,fontFamily:t.fontFamily,font:t.font,textAlign:t.textAlign,textBaseline:t.textBaseline,events:t.events}}function a(n,r,i,t,a=100,o={},s){let l,c=("function"==typeof n&&(n=h.loop++,r=arguments[0],i=arguments[1],t=arguments[2],o=arguments[3],s=arguments[4]),i?l=u.C.contextList[i]:(l=u.C.workingContext,i=l.name),l.timeDelayList=[],l.totalTimeCaptured=0,Object.assign(m(i)||{},o));if(null!=l.currentLoop)u.C.debugAnimations&&(console.log(i+": "+n+" %cdelayed",g.delayed),u.C._ANIMATIONLOG_.push({canvas:l,animationName:n,state:"delayed",settings:c})),l.delayedAnimations.push({name:n,settings:c,functionToRun:r,canvasName:i,timeDelay:t,timeDelaysToRemember:a,dur:s});else{if(u.C.debugAnimations){let t=i+`: ${n} %crunning`,e=[g.running];null!=s&&(t+=`%c for %c${s}ms`,e.push(g.keyword,g.number)),u.C._ANIMATIONLOG_.push({canvas:l,animationName:n,state:"running",settings:c,dur:s}),console.log(t,...e)}l.recentTimeStamp=performance.now(),l.timeStart=performance.now(),isNaN(t)?function t(){l.currentLoop=globalThis.requestAnimationFrame(t);u.C.workingContext=l;let e=m(i);o&&(0,d.defineProperties)(c,u.C.workingContext);r(performance.now()-l.timeStart,f());o&&(0,d.defineProperties)(e,u.C.workingContext)}():(l.currentLoopName=n,l.currentLoop=setInterval(function(){u.C.workingContext=l;var t=m(i);(0,d.defineProperties)(c,u.C.workingContext),r(performance.now()-l.timeStart,f()),(0,d.defineProperties)(t,u.C.workingContext)},t))}function f(){var t=performance.now(),e=t-l.recentTimeStamp;return l.recentTimeStamp=t,l.timeDelayList.push(e),l.totalTimeCaptured+=e,l.timeDelayList.length>a&&(l.totalTimeCaptured-=l.timeDelayList.shift()),l.timeDelayList.length/(l.totalTimeCaptured/1e3)}}function o(t=!1){var e,n,r,i,a,o,s=u.C.workingContext;return t?({fontStyle:t,fontVariant:e,fontWeight:n,fontStretch:r,fontSize:i,lineHeight:a,fontFamily:o}=s,t+` ${e} ${n} ${r} ${i}/${a} `+o):s.font}function s(t="image/png"){return u.C.workingContext.canvas.toDataURL(t)}},{"./color/color_reader.js":6,"./main.js":16,"./utils.js":37}],37:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.applyDefault=function s(l,c={},f=!0){c=Object.clone(c);for(let a=0,o=Object.keys(l);a<o.length;a++){let t=o[a],e=l[t],n=c[t],r=u(e),i=u(n);"Object"==r&&f&&(c[t]=s(e,n,f)),"Undefined"!=r&&"Null"!=r&&i!==r&&(c[t]=l[t])}return c},n.arange=function(e,n,r,t=!1){var i=[];if(t)for(let t=n;t>=e;t-=r)i.push(t);else for(let t=e;t<=n;t+=r)i.push(t);return i},n.defineConstant=function(n){var r=Object.keys(n);for(let t=0;t<r.length;t++){let e=r[t];Object.defineProperty(globalThis,e,{configurable:!0,enumerable:!0,get:n[e],set:function(t){Object.defineProperty(globalThis,e,{configurable:!0,enumerable:!0,value:t,writable:!0})}})}},n.defineProperties=function(t,e=globalThis,n=!1){Object.assign(e,t),n&&Object.assign(i.C.functions,t)},n.doFillAndStroke=function(t){t.doFill&&t.fill();t.doStroke&&t.stroke()},n.fraction=function(t,e,n=!0,r=!0,i=""){let a=t,o=e,s="";n&&([a,o]=l(a,o));s=0==a?"0":1==o?a+e:r?""+(a=1==a&&""!=i?"":a)+i+"/"+o:`(${a}/${o})`+i;return s},n.inArray=function(e,n,r=1e-6){for(let t=0;t<n.length;t++){var i=n[t];if(Math.abs(i-e)<=r)return!0}return!1},n.isLabel=function(t){return null!=t&&""!=t},n.latexToImg=function(a){let o=window.MathJax||{};return new Promise((e,t)=>{var n=o.tex2svg(""+a,{em:10,ex:5,display:!0}).getElementsByTagName("svg")[0];let r={svg:"",img:""};r.svg=n.outerHTML;var i=new Image;i.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(r.svg))),i.onload=function(){var t=document.createElement("canvas");t.width=i.width,t.height=i.height,t.getContext("2d").drawImage(i,0,0),r.img=t.toDataURL("image/png"),e(r.img)},i.onerror=function(){t()}})},n.measureHeight=function(t){var{actualBoundingBoxAscent:t,actualBoundingBoxDescent:e}=i.C.workingContext.measureText(t);return t+e},n.texFraction=function(t,e,n=!0,r=!0,i=""){let a=t,o=e;n&&([a,o]=l(a,o));tex=0==a?"0":1==o?a:r?`\\frac{${a=1==a&&""!=i?"":a}${i}}{${o}}`:`\\frac{${a}}{${o}}`+i;return tex},n.type=void 0;var r=t("./math/aritmetics.js"),i=t("./main.js");const u=t=>Object.prototype.toString.call(t).slice(8,-1);function l(t,e){var n=(0,r.gcd)(t,e);return[""+(t/=n),""+(e/=n)]}n.type=u,Object.clone=Object.clone||function(n){var r={};for(let t=0,e=Object.keys(n);t<e.length;t++){var i=n[e[t]];r[e[t]]=i}return r}},{"./main.js":16,"./math/aritmetics.js":17}]},{},[4]);
//# sourceMappingURL=c.min.js.map