From 180a3b1a83a22af093d72009c5eb3e4e8a331633 Mon Sep 17 00:00:00 2001 From: balladaniel <96133731+balladaniel@users.noreply.github.com> Date: Wed, 11 Sep 2024 14:02:11 +0200 Subject: [PATCH] bump chroma.js to 3.1.1, tested --- README.md | 2 +- lib/chroma.min.cjs | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b281ea2..5418b60 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ All features in the examples listed here have binded tooltips (a default Leaflet - [Leaflet](https://github.com/Leaflet/Leaflet) (tested with v1.9.4) ### External dependencies - [simple-statistics.js](https://github.com/simple-statistics/simple-statistics) (tested with v7.8.0) -- [chroma.js](https://github.com/gka/chroma.js) (tested with v2.6.0) +- [chroma.js](https://github.com/gka/chroma.js) (tested with v3.1.1) - [leaflet-hatchclass](https://github.com/samanbey/leaflet-hatchclass) (only if you intend to use hatch pattern fills for polygons) Include dependencies plus `leaflet-dataclassification.css` and `leaflet-dataclassification.js` in your code. You can also link them through GitHub Pages: diff --git a/lib/chroma.min.cjs b/lib/chroma.min.cjs index c86b7a2..73275da 100644 --- a/lib/chroma.min.cjs +++ b/lib/chroma.min.cjs @@ -55,4 +55,18 @@ * @preserve */ -!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r="undefined"!=typeof globalThis?globalThis:r||self).chroma=e()}(this,(function(){"use strict";function r(r,e,t){return void 0===e&&(e=0),void 0===t&&(t=1),l(h(e,r),t)}function e(e){e._clipped=!1,e._unclipped=e.slice(0);for(var t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=r(e[t],0,255)):3===t&&(e[t]=r(e[t],0,1));return e}for(var t={},n=0,a=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];n=3?Array.prototype.slice.call(r):"object"==o(r[0])&&e?e.split("").filter((function(e){return void 0!==r[0][e]})).map((function(e){return r[0][e]})):r[0]}function c(r){if(r.length<2)return null;var e=r.length-1;return"string"==o(r[e])?r[e].toLowerCase():null}var i=Math.PI,l=Math.min,h=Math.max,d=2*i,s=i/3,b=i/180,g=180/i,p={format:{},autodetect:[]},v=function(){for(var r=[],t=arguments.length;t--;)r[t]=arguments[t];var n=this;if("object"===o(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];var a=c(r),f=!1;if(!a){f=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(r,e){return e.p-r.p})),p.sorted=!0);for(var u=0,i=p.autodetect;u4?r[4]:1;return 1===f?[0,0,0,o]:[t>=1?0:255*(1-t)*(1-f),n>=1?0:255*(1-n)*(1-f),a>=1?0:255*(1-a)*(1-f),o]},p.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"cmyk"))&&4===r.length)return"cmyk"}});var w=function(r){return Math.round(100*r)/100},k=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n,a=(r=u(r,"rgba"))[0],f=r[1],o=r[2],c=l(a/=255,f/=255,o/=255),i=h(a,f,o),d=(i+c)/2;return i===c?(t=0,n=Number.NaN):t=d<.5?(i-c)/(i+c):(i-c)/(2-i-c),a==i?n=(f-o)/(i-c):f==i?n=2+(o-a)/(i-c):o==i&&(n=4+(a-f)/(i-c)),(n*=60)<0&&(n+=360),r.length>3&&void 0!==r[3]?[n,t,d,r[3]]:[n,t,d]},M=Math.round,N=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgba"),n=c(r)||"rgb";return"hsl"==n.substr(0,3)?function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"hsla"),n=c(r)||"lsa";return t[0]=w(t[0]||0),t[1]=w(100*t[1])+"%",t[2]=w(100*t[2])+"%","hsla"===n||t.length>3&&t[3]<1?(t[3]=t.length>3?t[3]:1,n="hsla"):t.length=3,n+"("+t.join(",")+")"}(k(t),n):(t[0]=M(t[0]),t[1]=M(t[1]),t[2]=M(t[2]),("rgba"===n||t.length>3&&t[3]<1)&&(t[3]=t.length>3?t[3]:1,n="rgba"),n+"("+t.slice(0,"rgb"===n?3:4).join(",")+")")},_=Math.round,x=function(){for(var r,e=[],t=arguments.length;t--;)e[t]=arguments[t];var n,a,f,o=(e=u(e,"hsl"))[0],c=e[1],i=e[2];if(0===c)n=a=f=255*i;else{var l=[0,0,0],h=[0,0,0],d=i<.5?i*(1+c):i+c-i*c,s=2*i-d,b=o/360;l[0]=b+1/3,l[1]=b,l[2]=b-1/3;for(var g=0;g<3;g++)l[g]<0&&(l[g]+=1),l[g]>1&&(l[g]-=1),6*l[g]<1?h[g]=s+6*(d-s)*l[g]:2*l[g]<1?h[g]=d:3*l[g]<2?h[g]=s+(d-s)*(2/3-l[g])*6:h[g]=s;n=(r=[_(255*h[0]),_(255*h[1]),_(255*h[2])])[0],a=r[1],f=r[2]}return e.length>3?[n,a,f,e[3]]:[n,a,f,1]},A=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,F=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,E=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,j=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,q=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,L=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,O=Math.round,P=function(r){var e;if(r=r.toLowerCase().trim(),p.format.named)try{return p.format.named(r)}catch(r){}if(e=r.match(A)){for(var t=e.slice(1,4),n=0;n<3;n++)t[n]=+t[n];return t[3]=1,t}if(e=r.match(F)){for(var a=e.slice(1,5),f=0;f<4;f++)a[f]=+a[f];return a}if(e=r.match(E)){for(var o=e.slice(1,4),u=0;u<3;u++)o[u]=O(2.55*o[u]);return o[3]=1,o}if(e=r.match(j)){for(var c=e.slice(1,5),i=0;i<3;i++)c[i]=O(2.55*c[i]);return c[3]=+c[3],c}if(e=r.match(q)){var l=e.slice(1,4);l[1]*=.01,l[2]*=.01;var h=x(l);return h[3]=1,h}if(e=r.match(L)){var d=e.slice(1,4);d[1]*=.01,d[2]*=.01;var s=x(d);return s[3]=+e[4],s}};P.test=function(r){return A.test(r)||F.test(r)||E.test(r)||j.test(r)||q.test(r)||L.test(r)},v.prototype.css=function(r){return N(this._rgb,r)},m.css=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["css"])))},p.format.css=P,p.autodetect.push({p:5,test:function(r){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];if(!e.length&&"string"===o(r)&&P.test(r))return"css"}}),p.format.gl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t},m.gl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["gl"])))},v.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var G=Math.floor;v.prototype.hcg=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n=u(r,"rgb"),a=n[0],f=n[1],o=n[2],c=l(a,f,o),i=h(a,f,o),d=i-c,s=100*d/255,b=c/(255-d)*100;return 0===d?t=Number.NaN:(a===i&&(t=(f-o)/d),f===i&&(t=2+(o-a)/d),o===i&&(t=4+(a-f)/d),(t*=60)<0&&(t+=360)),[t,s,b]}(this._rgb)},m.hcg=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["hcg"])))},p.format.hcg=function(){for(var r,e,t,n,a,f,o=[],c=arguments.length;c--;)o[c]=arguments[c];var i,l,h,d=(o=u(o,"hcg"))[0],s=o[1],b=o[2];b*=255;var g=255*s;if(0===s)i=l=h=b;else{360===d&&(d=0),d>360&&(d-=360),d<0&&(d+=360);var p=G(d/=60),v=d-p,m=b*(1-s),y=m+g*(1-v),w=m+g*v,k=m+g;switch(p){case 0:i=(r=[k,w,m])[0],l=r[1],h=r[2];break;case 1:i=(e=[y,k,m])[0],l=e[1],h=e[2];break;case 2:i=(t=[m,k,w])[0],l=t[1],h=t[2];break;case 3:i=(n=[m,y,k])[0],l=n[1],h=n[2];break;case 4:i=(a=[w,m,k])[0],l=a[1],h=a[2];break;case 5:i=(f=[k,m,y])[0],l=f[1],h=f[2]}}return[i,l,h,o.length>3?o[3]:1]},p.autodetect.push({p:1,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"hcg"))&&3===r.length)return"hcg"}});var B=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,C=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,R=function(r){if(r.match(B)){4!==r.length&&7!==r.length||(r=r.substr(1)),3===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]);var e=parseInt(r,16);return[e>>16,e>>8&255,255&e,1]}if(r.match(C)){5!==r.length&&9!==r.length||(r=r.substr(1)),4===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]+r[3]+r[3]);var t=parseInt(r,16);return[t>>24&255,t>>16&255,t>>8&255,Math.round((255&t)/255*100)/100]}throw new Error("unknown hex color: "+r)},S=Math.round,$=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgba"),n=t[0],a=t[1],f=t[2],o=t[3],i=c(r)||"auto";void 0===o&&(o=1),"auto"===i&&(i=o<1?"rgba":"rgb");var l="000000"+((n=S(n))<<16|(a=S(a))<<8|(f=S(f))).toString(16);l=l.substr(l.length-6);var h="0"+S(255*o).toString(16);switch(h=h.substr(h.length-2),i.toLowerCase()){case"rgba":return"#"+l+h;case"argb":return"#"+h+l;default:return"#"+l}};v.prototype.hex=function(r){return $(this._rgb,r)},m.hex=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["hex"])))},p.format.hex=R,p.autodetect.push({p:4,test:function(r){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];if(!e.length&&"string"===o(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var Y=Math.cos,z=Math.min,I=Math.sqrt,U=Math.acos;v.prototype.hsi=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n=u(r,"rgb"),a=n[0],f=n[1],o=n[2],c=z(a/=255,f/=255,o/=255),i=(a+f+o)/3,l=i>0?1-c/i:0;return 0===l?t=NaN:(t=(a-f+(a-o))/2,t/=I((a-f)*(a-f)+(a-o)*(f-o)),t=U(t),o>f&&(t=d-t),t/=d),[360*t,l,i]}(this._rgb)},m.hsi=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["hsi"])))},p.format.hsi=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n,a,f,o=(e=u(e,"hsi"))[0],c=e[1],i=e[2];return isNaN(o)&&(o=0),isNaN(c)&&(c=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?a=1-((f=(1-c)/3)+(n=(1+c*Y(d*o)/Y(s-d*o))/3)):o<2/3?f=1-((n=(1-c)/3)+(a=(1+c*Y(d*(o-=1/3))/Y(s-d*o))/3)):n=1-((a=(1-c)/3)+(f=(1+c*Y(d*(o-=2/3))/Y(s-d*o))/3)),[255*(n=r(i*n*3)),255*(a=r(i*a*3)),255*(f=r(i*f*3)),e.length>3?e[3]:1]},p.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"hsi"))&&3===r.length)return"hsi"}}),v.prototype.hsl=function(){return k(this._rgb)},m.hsl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["hsl"])))},p.format.hsl=x,p.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"hsl"))&&3===r.length)return"hsl"}});var V=Math.floor,X=Math.min,D=Math.max;v.prototype.hsv=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n,a,f=(r=u(r,"rgb"))[0],o=r[1],c=r[2],i=X(f,o,c),l=D(f,o,c),h=l-i;return a=l/255,0===l?(t=Number.NaN,n=0):(n=h/l,f===l&&(t=(o-c)/h),o===l&&(t=2+(c-f)/h),c===l&&(t=4+(f-o)/h),(t*=60)<0&&(t+=360)),[t,n,a]}(this._rgb)},m.hsv=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["hsv"])))},p.format.hsv=function(){for(var r,e,t,n,a,f,o=[],c=arguments.length;c--;)o[c]=arguments[c];var i,l,h,d=(o=u(o,"hsv"))[0],s=o[1],b=o[2];if(b*=255,0===s)i=l=h=b;else{360===d&&(d=0),d>360&&(d-=360),d<0&&(d+=360);var g=V(d/=60),p=d-g,v=b*(1-s),m=b*(1-s*p),y=b*(1-s*(1-p));switch(g){case 0:i=(r=[b,y,v])[0],l=r[1],h=r[2];break;case 1:i=(e=[m,b,v])[0],l=e[1],h=e[2];break;case 2:i=(t=[v,b,y])[0],l=t[1],h=t[2];break;case 3:i=(n=[v,m,b])[0],l=n[1],h=n[2];break;case 4:i=(a=[y,v,b])[0],l=a[1],h=a[2];break;case 5:i=(f=[b,v,m])[0],l=f[1],h=f[2]}}return[i,l,h,o.length>3?o[3]:1]},p.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"hsv"))&&3===r.length)return"hsv"}});var T=18,H=.95047,J=1,K=1.08883,Q=.137931034,W=.206896552,Z=.12841855,rr=.008856452,er=Math.pow,tr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n,a,f=(r=u(r,"lab"))[0],o=r[1],c=r[2];return n=(f+16)/116,t=isNaN(o)?n:n+o/500,a=isNaN(c)?n:n-c/200,n=J*ar(n),t=H*ar(t),a=K*ar(a),[nr(3.2404542*t-1.5371385*n-.4985314*a),nr(-.969266*t+1.8760108*n+.041556*a),nr(.0556434*t-.2040259*n+1.0572252*a),r.length>3?r[3]:1]},nr=function(r){return 255*(r<=.00304?12.92*r:1.055*er(r,1/2.4)-.055)},ar=function(r){return r>W?r*r*r:Z*(r-Q)},fr=Math.pow,or=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgb"),n=t[0],a=t[1],f=t[2],o=ir(n,a,f),c=o[0],i=o[1],l=116*i-16;return[l<0?0:l,500*(c-i),200*(i-o[2])]},ur=function(r){return(r/=255)<=.04045?r/12.92:fr((r+.055)/1.055,2.4)},cr=function(r){return r>rr?fr(r,1/3):r/Z+Q},ir=function(r,e,t){return r=ur(r),e=ur(e),t=ur(t),[cr((.4124564*r+.3575761*e+.1804375*t)/H),cr((.2126729*r+.7151522*e+.072175*t)/J),cr((.0193339*r+.119192*e+.9503041*t)/K)]};v.prototype.lab=function(){return or(this._rgb)},m.lab=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["lab"])))},p.format.lab=tr,p.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"lab"))&&3===r.length)return"lab"}});var lr=Math.sin,hr=Math.cos,dr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"lch"),n=t[0],a=t[1],f=t[2];return isNaN(f)&&(f=0),[n,hr(f*=b)*a,lr(f)*a]},sr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=(r=u(r,"lch"))[0],n=r[1],a=r[2],f=dr(t,n,a),o=f[0],c=f[1],i=f[2],l=tr(o,c,i);return[l[0],l[1],l[2],r.length>3?r[3]:1]},br=Math.sqrt,gr=Math.atan2,pr=Math.round,vr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"lab"),n=t[0],a=t[1],f=t[2],o=br(a*a+f*f),c=(gr(f,a)*g+360)%360;return 0===pr(1e4*o)&&(c=Number.NaN),[n,o,c]},mr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgb"),n=t[0],a=t[1],f=t[2],o=or(n,a,f),c=o[0],i=o[1],l=o[2];return vr(c,i,l)};v.prototype.lch=function(){return mr(this._rgb)},v.prototype.hcl=function(){return mr(this._rgb).reverse()},m.lch=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["lch"])))},m.hcl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["hcl"])))},p.format.lch=sr,p.format.hcl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"hcl").reverse();return sr.apply(void 0,t)},["lch","hcl"].forEach((function(r){return p.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if("array"===o(e=u(e,r))&&3===e.length)return r}})}));var yr={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",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",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",maroon2:"#7f0000",maroon3:"#b03060",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",purple2:"#7f007f",purple3:"#a020f0",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"};v.prototype.name=function(){for(var r=$(this._rgb,"rgb"),e=0,t=Object.keys(yr);e0;)e[t]=arguments[t+1];if(!e.length&&"string"===o(r)&&yr[r.toLowerCase()])return"named"}});v.prototype.num=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgb");return(t[0]<<16)+(t[1]<<8)+t[2]}(this._rgb)},m.num=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["num"])))},p.format.num=function(r){if("number"==o(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},p.autodetect.push({p:5,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(1===r.length&&"number"===o(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var wr=Math.round;v.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(wr)},v.prototype.rgba=function(r){return void 0===r&&(r=!0),this._rgb.slice(0,4).map((function(e,t){return t<3?!1===r?e:wr(e):e}))},m.rgb=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["rgb"])))},p.format.rgb=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgba");return void 0===t[3]&&(t[3]=1),t},p.autodetect.push({p:3,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"rgba"))&&(3===r.length||4===r.length&&"number"==o(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var kr=Math.log,Mr=function(r){var e,t,n,a=r/100;return a<66?(e=255,t=a<6?0:-155.25485562709179-.44596950469579133*(t=a-2)+104.49216199393888*kr(t),n=a<20?0:.8274096064007395*(n=a-10)-254.76935184120902+115.67994401066147*kr(n)):(e=351.97690566805693+.114206453784165*(e=a-55)-40.25366309332127*kr(e),t=325.4494125711974+.07943456536662342*(t=a-50)-28.0852963507957*kr(t),n=255),[e,t,n,1]},Nr=Math.round;v.prototype.temp=v.prototype.kelvin=v.prototype.temperature=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];for(var t,n=u(r,"rgb"),a=n[0],f=n[2],o=1e3,c=4e4;c-o>.4;){var i=Mr(t=.5*(c+o));i[2]/i[0]>=f/a?c=t:o=t}return Nr(t)}(this._rgb)},m.temp=m.kelvin=m.temperature=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["temp"])))},p.format.temp=p.format.kelvin=p.format.temperature=Mr;var _r=Math.pow,xr=Math.sign,Ar=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=(r=u(r,"lab"))[0],n=r[1],a=r[2],f=_r(t+.3963377774*n+.2158037573*a,3),o=_r(t-.1055613458*n-.0638541728*a,3),c=_r(t-.0894841775*n-1.291485548*a,3);return[255*Fr(4.0767416621*f-3.3077115913*o+.2309699292*c),255*Fr(-1.2684380046*f+2.6097574011*o-.3413193965*c),255*Fr(-.0041960863*f-.7034186147*o+1.707614701*c),r.length>3?r[3]:1]};function Fr(r){var e=Math.abs(r);return e>.0031308?(xr(r)||1)*(1.055*_r(e,1/2.4)-.055):12.92*r}var Er=Math.cbrt,jr=Math.pow,qr=Math.sign,Lr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgb"),n=t[0],a=t[1],f=t[2],o=[Or(n/255),Or(a/255),Or(f/255)],c=o[0],i=o[1],l=o[2],h=Er(.4122214708*c+.5363325363*i+.0514459929*l),d=Er(.2119034982*c+.6806995451*i+.1073969566*l),s=Er(.0883024619*c+.2817188376*i+.6299787005*l);return[.2104542553*h+.793617785*d-.0040720468*s,1.9779984951*h-2.428592205*d+.4505937099*s,.0259040371*h+.7827717662*d-.808675766*s]};function Or(r){var e=Math.abs(r);return e<.04045?r/12.92:(qr(r)||1)*jr((e+.055)/1.055,2.4)}v.prototype.oklab=function(){return Lr(this._rgb)},m.oklab=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["oklab"])))},p.format.oklab=Ar,p.autodetect.push({p:3,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"oklab"))&&3===r.length)return"oklab"}});v.prototype.oklch=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=u(r,"rgb"),n=t[0],a=t[1],f=t[2],o=Lr(n,a,f),c=o[0],i=o[1],l=o[2];return vr(c,i,l)}(this._rgb)},m.oklch=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(v,[null].concat(r,["oklch"])))},p.format.oklch=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=(r=u(r,"lch"))[0],n=r[1],a=r[2],f=dr(t,n,a),o=f[0],c=f[1],i=f[2],l=Ar(o,c,i);return[l[0],l[1],l[2],r.length>3?r[3]:1]},p.autodetect.push({p:3,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if("array"===o(r=u(r,"oklch"))&&3===r.length)return"oklch"}}),v.prototype.alpha=function(r,e){return void 0===e&&(e=!1),void 0!==r&&"number"===o(r)?e?(this._rgb[3]=r,this):new v([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},v.prototype.clipped=function(){return this._rgb._clipped||!1},v.prototype.darken=function(r){void 0===r&&(r=1);var e=this.lab();return e[0]-=T*r,new v(e,"lab").alpha(this.alpha(),!0)},v.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},v.prototype.darker=v.prototype.darken,v.prototype.brighter=v.prototype.brighten,v.prototype.get=function(r){var e=r.split("."),t=e[0],n=e[1],a=this[t]();if(n){var f=t.indexOf(n)-("ok"===t.substr(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+n+" in mode "+t)}return a};var Pr=Math.pow;v.prototype.luminance=function(r,e){if(void 0===e&&(e="rgb"),void 0!==r&&"number"===o(r)){if(0===r)return new v([0,0,0,this._rgb[3]],"rgb");if(1===r)return new v([255,255,255,this._rgb[3]],"rgb");var t=this.luminance(),n=20,a=function(t,f){var o=t.interpolate(f,.5,e),u=o.luminance();return Math.abs(r-u)<1e-7||!n--?o:u>r?a(t,o):a(o,f)},f=(t>r?a(new v([0,0,0]),this):a(this,new v([255,255,255]))).rgb();return new v(f.concat([this._rgb[3]]))}return Gr.apply(void 0,this._rgb.slice(0,3))};var Gr=function(r,e,t){return.2126*(r=Br(r))+.7152*(e=Br(e))+.0722*(t=Br(t))},Br=function(r){return(r/=255)<=.03928?r/12.92:Pr((r+.055)/1.055,2.4)},Cr={};function Rr(r,e,t){void 0===t&&(t=.5);for(var n=[],a=arguments.length-3;a-- >0;)n[a]=arguments[a+3];var f=n[0]||"lrgb";if(Cr[f]||n.length||(f=Object.keys(Cr)[0]),!Cr[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==o(r)&&(r=new v(r)),"object"!==o(e)&&(e=new v(e)),Cr[f](r,e,t).alpha(r.alpha()+t*(e.alpha()-r.alpha()))}v.prototype.mix=v.prototype.interpolate=function(r,e){void 0===e&&(e=.5);for(var t=[],n=arguments.length-2;n-- >0;)t[n]=arguments[n+2];return Rr.apply(void 0,[this,r,e].concat(t))},v.prototype.premultiply=function(r){void 0===r&&(r=!1);var e=this._rgb,t=e[3];return r?(this._rgb=[e[0]*t,e[1]*t,e[2]*t,t],this):new v([e[0]*t,e[1]*t,e[2]*t,t],"rgb")},v.prototype.saturate=function(r){void 0===r&&(r=1);var e=this.lch();return e[1]+=T*r,e[1]<0&&(e[1]=0),new v(e,"lch").alpha(this.alpha(),!0)},v.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)},v.prototype.set=function(r,e,t){void 0===t&&(t=!1);var n=r.split("."),a=n[0],f=n[1],u=this[a]();if(f){var c=a.indexOf(f)-("ok"===a.substr(0,2)?2:0);if(c>-1){if("string"==o(e))switch(e.charAt(0)){case"+":case"-":u[c]+=+e;break;case"*":u[c]*=+e.substr(1);break;case"/":u[c]/=+e.substr(1);break;default:u[c]=+e}else{if("number"!==o(e))throw new Error("unsupported value for Color.set");u[c]=e}var i=new v(u,a);return t?(this._rgb=i._rgb,this):i}throw new Error("unknown channel "+f+" in mode "+a)}return u},v.prototype.tint=function(r){void 0===r&&(r=.5);for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Rr.apply(void 0,[this,"white",r].concat(e))},v.prototype.shade=function(r){void 0===r&&(r=.5);for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];return Rr.apply(void 0,[this,"black",r].concat(e))};Cr.rgb=function(r,e,t){var n=r._rgb,a=e._rgb;return new v(n[0]+t*(a[0]-n[0]),n[1]+t*(a[1]-n[1]),n[2]+t*(a[2]-n[2]),"rgb")};var Sr=Math.sqrt,$r=Math.pow;Cr.lrgb=function(r,e,t){var n=r._rgb,a=n[0],f=n[1],o=n[2],u=e._rgb,c=u[0],i=u[1],l=u[2];return new v(Sr($r(a,2)*(1-t)+$r(c,2)*t),Sr($r(f,2)*(1-t)+$r(i,2)*t),Sr($r(o,2)*(1-t)+$r(l,2)*t),"rgb")};function Yr(r,e,t,n){var a,f,o,u,c,i,l,h,d,s,b,g,p;return"hsl"===n?(o=r.hsl(),u=e.hsl()):"hsv"===n?(o=r.hsv(),u=e.hsv()):"hcg"===n?(o=r.hcg(),u=e.hcg()):"hsi"===n?(o=r.hsi(),u=e.hsi()):"lch"===n||"hcl"===n?(n="hcl",o=r.hcl(),u=e.hcl()):"oklch"===n&&(o=r.oklch().reverse(),u=e.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||(c=(a=o)[0],l=a[1],d=a[2],i=(f=u)[0],h=f[1],s=f[2]),isNaN(c)||isNaN(i)?isNaN(c)?isNaN(i)?g=Number.NaN:(g=i,1!=d&&0!=d||"hsv"==n||(b=h)):(g=c,1!=s&&0!=s||"hsv"==n||(b=l)):g=c+t*(i>c&&i-c>180?i-(c+360):i180?i+360-c:i-c),void 0===b&&(b=l+t*(h-l)),p=d+t*(s-d),new v("oklch"===n?[p,b,g]:[g,b,p],n)}Cr.lab=function(r,e,t){var n=r.lab(),a=e.lab();return new v(n[0]+t*(a[0]-n[0]),n[1]+t*(a[1]-n[1]),n[2]+t*(a[2]-n[2]),"lab")};var zr=function(r,e,t){return Yr(r,e,t,"lch")};Cr.lch=zr,Cr.hcl=zr;Cr.num=function(r,e,t){var n=r.num(),a=e.num();return new v(n+t*(a-n),"num")};Cr.hcg=function(r,e,t){return Yr(r,e,t,"hcg")};Cr.hsi=function(r,e,t){return Yr(r,e,t,"hsi")};Cr.hsl=function(r,e,t){return Yr(r,e,t,"hsl")};Cr.hsv=function(r,e,t){return Yr(r,e,t,"hsv")};Cr.oklab=function(r,e,t){var n=r.oklab(),a=e.oklab();return new v(n[0]+t*(a[0]-n[0]),n[1]+t*(a[1]-n[1]),n[2]+t*(a[2]-n[2]),"oklab")};Cr.oklch=function(r,e,t){return Yr(r,e,t,"oklch")};var Ir=Math.pow,Ur=Math.sqrt,Vr=Math.PI,Xr=Math.cos,Dr=Math.sin,Tr=Math.atan2;var Hr=function(r,t){for(var n=r.length,a=[0,0,0,0],f=0;f.9999999&&(a[3]=1),new v(e(a))},Jr=Math.pow;function Kr(e){var t="rgb",n=m("#ccc"),a=0,f=[0,1],u=[],c=[0,0],i=!1,l=[],h=!1,d=0,s=1,b=!1,g={},p=!0,v=1,y=function(r){if((r=r||["#fff","#000"])&&"string"===o(r)&&m.brewer&&m.brewer[r.toLowerCase()]&&(r=m.brewer[r.toLowerCase()]),"array"===o(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var e=0;e2){var b=function(r){if(null!=i){for(var e=i.length-1,t=0;t=i[t];)t++;return t-1}return 0}(e);h=b/(i.length-2)}else h=s!==d?(e-d)/(s-d):1;h=k(h),a||(h=w(h)),1!==v&&(h=Jr(h,v)),h=r(h=c[0]+h*(1-c[0]-c[1]),0,1);var y=Math.floor(1e4*h);if(p&&g[y])f=g[y];else{if("array"===o(l))for(var M=0;M=N&&M===u.length-1){f=l[M];break}if(h>N&&h2){var c=r.map((function(e,t){return t/(r.length-1)})),i=r.map((function(r){return(r-d)/(s-d)}));i.every((function(r,e){return c[e]===r}))||(k=function(r){if(r<=0||r>=1)return r;for(var e=0;r>=i[e+1];)e++;var t=(r-i[e])/(i[e+1]-i[e]);return c[e]+t*(c[e+1]-c[e])})}}return f=[d,s],_},_.mode=function(r){return arguments.length?(t=r,N(),_):t},_.range=function(r,e){return y(r),_},_.out=function(r){return h=r,_},_.spread=function(r){return arguments.length?(a=r,_):a},_.correctLightness=function(r){return null==r&&(r=!0),b=r,N(),w=b?function(r){for(var e=M(0,!0).lab()[0],t=M(1,!0).lab()[0],n=e>t,a=M(r,!0).lab()[0],f=e+(t-e)*r,o=a-f,u=0,c=1,i=20;Math.abs(o)>.01&&i-- >0;)n&&(o*=-1),o<0?(u=r,r+=.5*(c-r)):(c=r,r+=.5*(u-r)),a=M(r,!0).lab()[0],o=a-f;return r}:function(r){return r},_},_.padding=function(r){return null!=r?("number"===o(r)&&(r=[r,r]),c=r,_):c},_.colors=function(r,t){arguments.length<2&&(t="hex");var n=[];if(0===arguments.length)n=l.slice(0);else if(1===r)n=[_(.5)];else if(r>1){var a=f[0],o=f[1]-a;n=function(r,e){for(var t=[],n=ra;n?f++:f--)t.push(f);return t}(0,r).map((function(e){return _(a+e/(r-1)*o)}))}else{e=[];var u=[];if(i&&i.length>2)for(var c=1,h=i.length,d=1<=h;d?ch;d?c++:c--)u.push(.5*(i[c-1]+i[c]));else u=f;n=u.map((function(r){return _(r)}))}return m[t]&&(n=n.map((function(r){return r[t]()}))),n},_.cache=function(r){return null!=r?(p=r,_):p},_.gamma=function(r){return null!=r?(v=r,_):v},_.nodata=function(r){return null!=r?(n=m(r),_):n},_}var Qr=function(r,e,t){if(!Qr[t])throw new Error("unknown blend mode "+t);return Qr[t](r,e)},Wr=function(r){return function(e,t){var n=m(t).rgb(),a=m(e).rgb();return m.rgb(r(n,a))}},Zr=function(r){return function(e,t){var n=[];return n[0]=r(e[0],t[0]),n[1]=r(e[1],t[1]),n[2]=r(e[2],t[2]),n}};Qr.normal=Wr(Zr((function(r){return r}))),Qr.multiply=Wr(Zr((function(r,e){return r*e/255}))),Qr.screen=Wr(Zr((function(r,e){return 255*(1-(1-r/255)*(1-e/255))}))),Qr.overlay=Wr(Zr((function(r,e){return e<128?2*r*e/255:255*(1-2*(1-r/255)*(1-e/255))}))),Qr.darken=Wr(Zr((function(r,e){return r>e?e:r}))),Qr.lighten=Wr(Zr((function(r,e){return r>e?r:e}))),Qr.dodge=Wr(Zr((function(r,e){return 255===r||(r=e/255*255/(1-r/255))>255?255:r}))),Qr.burn=Wr(Zr((function(r,e){return 255*(1-(1-e/255)/(r/255))})));var re=Math.pow,ee=Math.sin,te=Math.cos;var ne=Math.floor,ae=Math.random;var fe=Math.log,oe=Math.pow,ue=Math.floor,ce=Math.abs;function ie(r,e){void 0===e&&(e=null);var t={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===o(r)&&(r=Object.values(r)),r.forEach((function(r){e&&"object"===o(r)&&(r=r[e]),null==r||isNaN(r)||(t.values.push(r),t.sum+=r,rt.max&&(t.max=r),t.count+=1)})),t.domain=[t.min,t.max],t.limits=function(r,e){return le(t,r,e)},t}function le(r,e,t){void 0===e&&(e="equal"),void 0===t&&(t=7),"array"==o(r)&&(r=ie(r));var n=r.min,a=r.max,f=r.values.sort((function(r,e){return r-e}));if(1===t)return[n,a];var u=[];if("c"===e.substr(0,1)&&(u.push(n),u.push(a)),"e"===e.substr(0,1)){u.push(n);for(var c=1;c 0");var i=Math.LOG10E*fe(n),l=Math.LOG10E*fe(a);u.push(n);for(var h=1;h200&&(w=!1)}for(var C={},R=0;R=360;)b-=360;o[s]=b}else o[s]=o[s]/u[s];return d/=n,new v(o,e).alpha(d>.99999?1:d,!0)},bezier:function(r){var e=function(r){var e,t,n,a,f,o,u;if(2===(r=r.map((function(r){return new v(r)}))).length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],a=function(r){var e=[0,1,2].map((function(e){return f[e]+r*(o[e]-f[e])}));return new v(e,"lab")};else if(3===r.length)t=r.map((function(r){return r.lab()})),f=t[0],o=t[1],u=t[2],a=function(r){var e=[0,1,2].map((function(e){return(1-r)*(1-r)*f[e]+2*(1-r)*r*o[e]+r*r*u[e]}));return new v(e,"lab")};else if(4===r.length){var c;n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],u=n[2],c=n[3],a=function(r){var e=[0,1,2].map((function(e){return(1-r)*(1-r)*(1-r)*f[e]+3*(1-r)*(1-r)*r*o[e]+3*(1-r)*r*r*u[e]+r*r*r*c[e]}));return new v(e,"lab")}}else{if(!(r.length>=5))throw new RangeError("No point in running bezier with only one color.");var i,l,h;i=r.map((function(r){return r.lab()})),h=r.length-1,l=function(r){for(var e=[1,1],t=1;tn?(t+.05)/(n+.05):(n+.05)/(t+.05)},deltaE:function(r,e,t,n,a){void 0===t&&(t=1),void 0===n&&(n=1),void 0===a&&(a=1);var f=function(r){return 360*r/(2*we)},o=function(r){return 2*we*r/360};r=new v(r),e=new v(e);var u=Array.from(r.lab()),c=u[0],i=u[1],l=u[2],h=Array.from(e.lab()),d=h[0],s=h[1],b=h[2],g=(c+d)/2,p=(he(de(i,2)+de(l,2))+he(de(s,2)+de(b,2)))/2,m=.5*(1-he(de(p,7)/(de(p,7)+de(25,7)))),y=i*(1+m),w=s*(1+m),k=he(de(y,2)+de(l,2)),M=he(de(w,2)+de(b,2)),N=(k+M)/2,_=f(ge(l,y)),x=f(ge(b,w)),A=_>=0?_:_+360,F=x>=0?x:x+360,E=pe(A-F)>180?(A+F+360)/2:(A+F)/2,j=1-.17*ve(o(E-30))+.24*ve(o(2*E))+.32*ve(o(3*E+6))-.2*ve(o(4*E-63)),q=F-A;q=pe(q)<=180?q:F<=A?q+360:q-360,q=2*he(k*M)*me(o(q)/2);var L=d-c,O=M-k,P=1+.015*de(g-50,2)/he(20+de(g-50,2)),G=1+.045*N,B=1+.015*N*j,C=30*ye(-de((E-275)/25,2)),R=-(2*he(de(N,7)/(de(N,7)+de(25,7))))*me(2*o(C)),S=he(de(L/(t*P),2)+de(O/(n*G),2)+de(q/(a*B),2)+R*(O/(n*G))*(q/(a*B)));return be(0,se(100,S))},distance:function(r,e,t){void 0===t&&(t="lab"),r=new v(r),e=new v(e);var n=r.get(t),a=e.get(t),f=0;for(var o in n){var u=(n[o]||0)-(a[o]||0);f+=u*u}return Math.sqrt(f)},limits:le,valid:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return new(Function.prototype.bind.apply(v,[null].concat(r))),!0}catch(r){return!1}},scales:ke,input:p,colors:yr,brewer:Me}),m})); +!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r="undefined"!=typeof globalThis?globalThis:r||self).chroma=n()}(this,(function(){"use strict";var r=Math.min,n=Math.max;function e(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),r(n(t,e),a)}function t(r){r._clipped=!1,r._unclipped=r.slice(0);for(var n=0;n<=3;n++)n<3?((r[n]<0||r[n]>255)&&(r._clipped=!0),r[n]=e(r[n],0,255)):3===n&&(r[n]=e(r[n],0,1));return r}for(var a={},f=0,o=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];f=3?Array.prototype.slice.call(r):"object"==c(r[0])&&n?n.split("").filter((function(n){return void 0!==r[0][n]})).map((function(n){return r[0][n]})):r[0].slice(0)}function l(r){if(r.length<2)return null;var n=r.length-1;return"string"==c(r[n])?r[n].toLowerCase():null}var h=Math.PI,s=Math.min,d=Math.max,b=function(r){return Math.round(100*r)/100},g=function(r){return Math.round(100*r)/100},v=2*h,p=h/3,m=h/180,y=180/h,w={format:{},autodetect:[]},k=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=this;if("object"===c(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];var a=l(r),f=!1;if(!a){f=!0,w.sorted||(w.autodetect=w.autodetect.sort((function(r,n){return n.p-r.p})),w.sorted=!0);for(var o=0,u=w.autodetect;o4?r[4]:1;return 1===f?[0,0,0,o]:[e>=1?0:255*(1-e)*(1-f),t>=1?0:255*(1-t)*(1-f),a>=1?0:255*(1-a)*(1-f),o]},w.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"cmyk"))&&4===r.length)return"cmyk"}});var _=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a=(r=i(r,"rgba"))[0],f=r[1],o=r[2],u=s(a/=255,f/=255,o/=255),c=d(a,f,o),l=(c+u)/2;return c===u?(e=0,t=Number.NaN):e=l<.5?(c-u)/(c+u):(c-u)/(2-c-u),a==c?t=(f-o)/(c-u):f==c?t=2+(o-a)/(c-u):o==c&&(t=4+(a-f)/(c-u)),(t*=60)<0&&(t+=360),r.length>3&&void 0!==r[3]?[t,e,l,r[3]]:[t,e,l]},A={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},j=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function E(r){var n=j.get(String(r).toLowerCase());if(!n)throw new Error("unknown Lab illuminant "+r);A.labWhitePoint=r,A.Xn=n[0],A.Zn=n[1]}function R(){return A.labWhitePoint}var O=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb"),t=e[0],a=e[1],f=e[2],o=e.slice(3),u=F(t,a,f),c=function(r,n,e){var t=A.Xn,a=A.Yn,f=A.Zn,o=A.kE,u=A.kK,c=r/t,i=n/a,l=e/f,h=c>o?Math.pow(c,1/3):(u*c+16)/116,s=i>o?Math.pow(i,1/3):(u*i+16)/116,d=l>o?Math.pow(l,1/3):(u*l+16)/116;return[116*s-16,500*(h-s),200*(s-d)]}(u[0],u[1],u[2]);return[c[0],c[1],c[2]].concat(o.length>0&&o[0]<1?[o[0]]:[])};function P(r){var n=Math.sign(r);return((r=Math.abs(r))<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4))*n}var F=function(r,n,e){r=P(r/255),n=P(n/255),e=P(e/255);var t=A.MtxRGB2XYZ,a=A.MtxAdaptMa,f=A.MtxAdaptMaI,o=A.Xn,u=A.Yn,c=A.Zn,i=A.As,l=A.Bs,h=A.Cs,s=r*t.m00+n*t.m10+e*t.m20,d=r*t.m01+n*t.m11+e*t.m21,b=r*t.m02+n*t.m12+e*t.m22,g=o*a.m00+u*a.m10+c*a.m20,v=o*a.m01+u*a.m11+c*a.m21,p=o*a.m02+u*a.m12+c*a.m22,m=s*a.m00+d*a.m10+b*a.m20,y=s*a.m01+d*a.m11+b*a.m21,w=s*a.m02+d*a.m12+b*a.m22;return y*=v/l,w*=p/h,[s=(m*=g/i)*f.m00+y*f.m10+w*f.m20,d=m*f.m01+y*f.m11+w*f.m21,b=m*f.m02+y*f.m12+w*f.m22]},L=Math.sqrt,B=Math.atan2,G=Math.round,Y=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lab"),t=e[0],a=e[1],f=e[2],o=L(a*a+f*f),u=(B(f,a)*y+360)%360;return 0===G(1e4*o)&&(u=Number.NaN),[t,o,u]},q=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb"),t=e[0],a=e[1],f=e[2],o=e.slice(3),u=O(t,a,f),c=u[0],l=u[1],h=u[2],s=Y(c,l,h);return[s[0],s[1],s[2]].concat(o.length>0&&o[0]<1?[o[0]]:[])};function C(r,n){var e=r.length;Array.isArray(r[0])||(r=[r]),Array.isArray(n[0])||(n=n.map((function(r){return[r]})));var t=n[0].length,a=n[0].map((function(r,e){return n.map((function(r){return r[e]}))})),f=r.map((function(r){return a.map((function(n){return Array.isArray(r)?r.reduce((function(r,e,t){return r+e*(n[t]||0)}),0):n.reduce((function(n,e){return n+e*r}),0)}))}));return 1===e&&(f=f[0]),1===t?f.map((function(r){return r[0]})):f}var X=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a=i(r,"rgb"),f=a[0],o=a[1],u=a[2],c=a.slice(3),l=F(f,o,u);return(e=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],t=C([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],l),C(e,t.map((function(r){return Math.cbrt(r)})))).concat(c.length>0&&c[0]<1?[c[0]]:[])};var Z=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb"),t=e[0],a=e[1],f=e[2],o=e.slice(3),u=X(t,a,f),c=u[0],l=u[1],h=u[2],s=Y(c,l,h);return[s[0],s[1],s[2]].concat(o.length>0&&o[0]<1?[o[0]]:[])},$=Math.round,S=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba"),t=l(r)||"rgb";if("hsl"===t.substr(0,3))return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"hsla"),t=l(r)||"lsa";return e[0]=b(e[0]||0)+"deg",e[1]=b(100*e[1])+"%",e[2]=b(100*e[2])+"%","hsla"===t||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),t="hsla"):e.length=3,t.substr(0,3)+"("+e.join(" ")+")"}(_(e),t);if("lab"===t.substr(0,3)){var a=R();E("d50");var f=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lab"),t=l(r)||"lab";return e[0]=b(e[0])+"%",e[1]=b(e[1]),e[2]=b(e[2]),"laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lab("+e.join(" ")+")"}(O(e),t);return E(a),f}if("lch"===t.substr(0,3)){var o=R();E("d50");var u=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lch"),t=l(r)||"lab";return e[0]=b(e[0])+"%",e[1]=b(e[1]),e[2]=isNaN(e[2])?"none":b(e[2])+"deg","lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lch("+e.join(" ")+")"}(q(e),t);return E(o),u}return"oklab"===t.substr(0,5)?function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lab");return e[0]=b(100*e[0])+"%",e[1]=g(e[1]),e[2]=g(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklab("+e.join(" ")+")"}(X(e)):"oklch"===t.substr(0,5)?function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lch");return e[0]=b(100*e[0])+"%",e[1]=g(e[1]),e[2]=isNaN(e[2])?"none":b(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklch("+e.join(" ")+")"}(Z(e)):(e[0]=$(e[0]),e[1]=$(e[1]),e[2]=$(e[2]),("rgba"===t||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),t="rgba"),t.substr(0,3)+"("+e.slice(0,"rgb"===t?3:4).join(" ")+")")},W=function(){for(var r,n=[],e=arguments.length;e--;)n[e]=arguments[e];var t,a,f,o=(n=i(n,"hsl"))[0],u=n[1],c=n[2];if(0===u)t=a=f=255*c;else{var l=[0,0,0],h=[0,0,0],s=c<.5?c*(1+u):c+u-c*u,d=2*c-s,b=o/360;l[0]=b+1/3,l[1]=b,l[2]=b-1/3;for(var g=0;g<3;g++)l[g]<0&&(l[g]+=1),l[g]>1&&(l[g]-=1),6*l[g]<1?h[g]=d+6*(s-d)*l[g]:2*l[g]<1?h[g]=s:3*l[g]<2?h[g]=d+(s-d)*(2/3-l[g])*6:h[g]=d;t=(r=[255*h[0],255*h[1],255*h[2]])[0],a=r[1],f=r[2]}return n.length>3?[t,a,f,n[3]]:[t,a,f,1]},I=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=i(r,"lab"))[0],t=r[1],a=r[2],f=K(e,t,a),o=f[0],u=f[1],c=f[2],l=U(o,u,c);return[l[0],l[1],l[2],r.length>3?r[3]:1]},K=function(r,n,e){var t=A.kE,a=A.kK,f=A.kKE,o=A.Xn,u=A.Yn,c=A.Zn,i=(r+16)/116,l=.002*n+i,h=i-.005*e,s=l*l*l,d=h*h*h;return[(s>t?s:(116*l-16)/a)*o,(r>f?Math.pow((r+16)/116,3):r/a)*u,(d>t?d:(116*h-16)/a)*c]},z=function(r){var n=Math.sign(r);return((r=Math.abs(r))<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)*n},U=function(r,n,e){var t=A.MtxAdaptMa,a=A.MtxAdaptMaI,f=A.MtxXYZ2RGB,o=A.RefWhiteRGB,u=A.Xn,c=A.Yn,i=A.Zn,l=u*t.m00+c*t.m10+i*t.m20,h=u*t.m01+c*t.m11+i*t.m21,s=u*t.m02+c*t.m12+i*t.m22,d=o.X*t.m00+o.Y*t.m10+o.Z*t.m20,b=o.X*t.m01+o.Y*t.m11+o.Z*t.m21,g=o.X*t.m02+o.Y*t.m12+o.Z*t.m22,v=(r*t.m00+n*t.m10+e*t.m20)*(d/l),p=(r*t.m01+n*t.m11+e*t.m21)*(b/h),m=(r*t.m02+n*t.m12+e*t.m22)*(g/s),y=v*a.m00+p*a.m10+m*a.m20,w=v*a.m01+p*a.m11+m*a.m21,k=v*a.m02+p*a.m12+m*a.m22;return[255*z(y*f.m00+w*f.m10+k*f.m20),255*z(y*f.m01+w*f.m11+k*f.m21),255*z(y*f.m02+w*f.m12+k*f.m22)]},V=Math.sin,D=Math.cos,T=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"lch"),t=e[0],a=e[1],f=e[2];return isNaN(f)&&(f=0),[t,D(f*=m)*a,V(f)*a]},H=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=i(r,"lch"))[0],t=r[1],a=r[2],f=T(e,t,a),o=f[0],u=f[1],c=f[2],l=I(o,u,c);return[l[0],l[1],l[2],r.length>3?r[3]:1]},J=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a=(r=i(r,"lab"))[0],f=r[1],o=r[2],u=r.slice(3),c=(e=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],t=C([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],[a,f,o]),C(e,t.map((function(r){return Math.pow(r,3)})))),l=c[0],h=c[1],s=c[2],d=U(l,h,s);return[d[0],d[1],d[2]].concat(u.length>0&&u[0]<1?[u[0]]:[])};var Q=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=i(r,"lch"))[0],t=r[1],a=r[2],f=r.slice(3),o=T(e,t,a),u=o[0],c=o[1],l=o[2],h=J(u,c,l);return[h[0],h[1],h[2]].concat(f.length>0&&f[0]<1?[f[0]]:[])},rr=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,nr=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,er=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,tr=/\s*/.source,ar=/\s+/.source,fr=/\s*,\s*/.source,or=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,ur=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,cr=new RegExp("^rgba?\\("+tr+[rr,rr,rr].join(ar)+ur+"\\)$"),ir=new RegExp("^rgb\\("+tr+[rr,rr,rr].join(fr)+tr+"\\)$"),lr=new RegExp("^rgba\\("+tr+[rr,rr,rr,nr].join(fr)+tr+"\\)$"),hr=new RegExp("^hsla?\\("+tr+[or,er,er].join(ar)+ur+"\\)$"),sr=new RegExp("^hsl?\\("+tr+[or,er,er].join(fr)+tr+"\\)$"),dr=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,br=new RegExp("^lab\\("+tr+[nr,nr,nr].join(ar)+ur+"\\)$"),gr=new RegExp("^lch\\("+tr+[nr,nr,or].join(ar)+ur+"\\)$"),vr=new RegExp("^oklab\\("+tr+[nr,nr,nr].join(ar)+ur+"\\)$"),pr=new RegExp("^oklch\\("+tr+[nr,nr,or].join(ar)+ur+"\\)$"),mr=Math.round,yr=function(r){return r.map((function(r,n){return n<=2?e(mr(r),0,255):r}))},wr=function(r,n,e,t){return void 0===n&&(n=0),void 0===e&&(e=100),void 0===t&&(t=!1),"string"==typeof r&&r.endsWith("%")&&(r=parseFloat(r.substring(0,r.length-1))/100,r=t?n+.5*(r+1)*(e-n):n+r*(e-n)),+r},kr=function(r,n){return"none"===r?n:r},Mr=function(r){if("transparent"===(r=r.toLowerCase().trim()))return[0,0,0,0];var n;if(w.format.named)try{return w.format.named(r)}catch(r){}if((n=r.match(cr))||(n=r.match(ir))){for(var e=n.slice(1,4),t=0;t<3;t++)e[t]=+wr(kr(e[t],0),0,255);e=yr(e);var a=void 0!==n[4]?+wr(n[4],0,1):1;return e[3]=a,e}if(n=r.match(lr)){for(var f=n.slice(1,5),o=0;o<4;o++)f[o]=+wr(f[o],0,255);return f}if((n=r.match(hr))||(n=r.match(sr))){var u=n.slice(1,4);u[0]=+kr(u[0].replace("deg",""),0),u[1]=.01*+wr(kr(u[1],0),0,100),u[2]=.01*+wr(kr(u[2],0),0,100);var c=yr(W(u)),i=void 0!==n[4]?+wr(n[4],0,1):1;return c[3]=i,c}if(n=r.match(dr)){var l=n.slice(1,4);l[1]*=.01,l[2]*=.01;for(var h=W(l),s=0;s<3;s++)h[s]=mr(h[s]);return h[3]=+n[4],h}if(n=r.match(br)){var d=n.slice(1,4);d[0]=wr(kr(d[0],0),0,100),d[1]=wr(kr(d[1],0),-125,125,!0),d[2]=wr(kr(d[2],0),-125,125,!0);var b=R();E("d50");var g=yr(I(d));E(b);var v=void 0!==n[4]?+wr(n[4],0,1):1;return g[3]=v,g}if(n=r.match(gr)){var p=n.slice(1,4);p[0]=wr(p[0],0,100),p[1]=wr(kr(p[1],0),0,150,!1),p[2]=+kr(p[2].replace("deg",""),0);var m=R();E("d50");var y=yr(H(p));E(m);var k=void 0!==n[4]?+wr(n[4],0,1):1;return y[3]=k,y}if(n=r.match(vr)){var M=n.slice(1,4);M[0]=wr(kr(M[0],0),0,1),M[1]=wr(kr(M[1],0),-.4,.4,!0),M[2]=wr(kr(M[2],0),-.4,.4,!0);var N=yr(J(M)),x=void 0!==n[4]?+wr(n[4],0,1):1;return N[3]=x,N}if(n=r.match(pr)){var _=n.slice(1,4);_[0]=wr(kr(_[0],0),0,1),_[1]=wr(kr(_[1],0),0,.4,!1),_[2]=+kr(_[2].replace("deg",""),0);var A=yr(Q(_)),j=void 0!==n[4]?+wr(n[4],0,1):1;return A[3]=j,A}};Mr.test=function(r){return cr.test(r)||hr.test(r)||br.test(r)||gr.test(r)||vr.test(r)||pr.test(r)||ir.test(r)||lr.test(r)||sr.test(r)||dr.test(r)||"transparent"===r},k.prototype.css=function(r){return S(this._rgb,r)};var Nr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["css"])))};M.css=Nr,w.format.css=Mr,w.autodetect.push({p:5,test:function(r){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];if(!n.length&&"string"===c(r)&&Mr.test(r))return"css"}}),w.format.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};var xr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["gl"])))};M.gl=xr,k.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var _r=Math.floor;k.prototype.hcg=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=i(r,"rgb"),a=t[0],f=t[1],o=t[2],u=s(a,f,o),c=d(a,f,o),l=c-u,h=100*l/255,b=u/(255-l)*100;return 0===l?e=Number.NaN:(a===c&&(e=(f-o)/l),f===c&&(e=2+(o-a)/l),o===c&&(e=4+(a-f)/l),(e*=60)<0&&(e+=360)),[e,h,b]}(this._rgb)};var Ar=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["hcg"])))};M.hcg=Ar,w.format.hcg=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,l,h,s=(o=i(o,"hcg"))[0],d=o[1],b=o[2];b*=255;var g=255*d;if(0===d)c=l=h=b;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360);var v=_r(s/=60),p=s-v,m=b*(1-d),y=m+g*(1-p),w=m+g*p,k=m+g;switch(v){case 0:c=(r=[k,w,m])[0],l=r[1],h=r[2];break;case 1:c=(n=[y,k,m])[0],l=n[1],h=n[2];break;case 2:c=(e=[m,k,w])[0],l=e[1],h=e[2];break;case 3:c=(t=[m,y,k])[0],l=t[1],h=t[2];break;case 4:c=(a=[w,m,k])[0],l=a[1],h=a[2];break;case 5:c=(f=[k,m,y])[0],l=f[1],h=f[2]}}return[c,l,h,o.length>3?o[3]:1]},w.autodetect.push({p:1,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hcg"))&&3===r.length)return"hcg"}});var jr=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,Er=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Rr=function(r){if(r.match(jr)){4!==r.length&&7!==r.length||(r=r.substr(1)),3===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]);var n=parseInt(r,16);return[n>>16,n>>8&255,255&n,1]}if(r.match(Er)){5!==r.length&&9!==r.length||(r=r.substr(1)),4===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]+r[3]+r[3]);var e=parseInt(r,16);return[e>>24&255,e>>16&255,e>>8&255,Math.round((255&e)/255*100)/100]}throw new Error("unknown hex color: "+r)},Or=Math.round,Pr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba"),t=e[0],a=e[1],f=e[2],o=e[3],u=l(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c="000000"+((t=Or(t))<<16|(a=Or(a))<<8|(f=Or(f))).toString(16);c=c.substr(c.length-6);var h="0"+Or(255*o).toString(16);switch(h=h.substr(h.length-2),u.toLowerCase()){case"rgba":return"#"+c+h;case"argb":return"#"+h+c;default:return"#"+c}};k.prototype.hex=function(r){return Pr(this._rgb,r)};var Fr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["hex"])))};M.hex=Fr,w.format.hex=Rr,w.autodetect.push({p:4,test:function(r){for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];if(!n.length&&"string"===c(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var Lr=Math.cos,Br=Math.min,Gr=Math.sqrt,Yr=Math.acos;k.prototype.hsi=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=i(r,"rgb"),a=t[0],f=t[1],o=t[2],u=Br(a/=255,f/=255,o/=255),c=(a+f+o)/3,l=c>0?1-u/c:0;return 0===l?e=NaN:(e=(a-f+(a-o))/2,e/=Gr((a-f)*(a-f)+(a-o)*(f-o)),e=Yr(e),o>f&&(e=v-e),e/=v),[360*e,l,c]}(this._rgb)};var qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["hsi"])))};M.hsi=qr,w.format.hsi=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var t,a,f,o=(r=i(r,"hsi"))[0],u=r[1],c=r[2];return isNaN(o)&&(o=0),isNaN(u)&&(u=0),o>360&&(o-=360),o<0&&(o+=360),(o/=360)<1/3?a=1-((f=(1-u)/3)+(t=(1+u*Lr(v*o)/Lr(p-v*o))/3)):o<2/3?f=1-((t=(1-u)/3)+(a=(1+u*Lr(v*(o-=1/3))/Lr(p-v*o))/3)):t=1-((a=(1-u)/3)+(f=(1+u*Lr(v*(o-=2/3))/Lr(p-v*o))/3)),[255*(t=e(c*t*3)),255*(a=e(c*a*3)),255*(f=e(c*f*3)),r.length>3?r[3]:1]},w.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hsi"))&&3===r.length)return"hsi"}}),k.prototype.hsl=function(){return _(this._rgb)};var Cr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["hsl"])))};M.hsl=Cr,w.format.hsl=W,w.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hsl"))&&3===r.length)return"hsl"}});var Xr=Math.floor,Zr=Math.min,$r=Math.max;k.prototype.hsv=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=i(r,"rgb"))[0],o=r[1],u=r[2],c=Zr(f,o,u),l=$r(f,o,u),h=l-c;return a=l/255,0===l?(e=Number.NaN,t=0):(t=h/l,f===l&&(e=(o-u)/h),o===l&&(e=2+(u-f)/h),u===l&&(e=4+(f-o)/h),(e*=60)<0&&(e+=360)),[e,t,a]}(this._rgb)};var Sr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["hsv"])))};M.hsv=Sr,w.format.hsv=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,l,h,s=(o=i(o,"hsv"))[0],d=o[1],b=o[2];if(b*=255,0===d)c=l=h=b;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360);var g=Xr(s/=60),v=s-g,p=b*(1-d),m=b*(1-d*v),y=b*(1-d*(1-v));switch(g){case 0:c=(r=[b,y,p])[0],l=r[1],h=r[2];break;case 1:c=(n=[m,b,p])[0],l=n[1],h=n[2];break;case 2:c=(e=[p,b,y])[0],l=e[1],h=e[2];break;case 3:c=(t=[p,m,b])[0],l=t[1],h=t[2];break;case 4:c=(a=[y,p,b])[0],l=a[1],h=a[2];break;case 5:c=(f=[b,p,m])[0],l=f[1],h=f[2]}}return[c,l,h,o.length>3?o[3]:1]},w.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"hsv"))&&3===r.length)return"hsv"}}),k.prototype.lab=function(){return O(this._rgb)};var Wr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["lab"])))};Object.assign(M,{lab:Wr,getLabWhitePoint:R,setLabWhitePoint:E}),w.format.lab=I,w.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"lab"))&&3===r.length)return"lab"}});k.prototype.lch=function(){return q(this._rgb)},k.prototype.hcl=function(){return q(this._rgb).reverse()};var Ir=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["lch"])))},Kr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["hcl"])))};Object.assign(M,{lch:Ir,hcl:Kr}),w.format.lch=H,w.format.hcl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"hcl").reverse();return H.apply(void 0,e)},["lch","hcl"].forEach((function(r){return w.autodetect.push({p:2,test:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];if("array"===c(n=i(n,r))&&3===n.length)return r}})}));k.prototype.num=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgb");return(e[0]<<16)+(e[1]<<8)+e[2]}(this._rgb)};var zr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["num"])))};Object.assign(M,{num:zr}),w.format.num=function(r){if("number"==c(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},w.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===c(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Ur=Math.round;k.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Ur)},k.prototype.rgba=function(r){return void 0===r&&(r=!0),this._rgb.slice(0,4).map((function(n,e){return e<3?!1===r?n:Ur(n):n}))};var Vr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["rgb"])))};Object.assign(M,{rgb:Vr}),w.format.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=i(r,"rgba");return void 0===e[3]&&(e[3]=1),e},w.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"rgba"))&&(3===r.length||4===r.length&&"number"==c(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var Dr=Math.log,Tr=function(r){var n,e,t,a=r/100;return a<66?(n=255,e=a<6?0:-155.25485562709179-.44596950469579133*(e=a-2)+104.49216199393888*Dr(e),t=a<20?0:.8274096064007395*(t=a-10)-254.76935184120902+115.67994401066147*Dr(t)):(n=351.97690566805693+.114206453784165*(n=a-55)-40.25366309332127*Dr(n),e=325.4494125711974+.07943456536662342*(e=a-50)-28.0852963507957*Dr(e),t=255),[n,e,t,1]},Hr=Math.round;k.prototype.temp=k.prototype.kelvin=k.prototype.temperature=function(){return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];for(var e,t=i(r,"rgb"),a=t[0],f=t[2],o=1e3,u=4e4;u-o>.4;){var c=Tr(e=.5*(u+o));c[2]/c[0]>=f/a?u=e:o=e}return Hr(e)}(this._rgb)};var Jr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["temp"])))};Object.assign(M,{temp:Jr,kelvin:Jr,temperature:Jr}),w.format.temp=w.format.kelvin=w.format.temperature=Tr,k.prototype.oklab=function(){return X(this._rgb)};var Qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["oklab"])))};Object.assign(M,{oklab:Qr}),w.format.oklab=J,w.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"oklab"))&&3===r.length)return"oklab"}}),k.prototype.oklch=function(){return Z(this._rgb)};var rn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(k,[null].concat(r,["oklch"])))};Object.assign(M,{oklch:rn}),w.format.oklch=Q,w.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if("array"===c(r=i(r,"oklch"))&&3===r.length)return"oklch"}});var nn={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",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",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",maroon2:"#7f0000",maroon3:"#b03060",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",purple2:"#7f007f",purple3:"#a020f0",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"};k.prototype.name=function(){for(var r=Pr(this._rgb,"rgb"),n=0,e=Object.keys(nn);n0;)n[e]=arguments[e+1];if(!n.length&&"string"===c(r)&&nn[r.toLowerCase()])return"named"}}),k.prototype.alpha=function(r,n){return void 0===n&&(n=!1),void 0!==r&&"number"===c(r)?n?(this._rgb[3]=r,this):new k([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},k.prototype.clipped=function(){return this._rgb._clipped||!1},k.prototype.darken=function(r){void 0===r&&(r=1);var n=this.lab();return n[0]-=A.Kn*r,new k(n,"lab").alpha(this.alpha(),!0)},k.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},k.prototype.darker=k.prototype.darken,k.prototype.brighter=k.prototype.brighten,k.prototype.get=function(r){var n=r.split("."),e=n[0],t=n[1],a=this[e]();if(t){var f=e.indexOf(t)-("ok"===e.substr(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+t+" in mode "+e)}return a};var en=Math.pow;k.prototype.luminance=function(r,n){if(void 0===n&&(n="rgb"),void 0!==r&&"number"===c(r)){if(0===r)return new k([0,0,0,this._rgb[3]],"rgb");if(1===r)return new k([255,255,255,this._rgb[3]],"rgb");var e=this.luminance(),t=20,a=function(e,f){var o=e.interpolate(f,.5,n),u=o.luminance();return Math.abs(r-u)<1e-7||!t--?o:u>r?a(e,o):a(o,f)},f=(e>r?a(new k([0,0,0]),this):a(this,new k([255,255,255]))).rgb();return new k(f.concat([this._rgb[3]]))}return tn.apply(void 0,this._rgb.slice(0,3))};var tn=function(r,n,e){return.2126*(r=an(r))+.7152*(n=an(n))+.0722*(e=an(e))},an=function(r){return(r/=255)<=.03928?r/12.92:en((r+.055)/1.055,2.4)},fn={};function on(r,n,e){void 0===e&&(e=.5);for(var t=[],a=arguments.length-3;a-- >0;)t[a]=arguments[a+3];var f=t[0]||"lrgb";if(fn[f]||t.length||(f=Object.keys(fn)[0]),!fn[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==c(r)&&(r=new k(r)),"object"!==c(n)&&(n=new k(n)),fn[f](r,n,e).alpha(r.alpha()+e*(n.alpha()-r.alpha()))}k.prototype.mix=k.prototype.interpolate=function(r,n){void 0===n&&(n=.5);for(var e=[],t=arguments.length-2;t-- >0;)e[t]=arguments[t+2];return on.apply(void 0,[this,r,n].concat(e))},k.prototype.premultiply=function(r){void 0===r&&(r=!1);var n=this._rgb,e=n[3];return r?(this._rgb=[n[0]*e,n[1]*e,n[2]*e,e],this):new k([n[0]*e,n[1]*e,n[2]*e,e],"rgb")},k.prototype.saturate=function(r){void 0===r&&(r=1);var n=this.lch();return n[1]+=A.Kn*r,n[1]<0&&(n[1]=0),new k(n,"lch").alpha(this.alpha(),!0)},k.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)},k.prototype.set=function(r,n,e){void 0===e&&(e=!1);var t=r.split("."),a=t[0],f=t[1],o=this[a]();if(f){var u=a.indexOf(f)-("ok"===a.substr(0,2)?2:0);if(u>-1){if("string"==c(n))switch(n.charAt(0)){case"+":case"-":o[u]+=+n;break;case"*":o[u]*=+n.substr(1);break;case"/":o[u]/=+n.substr(1);break;default:o[u]=+n}else{if("number"!==c(n))throw new Error("unsupported value for Color.set");o[u]=n}var i=new k(o,a);return e?(this._rgb=i._rgb,this):i}throw new Error("unknown channel "+f+" in mode "+a)}return o},k.prototype.tint=function(r){void 0===r&&(r=.5);for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return on.apply(void 0,[this,"white",r].concat(n))},k.prototype.shade=function(r){void 0===r&&(r=.5);for(var n=[],e=arguments.length-1;e-- >0;)n[e]=arguments[e+1];return on.apply(void 0,[this,"black",r].concat(n))};fn.rgb=function(r,n,e){var t=r._rgb,a=n._rgb;return new k(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"rgb")};var un=Math.sqrt,cn=Math.pow;fn.lrgb=function(r,n,e){var t=r._rgb,a=t[0],f=t[1],o=t[2],u=n._rgb,c=u[0],i=u[1],l=u[2];return new k(un(cn(a,2)*(1-e)+cn(c,2)*e),un(cn(f,2)*(1-e)+cn(i,2)*e),un(cn(o,2)*(1-e)+cn(l,2)*e),"rgb")};function ln(r,n,e,t){var a,f,o,u,c,i,l,h,s,d,b,g,v;return"hsl"===t?(o=r.hsl(),u=n.hsl()):"hsv"===t?(o=r.hsv(),u=n.hsv()):"hcg"===t?(o=r.hcg(),u=n.hcg()):"hsi"===t?(o=r.hsi(),u=n.hsi()):"lch"===t||"hcl"===t?(t="hcl",o=r.hcl(),u=n.hcl()):"oklch"===t&&(o=r.oklch().reverse(),u=n.oklch().reverse()),"h"!==t.substr(0,1)&&"oklch"!==t||(c=(a=o)[0],l=a[1],s=a[2],i=(f=u)[0],h=f[1],d=f[2]),isNaN(c)||isNaN(i)?isNaN(c)?isNaN(i)?g=Number.NaN:(g=i,1!=s&&0!=s||"hsv"==t||(b=h)):(g=c,1!=d&&0!=d||"hsv"==t||(b=l)):g=c+e*(i>c&&i-c>180?i-(c+360):i180?i+360-c:i-c),void 0===b&&(b=l+e*(h-l)),v=s+e*(d-s),new k("oklch"===t?[v,b,g]:[g,b,v],t)}fn.lab=function(r,n,e){var t=r.lab(),a=n.lab();return new k(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"lab")};var hn=function(r,n,e){return ln(r,n,e,"lch")};fn.lch=hn,fn.hcl=hn;fn.num=function(r,n,e){var t=r.num(),a=n.num();return new k(t+e*(a-t),"num")};fn.hcg=function(r,n,e){return ln(r,n,e,"hcg")};fn.hsi=function(r,n,e){return ln(r,n,e,"hsi")};fn.hsl=function(r,n,e){return ln(r,n,e,"hsl")};fn.hsv=function(r,n,e){return ln(r,n,e,"hsv")};fn.oklab=function(r,n,e){var t=r.oklab(),a=n.oklab();return new k(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"oklab")};fn.oklch=function(r,n,e){return ln(r,n,e,"oklch")};var sn=Math.pow,dn=Math.sqrt,bn=Math.PI,gn=Math.cos,vn=Math.sin,pn=Math.atan2;var mn=function(r,n){for(var e=r.length,a=[0,0,0,0],f=0;f.9999999&&(a[3]=1),new k(t(a))},yn=Math.pow;function wn(r){var n="rgb",t=M("#ccc"),a=0,f=[0,1],o=[],u=[0,0],i=!1,l=[],h=!1,s=0,d=1,b=!1,g={},v=!0,p=1,m=function(r){if((r=r||["#fff","#000"])&&"string"===c(r)&&M.brewer&&M.brewer[r.toLowerCase()]&&(r=M.brewer[r.toLowerCase()]),"array"===c(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var n=0;n2){var b=function(r){if(null!=i){for(var n=i.length-1,e=0;e=i[e];)e++;return e-1}return 0}(r);h=b/(i.length-2)}else h=d!==s?(r-s)/(d-s):1;h=w(h),a||(h=y(h)),1!==p&&(h=yn(h,p)),h=e(h=u[0]+h*(1-u[0]-u[1]),0,1);var m=Math.floor(1e4*h);if(v&&g[m])f=g[m];else{if("array"===c(l))for(var k=0;k=N&&k===o.length-1){f=l[k];break}if(h>N&&h2){var c=r.map((function(n,e){return e/(r.length-1)})),i=r.map((function(r){return(r-s)/(d-s)}));i.every((function(r,n){return c[n]===r}))||(w=function(r){if(r<=0||r>=1)return r;for(var n=0;r>=i[n+1];)n++;var e=(r-i[n])/(i[n+1]-i[n]);return c[n]+e*(c[n+1]-c[n])})}}return f=[s,d],x},x.mode=function(r){return arguments.length?(n=r,N(),x):n},x.range=function(r,n){return m(r),x},x.out=function(r){return h=r,x},x.spread=function(r){return arguments.length?(a=r,x):a},x.correctLightness=function(r){return null==r&&(r=!0),b=r,N(),y=b?function(r){for(var n=k(0,!0).lab()[0],e=k(1,!0).lab()[0],t=n>e,a=k(r,!0).lab()[0],f=n+(e-n)*r,o=a-f,u=0,c=1,i=20;Math.abs(o)>.01&&i-- >0;)t&&(o*=-1),o<0?(u=r,r+=.5*(c-r)):(c=r,r+=.5*(u-r)),a=k(r,!0).lab()[0],o=a-f;return r}:function(r){return r},x},x.padding=function(r){return null!=r?("number"===c(r)&&(r=[r,r]),u=r,x):u},x.colors=function(n,e){arguments.length<2&&(e="hex");var t=[];if(0===arguments.length)t=l.slice(0);else if(1===n)t=[x(.5)];else if(n>1){var a=f[0],o=f[1]-a;t=function(r,n){for(var e=[],t=ra;t?f++:f--)e.push(f);return e}(0,n).map((function(r){return x(a+r/(n-1)*o)}))}else{r=[];var u=[];if(i&&i.length>2)for(var c=1,h=i.length,s=1<=h;s?ch;s?c++:c--)u.push(.5*(i[c-1]+i[c]));else u=f;t=u.map((function(r){return x(r)}))}return M[e]&&(t=t.map((function(r){return r[e]()}))),t},x.cache=function(r){return null!=r?(v=r,x):v},x.gamma=function(r){return null!=r?(p=r,x):p},x.nodata=function(r){return null!=r?(t=M(r),x):t},x}var kn=function(r,n,e){if(!kn[e])throw new Error("unknown blend mode "+e);return kn[e](r,n)},Mn=function(r){return function(n,e){var t=M(e).rgb(),a=M(n).rgb();return M.rgb(r(t,a))}},Nn=function(r){return function(n,e){var t=[];return t[0]=r(n[0],e[0]),t[1]=r(n[1],e[1]),t[2]=r(n[2],e[2]),t}};kn.normal=Mn(Nn((function(r){return r}))),kn.multiply=Mn(Nn((function(r,n){return r*n/255}))),kn.screen=Mn(Nn((function(r,n){return 255*(1-(1-r/255)*(1-n/255))}))),kn.overlay=Mn(Nn((function(r,n){return n<128?2*r*n/255:255*(1-2*(1-r/255)*(1-n/255))}))),kn.darken=Mn(Nn((function(r,n){return r>n?n:r}))),kn.lighten=Mn(Nn((function(r,n){return r>n?r:n}))),kn.dodge=Mn(Nn((function(r,n){return 255===r||(r=n/255*255/(1-r/255))>255?255:r}))),kn.burn=Mn(Nn((function(r,n){return 255*(1-(1-n/255)/(r/255))})));var xn=Math.pow,_n=Math.sin,An=Math.cos;var jn=Math.floor,En=Math.random;var Rn=Math.log,On=Math.pow,Pn=Math.floor,Fn=Math.abs;function Ln(r,n){void 0===n&&(n=null);var e={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===c(r)&&(r=Object.values(r)),r.forEach((function(r){n&&"object"===c(r)&&(r=r[n]),null==r||isNaN(r)||(e.values.push(r),e.sum+=r,re.max&&(e.max=r),e.count+=1)})),e.domain=[e.min,e.max],e.limits=function(r,n){return Bn(e,r,n)},e}function Bn(r,n,e){void 0===n&&(n="equal"),void 0===e&&(e=7),"array"==c(r)&&(r=Ln(r));var t=r.min,a=r.max,f=r.values.sort((function(r,n){return r-n}));if(1===e)return[t,a];var o=[];if("c"===n.substr(0,1)&&(o.push(t),o.push(a)),"e"===n.substr(0,1)){o.push(t);for(var u=1;u 0");var i=Math.LOG10E*Rn(t),l=Math.LOG10E*Rn(a);o.push(t);for(var h=1;h200&&(w=!1)}for(var Y={},q=0;q=360;)b-=360;o[d]=b}else o[d]=o[d]/u[d];return s/=t,new k(o,n).alpha(s>.99999?1:s,!0)},bezier:function(r){var n=function(r){var n,e,t,a,f,o,u;if(2===(r=r.map((function(r){return new k(r)}))).length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],a=function(r){var n=[0,1,2].map((function(n){return f[n]+r*(o[n]-f[n])}));return new k(n,"lab")};else if(3===r.length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],a=function(r){var n=[0,1,2].map((function(n){return(1-r)*(1-r)*f[n]+2*(1-r)*r*o[n]+r*r*u[n]}));return new k(n,"lab")};else if(4===r.length){var c;t=r.map((function(r){return r.lab()})),f=t[0],o=t[1],u=t[2],c=t[3],a=function(r){var n=[0,1,2].map((function(n){return(1-r)*(1-r)*(1-r)*f[n]+3*(1-r)*(1-r)*r*o[n]+3*(1-r)*r*r*u[n]+r*r*r*c[n]}));return new k(n,"lab")}}else{if(!(r.length>=5))throw new RangeError("No point in running bezier with only one color.");var i,l,h;i=r.map((function(r){return r.lab()})),h=r.length-1,l=function(r){for(var n=[1,1],e=1;et?(e+.05)/(t+.05):(t+.05)/(e+.05)},contrastAPCA:function(r,n){r=new k(r),n=new k(n),r.alpha()<1&&(r=on(n,r,r.alpha(),"rgb"));var e=Yn.apply(void 0,r.rgb()),t=Yn.apply(void 0,n.rgb()),a=e>=Gn?e:e+Math.pow(Gn-e,1.414),f=t>=Gn?t:t+Math.pow(Gn-t,1.414),o=Math.pow(f,.56)-Math.pow(a,.57),u=Math.pow(f,.65)-Math.pow(a,.62),c=Math.abs(f-a)<5e-4?0:a0?c-.027:c+.027)},cubehelix:function(r,n,e,a,f){void 0===r&&(r=300),void 0===n&&(n=-1.5),void 0===e&&(e=1),void 0===a&&(a=1),void 0===f&&(f=[0,1]);var o,u=0;"array"===c(f)?o=f[1]-f[0]:(o=0,f=[f,f]);var i=function(c){var i=v*((r+120)/360+n*c),l=xn(f[0]+o*c,a),h=(0!==u?e[0]+c*u:e)*l*(1-l)/2,s=An(i),d=_n(i);return M(t([255*(l+h*(-.14861*s+1.78277*d)),255*(l+h*(-.29227*s-.90649*d)),255*(l+h*(1.97294*s)),1]))};return i.start=function(n){return null==n?r:(r=n,i)},i.rotations=function(r){return null==r?n:(n=r,i)},i.gamma=function(r){return null==r?a:(a=r,i)},i.hue=function(r){return null==r?e:("array"===c(e=r)?0===(u=e[1]-e[0])&&(e=e[1]):u=0,i)},i.lightness=function(r){return null==r?f:("array"===c(r)?(f=r,o=r[1]-r[0]):(f=[r,r],o=0),i)},i.scale=function(){return M.scale(i)},i.hue(e),i},deltaE:function(r,n,e,t,a){void 0===e&&(e=1),void 0===t&&(t=1),void 0===a&&(a=1);var f=function(r){return 360*r/(2*zn)},o=function(r){return 2*zn*r/360};r=new k(r),n=new k(n);var u=Array.from(r.lab()),c=u[0],i=u[1],l=u[2],h=Array.from(n.lab()),s=h[0],d=h[1],b=h[2],g=(c+s)/2,v=(qn(Cn(i,2)+Cn(l,2))+qn(Cn(d,2)+Cn(b,2)))/2,p=.5*(1-qn(Cn(v,7)/(Cn(v,7)+Cn(25,7)))),m=i*(1+p),y=d*(1+p),w=qn(Cn(m,2)+Cn(l,2)),M=qn(Cn(y,2)+Cn(b,2)),N=(w+M)/2,x=f($n(l,m)),_=f($n(b,y)),A=x>=0?x:x+360,j=_>=0?_:_+360,E=Sn(A-j)>180?(A+j+360)/2:(A+j)/2,R=1-.17*Wn(o(E-30))+.24*Wn(o(2*E))+.32*Wn(o(3*E+6))-.2*Wn(o(4*E-63)),O=j-A;O=Sn(O)<=180?O:j<=A?O+360:O-360,O=2*qn(w*M)*In(o(O)/2);var P=s-c,F=M-w,L=1+.015*Cn(g-50,2)/qn(20+Cn(g-50,2)),B=1+.045*N,G=1+.015*N*R,Y=30*Kn(-Cn((E-275)/25,2)),q=-(2*qn(Cn(N,7)/(Cn(N,7)+Cn(25,7))))*In(2*o(Y)),C=qn(Cn(P/(e*L),2)+Cn(F/(t*B),2)+Cn(O/(a*G),2)+q*(F/(t*B))*(O/(a*G)));return Zn(0,Xn(100,C))},distance:function(r,n,e){void 0===e&&(e="lab"),r=new k(r),n=new k(n);var t=r.get(e),a=n.get(e),f=0;for(var o in t){var u=(t[o]||0)-(a[o]||0);f+=u*u}return Math.sqrt(f)},input:w,interpolate:on,limits:Bn,mix:on,random:function(){for(var r="#",n=0;n<6;n++)r+="0123456789abcdef".charAt(jn(16*En()));return new k(r,"hex")},scale:wn,scales:Un,valid:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];try{return new(Function.prototype.bind.apply(k,[null].concat(r))),!0}catch(r){return!1}},cmyk:x,css:Nr,gl:xr,hcg:Ar,hex:Fr,hsi:qr,hsl:Cr,hsv:Sr,lab:Wr,lch:Ir,hcl:Kr,num:zr,rgb:Vr,temp:Jr,kelvin:Jr,temperature:Jr,oklab:Qr,oklch:rn,getLabWhitePoint:R,setLabWhitePoint:E}),M}));