p5
Version:
[](https://www.npmjs.com/package/p5)
1 lines • 899 kB
JavaScript
var p5=function(){"use strict";const t=Math.PI,r="2.0.3",i="p2d",s="webgl",n="webgl2",a="default",o="simple",h="full",u="crosshair",l="pointer",c="move",p="text",d="wait",f=t/2,g=t,m=t/4,y=2*t,x=2*t,v=t/180,b=180/t,_="corner",w="corners",C="radius",D="right",E="left",A="center",S="bottom",F="alphabetic",T=0,M=1,k="quads",I="quad_strip",B="close",L="open",P="chord",O="pie",N="square",R="butt",V="round",U="bevel",G="miter",z="auto",j="source-over",$="destination-out",W="lighter",q="darken",H="lighten",X="difference",Y="subtract",Z="exclusion",K="multiply",J="screen",Q="copy",ee="overlay",te="hard-light",re="soft-light",ie="color-dodge",se="color-burn",ne="threshold",ae="gray",oe="opaque",he="invert",ue="posterize",le="dilate",ce="erode",pe="blur",de="normal",fe="WORD",ge="linear",me="fill",ye="texture",xe="image",ve="nearest",be="repeat",_e="clamp",we="mirror",Ce="flat",De="smooth",Ee="#000000",Ae="#FFFFFF",Se="grid",Fe="axes",Te="contain",Me="cover",ke="unsigned-byte",Ie="unsigned-int",Be="float",Le="half-float",Pe=Symbol("include"),Oe=Symbol("exclude"),Ne=Symbol("join");var Re=Object.freeze({__proto__:null,ADD:W,ALT:"Alt",ARROW:a,AUTO:z,AXES:Fe,BACKSPACE:"Backspace",BASELINE:F,BEVEL:U,BEZIER:"bezier",BLEND:j,BLUR:pe,BOLD:"bold",BOLDITALIC:"bold italic",BOTTOM:S,BURN:se,CENTER:A,CHAR:"CHAR",CHORD:P,CLAMP:_e,CLOSE:B,CONTAIN:Te,CONTROL:"Control",CORNER:_,CORNERS:w,COVER:Me,CROSS:u,CURVE:"curve",DARKEST:q,DEG_TO_RAD:v,DELETE:"Delete",DIFFERENCE:X,DILATE:le,DODGE:ie,DOWN_ARROW:"ArrowDown",EMPTY_PATH:7,ENTER:"Enter",ERODE:ce,ESCAPE:"Escape",EXCLUDE:Oe,EXCLUSION:Z,FALLBACK:"fallback",FILL:me,FLAT:Ce,FLOAT:Be,FULL:h,GRAY:ae,GRID:Se,HALF_FLOAT:Le,HALF_PI:f,HAND:l,HARD_LIGHT:te,IMAGE:xe,IMMEDIATE:"immediate",INCLUDE:Pe,INVERT:he,ITALIC:"italic",JOIN:Ne,LABEL:"label",LANDSCAPE:"landscape",LEFT:E,LEFT_ARROW:"ArrowLeft",LIGHTEST:H,LINEAR:ge,LINES:M,LINE_LOOP:2,LINE_STRIP:3,MIRROR:we,MITER:G,MOVE:c,MULTIPLY:K,NEAREST:ve,NORMAL:de,OPAQUE:oe,OPEN:L,OPTION:"Alt",OVERLAY:ee,P2D:i,P2DHDR:"p2d-hdr",PATH:8,PI:g,PIE:O,POINTS:T,PORTRAIT:"portrait",POSTERIZE:ue,PROJECT:N,QUADRATIC:"quadratic",QUADS:k,QUAD_STRIP:I,QUARTER_PI:m,RADIUS:C,RAD_TO_DEG:b,REMOVE:$,REPEAT:be,REPLACE:Q,RETURN:"Enter",RIGHT:D,RIGHT_ARROW:"ArrowRight",ROUND:V,SCREEN:J,SHIFT:"Shift",SIMPLE:o,SMOOTH:De,SOFT_LIGHT:re,SQUARE:R,STROKE:"stroke",SUBTRACT:Y,TAB:"Tab",TAU:y,TESS:"tess",TEXT:p,TEXTURE:ye,THRESHOLD:ne,TOP:"top",TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,TWO_PI:x,UNSIGNED_BYTE:ke,UNSIGNED_INT:Ie,UP_ARROW:"ArrowUp",VERSION:r,WAIT:d,WEBGL:s,WEBGL2:n,WORD:fe,_CTX_MIDDLE:"middle",_DEFAULT_FILL:Ae,_DEFAULT_LEADMULT:1.25,_DEFAULT_STROKE:Ee,_DEFAULT_TEXT_FILL:"#000000"});function Ve(e,t){t.applyMatrix=function(...e){let t=e[0]instanceof Object.getPrototypeOf(Uint8Array);return Array.isArray(e[0])||t?this._renderer.applyMatrix(...e[0]):this._renderer.applyMatrix(...e),this},t.resetMatrix=function(){return this._renderer.resetMatrix(),this},t.rotate=function(e,t){return this._renderer.rotate(this._toRadians(e),t),this},t.rotateX=function(e){return this._assert3d("rotateX"),this._renderer.rotateX(this._toRadians(e)),this},t.rotateY=function(e){return this._assert3d("rotateY"),this._renderer.rotateY(this._toRadians(e)),this},t.rotateZ=function(e){return this._assert3d("rotateZ"),this._renderer.rotateZ(this._toRadians(e)),this},t.scale=function(t,r,i){if(t instanceof e.Vector){const e=t;t=e.x,r=e.y,i=e.z}else if(Array.isArray(t)){const e=t;t=e[0],r=e[1],i=e[2]||1}return isNaN(r)?r=i=t:isNaN(i)&&(i=1),this._renderer.scale(t,r,i),this},t.shearX=function(e){const t=this._toRadians(e);return this._renderer.applyMatrix(1,0,Math.tan(t),1,0,0),this},t.shearY=function(e){const t=this._toRadians(e);return this._renderer.applyMatrix(1,Math.tan(t),0,1,0,0),this},t.translate=function(e,t,r){return this._renderer.isP3D?this._renderer.translate(e,t,r):this._renderer.translate(e,t),this},t.push=function(){this._renderer.push()},t.pop=function(){this._renderer.pop()}}function Ue(e,t){t.noLoop=function(){this._loop=!1},t.loop=function(){this._loop||(this._loop=!0,this._setupDone&&this._draw())},t.isLooping=function(){return this._loop},t.redraw=async function(e){if(this._inUserDraw||!this._setupDone)return;let t=parseInt(e);(isNaN(t)||t<1)&&(t=1);const r=this._isGlobal?window:this;if("function"==typeof r.draw){void 0===r.setup&&r.scale(r._pixelDensity,r._pixelDensity);for(let e=0;e<t;e++){r.resetMatrix(),(this._accessibleOutputs.grid||this._accessibleOutputs.text)&&this._updateAccsOutput(),this._renderer.isP3D&&this._renderer._update(),this.frameCount=r.frameCount+1,await this._runLifecycleHook("predraw"),this._inUserDraw=!0;try{await r.draw()}finally{this._inUserDraw=!1}await this._runLifecycleHook("postdraw")}}}}void 0!==p5&&Ve(p5,p5.prototype),void 0!==p5&&Ue(0,p5.prototype);const Ge=function(e,t){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),this},ze=function(e,t,r){return 0!==e&&(this.x=this.x%e),0!==t&&(this.y=this.y%t),0!==r&&(this.z=this.z%r),this};class je{constructor(...e){let t=e.map((e=>e||0));"function"==typeof e[0]&&(this.isPInst=!0,this._fromRadians=e[0],this._toRadians=e[1],t=e.slice(2).map((e=>e||0)));let r=t.length;0===r?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=r,this._values=t)}get values(){return this._values}set values(e){let t=e.length;0===t?(this.dimensions=2,this._values=[0,0,0]):(this.dimensions=t,this._values=e.slice())}get x(){return this._values[0]||0}getValue(e){if(e<this._values.length)return this._values[e];p5._friendlyError("The index parameter is trying to set a value outside the bounds of the vector","p5.Vector.setValue")}setValue(e,t){e<this._values.length?this._values[e]=t:p5._friendlyError("The index parameter is trying to set a value outside the bounds of the vector","p5.Vector.setValue")}get y(){return this._values[1]||0}get z(){return this._values[2]||0}get w(){return this._values[3]||0}set x(e){this._values.length>1&&(this._values[0]=e)}set y(e){this._values.length>1&&(this._values[1]=e)}set z(e){this._values.length>2&&(this._values[2]=e)}set w(e){this._values.length>3&&(this._values[3]=e)}toString(){return`[${this.values.join(", ")}]`}set(...e){return e[0]instanceof je?this.values=e[0].values.slice():Array.isArray(e[0])?this.values=e[0].map((e=>e||0)):this.values=e.map((e=>e||0)),this.dimensions=this.values.length,this}copy(){return this.isPInst?new je(this._fromRadians,this._toRadians,...this.values):new je(...this.values)}add(...e){return e[0]instanceof je?e=e[0].values:Array.isArray(e[0])&&(e=e[0]),e.forEach(((e,t)=>{this.values[t]=(this.values[t]||0)+(e||0)})),this}rem(e,t,r){if(e instanceof je){if([e.x,e.y,e.z].every(Number.isFinite)){const t=parseFloat(e.x),r=parseFloat(e.y),i=parseFloat(e.z);return ze.call(this,t,r,i)}}else if(Array.isArray(e)){if(e.every((e=>Number.isFinite(e)))){if(2===e.length)return Ge.call(this,e[0],e[1]);if(3===e.length)return ze.call(this,e[0],e[1],e[2])}}else if(1===arguments.length){if(Number.isFinite(arguments[0])&&0!==arguments[0])return this.x=this.x%arguments[0],this.y=this.y%arguments[0],this.z=this.z%arguments[0],this}else if(2===arguments.length){const e=[...arguments];if(e.every((e=>Number.isFinite(e)))&&2===e.length)return Ge.call(this,e[0],e[1])}else if(3===arguments.length){const e=[...arguments];if(e.every((e=>Number.isFinite(e)))&&3===e.length)return ze.call(this,e[0],e[1],e[2])}}sub(...e){return e[0]instanceof je?e[0].values.forEach(((e,t)=>{this.values[t]-=e||0})):Array.isArray(e[0])?e[0].forEach(((e,t)=>{this.values[t]-=e||0})):e.forEach(((e,t)=>{this.values[t]-=e||0})),this}mult(...e){if(1===e.length&&e[0]instanceof je){const t=e[0],r=Math.min(this.values.length,t.values.length);for(let e=0;e<r;e++){if(!Number.isFinite(t.values[e])||"number"!=typeof t.values[e])return console.warn("p5.Vector.prototype.mult:","v contains components that are either undefined or not finite numbers"),this;this._values[e]*=t.values[e]}}else if(1===e.length&&Array.isArray(e[0])){const t=e[0],r=Math.min(this.values.length,t.length);for(let e=0;e<r;e++){if(!Number.isFinite(t[e])||"number"!=typeof t[e])return console.warn("p5.Vector.prototype.mult:","arr contains elements that are either undefined or not finite numbers"),this;this._values[e]*=t[e]}}else if(1===e.length&&"number"==typeof e[0]&&Number.isFinite(e[0]))for(let t=0;t<this._values.length;t++)this._values[t]*=e[0];return this}div(...e){if(0===e.length)return this;if(1===e.length&&e[0]instanceof je){const t=e[0];if(t._values.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(t._values.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((e,r)=>e/t._values[r]))}else console.warn("p5.Vector.prototype.div:","vector contains components that are either undefined or not finite numbers");return this}if(1===e.length&&Array.isArray(e[0])){const t=e[0];if(t.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(t.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((e,r)=>e/t[r]))}else console.warn("p5.Vector.prototype.div:","array contains components that are either undefined or not finite numbers");return this}if(e.every((e=>Number.isFinite(e)&&"number"==typeof e))){if(e.some((e=>0===e)))return console.warn("p5.Vector.prototype.div:","divide by 0"),this;this._values=this._values.map(((t,r)=>t/e[0]))}else console.warn("p5.Vector.prototype.div:","arguments contain components that are either undefined or not finite numbers");return this}mag(){return Math.sqrt(this.magSq())}magSq(){return this._values.reduce(((e,t)=>e+t*t),0)}dot(...e){return e[0]instanceof je?this.dot(...e[0]._values):this._values.reduce(((t,r,i)=>t+r*(e[i]||0)),0)}cross(e){const t=this.y*e.z-this.z*e.y,r=this.z*e.x-this.x*e.z,i=this.x*e.y-this.y*e.x;return this.isPInst?new je(this._fromRadians,this._toRadians,t,r,i):new je(t,r,i)}dist(e){return e.copy().sub(this).mag()}normalize(){const e=this.mag();return 0!==e&&this.mult(1/e),this}limit(e){const t=this.magSq();return t>e*e&&this.div(Math.sqrt(t)).mult(e),this}setMag(e){return this.normalize().mult(e)}heading(){const e=Math.atan2(this.y,this.x);return this.isPInst?this._fromRadians(e):e}setHeading(e){this.isPInst&&(e=this._toRadians(e));let t=this.mag();return this.x=t*Math.cos(e),this.y=t*Math.sin(e),this}rotate(e){let t=this.heading()+e;this.isPInst&&(t=this._toRadians(t));const r=this.mag();return this.x=Math.cos(t)*r,this.y=Math.sin(t)*r,this}angleBetween(e){if(0===this.magSq()*e.magSq())return NaN;const t=this.cross(e);let r=Math.atan2(t.mag(),this.dot(e))*Math.sign(t.z||1);return this.isPInst&&(r=this._fromRadians(r)),r}lerp(e,t,r,i){return e instanceof je?this.lerp(e.x,e.y,e.z,t):(this.x+=(e-this.x)*i||0,this.y+=(t-this.y)*i||0,this.z+=(r-this.z)*i||0,this)}slerp(e,t){if(0===t)return this;if(1===t)return this.set(e);const r=this.mag(),i=e.mag();if(0===r*i)return this.mult(1-t).add(e.x*t,e.y*t,e.z*t),this;const s=this.cross(e),n=s.mag(),a=Math.atan2(n,this.dot(e));if(n>0)s.x/=n,s.y/=n,s.z/=n;else{if(a<.5*Math.PI)return this.mult(1-t).add(e.x*t,e.y*t,e.z*t),this;0===this.z&&0===e.z?s.set(0,0,1):0!==this.x?s.set(this.y,-this.x,0).normalize():s.set(1,0,0)}const o=s.cross(this),h=1-t+t*i/r,u=h*Math.cos(t*a),l=h*Math.sin(t*a);return this.x=this.x*u+o.x*l,this.y=this.y*u+o.y*l,this.z=this.z*u+o.z*l,this}reflect(e){const t=je.normalize(e);return this.sub(t.mult(2*this.dot(t)))}array(){return[this.x||0,this.y||0,this.z||0]}equals(...e){let t;t=e[0]instanceof je?e[0]._values:Array.isArray(e[0])?e[0]:e;for(let e=0;e<this._values.length;e++)if(this._values[e]!==(t[e]||0))return!1;return!0}clampToZero(){for(let e=0;e<this._values.length;e++)this._values[e]=this._clampToZero(this._values[e]);return this}_clampToZero(e){return Math.abs((e||0)-0)<=Number.EPSILON?0:e}static fromAngle(e,t){return void 0===t&&(t=1),new je(t*Math.cos(e),t*Math.sin(e),0)}static fromAngles(e,t,r){void 0===r&&(r=1);const i=Math.cos(t),s=Math.sin(t),n=Math.cos(e),a=Math.sin(e);return new je(r*a*s,-r*n,r*a*i)}static random2D(){return this.fromAngle(Math.random()*x)}static random3D(){const e=Math.random()*x,t=2*Math.random()-1,r=Math.sqrt(1-t*t),i=r*Math.cos(e),s=r*Math.sin(e);return new je(i,s,t)}static copy(e){return e.copy(e)}static add(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.add")),r.add(t),r}static rem(e,t){if(e instanceof je&&t instanceof je){let r=e.copy();return r.rem(t),r}}static sub(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.sub")),r.sub(t),r}static mult(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.mult")),r.mult(t),r}static rotate(e,t,r){return 2===arguments.length?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.rotate"),r.set(e)),r.rotate(t),r}static div(e,t,r){return r?r.set(e):(r=e.copy(),3===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.div")),r.div(t),r}static dot(e,t){return e.dot(t)}static cross(e,t){return e.cross(t)}static dist(e,t){return e.dist(t)}static lerp(e,t,r,i){return i?i.set(e):(i=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.lerp")),i.lerp(t,r),i}static slerp(e,t,r,i){return i?i.set(e):(i=e.copy(),4===arguments.length&&p5._friendlyError("The target parameter is undefined, it should be of type p5.Vector","p5.Vector.slerp")),i.slerp(t,r),i}static mag(e){return e.mag()}static magSq(e){return e.magSq()}static normalize(e,t){return arguments.length<2?t=e.copy():(t instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.normalize"),t.set(e)),t.normalize()}static limit(e,t,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.limit"),r.set(e)),r.limit(t)}static setMag(e,t,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.setMag"),r.set(e)),r.setMag(t)}static heading(e){return e.heading()}static angleBetween(e,t){return e.angleBetween(t)}static reflect(e,t,r){return arguments.length<3?r=e.copy():(r instanceof je||p5._friendlyError("The target parameter should be of type p5.Vector","p5.Vector.reflect"),r.set(e)),r.reflect(t)}static array(e){return e.array()}static equals(e,t){let r;return e instanceof je?r=e:e instanceof Array?r=(new je).set(e):p5._friendlyError("The v1 parameter should be of type Array or p5.Vector","p5.Vector.equals"),r.equals(t)}}function $e(e,t){e.Vector=je}function We(e,t){const r=[a,u,l,c,p,d];t._frameRate=0,t._lastFrameTime=window.performance.now(),t._targetFrameRate=60;const s=window.print;let n=!1;function o(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function h(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}t.print=function(...e){e.length?console.log(...e):n||(s(),window.confirm("You just tried to print the webpage. Do you want to prevent this from running again?")&&(n=!0))},t.frameCount=0,t.deltaTime=0,t.focused=document.hasFocus(),t.cursor=function(e,t,i){let s="auto";const n=this._curElement.elt;if(r.includes(e))s=e;else if("string"==typeof e){let r="";t&&i&&"number"==typeof t&&"number"==typeof i&&(r=`${t} ${i}`),s="http://"===e.substring(0,7)||"https://"===e.substring(0,8)||/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(e)?`url(${e}) ${r}, auto`:e}n.style.cursor=s},t.frameRate=function(e){return"number"!=typeof e||e<0?this._frameRate:(this._targetFrameRate=e,0===e&&(this._frameRate=e),this)},t.getFrameRate=function(){return this.frameRate()},t.setFrameRate=function(e){return this.frameRate(e)},t.getTargetFrameRate=function(){return this._targetFrameRate},t.noCursor=function(){this._curElement.elt.style.cursor="none"},t.webglVersion=i,t.displayWidth=screen.width,t.displayHeight=screen.height,t.windowWidth=0,t.windowHeight=0,t._onresize=function(e){this.windowWidth=o(),this.windowHeight=h();const t=this._isGlobal?window:this;let r;"function"==typeof t.windowResized&&(r=t.windowResized(e),void 0===r||r||e.preventDefault())},t._updateWindowSize=function(){this.windowWidth=o(),this.windowHeight=h()},Object.defineProperty(t,"width",{get(){return this._renderer.width}}),Object.defineProperty(t,"height",{get(){return this._renderer.height}}),t.fullscreen=function(e){if(void 0===e)return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;e?function(e){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))throw new Error("Fullscreen not enabled in this browser.");e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()}(document.documentElement):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()},t.pixelDensity=function(e){let t;return"number"==typeof e?(e!==this._renderer._pixelDensity&&(this._renderer._pixelDensity=e),t=this,this.resizeCanvas(this.width,this.height,!0)):t=this._renderer._pixelDensity,t},t.displayDensity=()=>window.devicePixelRatio,t.getURL=()=>location.href,t.getURLPath=()=>location.pathname.split("/").filter((e=>""!==e)),t.getURLParams=function(){const e=/[?&]([^&=]+)(?:[&=])([^&=]+)/gim;let t;const r={};for(;null!=(t=e.exec(location.search));)t.index===e.lastIndex&&e.lastIndex++,r[t[1]]=t[2];return r},t.worldToScreen=function(e){"number"==typeof e&&(e=this.createVector(...arguments));return this._renderer.getWorldToScreenMatrix().multiplyAndNormalizePoint(e)},t.screenToWorld=function(e){"number"==typeof e&&(e=this.createVector(...arguments));const t=this._renderer.getWorldToScreenMatrix();if(2==e.dimensions){let r=t.mat4[14]/t.mat4[15];e=this.createVector(e.x,e.y,r)}return t.invert(t).multiplyAndNormalizePoint(e)}}function qe(e,t){let r=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map((e=>[e])));let i=t[0].length,s=t[0].map(((e,r)=>t.map((e=>e[r])))),n=e.map((e=>s.map((t=>{let r=0;if(!Array.isArray(e)){for(let i of t)r+=e*i;return r}for(let i=0;i<e.length;i++)r+=e[i]*(t[i]||0);return r}))));return 1===r&&(n=n[0]),1===i?n.map((e=>e[0])):n}function He(e){return"string"===Xe(e)}function Xe(e){return(Object.prototype.toString.call(e).match(/^\[object\s+(.*?)\]$/)[1]||"").toLowerCase()}function Ye(e,{precision:t,unit:r}){return Ze(e)?"none":function(e,t){if(0===e)return 0;let r=~~e,i=0;r&&t&&(i=1+~~Math.log10(Math.abs(r)));const s=10**(t-i);return Math.floor(e*s+.5)/s}(e,t)+(r??"")}function Ze(e){return Number.isNaN(e)||e instanceof Number&&e?.none}void 0!==p5&&$e(p5),void 0!==p5&&We(0,p5.prototype);const Ke={deg:1,grad:.9,rad:180/Math.PI,turn:360};function Je(e){return e[e.length-1]}function Qe(e,t,r){return isNaN(e)?t:isNaN(t)?e:e+(t-e)*r}function et(e,t,r){return Qe(t[0],t[1],function(e,t,r){return(r-e)/(t-e)}(e[0],e[1],r))}function tt(e,t){return Math.sign(e)===Math.sign(t)?e:-e}function rt(e,t){return tt(Math.abs(e)**t,e)}function it(e,t){return 0===t?0:e/t}const st=new class{add(e,t,r){if("string"==typeof arguments[0])(Array.isArray(e)?e:[e]).forEach((function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)}),this);else for(var e in arguments[0])this.add(e,arguments[0][e],arguments[1])}run(e,t){this[e]=this[e]||[],this[e].forEach((function(e){e.call(t&&t.context?t.context:t,t)}))}},nt={D50:[.3457/.3585,1,.2958/.3585],D65:[.3127/.329,1,.3583/.329]};function at(e){return Array.isArray(e)?e:nt[e]}function ot(e,t,r,i={}){if(e=at(e),t=at(t),!e||!t)throw new TypeError(`Missing white point to convert ${e?"":"from"}${e||t?"":"/"}${t?"":"to"}`);if(e===t)return r;let s={W1:e,W2:t,XYZ:r,options:i};if(st.run("chromatic-adaptation-start",s),s.M||(s.W1===nt.D65&&s.W2===nt.D50?s.M=[[1.0479297925449969,.022946870601609652,-.05019226628920524],[.02962780877005599,.9904344267538799,-.017073799063418826],[-.009243040646204504,.015055191490298152,.7518742814281371]]:s.W1===nt.D50&&s.W2===nt.D65&&(s.M=[[.955473421488075,-.02309845494876471,.06325924320057072],[-.0283697093338637,1.0099953980813041,.021041441191917323],[.012314014864481998,-.020507649298898964,1.330365926242124]])),st.run("chromatic-adaptation-end",s),s.M)return qe(s.M,s.XYZ);throw new TypeError("Only Bradford CAT with white points D50 and D65 supported for now.")}var ht={gamut_mapping:"css",precision:5,deltaE:"76",verbose:"test"!==globalThis?.process?.env?.NODE_ENV?.toLowerCase(),warn:function(e){this.verbose&&globalThis?.console?.warn?.(e)}};const ut=new Set(["<number>","<percentage>","<angle>"]);function lt(e,t,r,i){let s=Object.entries(e.coords).map((([e,s],n)=>{let a,o=t.coordGrammar[n],h=i[n],u=h?.type;if(a=h.none?o.find((e=>ut.has(e))):o.find((e=>e==u)),!a){let t=s.name||e;throw new TypeError(`${u??h.raw} not allowed for ${t} in ${r}()`)}let l=a.range;"<percentage>"===u&&(l||=[0,1]);let c=s.range||s.refRange;return l&&c&&(i[n]=et(l,c,i[n])),a}));return s}function ct(e,{meta:t}={}){let r={str:String(e)?.trim()};if(st.run("parse-start",r),r.color)return r.color;if(r.parsed=function(e){if(!e)return;e=e.trim();const t=/^-?[\d.]+$/,r=/%|deg|g?rad|turn$/,i=/\/?\s*(none|[-\w.]+(?:%|deg|g?rad|turn)?)/g;let s=e.match(/^([a-z]+)\((.+?)\)$/i);if(s){let e=[];return s[2].replace(i,((i,s)=>{let n=s.match(r),a=s;if(n){let e=n[0],t=a.slice(0,-e.length);"%"===e?(a=new Number(t/100),a.type="<percentage>"):(a=new Number(t*Ke[e]),a.type="<angle>",a.unit=e)}else t.test(a)?(a=new Number(a),a.type="<number>"):"none"===a&&(a=new Number(NaN),a.none=!0);i.startsWith("/")&&(a=a instanceof Number?a:new Number(a),a.alpha=!0),"object"==typeof a&&a instanceof Number&&(a.raw=s),e.push(a)})),{name:s[1].toLowerCase(),rawName:s[1],rawArgs:s[2],args:e}}}(r.str),r.parsed){let e=r.parsed.name;if("color"===e){let e=r.parsed.args.shift(),i=e.startsWith("--")?e.substring(2):`--${e}`,s=[e,i],n=r.parsed.rawArgs.indexOf("/")>0?r.parsed.args.pop():1;for(let i of dt.all){let a=i.getFormat("color");if(a&&(s.includes(a.id)||a.ids?.filter((e=>s.includes(e))).length)){const s=Object.keys(i.coords).map(((e,t)=>r.parsed.args[t]||0));let o;return a.coordGrammar&&(o=lt(i,a,"color",s)),t&&Object.assign(t,{formatId:"color",types:o}),a.id.startsWith("--")&&!e.startsWith("--")&&ht.warn(`${i.name} is a non-standard space and not currently supported in the CSS spec. Use prefixed color(${a.id}) instead of color(${e}).`),e.startsWith("--")&&!a.id.startsWith("--")&&ht.warn(`${i.name} is a standard space and supported in the CSS spec. Use color(${a.id}) instead of prefixed color(${e}).`),{spaceId:i.id,coords:s,alpha:n}}}let a="",o=e in dt.registry?e:i;if(o in dt.registry){let e=dt.registry[o].formats?.color?.id;e&&(a=`Did you mean color(${e})?`)}throw new TypeError(`Cannot parse color(${e}). `+(a||"Missing a plugin?"))}for(let i of dt.all){let s=i.getFormat(e);if(s&&"function"===s.type){let n=1;(s.lastAlpha||Je(r.parsed.args).alpha)&&(n=r.parsed.args.pop());let a,o=r.parsed.args;return s.coordGrammar&&(a=lt(i,s,e,o)),t&&Object.assign(t,{formatId:s.name,types:a}),{spaceId:i.id,coords:o,alpha:n}}}}else for(let e of dt.all)for(let i in e.formats){let s=e.formats[i];if("custom"!==s.type)continue;if(s.test&&!s.test(r.str))continue;let n=s.parse(r.str);if(n)return n.alpha??=1,t&&(t.formatId=i),n}throw new TypeError(`Could not parse ${e} as a color. Missing a plugin?`)}function pt(e){if(Array.isArray(e))return e.map(pt);if(!e)throw new TypeError("Empty color reference");He(e)&&(e=ct(e));let t=e.space||e.spaceId;return t instanceof dt||(e.space=dt.get(t)),void 0===e.alpha&&(e.alpha=1),e}class dt{constructor(e){this.id=e.id,this.name=e.name,this.base=e.base?dt.get(e.base):null,this.aliases=e.aliases,this.base&&(this.fromBase=e.fromBase,this.toBase=e.toBase);let t=e.coords??this.base.coords;for(let e in t)"name"in t[e]||(t[e].name=e);this.coords=t;let r=e.white??this.base.white??"D65";this.white=at(r),this.formats=e.formats??{};for(let e in this.formats){let t=this.formats[e];t.type||="function",t.name||=e}this.formats.color?.id||(this.formats.color={...this.formats.color??{},id:e.cssId||this.id}),e.gamutSpace?this.gamutSpace="self"===e.gamutSpace?this:dt.get(e.gamutSpace):this.isPolar?this.gamutSpace=this.base:this.gamutSpace=this,this.gamutSpace.isUnbounded&&(this.inGamut=(e,t)=>!0),this.referred=e.referred,Object.defineProperty(this,"path",{value:ft(this).reverse(),writable:!1,enumerable:!0,configurable:!0}),st.run("colorspace-init-end",this)}inGamut(e,{epsilon:t=75e-6}={}){if(!this.equals(this.gamutSpace))return e=this.to(this.gamutSpace,e),this.gamutSpace.inGamut(e,{epsilon:t});let r=Object.values(this.coords);return e.every(((e,i)=>{let s=r[i];if("angle"!==s.type&&s.range){if(Number.isNaN(e))return!0;let[r,i]=s.range;return(void 0===r||e>=r-t)&&(void 0===i||e<=i+t)}return!0}))}get isUnbounded(){return Object.values(this.coords).every((e=>!("range"in e)))}get cssId(){return this.formats?.color?.id||this.id}get isPolar(){for(let e in this.coords)if("angle"===this.coords[e].type)return!0;return!1}getFormat(e){if("object"==typeof e)return e=gt(e,this);let t;return t="default"===e?Object.values(this.formats)[0]:this.formats[e],t?(t=gt(t,this),t):null}equals(e){return!!e&&(this===e||this.id===e||this.id===e.id)}to(e,t){if(1===arguments.length){const r=pt(e);[e,t]=[r.space,r.coords]}if(e=dt.get(e),this.equals(e))return t;t=t.map((e=>Number.isNaN(e)?0:e));let r,i,s=this.path,n=e.path;for(let e=0;e<s.length&&s[e].equals(n[e]);e++)r=s[e],i=e;if(!r)throw new Error(`Cannot convert between color spaces ${this} and ${e}: no connection space was found`);for(let e=s.length-1;e>i;e--)t=s[e].toBase(t);for(let e=i+1;e<n.length;e++)t=n[e].fromBase(t);return t}from(e,t){if(1===arguments.length){const r=pt(e);[e,t]=[r.space,r.coords]}return(e=dt.get(e)).to(this,t)}toString(){return`${this.name} (${this.id})`}getMinCoords(){let e=[];for(let t in this.coords){let r=this.coords[t],i=r.range||r.refRange;e.push(i?.min??0)}return e}static registry={};static get all(){return[...new Set(Object.values(dt.registry))]}static register(e,t){if(1===arguments.length&&(e=(t=arguments[0]).id),t=this.get(t),this.registry[e]&&this.registry[e]!==t)throw new Error(`Duplicate color space registration: '${e}'`);if(this.registry[e]=t,1===arguments.length&&t.aliases)for(let e of t.aliases)this.register(e,t);return t}static get(e,...t){if(!e||e instanceof dt)return e;if("string"===Xe(e)){let t=dt.registry[e.toLowerCase()];if(!t)throw new TypeError(`No color space found with id = "${e}"`);return t}if(t.length)return dt.get(...t);throw new TypeError(`${e} is not a valid color space`)}static resolveCoord(e,t){let r,i,s=Xe(e);if("string"===s?e.includes(".")?[r,i]=e.split("."):[r,i]=[,e]:Array.isArray(e)?[r,i]=e:(r=e.space,i=e.coordId),r=dt.get(r),r||(r=t),!r)throw new TypeError(`Cannot resolve coordinate reference ${e}: No color space specified and relative references are not allowed here`);if(s=Xe(i),"number"===s||"string"===s&&i>=0){let e=Object.entries(r.coords)[i];if(e)return{space:r,id:e[0],index:i,...e[1]}}r=dt.get(r);let n=i.toLowerCase(),a=0;for(let e in r.coords){let t=r.coords[e];if(e.toLowerCase()===n||t.name?.toLowerCase()===n)return{space:r,id:e,index:a,...t};a++}throw new TypeError(`No "${i}" coordinate found in ${r.name}. Its coordinates are: ${Object.keys(r.coords).join(", ")}`)}static DEFAULT_FORMAT={type:"functions",name:"color"}}function ft(e){let t=[e];for(let r=e;r=r.base;)t.push(r);return t}function gt(e,{coords:t}={}){if(e.coords&&!e.coordGrammar){e.type||="function",e.name||="color",e.coordGrammar=e.coords.map((e=>e.split("|").map((e=>{let t=(e=e.trim()).match(/^(<[a-z]+>)\[(-?[.\d]+),\s*(-?[.\d]+)\]?$/);if(t){let e=new String(t[1]);return e.range=[+t[2],+t[3]],e}return e}))));let r=Object.entries(t).map((([t,r],i)=>{let s=e.coordGrammar[i][0],n=r.range||r.refRange,a=s.range,o="";return"<percentage>"==s?(a=[0,100],o="%"):"<angle>"==s&&(o="deg"),{fromRange:n,toRange:a,suffix:o}}));e.serializeCoords=(e,t)=>e.map(((e,i)=>{let{fromRange:s,toRange:n,suffix:a}=r[i];return s&&n&&(e=et(s,n,e)),e=Ye(e,{precision:t,unit:a})}))}return e}var mt=new dt({id:"xyz-d65",name:"XYZ D65",coords:{x:{name:"X"},y:{name:"Y"},z:{name:"Z"}},white:"D65",formats:{color:{ids:["xyz-d65","xyz"]}},aliases:["xyz"]});class yt extends dt{constructor(e){e.coords||(e.coords={r:{range:[0,1],name:"Red"},g:{range:[0,1],name:"Green"},b:{range:[0,1],name:"Blue"}}),e.base||(e.base=mt),e.toXYZ_M&&e.fromXYZ_M&&(e.toBase??=t=>{let r=qe(e.toXYZ_M,t);return this.white!==this.base.white&&(r=ot(this.white,this.base.white,r)),r},e.fromBase??=t=>(t=ot(this.base.white,this.white,t),qe(e.fromXYZ_M,t))),e.referred??="display",super(e)}}function xt(e,t){return e=pt(e),!t||e.space.equals(t)?e.coords.slice():(t=dt.get(t)).from(e)}function vt(e,t){e=pt(e);let{space:r,index:i}=dt.resolveCoord(t,e.space);return xt(e,r)[i]}function bt(e,t,r){return e=pt(e),t=dt.get(t),e.coords=t.to(e.space,r),e}function _t(e,t,r){if(e=pt(e),2===arguments.length&&"object"===Xe(arguments[1])){let t=arguments[1];for(let r in t)_t(e,r,t[r])}else{"function"==typeof r&&(r=r(vt(e,t)));let{space:i,index:s}=dt.resolveCoord(t,e.space),n=xt(e,i);n[s]=r,bt(e,i,n)}return e}bt.returns="color",_t.returns="color";var wt=new dt({id:"xyz-d50",name:"XYZ D50",white:"D50",base:mt,fromBase:e=>ot(mt.white,"D50",e),toBase:e=>ot("D50",mt.white,e)});const Ct=216/24389,Dt=24/116,Et=24389/27;let At=nt.D50;var St=new dt({id:"lab",name:"Lab",coords:{l:{refRange:[0,100],name:"Lightness"},a:{refRange:[-125,125]},b:{refRange:[-125,125]}},white:At,base:wt,fromBase(e){let t=e.map(((e,t)=>e/At[t])),r=t.map((e=>e>Ct?Math.cbrt(e):(Et*e+16)/116));return[116*r[1]-16,500*(r[0]-r[1]),200*(r[1]-r[2])]},toBase(e){let t=[];return t[1]=(e[0]+16)/116,t[0]=e[1]/500+t[1],t[2]=t[1]-e[2]/200,[t[0]>Dt?Math.pow(t[0],3):(116*t[0]-16)/Et,e[0]>8?Math.pow((e[0]+16)/116,3):e[0]/Et,t[2]>Dt?Math.pow(t[2],3):(116*t[2]-16)/Et].map(((e,t)=>e*At[t]))},formats:{lab:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Ft(e){return(e%360+360)%360}var Tt=new dt({id:"lch",name:"LCH",coords:{l:{refRange:[0,100],name:"Lightness"},c:{refRange:[0,150],name:"Chroma"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:St,fromBase(e){let t,[r,i,s]=e;return t=Math.abs(i)<.02&&Math.abs(s)<.02?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**2+s**2),Ft(t)]},toBase(e){let[t,r,i]=e;return r<0&&(r=0),isNaN(i)&&(i=0),[t,r*Math.cos(i*Math.PI/180),r*Math.sin(i*Math.PI/180)]},formats:{lch:{coords:["<number> | <percentage>","<number> | <percentage>","<number> | <angle>"]}}});const Mt=25**7,kt=Math.PI,It=180/kt,Bt=kt/180;function Lt(e){const t=e*e;return t*t*t*e}function Pt(e,t,{kL:r=1,kC:i=1,kH:s=1}={}){[e,t]=pt([e,t]);let[n,a,o]=St.from(e),h=Tt.from(St,[n,a,o])[1],[u,l,c]=St.from(t),p=Tt.from(St,[u,l,c])[1];h<0&&(h=0),p<0&&(p=0);let d=Lt((h+p)/2),f=.5*(1-Math.sqrt(d/(d+Mt))),g=(1+f)*a,m=(1+f)*l,y=Math.sqrt(g**2+o**2),x=Math.sqrt(m**2+c**2),v=0===g&&0===o?0:Math.atan2(o,g),b=0===m&&0===c?0:Math.atan2(c,m);v<0&&(v+=2*kt),b<0&&(b+=2*kt),v*=It,b*=It;let _,w=u-n,C=x-y,D=b-v,E=v+b,A=Math.abs(D);y*x==0?_=0:A<=180?_=D:D>180?_=D-360:D<-180?_=D+360:ht.warn("the unthinkable has happened");let S,F=2*Math.sqrt(x*y)*Math.sin(_*Bt/2),T=(n+u)/2,M=(y+x)/2,k=Lt(M);S=y*x==0?E:A<=180?E/2:E<360?(E+360)/2:(E-360)/2;let I=(T-50)**2,B=1+.015*I/Math.sqrt(20+I),L=1+.045*M,P=1;P-=.17*Math.cos((S-30)*Bt),P+=.24*Math.cos(2*S*Bt),P+=.32*Math.cos((3*S+6)*Bt),P-=.2*Math.cos((4*S-63)*Bt);let O=1+.015*M*P,N=30*Math.exp(-1*((S-275)/25)**2),R=2*Math.sqrt(k/(k+Mt)),V=(w/(r*B))**2;return V+=(C/(i*L))**2,V+=(F/(s*O))**2,V+=-1*Math.sin(2*N*Bt)*R*(C/(i*L))*(F/(s*O)),Math.sqrt(V)}const Ot=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],Nt=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],Rt=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],Vt=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]];var Ut=new dt({id:"oklab",name:"Oklab",coords:{l:{refRange:[0,1],name:"Lightness"},a:{refRange:[-.4,.4]},b:{refRange:[-.4,.4]}},white:"D65",base:mt,fromBase(e){let t=qe(Ot,e).map((e=>Math.cbrt(e)));return qe(Rt,t)},toBase(e){let t=qe(Vt,e).map((e=>e**3));return qe(Nt,t)},formats:{oklab:{coords:["<percentage> | <number>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}});function Gt(e,t){[e,t]=pt([e,t]);let[r,i,s]=Ut.from(e),[n,a,o]=Ut.from(t),h=r-n,u=i-a,l=s-o;return Math.sqrt(h**2+u**2+l**2)}function zt(e,t,{epsilon:r=75e-6}={}){e=pt(e),t||(t=e.space),t=dt.get(t);let i=e.coords;return t!==e.space&&(i=t.from(e)),t.inGamut(i,{epsilon:r})}function jt(e){return{space:e.space,coords:e.coords.slice(),alpha:e.alpha}}const $t=Math.PI/180;var Wt=new dt({id:"xyz-abs-d65",cssId:"--xyz-abs-d65",name:"Absolute XYZ D65",coords:{x:{refRange:[0,9504.7],name:"Xa"},y:{refRange:[0,1e4],name:"Ya"},z:{refRange:[0,10888.3],name:"Za"}},base:mt,fromBase:e=>e.map((e=>Math.max(203*e,0))),toBase:e=>e.map((e=>Math.max(e/203,0)))});const qt=1.15,Ht=.66,Xt=2610/16384,Yt=16384/2610,Zt=.8359375,Kt=2413/128,Jt=18.6875,Qt=1.7*2523/32,er=32/(1.7*2523),tr=-.56,rr=16295499532821565e-27,ir=[[.41478972,.579999,.014648],[-.20151,1.120649,.0531008],[-.0166008,.2648,.6684799]],sr=[[1.9242264357876067,-1.0047923125953657,.037651404030618],[.35031676209499907,.7264811939316552,-.06538442294808501],[-.09098281098284752,-.3127282905230739,1.5227665613052603]],nr=[[.5,.5,0],[3.524,-4.066708,.542708],[.199076,1.096799,-1.295875]],ar=[[1,.1386050432715393,.05804731615611886],[.9999999999999999,-.1386050432715393,-.05804731615611886],[.9999999999999998,-.09601924202631895,-.8118918960560388]];var or=new dt({id:"jzazbz",name:"Jzazbz",coords:{jz:{refRange:[0,1],name:"Jz"},az:{refRange:[-.5,.5]},bz:{refRange:[-.5,.5]}},base:Wt,fromBase(e){let[t,r,i]=e,s=qe(ir,[qt*t-(qt-1)*i,Ht*r-(Ht-1)*t,i]).map((function(e){return((Zt+Kt*(e/1e4)**Xt)/(1+Jt*(e/1e4)**Xt))**Qt})),[n,a,o]=qe(nr,s);return[(1+tr)*n/(1+tr*n)-rr,a,o]},toBase(e){let[t,r,i]=e,s=qe(ar,[(t+rr)/(1+tr-tr*(t+rr)),r,i]).map((function(e){return 1e4*((Zt-e**er)/(Jt*e**er-Kt))**Yt})),[n,a,o]=qe(sr,s),h=(n+(qt-1)*o)/qt;return[h,(a+(Ht-1)*h)/Ht,o]},formats:{color:{coords:["<number> | <percentage>","<number> | <percentage>[-1,1]","<number> | <percentage>[-1,1]"]}}}),hr=new dt({id:"jzczhz",name:"JzCzHz",coords:{jz:{refRange:[0,1],name:"Jz"},cz:{refRange:[0,1],name:"Chroma"},hz:{refRange:[0,360],type:"angle",name:"Hue"}},base:or,fromBase(e){let t,[r,i,s]=e;const n=2e-4;return t=Math.abs(i)<n&&Math.abs(s)<n?NaN:180*Math.atan2(s,i)/Math.PI,[r,Math.sqrt(i**2+s**2),Ft(t)]},toBase:e=>[e[0],e[1]*Math.cos(e[2]*Math.PI/180),e[1]*Math.sin(e[2]*Math.PI/180)]});const ur=.8359375,lr=2413/128,cr=18.6875,pr=2610/16384,dr=2523/32,fr=16384/2610,gr=32/2523,mr=[[.3592832590121217,.6976051147779502,-.035891593232029],[-.1920808463704993,1.100476797037432,.0753748658519118],[.0070797844607479,.0748396662186362,.8433265453898765]],yr=[[.5,.5,0],[6610/4096,-13613/4096,7003/4096],[17933/4096,-17390/4096,-543/4096]],xr=[[.9999999999999998,.0086090370379328,.111029625003026],[.9999999999999998,-.0086090370379328,-.1110296250030259],[.9999999999999998,.5600313357106791,-.3206271749873188]],vr=[[2.0701522183894223,-1.3263473389671563,.2066510476294053],[.3647385209748072,.6805660249472273,-.0453045459220347],[-.0497472075358123,-.0492609666966131,1.1880659249923042]];var br=new dt({id:"ictcp",name:"ICTCP",coords:{i:{refRange:[0,1],name:"I"},ct:{refRange:[-.5,.5],name:"CT"},cp:{refRange:[-.5,.5],name:"CP"}},base:Wt,fromBase:e=>function(e){let t=e.map((function(e){return((ur+lr*(e/1e4)**pr)/(1+cr*(e/1e4)**pr))**dr}));return qe(yr,t)}(qe(mr,e)),toBase(e){let t=function(e){let t=qe(xr,e),r=t.map((function(e){return 1e4*(Math.max(e**gr-ur,0)/(lr-cr*e**gr))**fr}));return r}(e);return qe(vr,t)}});const _r=nt.D65,wr=1/.42,Cr=2*Math.PI,Dr=[[.401288,.650173,-.051461],[-.250268,1.204414,.045854],[-.002079,.048952,.953127]],Er=[[1.8620678550872327,-1.0112546305316843,.14918677544445175],[.38752654323613717,.6214474419314753,-.008973985167612518],[-.015841498849333856,-.03412293802851557,1.0499644368778496]],Ar=[[460,451,288],[460,-891,-261],[460,-220,-6300]],Sr={dark:[.8,.525,.8],dim:[.9,.59,.9],average:[1,.69,1]},Fr={h:[20.14,90,164.25,237.53,380.14],e:[.8,.7,1,1.2,.8],H:[0,100,200,300,400]},Tr=180/Math.PI,Mr=Math.PI/180;function kr(e,t){return e.map((e=>{const r=rt(t*Math.abs(e)*.01,.42);return 400*tt(r,e)/(r+27.13)}))}function Ir(e,t,r,i,s){const n={};n.discounting=s,n.refWhite=e,n.surround=i;const a=e.map((e=>100*e));n.la=t,n.yb=r;const o=a[1],h=qe(Dr,a),u=(i=Sr[n.surround])[0];n.c=i[1],n.nc=i[2];const l=(1/(5*n.la+1))**4;n.fl=l*n.la+.1*(1-l)*(1-l)*Math.cbrt(5*n.la),n.flRoot=n.fl**.25,n.n=n.yb/o,n.z=1.48+Math.sqrt(n.n),n.nbb=.725*n.n**-.2,n.ncb=n.nbb;const c=Math.max(Math.min(u*(1-1/3.6*Math.exp((-n.la-42)/92)),1),0);n.dRgb=h.map((e=>Qe(1,o/e,c))),n.dRgbInv=n.dRgb.map((e=>1/e));const p=h.map(((e,t)=>e*n.dRgb[t])),d=kr(p,n.fl);return n.aW=n.nbb*(2*d[0]+d[1]+.05*d[2]),n}const Br=Ir(_r,64/Math.PI*.2,20,"average",!1);function Lr(e,t){if(!(void 0!==e.J^void 0!==e.Q))throw new Error("Conversion requires one and only one: 'J' or 'Q'");if(!(void 0!==e.C^void 0!==e.M^void 0!==e.s))throw new Error("Conversion requires one and only one: 'C', 'M' or 's'");if(!(void 0!==e.h^void 0!==e.H))throw new Error("Conversion requires one and only one: 'h' or 'H'");if(0===e.J||0===e.Q)return[0,0,0];let r=0;r=void 0!==e.h?Ft(e.h)*Mr:function(e){let t=(e%400+400)%400;const r=Math.floor(.01*t);t%=100;const[i,s]=Fr.h.slice(r,r+2),[n,a]=Fr.e.slice(r,r+2);return Ft((t*(a*i-n*s)-100*i*a)/(t*(a-n)-100*a))}(e.H)*Mr;const i=Math.cos(r),s=Math.sin(r);let n=0;void 0!==e.J?n=.1*rt(e.J,.5):void 0!==e.Q&&(n=.25*t.c*e.Q/((t.aW+4)*t.flRoot));let a=0;void 0!==e.C?a=e.C/n:void 0!==e.M?a=e.M/t.flRoot/n:void 0!==e.s&&(a=4e-4*e.s**2*(t.aW+4)/t.c);const o=rt(a*Math.pow(1.64-Math.pow(.29,t.n),-.73),10/9),h=.25*(Math.cos(r+2)+3.8),u=t.aW*rt(n,2/t.c/t.z),l=5e4/13*t.nc*t.ncb*h,c=u/t.nbb,p=23*(c+.305)*it(o,23*l+o*(11*i+108*s)),d=function(e,t){const r=100/t*2588.068098016295;return e.map((e=>{const t=Math.abs(e);return tt(r*rt(t/(400-t),wr),e)}))}(qe(Ar,[c,p*i,p*s]).map((e=>1*e/1403)),t.fl);return qe(Er,d.map(((e,r)=>e*t.dRgbInv[r]))).map((e=>e/100))}function Pr(e,t){const r=e.map((e=>100*e)),i=kr(qe(Dr,r).map(((e,r)=>e*t.dRgb[r])),t.fl),s=i[0]+(-12*i[1]+i[2])/11,n=(i[0]+i[1]-2*i[2])/9,a=(Math.atan2(n,s)%Cr+Cr)%Cr,o=.25*(Math.cos(a+2)+3.8),h=rt(5e4/13*t.nc*t.ncb*it(o*Math.sqrt(s**2+n**2),i[0]+i[1]+1.05*i[2]+.305),.9)*Math.pow(1.64-Math.pow(.29,t.n),.73),u=rt(t.nbb*(2*i[0]+i[1]+.05*i[2])/t.aW,.5*t.c*t.z),l=100*rt(u,2),c=4/t.c*u*(t.aW+4)*t.flRoot,p=h*u,d=p*t.flRoot,f=Ft(a*Tr),g=function(e){let t=Ft(e);t<=Fr.h[0]&&(t+=360);const r=function(e,t,r=0,i=e.length){for(;r<i;){const s=r+i>>1;e[s]<t?r=s+1:i=s}return r}(Fr.h,t)-1,[i,s]=Fr.h.slice(r,r+2),[n,a]=Fr.e.slice(r,r+2),o=(t-i)/n;return Fr.H[r]+100*o/(o+(s-t)/a)}(f);return{J:l,C:p,h:f,s:50*rt(t.c*h/(t.aW+4),.5),Q:c,M:d,H:g}}new dt({id:"cam16-jmh",cssId:"--cam16-jmh",name:"CAM16-JMh",coords:{j:{refRange:[0,100],name:"J"},m:{refRange:[0,105],name:"Colorfulness"},h:{refRange:[0,360],type:"angle",name:"Hue"}},base:mt,fromBase(e){const t=Pr(e,Br);return[t.J,t.M,t.h]},toBase:e=>Lr({J:e[0],M:e[1],h:e[2]},Br)});const Or=216/24389,Nr=24389/27;function Rr(e){return e>8?Math.pow((e+16)/116,3):e/Nr}function Vr(e,t){const r=116*((i=e[1])>Or?Math.cbrt(i):(Nr*i+16)/116)-16;var i;if(0===r)return[0,0,0];const s=Pr(e,Ur);return[Ft(s.h),s.C,r]}const Ur=Ir(nt.D65,200/Math.PI*Rr(50),100*Rr(50),"average",!1);var Gr=new dt({id:"hct",name:"HCT",coords:{h:{refRange:[0,360],type:"angle",name:"Hue"},c:{refRange:[0,145],name:"Colorfulness"},t:{refRange:[0,100],name:"Tone"}},base:mt,fromBase:e=>Vr(e),toBase:e=>function(e,t){let[r,i,s]=e,n=[],a=0;if(0===s)return[0,0,0];let o=Rr(s);a=s>0?.00379058511492914*s**2+.608983189401032*s+.9155088574762233:9514440756550361e-21*s**2+.08693057439788597*s-21.928975842194614;let h=0,u=1/0;for(;h<=15;){n=Lr({J:a,C:i,h:r},t);const e=Math.abs(n[1]-o);if(e<u){if(e<=2e-12)return n;u=e}a-=(n[1]-o)*a/(2*n[1]),h+=1}return Lr({J:a,C:i,h:r},t)}(e,Ur),formats:{color:{id:"--hct",coords:["<number> | <angle>","<percentage> | <number>","<percentage> | <number>"]}}});const zr=Math.PI/180,jr=[1,.007,.0228];function $r(e){e[1]<0&&(e=Gr.fromBase(Gr.toBase(e)));const t=Math.log(Math.max(1+jr[2]*e[1]*Ur.flRoot,1))/jr[2],r=e[0]*zr,i=t*Math.cos(r),s=t*Math.sin(r);return[e[2],i,s]}var Wr={deltaE76:function(e,t){return function(e,t,r="lab"){let i=(r=dt.get(r)).from(e),s=r.from(t);return Math.sqrt(i.reduce(((e,t,r)=>{let i=s[r];return isNaN(t)||isNaN(i)?e:e+(i-t)**2}),0))}(e,t,"lab")},deltaECMC:function(e,t,{l:r=2,c:i=1}={}){[e,t]=pt([e,t]);let[s,n,a]=St.from(e),[,o,h]=Tt.from(St,[s,n,a]),[u,l,c]=St.from(t),p=Tt.from(St,[u,l,c])[1];o<0&&(o=0),p<0&&(p=0);let d=s-u,f=o-p,g=(n-l)**2+(a-c)**2-f**2,m=.511;s>=16&&(m=.040975*s/(1+.01765*s));let y,x=.0638*o/(1+.0131*o)+.638;Number.isNaN(h)&&(h=0),y=h>=164&&h<=345?.56+Math.abs(.2*Math.cos((h+168)*$t)):.36+Math.abs(.4*Math.cos((h+35)*$t));let v=Math.pow(o,4),b=Math.sqrt(v/(v+1900)),_=(d/(r*m))**2;return _+=(f/(i*x))**2,_+=g/(x*(b*y+1-b))**2,Math.sqrt(_)},deltaE2000:Pt,deltaEJz:function(e,t){[e,t]=pt([e,t]);let[r,i,s]=hr.from(e),[n,a,o]=hr.from(t),h=r-n,u=i-a;Number.isNaN(s)&&Number.isNaN(o)?(s=0,o=0):Number.isNaN(s)?s=o:Number.isNaN(o)&&(o=s);let l=s-o,c=2*Math.sqrt(i*a)*Math.sin(l/2*(Math.PI/180));return Math.sqrt(h**2+u**2+c**2)},deltaEITP:function(e,t){[e,t]=pt([e,t]);let[r,i,s]=br.from(e),[n,a,o]=br.from(t);return 720*Math.sqrt((r-n)**2+.25*(i-a)**2+(s-o)**2)},deltaEOK:Gt,deltaEHCT:function(e,t){[e,t]=pt([e,t]);let[r,i,s]=$r(Gr.from(e)),[n,a,o]=$r(Gr.from(t));return Math.sqrt((r-n)**2+(i-a)**2+(s-o)**2)}};const qr={hct:{method:"hct.c",jnd:2,deltaEMethod:"hct",blackWhiteClamp:{}},"hct-tonal":{method:"hct.c",jnd:0,deltaEMethod:"hct",blackWhiteClamp:{channel:"hct.t",min:0,max:100}}};function Hr(e,{method:t=ht.gamut_mapping,space:r,deltaEMethod:i="",jnd:s=2,blackWhiteClamp:n={}}={}){if(e=pt(e),He(arguments[1])?r=arguments[1]:r||(r=e.space),zt(e,r=dt.get(r),{epsilon:0}))return e;let a;if("css"===t)a=function(e,{space:t}={}){const r=.02,i=1e-4;e=pt(e),t||(t=e.space);t=dt.get(t);const s=dt.get("oklch");if(t.isUnbounded)return Yr(e,t);const n=Yr(e,s);let a=n.coords[0];if(a>=1){const r=Yr(Xr.WHITE,t);return r.alpha=e.alpha,Yr(r,t)}if(a<=0){const r=Yr(Xr.BLACK,t);return r.alpha=e.alpha,Yr(r,t)}if(zt(n,t,{epsilon:0}))return Yr(n,t);function o(e){const r=Yr(e,t),i=Object.values(t.coords);return r.coords=r.coords.map(((e,t)=>{if("range"in i[t]){const[r,s]=i[t].range;return function(e,t,r){return Math.max(Math.min(r,t),e)}(r,e,s)}return e})),r}let h=0,u=n.coords[1],l=!0,c=jt(n),p=o(c),d=Gt(p,c);if(d<r)return p;for(;u-h>i;){const e=(h+u)/2;if(c.coords[1]=e,l&&zt(c,t,{epsilon:0}))h=e;else if(p=o(c),d=Gt(p,c),d<r){if(r-d<i)break;l=!1,h=e}else u=e}return p}(e,{space:r});else{if("clip"===t||zt(e,r))a=Yr(e,r);else{Object.prototype.hasOwnProperty.call(qr,t)&&({method:t,jnd:s,deltaEMethod:i,blackWhiteClamp:n}=qr[t]);let o=Pt;if(""!==i)for(let e in Wr)if("deltae"+i.toLowerCase()===e.toLowerCase()){o=Wr[e];break}let h=Hr(Yr(e,r),{method:"clip",space:r});if(o(e,h)>s){if(3===Object.keys(n).length){let t=dt.resolveCoord(n.channel),r=vt(Yr(e,t.space),t.id);if(Ze(r)&&(r=0),r>=n.max)return Yr({space:"xyz-d65",coords:nt.D65},e.space);if(r<=n.min)return Yr({space:"xyz-d65",coords:[0,0,0]},e.space)}let i=dt.resolveCoord(t),h=i.space,u=i.id,l=Yr(e,h);l.coords.forEach(((e,t)=>{Ze(e)&&(l.coords[t]=0)}));let c=(i.range||i.refRange)[0],p=function(e){const t=e?Math.floor(Math.log10(Math.abs(e))):0;return Math.max(parseFloat("1e"+(t-2)),1e-6)}(s),d=c,f=vt(l,u);for(;f-d>p;){let e=jt(l);e=Hr(e,{space:r,method:"clip"}),o(l,e)-s<p?d=vt(l,u):f=vt(l,u),_t(l,u,(d+f)/2)}a=Yr(l,r)}else a=h}if("clip"===t||!zt(a,r,{epsilon:0})){let e=Object.values(r.coords).map((e=>e.range||[]));a.coords=a.coords.map(((t,r)=>{let[i,s]=e[r];return void 0!==i&&(t=Math.max(i,t)),void 0!==s&&(t=Math.min(t,s)),t}))}}return r!==e.space&&(a=Yr(a,e.space)),e.coords=a.coords,e}Hr.returns="color";const Xr={WHITE:{space:Ut,coords:[1,0,0]},BLACK:{space:Ut,coords:[0,0,0]}};function Yr(e,t,{inGamut:r}={}){e=pt(e);let i=(t=dt.get(t)).from(e),s={space:t,coords:i,alpha:e.alpha};return r&&(s=Hr(s,!0===r?void 0:r)),s}Yr.returns="color";var Zr=new yt({id:"p3-linear",cssId:"--display-p3-linear",name:"Linear P3",white:"D65",toXYZ_M:[[.4865709486482162,.26566769316909306,.1982172852343625],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],fromXYZ_M:[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]]});var Kr=new yt({id:"srgb-linear",name:"Linear sRGB",white:"D65",toXYZ_M:[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],fromXYZ_M:[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]]}),Jr={aliceblue:[240/255,248/255,1],antiquewhite:[250/255,235/255,215/255],aqua:[0,1,1],aquamarine:[127/255,1,212/255],azure:[240/255,1,1],beige:[245/255,245/255,220/255],bisque:[1,228/255,196/255],black:[0,0,0],blanchedalmond:[1,235/255,205/255],blue:[0,0,1],blueviolet:[138/255,43/255,226/255],brown:[165/255,42/255,42/255],burlywood:[222/255,184/255,135/255],cadetblue:[95/255,158/255,160/255],chartreuse:[127/255,1,0],chocolate:[210/255,105/255,30/255],coral:[1,127/255,80/255],cornflowerblue:[100/255,149/255,237/255],cornsilk:[1,248/255,220/255],crimson:[220/255,20/255,60/255],cyan:[0,1,1],darkblue:[0,0,139/255],darkcyan:[0,139/255,139/255],darkgoldenrod:[184/255,134/255,11/255],darkgray:[169/255,169/255,169/255],darkgreen:[0,100/255,0],darkgrey:[169/255,169/255,169/255],darkkhaki:[189/255,183/255,107/255],darkmagenta:[139/255,0,139/255],darkolivegreen:[85/255,107/255,47/255],darkorange:[1,140/255,0],darkorchid:[.6,50/255,.8],darkred:[139/255,0,0],darksalmon:[233/255,150/255,122/255],darkseagreen:[143/255,188/255,143/255],darkslateblue:[72/255,61/255,139/255],darkslategray:[47/255,79/255,79/255],darkslategrey:[47/255,79/255,79/255],darkturquoise:[0,206/255,209/255],darkviolet:[148/255,0,211/255],deeppink:[1,20/255,147/255],deepskyblue:[0,191/255,1],dimgray:[105/255,105/255,105/255],dimgrey:[105/255,105/255,105/255],dodgerblue:[30/255,144/255,1],firebrick:[178/255,34/255,34/255],floralwhite:[1,250/255,240/255],forestgreen:[34/255,139/255,34/255],fuchsia:[1,0,1],gainsboro:[220/255,220/255,220/255],ghostwhite:[248/255,248/255,1],gold:[1,215/255,0],goldenrod:[218/255,165/255,32/255],gray:[128/255,128/255,128/255],green:[0,128/255,0],greenyellow:[173/255,1,47/255],grey:[128/255,128/255,128/255],honeydew:[240/255,1,240/255],hotpink:[1,105/255,180/255],indianred:[205/255,92/255,92/255],indigo:[75/255,0,130/255],ivory:[1,1,240/255],khaki:[240/255,230/255,140/255],lavender:[230/255,230/255,250/255],lavenderblush:[1,240/255,245/255],lawngreen:[124/255,252/255,0],lemonchiffon:[1,250/255,205/255],lightblue:[173/255,216/255,230/255],lightcoral:[240/255,128/255,128/255],lightcyan:[224/255,1,1],lightgoldenrodyellow:[250/255,250/255,210/255],lightgray:[211/255,211/255,211/255],lightgreen:[144/255,238/255,144/255],lightgrey:[211/255,211/255,211/255],lightpink:[1,182/255,193/255],lightsalmon:[1,160/255,122/255],lightseagreen:[32/255,178/255,170/255],lightskyblue:[135/255,206/255,250/255],lightslategray:[119/255,136/255,.6],lightslategrey:[119/255,136/255,.6],lightsteelblue:[176/255,196/255,222/255],lightyellow:[1,1,224/255],lime:[0,1,0],limegreen:[50/255,205/255,50/255],linen:[250/255,240/255,230/255],magenta:[1,0,1],maroon:[128/255,0,0],mediumaquamarine:[.4,205/255,170/255],mediumblue:[0,0,205/255],mediumorchid:[186/255,85/255,211/255],mediumpurple:[147/255,112/255,219/255],mediumseagreen:[60/255,179/255,113/255],mediumslateblue:[123/255,104/255,238/255],mediumspringgreen:[0,250/255,154/255],mediumturquoise:[72/255,209/255,.8],mediumvioletred:[199/255,21/255,133/255],midnightblue:[25/255,25/255,112/255],mintcream:[245/255,1,250/255],mistyrose:[1,228/255,225/255],moccasin:[1,228/255,181/255],navajowhite:[1,222/255,173/255],navy:[0,0,128/255],oldlace:[253/255,245/255,230/255],olive:[128/255,128/255,0],olivedrab:[107/255,142/255,35/255],orange:[1,165/255,0],orangered:[1,69/255,0],orchid:[218/255,112/255,214/255],palegoldenrod:[238/255,232/255,170/255],palegreen:[152/255,251/255,152/255],paleturquoise:[175/255,238/255,238/255],palevioletred:[219/255,112/255,147/255],papayawhip:[1,239/255,213/255],peachpuff:[1,218/255,185/255],peru:[205/255,133/255,63/255],pink:[1,192/255,203/255],plum:[221/255,160/255,221/255],powderblue:[176/255,224/255,230/255],purple:[128/25