From 90cc076bf9e3c6bf40e40a59f4c7b140b37bdf94 Mon Sep 17 00:00:00 2001 From: regorxxx Date: Sun, 10 Mar 2024 11:50:37 +0100 Subject: [PATCH] Update docs. Update build. Signed-off-by: regorxxx --- CHANGELOG.md | 1 + chroma.js | 4 +++- chroma.min.js | 2 +- docs/index.html | 1 + docs/libs/chroma.js | 4 +++- docs/libs/chroma.min.js | 2 +- 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a42e39df..40c9af6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * added 'supported color spaces' to documentation * minor improvements to documentation * fix wrong handling of RGB and RGBA arrays when constructing chroma color objects. +* fix wrong handling of values outside scale domain due to internal Math.pow usage. See [Issue 331](https://github.com/gka/chroma.js/issues/331) ### 2.7.0 * added `chroma.brewer.getPalettes()` to retrieve all available palettes (keys). [ColorBrewer](http://colorbrewer2.org/) schemes (scales) are divided into palettes according to their type diff --git a/chroma.js b/chroma.js index 8e339cf7..88e82087 100644 --- a/chroma.js +++ b/chroma.js @@ -2948,7 +2948,9 @@ t = tMapLightness(t); // lightness correction } - if (_gamma !== 1) { t = pow$3(t, _gamma); } + if (t > 1) { t = 1; } // pow fails with negative bases, but values are always clamped to the extremes + else if (t < 0) { t = 0; } + else if (_gamma !== 1) { t = pow$3(t, _gamma); } t = _padding[0] + (t * (1 - _padding[0] - _padding[1])); diff --git a/chroma.min.js b/chroma.min.js index b961e4e7..29c5a511 100644 --- a/chroma.min.js +++ b/chroma.min.js @@ -83,4 +83,4 @@ * @preserve */ -!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";for(var r=function(r,n,e){return void 0===n&&(n=0),void 0===e&&(e=1),re?e:r},n=r,e={},t=0,a=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];t255)&&(r._clipped=!0),r[e]=n(r[e],0,255)):3===e&&(r[e]=n(r[e],0,1));return r},limit:r,type:o,unpack:function(r,n){return void 0===n&&(n=null),r.length>=3?Array.prototype.slice.call(r):"object"==u(r[0])&&n?n.split("").filter((function(n){return void 0!==r[0][n]})).map((function(n){return r[0][n]})):r[0]},last:function(r){if(r.length<2)return null;var n=r.length-1;return"string"==c(r[n])?r[n].toLowerCase():null},PI:i,TWOPI:2*i,PITHIRD:i/3,DEG2RAD:i/180,RAD2DEG:180/i},h={format:{},autodetect:[]},s=l.last,d=l.clip_rgb,b=l.type,p=h,g=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=this;if("object"===b(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];"array"===b(r[0])&&1===r.length&&(r=[].concat(r[0]));var t=s(r),a=!1;if(!t){a=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(r,n){return n.p-r.p})),p.sorted=!0);for(var f=0,o=p.autodetect;f4?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]},A=y,P=v,x=h,E=l.unpack,O=l.type,G=N;P.prototype.cmyk=function(){return G(this._rgb)},A.cmyk=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(P,[null].concat(r,["cmyk"])))},x.format.cmyk=_,x.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=E(r,"cmyk"),"array"===O(r)&&4===r.length)return"cmyk"}});var R=l.unpack,j=l.last,B=function(r){return Math.round(100*r)/100},F=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=R(r,"hsla"),t=j(r)||"lsa";return e[0]=B(e[0]||0),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+"("+e.join(",")+")"},q=l.unpack,L=y,Y=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=q(r,"rgba"))[0],t=r[1],a=r[2];e/=255,t/=255,a/=255;var f,o,u=Math.min(e,t,a),c=Math.max(e,t,a),i=(c+u)/2;return c===u?(f=0,o=L.hueNaN?Number.NaN:0):f=i<.5?(c-u)/(c+u):(c-u)/(2-c-u),e==c?o=(t-a)/(c-u):t==c?o=2+(a-e)/(c-u):a==c&&(o=4+(e-t)/(c-u)),(o*=60)<0?o+=360:!L.hueNaN&&isNaN(o)&&(o=0),r.length>3&&void 0!==r[3]?[o,f,i,r[3]]:[o,f,i]},D=l.unpack,S=l.last,C=function(r){return Math.round(100*r)/100},I=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=D(r,"lch"),t=S(r)||"lch";return e[0]=C(e[0])+"%",e[1]=C(e[1])+"%",e[2]=C(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lch("+e.join(" ")+")"},$={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},z=$,T=l.unpack,W=Math.pow,X=function(r){return(r/=255)<=.04045?r/12.92:W((r+.055)/1.055,2.4)},V=function(r){return r>z.t3?W(r,1/3):r/z.t2+z.t0},U=function(r,n,e){return r=X(r),n=X(n),e=X(e),[V((.4124564*r+.3575761*n+.1804375*e)/z.Xn),V((.2126729*r+.7151522*n+.072175*e)/z.Yn),V((.0193339*r+.119192*n+.9503041*e)/z.Zn)]},Z=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=T(r,"rgb"),t=e[0],a=e[1],f=e[2],o=U(t,a,f),u=o[0],c=o[1],i=116*c-16;return[i<0?0:i,500*(u-c),200*(c-o[2])]},H=l.unpack,K=l.RAD2DEG,Q=Math.sqrt,J=Math.atan2,rr=Math.round,nr=y,er=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=H(r,"lab"),t=e[0],a=e[1],f=e[2],o=Q(a*a+f*f),u=(J(f,a)*K+360)%360;return 0===rr(1e4*o)&&(u=nr.hueNaN?Number.NaN:0),[t,o,u]},tr=l.unpack,ar=Z,fr=er,or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=tr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=ar(t,a,f),u=o[0],c=o[1],i=o[2];return fr(u,c,i)},ur=l.unpack,cr=l.last,ir=function(r){return Math.round(100*r)/100},lr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ur(r,"lab"),t=cr(r)||"lab";return e[0]=ir(e[0])+"%",e[1]=ir(e[1])+"%",e[2]=ir(e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lab("+e.join(" ")+")"},hr=l.unpack,sr=l.last,dr=function(r){return Math.round(100*r)/100},br=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=hr(r,"lab"),t=sr(r)||"lab";return e[0]=dr(100*e[0])+"%",e[1]=dr(100*e[1])+"%",e[2]=dr(100*e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklab("+e.join(" ")+")"},pr=l.unpack,gr=Math.cbrt,vr=Math.pow,mr=Math.sign,yr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=[kr(t/255),kr(a/255),kr(f/255)],u=o[0],c=o[1],i=o[2],l=gr(.4122214708*u+.5363325363*c+.0514459929*i),h=gr(.2119034982*u+.6806995451*c+.1073969566*i),s=gr(.0883024619*u+.2817188376*c+.6299787005*i);return[.2104542553*l+.793617785*h-.0040720468*s,1.9779984951*l-2.428592205*h+.4505937099*s,.0259040371*l+.7827717662*h-.808675766*s]};function kr(r){var n=Math.abs(r);return n<.04045?r/12.92:(mr(r)||1)*vr((n+.055)/1.055,2.4)}var wr=l.unpack,Nr=l.last,Mr=function(r){return Math.round(100*r)/100},_r=Math.min,Ar=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=wr(r,"lch"),t=Nr(r)||"lch";return e[0]=Mr(100*e[0])+"%",e[1]=_r(Mr(e[1]/.4*100),100)+"%",e[2]=Mr(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklch("+e.join(" ")+")"},Pr=l.unpack,xr=yr,Er=er,Or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=xr(t,a,f),u=o[0],c=o[1],i=o[2];return Er(u,c,i)},Gr=l.unpack,Rr=l.last,jr=F,Br=Y,Fr=I,qr=or,Lr=lr,Yr=Z,Dr=br,Sr=yr,Cr=Ar,Ir=Or,$r=Math.round,zr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Gr(r,"rgba"),t=Rr(r)||"rgb";return"hsl"==t.substring(0,3)?jr(Br(e),t):"lch"==t.substring(0,3)?Fr(qr(e),t):"lab"==t.substring(0,3)?Lr(Yr(e).concat([e.length>3?e[3]:1]),t):"oklab"==t.substring(0,5)?Dr(Sr(e).concat([e.length>3?e[3]:1]),"lab"):"oklch"==t.substring(0,5)?Cr(Ir(e).concat([e.length>3?e[3]:1]),"lch"):(e[0]=$r(e[0]),e[1]=$r(e[1]),e[2]=$r(e[2]),("rgba"===t||e.length>3&&e[3]<1)&&(e[3]=e.length>3?e[3]:1,t="rgba"),t+"("+e.slice(0,"rgb"===t?3:4).join(",")+")")},Tr=l.unpack,Wr=Math.round,Xr=function(){for(var r,n=[],e=arguments.length;e--;)n[e]=arguments[e];var t,a,f,o=(n=Tr(n,"hsl"))[0],u=n[1],c=n[2];if(0===u)t=a=f=255*c;else{var i=[0,0,0],l=[0,0,0],h=c<.5?c*(1+u):c+u-c*u,s=2*c-h,d=o/360;i[0]=d+1/3,i[1]=d,i[2]=d-1/3;for(var b=0;b<3;b++)i[b]<0&&(i[b]+=1),i[b]>1&&(i[b]-=1),6*i[b]<1?l[b]=s+6*(h-s)*i[b]:2*i[b]<1?l[b]=h:3*i[b]<2?l[b]=s+(h-s)*(2/3-i[b])*6:l[b]=s;t=(r=[Wr(255*l[0]),Wr(255*l[1]),Wr(255*l[2])])[0],a=r[1],f=r[2]}return n.length>3?[t,a,f,n[3]]:[t,a,f,1]},Vr=$,Ur=l.unpack,Zr=Math.pow,Hr=function(r){return 255*(r<=.00304?12.92*r:1.055*Zr(r,1/2.4)-.055)},Kr=function(r){return r>Vr.t1?r*r*r:Vr.t2*(r-Vr.t0)},Qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ur(r,"lab"))[0],o=r[1],u=r[2];return t=(f+16)/116,e=isNaN(o)?t:t+o/500,a=isNaN(u)?t:t-u/200,t=Vr.Yn*Kr(t),e=Vr.Xn*Kr(e),a=Vr.Zn*Kr(a),[Hr(3.2404542*e-1.5371385*t-.4985314*a),Hr(-.969266*e+1.8760108*t+.041556*a),Hr(.0556434*e-.2040259*t+1.0572252*a),r.length>3?r[3]:1]},Jr=l.unpack,rn=l.DEG2RAD,nn=Math.sin,en=Math.cos,tn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Jr(r,"lch"),t=e[0],a=e[1],f=e[2];return isNaN(f)&&(f=0),[t,en(f*=rn)*a,nn(f)*a]},an=l.unpack,fn=tn,on=Qr,un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=an(r,"lch"))[0],t=r[1],a=r[2],f=fn(e,t,a),o=f[0],u=f[1],c=f[2],i=on(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},cn=l.unpack,ln=Math.pow,hn=Math.sign,sn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=cn(r,"lab"))[0],t=r[1],a=r[2],f=ln(e+.3963377774*t+.2158037573*a,3),o=ln(e-.1055613458*t-.0638541728*a,3),u=ln(e-.0894841775*t-1.291485548*a,3);return[255*dn(4.0767416621*f-3.3077115913*o+.2309699292*u),255*dn(-1.2684380046*f+2.6097574011*o-.3413193965*u),255*dn(-.0041960863*f-.7034186147*o+1.707614701*u),r.length>3?r[3]:1]};function dn(r){var n=Math.abs(r);return n>.0031308?(hn(r)||1)*(1.055*ln(n,1/2.4)-.055):12.92*r}var bn=l.unpack,pn=tn,gn=sn,vn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=bn(r,"lch"))[0],t=r[1],a=r[2],f=pn(e,t,a),o=f[0],u=f[1],c=f[2],i=gn(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},mn=Xr,yn=Qr,kn=un,wn=sn,Nn=vn,Mn=h,_n=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,An=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Pn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,xn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,En=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,On=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gn=/^lab\(\s*(\d+(?:\.\d+)?)%?\s* (-?\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)%?\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Rn=/^lch\(\s*(\d+(?:\.\d+)?)%?\s* (\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,jn=/^oklab\(\s*(\d+(?:\.\d+)?%?)\s* (-?\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?%?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Bn=/^oklch\(\s*(\d+(?:\.\d+)?%?)\s* (\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Fn=Math.round,qn=Math.abs,Ln=function(r){var n;if(r=r.toLowerCase().trim(),Mn.format.named)try{return Mn.format.named(r)}catch(r){}if(n=r.match(_n)){for(var e=n.slice(1,4),t=0;t<3;t++)e[t]=Number(e[t]);return e[3]=1,e}if(n=r.match(An)){for(var a=n.slice(1,5),f=0;f<4;f++)a[f]=Number(a[f]);return a}if(n=r.match(Pn)){for(var o=n.slice(1,4),u=0;u<3;u++)o[u]=Fn(2.55*Number(o[u]));return o[3]=1,o}if(n=r.match(xn)){for(var c=n.slice(1,5),i=0;i<3;i++)c[i]=Fn(2.55*Number(c[i]));return c[3]=Number(c[3]),c}if(n=r.match(En)){for(var l=n.slice(1,4),h=0;h<=2;h++)l[h]=Number(l[h]);l[1]*=.01,l[2]*=.01;var s=mn(l);return s[3]=1,s}if(n=r.match(On)){for(var d=n.slice(1,4),b=0;b<=2;b++)d[b]=Number(d[b]);d[1]*=.01,d[2]*=.01;var p=mn(d);return p[3]=Number(n[4]),p}if(n=r.match(Gn)){for(var g=n.slice(1,4),v=0;v<=2;v++)g[v]=Number(g[v]);var m=yn(g).map((function(r){return qn(Fn(r))}));return m[3]=Number(n[4]),m[3]||0===m[3]||(m[3]=1),m}if(n=r.match(Rn)){for(var y=n.slice(1,4),k=0;k<=2;k++)y[k]=Number(y[k]);var w=kn(y).map((function(r){return qn(Fn(r))}));return w[3]=Number(n[4]),w[3]||0===w[3]||(w[3]=1),w}if(n=r.match(jn)){for(var N=n.slice(1,4),M=0;M<=2;M++)N[M].endsWith("%")?N[M]=.01*Number(N[M].replace("%","")):N[M]=Number(N[M]);var _=wn(N).map((function(r){return qn(Fn(r))}));return _[3]=Number(n[4]),_[3]||0===_[3]||(_[3]=1),_}if(n=r.match(Bn)){for(var A=n.slice(1,4),P=0;P<=1;P++)A[P].endsWith("%")?(A[P]=.01*Number(A[P].replace("%","")),1===P&&(A[P]*=.4)):A[P]=Number(A[P]);var x=Nn(A).map((function(r){return qn(Fn(r))}));return x[3]=Number(n[4]),x[3]||0===x[3]||(x[3]=1),x}};Ln.test=function(r){return _n.test(r)||An.test(r)||Pn.test(r)||xn.test(r)||En.test(r)||On.test(r)||Gn.test(r)||Rn.test(r)||jn.test(r)||Bn.test(r)};var Yn=y,Dn=v,Sn=h,Cn=l.type,In=zr,$n=Ln;Dn.prototype.css=function(r){return In(this._rgb,r)},Yn.css=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Dn,[null].concat(r,["css"])))},Sn.format.css=$n,Sn.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"===Cn(r)&&$n.test(r))return"css"}});var zn=v,Tn=y,Wn=l.unpack;h.format.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Wn(r,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e},Tn.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(zn,[null].concat(r,["gl"])))},zn.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var Xn=l.unpack,Vn=y,Un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=Xn(r,"rgb"),a=t[0],f=t[1],o=t[2],u=Math.min(a,f,o),c=Math.max(a,f,o),i=c-u,l=100*i/255,h=u/(255-i)*100;return 0===i?e=Vn.hueNaN?Number.NaN:0:(a===c&&(e=(f-o)/i),f===c&&(e=2+(o-a)/i),o===c&&(e=4+(a-f)/i),(e*=60)<0?e+=360:!Vn.hueNaN&&isNaN(e)&&(e=0)),[e,l,h]},Zn=l.unpack,Hn=Math.floor,Kn=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Zn(o,"hcg"))[0],s=o[1],d=o[2];d*=255;var b=255*s;if(0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var p=Hn(h/=60),g=h-p,v=d*(1-s),m=v+b*(1-g),y=v+b*g,k=v+b;switch(p){case 0:c=(r=[k,y,v])[0],i=r[1],l=r[2];break;case 1:c=(n=[m,k,v])[0],i=n[1],l=n[2];break;case 2:c=(e=[v,k,y])[0],i=e[1],l=e[2];break;case 3:c=(t=[v,m,k])[0],i=t[1],l=t[2];break;case 4:c=(a=[y,v,k])[0],i=a[1],l=a[2];break;case 5:c=(f=[k,v,m])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Qn=l.unpack,Jn=l.type,re=y,ne=v,ee=h,te=Un;ne.prototype.hcg=function(){return te(this._rgb)},re.hcg=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ne,[null].concat(r,["hcg"])))},ee.format.hcg=Kn,ee.autodetect.push({p:1,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Qn(r,"hcg"),"array"===Jn(r)&&3===r.length)return"hcg"}});var ae=l.unpack,fe=l.last,oe=Math.round,ue=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ae(r,"rgba"),t=e[0],a=e[1],f=e[2],o=e[3],u=fe(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c="000000"+((t=oe(t))<<16|(a=oe(a))<<8|(f=oe(f))).toString(16);c=c.substring(c.length-6);var i="0"+oe(255*o).toString(16);switch(i=i.substring(i.length-2),u.toLowerCase()){case"rgba":return"#"+c+i;case"argb":return"#"+i+c;default:return"#"+c}},ce=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,ie=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,le=function(r){if(r.match(ce)){4!==r.length&&7!==r.length||(r=r.substring(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(ie)){5!==r.length&&9!==r.length||(r=r.substring(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)},he=y,se=v,de=l.type,be=h,pe=ue;se.prototype.hex=function(r){return pe(this._rgb,r)},he.hex=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(se,[null].concat(r,["hex"])))},be.format.hex=le,be.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"===de(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var ge=l.unpack,ve=l.TWOPI,me=Math.min,ye=Math.sqrt,ke=Math.acos,we=y,Ne=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=ge(r,"rgb"),a=t[0],f=t[1],o=t[2],u=me(a/=255,f/=255,o/=255),c=(a+f+o)/3,i=c>0?1-u/c:0;return 0===i?e=we.hueNaN?Number.NaN:0:(e=(a-f+(a-o))/2,e/=ye((a-f)*(a-f)+(a-o)*(f-o)),e=ke(e),o>f&&(e=ve-e),e/=ve,!we.hueNaN&&isNaN(e)&&(e=0)),[360*e,i,c]},Me=l.unpack,_e=l.limit,Ae=l.TWOPI,Pe=l.PITHIRD,xe=Math.cos,Ee=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Me(r,"hsi"))[0],o=r[1],u=r[2];return isNaN(f)&&(f=0),isNaN(o)&&(o=0),f>360&&(f-=360),f<0&&(f+=360),(f/=360)<1/3?t=1-((a=(1-o)/3)+(e=(1+o*xe(Ae*f)/xe(Pe-Ae*f))/3)):f<2/3?a=1-((e=(1-o)/3)+(t=(1+o*xe(Ae*(f-=1/3))/xe(Pe-Ae*f))/3)):e=1-((t=(1-o)/3)+(a=(1+o*xe(Ae*(f-=2/3))/xe(Pe-Ae*f))/3)),[255*(e=_e(u*e*3)),255*(t=_e(u*t*3)),255*(a=_e(u*a*3)),r.length>3?r[3]:1]},Oe=l.unpack,Ge=l.type,Re=y,je=v,Be=h,Fe=Ne;je.prototype.hsi=function(){return Fe(this._rgb)},Re.hsi=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(je,[null].concat(r,["hsi"])))},Be.format.hsi=Ee,Be.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Oe(r,"hsi"),"array"===Ge(r)&&3===r.length)return"hsi"}});var qe=l.unpack,Le=l.type,Ye=y,De=v,Se=h,Ce=Y;De.prototype.hsl=function(){return Ce(this._rgb)},Ye.hsl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(De,[null].concat(r,["hsl"])))},Se.format.hsl=Xr,Se.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=qe(r,"hsl"),"array"===Le(r)&&3===r.length)return"hsl"}});var Ie=l.unpack,$e=Math.min,ze=Math.max,Te=y,We=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ie(r,"rgb"))[0],o=r[1],u=r[2],c=$e(f,o,u),i=ze(f,o,u),l=i-c;return a=i/255,0===i?(e=Te.hueNaN?Number.NaN:0,t=0):(t=l/i,f===i&&(e=(o-u)/l),o===i&&(e=2+(u-f)/l),u===i&&(e=4+(f-o)/l),(e*=60)<0?e+=360:!Te.hueNaN&&isNaN(e)&&(e=0)),[e,t,a]},Xe=l.unpack,Ve=Math.floor,Ue=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Xe(o,"hsv"))[0],s=o[1],d=o[2];if(d*=255,0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var b=Ve(h/=60),p=h-b,g=d*(1-s),v=d*(1-s*p),m=d*(1-s*(1-p));switch(b){case 0:c=(r=[d,m,g])[0],i=r[1],l=r[2];break;case 1:c=(n=[v,d,g])[0],i=n[1],l=n[2];break;case 2:c=(e=[g,d,m])[0],i=e[1],l=e[2];break;case 3:c=(t=[g,v,d])[0],i=t[1],l=t[2];break;case 4:c=(a=[m,g,d])[0],i=a[1],l=a[2];break;case 5:c=(f=[d,g,v])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Ze=l.unpack,He=l.type,Ke=y,Qe=v,Je=h,rt=We;Qe.prototype.hsv=function(){return rt(this._rgb)},Ke.hsv=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Qe,[null].concat(r,["hsv"])))},Je.format.hsv=Ue,Je.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ze(r,"hsv"),"array"===He(r)&&3===r.length)return"hsv"}});var nt=l.unpack,et=l.type,tt=y,at=v,ft=h,ot=Z;at.prototype.lab=function(){return ot(this._rgb)},tt.lab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(at,[null].concat(r,["lab"])))},ft.format.lab=Qr,ft.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=nt(r,"lab"),"array"===et(r)&&3===r.length)return"lab"}});var ut=l.unpack,ct=un,it=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ut(r,"hcl").reverse();return ct.apply(void 0,e)},lt=l.unpack,ht=l.type,st=y,dt=v,bt=h,pt=or;dt.prototype.lch=function(){return pt(this._rgb)},dt.prototype.hcl=function(){return pt(this._rgb).reverse()},st.lch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["lch"])))},st.hcl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["hcl"])))},bt.format.lch=un,bt.format.hcl=it,["lch","hcl"].forEach((function(r){return bt.autodetect.push({p:2,test:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];if(n=lt(n,r),"array"===ht(n)&&3===n.length)return r}})}));var gt={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",cornflower:"#6495ed",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"},vt=h,mt=l.type,yt=gt,kt=le,wt=ue;v.prototype.name=function(){for(var r=wt(this._rgb,"rgb"),n=0,e=Object.keys(yt);n0;)n[e]=arguments[e+1];if(!n.length&&"string"===mt(r)&&yt[r.toLowerCase()])return"named"}});var Nt=l.unpack,Mt=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Nt(r,"rgb");return(e[0]<<16)+(e[1]<<8)+e[2]},_t=l.type,At=function(r){if("number"==_t(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},Pt=y,xt=v,Et=h,Ot=l.type,Gt=Mt;xt.prototype.num=function(){return Gt(this._rgb)},Pt.num=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(xt,[null].concat(r,["num"])))},Et.format.num=At,Et.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===Ot(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Rt=y,jt=v,Bt=h,Ft=l.unpack,qt=l.type,Lt=Math.round;jt.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Lt)},jt.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:Lt(n):n}))},Rt.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(jt,[null].concat(r,["rgb"])))},Bt.format.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Ft(r,"rgba");return void 0===e[3]&&(e[3]=1),e},Bt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ft(r,"rgba"),"array"===qt(r)&&(3===r.length||4===r.length&&"number"==qt(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var Yt=Math.log,Dt=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*Yt(e),t=a<20?0:.8274096064007395*(t=a-10)-254.76935184120902+115.67994401066147*Yt(t)):(n=351.97690566805693+.114206453784165*(n=a-55)-40.25366309332127*Yt(n),e=325.4494125711974+.07943456536662342*(e=a-50)-28.0852963507957*Yt(e),t=255),[n,e,t,1]},St=Dt,Ct=l.unpack,It=Math.round,$t=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];for(var e,t=Ct(r,"rgb"),a=t[0],f=t[2],o=1e3,u=4e4;u-o>.4;){var c=St(e=.5*(u+o));c[2]/c[0]>=f/a?u=e:o=e}return It(e)},zt=y,Tt=v,Wt=h,Xt=$t;Tt.prototype.temp=Tt.prototype.kelvin=Tt.prototype.temperature=function(){return Xt(this._rgb)},zt.temp=zt.kelvin=zt.temperature=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Tt,[null].concat(r,["temp"])))},Wt.format.temp=Wt.format.kelvin=Wt.format.temperature=Dt;var Vt=l.unpack,Ut=l.type,Zt=y,Ht=v,Kt=h,Qt=yr;Ht.prototype.oklab=function(){return Qt(this._rgb)},Zt.oklab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Ht,[null].concat(r,["oklab"])))},Kt.format.oklab=sn,Kt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Vt(r,"oklab"),"array"===Ut(r)&&3===r.length)return"oklab"}});var Jt=l.unpack,ra=l.type,na=y,ea=v,ta=h,aa=Or;ea.prototype.oklch=function(){return aa(this._rgb)},na.oklch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ea,[null].concat(r,["oklch"])))},ta.format.oklch=vn,ta.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Jt(r,"oklch"),"array"===ra(r)&&3===r.length)return"oklch"}});var fa=l.unpack,oa=l.last,ua=Math.round,ca=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=fa(r,"rgba"),t=(1!==e[3]?oa(r):"rgb")||"rgb";return e[0]=ua(e[0]),e[1]=ua(e[1]),e[2]=ua(e[2]),("rgba"===t||e.length>3&&e[3]<1&&"rgb"!==oa(r))&&(e[3]=e.length>3?e[3]:1,t="rgba"),"rgba"===t?e[3]<<24|e[0]<<16|e[1]<<8|e[2]:4278190080|e[0]<<16|e[1]<<8|e[2]},ia=l.type,la=function(r){if("number"==ia(r)){var n=(r>>24&255)/255;if(n>=0&&n<=1){var e=r-4278190080;return[e>>16&255,e>>8&255,255&e,n]}}throw new Error("unknown android color: "+r)},ha=y,sa=v,da=h,ba=l.type,pa=ca;sa.prototype.android=function(r){return pa(this._rgb,r)},ha.android=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(sa,[null].concat(r,["android"])))},da.format.android=la,da.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===ba(r[0])){var e=(r[0]>>24&255)/255;if(e>=0&&e<=1){var t=r[0]-4278190080;if([t>>16&255,t>>8&255,255&t].every((function(r){return r>=0&&r<=255})))return"android"}}}});var ga=v,va=l.type;ga.prototype.alpha=function(r,n){return void 0===n&&(n=!1),void 0!==r&&"number"===va(r)?n?(this._rgb[3]=r,this):new ga([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},v.prototype.clipped=function(){return this._rgb._clipped||!1};var ma=v,ya=$;ma.prototype.darken=function(r){void 0===r&&(r=1);var n=this.lab();return n[0]-=ya.Kn*r,new ma(n,"lab").alpha(this.alpha(),!0)},ma.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},ma.prototype.darker=ma.prototype.darken,ma.prototype.brighter=ma.prototype.brighten,v.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.substring(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+t+" in mode "+e)}return a};var ka=v,wa=l.type,Na=Math.pow;ka.prototype.luminance=function(r){if(void 0!==r&&"number"===wa(r)){if(0===r)return new ka([0,0,0,this._rgb[3]],"rgb");if(1===r)return new ka([255,255,255,this._rgb[3]],"rgb");var n=this.luminance(),e=20,t=function(n,a){var f=n.interpolate(a,.5,"rgb"),o=f.luminance();return Math.abs(r-o)<1e-7||!e--?f:o>r?t(n,f):t(f,a)},a=(n>r?t(new ka([0,0,0]),this):t(this,new ka([255,255,255]))).rgb();return new ka(a.concat([this._rgb[3]]))}return Ma.apply(void 0,this._rgb.slice(0,3))};var Ma=function(r,n,e){return.2126*(r=_a(r))+.7152*(n=_a(n))+.0722*(e=_a(e))},_a=function(r){return(r/=255)<=.03928?r/12.92:Na((r+.055)/1.055,2.4)},Aa={},Pa=v,xa=l.type,Ea=Aa,Oa=function(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(Ea[f]||t.length||(f=Object.keys(Ea)[0]),!Ea[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==xa(r)&&(r=new Pa(r)),"object"!==xa(n)&&(n=new Pa(n)),Ea[f](r,n,e).alpha(r.alpha()+e*(n.alpha()-r.alpha()))},Ga=v,Ra=Oa;Ga.prototype.mix=Ga.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 Ra.apply(void 0,[this,r,n].concat(e))};var ja=v;ja.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 ja([n[0]*e,n[1]*e,n[2]*e,e],"rgb")};var Ba=v,Fa=$;Ba.prototype.saturate=function(r){void 0===r&&(r=1);var n=this.lch();return n[1]+=Fa.Kn*r,n[1]<0&&(n[1]=0),new Ba(n,"lch").alpha(this.alpha(),!0)},Ba.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)};var qa=v,La=l.type;qa.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.substring(0,2)?2:0);if(u>-1){if("string"==La(n))switch(n.charAt(0)){case"+":case"-":o[u]+=+n;break;case"*":o[u]*=+n.substring(1);break;case"/":o[u]/=+n.substring(1);break;default:o[u]=+n}else{if("number"!==La(n))throw new Error("unsupported value for Color.set");o[u]=n}var c=new qa(o,a);return e?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+f+" in mode "+a)}return o};var Ya=v;Aa.rgb=function(r,n,e){var t=r._rgb,a=n._rgb;return new Ya(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"rgb")};var Da=v,Sa=Math.sqrt,Ca=Math.pow;Aa.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 Da(Sa(Ca(a,2)*(1-e)+Ca(c,2)*e),Sa(Ca(f,2)*(1-e)+Ca(i,2)*e),Sa(Ca(o,2)*(1-e)+Ca(l,2)*e),"rgb")};var Ia=v;Aa.lab=function(r,n,e){var t=r.lab(),a=n.lab();return new Ia(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"lab")};var $a=v,za=function(r,n,e,t){var a,f,o,u,c,i,l,h,s,d,b,p,g;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.substring(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)?p=Number.NaN:(p=i,1!=s&&0!=s||"hsv"==t||(b=h)):(p=c,1!=d&&0!=d||"hsv"==t||(b=l)):p=c+e*(i>c&&i-c>180?i-(c+360):i180?i+360-c:i-c),void 0===b&&(b=l+e*(h-l)),g=s+e*(d-s),new $a("oklch"===t?[g,b,p]:[p,b,g],t)},Ta=za,Wa=function(r,n,e){return Ta(r,n,e,"lch")};Aa.lch=Wa,Aa.hcl=Wa;var Xa=v;Aa.num=function(r,n,e){var t=r.num(),a=n.num();return new Xa(t+e*(a-t),"num")};var Va=za;Aa.hcg=function(r,n,e){return Va(r,n,e,"hcg")};var Ua=za;Aa.hsi=function(r,n,e){return Ua(r,n,e,"hsi")};var Za=za;Aa.hsl=function(r,n,e){return Za(r,n,e,"hsl")};var Ha=za;Aa.hsv=function(r,n,e){return Ha(r,n,e,"hsv")};var Ka=v;Aa.oklab=function(r,n,e){var t=r.oklab(),a=n.oklab();return new Ka(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"oklab")};var Qa=za;Aa.oklch=function(r,n,e){return Qa(r,n,e,"oklch")};var Ja=v,rf=l.clip_rgb,nf=Math.pow,ef=Math.sqrt,tf=Math.PI,af=Math.cos,ff=Math.sin,of=Math.atan2,uf=function(r,n){for(var e=r.length,t=[0,0,0,0],a=0;a.9999999&&(t[3]=1),new Ja(rf(t))},cf=y,lf=l.type,hf=Math.pow,sf=function(r){var n="rgb",e=cf("#ccc"),t=0,a=[0,1],f=[],o=[0,0],u=!1,c=[],i=!1,l=0,h=1,s=!1,d={},b=!0,p=1,g=function(r){if((r=r||["#fff","#000"])&&"string"===lf(r)&&cf.brewer&&cf.brewer.hasOwnProperty(r.toLowerCase())&&"palettes"!==r&&(r=cf.brewer[r.toLowerCase()]),"array"===lf(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var n=0;n2){var s=function(r){if(null!=u){for(var n=u.length-1,e=0;e=u[e];)e++;return e-1}return 0}(r);i=s/(u.length-2)}else i=h!==l?(r-l)/(h-l):1;i=m(i),t||(i=v(i)),1!==p&&(i=hf(i,p)),i=o[0]+i*(1-o[0]-o[1]),i=Math.min(1,Math.max(0,i));var g=Math.floor(1e4*i);if(b&&d[g])a=d[g];else{if("array"===lf(c))for(var y=0;y=k&&y===f.length-1){a=c[y];break}if(i>k&&i2){var i=r.map((function(n,e){return e/(r.length-1)})),s=r.map((function(r){return(r-l)/(h-l)}));s.every((function(r,n){return i[n]===r}))||(m=function(r){if(r<=0||r>=1)return r;for(var n=0;r>=s[n+1];)n++;var e=(r-s[n])/(s[n+1]-s[n]);return i[n]+e*(i[n+1]-i[n])})}}return a=[l,h],w},w.mode=function(r){return arguments.length?(n=r,k(),w):n},w.range=function(r,n){return g(r),w},w.out=function(r){return i=r,w},w.spread=function(r){return arguments.length?(t=r,w):t},w.correctLightness=function(r){return null==r&&(r=!0),s=r,k(),v=s?function(r){for(var n=y(0,!0).lab()[0],e=y(1,!0).lab()[0],t=n>e,a=y(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=y(r,!0).lab()[0],o=a-f;return r}:function(r){return r},w},w.padding=function(r){return null!=r?("number"===lf(r)&&(r=[r,r]),o=r,w):o},w.colors=function(n,e){arguments.length<2&&(e="hex");var t=[];if(0===arguments.length)t=c.slice(0);else if(1===n)t=[w(.5)];else if(n>1){var f=a[0],o=a[1]-f;t=function(r,n,e){for(var t=[],a=rf;a?o++:o--)t.push(o);return t}(0,n,!1).map((function(r){return w(f+r/(n-1)*o)}))}else{r=[];var i=[];if(u&&u.length>2)for(var l=1,h=u.length,s=1<=h;s?lh;s?l++:l--)i.push(.5*(u[l-1]+u[l]));else i=a;t=i.map((function(r){return w(r)}))}return cf[e]&&(t=t.map((function(r){return r[e]()}))),t},w.cache=function(r){return null!=r?(b=r,w):b},w.gamma=function(r){return null!=r?(p=r,w):p},w.nodata=function(r){return null!=r?(e=cf(r),w):e},w};var df=v,bf=sf,pf=y,gf=function(r,n,e){if(!gf[e])throw new Error("unknown blend mode "+e);return gf[e](r,n)},vf=function(r){return function(n,e){var t=pf(e).rgb(),a=pf(n).rgb();return pf.rgb(r(t,a))}},mf=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}};gf.normal=vf(mf((function(r){return r}))),gf.multiply=vf(mf((function(r,n){return r*n/255}))),gf.screen=vf(mf((function(r,n){return 255*(1-(1-r/255)*(1-n/255))}))),gf.overlay=vf(mf((function(r,n){return n<128?2*r*n/255:255*(1-2*(1-r/255)*(1-n/255))}))),gf.darken=vf(mf((function(r,n){return r>n?n:r}))),gf.lighten=vf(mf((function(r,n){return r>n?r:n}))),gf.dodge=vf(mf((function(r,n){return 255===r||(r=n/255*255/(1-r/255))>255?255:r}))),gf.burn=vf(mf((function(r,n){return 255*(1-(1-n/255)/(r/255))})));var yf=gf,kf=l.type,wf=l.clip_rgb,Nf=l.TWOPI,Mf=Math.pow,_f=Math.sin,Af=Math.cos,Pf=y,xf=v,Ef=Math.floor,Of=Math.random,Gf=o,Rf=Math.log,jf=Math.pow,Bf=Math.floor,Ff=Math.abs,qf=function(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"===Gf(r)&&(r=Object.values(r)),r.forEach((function(r){n&&"object"===Gf(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 Lf(e,r,n)},e},Lf=function(r,n,e){void 0===n&&(n="equal"),void 0===e&&(e=7),"array"==Gf(r)&&(r=qf(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.substring(0,1)&&(o.push(t),o.push(a)),"e"===n.substring(0,1)){o.push(t);for(var u=1;u 0");var c=Math.LOG10E*Rf(t),i=Math.LOG10E*Rf(a);o.push(t);for(var l=1;l200&&(y=!1)}for(var q={},L=0;L=360;)p-=360;u[b]=p}else u[b]=u[b]/c[b];return d/=t,new Ja(u,n).alpha(d>.99999?1:d,!0)},ho.bezier=function(r){var n=function(r){var n,e,t,a,f,o,u;if(2===(r=r.map((function(r){return new df(r)}))).length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],a=function(n){var e=function(r,e){return r+n*(e-r)},t=[0,1,2].map((function(r){return e(f[r],o[r])})),a=e(r[0].alpha(),r[1].alpha());return new df(t,"lab").alpha(a)};else if(3===r.length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],a=function(n){var e=function(r,e,t){return(1-n)*(1-n)*r+2*(1-n)*n*e+n*n*t},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha());return new df(t,"lab").alpha(a)};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(n){var e=function(r,e,t,a){return(1-n)*(1-n)*(1-n)*r+3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*t+n*n*n*a},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r],c[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha(),r[3].alpha());return new df(t,"lab").alpha(a)}}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)},ho.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*Zf)},o=function(r){return 2*Zf*r/360};r=new Sf(r),n=new Sf(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],p=(c+s)/2,g=(Cf(If(i,2)+If(l,2))+Cf(If(d,2)+If(b,2)))/2,v=.5*(1-Cf(If(g,7)/(If(g,7)+If(25,7)))),m=i*(1+v),y=d*(1+v),k=Cf(If(m,2)+If(l,2)),w=Cf(If(y,2)+If(b,2)),N=(k+w)/2,M=f(Tf(l,m)),_=f(Tf(b,y)),A=M>=0?M:M+360,P=_>=0?_:_+360,x=Wf(A-P)>180?(A+P+360)/2:(A+P)/2,E=1-.17*Xf(o(x-30))+.24*Xf(o(2*x))+.32*Xf(o(3*x+6))-.2*Xf(o(4*x-63)),O=P-A;O=Wf(O)<=180?O:P<=A?O+360:O-360,O=2*Cf(k*w)*Vf(o(O)/2);var G=s-c,R=w-k,j=1+.015*If(p-50,2)/Cf(20+If(p-50,2)),B=1+.045*N,F=1+.015*N*E,q=30*Uf(-If((x-275)/25,2)),L=-(2*Cf(If(N,7)/(If(N,7)+If(25,7))))*Vf(2*o(q)),Y=Cf(If(G/(e*j),2)+If(R/(t*B),2)+If(O/(a*F),2)+L*(R/(t*B))*(O/(a*F)));return zf(0,$f(100,Y))},ho.distance=function(r,n,e,t){if(void 0===e&&(e="lab"),void 0===t&&(t=null),t){var a=t;t=new Array(4).fill(1),a.slice(0,4).forEach((function(r,n){isNaN(r)||(t[n]=r)}))}else t=Array(4).fill(1);r=new Hf(r),n=new Hf(n);var f,o=r.get(e),u=n.get(e),c=e.replace(/(^ok)/gi,""),i=0;for(var l in o){if("h"===c.charAt(l)){var h=(o[l]||0)-(u[l]||0);f=Math.abs(h+180)%360-180}else f=(o[l]||0)-(u[l]||0);i+=f*f*t[l]*t[l]}return Math.sqrt(i)},ho.stdDeviation=function(r){var n=(r=[].concat(r).map((function(r){return new Kf(r).rgba()}))).length;Array.from(Array(n),(function(){return new Array(n)}));for(var e=[0,0,0,0],t=0;te?e:r},n=r,e={},t=0,a=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];t255)&&(r._clipped=!0),r[e]=n(r[e],0,255)):3===e&&(r[e]=n(r[e],0,1));return r},limit:r,type:o,unpack:function(r,n){return void 0===n&&(n=null),r.length>=3?Array.prototype.slice.call(r):"object"==u(r[0])&&n?n.split("").filter((function(n){return void 0!==r[0][n]})).map((function(n){return r[0][n]})):r[0]},last:function(r){if(r.length<2)return null;var n=r.length-1;return"string"==c(r[n])?r[n].toLowerCase():null},PI:i,TWOPI:2*i,PITHIRD:i/3,DEG2RAD:i/180,RAD2DEG:180/i},h={format:{},autodetect:[]},s=l.last,d=l.clip_rgb,b=l.type,p=h,g=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=this;if("object"===b(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];"array"===b(r[0])&&1===r.length&&(r=[].concat(r[0]));var t=s(r),a=!1;if(!t){a=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(r,n){return n.p-r.p})),p.sorted=!0);for(var f=0,o=p.autodetect;f4?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]},A=y,P=v,x=h,E=l.unpack,O=l.type,G=N;P.prototype.cmyk=function(){return G(this._rgb)},A.cmyk=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(P,[null].concat(r,["cmyk"])))},x.format.cmyk=_,x.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=E(r,"cmyk"),"array"===O(r)&&4===r.length)return"cmyk"}});var R=l.unpack,j=l.last,B=function(r){return Math.round(100*r)/100},F=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=R(r,"hsla"),t=j(r)||"lsa";return e[0]=B(e[0]||0),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+"("+e.join(",")+")"},q=l.unpack,L=y,Y=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=q(r,"rgba"))[0],t=r[1],a=r[2];e/=255,t/=255,a/=255;var f,o,u=Math.min(e,t,a),c=Math.max(e,t,a),i=(c+u)/2;return c===u?(f=0,o=L.hueNaN?Number.NaN:0):f=i<.5?(c-u)/(c+u):(c-u)/(2-c-u),e==c?o=(t-a)/(c-u):t==c?o=2+(a-e)/(c-u):a==c&&(o=4+(e-t)/(c-u)),(o*=60)<0?o+=360:!L.hueNaN&&isNaN(o)&&(o=0),r.length>3&&void 0!==r[3]?[o,f,i,r[3]]:[o,f,i]},D=l.unpack,S=l.last,C=function(r){return Math.round(100*r)/100},I=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=D(r,"lch"),t=S(r)||"lch";return e[0]=C(e[0])+"%",e[1]=C(e[1])+"%",e[2]=C(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lch("+e.join(" ")+")"},$={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},z=$,T=l.unpack,W=Math.pow,X=function(r){return(r/=255)<=.04045?r/12.92:W((r+.055)/1.055,2.4)},V=function(r){return r>z.t3?W(r,1/3):r/z.t2+z.t0},U=function(r,n,e){return r=X(r),n=X(n),e=X(e),[V((.4124564*r+.3575761*n+.1804375*e)/z.Xn),V((.2126729*r+.7151522*n+.072175*e)/z.Yn),V((.0193339*r+.119192*n+.9503041*e)/z.Zn)]},Z=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=T(r,"rgb"),t=e[0],a=e[1],f=e[2],o=U(t,a,f),u=o[0],c=o[1],i=116*c-16;return[i<0?0:i,500*(u-c),200*(c-o[2])]},H=l.unpack,K=l.RAD2DEG,Q=Math.sqrt,J=Math.atan2,rr=Math.round,nr=y,er=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=H(r,"lab"),t=e[0],a=e[1],f=e[2],o=Q(a*a+f*f),u=(J(f,a)*K+360)%360;return 0===rr(1e4*o)&&(u=nr.hueNaN?Number.NaN:0),[t,o,u]},tr=l.unpack,ar=Z,fr=er,or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=tr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=ar(t,a,f),u=o[0],c=o[1],i=o[2];return fr(u,c,i)},ur=l.unpack,cr=l.last,ir=function(r){return Math.round(100*r)/100},lr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ur(r,"lab"),t=cr(r)||"lab";return e[0]=ir(e[0])+"%",e[1]=ir(e[1])+"%",e[2]=ir(e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lab("+e.join(" ")+")"},hr=l.unpack,sr=l.last,dr=function(r){return Math.round(100*r)/100},br=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=hr(r,"lab"),t=sr(r)||"lab";return e[0]=dr(100*e[0])+"%",e[1]=dr(100*e[1])+"%",e[2]=dr(100*e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklab("+e.join(" ")+")"},pr=l.unpack,gr=Math.cbrt,vr=Math.pow,mr=Math.sign,yr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=[kr(t/255),kr(a/255),kr(f/255)],u=o[0],c=o[1],i=o[2],l=gr(.4122214708*u+.5363325363*c+.0514459929*i),h=gr(.2119034982*u+.6806995451*c+.1073969566*i),s=gr(.0883024619*u+.2817188376*c+.6299787005*i);return[.2104542553*l+.793617785*h-.0040720468*s,1.9779984951*l-2.428592205*h+.4505937099*s,.0259040371*l+.7827717662*h-.808675766*s]};function kr(r){var n=Math.abs(r);return n<.04045?r/12.92:(mr(r)||1)*vr((n+.055)/1.055,2.4)}var wr=l.unpack,Nr=l.last,Mr=function(r){return Math.round(100*r)/100},_r=Math.min,Ar=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=wr(r,"lch"),t=Nr(r)||"lch";return e[0]=Mr(100*e[0])+"%",e[1]=_r(Mr(e[1]/.4*100),100)+"%",e[2]=Mr(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklch("+e.join(" ")+")"},Pr=l.unpack,xr=yr,Er=er,Or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=xr(t,a,f),u=o[0],c=o[1],i=o[2];return Er(u,c,i)},Gr=l.unpack,Rr=l.last,jr=F,Br=Y,Fr=I,qr=or,Lr=lr,Yr=Z,Dr=br,Sr=yr,Cr=Ar,Ir=Or,$r=Math.round,zr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Gr(r,"rgba"),t=Rr(r)||"rgb";return"hsl"==t.substring(0,3)?jr(Br(e),t):"lch"==t.substring(0,3)?Fr(qr(e),t):"lab"==t.substring(0,3)?Lr(Yr(e).concat([e.length>3?e[3]:1]),t):"oklab"==t.substring(0,5)?Dr(Sr(e).concat([e.length>3?e[3]:1]),"lab"):"oklch"==t.substring(0,5)?Cr(Ir(e).concat([e.length>3?e[3]:1]),"lch"):(e[0]=$r(e[0]),e[1]=$r(e[1]),e[2]=$r(e[2]),("rgba"===t||e.length>3&&e[3]<1)&&(e[3]=e.length>3?e[3]:1,t="rgba"),t+"("+e.slice(0,"rgb"===t?3:4).join(",")+")")},Tr=l.unpack,Wr=Math.round,Xr=function(){for(var r,n=[],e=arguments.length;e--;)n[e]=arguments[e];var t,a,f,o=(n=Tr(n,"hsl"))[0],u=n[1],c=n[2];if(0===u)t=a=f=255*c;else{var i=[0,0,0],l=[0,0,0],h=c<.5?c*(1+u):c+u-c*u,s=2*c-h,d=o/360;i[0]=d+1/3,i[1]=d,i[2]=d-1/3;for(var b=0;b<3;b++)i[b]<0&&(i[b]+=1),i[b]>1&&(i[b]-=1),6*i[b]<1?l[b]=s+6*(h-s)*i[b]:2*i[b]<1?l[b]=h:3*i[b]<2?l[b]=s+(h-s)*(2/3-i[b])*6:l[b]=s;t=(r=[Wr(255*l[0]),Wr(255*l[1]),Wr(255*l[2])])[0],a=r[1],f=r[2]}return n.length>3?[t,a,f,n[3]]:[t,a,f,1]},Vr=$,Ur=l.unpack,Zr=Math.pow,Hr=function(r){return 255*(r<=.00304?12.92*r:1.055*Zr(r,1/2.4)-.055)},Kr=function(r){return r>Vr.t1?r*r*r:Vr.t2*(r-Vr.t0)},Qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ur(r,"lab"))[0],o=r[1],u=r[2];return t=(f+16)/116,e=isNaN(o)?t:t+o/500,a=isNaN(u)?t:t-u/200,t=Vr.Yn*Kr(t),e=Vr.Xn*Kr(e),a=Vr.Zn*Kr(a),[Hr(3.2404542*e-1.5371385*t-.4985314*a),Hr(-.969266*e+1.8760108*t+.041556*a),Hr(.0556434*e-.2040259*t+1.0572252*a),r.length>3?r[3]:1]},Jr=l.unpack,rn=l.DEG2RAD,nn=Math.sin,en=Math.cos,tn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Jr(r,"lch"),t=e[0],a=e[1],f=e[2];return isNaN(f)&&(f=0),[t,en(f*=rn)*a,nn(f)*a]},an=l.unpack,fn=tn,on=Qr,un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=an(r,"lch"))[0],t=r[1],a=r[2],f=fn(e,t,a),o=f[0],u=f[1],c=f[2],i=on(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},cn=l.unpack,ln=Math.pow,hn=Math.sign,sn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=cn(r,"lab"))[0],t=r[1],a=r[2],f=ln(e+.3963377774*t+.2158037573*a,3),o=ln(e-.1055613458*t-.0638541728*a,3),u=ln(e-.0894841775*t-1.291485548*a,3);return[255*dn(4.0767416621*f-3.3077115913*o+.2309699292*u),255*dn(-1.2684380046*f+2.6097574011*o-.3413193965*u),255*dn(-.0041960863*f-.7034186147*o+1.707614701*u),r.length>3?r[3]:1]};function dn(r){var n=Math.abs(r);return n>.0031308?(hn(r)||1)*(1.055*ln(n,1/2.4)-.055):12.92*r}var bn=l.unpack,pn=tn,gn=sn,vn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=bn(r,"lch"))[0],t=r[1],a=r[2],f=pn(e,t,a),o=f[0],u=f[1],c=f[2],i=gn(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},mn=Xr,yn=Qr,kn=un,wn=sn,Nn=vn,Mn=h,_n=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,An=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Pn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,xn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,En=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,On=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gn=/^lab\(\s*(\d+(?:\.\d+)?)%?\s* (-?\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)%?\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Rn=/^lch\(\s*(\d+(?:\.\d+)?)%?\s* (\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,jn=/^oklab\(\s*(\d+(?:\.\d+)?%?)\s* (-?\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?%?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Bn=/^oklch\(\s*(\d+(?:\.\d+)?%?)\s* (\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Fn=Math.round,qn=Math.abs,Ln=function(r){var n;if(r=r.toLowerCase().trim(),Mn.format.named)try{return Mn.format.named(r)}catch(r){}if(n=r.match(_n)){for(var e=n.slice(1,4),t=0;t<3;t++)e[t]=Number(e[t]);return e[3]=1,e}if(n=r.match(An)){for(var a=n.slice(1,5),f=0;f<4;f++)a[f]=Number(a[f]);return a}if(n=r.match(Pn)){for(var o=n.slice(1,4),u=0;u<3;u++)o[u]=Fn(2.55*Number(o[u]));return o[3]=1,o}if(n=r.match(xn)){for(var c=n.slice(1,5),i=0;i<3;i++)c[i]=Fn(2.55*Number(c[i]));return c[3]=Number(c[3]),c}if(n=r.match(En)){for(var l=n.slice(1,4),h=0;h<=2;h++)l[h]=Number(l[h]);l[1]*=.01,l[2]*=.01;var s=mn(l);return s[3]=1,s}if(n=r.match(On)){for(var d=n.slice(1,4),b=0;b<=2;b++)d[b]=Number(d[b]);d[1]*=.01,d[2]*=.01;var p=mn(d);return p[3]=Number(n[4]),p}if(n=r.match(Gn)){for(var g=n.slice(1,4),v=0;v<=2;v++)g[v]=Number(g[v]);var m=yn(g).map((function(r){return qn(Fn(r))}));return m[3]=Number(n[4]),m[3]||0===m[3]||(m[3]=1),m}if(n=r.match(Rn)){for(var y=n.slice(1,4),k=0;k<=2;k++)y[k]=Number(y[k]);var w=kn(y).map((function(r){return qn(Fn(r))}));return w[3]=Number(n[4]),w[3]||0===w[3]||(w[3]=1),w}if(n=r.match(jn)){for(var N=n.slice(1,4),M=0;M<=2;M++)N[M].endsWith("%")?N[M]=.01*Number(N[M].replace("%","")):N[M]=Number(N[M]);var _=wn(N).map((function(r){return qn(Fn(r))}));return _[3]=Number(n[4]),_[3]||0===_[3]||(_[3]=1),_}if(n=r.match(Bn)){for(var A=n.slice(1,4),P=0;P<=1;P++)A[P].endsWith("%")?(A[P]=.01*Number(A[P].replace("%","")),1===P&&(A[P]*=.4)):A[P]=Number(A[P]);var x=Nn(A).map((function(r){return qn(Fn(r))}));return x[3]=Number(n[4]),x[3]||0===x[3]||(x[3]=1),x}};Ln.test=function(r){return _n.test(r)||An.test(r)||Pn.test(r)||xn.test(r)||En.test(r)||On.test(r)||Gn.test(r)||Rn.test(r)||jn.test(r)||Bn.test(r)};var Yn=y,Dn=v,Sn=h,Cn=l.type,In=zr,$n=Ln;Dn.prototype.css=function(r){return In(this._rgb,r)},Yn.css=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Dn,[null].concat(r,["css"])))},Sn.format.css=$n,Sn.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"===Cn(r)&&$n.test(r))return"css"}});var zn=v,Tn=y,Wn=l.unpack;h.format.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Wn(r,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e},Tn.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(zn,[null].concat(r,["gl"])))},zn.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var Xn=l.unpack,Vn=y,Un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=Xn(r,"rgb"),a=t[0],f=t[1],o=t[2],u=Math.min(a,f,o),c=Math.max(a,f,o),i=c-u,l=100*i/255,h=u/(255-i)*100;return 0===i?e=Vn.hueNaN?Number.NaN:0:(a===c&&(e=(f-o)/i),f===c&&(e=2+(o-a)/i),o===c&&(e=4+(a-f)/i),(e*=60)<0?e+=360:!Vn.hueNaN&&isNaN(e)&&(e=0)),[e,l,h]},Zn=l.unpack,Hn=Math.floor,Kn=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Zn(o,"hcg"))[0],s=o[1],d=o[2];d*=255;var b=255*s;if(0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var p=Hn(h/=60),g=h-p,v=d*(1-s),m=v+b*(1-g),y=v+b*g,k=v+b;switch(p){case 0:c=(r=[k,y,v])[0],i=r[1],l=r[2];break;case 1:c=(n=[m,k,v])[0],i=n[1],l=n[2];break;case 2:c=(e=[v,k,y])[0],i=e[1],l=e[2];break;case 3:c=(t=[v,m,k])[0],i=t[1],l=t[2];break;case 4:c=(a=[y,v,k])[0],i=a[1],l=a[2];break;case 5:c=(f=[k,v,m])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Qn=l.unpack,Jn=l.type,re=y,ne=v,ee=h,te=Un;ne.prototype.hcg=function(){return te(this._rgb)},re.hcg=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ne,[null].concat(r,["hcg"])))},ee.format.hcg=Kn,ee.autodetect.push({p:1,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Qn(r,"hcg"),"array"===Jn(r)&&3===r.length)return"hcg"}});var ae=l.unpack,fe=l.last,oe=Math.round,ue=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ae(r,"rgba"),t=e[0],a=e[1],f=e[2],o=e[3],u=fe(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c="000000"+((t=oe(t))<<16|(a=oe(a))<<8|(f=oe(f))).toString(16);c=c.substring(c.length-6);var i="0"+oe(255*o).toString(16);switch(i=i.substring(i.length-2),u.toLowerCase()){case"rgba":return"#"+c+i;case"argb":return"#"+i+c;default:return"#"+c}},ce=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,ie=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,le=function(r){if(r.match(ce)){4!==r.length&&7!==r.length||(r=r.substring(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(ie)){5!==r.length&&9!==r.length||(r=r.substring(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)},he=y,se=v,de=l.type,be=h,pe=ue;se.prototype.hex=function(r){return pe(this._rgb,r)},he.hex=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(se,[null].concat(r,["hex"])))},be.format.hex=le,be.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"===de(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var ge=l.unpack,ve=l.TWOPI,me=Math.min,ye=Math.sqrt,ke=Math.acos,we=y,Ne=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=ge(r,"rgb"),a=t[0],f=t[1],o=t[2],u=me(a/=255,f/=255,o/=255),c=(a+f+o)/3,i=c>0?1-u/c:0;return 0===i?e=we.hueNaN?Number.NaN:0:(e=(a-f+(a-o))/2,e/=ye((a-f)*(a-f)+(a-o)*(f-o)),e=ke(e),o>f&&(e=ve-e),e/=ve,!we.hueNaN&&isNaN(e)&&(e=0)),[360*e,i,c]},Me=l.unpack,_e=l.limit,Ae=l.TWOPI,Pe=l.PITHIRD,xe=Math.cos,Ee=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Me(r,"hsi"))[0],o=r[1],u=r[2];return isNaN(f)&&(f=0),isNaN(o)&&(o=0),f>360&&(f-=360),f<0&&(f+=360),(f/=360)<1/3?t=1-((a=(1-o)/3)+(e=(1+o*xe(Ae*f)/xe(Pe-Ae*f))/3)):f<2/3?a=1-((e=(1-o)/3)+(t=(1+o*xe(Ae*(f-=1/3))/xe(Pe-Ae*f))/3)):e=1-((t=(1-o)/3)+(a=(1+o*xe(Ae*(f-=2/3))/xe(Pe-Ae*f))/3)),[255*(e=_e(u*e*3)),255*(t=_e(u*t*3)),255*(a=_e(u*a*3)),r.length>3?r[3]:1]},Oe=l.unpack,Ge=l.type,Re=y,je=v,Be=h,Fe=Ne;je.prototype.hsi=function(){return Fe(this._rgb)},Re.hsi=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(je,[null].concat(r,["hsi"])))},Be.format.hsi=Ee,Be.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Oe(r,"hsi"),"array"===Ge(r)&&3===r.length)return"hsi"}});var qe=l.unpack,Le=l.type,Ye=y,De=v,Se=h,Ce=Y;De.prototype.hsl=function(){return Ce(this._rgb)},Ye.hsl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(De,[null].concat(r,["hsl"])))},Se.format.hsl=Xr,Se.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=qe(r,"hsl"),"array"===Le(r)&&3===r.length)return"hsl"}});var Ie=l.unpack,$e=Math.min,ze=Math.max,Te=y,We=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ie(r,"rgb"))[0],o=r[1],u=r[2],c=$e(f,o,u),i=ze(f,o,u),l=i-c;return a=i/255,0===i?(e=Te.hueNaN?Number.NaN:0,t=0):(t=l/i,f===i&&(e=(o-u)/l),o===i&&(e=2+(u-f)/l),u===i&&(e=4+(f-o)/l),(e*=60)<0?e+=360:!Te.hueNaN&&isNaN(e)&&(e=0)),[e,t,a]},Xe=l.unpack,Ve=Math.floor,Ue=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Xe(o,"hsv"))[0],s=o[1],d=o[2];if(d*=255,0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var b=Ve(h/=60),p=h-b,g=d*(1-s),v=d*(1-s*p),m=d*(1-s*(1-p));switch(b){case 0:c=(r=[d,m,g])[0],i=r[1],l=r[2];break;case 1:c=(n=[v,d,g])[0],i=n[1],l=n[2];break;case 2:c=(e=[g,d,m])[0],i=e[1],l=e[2];break;case 3:c=(t=[g,v,d])[0],i=t[1],l=t[2];break;case 4:c=(a=[m,g,d])[0],i=a[1],l=a[2];break;case 5:c=(f=[d,g,v])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Ze=l.unpack,He=l.type,Ke=y,Qe=v,Je=h,rt=We;Qe.prototype.hsv=function(){return rt(this._rgb)},Ke.hsv=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Qe,[null].concat(r,["hsv"])))},Je.format.hsv=Ue,Je.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ze(r,"hsv"),"array"===He(r)&&3===r.length)return"hsv"}});var nt=l.unpack,et=l.type,tt=y,at=v,ft=h,ot=Z;at.prototype.lab=function(){return ot(this._rgb)},tt.lab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(at,[null].concat(r,["lab"])))},ft.format.lab=Qr,ft.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=nt(r,"lab"),"array"===et(r)&&3===r.length)return"lab"}});var ut=l.unpack,ct=un,it=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ut(r,"hcl").reverse();return ct.apply(void 0,e)},lt=l.unpack,ht=l.type,st=y,dt=v,bt=h,pt=or;dt.prototype.lch=function(){return pt(this._rgb)},dt.prototype.hcl=function(){return pt(this._rgb).reverse()},st.lch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["lch"])))},st.hcl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["hcl"])))},bt.format.lch=un,bt.format.hcl=it,["lch","hcl"].forEach((function(r){return bt.autodetect.push({p:2,test:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];if(n=lt(n,r),"array"===ht(n)&&3===n.length)return r}})}));var gt={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",cornflower:"#6495ed",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"},vt=h,mt=l.type,yt=gt,kt=le,wt=ue;v.prototype.name=function(){for(var r=wt(this._rgb,"rgb"),n=0,e=Object.keys(yt);n0;)n[e]=arguments[e+1];if(!n.length&&"string"===mt(r)&&yt[r.toLowerCase()])return"named"}});var Nt=l.unpack,Mt=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Nt(r,"rgb");return(e[0]<<16)+(e[1]<<8)+e[2]},_t=l.type,At=function(r){if("number"==_t(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},Pt=y,xt=v,Et=h,Ot=l.type,Gt=Mt;xt.prototype.num=function(){return Gt(this._rgb)},Pt.num=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(xt,[null].concat(r,["num"])))},Et.format.num=At,Et.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===Ot(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Rt=y,jt=v,Bt=h,Ft=l.unpack,qt=l.type,Lt=Math.round;jt.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Lt)},jt.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:Lt(n):n}))},Rt.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(jt,[null].concat(r,["rgb"])))},Bt.format.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Ft(r,"rgba");return void 0===e[3]&&(e[3]=1),e},Bt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ft(r,"rgba"),"array"===qt(r)&&(3===r.length||4===r.length&&"number"==qt(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var Yt=Math.log,Dt=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*Yt(e),t=a<20?0:.8274096064007395*(t=a-10)-254.76935184120902+115.67994401066147*Yt(t)):(n=351.97690566805693+.114206453784165*(n=a-55)-40.25366309332127*Yt(n),e=325.4494125711974+.07943456536662342*(e=a-50)-28.0852963507957*Yt(e),t=255),[n,e,t,1]},St=Dt,Ct=l.unpack,It=Math.round,$t=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];for(var e,t=Ct(r,"rgb"),a=t[0],f=t[2],o=1e3,u=4e4;u-o>.4;){var c=St(e=.5*(u+o));c[2]/c[0]>=f/a?u=e:o=e}return It(e)},zt=y,Tt=v,Wt=h,Xt=$t;Tt.prototype.temp=Tt.prototype.kelvin=Tt.prototype.temperature=function(){return Xt(this._rgb)},zt.temp=zt.kelvin=zt.temperature=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Tt,[null].concat(r,["temp"])))},Wt.format.temp=Wt.format.kelvin=Wt.format.temperature=Dt;var Vt=l.unpack,Ut=l.type,Zt=y,Ht=v,Kt=h,Qt=yr;Ht.prototype.oklab=function(){return Qt(this._rgb)},Zt.oklab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Ht,[null].concat(r,["oklab"])))},Kt.format.oklab=sn,Kt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Vt(r,"oklab"),"array"===Ut(r)&&3===r.length)return"oklab"}});var Jt=l.unpack,ra=l.type,na=y,ea=v,ta=h,aa=Or;ea.prototype.oklch=function(){return aa(this._rgb)},na.oklch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ea,[null].concat(r,["oklch"])))},ta.format.oklch=vn,ta.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Jt(r,"oklch"),"array"===ra(r)&&3===r.length)return"oklch"}});var fa=l.unpack,oa=l.last,ua=Math.round,ca=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=fa(r,"rgba"),t=(1!==e[3]?oa(r):"rgb")||"rgb";return e[0]=ua(e[0]),e[1]=ua(e[1]),e[2]=ua(e[2]),("rgba"===t||e.length>3&&e[3]<1&&"rgb"!==oa(r))&&(e[3]=e.length>3?e[3]:1,t="rgba"),"rgba"===t?e[3]<<24|e[0]<<16|e[1]<<8|e[2]:4278190080|e[0]<<16|e[1]<<8|e[2]},ia=l.type,la=function(r){if("number"==ia(r)){var n=(r>>24&255)/255;if(n>=0&&n<=1){var e=r-4278190080;return[e>>16&255,e>>8&255,255&e,n]}}throw new Error("unknown android color: "+r)},ha=y,sa=v,da=h,ba=l.type,pa=ca;sa.prototype.android=function(r){return pa(this._rgb,r)},ha.android=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(sa,[null].concat(r,["android"])))},da.format.android=la,da.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===ba(r[0])){var e=(r[0]>>24&255)/255;if(e>=0&&e<=1){var t=r[0]-4278190080;if([t>>16&255,t>>8&255,255&t].every((function(r){return r>=0&&r<=255})))return"android"}}}});var ga=v,va=l.type;ga.prototype.alpha=function(r,n){return void 0===n&&(n=!1),void 0!==r&&"number"===va(r)?n?(this._rgb[3]=r,this):new ga([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},v.prototype.clipped=function(){return this._rgb._clipped||!1};var ma=v,ya=$;ma.prototype.darken=function(r){void 0===r&&(r=1);var n=this.lab();return n[0]-=ya.Kn*r,new ma(n,"lab").alpha(this.alpha(),!0)},ma.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},ma.prototype.darker=ma.prototype.darken,ma.prototype.brighter=ma.prototype.brighten,v.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.substring(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+t+" in mode "+e)}return a};var ka=v,wa=l.type,Na=Math.pow;ka.prototype.luminance=function(r){if(void 0!==r&&"number"===wa(r)){if(0===r)return new ka([0,0,0,this._rgb[3]],"rgb");if(1===r)return new ka([255,255,255,this._rgb[3]],"rgb");var n=this.luminance(),e=20,t=function(n,a){var f=n.interpolate(a,.5,"rgb"),o=f.luminance();return Math.abs(r-o)<1e-7||!e--?f:o>r?t(n,f):t(f,a)},a=(n>r?t(new ka([0,0,0]),this):t(this,new ka([255,255,255]))).rgb();return new ka(a.concat([this._rgb[3]]))}return Ma.apply(void 0,this._rgb.slice(0,3))};var Ma=function(r,n,e){return.2126*(r=_a(r))+.7152*(n=_a(n))+.0722*(e=_a(e))},_a=function(r){return(r/=255)<=.03928?r/12.92:Na((r+.055)/1.055,2.4)},Aa={},Pa=v,xa=l.type,Ea=Aa,Oa=function(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(Ea[f]||t.length||(f=Object.keys(Ea)[0]),!Ea[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==xa(r)&&(r=new Pa(r)),"object"!==xa(n)&&(n=new Pa(n)),Ea[f](r,n,e).alpha(r.alpha()+e*(n.alpha()-r.alpha()))},Ga=v,Ra=Oa;Ga.prototype.mix=Ga.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 Ra.apply(void 0,[this,r,n].concat(e))};var ja=v;ja.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 ja([n[0]*e,n[1]*e,n[2]*e,e],"rgb")};var Ba=v,Fa=$;Ba.prototype.saturate=function(r){void 0===r&&(r=1);var n=this.lch();return n[1]+=Fa.Kn*r,n[1]<0&&(n[1]=0),new Ba(n,"lch").alpha(this.alpha(),!0)},Ba.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)};var qa=v,La=l.type;qa.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.substring(0,2)?2:0);if(u>-1){if("string"==La(n))switch(n.charAt(0)){case"+":case"-":o[u]+=+n;break;case"*":o[u]*=+n.substring(1);break;case"/":o[u]/=+n.substring(1);break;default:o[u]=+n}else{if("number"!==La(n))throw new Error("unsupported value for Color.set");o[u]=n}var c=new qa(o,a);return e?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+f+" in mode "+a)}return o};var Ya=v;Aa.rgb=function(r,n,e){var t=r._rgb,a=n._rgb;return new Ya(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"rgb")};var Da=v,Sa=Math.sqrt,Ca=Math.pow;Aa.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 Da(Sa(Ca(a,2)*(1-e)+Ca(c,2)*e),Sa(Ca(f,2)*(1-e)+Ca(i,2)*e),Sa(Ca(o,2)*(1-e)+Ca(l,2)*e),"rgb")};var Ia=v;Aa.lab=function(r,n,e){var t=r.lab(),a=n.lab();return new Ia(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"lab")};var $a=v,za=function(r,n,e,t){var a,f,o,u,c,i,l,h,s,d,b,p,g;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.substring(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)?p=Number.NaN:(p=i,1!=s&&0!=s||"hsv"==t||(b=h)):(p=c,1!=d&&0!=d||"hsv"==t||(b=l)):p=c+e*(i>c&&i-c>180?i-(c+360):i180?i+360-c:i-c),void 0===b&&(b=l+e*(h-l)),g=s+e*(d-s),new $a("oklch"===t?[g,b,p]:[p,b,g],t)},Ta=za,Wa=function(r,n,e){return Ta(r,n,e,"lch")};Aa.lch=Wa,Aa.hcl=Wa;var Xa=v;Aa.num=function(r,n,e){var t=r.num(),a=n.num();return new Xa(t+e*(a-t),"num")};var Va=za;Aa.hcg=function(r,n,e){return Va(r,n,e,"hcg")};var Ua=za;Aa.hsi=function(r,n,e){return Ua(r,n,e,"hsi")};var Za=za;Aa.hsl=function(r,n,e){return Za(r,n,e,"hsl")};var Ha=za;Aa.hsv=function(r,n,e){return Ha(r,n,e,"hsv")};var Ka=v;Aa.oklab=function(r,n,e){var t=r.oklab(),a=n.oklab();return new Ka(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"oklab")};var Qa=za;Aa.oklch=function(r,n,e){return Qa(r,n,e,"oklch")};var Ja=v,rf=l.clip_rgb,nf=Math.pow,ef=Math.sqrt,tf=Math.PI,af=Math.cos,ff=Math.sin,of=Math.atan2,uf=function(r,n){for(var e=r.length,t=[0,0,0,0],a=0;a.9999999&&(t[3]=1),new Ja(rf(t))},cf=y,lf=l.type,hf=Math.pow,sf=function(r){var n="rgb",e=cf("#ccc"),t=0,a=[0,1],f=[],o=[0,0],u=!1,c=[],i=!1,l=0,h=1,s=!1,d={},b=!0,p=1,g=function(r){if((r=r||["#fff","#000"])&&"string"===lf(r)&&cf.brewer&&cf.brewer.hasOwnProperty(r.toLowerCase())&&"palettes"!==r&&(r=cf.brewer[r.toLowerCase()]),"array"===lf(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var n=0;n2){var s=function(r){if(null!=u){for(var n=u.length-1,e=0;e=u[e];)e++;return e-1}return 0}(r);i=s/(u.length-2)}else i=h!==l?(r-l)/(h-l):1;i=m(i),t||(i=v(i)),i>1?i=1:i<0?i=0:1!==p&&(i=hf(i,p)),i=o[0]+i*(1-o[0]-o[1]),i=Math.min(1,Math.max(0,i));var g=Math.floor(1e4*i);if(b&&d[g])a=d[g];else{if("array"===lf(c))for(var y=0;y=k&&y===f.length-1){a=c[y];break}if(i>k&&i2){var i=r.map((function(n,e){return e/(r.length-1)})),s=r.map((function(r){return(r-l)/(h-l)}));s.every((function(r,n){return i[n]===r}))||(m=function(r){if(r<=0||r>=1)return r;for(var n=0;r>=s[n+1];)n++;var e=(r-s[n])/(s[n+1]-s[n]);return i[n]+e*(i[n+1]-i[n])})}}return a=[l,h],w},w.mode=function(r){return arguments.length?(n=r,k(),w):n},w.range=function(r,n){return g(r),w},w.out=function(r){return i=r,w},w.spread=function(r){return arguments.length?(t=r,w):t},w.correctLightness=function(r){return null==r&&(r=!0),s=r,k(),v=s?function(r){for(var n=y(0,!0).lab()[0],e=y(1,!0).lab()[0],t=n>e,a=y(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=y(r,!0).lab()[0],o=a-f;return r}:function(r){return r},w},w.padding=function(r){return null!=r?("number"===lf(r)&&(r=[r,r]),o=r,w):o},w.colors=function(n,e){arguments.length<2&&(e="hex");var t=[];if(0===arguments.length)t=c.slice(0);else if(1===n)t=[w(.5)];else if(n>1){var f=a[0],o=a[1]-f;t=function(r,n,e){for(var t=[],a=rf;a?o++:o--)t.push(o);return t}(0,n,!1).map((function(r){return w(f+r/(n-1)*o)}))}else{r=[];var i=[];if(u&&u.length>2)for(var l=1,h=u.length,s=1<=h;s?lh;s?l++:l--)i.push(.5*(u[l-1]+u[l]));else i=a;t=i.map((function(r){return w(r)}))}return cf[e]&&(t=t.map((function(r){return r[e]()}))),t},w.cache=function(r){return null!=r?(b=r,w):b},w.gamma=function(r){return null!=r?(p=r,w):p},w.nodata=function(r){return null!=r?(e=cf(r),w):e},w};var df=v,bf=sf,pf=y,gf=function(r,n,e){if(!gf[e])throw new Error("unknown blend mode "+e);return gf[e](r,n)},vf=function(r){return function(n,e){var t=pf(e).rgb(),a=pf(n).rgb();return pf.rgb(r(t,a))}},mf=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}};gf.normal=vf(mf((function(r){return r}))),gf.multiply=vf(mf((function(r,n){return r*n/255}))),gf.screen=vf(mf((function(r,n){return 255*(1-(1-r/255)*(1-n/255))}))),gf.overlay=vf(mf((function(r,n){return n<128?2*r*n/255:255*(1-2*(1-r/255)*(1-n/255))}))),gf.darken=vf(mf((function(r,n){return r>n?n:r}))),gf.lighten=vf(mf((function(r,n){return r>n?r:n}))),gf.dodge=vf(mf((function(r,n){return 255===r||(r=n/255*255/(1-r/255))>255?255:r}))),gf.burn=vf(mf((function(r,n){return 255*(1-(1-n/255)/(r/255))})));var yf=gf,kf=l.type,wf=l.clip_rgb,Nf=l.TWOPI,Mf=Math.pow,_f=Math.sin,Af=Math.cos,Pf=y,xf=v,Ef=Math.floor,Of=Math.random,Gf=o,Rf=Math.log,jf=Math.pow,Bf=Math.floor,Ff=Math.abs,qf=function(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"===Gf(r)&&(r=Object.values(r)),r.forEach((function(r){n&&"object"===Gf(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 Lf(e,r,n)},e},Lf=function(r,n,e){void 0===n&&(n="equal"),void 0===e&&(e=7),"array"==Gf(r)&&(r=qf(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.substring(0,1)&&(o.push(t),o.push(a)),"e"===n.substring(0,1)){o.push(t);for(var u=1;u 0");var c=Math.LOG10E*Rf(t),i=Math.LOG10E*Rf(a);o.push(t);for(var l=1;l200&&(y=!1)}for(var q={},L=0;L=360;)p-=360;u[b]=p}else u[b]=u[b]/c[b];return d/=t,new Ja(u,n).alpha(d>.99999?1:d,!0)},ho.bezier=function(r){var n=function(r){var n,e,t,a,f,o,u;if(2===(r=r.map((function(r){return new df(r)}))).length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],a=function(n){var e=function(r,e){return r+n*(e-r)},t=[0,1,2].map((function(r){return e(f[r],o[r])})),a=e(r[0].alpha(),r[1].alpha());return new df(t,"lab").alpha(a)};else if(3===r.length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],a=function(n){var e=function(r,e,t){return(1-n)*(1-n)*r+2*(1-n)*n*e+n*n*t},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha());return new df(t,"lab").alpha(a)};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(n){var e=function(r,e,t,a){return(1-n)*(1-n)*(1-n)*r+3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*t+n*n*n*a},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r],c[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha(),r[3].alpha());return new df(t,"lab").alpha(a)}}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)},ho.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*Zf)},o=function(r){return 2*Zf*r/360};r=new Sf(r),n=new Sf(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],p=(c+s)/2,g=(Cf(If(i,2)+If(l,2))+Cf(If(d,2)+If(b,2)))/2,v=.5*(1-Cf(If(g,7)/(If(g,7)+If(25,7)))),m=i*(1+v),y=d*(1+v),k=Cf(If(m,2)+If(l,2)),w=Cf(If(y,2)+If(b,2)),N=(k+w)/2,M=f(Tf(l,m)),_=f(Tf(b,y)),A=M>=0?M:M+360,P=_>=0?_:_+360,x=Wf(A-P)>180?(A+P+360)/2:(A+P)/2,E=1-.17*Xf(o(x-30))+.24*Xf(o(2*x))+.32*Xf(o(3*x+6))-.2*Xf(o(4*x-63)),O=P-A;O=Wf(O)<=180?O:P<=A?O+360:O-360,O=2*Cf(k*w)*Vf(o(O)/2);var G=s-c,R=w-k,j=1+.015*If(p-50,2)/Cf(20+If(p-50,2)),B=1+.045*N,F=1+.015*N*E,q=30*Uf(-If((x-275)/25,2)),L=-(2*Cf(If(N,7)/(If(N,7)+If(25,7))))*Vf(2*o(q)),Y=Cf(If(G/(e*j),2)+If(R/(t*B),2)+If(O/(a*F),2)+L*(R/(t*B))*(O/(a*F)));return zf(0,$f(100,Y))},ho.distance=function(r,n,e,t){if(void 0===e&&(e="lab"),void 0===t&&(t=null),t){var a=t;t=new Array(4).fill(1),a.slice(0,4).forEach((function(r,n){isNaN(r)||(t[n]=r)}))}else t=Array(4).fill(1);r=new Hf(r),n=new Hf(n);var f,o=r.get(e),u=n.get(e),c=e.replace(/(^ok)/gi,""),i=0;for(var l in o){if("h"===c.charAt(l)){var h=(o[l]||0)-(u[l]||0);f=Math.abs(h+180)%360-180}else f=(o[l]||0)-(u[l]||0);i+=f*f*t[l]*t[l]}return Math.sqrt(i)},ho.stdDeviation=function(r){var n=(r=[].concat(r).map((function(r){return new Kf(r).rgba()}))).length;Array.from(Array(n),(function(){return new Array(n)}));for(var e=[0,0,0,0],t=0;tunreleased
  • added 'supported color spaces' to documentation
  • minor improvements to documentation
  • fix wrong handling of RGB and RGBA arrays when constructing chroma color objects.
  • +
  • fix wrong handling of values outside scale domain. See Issue 331
  • 2.7.0

      diff --git a/docs/libs/chroma.js b/docs/libs/chroma.js index 8e339cf7..88e82087 100644 --- a/docs/libs/chroma.js +++ b/docs/libs/chroma.js @@ -2948,7 +2948,9 @@ t = tMapLightness(t); // lightness correction } - if (_gamma !== 1) { t = pow$3(t, _gamma); } + if (t > 1) { t = 1; } // pow fails with negative bases, but values are always clamped to the extremes + else if (t < 0) { t = 0; } + else if (_gamma !== 1) { t = pow$3(t, _gamma); } t = _padding[0] + (t * (1 - _padding[0] - _padding[1])); diff --git a/docs/libs/chroma.min.js b/docs/libs/chroma.min.js index b961e4e7..29c5a511 100644 --- a/docs/libs/chroma.min.js +++ b/docs/libs/chroma.min.js @@ -83,4 +83,4 @@ * @preserve */ -!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";for(var r=function(r,n,e){return void 0===n&&(n=0),void 0===e&&(e=1),re?e:r},n=r,e={},t=0,a=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];t255)&&(r._clipped=!0),r[e]=n(r[e],0,255)):3===e&&(r[e]=n(r[e],0,1));return r},limit:r,type:o,unpack:function(r,n){return void 0===n&&(n=null),r.length>=3?Array.prototype.slice.call(r):"object"==u(r[0])&&n?n.split("").filter((function(n){return void 0!==r[0][n]})).map((function(n){return r[0][n]})):r[0]},last:function(r){if(r.length<2)return null;var n=r.length-1;return"string"==c(r[n])?r[n].toLowerCase():null},PI:i,TWOPI:2*i,PITHIRD:i/3,DEG2RAD:i/180,RAD2DEG:180/i},h={format:{},autodetect:[]},s=l.last,d=l.clip_rgb,b=l.type,p=h,g=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=this;if("object"===b(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];"array"===b(r[0])&&1===r.length&&(r=[].concat(r[0]));var t=s(r),a=!1;if(!t){a=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(r,n){return n.p-r.p})),p.sorted=!0);for(var f=0,o=p.autodetect;f4?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]},A=y,P=v,x=h,E=l.unpack,O=l.type,G=N;P.prototype.cmyk=function(){return G(this._rgb)},A.cmyk=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(P,[null].concat(r,["cmyk"])))},x.format.cmyk=_,x.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=E(r,"cmyk"),"array"===O(r)&&4===r.length)return"cmyk"}});var R=l.unpack,j=l.last,B=function(r){return Math.round(100*r)/100},F=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=R(r,"hsla"),t=j(r)||"lsa";return e[0]=B(e[0]||0),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+"("+e.join(",")+")"},q=l.unpack,L=y,Y=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=q(r,"rgba"))[0],t=r[1],a=r[2];e/=255,t/=255,a/=255;var f,o,u=Math.min(e,t,a),c=Math.max(e,t,a),i=(c+u)/2;return c===u?(f=0,o=L.hueNaN?Number.NaN:0):f=i<.5?(c-u)/(c+u):(c-u)/(2-c-u),e==c?o=(t-a)/(c-u):t==c?o=2+(a-e)/(c-u):a==c&&(o=4+(e-t)/(c-u)),(o*=60)<0?o+=360:!L.hueNaN&&isNaN(o)&&(o=0),r.length>3&&void 0!==r[3]?[o,f,i,r[3]]:[o,f,i]},D=l.unpack,S=l.last,C=function(r){return Math.round(100*r)/100},I=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=D(r,"lch"),t=S(r)||"lch";return e[0]=C(e[0])+"%",e[1]=C(e[1])+"%",e[2]=C(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lch("+e.join(" ")+")"},$={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},z=$,T=l.unpack,W=Math.pow,X=function(r){return(r/=255)<=.04045?r/12.92:W((r+.055)/1.055,2.4)},V=function(r){return r>z.t3?W(r,1/3):r/z.t2+z.t0},U=function(r,n,e){return r=X(r),n=X(n),e=X(e),[V((.4124564*r+.3575761*n+.1804375*e)/z.Xn),V((.2126729*r+.7151522*n+.072175*e)/z.Yn),V((.0193339*r+.119192*n+.9503041*e)/z.Zn)]},Z=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=T(r,"rgb"),t=e[0],a=e[1],f=e[2],o=U(t,a,f),u=o[0],c=o[1],i=116*c-16;return[i<0?0:i,500*(u-c),200*(c-o[2])]},H=l.unpack,K=l.RAD2DEG,Q=Math.sqrt,J=Math.atan2,rr=Math.round,nr=y,er=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=H(r,"lab"),t=e[0],a=e[1],f=e[2],o=Q(a*a+f*f),u=(J(f,a)*K+360)%360;return 0===rr(1e4*o)&&(u=nr.hueNaN?Number.NaN:0),[t,o,u]},tr=l.unpack,ar=Z,fr=er,or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=tr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=ar(t,a,f),u=o[0],c=o[1],i=o[2];return fr(u,c,i)},ur=l.unpack,cr=l.last,ir=function(r){return Math.round(100*r)/100},lr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ur(r,"lab"),t=cr(r)||"lab";return e[0]=ir(e[0])+"%",e[1]=ir(e[1])+"%",e[2]=ir(e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lab("+e.join(" ")+")"},hr=l.unpack,sr=l.last,dr=function(r){return Math.round(100*r)/100},br=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=hr(r,"lab"),t=sr(r)||"lab";return e[0]=dr(100*e[0])+"%",e[1]=dr(100*e[1])+"%",e[2]=dr(100*e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklab("+e.join(" ")+")"},pr=l.unpack,gr=Math.cbrt,vr=Math.pow,mr=Math.sign,yr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=[kr(t/255),kr(a/255),kr(f/255)],u=o[0],c=o[1],i=o[2],l=gr(.4122214708*u+.5363325363*c+.0514459929*i),h=gr(.2119034982*u+.6806995451*c+.1073969566*i),s=gr(.0883024619*u+.2817188376*c+.6299787005*i);return[.2104542553*l+.793617785*h-.0040720468*s,1.9779984951*l-2.428592205*h+.4505937099*s,.0259040371*l+.7827717662*h-.808675766*s]};function kr(r){var n=Math.abs(r);return n<.04045?r/12.92:(mr(r)||1)*vr((n+.055)/1.055,2.4)}var wr=l.unpack,Nr=l.last,Mr=function(r){return Math.round(100*r)/100},_r=Math.min,Ar=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=wr(r,"lch"),t=Nr(r)||"lch";return e[0]=Mr(100*e[0])+"%",e[1]=_r(Mr(e[1]/.4*100),100)+"%",e[2]=Mr(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklch("+e.join(" ")+")"},Pr=l.unpack,xr=yr,Er=er,Or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=xr(t,a,f),u=o[0],c=o[1],i=o[2];return Er(u,c,i)},Gr=l.unpack,Rr=l.last,jr=F,Br=Y,Fr=I,qr=or,Lr=lr,Yr=Z,Dr=br,Sr=yr,Cr=Ar,Ir=Or,$r=Math.round,zr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Gr(r,"rgba"),t=Rr(r)||"rgb";return"hsl"==t.substring(0,3)?jr(Br(e),t):"lch"==t.substring(0,3)?Fr(qr(e),t):"lab"==t.substring(0,3)?Lr(Yr(e).concat([e.length>3?e[3]:1]),t):"oklab"==t.substring(0,5)?Dr(Sr(e).concat([e.length>3?e[3]:1]),"lab"):"oklch"==t.substring(0,5)?Cr(Ir(e).concat([e.length>3?e[3]:1]),"lch"):(e[0]=$r(e[0]),e[1]=$r(e[1]),e[2]=$r(e[2]),("rgba"===t||e.length>3&&e[3]<1)&&(e[3]=e.length>3?e[3]:1,t="rgba"),t+"("+e.slice(0,"rgb"===t?3:4).join(",")+")")},Tr=l.unpack,Wr=Math.round,Xr=function(){for(var r,n=[],e=arguments.length;e--;)n[e]=arguments[e];var t,a,f,o=(n=Tr(n,"hsl"))[0],u=n[1],c=n[2];if(0===u)t=a=f=255*c;else{var i=[0,0,0],l=[0,0,0],h=c<.5?c*(1+u):c+u-c*u,s=2*c-h,d=o/360;i[0]=d+1/3,i[1]=d,i[2]=d-1/3;for(var b=0;b<3;b++)i[b]<0&&(i[b]+=1),i[b]>1&&(i[b]-=1),6*i[b]<1?l[b]=s+6*(h-s)*i[b]:2*i[b]<1?l[b]=h:3*i[b]<2?l[b]=s+(h-s)*(2/3-i[b])*6:l[b]=s;t=(r=[Wr(255*l[0]),Wr(255*l[1]),Wr(255*l[2])])[0],a=r[1],f=r[2]}return n.length>3?[t,a,f,n[3]]:[t,a,f,1]},Vr=$,Ur=l.unpack,Zr=Math.pow,Hr=function(r){return 255*(r<=.00304?12.92*r:1.055*Zr(r,1/2.4)-.055)},Kr=function(r){return r>Vr.t1?r*r*r:Vr.t2*(r-Vr.t0)},Qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ur(r,"lab"))[0],o=r[1],u=r[2];return t=(f+16)/116,e=isNaN(o)?t:t+o/500,a=isNaN(u)?t:t-u/200,t=Vr.Yn*Kr(t),e=Vr.Xn*Kr(e),a=Vr.Zn*Kr(a),[Hr(3.2404542*e-1.5371385*t-.4985314*a),Hr(-.969266*e+1.8760108*t+.041556*a),Hr(.0556434*e-.2040259*t+1.0572252*a),r.length>3?r[3]:1]},Jr=l.unpack,rn=l.DEG2RAD,nn=Math.sin,en=Math.cos,tn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Jr(r,"lch"),t=e[0],a=e[1],f=e[2];return isNaN(f)&&(f=0),[t,en(f*=rn)*a,nn(f)*a]},an=l.unpack,fn=tn,on=Qr,un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=an(r,"lch"))[0],t=r[1],a=r[2],f=fn(e,t,a),o=f[0],u=f[1],c=f[2],i=on(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},cn=l.unpack,ln=Math.pow,hn=Math.sign,sn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=cn(r,"lab"))[0],t=r[1],a=r[2],f=ln(e+.3963377774*t+.2158037573*a,3),o=ln(e-.1055613458*t-.0638541728*a,3),u=ln(e-.0894841775*t-1.291485548*a,3);return[255*dn(4.0767416621*f-3.3077115913*o+.2309699292*u),255*dn(-1.2684380046*f+2.6097574011*o-.3413193965*u),255*dn(-.0041960863*f-.7034186147*o+1.707614701*u),r.length>3?r[3]:1]};function dn(r){var n=Math.abs(r);return n>.0031308?(hn(r)||1)*(1.055*ln(n,1/2.4)-.055):12.92*r}var bn=l.unpack,pn=tn,gn=sn,vn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=bn(r,"lch"))[0],t=r[1],a=r[2],f=pn(e,t,a),o=f[0],u=f[1],c=f[2],i=gn(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},mn=Xr,yn=Qr,kn=un,wn=sn,Nn=vn,Mn=h,_n=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,An=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Pn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,xn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,En=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,On=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gn=/^lab\(\s*(\d+(?:\.\d+)?)%?\s* (-?\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)%?\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Rn=/^lch\(\s*(\d+(?:\.\d+)?)%?\s* (\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,jn=/^oklab\(\s*(\d+(?:\.\d+)?%?)\s* (-?\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?%?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Bn=/^oklch\(\s*(\d+(?:\.\d+)?%?)\s* (\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Fn=Math.round,qn=Math.abs,Ln=function(r){var n;if(r=r.toLowerCase().trim(),Mn.format.named)try{return Mn.format.named(r)}catch(r){}if(n=r.match(_n)){for(var e=n.slice(1,4),t=0;t<3;t++)e[t]=Number(e[t]);return e[3]=1,e}if(n=r.match(An)){for(var a=n.slice(1,5),f=0;f<4;f++)a[f]=Number(a[f]);return a}if(n=r.match(Pn)){for(var o=n.slice(1,4),u=0;u<3;u++)o[u]=Fn(2.55*Number(o[u]));return o[3]=1,o}if(n=r.match(xn)){for(var c=n.slice(1,5),i=0;i<3;i++)c[i]=Fn(2.55*Number(c[i]));return c[3]=Number(c[3]),c}if(n=r.match(En)){for(var l=n.slice(1,4),h=0;h<=2;h++)l[h]=Number(l[h]);l[1]*=.01,l[2]*=.01;var s=mn(l);return s[3]=1,s}if(n=r.match(On)){for(var d=n.slice(1,4),b=0;b<=2;b++)d[b]=Number(d[b]);d[1]*=.01,d[2]*=.01;var p=mn(d);return p[3]=Number(n[4]),p}if(n=r.match(Gn)){for(var g=n.slice(1,4),v=0;v<=2;v++)g[v]=Number(g[v]);var m=yn(g).map((function(r){return qn(Fn(r))}));return m[3]=Number(n[4]),m[3]||0===m[3]||(m[3]=1),m}if(n=r.match(Rn)){for(var y=n.slice(1,4),k=0;k<=2;k++)y[k]=Number(y[k]);var w=kn(y).map((function(r){return qn(Fn(r))}));return w[3]=Number(n[4]),w[3]||0===w[3]||(w[3]=1),w}if(n=r.match(jn)){for(var N=n.slice(1,4),M=0;M<=2;M++)N[M].endsWith("%")?N[M]=.01*Number(N[M].replace("%","")):N[M]=Number(N[M]);var _=wn(N).map((function(r){return qn(Fn(r))}));return _[3]=Number(n[4]),_[3]||0===_[3]||(_[3]=1),_}if(n=r.match(Bn)){for(var A=n.slice(1,4),P=0;P<=1;P++)A[P].endsWith("%")?(A[P]=.01*Number(A[P].replace("%","")),1===P&&(A[P]*=.4)):A[P]=Number(A[P]);var x=Nn(A).map((function(r){return qn(Fn(r))}));return x[3]=Number(n[4]),x[3]||0===x[3]||(x[3]=1),x}};Ln.test=function(r){return _n.test(r)||An.test(r)||Pn.test(r)||xn.test(r)||En.test(r)||On.test(r)||Gn.test(r)||Rn.test(r)||jn.test(r)||Bn.test(r)};var Yn=y,Dn=v,Sn=h,Cn=l.type,In=zr,$n=Ln;Dn.prototype.css=function(r){return In(this._rgb,r)},Yn.css=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Dn,[null].concat(r,["css"])))},Sn.format.css=$n,Sn.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"===Cn(r)&&$n.test(r))return"css"}});var zn=v,Tn=y,Wn=l.unpack;h.format.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Wn(r,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e},Tn.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(zn,[null].concat(r,["gl"])))},zn.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var Xn=l.unpack,Vn=y,Un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=Xn(r,"rgb"),a=t[0],f=t[1],o=t[2],u=Math.min(a,f,o),c=Math.max(a,f,o),i=c-u,l=100*i/255,h=u/(255-i)*100;return 0===i?e=Vn.hueNaN?Number.NaN:0:(a===c&&(e=(f-o)/i),f===c&&(e=2+(o-a)/i),o===c&&(e=4+(a-f)/i),(e*=60)<0?e+=360:!Vn.hueNaN&&isNaN(e)&&(e=0)),[e,l,h]},Zn=l.unpack,Hn=Math.floor,Kn=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Zn(o,"hcg"))[0],s=o[1],d=o[2];d*=255;var b=255*s;if(0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var p=Hn(h/=60),g=h-p,v=d*(1-s),m=v+b*(1-g),y=v+b*g,k=v+b;switch(p){case 0:c=(r=[k,y,v])[0],i=r[1],l=r[2];break;case 1:c=(n=[m,k,v])[0],i=n[1],l=n[2];break;case 2:c=(e=[v,k,y])[0],i=e[1],l=e[2];break;case 3:c=(t=[v,m,k])[0],i=t[1],l=t[2];break;case 4:c=(a=[y,v,k])[0],i=a[1],l=a[2];break;case 5:c=(f=[k,v,m])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Qn=l.unpack,Jn=l.type,re=y,ne=v,ee=h,te=Un;ne.prototype.hcg=function(){return te(this._rgb)},re.hcg=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ne,[null].concat(r,["hcg"])))},ee.format.hcg=Kn,ee.autodetect.push({p:1,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Qn(r,"hcg"),"array"===Jn(r)&&3===r.length)return"hcg"}});var ae=l.unpack,fe=l.last,oe=Math.round,ue=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ae(r,"rgba"),t=e[0],a=e[1],f=e[2],o=e[3],u=fe(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c="000000"+((t=oe(t))<<16|(a=oe(a))<<8|(f=oe(f))).toString(16);c=c.substring(c.length-6);var i="0"+oe(255*o).toString(16);switch(i=i.substring(i.length-2),u.toLowerCase()){case"rgba":return"#"+c+i;case"argb":return"#"+i+c;default:return"#"+c}},ce=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,ie=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,le=function(r){if(r.match(ce)){4!==r.length&&7!==r.length||(r=r.substring(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(ie)){5!==r.length&&9!==r.length||(r=r.substring(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)},he=y,se=v,de=l.type,be=h,pe=ue;se.prototype.hex=function(r){return pe(this._rgb,r)},he.hex=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(se,[null].concat(r,["hex"])))},be.format.hex=le,be.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"===de(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var ge=l.unpack,ve=l.TWOPI,me=Math.min,ye=Math.sqrt,ke=Math.acos,we=y,Ne=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=ge(r,"rgb"),a=t[0],f=t[1],o=t[2],u=me(a/=255,f/=255,o/=255),c=(a+f+o)/3,i=c>0?1-u/c:0;return 0===i?e=we.hueNaN?Number.NaN:0:(e=(a-f+(a-o))/2,e/=ye((a-f)*(a-f)+(a-o)*(f-o)),e=ke(e),o>f&&(e=ve-e),e/=ve,!we.hueNaN&&isNaN(e)&&(e=0)),[360*e,i,c]},Me=l.unpack,_e=l.limit,Ae=l.TWOPI,Pe=l.PITHIRD,xe=Math.cos,Ee=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Me(r,"hsi"))[0],o=r[1],u=r[2];return isNaN(f)&&(f=0),isNaN(o)&&(o=0),f>360&&(f-=360),f<0&&(f+=360),(f/=360)<1/3?t=1-((a=(1-o)/3)+(e=(1+o*xe(Ae*f)/xe(Pe-Ae*f))/3)):f<2/3?a=1-((e=(1-o)/3)+(t=(1+o*xe(Ae*(f-=1/3))/xe(Pe-Ae*f))/3)):e=1-((t=(1-o)/3)+(a=(1+o*xe(Ae*(f-=2/3))/xe(Pe-Ae*f))/3)),[255*(e=_e(u*e*3)),255*(t=_e(u*t*3)),255*(a=_e(u*a*3)),r.length>3?r[3]:1]},Oe=l.unpack,Ge=l.type,Re=y,je=v,Be=h,Fe=Ne;je.prototype.hsi=function(){return Fe(this._rgb)},Re.hsi=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(je,[null].concat(r,["hsi"])))},Be.format.hsi=Ee,Be.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Oe(r,"hsi"),"array"===Ge(r)&&3===r.length)return"hsi"}});var qe=l.unpack,Le=l.type,Ye=y,De=v,Se=h,Ce=Y;De.prototype.hsl=function(){return Ce(this._rgb)},Ye.hsl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(De,[null].concat(r,["hsl"])))},Se.format.hsl=Xr,Se.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=qe(r,"hsl"),"array"===Le(r)&&3===r.length)return"hsl"}});var Ie=l.unpack,$e=Math.min,ze=Math.max,Te=y,We=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ie(r,"rgb"))[0],o=r[1],u=r[2],c=$e(f,o,u),i=ze(f,o,u),l=i-c;return a=i/255,0===i?(e=Te.hueNaN?Number.NaN:0,t=0):(t=l/i,f===i&&(e=(o-u)/l),o===i&&(e=2+(u-f)/l),u===i&&(e=4+(f-o)/l),(e*=60)<0?e+=360:!Te.hueNaN&&isNaN(e)&&(e=0)),[e,t,a]},Xe=l.unpack,Ve=Math.floor,Ue=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Xe(o,"hsv"))[0],s=o[1],d=o[2];if(d*=255,0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var b=Ve(h/=60),p=h-b,g=d*(1-s),v=d*(1-s*p),m=d*(1-s*(1-p));switch(b){case 0:c=(r=[d,m,g])[0],i=r[1],l=r[2];break;case 1:c=(n=[v,d,g])[0],i=n[1],l=n[2];break;case 2:c=(e=[g,d,m])[0],i=e[1],l=e[2];break;case 3:c=(t=[g,v,d])[0],i=t[1],l=t[2];break;case 4:c=(a=[m,g,d])[0],i=a[1],l=a[2];break;case 5:c=(f=[d,g,v])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Ze=l.unpack,He=l.type,Ke=y,Qe=v,Je=h,rt=We;Qe.prototype.hsv=function(){return rt(this._rgb)},Ke.hsv=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Qe,[null].concat(r,["hsv"])))},Je.format.hsv=Ue,Je.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ze(r,"hsv"),"array"===He(r)&&3===r.length)return"hsv"}});var nt=l.unpack,et=l.type,tt=y,at=v,ft=h,ot=Z;at.prototype.lab=function(){return ot(this._rgb)},tt.lab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(at,[null].concat(r,["lab"])))},ft.format.lab=Qr,ft.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=nt(r,"lab"),"array"===et(r)&&3===r.length)return"lab"}});var ut=l.unpack,ct=un,it=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ut(r,"hcl").reverse();return ct.apply(void 0,e)},lt=l.unpack,ht=l.type,st=y,dt=v,bt=h,pt=or;dt.prototype.lch=function(){return pt(this._rgb)},dt.prototype.hcl=function(){return pt(this._rgb).reverse()},st.lch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["lch"])))},st.hcl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["hcl"])))},bt.format.lch=un,bt.format.hcl=it,["lch","hcl"].forEach((function(r){return bt.autodetect.push({p:2,test:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];if(n=lt(n,r),"array"===ht(n)&&3===n.length)return r}})}));var gt={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",cornflower:"#6495ed",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"},vt=h,mt=l.type,yt=gt,kt=le,wt=ue;v.prototype.name=function(){for(var r=wt(this._rgb,"rgb"),n=0,e=Object.keys(yt);n0;)n[e]=arguments[e+1];if(!n.length&&"string"===mt(r)&&yt[r.toLowerCase()])return"named"}});var Nt=l.unpack,Mt=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Nt(r,"rgb");return(e[0]<<16)+(e[1]<<8)+e[2]},_t=l.type,At=function(r){if("number"==_t(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},Pt=y,xt=v,Et=h,Ot=l.type,Gt=Mt;xt.prototype.num=function(){return Gt(this._rgb)},Pt.num=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(xt,[null].concat(r,["num"])))},Et.format.num=At,Et.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===Ot(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Rt=y,jt=v,Bt=h,Ft=l.unpack,qt=l.type,Lt=Math.round;jt.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Lt)},jt.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:Lt(n):n}))},Rt.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(jt,[null].concat(r,["rgb"])))},Bt.format.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Ft(r,"rgba");return void 0===e[3]&&(e[3]=1),e},Bt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ft(r,"rgba"),"array"===qt(r)&&(3===r.length||4===r.length&&"number"==qt(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var Yt=Math.log,Dt=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*Yt(e),t=a<20?0:.8274096064007395*(t=a-10)-254.76935184120902+115.67994401066147*Yt(t)):(n=351.97690566805693+.114206453784165*(n=a-55)-40.25366309332127*Yt(n),e=325.4494125711974+.07943456536662342*(e=a-50)-28.0852963507957*Yt(e),t=255),[n,e,t,1]},St=Dt,Ct=l.unpack,It=Math.round,$t=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];for(var e,t=Ct(r,"rgb"),a=t[0],f=t[2],o=1e3,u=4e4;u-o>.4;){var c=St(e=.5*(u+o));c[2]/c[0]>=f/a?u=e:o=e}return It(e)},zt=y,Tt=v,Wt=h,Xt=$t;Tt.prototype.temp=Tt.prototype.kelvin=Tt.prototype.temperature=function(){return Xt(this._rgb)},zt.temp=zt.kelvin=zt.temperature=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Tt,[null].concat(r,["temp"])))},Wt.format.temp=Wt.format.kelvin=Wt.format.temperature=Dt;var Vt=l.unpack,Ut=l.type,Zt=y,Ht=v,Kt=h,Qt=yr;Ht.prototype.oklab=function(){return Qt(this._rgb)},Zt.oklab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Ht,[null].concat(r,["oklab"])))},Kt.format.oklab=sn,Kt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Vt(r,"oklab"),"array"===Ut(r)&&3===r.length)return"oklab"}});var Jt=l.unpack,ra=l.type,na=y,ea=v,ta=h,aa=Or;ea.prototype.oklch=function(){return aa(this._rgb)},na.oklch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ea,[null].concat(r,["oklch"])))},ta.format.oklch=vn,ta.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Jt(r,"oklch"),"array"===ra(r)&&3===r.length)return"oklch"}});var fa=l.unpack,oa=l.last,ua=Math.round,ca=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=fa(r,"rgba"),t=(1!==e[3]?oa(r):"rgb")||"rgb";return e[0]=ua(e[0]),e[1]=ua(e[1]),e[2]=ua(e[2]),("rgba"===t||e.length>3&&e[3]<1&&"rgb"!==oa(r))&&(e[3]=e.length>3?e[3]:1,t="rgba"),"rgba"===t?e[3]<<24|e[0]<<16|e[1]<<8|e[2]:4278190080|e[0]<<16|e[1]<<8|e[2]},ia=l.type,la=function(r){if("number"==ia(r)){var n=(r>>24&255)/255;if(n>=0&&n<=1){var e=r-4278190080;return[e>>16&255,e>>8&255,255&e,n]}}throw new Error("unknown android color: "+r)},ha=y,sa=v,da=h,ba=l.type,pa=ca;sa.prototype.android=function(r){return pa(this._rgb,r)},ha.android=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(sa,[null].concat(r,["android"])))},da.format.android=la,da.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===ba(r[0])){var e=(r[0]>>24&255)/255;if(e>=0&&e<=1){var t=r[0]-4278190080;if([t>>16&255,t>>8&255,255&t].every((function(r){return r>=0&&r<=255})))return"android"}}}});var ga=v,va=l.type;ga.prototype.alpha=function(r,n){return void 0===n&&(n=!1),void 0!==r&&"number"===va(r)?n?(this._rgb[3]=r,this):new ga([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},v.prototype.clipped=function(){return this._rgb._clipped||!1};var ma=v,ya=$;ma.prototype.darken=function(r){void 0===r&&(r=1);var n=this.lab();return n[0]-=ya.Kn*r,new ma(n,"lab").alpha(this.alpha(),!0)},ma.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},ma.prototype.darker=ma.prototype.darken,ma.prototype.brighter=ma.prototype.brighten,v.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.substring(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+t+" in mode "+e)}return a};var ka=v,wa=l.type,Na=Math.pow;ka.prototype.luminance=function(r){if(void 0!==r&&"number"===wa(r)){if(0===r)return new ka([0,0,0,this._rgb[3]],"rgb");if(1===r)return new ka([255,255,255,this._rgb[3]],"rgb");var n=this.luminance(),e=20,t=function(n,a){var f=n.interpolate(a,.5,"rgb"),o=f.luminance();return Math.abs(r-o)<1e-7||!e--?f:o>r?t(n,f):t(f,a)},a=(n>r?t(new ka([0,0,0]),this):t(this,new ka([255,255,255]))).rgb();return new ka(a.concat([this._rgb[3]]))}return Ma.apply(void 0,this._rgb.slice(0,3))};var Ma=function(r,n,e){return.2126*(r=_a(r))+.7152*(n=_a(n))+.0722*(e=_a(e))},_a=function(r){return(r/=255)<=.03928?r/12.92:Na((r+.055)/1.055,2.4)},Aa={},Pa=v,xa=l.type,Ea=Aa,Oa=function(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(Ea[f]||t.length||(f=Object.keys(Ea)[0]),!Ea[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==xa(r)&&(r=new Pa(r)),"object"!==xa(n)&&(n=new Pa(n)),Ea[f](r,n,e).alpha(r.alpha()+e*(n.alpha()-r.alpha()))},Ga=v,Ra=Oa;Ga.prototype.mix=Ga.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 Ra.apply(void 0,[this,r,n].concat(e))};var ja=v;ja.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 ja([n[0]*e,n[1]*e,n[2]*e,e],"rgb")};var Ba=v,Fa=$;Ba.prototype.saturate=function(r){void 0===r&&(r=1);var n=this.lch();return n[1]+=Fa.Kn*r,n[1]<0&&(n[1]=0),new Ba(n,"lch").alpha(this.alpha(),!0)},Ba.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)};var qa=v,La=l.type;qa.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.substring(0,2)?2:0);if(u>-1){if("string"==La(n))switch(n.charAt(0)){case"+":case"-":o[u]+=+n;break;case"*":o[u]*=+n.substring(1);break;case"/":o[u]/=+n.substring(1);break;default:o[u]=+n}else{if("number"!==La(n))throw new Error("unsupported value for Color.set");o[u]=n}var c=new qa(o,a);return e?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+f+" in mode "+a)}return o};var Ya=v;Aa.rgb=function(r,n,e){var t=r._rgb,a=n._rgb;return new Ya(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"rgb")};var Da=v,Sa=Math.sqrt,Ca=Math.pow;Aa.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 Da(Sa(Ca(a,2)*(1-e)+Ca(c,2)*e),Sa(Ca(f,2)*(1-e)+Ca(i,2)*e),Sa(Ca(o,2)*(1-e)+Ca(l,2)*e),"rgb")};var Ia=v;Aa.lab=function(r,n,e){var t=r.lab(),a=n.lab();return new Ia(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"lab")};var $a=v,za=function(r,n,e,t){var a,f,o,u,c,i,l,h,s,d,b,p,g;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.substring(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)?p=Number.NaN:(p=i,1!=s&&0!=s||"hsv"==t||(b=h)):(p=c,1!=d&&0!=d||"hsv"==t||(b=l)):p=c+e*(i>c&&i-c>180?i-(c+360):i180?i+360-c:i-c),void 0===b&&(b=l+e*(h-l)),g=s+e*(d-s),new $a("oklch"===t?[g,b,p]:[p,b,g],t)},Ta=za,Wa=function(r,n,e){return Ta(r,n,e,"lch")};Aa.lch=Wa,Aa.hcl=Wa;var Xa=v;Aa.num=function(r,n,e){var t=r.num(),a=n.num();return new Xa(t+e*(a-t),"num")};var Va=za;Aa.hcg=function(r,n,e){return Va(r,n,e,"hcg")};var Ua=za;Aa.hsi=function(r,n,e){return Ua(r,n,e,"hsi")};var Za=za;Aa.hsl=function(r,n,e){return Za(r,n,e,"hsl")};var Ha=za;Aa.hsv=function(r,n,e){return Ha(r,n,e,"hsv")};var Ka=v;Aa.oklab=function(r,n,e){var t=r.oklab(),a=n.oklab();return new Ka(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"oklab")};var Qa=za;Aa.oklch=function(r,n,e){return Qa(r,n,e,"oklch")};var Ja=v,rf=l.clip_rgb,nf=Math.pow,ef=Math.sqrt,tf=Math.PI,af=Math.cos,ff=Math.sin,of=Math.atan2,uf=function(r,n){for(var e=r.length,t=[0,0,0,0],a=0;a.9999999&&(t[3]=1),new Ja(rf(t))},cf=y,lf=l.type,hf=Math.pow,sf=function(r){var n="rgb",e=cf("#ccc"),t=0,a=[0,1],f=[],o=[0,0],u=!1,c=[],i=!1,l=0,h=1,s=!1,d={},b=!0,p=1,g=function(r){if((r=r||["#fff","#000"])&&"string"===lf(r)&&cf.brewer&&cf.brewer.hasOwnProperty(r.toLowerCase())&&"palettes"!==r&&(r=cf.brewer[r.toLowerCase()]),"array"===lf(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var n=0;n2){var s=function(r){if(null!=u){for(var n=u.length-1,e=0;e=u[e];)e++;return e-1}return 0}(r);i=s/(u.length-2)}else i=h!==l?(r-l)/(h-l):1;i=m(i),t||(i=v(i)),1!==p&&(i=hf(i,p)),i=o[0]+i*(1-o[0]-o[1]),i=Math.min(1,Math.max(0,i));var g=Math.floor(1e4*i);if(b&&d[g])a=d[g];else{if("array"===lf(c))for(var y=0;y=k&&y===f.length-1){a=c[y];break}if(i>k&&i2){var i=r.map((function(n,e){return e/(r.length-1)})),s=r.map((function(r){return(r-l)/(h-l)}));s.every((function(r,n){return i[n]===r}))||(m=function(r){if(r<=0||r>=1)return r;for(var n=0;r>=s[n+1];)n++;var e=(r-s[n])/(s[n+1]-s[n]);return i[n]+e*(i[n+1]-i[n])})}}return a=[l,h],w},w.mode=function(r){return arguments.length?(n=r,k(),w):n},w.range=function(r,n){return g(r),w},w.out=function(r){return i=r,w},w.spread=function(r){return arguments.length?(t=r,w):t},w.correctLightness=function(r){return null==r&&(r=!0),s=r,k(),v=s?function(r){for(var n=y(0,!0).lab()[0],e=y(1,!0).lab()[0],t=n>e,a=y(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=y(r,!0).lab()[0],o=a-f;return r}:function(r){return r},w},w.padding=function(r){return null!=r?("number"===lf(r)&&(r=[r,r]),o=r,w):o},w.colors=function(n,e){arguments.length<2&&(e="hex");var t=[];if(0===arguments.length)t=c.slice(0);else if(1===n)t=[w(.5)];else if(n>1){var f=a[0],o=a[1]-f;t=function(r,n,e){for(var t=[],a=rf;a?o++:o--)t.push(o);return t}(0,n,!1).map((function(r){return w(f+r/(n-1)*o)}))}else{r=[];var i=[];if(u&&u.length>2)for(var l=1,h=u.length,s=1<=h;s?lh;s?l++:l--)i.push(.5*(u[l-1]+u[l]));else i=a;t=i.map((function(r){return w(r)}))}return cf[e]&&(t=t.map((function(r){return r[e]()}))),t},w.cache=function(r){return null!=r?(b=r,w):b},w.gamma=function(r){return null!=r?(p=r,w):p},w.nodata=function(r){return null!=r?(e=cf(r),w):e},w};var df=v,bf=sf,pf=y,gf=function(r,n,e){if(!gf[e])throw new Error("unknown blend mode "+e);return gf[e](r,n)},vf=function(r){return function(n,e){var t=pf(e).rgb(),a=pf(n).rgb();return pf.rgb(r(t,a))}},mf=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}};gf.normal=vf(mf((function(r){return r}))),gf.multiply=vf(mf((function(r,n){return r*n/255}))),gf.screen=vf(mf((function(r,n){return 255*(1-(1-r/255)*(1-n/255))}))),gf.overlay=vf(mf((function(r,n){return n<128?2*r*n/255:255*(1-2*(1-r/255)*(1-n/255))}))),gf.darken=vf(mf((function(r,n){return r>n?n:r}))),gf.lighten=vf(mf((function(r,n){return r>n?r:n}))),gf.dodge=vf(mf((function(r,n){return 255===r||(r=n/255*255/(1-r/255))>255?255:r}))),gf.burn=vf(mf((function(r,n){return 255*(1-(1-n/255)/(r/255))})));var yf=gf,kf=l.type,wf=l.clip_rgb,Nf=l.TWOPI,Mf=Math.pow,_f=Math.sin,Af=Math.cos,Pf=y,xf=v,Ef=Math.floor,Of=Math.random,Gf=o,Rf=Math.log,jf=Math.pow,Bf=Math.floor,Ff=Math.abs,qf=function(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"===Gf(r)&&(r=Object.values(r)),r.forEach((function(r){n&&"object"===Gf(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 Lf(e,r,n)},e},Lf=function(r,n,e){void 0===n&&(n="equal"),void 0===e&&(e=7),"array"==Gf(r)&&(r=qf(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.substring(0,1)&&(o.push(t),o.push(a)),"e"===n.substring(0,1)){o.push(t);for(var u=1;u 0");var c=Math.LOG10E*Rf(t),i=Math.LOG10E*Rf(a);o.push(t);for(var l=1;l200&&(y=!1)}for(var q={},L=0;L=360;)p-=360;u[b]=p}else u[b]=u[b]/c[b];return d/=t,new Ja(u,n).alpha(d>.99999?1:d,!0)},ho.bezier=function(r){var n=function(r){var n,e,t,a,f,o,u;if(2===(r=r.map((function(r){return new df(r)}))).length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],a=function(n){var e=function(r,e){return r+n*(e-r)},t=[0,1,2].map((function(r){return e(f[r],o[r])})),a=e(r[0].alpha(),r[1].alpha());return new df(t,"lab").alpha(a)};else if(3===r.length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],a=function(n){var e=function(r,e,t){return(1-n)*(1-n)*r+2*(1-n)*n*e+n*n*t},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha());return new df(t,"lab").alpha(a)};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(n){var e=function(r,e,t,a){return(1-n)*(1-n)*(1-n)*r+3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*t+n*n*n*a},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r],c[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha(),r[3].alpha());return new df(t,"lab").alpha(a)}}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)},ho.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*Zf)},o=function(r){return 2*Zf*r/360};r=new Sf(r),n=new Sf(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],p=(c+s)/2,g=(Cf(If(i,2)+If(l,2))+Cf(If(d,2)+If(b,2)))/2,v=.5*(1-Cf(If(g,7)/(If(g,7)+If(25,7)))),m=i*(1+v),y=d*(1+v),k=Cf(If(m,2)+If(l,2)),w=Cf(If(y,2)+If(b,2)),N=(k+w)/2,M=f(Tf(l,m)),_=f(Tf(b,y)),A=M>=0?M:M+360,P=_>=0?_:_+360,x=Wf(A-P)>180?(A+P+360)/2:(A+P)/2,E=1-.17*Xf(o(x-30))+.24*Xf(o(2*x))+.32*Xf(o(3*x+6))-.2*Xf(o(4*x-63)),O=P-A;O=Wf(O)<=180?O:P<=A?O+360:O-360,O=2*Cf(k*w)*Vf(o(O)/2);var G=s-c,R=w-k,j=1+.015*If(p-50,2)/Cf(20+If(p-50,2)),B=1+.045*N,F=1+.015*N*E,q=30*Uf(-If((x-275)/25,2)),L=-(2*Cf(If(N,7)/(If(N,7)+If(25,7))))*Vf(2*o(q)),Y=Cf(If(G/(e*j),2)+If(R/(t*B),2)+If(O/(a*F),2)+L*(R/(t*B))*(O/(a*F)));return zf(0,$f(100,Y))},ho.distance=function(r,n,e,t){if(void 0===e&&(e="lab"),void 0===t&&(t=null),t){var a=t;t=new Array(4).fill(1),a.slice(0,4).forEach((function(r,n){isNaN(r)||(t[n]=r)}))}else t=Array(4).fill(1);r=new Hf(r),n=new Hf(n);var f,o=r.get(e),u=n.get(e),c=e.replace(/(^ok)/gi,""),i=0;for(var l in o){if("h"===c.charAt(l)){var h=(o[l]||0)-(u[l]||0);f=Math.abs(h+180)%360-180}else f=(o[l]||0)-(u[l]||0);i+=f*f*t[l]*t[l]}return Math.sqrt(i)},ho.stdDeviation=function(r){var n=(r=[].concat(r).map((function(r){return new Kf(r).rgba()}))).length;Array.from(Array(n),(function(){return new Array(n)}));for(var e=[0,0,0,0],t=0;te?e:r},n=r,e={},t=0,a=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];t255)&&(r._clipped=!0),r[e]=n(r[e],0,255)):3===e&&(r[e]=n(r[e],0,1));return r},limit:r,type:o,unpack:function(r,n){return void 0===n&&(n=null),r.length>=3?Array.prototype.slice.call(r):"object"==u(r[0])&&n?n.split("").filter((function(n){return void 0!==r[0][n]})).map((function(n){return r[0][n]})):r[0]},last:function(r){if(r.length<2)return null;var n=r.length-1;return"string"==c(r[n])?r[n].toLowerCase():null},PI:i,TWOPI:2*i,PITHIRD:i/3,DEG2RAD:i/180,RAD2DEG:180/i},h={format:{},autodetect:[]},s=l.last,d=l.clip_rgb,b=l.type,p=h,g=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=this;if("object"===b(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];"array"===b(r[0])&&1===r.length&&(r=[].concat(r[0]));var t=s(r),a=!1;if(!t){a=!0,p.sorted||(p.autodetect=p.autodetect.sort((function(r,n){return n.p-r.p})),p.sorted=!0);for(var f=0,o=p.autodetect;f4?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]},A=y,P=v,x=h,E=l.unpack,O=l.type,G=N;P.prototype.cmyk=function(){return G(this._rgb)},A.cmyk=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(P,[null].concat(r,["cmyk"])))},x.format.cmyk=_,x.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=E(r,"cmyk"),"array"===O(r)&&4===r.length)return"cmyk"}});var R=l.unpack,j=l.last,B=function(r){return Math.round(100*r)/100},F=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=R(r,"hsla"),t=j(r)||"lsa";return e[0]=B(e[0]||0),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+"("+e.join(",")+")"},q=l.unpack,L=y,Y=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=q(r,"rgba"))[0],t=r[1],a=r[2];e/=255,t/=255,a/=255;var f,o,u=Math.min(e,t,a),c=Math.max(e,t,a),i=(c+u)/2;return c===u?(f=0,o=L.hueNaN?Number.NaN:0):f=i<.5?(c-u)/(c+u):(c-u)/(2-c-u),e==c?o=(t-a)/(c-u):t==c?o=2+(a-e)/(c-u):a==c&&(o=4+(e-t)/(c-u)),(o*=60)<0?o+=360:!L.hueNaN&&isNaN(o)&&(o=0),r.length>3&&void 0!==r[3]?[o,f,i,r[3]]:[o,f,i]},D=l.unpack,S=l.last,C=function(r){return Math.round(100*r)/100},I=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=D(r,"lch"),t=S(r)||"lch";return e[0]=C(e[0])+"%",e[1]=C(e[1])+"%",e[2]=C(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lch("+e.join(" ")+")"},$={Kn:18,Xn:.95047,Yn:1,Zn:1.08883,t0:.137931034,t1:.206896552,t2:.12841855,t3:.008856452},z=$,T=l.unpack,W=Math.pow,X=function(r){return(r/=255)<=.04045?r/12.92:W((r+.055)/1.055,2.4)},V=function(r){return r>z.t3?W(r,1/3):r/z.t2+z.t0},U=function(r,n,e){return r=X(r),n=X(n),e=X(e),[V((.4124564*r+.3575761*n+.1804375*e)/z.Xn),V((.2126729*r+.7151522*n+.072175*e)/z.Yn),V((.0193339*r+.119192*n+.9503041*e)/z.Zn)]},Z=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=T(r,"rgb"),t=e[0],a=e[1],f=e[2],o=U(t,a,f),u=o[0],c=o[1],i=116*c-16;return[i<0?0:i,500*(u-c),200*(c-o[2])]},H=l.unpack,K=l.RAD2DEG,Q=Math.sqrt,J=Math.atan2,rr=Math.round,nr=y,er=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=H(r,"lab"),t=e[0],a=e[1],f=e[2],o=Q(a*a+f*f),u=(J(f,a)*K+360)%360;return 0===rr(1e4*o)&&(u=nr.hueNaN?Number.NaN:0),[t,o,u]},tr=l.unpack,ar=Z,fr=er,or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=tr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=ar(t,a,f),u=o[0],c=o[1],i=o[2];return fr(u,c,i)},ur=l.unpack,cr=l.last,ir=function(r){return Math.round(100*r)/100},lr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ur(r,"lab"),t=cr(r)||"lab";return e[0]=ir(e[0])+"%",e[1]=ir(e[1])+"%",e[2]=ir(e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"lab("+e.join(" ")+")"},hr=l.unpack,sr=l.last,dr=function(r){return Math.round(100*r)/100},br=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=hr(r,"lab"),t=sr(r)||"lab";return e[0]=dr(100*e[0])+"%",e[1]=dr(100*e[1])+"%",e[2]=dr(100*e[2])+"%","laba"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklab("+e.join(" ")+")"},pr=l.unpack,gr=Math.cbrt,vr=Math.pow,mr=Math.sign,yr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=[kr(t/255),kr(a/255),kr(f/255)],u=o[0],c=o[1],i=o[2],l=gr(.4122214708*u+.5363325363*c+.0514459929*i),h=gr(.2119034982*u+.6806995451*c+.1073969566*i),s=gr(.0883024619*u+.2817188376*c+.6299787005*i);return[.2104542553*l+.793617785*h-.0040720468*s,1.9779984951*l-2.428592205*h+.4505937099*s,.0259040371*l+.7827717662*h-.808675766*s]};function kr(r){var n=Math.abs(r);return n<.04045?r/12.92:(mr(r)||1)*vr((n+.055)/1.055,2.4)}var wr=l.unpack,Nr=l.last,Mr=function(r){return Math.round(100*r)/100},_r=Math.min,Ar=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=wr(r,"lch"),t=Nr(r)||"lch";return e[0]=Mr(100*e[0])+"%",e[1]=_r(Mr(e[1]/.4*100),100)+"%",e[2]=Mr(e[2]||0),"lcha"===t||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,"oklch("+e.join(" ")+")"},Pr=l.unpack,xr=yr,Er=er,Or=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Pr(r,"rgb"),t=e[0],a=e[1],f=e[2],o=xr(t,a,f),u=o[0],c=o[1],i=o[2];return Er(u,c,i)},Gr=l.unpack,Rr=l.last,jr=F,Br=Y,Fr=I,qr=or,Lr=lr,Yr=Z,Dr=br,Sr=yr,Cr=Ar,Ir=Or,$r=Math.round,zr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Gr(r,"rgba"),t=Rr(r)||"rgb";return"hsl"==t.substring(0,3)?jr(Br(e),t):"lch"==t.substring(0,3)?Fr(qr(e),t):"lab"==t.substring(0,3)?Lr(Yr(e).concat([e.length>3?e[3]:1]),t):"oklab"==t.substring(0,5)?Dr(Sr(e).concat([e.length>3?e[3]:1]),"lab"):"oklch"==t.substring(0,5)?Cr(Ir(e).concat([e.length>3?e[3]:1]),"lch"):(e[0]=$r(e[0]),e[1]=$r(e[1]),e[2]=$r(e[2]),("rgba"===t||e.length>3&&e[3]<1)&&(e[3]=e.length>3?e[3]:1,t="rgba"),t+"("+e.slice(0,"rgb"===t?3:4).join(",")+")")},Tr=l.unpack,Wr=Math.round,Xr=function(){for(var r,n=[],e=arguments.length;e--;)n[e]=arguments[e];var t,a,f,o=(n=Tr(n,"hsl"))[0],u=n[1],c=n[2];if(0===u)t=a=f=255*c;else{var i=[0,0,0],l=[0,0,0],h=c<.5?c*(1+u):c+u-c*u,s=2*c-h,d=o/360;i[0]=d+1/3,i[1]=d,i[2]=d-1/3;for(var b=0;b<3;b++)i[b]<0&&(i[b]+=1),i[b]>1&&(i[b]-=1),6*i[b]<1?l[b]=s+6*(h-s)*i[b]:2*i[b]<1?l[b]=h:3*i[b]<2?l[b]=s+(h-s)*(2/3-i[b])*6:l[b]=s;t=(r=[Wr(255*l[0]),Wr(255*l[1]),Wr(255*l[2])])[0],a=r[1],f=r[2]}return n.length>3?[t,a,f,n[3]]:[t,a,f,1]},Vr=$,Ur=l.unpack,Zr=Math.pow,Hr=function(r){return 255*(r<=.00304?12.92*r:1.055*Zr(r,1/2.4)-.055)},Kr=function(r){return r>Vr.t1?r*r*r:Vr.t2*(r-Vr.t0)},Qr=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ur(r,"lab"))[0],o=r[1],u=r[2];return t=(f+16)/116,e=isNaN(o)?t:t+o/500,a=isNaN(u)?t:t-u/200,t=Vr.Yn*Kr(t),e=Vr.Xn*Kr(e),a=Vr.Zn*Kr(a),[Hr(3.2404542*e-1.5371385*t-.4985314*a),Hr(-.969266*e+1.8760108*t+.041556*a),Hr(.0556434*e-.2040259*t+1.0572252*a),r.length>3?r[3]:1]},Jr=l.unpack,rn=l.DEG2RAD,nn=Math.sin,en=Math.cos,tn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Jr(r,"lch"),t=e[0],a=e[1],f=e[2];return isNaN(f)&&(f=0),[t,en(f*=rn)*a,nn(f)*a]},an=l.unpack,fn=tn,on=Qr,un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=an(r,"lch"))[0],t=r[1],a=r[2],f=fn(e,t,a),o=f[0],u=f[1],c=f[2],i=on(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},cn=l.unpack,ln=Math.pow,hn=Math.sign,sn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=cn(r,"lab"))[0],t=r[1],a=r[2],f=ln(e+.3963377774*t+.2158037573*a,3),o=ln(e-.1055613458*t-.0638541728*a,3),u=ln(e-.0894841775*t-1.291485548*a,3);return[255*dn(4.0767416621*f-3.3077115913*o+.2309699292*u),255*dn(-1.2684380046*f+2.6097574011*o-.3413193965*u),255*dn(-.0041960863*f-.7034186147*o+1.707614701*u),r.length>3?r[3]:1]};function dn(r){var n=Math.abs(r);return n>.0031308?(hn(r)||1)*(1.055*ln(n,1/2.4)-.055):12.92*r}var bn=l.unpack,pn=tn,gn=sn,vn=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=(r=bn(r,"lch"))[0],t=r[1],a=r[2],f=pn(e,t,a),o=f[0],u=f[1],c=f[2],i=gn(o,u,c);return[i[0],i[1],i[2],r.length>3?r[3]:1]},mn=Xr,yn=Qr,kn=un,wn=sn,Nn=vn,Mn=h,_n=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,An=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,Pn=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,xn=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,En=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,On=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,Gn=/^lab\(\s*(\d+(?:\.\d+)?)%?\s* (-?\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)%?\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Rn=/^lch\(\s*(\d+(?:\.\d+)?)%?\s* (\d+(?:\.\d+)?)%?\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,jn=/^oklab\(\s*(\d+(?:\.\d+)?%?)\s* (-?\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?%?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Bn=/^oklch\(\s*(\d+(?:\.\d+)?%?)\s* (\d+(?:\.\d+)?%?)\s* \s*(-?\d+(?:\.\d+)?)\s*(?:\/\s*([01]|[01]?\.\d+))?\)$/,Fn=Math.round,qn=Math.abs,Ln=function(r){var n;if(r=r.toLowerCase().trim(),Mn.format.named)try{return Mn.format.named(r)}catch(r){}if(n=r.match(_n)){for(var e=n.slice(1,4),t=0;t<3;t++)e[t]=Number(e[t]);return e[3]=1,e}if(n=r.match(An)){for(var a=n.slice(1,5),f=0;f<4;f++)a[f]=Number(a[f]);return a}if(n=r.match(Pn)){for(var o=n.slice(1,4),u=0;u<3;u++)o[u]=Fn(2.55*Number(o[u]));return o[3]=1,o}if(n=r.match(xn)){for(var c=n.slice(1,5),i=0;i<3;i++)c[i]=Fn(2.55*Number(c[i]));return c[3]=Number(c[3]),c}if(n=r.match(En)){for(var l=n.slice(1,4),h=0;h<=2;h++)l[h]=Number(l[h]);l[1]*=.01,l[2]*=.01;var s=mn(l);return s[3]=1,s}if(n=r.match(On)){for(var d=n.slice(1,4),b=0;b<=2;b++)d[b]=Number(d[b]);d[1]*=.01,d[2]*=.01;var p=mn(d);return p[3]=Number(n[4]),p}if(n=r.match(Gn)){for(var g=n.slice(1,4),v=0;v<=2;v++)g[v]=Number(g[v]);var m=yn(g).map((function(r){return qn(Fn(r))}));return m[3]=Number(n[4]),m[3]||0===m[3]||(m[3]=1),m}if(n=r.match(Rn)){for(var y=n.slice(1,4),k=0;k<=2;k++)y[k]=Number(y[k]);var w=kn(y).map((function(r){return qn(Fn(r))}));return w[3]=Number(n[4]),w[3]||0===w[3]||(w[3]=1),w}if(n=r.match(jn)){for(var N=n.slice(1,4),M=0;M<=2;M++)N[M].endsWith("%")?N[M]=.01*Number(N[M].replace("%","")):N[M]=Number(N[M]);var _=wn(N).map((function(r){return qn(Fn(r))}));return _[3]=Number(n[4]),_[3]||0===_[3]||(_[3]=1),_}if(n=r.match(Bn)){for(var A=n.slice(1,4),P=0;P<=1;P++)A[P].endsWith("%")?(A[P]=.01*Number(A[P].replace("%","")),1===P&&(A[P]*=.4)):A[P]=Number(A[P]);var x=Nn(A).map((function(r){return qn(Fn(r))}));return x[3]=Number(n[4]),x[3]||0===x[3]||(x[3]=1),x}};Ln.test=function(r){return _n.test(r)||An.test(r)||Pn.test(r)||xn.test(r)||En.test(r)||On.test(r)||Gn.test(r)||Rn.test(r)||jn.test(r)||Bn.test(r)};var Yn=y,Dn=v,Sn=h,Cn=l.type,In=zr,$n=Ln;Dn.prototype.css=function(r){return In(this._rgb,r)},Yn.css=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Dn,[null].concat(r,["css"])))},Sn.format.css=$n,Sn.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"===Cn(r)&&$n.test(r))return"css"}});var zn=v,Tn=y,Wn=l.unpack;h.format.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Wn(r,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e},Tn.gl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(zn,[null].concat(r,["gl"])))},zn.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var Xn=l.unpack,Vn=y,Un=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=Xn(r,"rgb"),a=t[0],f=t[1],o=t[2],u=Math.min(a,f,o),c=Math.max(a,f,o),i=c-u,l=100*i/255,h=u/(255-i)*100;return 0===i?e=Vn.hueNaN?Number.NaN:0:(a===c&&(e=(f-o)/i),f===c&&(e=2+(o-a)/i),o===c&&(e=4+(a-f)/i),(e*=60)<0?e+=360:!Vn.hueNaN&&isNaN(e)&&(e=0)),[e,l,h]},Zn=l.unpack,Hn=Math.floor,Kn=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Zn(o,"hcg"))[0],s=o[1],d=o[2];d*=255;var b=255*s;if(0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var p=Hn(h/=60),g=h-p,v=d*(1-s),m=v+b*(1-g),y=v+b*g,k=v+b;switch(p){case 0:c=(r=[k,y,v])[0],i=r[1],l=r[2];break;case 1:c=(n=[m,k,v])[0],i=n[1],l=n[2];break;case 2:c=(e=[v,k,y])[0],i=e[1],l=e[2];break;case 3:c=(t=[v,m,k])[0],i=t[1],l=t[2];break;case 4:c=(a=[y,v,k])[0],i=a[1],l=a[2];break;case 5:c=(f=[k,v,m])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Qn=l.unpack,Jn=l.type,re=y,ne=v,ee=h,te=Un;ne.prototype.hcg=function(){return te(this._rgb)},re.hcg=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ne,[null].concat(r,["hcg"])))},ee.format.hcg=Kn,ee.autodetect.push({p:1,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Qn(r,"hcg"),"array"===Jn(r)&&3===r.length)return"hcg"}});var ae=l.unpack,fe=l.last,oe=Math.round,ue=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ae(r,"rgba"),t=e[0],a=e[1],f=e[2],o=e[3],u=fe(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c="000000"+((t=oe(t))<<16|(a=oe(a))<<8|(f=oe(f))).toString(16);c=c.substring(c.length-6);var i="0"+oe(255*o).toString(16);switch(i=i.substring(i.length-2),u.toLowerCase()){case"rgba":return"#"+c+i;case"argb":return"#"+i+c;default:return"#"+c}},ce=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,ie=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,le=function(r){if(r.match(ce)){4!==r.length&&7!==r.length||(r=r.substring(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(ie)){5!==r.length&&9!==r.length||(r=r.substring(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)},he=y,se=v,de=l.type,be=h,pe=ue;se.prototype.hex=function(r){return pe(this._rgb,r)},he.hex=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(se,[null].concat(r,["hex"])))},be.format.hex=le,be.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"===de(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var ge=l.unpack,ve=l.TWOPI,me=Math.min,ye=Math.sqrt,ke=Math.acos,we=y,Ne=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t=ge(r,"rgb"),a=t[0],f=t[1],o=t[2],u=me(a/=255,f/=255,o/=255),c=(a+f+o)/3,i=c>0?1-u/c:0;return 0===i?e=we.hueNaN?Number.NaN:0:(e=(a-f+(a-o))/2,e/=ye((a-f)*(a-f)+(a-o)*(f-o)),e=ke(e),o>f&&(e=ve-e),e/=ve,!we.hueNaN&&isNaN(e)&&(e=0)),[360*e,i,c]},Me=l.unpack,_e=l.limit,Ae=l.TWOPI,Pe=l.PITHIRD,xe=Math.cos,Ee=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Me(r,"hsi"))[0],o=r[1],u=r[2];return isNaN(f)&&(f=0),isNaN(o)&&(o=0),f>360&&(f-=360),f<0&&(f+=360),(f/=360)<1/3?t=1-((a=(1-o)/3)+(e=(1+o*xe(Ae*f)/xe(Pe-Ae*f))/3)):f<2/3?a=1-((e=(1-o)/3)+(t=(1+o*xe(Ae*(f-=1/3))/xe(Pe-Ae*f))/3)):e=1-((t=(1-o)/3)+(a=(1+o*xe(Ae*(f-=2/3))/xe(Pe-Ae*f))/3)),[255*(e=_e(u*e*3)),255*(t=_e(u*t*3)),255*(a=_e(u*a*3)),r.length>3?r[3]:1]},Oe=l.unpack,Ge=l.type,Re=y,je=v,Be=h,Fe=Ne;je.prototype.hsi=function(){return Fe(this._rgb)},Re.hsi=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(je,[null].concat(r,["hsi"])))},Be.format.hsi=Ee,Be.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Oe(r,"hsi"),"array"===Ge(r)&&3===r.length)return"hsi"}});var qe=l.unpack,Le=l.type,Ye=y,De=v,Se=h,Ce=Y;De.prototype.hsl=function(){return Ce(this._rgb)},Ye.hsl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(De,[null].concat(r,["hsl"])))},Se.format.hsl=Xr,Se.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=qe(r,"hsl"),"array"===Le(r)&&3===r.length)return"hsl"}});var Ie=l.unpack,$e=Math.min,ze=Math.max,Te=y,We=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e,t,a,f=(r=Ie(r,"rgb"))[0],o=r[1],u=r[2],c=$e(f,o,u),i=ze(f,o,u),l=i-c;return a=i/255,0===i?(e=Te.hueNaN?Number.NaN:0,t=0):(t=l/i,f===i&&(e=(o-u)/l),o===i&&(e=2+(u-f)/l),u===i&&(e=4+(f-o)/l),(e*=60)<0?e+=360:!Te.hueNaN&&isNaN(e)&&(e=0)),[e,t,a]},Xe=l.unpack,Ve=Math.floor,Ue=function(){for(var r,n,e,t,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,h=(o=Xe(o,"hsv"))[0],s=o[1],d=o[2];if(d*=255,0===s)c=i=l=d;else{360===h&&(h=0),h>360&&(h-=360),h<0&&(h+=360);var b=Ve(h/=60),p=h-b,g=d*(1-s),v=d*(1-s*p),m=d*(1-s*(1-p));switch(b){case 0:c=(r=[d,m,g])[0],i=r[1],l=r[2];break;case 1:c=(n=[v,d,g])[0],i=n[1],l=n[2];break;case 2:c=(e=[g,d,m])[0],i=e[1],l=e[2];break;case 3:c=(t=[g,v,d])[0],i=t[1],l=t[2];break;case 4:c=(a=[m,g,d])[0],i=a[1],l=a[2];break;case 5:c=(f=[d,g,v])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},Ze=l.unpack,He=l.type,Ke=y,Qe=v,Je=h,rt=We;Qe.prototype.hsv=function(){return rt(this._rgb)},Ke.hsv=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Qe,[null].concat(r,["hsv"])))},Je.format.hsv=Ue,Je.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ze(r,"hsv"),"array"===He(r)&&3===r.length)return"hsv"}});var nt=l.unpack,et=l.type,tt=y,at=v,ft=h,ot=Z;at.prototype.lab=function(){return ot(this._rgb)},tt.lab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(at,[null].concat(r,["lab"])))},ft.format.lab=Qr,ft.autodetect.push({p:2,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=nt(r,"lab"),"array"===et(r)&&3===r.length)return"lab"}});var ut=l.unpack,ct=un,it=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=ut(r,"hcl").reverse();return ct.apply(void 0,e)},lt=l.unpack,ht=l.type,st=y,dt=v,bt=h,pt=or;dt.prototype.lch=function(){return pt(this._rgb)},dt.prototype.hcl=function(){return pt(this._rgb).reverse()},st.lch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["lch"])))},st.hcl=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(dt,[null].concat(r,["hcl"])))},bt.format.lch=un,bt.format.hcl=it,["lch","hcl"].forEach((function(r){return bt.autodetect.push({p:2,test:function(){for(var n=[],e=arguments.length;e--;)n[e]=arguments[e];if(n=lt(n,r),"array"===ht(n)&&3===n.length)return r}})}));var gt={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",cornflower:"#6495ed",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"},vt=h,mt=l.type,yt=gt,kt=le,wt=ue;v.prototype.name=function(){for(var r=wt(this._rgb,"rgb"),n=0,e=Object.keys(yt);n0;)n[e]=arguments[e+1];if(!n.length&&"string"===mt(r)&&yt[r.toLowerCase()])return"named"}});var Nt=l.unpack,Mt=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Nt(r,"rgb");return(e[0]<<16)+(e[1]<<8)+e[2]},_t=l.type,At=function(r){if("number"==_t(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},Pt=y,xt=v,Et=h,Ot=l.type,Gt=Mt;xt.prototype.num=function(){return Gt(this._rgb)},Pt.num=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(xt,[null].concat(r,["num"])))},Et.format.num=At,Et.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===Ot(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var Rt=y,jt=v,Bt=h,Ft=l.unpack,qt=l.type,Lt=Math.round;jt.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(Lt)},jt.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:Lt(n):n}))},Rt.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(jt,[null].concat(r,["rgb"])))},Bt.format.rgb=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=Ft(r,"rgba");return void 0===e[3]&&(e[3]=1),e},Bt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Ft(r,"rgba"),"array"===qt(r)&&(3===r.length||4===r.length&&"number"==qt(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var Yt=Math.log,Dt=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*Yt(e),t=a<20?0:.8274096064007395*(t=a-10)-254.76935184120902+115.67994401066147*Yt(t)):(n=351.97690566805693+.114206453784165*(n=a-55)-40.25366309332127*Yt(n),e=325.4494125711974+.07943456536662342*(e=a-50)-28.0852963507957*Yt(e),t=255),[n,e,t,1]},St=Dt,Ct=l.unpack,It=Math.round,$t=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];for(var e,t=Ct(r,"rgb"),a=t[0],f=t[2],o=1e3,u=4e4;u-o>.4;){var c=St(e=.5*(u+o));c[2]/c[0]>=f/a?u=e:o=e}return It(e)},zt=y,Tt=v,Wt=h,Xt=$t;Tt.prototype.temp=Tt.prototype.kelvin=Tt.prototype.temperature=function(){return Xt(this._rgb)},zt.temp=zt.kelvin=zt.temperature=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Tt,[null].concat(r,["temp"])))},Wt.format.temp=Wt.format.kelvin=Wt.format.temperature=Dt;var Vt=l.unpack,Ut=l.type,Zt=y,Ht=v,Kt=h,Qt=yr;Ht.prototype.oklab=function(){return Qt(this._rgb)},Zt.oklab=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(Ht,[null].concat(r,["oklab"])))},Kt.format.oklab=sn,Kt.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Vt(r,"oklab"),"array"===Ut(r)&&3===r.length)return"oklab"}});var Jt=l.unpack,ra=l.type,na=y,ea=v,ta=h,aa=Or;ea.prototype.oklch=function(){return aa(this._rgb)},na.oklch=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(ea,[null].concat(r,["oklch"])))},ta.format.oklch=vn,ta.autodetect.push({p:3,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(r=Jt(r,"oklch"),"array"===ra(r)&&3===r.length)return"oklch"}});var fa=l.unpack,oa=l.last,ua=Math.round,ca=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];var e=fa(r,"rgba"),t=(1!==e[3]?oa(r):"rgb")||"rgb";return e[0]=ua(e[0]),e[1]=ua(e[1]),e[2]=ua(e[2]),("rgba"===t||e.length>3&&e[3]<1&&"rgb"!==oa(r))&&(e[3]=e.length>3?e[3]:1,t="rgba"),"rgba"===t?e[3]<<24|e[0]<<16|e[1]<<8|e[2]:4278190080|e[0]<<16|e[1]<<8|e[2]},ia=l.type,la=function(r){if("number"==ia(r)){var n=(r>>24&255)/255;if(n>=0&&n<=1){var e=r-4278190080;return[e>>16&255,e>>8&255,255&e,n]}}throw new Error("unknown android color: "+r)},ha=y,sa=v,da=h,ba=l.type,pa=ca;sa.prototype.android=function(r){return pa(this._rgb,r)},ha.android=function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];return new(Function.prototype.bind.apply(sa,[null].concat(r,["android"])))},da.format.android=la,da.autodetect.push({p:5,test:function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(1===r.length&&"number"===ba(r[0])){var e=(r[0]>>24&255)/255;if(e>=0&&e<=1){var t=r[0]-4278190080;if([t>>16&255,t>>8&255,255&t].every((function(r){return r>=0&&r<=255})))return"android"}}}});var ga=v,va=l.type;ga.prototype.alpha=function(r,n){return void 0===n&&(n=!1),void 0!==r&&"number"===va(r)?n?(this._rgb[3]=r,this):new ga([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},v.prototype.clipped=function(){return this._rgb._clipped||!1};var ma=v,ya=$;ma.prototype.darken=function(r){void 0===r&&(r=1);var n=this.lab();return n[0]-=ya.Kn*r,new ma(n,"lab").alpha(this.alpha(),!0)},ma.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},ma.prototype.darker=ma.prototype.darken,ma.prototype.brighter=ma.prototype.brighten,v.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.substring(0,2)?2:0);if(f>-1)return a[f];throw new Error("unknown channel "+t+" in mode "+e)}return a};var ka=v,wa=l.type,Na=Math.pow;ka.prototype.luminance=function(r){if(void 0!==r&&"number"===wa(r)){if(0===r)return new ka([0,0,0,this._rgb[3]],"rgb");if(1===r)return new ka([255,255,255,this._rgb[3]],"rgb");var n=this.luminance(),e=20,t=function(n,a){var f=n.interpolate(a,.5,"rgb"),o=f.luminance();return Math.abs(r-o)<1e-7||!e--?f:o>r?t(n,f):t(f,a)},a=(n>r?t(new ka([0,0,0]),this):t(this,new ka([255,255,255]))).rgb();return new ka(a.concat([this._rgb[3]]))}return Ma.apply(void 0,this._rgb.slice(0,3))};var Ma=function(r,n,e){return.2126*(r=_a(r))+.7152*(n=_a(n))+.0722*(e=_a(e))},_a=function(r){return(r/=255)<=.03928?r/12.92:Na((r+.055)/1.055,2.4)},Aa={},Pa=v,xa=l.type,Ea=Aa,Oa=function(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(Ea[f]||t.length||(f=Object.keys(Ea)[0]),!Ea[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==xa(r)&&(r=new Pa(r)),"object"!==xa(n)&&(n=new Pa(n)),Ea[f](r,n,e).alpha(r.alpha()+e*(n.alpha()-r.alpha()))},Ga=v,Ra=Oa;Ga.prototype.mix=Ga.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 Ra.apply(void 0,[this,r,n].concat(e))};var ja=v;ja.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 ja([n[0]*e,n[1]*e,n[2]*e,e],"rgb")};var Ba=v,Fa=$;Ba.prototype.saturate=function(r){void 0===r&&(r=1);var n=this.lch();return n[1]+=Fa.Kn*r,n[1]<0&&(n[1]=0),new Ba(n,"lch").alpha(this.alpha(),!0)},Ba.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)};var qa=v,La=l.type;qa.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.substring(0,2)?2:0);if(u>-1){if("string"==La(n))switch(n.charAt(0)){case"+":case"-":o[u]+=+n;break;case"*":o[u]*=+n.substring(1);break;case"/":o[u]/=+n.substring(1);break;default:o[u]=+n}else{if("number"!==La(n))throw new Error("unsupported value for Color.set");o[u]=n}var c=new qa(o,a);return e?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+f+" in mode "+a)}return o};var Ya=v;Aa.rgb=function(r,n,e){var t=r._rgb,a=n._rgb;return new Ya(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"rgb")};var Da=v,Sa=Math.sqrt,Ca=Math.pow;Aa.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 Da(Sa(Ca(a,2)*(1-e)+Ca(c,2)*e),Sa(Ca(f,2)*(1-e)+Ca(i,2)*e),Sa(Ca(o,2)*(1-e)+Ca(l,2)*e),"rgb")};var Ia=v;Aa.lab=function(r,n,e){var t=r.lab(),a=n.lab();return new Ia(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"lab")};var $a=v,za=function(r,n,e,t){var a,f,o,u,c,i,l,h,s,d,b,p,g;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.substring(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)?p=Number.NaN:(p=i,1!=s&&0!=s||"hsv"==t||(b=h)):(p=c,1!=d&&0!=d||"hsv"==t||(b=l)):p=c+e*(i>c&&i-c>180?i-(c+360):i180?i+360-c:i-c),void 0===b&&(b=l+e*(h-l)),g=s+e*(d-s),new $a("oklch"===t?[g,b,p]:[p,b,g],t)},Ta=za,Wa=function(r,n,e){return Ta(r,n,e,"lch")};Aa.lch=Wa,Aa.hcl=Wa;var Xa=v;Aa.num=function(r,n,e){var t=r.num(),a=n.num();return new Xa(t+e*(a-t),"num")};var Va=za;Aa.hcg=function(r,n,e){return Va(r,n,e,"hcg")};var Ua=za;Aa.hsi=function(r,n,e){return Ua(r,n,e,"hsi")};var Za=za;Aa.hsl=function(r,n,e){return Za(r,n,e,"hsl")};var Ha=za;Aa.hsv=function(r,n,e){return Ha(r,n,e,"hsv")};var Ka=v;Aa.oklab=function(r,n,e){var t=r.oklab(),a=n.oklab();return new Ka(t[0]+e*(a[0]-t[0]),t[1]+e*(a[1]-t[1]),t[2]+e*(a[2]-t[2]),"oklab")};var Qa=za;Aa.oklch=function(r,n,e){return Qa(r,n,e,"oklch")};var Ja=v,rf=l.clip_rgb,nf=Math.pow,ef=Math.sqrt,tf=Math.PI,af=Math.cos,ff=Math.sin,of=Math.atan2,uf=function(r,n){for(var e=r.length,t=[0,0,0,0],a=0;a.9999999&&(t[3]=1),new Ja(rf(t))},cf=y,lf=l.type,hf=Math.pow,sf=function(r){var n="rgb",e=cf("#ccc"),t=0,a=[0,1],f=[],o=[0,0],u=!1,c=[],i=!1,l=0,h=1,s=!1,d={},b=!0,p=1,g=function(r){if((r=r||["#fff","#000"])&&"string"===lf(r)&&cf.brewer&&cf.brewer.hasOwnProperty(r.toLowerCase())&&"palettes"!==r&&(r=cf.brewer[r.toLowerCase()]),"array"===lf(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var n=0;n2){var s=function(r){if(null!=u){for(var n=u.length-1,e=0;e=u[e];)e++;return e-1}return 0}(r);i=s/(u.length-2)}else i=h!==l?(r-l)/(h-l):1;i=m(i),t||(i=v(i)),i>1?i=1:i<0?i=0:1!==p&&(i=hf(i,p)),i=o[0]+i*(1-o[0]-o[1]),i=Math.min(1,Math.max(0,i));var g=Math.floor(1e4*i);if(b&&d[g])a=d[g];else{if("array"===lf(c))for(var y=0;y=k&&y===f.length-1){a=c[y];break}if(i>k&&i2){var i=r.map((function(n,e){return e/(r.length-1)})),s=r.map((function(r){return(r-l)/(h-l)}));s.every((function(r,n){return i[n]===r}))||(m=function(r){if(r<=0||r>=1)return r;for(var n=0;r>=s[n+1];)n++;var e=(r-s[n])/(s[n+1]-s[n]);return i[n]+e*(i[n+1]-i[n])})}}return a=[l,h],w},w.mode=function(r){return arguments.length?(n=r,k(),w):n},w.range=function(r,n){return g(r),w},w.out=function(r){return i=r,w},w.spread=function(r){return arguments.length?(t=r,w):t},w.correctLightness=function(r){return null==r&&(r=!0),s=r,k(),v=s?function(r){for(var n=y(0,!0).lab()[0],e=y(1,!0).lab()[0],t=n>e,a=y(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=y(r,!0).lab()[0],o=a-f;return r}:function(r){return r},w},w.padding=function(r){return null!=r?("number"===lf(r)&&(r=[r,r]),o=r,w):o},w.colors=function(n,e){arguments.length<2&&(e="hex");var t=[];if(0===arguments.length)t=c.slice(0);else if(1===n)t=[w(.5)];else if(n>1){var f=a[0],o=a[1]-f;t=function(r,n,e){for(var t=[],a=rf;a?o++:o--)t.push(o);return t}(0,n,!1).map((function(r){return w(f+r/(n-1)*o)}))}else{r=[];var i=[];if(u&&u.length>2)for(var l=1,h=u.length,s=1<=h;s?lh;s?l++:l--)i.push(.5*(u[l-1]+u[l]));else i=a;t=i.map((function(r){return w(r)}))}return cf[e]&&(t=t.map((function(r){return r[e]()}))),t},w.cache=function(r){return null!=r?(b=r,w):b},w.gamma=function(r){return null!=r?(p=r,w):p},w.nodata=function(r){return null!=r?(e=cf(r),w):e},w};var df=v,bf=sf,pf=y,gf=function(r,n,e){if(!gf[e])throw new Error("unknown blend mode "+e);return gf[e](r,n)},vf=function(r){return function(n,e){var t=pf(e).rgb(),a=pf(n).rgb();return pf.rgb(r(t,a))}},mf=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}};gf.normal=vf(mf((function(r){return r}))),gf.multiply=vf(mf((function(r,n){return r*n/255}))),gf.screen=vf(mf((function(r,n){return 255*(1-(1-r/255)*(1-n/255))}))),gf.overlay=vf(mf((function(r,n){return n<128?2*r*n/255:255*(1-2*(1-r/255)*(1-n/255))}))),gf.darken=vf(mf((function(r,n){return r>n?n:r}))),gf.lighten=vf(mf((function(r,n){return r>n?r:n}))),gf.dodge=vf(mf((function(r,n){return 255===r||(r=n/255*255/(1-r/255))>255?255:r}))),gf.burn=vf(mf((function(r,n){return 255*(1-(1-n/255)/(r/255))})));var yf=gf,kf=l.type,wf=l.clip_rgb,Nf=l.TWOPI,Mf=Math.pow,_f=Math.sin,Af=Math.cos,Pf=y,xf=v,Ef=Math.floor,Of=Math.random,Gf=o,Rf=Math.log,jf=Math.pow,Bf=Math.floor,Ff=Math.abs,qf=function(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"===Gf(r)&&(r=Object.values(r)),r.forEach((function(r){n&&"object"===Gf(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 Lf(e,r,n)},e},Lf=function(r,n,e){void 0===n&&(n="equal"),void 0===e&&(e=7),"array"==Gf(r)&&(r=qf(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.substring(0,1)&&(o.push(t),o.push(a)),"e"===n.substring(0,1)){o.push(t);for(var u=1;u 0");var c=Math.LOG10E*Rf(t),i=Math.LOG10E*Rf(a);o.push(t);for(var l=1;l200&&(y=!1)}for(var q={},L=0;L=360;)p-=360;u[b]=p}else u[b]=u[b]/c[b];return d/=t,new Ja(u,n).alpha(d>.99999?1:d,!0)},ho.bezier=function(r){var n=function(r){var n,e,t,a,f,o,u;if(2===(r=r.map((function(r){return new df(r)}))).length)n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],a=function(n){var e=function(r,e){return r+n*(e-r)},t=[0,1,2].map((function(r){return e(f[r],o[r])})),a=e(r[0].alpha(),r[1].alpha());return new df(t,"lab").alpha(a)};else if(3===r.length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],u=e[2],a=function(n){var e=function(r,e,t){return(1-n)*(1-n)*r+2*(1-n)*n*e+n*n*t},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha());return new df(t,"lab").alpha(a)};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(n){var e=function(r,e,t,a){return(1-n)*(1-n)*(1-n)*r+3*(1-n)*(1-n)*n*e+3*(1-n)*n*n*t+n*n*n*a},t=[0,1,2].map((function(r){return e(f[r],o[r],u[r],c[r])})),a=e(r[0].alpha(),r[1].alpha(),r[2].alpha(),r[3].alpha());return new df(t,"lab").alpha(a)}}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)},ho.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*Zf)},o=function(r){return 2*Zf*r/360};r=new Sf(r),n=new Sf(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],p=(c+s)/2,g=(Cf(If(i,2)+If(l,2))+Cf(If(d,2)+If(b,2)))/2,v=.5*(1-Cf(If(g,7)/(If(g,7)+If(25,7)))),m=i*(1+v),y=d*(1+v),k=Cf(If(m,2)+If(l,2)),w=Cf(If(y,2)+If(b,2)),N=(k+w)/2,M=f(Tf(l,m)),_=f(Tf(b,y)),A=M>=0?M:M+360,P=_>=0?_:_+360,x=Wf(A-P)>180?(A+P+360)/2:(A+P)/2,E=1-.17*Xf(o(x-30))+.24*Xf(o(2*x))+.32*Xf(o(3*x+6))-.2*Xf(o(4*x-63)),O=P-A;O=Wf(O)<=180?O:P<=A?O+360:O-360,O=2*Cf(k*w)*Vf(o(O)/2);var G=s-c,R=w-k,j=1+.015*If(p-50,2)/Cf(20+If(p-50,2)),B=1+.045*N,F=1+.015*N*E,q=30*Uf(-If((x-275)/25,2)),L=-(2*Cf(If(N,7)/(If(N,7)+If(25,7))))*Vf(2*o(q)),Y=Cf(If(G/(e*j),2)+If(R/(t*B),2)+If(O/(a*F),2)+L*(R/(t*B))*(O/(a*F)));return zf(0,$f(100,Y))},ho.distance=function(r,n,e,t){if(void 0===e&&(e="lab"),void 0===t&&(t=null),t){var a=t;t=new Array(4).fill(1),a.slice(0,4).forEach((function(r,n){isNaN(r)||(t[n]=r)}))}else t=Array(4).fill(1);r=new Hf(r),n=new Hf(n);var f,o=r.get(e),u=n.get(e),c=e.replace(/(^ok)/gi,""),i=0;for(var l in o){if("h"===c.charAt(l)){var h=(o[l]||0)-(u[l]||0);f=Math.abs(h+180)%360-180}else f=(o[l]||0)-(u[l]||0);i+=f*f*t[l]*t[l]}return Math.sqrt(i)},ho.stdDeviation=function(r){var n=(r=[].concat(r).map((function(r){return new Kf(r).rgba()}))).length;Array.from(Array(n),(function(){return new Array(n)}));for(var e=[0,0,0,0],t=0;t