forked from regorxxx/chroma.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chroma.min.js
58 lines (57 loc) · 37.2 KB
/
chroma.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* chroma.js - JavaScript library for color conversions
*
* Copyright (c) 2011-2019, Gregor Aisch
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name Gregor Aisch may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* -------------------------------------------------------
*
* chroma.js includes colors from colorbrewer2.org, which are released under
* the following license:
*
* Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
* and The Pennsylvania State University.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
* ------------------------------------------------------
*
* Named colors are taken from X11 Color Names.
* http://www.w3.org/TR/css3-color/#svg-color
*
* @preserve
*/
var e=(e,t=0,r=1)=>e<t?t:e>r?r:e,t=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let r=0;r<=3;r++)r<3?((t[r]<0||t[r]>255)&&(t._clipped=!0),t[r]=e(t[r],0,255)):3===r&&(t[r]=e(t[r],0,1));return t};const r={};for(let e of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])r[`[object ${e}]`]=e.toLowerCase();function n(e){return r[Object.prototype.toString.call(e)]||"object"}var a=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):"object"==n(e[0])&&t?t.split("").filter((t=>void 0!==e[0][t])).map((t=>e[0][t])):e[0],f=e=>{if(e.length<2)return null;const t=e.length-1;return"string"==n(e[t])?e[t].toLowerCase():null};const o=Math.PI,c=2*o,s=o/3,l=o/180,u=180/o;var i={format:{},autodetect:[]};class h{constructor(...e){const r=this;if("object"===n(e[0])&&e[0].constructor&&e[0].constructor===this.constructor)return e[0];let a=f(e),o=!1;if(!a){o=!0,i.sorted||(i.autodetect=i.autodetect.sort(((e,t)=>t.p-e.p)),i.sorted=!0);for(let t of i.autodetect)if(a=t.test(...e),a)break}if(!i.format[a])throw new Error("unknown format: "+e);{const n=i.format[a].apply(null,o?e:e.slice(0,-1));r._rgb=t(n)}3===r._rgb.length&&r._rgb.push(1)}toString(){return"function"==n(this.hex)?this.hex():`[${this._rgb.join(",")}]`}}const b=(...e)=>new b.Color(...e);b.Color=h,b.version="2.6.2";const{max:d}=Math;h.prototype.cmyk=function(){return((...e)=>{let[t,r,n]=a(e,"rgb");t/=255,r/=255,n/=255;const f=1-d(t,d(r,n)),o=f<1?1/(1-f):0;return[(1-t-f)*o,(1-r-f)*o,(1-n-f)*o,f]})(this._rgb)},b.cmyk=(...e)=>new h(...e,"cmyk"),i.format.cmyk=(...e)=>{e=a(e,"cmyk");const[t,r,n,f]=e,o=e.length>4?e[4]:1;return 1===f?[0,0,0,o]:[t>=1?0:255*(1-t)*(1-f),r>=1?0:255*(1-r)*(1-f),n>=1?0:255*(1-n)*(1-f),o]},i.autodetect.push({p:2,test:(...e)=>{if("array"===n(e=a(e,"cmyk"))&&4===e.length)return"cmyk"}});const g=e=>Math.round(100*e)/100,p=(...e)=>{e=a(e,"rgba");let[t,r,n]=e;t/=255,r/=255,n/=255;const f=Math.min(t,r,n),o=Math.max(t,r,n),c=(o+f)/2;let s,l;return o===f?(s=0,l=Number.NaN):s=c<.5?(o-f)/(o+f):(o-f)/(2-o-f),t==o?l=(r-n)/(o-f):r==o?l=2+(n-t)/(o-f):n==o&&(l=4+(t-r)/(o-f)),l*=60,l<0&&(l+=360),e.length>3&&void 0!==e[3]?[l,s,c,e[3]]:[l,s,c]},{round:m}=Math,w=(...e)=>{const t=a(e,"rgba");let r=f(e)||"rgb";return"hsl"==r.substr(0,3)?((...e)=>{const t=a(e,"hsla");let r=f(e)||"lsa";return t[0]=g(t[0]||0),t[1]=g(100*t[1])+"%",t[2]=g(100*t[2])+"%","hsla"===r||t.length>3&&t[3]<1?(t[3]=t.length>3?t[3]:1,r="hsla"):t.length=3,`${r}(${t.join(",")})`})(p(t),r):(t[0]=m(t[0]),t[1]=m(t[1]),t[2]=m(t[2]),("rgba"===r||t.length>3&&t[3]<1)&&(t[3]=t.length>3?t[3]:1,r="rgba"),`${r}(${t.slice(0,"rgb"===r?3:4).join(",")})`)},{round:y}=Math,k=(...e)=>{e=a(e,"hsl");const[t,r,n]=e;let f,o,c;if(0===r)f=o=c=255*n;else{const e=[0,0,0],a=[0,0,0],s=n<.5?n*(1+r):n+r-n*r,l=2*n-s,u=t/360;e[0]=u+1/3,e[1]=u,e[2]=u-1/3;for(let t=0;t<3;t++)e[t]<0&&(e[t]+=1),e[t]>1&&(e[t]-=1),6*e[t]<1?a[t]=l+6*(s-l)*e[t]:2*e[t]<1?a[t]=s:3*e[t]<2?a[t]=l+(s-l)*(2/3-e[t])*6:a[t]=l;[f,o,c]=[y(255*a[0]),y(255*a[1]),y(255*a[2])]}return e.length>3?[f,o,c,e[3]]:[f,o,c,1]},v=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,N=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,_=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,M=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,x=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,A=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,{round:$}=Math,E=e=>{let t;if(e=e.toLowerCase().trim(),i.format.named)try{return i.format.named(e)}catch(e){}if(t=e.match(v)){const e=t.slice(1,4);for(let t=0;t<3;t++)e[t]=+e[t];return e[3]=1,e}if(t=e.match(N)){const e=t.slice(1,5);for(let t=0;t<4;t++)e[t]=+e[t];return e}if(t=e.match(_)){const e=t.slice(1,4);for(let t=0;t<3;t++)e[t]=$(2.55*e[t]);return e[3]=1,e}if(t=e.match(M)){const e=t.slice(1,5);for(let t=0;t<3;t++)e[t]=$(2.55*e[t]);return e[3]=+e[3],e}if(t=e.match(x)){const e=t.slice(1,4);e[1]*=.01,e[2]*=.01;const r=k(e);return r[3]=1,r}if(t=e.match(A)){const e=t.slice(1,4);e[1]*=.01,e[2]*=.01;const r=k(e);return r[3]=+t[4],r}};E.test=e=>v.test(e)||N.test(e)||_.test(e)||M.test(e)||x.test(e)||A.test(e),h.prototype.css=function(e){return w(this._rgb,e)},b.css=(...e)=>new h(...e,"css"),i.format.css=E,i.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&"string"===n(e)&&E.test(e))return"css"}}),i.format.gl=(...e)=>{const t=a(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t},b.gl=(...e)=>new h(...e,"gl"),h.prototype.gl=function(){const e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};const{floor:j}=Math;h.prototype.hcg=function(){return((...e)=>{const[t,r,n]=a(e,"rgb").map((e=>e/255)),f=Math.min(t,r,n),o=Math.max(t,r,n),c=o-f,s=f/(1-c);let l;return 0===c?l=Number.NaN:(t===o&&(l=(r-n)/c),r===o&&(l=2+(n-t)/c),n===o&&(l=4+(t-r)/c),l*=60,l<0&&(l+=360)),[l,c,s]})(this._rgb)},b.hcg=(...e)=>new h(...e,"hcg"),i.format.hcg=(...e)=>{e=a(e,"hcg");let t,r,n,[f,o,c]=e;c*=255;const s=255*o;if(0===o)t=r=n=c;else{360===f&&(f=0),f>360&&(f-=360),f<0&&(f+=360),f/=60;const e=j(f),a=f-e,l=c*(1-o),u=l+s*(1-a),i=l+s*a,h=l+s;switch(e){case 0:[t,r,n]=[h,i,l];break;case 1:[t,r,n]=[u,h,l];break;case 2:[t,r,n]=[l,h,i];break;case 3:[t,r,n]=[l,u,h];break;case 4:[t,r,n]=[i,l,h];break;case 5:[t,r,n]=[h,l,u]}}return[t,r,n,e.length>3?e[3]:1]},i.autodetect.push({p:1,test:(...e)=>{if("array"===n(e=a(e,"hcg"))&&3===e.length)return"hcg"}});const{round:q}=Math,L=(...e)=>{let[t,r,n,o]=a(e,"rgba"),c=f(e)||"auto";void 0===o&&(o=1),"auto"===c&&(c=o<1?"rgba":"rgb"),t=q(t),r=q(r),n=q(n);let s="000000"+(t<<16|r<<8|n).toString(16);s=s.substr(s.length-6);let l="0"+q(255*o).toString(16);switch(l=l.substr(l.length-2),c.toLowerCase()){case"rgba":return`#${s}${l}`;case"argb":return`#${l}${s}`;default:return`#${s}`}},O=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,P=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,G=e=>{if(e.match(O)){4!==e.length&&7!==e.length||(e=e.substr(1)),3===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e,16);return[t>>16,t>>8&255,255&t,1]}if(e.match(P)){5!==e.length&&9!==e.length||(e=e.substr(1)),4===e.length&&(e=(e=e.split(""))[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e,16);return[t>>24&255,t>>16&255,t>>8&255,Math.round((255&t)/255*100)/100]}throw new Error(`unknown hex color: ${e}`)};h.prototype.hex=function(e){return L(this._rgb,e)},b.hex=(...e)=>new h(...e,"hex"),i.format.hex=G,i.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&"string"===n(e)&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{min:B,sqrt:C,acos:R}=Math,{cos:S}=Math;h.prototype.hsi=function(){return((...e)=>{let t,[r,n,f]=a(e,"rgb");r/=255,n/=255,f/=255;const o=B(r,n,f),s=(r+n+f)/3,l=s>0?1-o/s:0;return 0===l?t=NaN:(t=(r-n+(r-f))/2,t/=C((r-n)*(r-n)+(r-f)*(n-f)),t=R(t),f>n&&(t=c-t),t/=c),[360*t,l,s]})(this._rgb)},b.hsi=(...e)=>new h(...e,"hsi"),i.format.hsi=(...t)=>{t=a(t,"hsi");let r,n,f,[o,l,u]=t;return isNaN(o)&&(o=0),isNaN(l)&&(l=0),o>360&&(o-=360),o<0&&(o+=360),o/=360,o<1/3?(f=(1-l)/3,r=(1+l*S(c*o)/S(s-c*o))/3,n=1-(f+r)):o<2/3?(o-=1/3,r=(1-l)/3,n=(1+l*S(c*o)/S(s-c*o))/3,f=1-(r+n)):(o-=2/3,n=(1-l)/3,f=(1+l*S(c*o)/S(s-c*o))/3,r=1-(n+f)),r=e(u*r*3),n=e(u*n*3),f=e(u*f*3),[255*r,255*n,255*f,t.length>3?t[3]:1]},i.autodetect.push({p:2,test:(...e)=>{if("array"===n(e=a(e,"hsi"))&&3===e.length)return"hsi"}}),h.prototype.hsl=function(){return p(this._rgb)},b.hsl=(...e)=>new h(...e,"hsl"),i.format.hsl=k,i.autodetect.push({p:2,test:(...e)=>{if("array"===n(e=a(e,"hsl"))&&3===e.length)return"hsl"}});const{min:z,max:Y}=Math,{floor:F}=Math;h.prototype.hsv=function(){return((...e)=>{e=a(e,"rgb");let[t,r,n]=e;const f=z(t,r,n),o=Y(t,r,n),c=o-f;let s,l,u;return u=o/255,0===o?(s=Number.NaN,l=0):(l=c/o,t===o&&(s=(r-n)/c),r===o&&(s=2+(n-t)/c),n===o&&(s=4+(t-r)/c),s*=60,s<0&&(s+=360)),[s,l,u]})(this._rgb)},b.hsv=(...e)=>new h(...e,"hsv"),i.format.hsv=(...e)=>{e=a(e,"hsv");let t,r,n,[f,o,c]=e;if(c*=255,0===o)t=r=n=c;else{360===f&&(f=0),f>360&&(f-=360),f<0&&(f+=360),f/=60;const e=F(f),a=f-e,s=c*(1-o),l=c*(1-o*a),u=c*(1-o*(1-a));switch(e){case 0:[t,r,n]=[c,u,s];break;case 1:[t,r,n]=[l,c,s];break;case 2:[t,r,n]=[s,c,u];break;case 3:[t,r,n]=[s,l,c];break;case 4:[t,r,n]=[u,s,c];break;case 5:[t,r,n]=[c,s,l]}}return[t,r,n,e.length>3?e[3]:1]},i.autodetect.push({p:2,test:(...e)=>{if("array"===n(e=a(e,"hsv"))&&3===e.length)return"hsv"}});var I=18,U=.95047,V=1,X=1.08883,D=.137931034,H=.206896552,J=.12841855,K=.008856452;const{pow:Q}=Math,T=(...e)=>{const[t,r,n]=a(e,"rgb"),[f,o,c]=ee(t,r,n),s=116*o-16;return[s<0?0:s,500*(f-o),200*(o-c)]},W=e=>(e/=255)<=.04045?e/12.92:Q((e+.055)/1.055,2.4),Z=e=>e>K?Q(e,1/3):e/J+D,ee=(e,t,r)=>{e=W(e),t=W(t),r=W(r);return[Z((.4124564*e+.3575761*t+.1804375*r)/U),Z((.2126729*e+.7151522*t+.072175*r)/V),Z((.0193339*e+.119192*t+.9503041*r)/X)]},{pow:te}=Math,re=(...e)=>{e=a(e,"lab");const[t,r,n]=e;let f,o,c,s,l,u;return o=(t+16)/116,f=isNaN(r)?o:o+r/500,c=isNaN(n)?o:o-n/200,o=V*ae(o),f=U*ae(f),c=X*ae(c),s=ne(3.2404542*f-1.5371385*o-.4985314*c),l=ne(-.969266*f+1.8760108*o+.041556*c),u=ne(.0556434*f-.2040259*o+1.0572252*c),[s,l,u,e.length>3?e[3]:1]},ne=e=>255*(e<=.00304?12.92*e:1.055*te(e,1/2.4)-.055),ae=e=>e>H?e*e*e:J*(e-D);h.prototype.lab=function(){return T(this._rgb)},b.lab=(...e)=>new h(...e,"lab"),i.format.lab=re,i.autodetect.push({p:2,test:(...e)=>{if("array"===n(e=a(e,"lab"))&&3===e.length)return"lab"}});const{sqrt:fe,atan2:oe,round:ce}=Math,se=(...e)=>{const[t,r,n]=a(e,"lab"),f=fe(r*r+n*n);let o=(oe(n,r)*u+360)%360;return 0===ce(1e4*f)&&(o=Number.NaN),[t,f,o]},le=(...e)=>{const[t,r,n]=a(e,"rgb"),[f,o,c]=T(t,r,n);return se(f,o,c)},{sin:ue,cos:ie}=Math,he=(...e)=>{let[t,r,n]=a(e,"lch");return isNaN(n)&&(n=0),n*=l,[t,ie(n)*r,ue(n)*r]},be=(...e)=>{e=a(e,"lch");const[t,r,n]=e,[f,o,c]=he(t,r,n),[s,l,u]=re(f,o,c);return[s,l,u,e.length>3?e[3]:1]};h.prototype.lch=function(){return le(this._rgb)},h.prototype.hcl=function(){return le(this._rgb).reverse()},b.lch=(...e)=>new h(...e,"lch"),b.hcl=(...e)=>new h(...e,"hcl"),i.format.lch=be,i.format.hcl=(...e)=>{const t=a(e,"hcl").reverse();return be(...t)},["lch","hcl"].forEach((e=>i.autodetect.push({p:2,test:(...t)=>{if("array"===n(t=a(t,e))&&3===t.length)return e}})));const de={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"};h.prototype.name=function(){const e=L(this._rgb,"rgb");for(let t of Object.keys(de))if(de[t]===e)return t.toLowerCase();return e},i.format.named=e=>{if(e=e.toLowerCase(),de[e])return G(de[e]);throw new Error("unknown color name: "+e)},i.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&"string"===n(e)&&de[e.toLowerCase()])return"named"}});h.prototype.num=function(){return((...e)=>{const[t,r,n]=a(e,"rgb");return(t<<16)+(r<<8)+n})(this._rgb)},b.num=(...e)=>new h(...e,"num"),i.format.num=e=>{if("number"==n(e)&&e>=0&&e<=16777215){return[e>>16,e>>8&255,255&e,1]}throw new Error("unknown num color: "+e)},i.autodetect.push({p:5,test:(...e)=>{if(1===e.length&&"number"===n(e[0])&&e[0]>=0&&e[0]<=16777215)return"num"}});const{round:ge}=Math;h.prototype.rgb=function(e=!0){return!1===e?this._rgb.slice(0,3):this._rgb.slice(0,3).map(ge)},h.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map(((t,r)=>r<3?!1===e?t:ge(t):t))},b.rgb=(...e)=>new h(...e,"rgb"),i.format.rgb=(...e)=>{const t=a(e,"rgba");return void 0===t[3]&&(t[3]=1),t},i.autodetect.push({p:3,test:(...e)=>{if("array"===n(e=a(e,"rgba"))&&(3===e.length||4===e.length&&"number"==n(e[3])&&e[3]>=0&&e[3]<=1))return"rgb"}});const{log:pe}=Math,me=e=>{const t=e/100;let r,n,a;return t<66?(r=255,n=t<6?0:-155.25485562709179-.44596950469579133*(n=t-2)+104.49216199393888*pe(n),a=t<20?0:.8274096064007395*(a=t-10)-254.76935184120902+115.67994401066147*pe(a)):(r=351.97690566805693+.114206453784165*(r=t-55)-40.25366309332127*pe(r),n=325.4494125711974+.07943456536662342*(n=t-50)-28.0852963507957*pe(n),a=255),[r,n,a,1]},{round:we}=Math;h.prototype.temp=h.prototype.kelvin=h.prototype.temperature=function(){return((...e)=>{const t=a(e,"rgb"),r=t[0],n=t[2];let f,o=1e3,c=4e4;for(;c-o>.4;){f=.5*(c+o);const e=me(f);e[2]/e[0]>=n/r?c=f:o=f}return we(f)})(this._rgb)},b.temp=b.kelvin=b.temperature=(...e)=>new h(...e,"temp"),i.format.temp=i.format.kelvin=i.format.temperature=me;const{cbrt:ye,pow:ke,sign:ve}=Math,Ne=(...e)=>{const[t,r,n]=a(e,"rgb"),[f,o,c]=[_e(t/255),_e(r/255),_e(n/255)],s=ye(.4122214708*f+.5363325363*o+.0514459929*c),l=ye(.2119034982*f+.6806995451*o+.1073969566*c),u=ye(.0883024619*f+.2817188376*o+.6299787005*c);return[.2104542553*s+.793617785*l-.0040720468*u,1.9779984951*s-2.428592205*l+.4505937099*u,.0259040371*s+.7827717662*l-.808675766*u]};function _e(e){const t=Math.abs(e);return t<.04045?e/12.92:(ve(e)||1)*ke((t+.055)/1.055,2.4)}const{pow:Me,sign:xe}=Math,Ae=(...e)=>{e=a(e,"lab");const[t,r,n]=e,f=Me(t+.3963377774*r+.2158037573*n,3),o=Me(t-.1055613458*r-.0638541728*n,3),c=Me(t-.0894841775*r-1.291485548*n,3);return[255*$e(4.0767416621*f-3.3077115913*o+.2309699292*c),255*$e(-1.2684380046*f+2.6097574011*o-.3413193965*c),255*$e(-.0041960863*f-.7034186147*o+1.707614701*c),e.length>3?e[3]:1]};function $e(e){const t=Math.abs(e);return t>.0031308?(xe(e)||1)*(1.055*Me(t,1/2.4)-.055):12.92*e}h.prototype.oklab=function(){return Ne(this._rgb)},b.oklab=(...e)=>new h(...e,"oklab"),i.format.oklab=Ae,i.autodetect.push({p:3,test:(...e)=>{if("array"===n(e=a(e,"oklab"))&&3===e.length)return"oklab"}});h.prototype.oklch=function(){return((...e)=>{const[t,r,n]=a(e,"rgb"),[f,o,c]=Ne(t,r,n);return se(f,o,c)})(this._rgb)},b.oklch=(...e)=>new h(...e,"oklch"),i.format.oklch=(...e)=>{e=a(e,"lch");const[t,r,n]=e,[f,o,c]=he(t,r,n),[s,l,u]=Ae(f,o,c);return[s,l,u,e.length>3?e[3]:1]},i.autodetect.push({p:3,test:(...e)=>{if("array"===n(e=a(e,"oklch"))&&3===e.length)return"oklch"}});const{round:Ee}=Math;h.prototype.android=function(e){return((...e)=>{const t=a(e,"rgba");let r=(1!==t[3]?f(e):"rgb")||"rgb";return t[0]=Ee(t[0]),t[1]=Ee(t[1]),t[2]=Ee(t[2]),("rgba"===r||t.length>3&&t[3]<1&&"rgb"!==f(e))&&(t[3]=t.length>3?t[3]:1,r="rgba"),"rgba"===r?t[3]<<24|t[0]<<16|t[1]<<8|t[2]:4278190080|t[0]<<16|t[1]<<8|t[2]})(this._rgb,e)},b.android=(...e)=>new h(...e,"android"),i.format.android=e=>{if("number"==n(e)){const t=(e>>24&255)/255;if(t>=0&&t<=1){const r=e-4278190080;return[r>>16&255,r>>8&255,255&r,t]}}throw new Error("unknown android color: "+e)},i.autodetect.push({p:5,test:(...e)=>{if(1===e.length&&"number"===n(e[0])){const t=(e[0]>>24&255)/255;if(t>=0&&t<=1){const t=e[0]-4278190080;if([t>>16&255,t>>8&255,255&t].every((e=>e>=0&&e<=255)))return"android"}}}}),h.prototype.alpha=function(e,t=!1){return void 0!==e&&"number"===n(e)?t?(this._rgb[3]=e,this):new h([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]},h.prototype.clipped=function(){return this._rgb._clipped||!1},h.prototype.darken=function(e=1){const t=this.lab();return t[0]-=I*e,new h(t,"lab").alpha(this.alpha(),!0)},h.prototype.brighten=function(e=1){return this.darken(-e)},h.prototype.darker=h.prototype.darken,h.prototype.brighter=h.prototype.brighten,h.prototype.get=function(e){const[t,r]=e.split("."),n=this[t]();if(r){const e=t.indexOf(r)-("ok"===t.substr(0,2)?2:0);if(e>-1)return n[e];throw new Error(`unknown channel ${r} in mode ${t}`)}return n};const{pow:je}=Math;h.prototype.luminance=function(e){if(void 0!==e&&"number"===n(e)){if(0===e)return new h([0,0,0,this._rgb[3]],"rgb");if(1===e)return new h([255,255,255,this._rgb[3]],"rgb");let t=this.luminance(),r="rgb",n=20;const a=(t,f)=>{const o=t.interpolate(f,.5,r),c=o.luminance();return Math.abs(e-c)<1e-7||!n--?o:c>e?a(t,o):a(o,f)},f=(t>e?a(new h([0,0,0]),this):a(this,new h([255,255,255]))).rgb();return new h([...f,this._rgb[3]])}return qe(...this._rgb.slice(0,3))};const qe=(e,t,r)=>.2126*(e=Le(e))+.7152*(t=Le(t))+.0722*(r=Le(r)),Le=e=>(e/=255)<=.03928?e/12.92:je((e+.055)/1.055,2.4);var Oe={},Pe=(e,t,r=.5,...a)=>{let f=a[0]||"lrgb";if(Oe[f]||a.length||(f=Object.keys(Oe)[0]),!Oe[f])throw new Error(`interpolation mode ${f} is not defined`);return"object"!==n(e)&&(e=new h(e)),"object"!==n(t)&&(t=new h(t)),Oe[f](e,t,r).alpha(e.alpha()+r*(t.alpha()-e.alpha()))};h.prototype.mix=h.prototype.interpolate=function(e,t=.5,...r){return Pe(this,e,t,...r)},h.prototype.premultiply=function(e=!1){const t=this._rgb,r=t[3];return e?(this._rgb=[t[0]*r,t[1]*r,t[2]*r,r],this):new h([t[0]*r,t[1]*r,t[2]*r,r],"rgb")},h.prototype.saturate=function(e=1){const t=this.lch();return t[1]+=I*e,t[1]<0&&(t[1]=0),new h(t,"lch").alpha(this.alpha(),!0)},h.prototype.desaturate=function(e=1){return this.saturate(-e)},h.prototype.set=function(e,t,r=!1){const[a,f]=e.split("."),o=this[a]();if(f){const e=a.indexOf(f)-("ok"===a.substr(0,2)?2:0);if(e>-1){if("string"==n(t))switch(t.charAt(0)){case"+":case"-":o[e]+=+t;break;case"*":o[e]*=+t.substr(1);break;case"/":o[e]/=+t.substr(1);break;default:o[e]=+t}else{if("number"!==n(t))throw new Error("unsupported value for Color.set");o[e]=t}const f=new h(o,a);return r?(this._rgb=f._rgb,this):f}throw new Error(`unknown channel ${f} in mode ${a}`)}return o};Oe.rgb=(e,t,r)=>{const n=e._rgb,a=t._rgb;return new h(n[0]+r*(a[0]-n[0]),n[1]+r*(a[1]-n[1]),n[2]+r*(a[2]-n[2]),"rgb")};const{sqrt:Ge,pow:Be}=Math;Oe.lrgb=(e,t,r)=>{const[n,a,f]=e._rgb,[o,c,s]=t._rgb;return new h(Ge(Be(n,2)*(1-r)+Be(o,2)*r),Ge(Be(a,2)*(1-r)+Be(c,2)*r),Ge(Be(f,2)*(1-r)+Be(s,2)*r),"rgb")};Oe.lab=(e,t,r)=>{const n=e.lab(),a=t.lab();return new h(n[0]+r*(a[0]-n[0]),n[1]+r*(a[1]-n[1]),n[2]+r*(a[2]-n[2]),"lab")};var Ce=(e,t,r,n)=>{let a,f,o,c,s,l,u,i,b,d,g,p;return"hsl"===n?(a=e.hsl(),f=t.hsl()):"hsv"===n?(a=e.hsv(),f=t.hsv()):"hcg"===n?(a=e.hcg(),f=t.hcg()):"hsi"===n?(a=e.hsi(),f=t.hsi()):"lch"===n||"hcl"===n?(n="hcl",a=e.hcl(),f=t.hcl()):"oklch"===n&&(a=e.oklch().reverse(),f=t.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||([o,s,u]=a,[c,l,i]=f),isNaN(o)||isNaN(c)?isNaN(o)?isNaN(c)?d=Number.NaN:(d=c,1!=u&&0!=u||"hsv"==n||(b=l)):(d=o,1!=i&&0!=i||"hsv"==n||(b=s)):(p=c>o&&c-o>180?c-(o+360):c<o&&o-c>180?c+360-o:c-o,d=o+r*p),void 0===b&&(b=s+r*(l-s)),g=u+r*(i-u),new h("oklch"===n?[g,b,d]:[d,b,g],n)};const Re=(e,t,r)=>Ce(e,t,r,"lch");Oe.lch=Re,Oe.hcl=Re;Oe.num=(e,t,r)=>{const n=e.num(),a=t.num();return new h(n+r*(a-n),"num")};Oe.hcg=(e,t,r)=>Ce(e,t,r,"hcg");Oe.hsi=(e,t,r)=>Ce(e,t,r,"hsi");Oe.hsl=(e,t,r)=>Ce(e,t,r,"hsl");Oe.hsv=(e,t,r)=>Ce(e,t,r,"hsv");Oe.oklab=(e,t,r)=>{const n=e.oklab(),a=t.oklab();return new h(n[0]+r*(a[0]-n[0]),n[1]+r*(a[1]-n[1]),n[2]+r*(a[2]-n[2]),"oklab")};Oe.oklch=(e,t,r)=>Ce(e,t,r,"oklch");const{pow:Se,sqrt:ze,PI:Ye,cos:Fe,sin:Ie,atan2:Ue}=Math;const Ve=(e,r)=>{const n=e.length,a=[0,0,0,0];for(let t=0;t<e.length;t++){const f=e[t],o=r[t]/n,c=f._rgb;a[0]+=Se(c[0],2)*o,a[1]+=Se(c[1],2)*o,a[2]+=Se(c[2],2)*o,a[3]+=c[3]*o}return a[0]=ze(a[0]),a[1]=ze(a[1]),a[2]=ze(a[2]),a[3]>.9999999&&(a[3]=1),new h(t(a))},{pow:Xe}=Math;function De(e){let t="rgb",r=b("#ccc"),a=0,f=[0,1],o=[],c=[0,0],s=!1,l=[],u=!1,i=0,h=1,d=!1,g={},p=!0,m=1;const w=function(e){if((e=e||["#fff","#000"])&&"string"===n(e)&&b.brewer&&b.brewer[e.toLowerCase()]&&(e=b.brewer[e.toLowerCase()]),"array"===n(e)){1===e.length&&(e=[e[0],e[0]]),e=e.slice(0);for(let t=0;t<e.length;t++)e[t]=b(e[t]);o.length=0;for(let t=0;t<e.length;t++)o.push(t/(e.length-1))}return N(),l=e};let y=e=>e,k=e=>e;const v=function(e,a){let f,u;if(null==a&&(a=!1),isNaN(e)||null===e)return r;if(a)u=e;else if(s&&s.length>2){u=function(e){if(null!=s){const t=s.length-1;let r=0;for(;r<t&&e>=s[r];)r++;return r-1}return 0}(e)/(s.length-2)}else u=h!==i?(e-i)/(h-i):1;u=k(u),a||(u=y(u)),1!==m&&(u=Xe(u,m)),u=c[0]+u*(1-c[0]-c[1]),u=Math.min(1,Math.max(0,u));const d=Math.floor(1e4*u);if(p&&g[d])f=g[d];else{if("array"===n(l))for(let e=0;e<o.length;e++){const r=o[e];if(u<=r){f=l[e];break}if(u>=r&&e===o.length-1){f=l[e];break}if(u>r&&u<o[e+1]){u=(u-r)/(o[e+1]-r),f=b.interpolate(l[e],l[e+1],u,t);break}}else"function"===n(l)&&(f=l(u));p&&(g[d]=f)}return f};var N=()=>g={};w(e);const _=function(e){const t=b(v(e));return u&&t[u]?t[u]():t};return _.classes=function(e){if(null!=e){if("array"===n(e))s=e,f=[e[0],e[e.length-1]];else{const t=b.analyze(f);s=0===e?[t.min,t.max]:b.limits(t,"e",e)}return _}return s},_.domain=function(e){if(!arguments.length)return f;i=e[0],h=e[e.length-1],o=[];const t=l.length;if(e.length===t&&i!==h)for(let t of Array.from(e))o.push((t-i)/(h-i));else{for(let e=0;e<t;e++)o.push(e/(t-1));if(e.length>2){const t=e.map(((t,r)=>r/(e.length-1))),r=e.map((e=>(e-i)/(h-i)));r.every(((e,r)=>t[r]===e))||(k=e=>{if(e<=0||e>=1)return e;let n=0;for(;e>=r[n+1];)n++;const a=(e-r[n])/(r[n+1]-r[n]);return t[n]+a*(t[n+1]-t[n])})}}return f=[i,h],_},_.mode=function(e){return arguments.length?(t=e,N(),_):t},_.range=function(e,t){return w(e),_},_.out=function(e){return u=e,_},_.spread=function(e){return arguments.length?(a=e,_):a},_.correctLightness=function(e){return null==e&&(e=!0),d=e,N(),y=d?function(e){const t=v(0,!0).lab()[0],r=v(1,!0).lab()[0],n=t>r;let a=v(e,!0).lab()[0];const f=t+(r-t)*e;let o=a-f,c=0,s=1,l=20;for(;Math.abs(o)>.01&&l-- >0;)n&&(o*=-1),o<0?(c=e,e+=.5*(s-e)):(s=e,e+=.5*(c-e)),a=v(e,!0).lab()[0],o=a-f;return e}:e=>e,_},_.padding=function(e){return null!=e?("number"===n(e)&&(e=[e,e]),c=e,_):c},_.colors=function(t,r){arguments.length<2&&(r="hex");let n=[];if(0===arguments.length)n=l.slice(0);else if(1===t)n=[_(.5)];else if(t>1){const e=f[0],r=f[1]-e;n=function(e,t,r){let n=[],a=e<t,f=r?a?t+1:t-1:t;for(let t=e;a?t<f:t>f;a?t++:t--)n.push(t);return n}(0,t,!1).map((n=>_(e+n/(t-1)*r)))}else{e=[];let t=[];if(s&&s.length>2)for(let e=1,r=s.length,n=1<=r;n?e<r:e>r;n?e++:e--)t.push(.5*(s[e-1]+s[e]));else t=f;n=t.map((e=>_(e)))}return b[r]&&(n=n.map((e=>e[r]()))),n},_.cache=function(e){return null!=e?(p=e,_):p},_.gamma=function(e){return null!=e?(m=e,_):m},_.nodata=function(e){return null!=e?(r=b(e),_):r},_}const{floor:He,random:Je}=Math;const{pow:Ke,sin:Qe,cos:Te}=Math;const We=(e,t,r)=>{if(!We[r])throw new Error("unknown blend mode "+r);return We[r](e,t)},Ze=e=>(t,r)=>{const n=b(r).rgb(),a=b(t).rgb();return b.rgb(e(n,a))},et=e=>(t,r)=>{const n=[];return n[0]=e(t[0],r[0]),n[1]=e(t[1],r[1]),n[2]=e(t[2],r[2]),n};We.normal=Ze(et((e=>e))),We.multiply=Ze(et(((e,t)=>e*t/255))),We.screen=Ze(et(((e,t)=>255*(1-(1-e/255)*(1-t/255))))),We.overlay=Ze(et(((e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255))))),We.darken=Ze(et(((e,t)=>e>t?t:e))),We.lighten=Ze(et(((e,t)=>e>t?e:t))),We.dodge=Ze(et(((e,t)=>255===e||(e=t/255*255/(1-e/255))>255?255:e))),We.burn=Ze(et(((e,t)=>255*(1-(1-t/255)/(e/255)))));const{log:tt,pow:rt,floor:nt,abs:at}=Math,ft=(e,t=null)=>{const r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===n(e)&&(e=Object.values(e)),e.forEach((e=>{t&&"object"===n(e)&&(e=e[t]),null==e||isNaN(e)||(r.values.push(e),r.sum+=e,e<r.min&&(r.min=e),e>r.max&&(r.max=e),r.count+=1)})),r.domain=[r.min,r.max],r.limits=(e,t)=>ot(r,e,t),r},ot=(e,t="equal",r=7)=>{"array"==n(e)&&(e=ft(e));const{min:a,max:f}=e,o=e.values.sort(((e,t)=>e-t));if(1===r)return[a,f];const c=[];if("c"===t.substr(0,1)&&(c.push(a),c.push(f)),"e"===t.substr(0,1)){c.push(a);for(let e=1;e<r;e++)c.push(a+e/r*(f-a));c.push(f)}else if("l"===t.substr(0,1)){if(a<=0)throw new Error("Logarithmic scales are only possible for values > 0");const e=Math.LOG10E*tt(a),t=Math.LOG10E*tt(f);c.push(a);for(let n=1;n<r;n++)c.push(rt(10,e+n/r*(t-e)));c.push(f)}else if("q"===t.substr(0,1)){c.push(a);for(let e=1;e<r;e++){const t=(o.length-1)*e/r,n=nt(t);if(n===t)c.push(o[n]);else{const e=t-n;c.push(o[n]*(1-e)+o[n+1]*e)}}c.push(f)}else if("k"===t.substr(0,1)){let e;const t=o.length,n=new Array(t),s=new Array(r);let l=!0,u=0,i=null;i=[],i.push(a);for(let e=1;e<r;e++)i.push(a+e/r*(f-a));for(i.push(f);l;){for(let e=0;e<r;e++)s[e]=0;for(let e=0;e<t;e++){const t=o[e];let a,f=Number.MAX_VALUE;for(let o=0;o<r;o++){const r=at(i[o]-t);r<f&&(f=r,a=o),s[a]++,n[e]=a}}const a=new Array(r);for(let e=0;e<r;e++)a[e]=null;for(let r=0;r<t;r++)e=n[r],null===a[e]?a[e]=o[r]:a[e]+=o[r];for(let e=0;e<r;e++)a[e]*=1/s[e];l=!1;for(let e=0;e<r;e++)if(a[e]!==i[e]){l=!0;break}i=a,u++,u>200&&(l=!1)}const h={};for(let e=0;e<r;e++)h[e]=[];for(let r=0;r<t;r++)e=n[r],h[e].push(o[r]);let b=[];for(let e=0;e<r;e++)b.push(h[e][0]),b.push(h[e][h[e].length-1]);b=b.sort(((e,t)=>e-t)),c.push(b[0]);for(let e=1;e<b.length;e+=2){const t=b[e];isNaN(t)||-1!==c.indexOf(t)||c.push(t)}}return c};var ct={analyze:ft,limits:ot};const{sqrt:st,pow:lt,min:ut,max:it,atan2:ht,abs:bt,cos:dt,sin:gt,exp:pt,PI:mt}=Math;var wt={cool:()=>De([b.hsl(180,1,.9),b.hsl(250,.7,.4)]),hot:()=>De(["#000","#f00","#ff0","#fff"]).mode("rgb")};const yt={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]};for(let e of Object.keys(yt))yt[e.toLowerCase()]=yt[e];b.average=(e,t="lrgb",r=null)=>{const n=e.length;r||(r=Array.from(new Array(n)).map((()=>1)));const a=n/r.reduce((function(e,t){return e+t}));if(r.forEach(((e,t)=>{r[t]*=a})),e=e.map((e=>new h(e))),"lrgb"===t)return Ve(e,r);const f=e.shift(),o=f.get(t),c=[];let s=0,l=0;for(let e=0;e<o.length;e++)if(o[e]=(o[e]||0)*("h"===t.charAt(e)?1:r[0]),c.push(isNaN(o[e])?0:r[0]),"h"===t.charAt(e)&&!isNaN(o[e])){const t=o[e]/180*Ye;s+=Fe(t)*r[0],l+=Ie(t)*r[0]}let u=f.alpha()*r[0];e.forEach(((e,n)=>{const a=e.get(t);u+=e.alpha()*r[n+1];for(let e=0;e<o.length;e++)if(!isNaN(a[e]))if(c[e]+=r[n+1],"h"===t.charAt(e)){const t=a[e]/180*Ye;s+=Fe(t)*r[n+1],l+=Ie(t)*r[n+1]}else o[e]+=a[e]*r[n+1]}));for(let e=0;e<o.length;e++)if("h"===t.charAt(e)){let t=Ue(l/c[e],s/c[e])/Ye*180;for(;t<0;)t+=360;for(;t>=360;)t-=360;o[e]=t}else o[e]=o[e]/c[e];return u/=n,new h(o,t).alpha(u>.99999?1:u,!0)},b.bezier=e=>{const t=function(e){let t,r,n,a;if(2===(e=e.map((e=>new h(e)))).length)[r,n]=e.map((e=>e.lab())),t=function(t){const a=(e,r)=>e+t*(r-e),f=[0,1,2].map((e=>a(r[e],n[e]))),o=a(e[0].alpha(),e[1].alpha());return new h(f,"lab").alpha(o)};else if(3===e.length)[r,n,a]=e.map((e=>e.lab())),t=function(t){const f=(e,r,n)=>(1-t)*(1-t)*e+2*(1-t)*t*r+t*t*n,o=[0,1,2].map((e=>f(r[e],n[e],a[e]))),c=f(e[0].alpha(),e[1].alpha(),e[2].alpha());return new h(o,"lab").alpha(c)};else if(4===e.length){let f;[r,n,a,f]=e.map((e=>e.lab())),t=function(t){const o=(e,r,n,a)=>(1-t)*(1-t)*(1-t)*e+3*(1-t)*(1-t)*t*r+3*(1-t)*t*t*n+t*t*t*a,c=[0,1,2].map((e=>o(r[e],n[e],a[e],f[e]))),s=o(e[0].alpha(),e[1].alpha(),e[2].alpha(),e[3].alpha());return new h(c,"lab").alpha(s)}}else{if(!(e.length>=5))throw new RangeError("No point in running bezier with only one color.");{let r,n,a;r=e.map((e=>e.lab())),a=e.length-1,n=function(e){let t=[1,1];for(let r=1;r<e;r++){let e=[1];for(let r=1;r<=t.length;r++)e[r]=(t[r]||0)+t[r-1];t=e}return t}(a),t=function(t){const f=1-t,o=(e,r)=>r.reduce(((r,o,c)=>r+n[c]*f**(a-c)*t**c*o[e]),0),c=[0,1,2].map((e=>o(e,r))),s=o(0,e.map((e=>[e.alpha()])));return new h(c,"lab").alpha(s)}}}return t}(e);return t.scale=()=>De(t),t},b.blend=We,b.cubehelix=function(e=300,r=-1.5,a=1,f=1,o=[0,1]){let s,l=0;"array"===n(o)?s=o[1]-o[0]:(s=0,o=[o,o]);const u=function(n){const u=c*((e+120)/360+r*n),i=Ke(o[0]+s*n,f),h=(0!==l?a[0]+n*l:a)*i*(1-i)/2,d=Te(u),g=Qe(u);return b(t([255*(i+h*(-.14861*d+1.78277*g)),255*(i+h*(-.29227*d-.90649*g)),255*(i+h*(1.97294*d)),1]))};return u.start=function(t){return null==t?e:(e=t,u)},u.rotations=function(e){return null==e?r:(r=e,u)},u.gamma=function(e){return null==e?f:(f=e,u)},u.hue=function(e){return null==e?a:("array"===n(a=e)?(l=a[1]-a[0],0===l&&(a=a[1])):l=0,u)},u.lightness=function(e){return null==e?o:("array"===n(e)?(o=e,s=e[1]-e[0]):(o=[e,e],s=0),u)},u.scale=()=>b.scale(u),u.hue(a),u},b.mix=b.interpolate=Pe,b.random=()=>{let e="#";for(let t=0;t<6;t++)e+="0123456789abcdef".charAt(He(16*Je()));return new h(e,"hex")},b.scale=De,b.analyze=ct.analyze,b.contrast=(e,t)=>{e=new h(e),t=new h(t);const r=e.luminance(),n=t.luminance();return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)},b.deltaE=function(e,t,r=1,n=1,a=1){var f=function(e){return 360*e/(2*mt)},o=function(e){return 2*mt*e/360};e=new h(e),t=new h(t);const[c,s,l]=Array.from(e.lab()),[u,i,b]=Array.from(t.lab()),d=(c+u)/2,g=(st(lt(s,2)+lt(l,2))+st(lt(i,2)+lt(b,2)))/2,p=.5*(1-st(lt(g,7)/(lt(g,7)+lt(25,7)))),m=s*(1+p),w=i*(1+p),y=st(lt(m,2)+lt(l,2)),k=st(lt(w,2)+lt(b,2)),v=(y+k)/2,N=f(ht(l,m)),_=f(ht(b,w)),M=N>=0?N:N+360,x=_>=0?_:_+360,A=bt(M-x)>180?(M+x+360)/2:(M+x)/2,$=1-.17*dt(o(A-30))+.24*dt(o(2*A))+.32*dt(o(3*A+6))-.2*dt(o(4*A-63));let E=x-M;E=bt(E)<=180?E:x<=M?E+360:E-360,E=2*st(y*k)*gt(o(E)/2);const j=u-c,q=k-y,L=1+.015*lt(d-50,2)/st(20+lt(d-50,2)),O=1+.045*v,P=1+.015*v*$,G=30*pt(-lt((A-275)/25,2)),B=-(2*st(lt(v,7)/(lt(v,7)+lt(25,7))))*gt(2*o(G)),C=st(lt(j/(r*L),2)+lt(q/(n*O),2)+lt(E/(a*P),2)+B*(q/(n*O))*(E/(a*P)));return it(0,ut(100,C))},b.distance=function(e,t,r="lab"){e=new h(e),t=new h(t);const n=e.get(r),a=t.get(r);let f=0;for(let e in n){const t=(n[e]||0)-(a[e]||0);f+=t*t}return Math.sqrt(f)},b.limits=ct.limits,b.valid=(...e)=>{try{return new h(...e),!0}catch(e){return!1}},b.scales=wt,b.colors=de,b.brewer=yt;export{b as default};