@phun-ky/moebius 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/moebius.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @phun-ky/moebius
3
3
  * Automatically generate color palettes!
4
4
  * @author Alexander Vassbotn Røyne-Helgesen <alexander+github.com@phun-ky.net>
5
- * @version 2.0.0
5
+ * @version 2.0.2
6
6
  * @license
7
7
  * Copyright (c) 2023 Alexander Vassbotn Røyne-Helgesen
8
8
  *
@@ -50,5 +50,19 @@
50
50
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
51
51
  * SOFTWARE.
52
52
  */
53
- var t=(t,e=0,r=1)=>a(i(e,t),r),e=e=>{e._clipped=!1,e._unclipped=e.slice(0);for(let r=0;r<=3;r++)r<3?((e[r]<0||e[r]>255)&&(e._clipped=!0),e[r]=t(e[r],0,255)):3===r&&(e[r]=t(e[r],0,1));return e};const r={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])r[`[object ${t}]`]=t.toLowerCase();function n(t){return r[Object.prototype.toString.call(t)]||"object"}var o=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):"object"==n(t[0])&&e?e.split("").filter((e=>void 0!==t[0][e])).map((e=>t[0][e])):t[0],s=t=>{if(t.length<2)return null;const e=t.length-1;return"string"==n(t[e])?t[e].toLowerCase():null};const{PI:c,min:a,max:i}=Math,l=2*c,f=c/3,h=c/180,u=180/c;var b={format:{},autodetect:[]};class d{constructor(...t){const r=this;if("object"===n(t[0])&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let o=s(t),c=!1;if(!o){c=!0,b.sorted||(b.autodetect=b.autodetect.sort(((t,e)=>e.p-t.p)),b.sorted=!0);for(let e of b.autodetect)if(o=e.test(...t),o)break}if(!b.format[o])throw new Error("unknown format: "+t);{const n=b.format[o].apply(null,c?t:t.slice(0,-1));r._rgb=e(n)}3===r._rgb.length&&r._rgb.push(1)}toString(){return"function"==n(this.hex)?this.hex():`[${this._rgb.join(",")}]`}}const g=(...t)=>new g.Color(...t);g.Color=d,g.version="2.6.0";const{max:m}=Math;d.prototype.cmyk=function(){return((...t)=>{let[e,r,n]=o(t,"rgb");e/=255,r/=255,n/=255;const s=1-m(e,m(r,n)),c=s<1?1/(1-s):0;return[(1-e-s)*c,(1-r-s)*c,(1-n-s)*c,s]})(this._rgb)},g.cmyk=(...t)=>new d(...t,"cmyk"),b.format.cmyk=(...t)=>{t=o(t,"cmyk");const[e,r,n,s]=t,c=t.length>4?t[4]:1;return 1===s?[0,0,0,c]:[e>=1?0:255*(1-e)*(1-s),r>=1?0:255*(1-r)*(1-s),n>=1?0:255*(1-n)*(1-s),c]},b.autodetect.push({p:2,test:(...t)=>{if("array"===n(t=o(t,"cmyk"))&&4===t.length)return"cmyk"}});const p=t=>Math.round(100*t)/100,w=(...t)=>{t=o(t,"rgba");let[e,r,n]=t;e/=255,r/=255,n/=255;const s=a(e,r,n),c=i(e,r,n),l=(c+s)/2;let f,h;return c===s?(f=0,h=Number.NaN):f=l<.5?(c-s)/(c+s):(c-s)/(2-c-s),e==c?h=(r-n)/(c-s):r==c?h=2+(n-e)/(c-s):n==c&&(h=4+(e-r)/(c-s)),h*=60,h<0&&(h+=360),t.length>3&&void 0!==t[3]?[h,f,l,t[3]]:[h,f,l]},{round:y}=Math,x=(...t)=>{const e=o(t,"rgba");let r=s(t)||"rgb";return"hsl"==r.substr(0,3)?((...t)=>{const e=o(t,"hsla");let r=s(t)||"lsa";return e[0]=p(e[0]||0),e[1]=p(100*e[1])+"%",e[2]=p(100*e[2])+"%","hsla"===r||e.length>3&&e[3]<1?(e[3]=e.length>3?e[3]:1,r="hsla"):e.length=3,`${r}(${e.join(",")})`})(w(e),r):(e[0]=y(e[0]),e[1]=y(e[1]),e[2]=y(e[2]),("rgba"===r||e.length>3&&e[3]<1)&&(e[3]=e.length>3?e[3]:1,r="rgba"),`${r}(${e.slice(0,"rgb"===r?3:4).join(",")})`)},{round:N}=Math,k=(...t)=>{t=o(t,"hsl");const[e,r,n]=t;let s,c,a;if(0===r)s=c=a=255*n;else{const t=[0,0,0],o=[0,0,0],i=n<.5?n*(1+r):n+r-n*r,l=2*n-i,f=e/360;t[0]=f+1/3,t[1]=f,t[2]=f-1/3;for(let e=0;e<3;e++)t[e]<0&&(t[e]+=1),t[e]>1&&(t[e]-=1),6*t[e]<1?o[e]=l+6*(i-l)*t[e]:2*t[e]<1?o[e]=i:3*t[e]<2?o[e]=l+(i-l)*(2/3-t[e])*6:o[e]=l;[s,c,a]=[N(255*o[0]),N(255*o[1]),N(255*o[2])]}return t.length>3?[s,c,a,t[3]]:[s,c,a,1]},v=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,M=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,$=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,S=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,C=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,A=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,{round:F}=Math,O=t=>{let e;if(t=t.toLowerCase().trim(),b.format.named)try{return b.format.named(t)}catch(t){}if(e=t.match(v)){const t=e.slice(1,4);for(let e=0;e<3;e++)t[e]=+t[e];return t[3]=1,t}if(e=t.match(M)){const t=e.slice(1,5);for(let e=0;e<4;e++)t[e]=+t[e];return t}if(e=t.match($)){const t=e.slice(1,4);for(let e=0;e<3;e++)t[e]=F(2.55*t[e]);return t[3]=1,t}if(e=t.match(S)){const t=e.slice(1,5);for(let e=0;e<3;e++)t[e]=F(2.55*t[e]);return t[3]=+t[3],t}if(e=t.match(C)){const t=e.slice(1,4);t[1]*=.01,t[2]*=.01;const r=k(t);return r[3]=1,r}if(e=t.match(A)){const t=e.slice(1,4);t[1]*=.01,t[2]*=.01;const r=k(t);return r[3]=+e[4],r}};O.test=t=>v.test(t)||M.test(t)||$.test(t)||S.test(t)||C.test(t)||A.test(t),d.prototype.css=function(t){return x(this._rgb,t)},g.css=(...t)=>new d(...t,"css"),b.format.css=O,b.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&"string"===n(t)&&O.test(t))return"css"}}),b.format.gl=(...t)=>{const e=o(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e},g.gl=(...t)=>new d(...t,"gl"),d.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]};const{floor:_}=Math;d.prototype.hcg=function(){return((...t)=>{const[e,r,n]=o(t,"rgb"),s=a(e,r,n),c=i(e,r,n),l=c-s,f=100*l/255,h=s/(255-l)*100;let u;return 0===l?u=Number.NaN:(e===c&&(u=(r-n)/l),r===c&&(u=2+(n-e)/l),n===c&&(u=4+(e-r)/l),u*=60,u<0&&(u+=360)),[u,f,h]})(this._rgb)},g.hcg=(...t)=>new d(...t,"hcg"),b.format.hcg=(...t)=>{t=o(t,"hcg");let e,r,n,[s,c,a]=t;a*=255;const i=255*c;if(0===c)e=r=n=a;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360),s/=60;const t=_(s),o=s-t,l=a*(1-c),f=l+i*(1-o),h=l+i*o,u=l+i;switch(t){case 0:[e,r,n]=[u,h,l];break;case 1:[e,r,n]=[f,u,l];break;case 2:[e,r,n]=[l,u,h];break;case 3:[e,r,n]=[l,f,u];break;case 4:[e,r,n]=[h,l,u];break;case 5:[e,r,n]=[u,l,f]}}return[e,r,n,t.length>3?t[3]:1]},b.autodetect.push({p:1,test:(...t)=>{if("array"===n(t=o(t,"hcg"))&&3===t.length)return"hcg"}});const L=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,E=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,j=t=>{if(t.match(L)){4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16);return[e>>16,e>>8&255,255&e,1]}if(t.match(E)){5!==t.length&&9!==t.length||(t=t.substr(1)),4===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16);return[e>>24&255,e>>16&255,e>>8&255,Math.round((255&e)/255*100)/100]}throw new Error(`unknown hex color: ${t}`)},{round:P}=Math,z=(...t)=>{let[e,r,n,c]=o(t,"rgba"),a=s(t)||"auto";void 0===c&&(c=1),"auto"===a&&(a=c<1?"rgba":"rgb"),e=P(e),r=P(r),n=P(n);let i="000000"+(e<<16|r<<8|n).toString(16);i=i.substr(i.length-6);let l="0"+P(255*c).toString(16);switch(l=l.substr(l.length-2),a.toLowerCase()){case"rgba":return`#${i}${l}`;case"argb":return`#${l}${i}`;default:return`#${i}`}};d.prototype.hex=function(t){return z(this._rgb,t)},g.hex=(...t)=>new d(...t,"hex"),b.format.hex=j,b.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&"string"===n(t)&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{cos:R}=Math,{min:D,sqrt:q,acos:G}=Math;d.prototype.hsi=function(){return((...t)=>{let e,[r,n,s]=o(t,"rgb");r/=255,n/=255,s/=255;const c=D(r,n,s),a=(r+n+s)/3,i=a>0?1-c/a:0;return 0===i?e=NaN:(e=(r-n+(r-s))/2,e/=q((r-n)*(r-n)+(r-s)*(n-s)),e=G(e),s>n&&(e=l-e),e/=l),[360*e,i,a]})(this._rgb)},g.hsi=(...t)=>new d(...t,"hsi"),b.format.hsi=(...e)=>{e=o(e,"hsi");let r,n,s,[c,a,i]=e;return isNaN(c)&&(c=0),isNaN(a)&&(a=0),c>360&&(c-=360),c<0&&(c+=360),c/=360,c<1/3?(s=(1-a)/3,r=(1+a*R(l*c)/R(f-l*c))/3,n=1-(s+r)):c<2/3?(c-=1/3,r=(1-a)/3,n=(1+a*R(l*c)/R(f-l*c))/3,s=1-(r+n)):(c-=2/3,n=(1-a)/3,s=(1+a*R(l*c)/R(f-l*c))/3,r=1-(n+s)),r=t(i*r*3),n=t(i*n*3),s=t(i*s*3),[255*r,255*n,255*s,e.length>3?e[3]:1]},b.autodetect.push({p:2,test:(...t)=>{if("array"===n(t=o(t,"hsi"))&&3===t.length)return"hsi"}}),d.prototype.hsl=function(){return w(this._rgb)},g.hsl=(...t)=>new d(...t,"hsl"),b.format.hsl=k,b.autodetect.push({p:2,test:(...t)=>{if("array"===n(t=o(t,"hsl"))&&3===t.length)return"hsl"}});const{floor:I}=Math,{min:B,max:Y}=Math;d.prototype.hsv=function(){return((...t)=>{t=o(t,"rgb");let[e,r,n]=t;const s=B(e,r,n),c=Y(e,r,n),a=c-s;let i,l,f;return f=c/255,0===c?(i=Number.NaN,l=0):(l=a/c,e===c&&(i=(r-n)/a),r===c&&(i=2+(n-e)/a),n===c&&(i=4+(e-r)/a),i*=60,i<0&&(i+=360)),[i,l,f]})(this._rgb)},g.hsv=(...t)=>new d(...t,"hsv"),b.format.hsv=(...t)=>{t=o(t,"hsv");let e,r,n,[s,c,a]=t;if(a*=255,0===c)e=r=n=a;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360),s/=60;const t=I(s),o=s-t,i=a*(1-c),l=a*(1-c*o),f=a*(1-c*(1-o));switch(t){case 0:[e,r,n]=[a,f,i];break;case 1:[e,r,n]=[l,a,i];break;case 2:[e,r,n]=[i,a,f];break;case 3:[e,r,n]=[i,l,a];break;case 4:[e,r,n]=[f,i,a];break;case 5:[e,r,n]=[a,i,l]}}return[e,r,n,t.length>3?t[3]:1]},b.autodetect.push({p:2,test:(...t)=>{if("array"===n(t=o(t,"hsv"))&&3===t.length)return"hsv"}});var U=18,V=.95047,T=1,X=1.08883,H=.137931034,Z=.206896552,J=.12841855,K=.008856452;const{pow:Q}=Math,W=(...t)=>{t=o(t,"lab");const[e,r,n]=t;let s,c,a,i,l,f;return c=(e+16)/116,s=isNaN(r)?c:c+r/500,a=isNaN(n)?c:c-n/200,c=T*et(c),s=V*et(s),a=X*et(a),i=tt(3.2404542*s-1.5371385*c-.4985314*a),l=tt(-.969266*s+1.8760108*c+.041556*a),f=tt(.0556434*s-.2040259*c+1.0572252*a),[i,l,f,t.length>3?t[3]:1]},tt=t=>255*(t<=.00304?12.92*t:1.055*Q(t,1/2.4)-.055),et=t=>t>Z?t*t*t:J*(t-H),{pow:rt}=Math,nt=(...t)=>{const[e,r,n]=o(t,"rgb"),[s,c,a]=ct(e,r,n),i=116*c-16;return[i<0?0:i,500*(s-c),200*(c-a)]},ot=t=>(t/=255)<=.04045?t/12.92:rt((t+.055)/1.055,2.4),st=t=>t>K?rt(t,1/3):t/J+H,ct=(t,e,r)=>{t=ot(t),e=ot(e),r=ot(r);return[st((.4124564*t+.3575761*e+.1804375*r)/V),st((.2126729*t+.7151522*e+.072175*r)/T),st((.0193339*t+.119192*e+.9503041*r)/X)]};d.prototype.lab=function(){return nt(this._rgb)},g.lab=(...t)=>new d(...t,"lab"),b.format.lab=W,b.autodetect.push({p:2,test:(...t)=>{if("array"===n(t=o(t,"lab"))&&3===t.length)return"lab"}});const{sin:at,cos:it}=Math,lt=(...t)=>{let[e,r,n]=o(t,"lch");return isNaN(n)&&(n=0),n*=h,[e,it(n)*r,at(n)*r]},ft=(...t)=>{t=o(t,"lch");const[e,r,n]=t,[s,c,a]=lt(e,r,n),[i,l,f]=W(s,c,a);return[i,l,f,t.length>3?t[3]:1]},{sqrt:ht,atan2:ut,round:bt}=Math,dt=(...t)=>{const[e,r,n]=o(t,"lab"),s=ht(r*r+n*n);let c=(ut(n,r)*u+360)%360;return 0===bt(1e4*s)&&(c=Number.NaN),[e,s,c]},gt=(...t)=>{const[e,r,n]=o(t,"rgb"),[s,c,a]=nt(e,r,n);return dt(s,c,a)};d.prototype.lch=function(){return gt(this._rgb)},d.prototype.hcl=function(){return gt(this._rgb).reverse()},g.lch=(...t)=>new d(...t,"lch"),g.hcl=(...t)=>new d(...t,"hcl"),b.format.lch=ft,b.format.hcl=(...t)=>{const e=o(t,"hcl").reverse();return ft(...e)},["lch","hcl"].forEach((t=>b.autodetect.push({p:2,test:(...e)=>{if("array"===n(e=o(e,t))&&3===e.length)return t}})));const mt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};d.prototype.name=function(){const t=z(this._rgb,"rgb");for(let e of Object.keys(mt))if(mt[e]===t)return e.toLowerCase();return t},b.format.named=t=>{if(t=t.toLowerCase(),mt[t])return j(mt[t]);throw new Error("unknown color name: "+t)},b.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&"string"===n(t)&&mt[t.toLowerCase()])return"named"}});d.prototype.num=function(){return((...t)=>{const[e,r,n]=o(t,"rgb");return(e<<16)+(r<<8)+n})(this._rgb)},g.num=(...t)=>new d(...t,"num"),b.format.num=t=>{if("number"==n(t)&&t>=0&&t<=16777215){return[t>>16,t>>8&255,255&t,1]}throw new Error("unknown num color: "+t)},b.autodetect.push({p:5,test:(...t)=>{if(1===t.length&&"number"===n(t[0])&&t[0]>=0&&t[0]<=16777215)return"num"}});const{round:pt}=Math;d.prototype.rgb=function(t=!0){return!1===t?this._rgb.slice(0,3):this._rgb.slice(0,3).map(pt)},d.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map(((e,r)=>r<3?!1===t?e:pt(e):e))},g.rgb=(...t)=>new d(...t,"rgb"),b.format.rgb=(...t)=>{const e=o(t,"rgba");return void 0===e[3]&&(e[3]=1),e},b.autodetect.push({p:3,test:(...t)=>{if("array"===n(t=o(t,"rgba"))&&(3===t.length||4===t.length&&"number"==n(t[3])&&t[3]>=0&&t[3]<=1))return"rgb"}});const{log:wt}=Math,yt=t=>{const e=t/100;let r,n,o;return e<66?(r=255,n=e<6?0:-155.25485562709179-.44596950469579133*(n=e-2)+104.49216199393888*wt(n),o=e<20?0:.8274096064007395*(o=e-10)-254.76935184120902+115.67994401066147*wt(o)):(r=351.97690566805693+.114206453784165*(r=e-55)-40.25366309332127*wt(r),n=325.4494125711974+.07943456536662342*(n=e-50)-28.0852963507957*wt(n),o=255),[r,n,o,1]},{round:xt}=Math;d.prototype.temp=d.prototype.kelvin=d.prototype.temperature=function(){return((...t)=>{const e=o(t,"rgb"),r=e[0],n=e[2];let s,c=1e3,a=4e4;for(;a-c>.4;){s=.5*(a+c);const t=yt(s);t[2]/t[0]>=n/r?a=s:c=s}return xt(s)})(this._rgb)},g.temp=g.kelvin=g.temperature=(...t)=>new d(...t,"temp"),b.format.temp=b.format.kelvin=b.format.temperature=yt;const{pow:Nt,sign:kt}=Math,vt=(...t)=>{t=o(t,"lab");const[e,r,n]=t,s=Nt(e+.3963377774*r+.2158037573*n,3),c=Nt(e-.1055613458*r-.0638541728*n,3),a=Nt(e-.0894841775*r-1.291485548*n,3);return[255*Mt(4.0767416621*s-3.3077115913*c+.2309699292*a),255*Mt(-1.2684380046*s+2.6097574011*c-.3413193965*a),255*Mt(-.0041960863*s-.7034186147*c+1.707614701*a),t.length>3?t[3]:1]};function Mt(t){const e=Math.abs(t);return e>.0031308?(kt(t)||1)*(1.055*Nt(e,1/2.4)-.055):12.92*t}const{cbrt:$t,pow:St,sign:Ct}=Math,At=(...t)=>{const[e,r,n]=o(t,"rgb"),[s,c,a]=[Ft(e/255),Ft(r/255),Ft(n/255)],i=$t(.4122214708*s+.5363325363*c+.0514459929*a),l=$t(.2119034982*s+.6806995451*c+.1073969566*a),f=$t(.0883024619*s+.2817188376*c+.6299787005*a);return[.2104542553*i+.793617785*l-.0040720468*f,1.9779984951*i-2.428592205*l+.4505937099*f,.0259040371*i+.7827717662*l-.808675766*f]};function Ft(t){const e=Math.abs(t);return e<.04045?t/12.92:(Ct(t)||1)*St((e+.055)/1.055,2.4)}d.prototype.oklab=function(){return At(this._rgb)},g.oklab=(...t)=>new d(...t,"oklab"),b.format.oklab=vt,b.autodetect.push({p:3,test:(...t)=>{if("array"===n(t=o(t,"oklab"))&&3===t.length)return"oklab"}});d.prototype.oklch=function(){return((...t)=>{const[e,r,n]=o(t,"rgb"),[s,c,a]=At(e,r,n);return dt(s,c,a)})(this._rgb)},g.oklch=(...t)=>new d(...t,"oklch"),b.format.oklch=(...t)=>{t=o(t,"lch");const[e,r,n]=t,[s,c,a]=lt(e,r,n),[i,l,f]=vt(s,c,a);return[i,l,f,t.length>3?t[3]:1]},b.autodetect.push({p:3,test:(...t)=>{if("array"===n(t=o(t,"oklch"))&&3===t.length)return"oklch"}}),d.prototype.alpha=function(t,e=!1){return void 0!==t&&"number"===n(t)?e?(this._rgb[3]=t,this):new d([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},d.prototype.clipped=function(){return this._rgb._clipped||!1},d.prototype.darken=function(t=1){const e=this.lab();return e[0]-=U*t,new d(e,"lab").alpha(this.alpha(),!0)},d.prototype.brighten=function(t=1){return this.darken(-t)},d.prototype.darker=d.prototype.darken,d.prototype.brighter=d.prototype.brighten,d.prototype.get=function(t){const[e,r]=t.split("."),n=this[e]();if(r){const t=e.indexOf(r)-("ok"===e.substr(0,2)?2:0);if(t>-1)return n[t];throw new Error(`unknown channel ${r} in mode ${e}`)}return n};const{pow:Ot}=Math;d.prototype.luminance=function(t,e="rgb"){if(void 0!==t&&"number"===n(t)){if(0===t)return new d([0,0,0,this._rgb[3]],"rgb");if(1===t)return new d([255,255,255,this._rgb[3]],"rgb");let r=this.luminance(),n=20;const o=(r,s)=>{const c=r.interpolate(s,.5,e),a=c.luminance();return Math.abs(t-a)<1e-7||!n--?c:a>t?o(r,c):o(c,s)},s=(r>t?o(new d([0,0,0]),this):o(this,new d([255,255,255]))).rgb();return new d([...s,this._rgb[3]])}return _t(...this._rgb.slice(0,3))};const _t=(t,e,r)=>.2126*(t=Lt(t))+.7152*(e=Lt(e))+.0722*(r=Lt(r)),Lt=t=>(t/=255)<=.03928?t/12.92:Ot((t+.055)/1.055,2.4);var Et={},jt=(t,e,r=.5,...o)=>{let s=o[0]||"lrgb";if(Et[s]||o.length||(s=Object.keys(Et)[0]),!Et[s])throw new Error(`interpolation mode ${s} is not defined`);return"object"!==n(t)&&(t=new d(t)),"object"!==n(e)&&(e=new d(e)),Et[s](t,e,r).alpha(t.alpha()+r*(e.alpha()-t.alpha()))};d.prototype.mix=d.prototype.interpolate=function(t,e=.5,...r){return jt(this,t,e,...r)},d.prototype.premultiply=function(t=!1){const e=this._rgb,r=e[3];return t?(this._rgb=[e[0]*r,e[1]*r,e[2]*r,r],this):new d([e[0]*r,e[1]*r,e[2]*r,r],"rgb")},d.prototype.saturate=function(t=1){const e=this.lch();return e[1]+=U*t,e[1]<0&&(e[1]=0),new d(e,"lch").alpha(this.alpha(),!0)},d.prototype.desaturate=function(t=1){return this.saturate(-t)},d.prototype.set=function(t,e,r=!1){const[o,s]=t.split("."),c=this[o]();if(s){const t=o.indexOf(s)-("ok"===o.substr(0,2)?2:0);if(t>-1){if("string"==n(e))switch(e.charAt(0)){case"+":case"-":c[t]+=+e;break;case"*":c[t]*=+e.substr(1);break;case"/":c[t]/=+e.substr(1);break;default:c[t]=+e}else{if("number"!==n(e))throw new Error("unsupported value for Color.set");c[t]=e}const s=new d(c,o);return r?(this._rgb=s._rgb,this):s}throw new Error(`unknown channel ${s} in mode ${o}`)}return c},d.prototype.tint=function(t=.5,...e){return jt(this,"white",t,...e)},d.prototype.shade=function(t=.5,...e){return jt(this,"black",t,...e)};Et.rgb=(t,e,r)=>{const n=t._rgb,o=e._rgb;return new d(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),"rgb")};const{sqrt:Pt,pow:zt}=Math;Et.lrgb=(t,e,r)=>{const[n,o,s]=t._rgb,[c,a,i]=e._rgb;return new d(Pt(zt(n,2)*(1-r)+zt(c,2)*r),Pt(zt(o,2)*(1-r)+zt(a,2)*r),Pt(zt(s,2)*(1-r)+zt(i,2)*r),"rgb")};Et.lab=(t,e,r)=>{const n=t.lab(),o=e.lab();return new d(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),"lab")};var Rt=(t,e,r,n)=>{let o,s,c,a,i,l,f,h,u,b,g,m;return"hsl"===n?(o=t.hsl(),s=e.hsl()):"hsv"===n?(o=t.hsv(),s=e.hsv()):"hcg"===n?(o=t.hcg(),s=e.hcg()):"hsi"===n?(o=t.hsi(),s=e.hsi()):"lch"===n||"hcl"===n?(n="hcl",o=t.hcl(),s=e.hcl()):"oklch"===n&&(o=t.oklch().reverse(),s=e.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||([c,i,f]=o,[a,l,h]=s),isNaN(c)||isNaN(a)?isNaN(c)?isNaN(a)?b=Number.NaN:(b=a,1!=f&&0!=f||"hsv"==n||(u=l)):(b=c,1!=h&&0!=h||"hsv"==n||(u=i)):(m=a>c&&a-c>180?a-(c+360):a<c&&c-a>180?a+360-c:a-c,b=c+r*m),void 0===u&&(u=i+r*(l-i)),g=f+r*(h-f),new d("oklch"===n?[g,u,b]:[b,u,g],n)};const Dt=(t,e,r)=>Rt(t,e,r,"lch");Et.lch=Dt,Et.hcl=Dt;Et.num=(t,e,r)=>{const n=t.num(),o=e.num();return new d(n+r*(o-n),"num")};Et.hcg=(t,e,r)=>Rt(t,e,r,"hcg");Et.hsi=(t,e,r)=>Rt(t,e,r,"hsi");Et.hsl=(t,e,r)=>Rt(t,e,r,"hsl");Et.hsv=(t,e,r)=>Rt(t,e,r,"hsv");Et.oklab=(t,e,r)=>{const n=t.oklab(),o=e.oklab();return new d(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),"oklab")};Et.oklch=(t,e,r)=>Rt(t,e,r,"oklch");const{pow:qt,sqrt:Gt,PI:It,cos:Bt,sin:Yt,atan2:Ut}=Math;const Vt=(t,r)=>{const n=t.length,o=[0,0,0,0];for(let e=0;e<t.length;e++){const s=t[e],c=r[e]/n,a=s._rgb;o[0]+=qt(a[0],2)*c,o[1]+=qt(a[1],2)*c,o[2]+=qt(a[2],2)*c,o[3]+=a[3]*c}return o[0]=Gt(o[0]),o[1]=Gt(o[1]),o[2]=Gt(o[2]),o[3]>.9999999&&(o[3]=1),new d(e(o))},{pow:Tt}=Math;function Xt(e){let r="rgb",o=g("#ccc"),s=0,c=[0,1],a=[],i=[0,0],l=!1,f=[],h=!1,u=0,b=1,d=!1,m={},p=!0,w=1;const y=function(t){if((t=t||["#fff","#000"])&&"string"===n(t)&&g.brewer&&g.brewer[t.toLowerCase()]&&(t=g.brewer[t.toLowerCase()]),"array"===n(t)){1===t.length&&(t=[t[0],t[0]]),t=t.slice(0);for(let e=0;e<t.length;e++)t[e]=g(t[e]);a.length=0;for(let e=0;e<t.length;e++)a.push(e/(t.length-1))}return v(),f=t};let x=t=>t,N=t=>t;const k=function(e,s){let c,h;if(null==s&&(s=!1),isNaN(e)||null===e)return o;if(s)h=e;else if(l&&l.length>2){h=function(t){if(null!=l){const e=l.length-1;let r=0;for(;r<e&&t>=l[r];)r++;return r-1}return 0}(e)/(l.length-2)}else h=b!==u?(e-u)/(b-u):1;h=N(h),s||(h=x(h)),1!==w&&(h=Tt(h,w)),h=i[0]+h*(1-i[0]-i[1]),h=t(h,0,1);const d=Math.floor(1e4*h);if(p&&m[d])c=m[d];else{if("array"===n(f))for(let t=0;t<a.length;t++){const e=a[t];if(h<=e){c=f[t];break}if(h>=e&&t===a.length-1){c=f[t];break}if(h>e&&h<a[t+1]){h=(h-e)/(a[t+1]-e),c=g.interpolate(f[t],f[t+1],h,r);break}}else"function"===n(f)&&(c=f(h));p&&(m[d]=c)}return c};var v=()=>m={};y(e);const M=function(t){const e=g(k(t));return h&&e[h]?e[h]():e};return M.classes=function(t){if(null!=t){if("array"===n(t))l=t,c=[t[0],t[t.length-1]];else{const e=g.analyze(c);l=0===t?[e.min,e.max]:g.limits(e,"e",t)}return M}return l},M.domain=function(t){if(!arguments.length)return c;u=t[0],b=t[t.length-1],a=[];const e=f.length;if(t.length===e&&u!==b)for(let e of Array.from(t))a.push((e-u)/(b-u));else{for(let t=0;t<e;t++)a.push(t/(e-1));if(t.length>2){const e=t.map(((e,r)=>r/(t.length-1))),r=t.map((t=>(t-u)/(b-u)));r.every(((t,r)=>e[r]===t))||(N=t=>{if(t<=0||t>=1)return t;let n=0;for(;t>=r[n+1];)n++;const o=(t-r[n])/(r[n+1]-r[n]);return e[n]+o*(e[n+1]-e[n])})}}return c=[u,b],M},M.mode=function(t){return arguments.length?(r=t,v(),M):r},M.range=function(t,e){return y(t),M},M.out=function(t){return h=t,M},M.spread=function(t){return arguments.length?(s=t,M):s},M.correctLightness=function(t){return null==t&&(t=!0),d=t,v(),x=d?function(t){const e=k(0,!0).lab()[0],r=k(1,!0).lab()[0],n=e>r;let o=k(t,!0).lab()[0];const s=e+(r-e)*t;let c=o-s,a=0,i=1,l=20;for(;Math.abs(c)>.01&&l-- >0;)n&&(c*=-1),c<0?(a=t,t+=.5*(i-t)):(i=t,t+=.5*(a-t)),o=k(t,!0).lab()[0],c=o-s;return t}:t=>t,M},M.padding=function(t){return null!=t?("number"===n(t)&&(t=[t,t]),i=t,M):i},M.colors=function(t,r){arguments.length<2&&(r="hex");let n=[];if(0===arguments.length)n=f.slice(0);else if(1===t)n=[M(.5)];else if(t>1){const e=c[0],r=c[1]-e;n=function(t,e){let r=[],n=t<e,o=e;for(let e=t;n?e<o:e>o;n?e++:e--)r.push(e);return r}(0,t).map((n=>M(e+n/(t-1)*r)))}else{e=[];let t=[];if(l&&l.length>2)for(let e=1,r=l.length,n=1<=r;n?e<r:e>r;n?e++:e--)t.push(.5*(l[e-1]+l[e]));else t=c;n=t.map((t=>M(t)))}return g[r]&&(n=n.map((t=>t[r]()))),n},M.cache=function(t){return null!=t?(p=t,M):p},M.gamma=function(t){return null!=t?(w=t,M):w},M.nodata=function(t){return null!=t?(o=g(t),M):o},M}const Ht=(t,e,r)=>{if(!Ht[r])throw new Error("unknown blend mode "+r);return Ht[r](t,e)},Zt=t=>(e,r)=>{const n=g(r).rgb(),o=g(e).rgb();return g.rgb(t(n,o))},Jt=t=>(e,r)=>{const n=[];return n[0]=t(e[0],r[0]),n[1]=t(e[1],r[1]),n[2]=t(e[2],r[2]),n};Ht.normal=Zt(Jt((t=>t))),Ht.multiply=Zt(Jt(((t,e)=>t*e/255))),Ht.screen=Zt(Jt(((t,e)=>255*(1-(1-t/255)*(1-e/255))))),Ht.overlay=Zt(Jt(((t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))))),Ht.darken=Zt(Jt(((t,e)=>t>e?e:t))),Ht.lighten=Zt(Jt(((t,e)=>t>e?t:e))),Ht.dodge=Zt(Jt(((t,e)=>255===t||(t=e/255*255/(1-t/255))>255?255:t))),Ht.burn=Zt(Jt(((t,e)=>255*(1-(1-e/255)/(t/255)))));const{pow:Kt,sin:Qt,cos:Wt}=Math;const{floor:te,random:ee}=Math;const{log:re,pow:ne,floor:oe,abs:se}=Math;function ce(t,e=null){const r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===n(t)&&(t=Object.values(t)),t.forEach((t=>{e&&"object"===n(t)&&(t=t[e]),null==t||isNaN(t)||(r.values.push(t),r.sum+=t,t<r.min&&(r.min=t),t>r.max&&(r.max=t),r.count+=1)})),r.domain=[r.min,r.max],r.limits=(t,e)=>ae(r,t,e),r}function ae(t,e="equal",r=7){"array"==n(t)&&(t=ce(t));const{min:o,max:s}=t,c=t.values.sort(((t,e)=>t-e));if(1===r)return[o,s];const a=[];if("c"===e.substr(0,1)&&(a.push(o),a.push(s)),"e"===e.substr(0,1)){a.push(o);for(let t=1;t<r;t++)a.push(o+t/r*(s-o));a.push(s)}else if("l"===e.substr(0,1)){if(o<=0)throw new Error("Logarithmic scales are only possible for values > 0");const t=Math.LOG10E*re(o),e=Math.LOG10E*re(s);a.push(o);for(let n=1;n<r;n++)a.push(ne(10,t+n/r*(e-t)));a.push(s)}else if("q"===e.substr(0,1)){a.push(o);for(let t=1;t<r;t++){const e=(c.length-1)*t/r,n=oe(e);if(n===e)a.push(c[n]);else{const t=e-n;a.push(c[n]*(1-t)+c[n+1]*t)}}a.push(s)}else if("k"===e.substr(0,1)){let t;const e=c.length,n=new Array(e),i=new Array(r);let l=!0,f=0,h=null;h=[],h.push(o);for(let t=1;t<r;t++)h.push(o+t/r*(s-o));for(h.push(s);l;){for(let t=0;t<r;t++)i[t]=0;for(let t=0;t<e;t++){const e=c[t];let o,s=Number.MAX_VALUE;for(let c=0;c<r;c++){const r=se(h[c]-e);r<s&&(s=r,o=c),i[o]++,n[t]=o}}const o=new Array(r);for(let t=0;t<r;t++)o[t]=null;for(let r=0;r<e;r++)t=n[r],null===o[t]?o[t]=c[r]:o[t]+=c[r];for(let t=0;t<r;t++)o[t]*=1/i[t];l=!1;for(let t=0;t<r;t++)if(o[t]!==h[t]){l=!0;break}h=o,f++,f>200&&(l=!1)}const u={};for(let t=0;t<r;t++)u[t]=[];for(let r=0;r<e;r++)t=n[r],u[t].push(c[r]);let b=[];for(let t=0;t<r;t++)b.push(u[t][0]),b.push(u[t][u[t].length-1]);b=b.sort(((t,e)=>t-e)),a.push(b[0]);for(let t=1;t<b.length;t+=2){const e=b[t];isNaN(e)||-1!==a.indexOf(e)||a.push(e)}}return a}const{sqrt:ie,pow:le,min:fe,max:he,atan2:ue,abs:be,cos:de,sin:ge,exp:me,PI:pe}=Math;var we={cool:()=>Xt([g.hsl(180,1,.9),g.hsl(250,.7,.4)]),hot:()=>Xt(["#000","#f00","#ff0","#fff"]).mode("rgb")};const ye={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]};for(let t of Object.keys(ye))ye[t.toLowerCase()]=ye[t];function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}Object.assign(g,{average:(t,e="lrgb",r=null)=>{const n=t.length;r||(r=Array.from(new Array(n)).map((()=>1)));const o=n/r.reduce((function(t,e){return t+e}));if(r.forEach(((t,e)=>{r[e]*=o})),t=t.map((t=>new d(t))),"lrgb"===e)return Vt(t,r);const s=t.shift(),c=s.get(e),a=[];let i=0,l=0;for(let t=0;t<c.length;t++)if(c[t]=(c[t]||0)*r[0],a.push(isNaN(c[t])?0:r[0]),"h"===e.charAt(t)&&!isNaN(c[t])){const e=c[t]/180*It;i+=Bt(e)*r[0],l+=Yt(e)*r[0]}let f=s.alpha()*r[0];t.forEach(((t,n)=>{const o=t.get(e);f+=t.alpha()*r[n+1];for(let t=0;t<c.length;t++)if(!isNaN(o[t]))if(a[t]+=r[n+1],"h"===e.charAt(t)){const e=o[t]/180*It;i+=Bt(e)*r[n+1],l+=Yt(e)*r[n+1]}else c[t]+=o[t]*r[n+1]}));for(let t=0;t<c.length;t++)if("h"===e.charAt(t)){let e=Ut(l/a[t],i/a[t])/It*180;for(;e<0;)e+=360;for(;e>=360;)e-=360;c[t]=e}else c[t]=c[t]/a[t];return f/=n,new d(c,e).alpha(f>.99999?1:f,!0)},bezier:t=>{const e=function(t){let e,r,n,o;if(2===(t=t.map((t=>new d(t)))).length)[r,n]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>r[e]+t*(n[e]-r[e])));return new d(e,"lab")};else if(3===t.length)[r,n,o]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>(1-t)*(1-t)*r[e]+2*(1-t)*t*n[e]+t*t*o[e]));return new d(e,"lab")};else if(4===t.length){let s;[r,n,o,s]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>(1-t)*(1-t)*(1-t)*r[e]+3*(1-t)*(1-t)*t*n[e]+3*(1-t)*t*t*o[e]+t*t*t*s[e]));return new d(e,"lab")}}else{if(!(t.length>=5))throw new RangeError("No point in running bezier with only one color.");{let r,n,o;r=t.map((t=>t.lab())),o=t.length-1,n=function(t){let e=[1,1];for(let r=1;r<t;r++){let t=[1];for(let r=1;r<=e.length;r++)t[r]=(e[r]||0)+e[r-1];e=t}return e}(o),e=function(t){const e=1-t,s=[0,1,2].map((s=>r.reduce(((r,c,a)=>r+n[a]*e**(o-a)*t**a*c[s]),0)));return new d(s,"lab")}}}return e}(t);return e.scale=()=>Xt(e),e},blend:Ht,cubehelix:function(t=300,r=-1.5,o=1,s=1,c=[0,1]){let a,i=0;"array"===n(c)?a=c[1]-c[0]:(a=0,c=[c,c]);const f=function(n){const f=l*((t+120)/360+r*n),h=Kt(c[0]+a*n,s),u=(0!==i?o[0]+n*i:o)*h*(1-h)/2,b=Wt(f),d=Qt(f);return g(e([255*(h+u*(-.14861*b+1.78277*d)),255*(h+u*(-.29227*b-.90649*d)),255*(h+u*(1.97294*b)),1]))};return f.start=function(e){return null==e?t:(t=e,f)},f.rotations=function(t){return null==t?r:(r=t,f)},f.gamma=function(t){return null==t?s:(s=t,f)},f.hue=function(t){return null==t?o:("array"===n(o=t)?(i=o[1]-o[0],0===i&&(o=o[1])):i=0,f)},f.lightness=function(t){return null==t?c:("array"===n(t)?(c=t,a=t[1]-t[0]):(c=[t,t],a=0),f)},f.scale=()=>g.scale(f),f.hue(o),f},mix:jt,interpolate:jt,random:()=>{let t="#";for(let e=0;e<6;e++)t+="0123456789abcdef".charAt(te(16*ee()));return new d(t,"hex")},scale:Xt,analyze:ce,contrast:(t,e)=>{t=new d(t),e=new d(e);const r=t.luminance(),n=e.luminance();return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)},deltaE:function(t,e,r=1,n=1,o=1){var s=function(t){return 360*t/(2*pe)},c=function(t){return 2*pe*t/360};t=new d(t),e=new d(e);const[a,i,l]=Array.from(t.lab()),[f,h,u]=Array.from(e.lab()),b=(a+f)/2,g=(ie(le(i,2)+le(l,2))+ie(le(h,2)+le(u,2)))/2,m=.5*(1-ie(le(g,7)/(le(g,7)+le(25,7)))),p=i*(1+m),w=h*(1+m),y=ie(le(p,2)+le(l,2)),x=ie(le(w,2)+le(u,2)),N=(y+x)/2,k=s(ue(l,p)),v=s(ue(u,w)),M=k>=0?k:k+360,$=v>=0?v:v+360,S=be(M-$)>180?(M+$+360)/2:(M+$)/2,C=1-.17*de(c(S-30))+.24*de(c(2*S))+.32*de(c(3*S+6))-.2*de(c(4*S-63));let A=$-M;A=be(A)<=180?A:$<=M?A+360:A-360,A=2*ie(y*x)*ge(c(A)/2);const F=f-a,O=x-y,_=1+.015*le(b-50,2)/ie(20+le(b-50,2)),L=1+.045*N,E=1+.015*N*C,j=30*me(-le((S-275)/25,2)),P=-(2*ie(le(N,7)/(le(N,7)+le(25,7))))*ge(2*c(j)),z=ie(le(F/(r*_),2)+le(O/(n*L),2)+le(A/(o*E),2)+P*(O/(n*L))*(A/(o*E)));return he(0,fe(100,z))},distance:function(t,e,r="lab"){t=new d(t),e=new d(e);const n=t.get(r),o=e.get(r);let s=0;for(let t in n){const e=(n[t]||0)-(o[t]||0);s+=e*e}return Math.sqrt(s)},limits:ae,valid:(...t)=>{try{return new d(...t),!0}catch(t){return!1}},scales:we,input:b,colors:mt,brewer:ye});var Ne,ke={exports:{}};var ve,Me=(Ne||(Ne=1,ve=ke,function(t){function e(t,r){if(!(t=n(t)))return null;var o,s,c,a=1/0;r||(r=e.DEFAULT_COLORS);for(var i=0;i<r.length;++i)s=r[i].rgb,(o=Math.pow(t.r-s.r,2)+Math.pow(t.g-s.g,2)+Math.pow(t.b-s.b,2))<a&&(a=o,c=r[i]);return c.name?{name:c.name,value:c.source,rgb:c.rgb,distance:Math.sqrt(a)}:c.source}function r(t){return t instanceof Array?t.map((function(t){return o(t)})):Object.keys(t).map((function(e){return o(t[e],e)}))}function n(t){if("object"==typeof t)return t;if(t in e.STANDARD_COLORS)return n(e.STANDARD_COLORS[t]);var r=t.match(/^#?((?:[0-9a-f]{3}){1,2})$/i);if(r)return r=3===(r=r[1]).length?[r.charAt(0)+r.charAt(0),r.charAt(1)+r.charAt(1),r.charAt(2)+r.charAt(2)]:[r.substring(0,2),r.substring(2,4),r.substring(4,6)],{r:parseInt(r[0],16),g:parseInt(r[1],16),b:parseInt(r[2],16)};var o=t.match(/^rgb\(\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?)\s*\)$/i);if(o)return{r:s(o[1]),g:s(o[2]),b:s(o[3])};throw Error('"'+t+'" is not a valid color')}function o(t,e){var r={};if(e&&(r.name=e),"string"==typeof t)r.source=t,r.rgb=n(t);else if("object"==typeof t){if(t.source)return o(t.source,t.name);r.rgb=t,r.source=function(t){return"#"+c(t.r.toString(16))+c(t.g.toString(16))+c(t.b.toString(16))}(t)}return r}function s(t){return"%"===t.charAt(t.length-1)?Math.round(255*parseInt(t,10)/100):Number(t)}function c(t){return 1===t.length&&(t="0"+t),t}e.from=function t(n){var o=r(n),s=e,c=function(t){return s(t,o)};return c.from=t,c.or=function(t){var n=o.concat(r(t));return e.from(n)},c},e.STANDARD_COLORS={aqua:"#0ff",black:"#000",blue:"#00f",fuchsia:"#f0f",gray:"#808080",green:"#008000",lime:"#0f0",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#ffa500",purple:"#800080",red:"#f00",silver:"#c0c0c0",teal:"#008080",white:"#fff",yellow:"#ff0"},e.DEFAULT_COLORS=r(["#f00","#f80","#ff0","#0f0","#00f","#008","#808"]),e.VERSION="0.4.4",ve&&ve.exports?ve.exports=e:t.nearestColor=e}(ke.exports)),ke.exports),$e=xe(Me);class Se{h;s;l;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(0)),this.s=Number((100*e).toFixed(0)),this.l=Number((100*r).toFixed(0))}toString(){return`hsl(${this.h}, ${this.s}%, ${this.l}%)`}}class Ce{h;s;l;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(0)),this.s=Number(e.toFixed(2)),this.l=Number(r.toFixed(2))}toString(){return`${this.h}, ${this.s}, ${this.l}`}}class Ae{x;y;z;constructor({x:t,y:e,z:r}){this.x=t,this.y=e,this.z=r}toString(){return`${this.x}, ${this.y}, ${this.z}`}}class Fe{c;m;y;k;constructor({c:t,m:e,y:r,k:n}){this.c=t,this.m=e,this.y=r,this.k=n}toString(){return`${this.c}, ${this.m}, ${this.y}, ${this.k}`}}class Oe{r;g;b;constructor({r:t,g:e,b:r}){this.r=t,this.g=e,this.b=r}toString(){return`${this.r}, ${this.g}, ${this.b}`}}class _e{h;w;b;constructor({h:t,w:e,b:r}){this.h=t,this.w=e,this.b=r}toString(){return`${this.h}, ${this.w}, ${this.b}`}}class Le{l;a;b;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.a=Number(e.toFixed(2)),this.b=Number(r.toFixed(2))}toString(){return`${this.l}, ${this.a}, ${this.b}`}}class Ee{l;a;b;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.a=Number(e.toFixed(2)),this.b=Number(r.toFixed(2))}toString(){return`${this.l}, ${this.a}, ${this.b}`}}class je{h;s;v;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(2)),this.s=Number(e.toFixed(2)),this.v=Number(r.toFixed(2))}toString(){return`${this.h}, ${this.s}, ${this.v}`}}class Pe{l;c;h;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.c=Number(e.toFixed(2)),this.h=Number(isNaN(r)?"0":r.toFixed(2))}toString(){return`${this.l}, ${this.c}, ${this.h}`}}class ze{l;c;h;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.c=Number(e.toFixed(2)),this.h=Number(isNaN(r)?"0":r.toFixed(2))}toString(){return`${this.l}, ${this.c}, ${this.h}`}}class Re{h;s;i;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(2)),this.s=Number(e.toFixed(2)),this.i=Number(r.toFixed(2))}toString(){return`${this.h}, ${this.s}, ${this.i}`}}const De=(t,e)=>{if("hsl"===e)return new Ce(g(t).hsl());const r=g(t).rgb();return new Oe({r:Number((r[0]/255).toFixed(2)),g:Number((r[1]/255).toFixed(2)),b:Number((r[2]/255).toFixed(2))})},qe=t=>(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4),Ge=t=>t>.008856452?Math.pow(t,1/3):t/.12841855+.137931034;class Ie{color;name;hex;rgb;hsl;hwb;hsv;lab;xyz;lch;oklch;hsi;oklab;cmyk;rgbFloat;hslFloat;constructor(t,e){this.color=t,this.name=e,this.hex=(t=>g(t).hex())(this.color),this.cmyk=(t=>{let[e,r,n]=g(t).rgb();e/=255,n/=255,r/=255;const o=+(1-Math.max(e,n,r)),s=+((1-n-o)/(1-o)||0),c=+((1-r-o)/(1-o)||0);return new Fe({c:Number((100*+((1-e-o)/(1-o)||0)).toFixed()),m:Number((100*s).toFixed()),y:Number((100*c).toFixed()),k:Number((100*o).toFixed())})})(this.color),this.xyz=(t=>{let[e,r,n]=g(t).rgb();e=qe(e),n=qe(n),r=qe(r);const o=Ge((.4124564*e+.3575761*n+.1804375*r)/.95047),s=Ge((.2126729*e+.7151522*n+.072175*r)/1),c=Ge((.0193339*e+.119192*n+.9503041*r)/1.08883);return new Ae({x:Number(o.toFixed(2)),y:Number(s.toFixed(2)),z:Number(c.toFixed(2))})})(this.color),this.hsl=(t=>new Se(g(t).hsl()))(this.color),this.hwb=(t=>{let[e,r,n]=g(t).rgb();e/=255,n/=255,r/=255;const o=Math.min(e,n,r),s=Math.max(e,n,r),c=1-s;return s===o?{h:0,w:o,b:c}:new _e({h:Number((((e===o?3:n===o?5:1)-(e===o?n-r:n===o?r-e:e-n)/(s-o))/6).toFixed(2)),w:Number(o.toFixed(2)),b:Number(c.toFixed(2))})})(this.color),this.lab=(t=>new Le(g(t).lab()))(this.color),this.oklab=(t=>new Ee(g(t).oklab()))(this.color),this.hsv=(t=>new je(g(t).hsv()))(this.color),this.lch=(t=>new Pe(g(t).lch()))(this.color),this.oklch=(t=>new ze(g(t).oklch()))(this.color),this.hsi=(t=>new Re(g(t).hsi()))(this.color),this.rgb=(t=>{const[e,r,n]=g(t).rgb();return`rgb(${e}, ${r}, ${n})`})(this.color),this.rgbFloat=De(this.color),this.hslFloat=De(this.color,"hsl")}toObject(t){return((t,e)=>{if("hsl"===e){const[e,r,n]=g(t).hsl();return{h:Number(isNaN(e)?0:e.toFixed(0)),s:Number((100*r).toFixed()),l:Number((100*n).toFixed())}}const r=g(t).rgb();return{r:r[0],g:r[1],b:r[2]}})(this.color,t)}toFloat(t){return De(this.color,t)}}const Be={diverging:!1,bezier:!1,randomOffset:!1,correctLightness:!1,noDuplicates:!0,colorScaleMode:"lch",reverseDirection:!1},Ye=(t,e,r,n,o={})=>{const{noDuplicates:s=!0}=o,c=[g(t).hex()];let[a,i,l]=g(t).hsl();isNaN(a)&&(a=0),i=Number((100*i).toFixed()),l=Number((100*l).toFixed());for(let t=e;t<=r;t+=n){const e=Number(((a+t)%360).toFixed());c.push(g(`hsl(${e}, ${i}%, ${l}%)`).hex())}let f=c;return s&&(f=[...new Set(c)]),f},Ue=(t,e)=>Math.floor(Math.random()*(t-e+1))+e,Ve=(t,e={})=>{const{numberOfColors:r=8,bezier:n=!1,randomOffset:o=!1,colorScaleMode:s,noDuplicates:c=!0,reverseDirection:a=!1,correctLightness:i=!0}=e;let[l,f,h]=g(t).hsl();isNaN(l)&&(l=0),l=Number(l.toFixed(0)),f=Number((100*f).toFixed(0)),h=Number((100*h).toFixed(0));const u=[];if(u.push(g(`hsl(${l}, ${f}%, ${h<0?0:h}%)`).hex()),o)for(let t=1;t<r;t++)a?(h+=Ue(0,10),l+=Ue(-5,5)):(h-=Ue(0,10),l-=Ue(-5,5)),l>359&&(l=359),l<0&&(l=0),u.push(g(`hsl(${l}, ${f}%, ${h<0?0:h}%)`).hex());else for(let t=1;t<r;t++)a?(h+=5,l+=5):(h-=5,l-=5),l>359&&(l=359),l<0&&(l=0),u.push(g(`hsl(${l}, ${f}%, ${h<0?0:h}%)`).hex());let b=u.map((t=>g(t).hex()));return c&&(b=[...new Set(b)]),n&&(b=b.length>1?g.bezier(b).scale().mode(s).correctLightness(i).colors(r):g.scale(b).mode(s).correctLightness(i).colors(r)),b},Te=(t,e={})=>{if(!t)throw Error("MoebiusPalettes: missing input `color`");const{diverging:r=!1,numberOfColors:n=7}=e,[o,s,c]=g(t).lab(),a=100*(.95-1/n),i=a/(n-1),l=.5*(100-a),f=((t,e,r)=>{const n=[];for(let o=t;o<e;o+=r)n.push(o);return n})(l,l+n*i,i);let h=0;if(!r){h=9999;for(let t=0;t<n;t++){const e=o-f[t];Math.abs(e)<Math.abs(h)&&(h=e)}}return f.map((t=>g.lab([t+h,s,c]).hex()))},Xe=(t,e={})=>{const{numberOfColors:r,reverseDirection:n=!1,diverging:o=!1,divergentColor:s}=e;if(o){const e=Te(g(t).hex(),{numberOfColors:Math.ceil(r/2)}).concat(s);return n&&e.reverse(),e}return Te(t,{numberOfColors:r})},He=(t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e;try{return g.bezier(t).scale().mode(n).correctLightness(o).colors(r)}catch{return[]}},Ze=(t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e;try{return g.scale(t).mode(n).correctLightness(o).colors(r)}catch{return[]}};class Je{interpolate;luminanceShift;monochromatic;complement;split;triadic;tetradic;pentadic;hexadic;analogous;constructor(t,e){Object.keys(t).forEach((r=>{this[r]=t[r].map((t=>Ve(t,{...e,numberOfColors:9})))}))}toArray(){return[...this.interpolate,...this.luminanceShift,...this.monochromatic,...this.complement,...this.split,...this.triadic,...this.tetradic,...this.pentadic,...this.hexadic,...this.analogous].flat()}}class Ke{interpolate;luminanceShift;monochromatic;complement;split;triadic;tetradic;pentadic;hexadic;analogous;constructor(t){Object.keys(t).forEach((e=>{this[e]=t[e]}))}toArray(){return[...this.interpolate,...this.luminanceShift,...this.monochromatic,...this.complement,...this.split,...this.triadic,...this.tetradic,...this.pentadic,...this.hexadic,...this.analogous].flat()}}class Qe{darkMode;constructor(t){Object.keys(t).forEach((e=>{this[e]=t[e]}))}}class We{baseColor;secondaryColor;colors={};themes={};defaultOptions={...Be,divergentColor:"#f5f5f5"};options;all=[];accents;constructor(t){this.options={...this.defaultOptions,...t},this.baseColor=this.options.baseColor,this.secondaryColor=this.options.secondaryColor,this.themes=new Qe({darkMode:this.darkMode(this.baseColor.hex,this.secondaryColor.hex,{...this.options,reverseDirection:!this.options.reverseDirection})}),this.colors=new Ke({interpolate:this.interpolate(this.baseColor.hex,this.secondaryColor.hex,this.options),luminanceShift:this.luminanceShift([this.baseColor.hex],[this.secondaryColor.hex],this.options),monochromatic:this.monochromatic(this.baseColor.hex),complement:this.complement(this.baseColor.hex),split:this.split(this.baseColor.hex),triadic:this.triadic(this.baseColor.hex),tetradic:this.tetradic(this.baseColor.hex),pentadic:this.pentadic(this.baseColor.hex),hexadic:this.hexadic(this.baseColor.hex),analogous:this.analogous(this.baseColor.hex)}),this.accents=new Je(this.colors,this.options),this.all=[...new Set([...this.accents.toArray(),...this.colors.toArray()].flat())]}complement(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=Ye(t,180,180,1);return g.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}darkMode(t,e,r={}){return((t,e,r={})=>{const{bezier:n=!1,colorScaleMode:o,noDuplicates:s=!0}=r,c=Ve(t,r),a=Ve(e,r),i=a.map(((t,e)=>g.mix(c[e],t,.99-.02*e,o).hex())),l={primary:c,surface:a,mixed:i};return s&&(l.primary=[...new Set(c)],l.surface=[...new Set(a)],l.mixed=[...new Set(i)]),n&&(l.primary.length>1&&l.surface.length>1&&l.mixed.length>1?(l.primary=He(l.primary,r),l.surface=He(l.surface,r),l.mixed=He(l.mixed,r)):(l.primary=Ze(l.primary,r),l.surface=Ze(l.surface,r),l.mixed=Ze(l.mixed,r))),l})(t,e,{...this.options,...r})}split(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=Ye(t,150,210,60);return g.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}triadic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=Ye(t,120,240,120);return g.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}tetradic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=Ye(t,90,270,90);return g.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}pentadic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=Ye(t,144,360,72);return g.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}hexadic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=Ye(t,120,360,60);return g.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}analogous(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=Ye(t,30,90,30);return g.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}interpolate(t,e,r={}){return((t,e,r={})=>{const{numberOfColors:n=8,colorScaleMode:o,bezier:s=!1,correctLightness:c=!0}=r;let a=g.scale([t,e]).mode(o).correctLightness(c).colors(n);return s&&(a=g.bezier([t,e]).scale().mode(o).correctLightness(c).colors(n)),a})(t,e,{...this.options,...r})}luminanceShift(t,e=[],r={}){return((t,e=[],r={})=>{const{numberOfColors:n=8,diverging:o=!1,colorScaleMode:s,bezier:c=!1,divergentColor:a="#f5f5f5",correctLightness:i=!0}=r;e=0===e.length?[Ye(t[0],90,270,90)[3]]:e;const l=n%2==0,f=o?Math.ceil(n/2)+(l?1:0):n,h=o?Math.ceil(n/2)+(l?1:0):0,u=1!==t.length?t:Xe(t[0],{numberOfColors:f,divergentColor:a});let b=[];o&&(b=1!==e.length?e:Xe(e[0],{numberOfColors:h,divergentColor:a,diverging:o}));let d=t.length?g.scale(u).mode(s).correctLightness(i).colors(f):[];c&&(d=t.length?g.bezier(u).scale().mode(s).correctLightness(i).colors(f):[]);let m=o&&e.length?g.scale(b).mode(s).correctLightness(i).colors(h):[];c&&(m=o&&e.length?g.bezier(b).scale().mode(s).correctLightness(i).colors(h):[]);let p=d;return p=(o?d.slice(0,d.length-(f%2!=0?0:1)):d).concat(m.reverse()),p})(t,e,{...this.options,...r})}monochromatic(t,e={}){const r={...this.options,...e};return Ve(t,r)}harmonize(t,e,r,n,o={}){const s={...this.options,...o};return Ye(t,e,r,n,s)}}class tr{xlmns="http://www.w3.org/2000/svg";getColorPiePaths(t,e=256){const r=document.createDocumentFragment(),n=document.createElementNS(this.xlmns,"defs"),o=document.createElementNS(this.xlmns,"mask"),s=document.createElementNS(this.xlmns,"rect"),c=document.createElementNS(this.xlmns,"g"),a=360/t.length,i="_"+Math.random().toString(36).substring(2,11);o.setAttributeNS(null,"id",i),s.setAttributeNS(null,"height","100%"),s.setAttributeNS(null,"width","100%"),s.setAttributeNS(null,"fill","white"),c.setAttributeNS(null,"mask",`url(#${i})`),o.appendChild(s);const l=360/t.length;var f,h;for(let e=(f=l/2,4===(h=t.length)||8===h||12===h?0:3===h||9===h?30:7===h?12:5===h?55:f);e<360;e+=l){const t=document.createElementNS(this.xlmns,"line");t.setAttributeNS(null,"x1","128"),t.setAttributeNS(null,"y1","128"),t.setAttributeNS(null,"x2","0"),t.setAttributeNS(null,"y2","128"),t.setAttributeNS(null,"stroke","black"),t.setAttributeNS(null,"stroke-width","6"),t.setAttributeNS(null,"transform",`rotate(${e} 128 128)`),o.appendChild(t)}let u=0;return t.forEach((t=>{const r=e/2/t.length;return u+=a,t.forEach(((t,n)=>{const o=e/2-n*r,s=document.createElementNS(this.xlmns,"path");s.setAttributeNS(null,"fill",t),s.setAttributeNS(null,"data-color-hex",t),s.setAttributeNS(null,"data-r",`${o}`),s.setAttributeNS(null,"d",((t,e,r,n=256)=>{const o=n/2,s=o;let c=t+e;if(t>c){const e=t;t=c,c=e}return`M ${o+r*Math.cos((90-t)*(Math.PI/180))} ${s+r*Math.sin((90-t)*(Math.PI/180))} A ${r} ${r} 0 ${c-t<=180?"0":"1"} 0 ${o+r*Math.cos((90-c)*(Math.PI/180))} ${s+r*Math.sin((90-c)*(Math.PI/180))} L ${o} ${s} Z`})(u,a,o)),c.appendChild(s)}))})),n.appendChild(o),r.appendChild(n),r.appendChild(c),r}}async function er(){const t=await(async()=>{const t=await fetch("https://color-names.herokuapp.com/v1/"),e=(await t.json()).colors,r={};return e.forEach((t=>{r[t.name]=t.hex})),$e.from(r)})();return{MoebiusColor:class extends Ie{constructor(e){super(g(e).hex(),(t=>"string"==typeof t)(t(e))?t(e):t(e).name)}},MoebiusPalettes:We,MoebiusSVGHelper:tr}}export{er as default};
53
+ const{min:t,max:e}=Math;var r=(r,n=0,o=1)=>t(e(n,r),o),n=t=>{t._clipped=!1,t._unclipped=t.slice(0);for(let e=0;e<=3;e++)e<3?((t[e]<0||t[e]>255)&&(t._clipped=!0),t[e]=r(t[e],0,255)):3===e&&(t[e]=r(t[e],0,1));return t};const o={};for(let t of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])o[`[object ${t}]`]=t.toLowerCase();function s(t){return o[Object.prototype.toString.call(t)]||"object"}var a=(t,e=null)=>t.length>=3?Array.prototype.slice.call(t):"object"==s(t[0])&&e?e.split("").filter((e=>void 0!==t[0][e])).map((e=>t[0][e])):t[0].slice(0),c=t=>{if(t.length<2)return null;const e=t.length-1;return"string"==s(t[e])?t[e].toLowerCase():null};const{PI:i,min:l,max:h}=Math,f=t=>Math.round(100*t)/100,u=t=>Math.round(100*t)/100,b=2*i,d=i/3,m=i/180,g=180/i;function p(t){return[...t.slice(0,3).reverse(),...t.slice(3)]}var w={format:{},autodetect:[]};class y{constructor(...t){const e=this;if("object"===s(t[0])&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let r=c(t),o=!1;if(!r){o=!0,w.sorted||(w.autodetect=w.autodetect.sort(((t,e)=>e.p-t.p)),w.sorted=!0);for(let e of w.autodetect)if(r=e.test(...t),r)break}if(!w.format[r])throw new Error("unknown format: "+t);{const s=w.format[r].apply(null,o?t:t.slice(0,-1));e._rgb=n(s)}3===e._rgb.length&&e._rgb.push(1)}toString(){return"function"==s(this.hex)?this.hex():`[${this._rgb.join(",")}]`}}const x=(...t)=>new y(...t);x.version="3.1.2";const k={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},N=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,M=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,v=t=>{if(t.match(N)){4!==t.length&&7!==t.length||(t=t.substr(1)),3===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]);const e=parseInt(t,16);return[e>>16,e>>8&255,255&e,1]}if(t.match(M)){5!==t.length&&9!==t.length||(t=t.substr(1)),4===t.length&&(t=(t=t.split(""))[0]+t[0]+t[1]+t[1]+t[2]+t[2]+t[3]+t[3]);const e=parseInt(t,16);return[e>>24&255,e>>16&255,e>>8&255,Math.round((255&e)/255*100)/100]}throw new Error(`unknown hex color: ${t}`)},{round:$}=Math,S=(...t)=>{let[e,r,n,o]=a(t,"rgba"),s=c(t)||"auto";void 0===o&&(o=1),"auto"===s&&(s=o<1?"rgba":"rgb"),e=$(e),r=$(r),n=$(n);let i="000000"+(e<<16|r<<8|n).toString(16);i=i.substr(i.length-6);let l="0"+$(255*o).toString(16);switch(l=l.substr(l.length-2),s.toLowerCase()){case"rgba":return`#${i}${l}`;case"argb":return`#${l}${i}`;default:return`#${i}`}};y.prototype.name=function(){const t=S(this._rgb,"rgb");for(let e of Object.keys(k))if(k[e]===t)return e.toLowerCase();return t},w.format.named=t=>{if(t=t.toLowerCase(),k[t])return v(k[t]);throw new Error("unknown color name: "+t)},w.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&"string"===s(t)&&k[t.toLowerCase()])return"named"}}),y.prototype.alpha=function(t,e=!1){return void 0!==t&&"number"===s(t)?e?(this._rgb[3]=t,this):new y([this._rgb[0],this._rgb[1],this._rgb[2],t],"rgb"):this._rgb[3]},y.prototype.clipped=function(){return this._rgb._clipped||!1};const A={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},C=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function O(t){const e=C.get(String(t).toLowerCase());if(!e)throw new Error("unknown Lab illuminant "+t);A.labWhitePoint=t,A.Xn=e[0],A.Zn=e[1]}function F(){return A.labWhitePoint}const L=(...t)=>{t=a(t,"lab");const[e,r,n]=t,[o,s,c]=_(e,r,n),[i,l,h]=j(o,s,c);return[i,l,h,t.length>3?t[3]:1]},_=(t,e,r)=>{const{kE:n,kK:o,kKE:s,Xn:a,Yn:c,Zn:i}=A,l=(t+16)/116,h=.002*e+l,f=l-.005*r,u=h*h*h,b=f*f*f;return[(u>n?u:(116*h-16)/o)*a,(t>s?Math.pow((t+16)/116,3):t/o)*c,(b>n?b:(116*f-16)/o)*i]},E=t=>{const e=Math.sign(t);return((t=Math.abs(t))<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)*e},j=(t,e,r)=>{const{MtxAdaptMa:n,MtxAdaptMaI:o,MtxXYZ2RGB:s,RefWhiteRGB:a,Xn:c,Yn:i,Zn:l}=A,h=c*n.m00+i*n.m10+l*n.m20,f=c*n.m01+i*n.m11+l*n.m21,u=c*n.m02+i*n.m12+l*n.m22,b=a.X*n.m00+a.Y*n.m10+a.Z*n.m20,d=a.X*n.m01+a.Y*n.m11+a.Z*n.m21,m=a.X*n.m02+a.Y*n.m12+a.Z*n.m22,g=(t*n.m00+e*n.m10+r*n.m20)*(b/h),p=(t*n.m01+e*n.m11+r*n.m21)*(d/f),w=(t*n.m02+e*n.m12+r*n.m22)*(m/u),y=g*o.m00+p*o.m10+w*o.m20,x=g*o.m01+p*o.m11+w*o.m21,k=g*o.m02+p*o.m12+w*o.m22;return[255*E(y*s.m00+x*s.m10+k*s.m20),255*E(y*s.m01+x*s.m11+k*s.m21),255*E(y*s.m02+x*s.m12+k*s.m22)]},R=(...t)=>{const[e,r,n,...o]=a(t,"rgb"),[s,c,i]=z(e,r,n),[l,h,f]=function(t,e,r){const{Xn:n,Yn:o,Zn:s,kE:a,kK:c}=A,i=t/n,l=e/o,h=r/s,f=i>a?Math.pow(i,1/3):(c*i+16)/116,u=l>a?Math.pow(l,1/3):(c*l+16)/116,b=h>a?Math.pow(h,1/3):(c*h+16)/116;return[116*u-16,500*(f-u),200*(u-b)]}(s,c,i);return[l,h,f,...o.length>0&&o[0]<1?[o[0]]:[]]};function P(t){const e=Math.sign(t);return((t=Math.abs(t))<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4))*e}const z=(t,e,r)=>{t=P(t/255),e=P(e/255),r=P(r/255);const{MtxRGB2XYZ:n,MtxAdaptMa:o,MtxAdaptMaI:s,Xn:a,Yn:c,Zn:i,As:l,Bs:h,Cs:f}=A;let u=t*n.m00+e*n.m10+r*n.m20,b=t*n.m01+e*n.m11+r*n.m21,d=t*n.m02+e*n.m12+r*n.m22;const m=a*o.m00+c*o.m10+i*o.m20,g=a*o.m01+c*o.m11+i*o.m21,p=a*o.m02+c*o.m12+i*o.m22;let w=u*o.m00+b*o.m10+d*o.m20,y=u*o.m01+b*o.m11+d*o.m21,x=u*o.m02+b*o.m12+d*o.m22;return w*=m/l,y*=g/h,x*=p/f,u=w*s.m00+y*s.m10+x*s.m20,b=w*s.m01+y*s.m11+x*s.m21,d=w*s.m02+y*s.m12+x*s.m22,[u,b,d]};y.prototype.lab=function(){return R(this._rgb)};Object.assign(x,{lab:(...t)=>new y(...t,"lab"),getLabWhitePoint:F,setLabWhitePoint:O}),w.format.lab=L,w.autodetect.push({p:2,test:(...t)=>{if("array"===s(t=a(t,"lab"))&&3===t.length)return"lab"}}),y.prototype.darken=function(t=1){const e=this.lab();return e[0]-=A.Kn*t,new y(e,"lab").alpha(this.alpha(),!0)},y.prototype.brighten=function(t=1){return this.darken(-t)},y.prototype.darker=y.prototype.darken,y.prototype.brighter=y.prototype.brighten,y.prototype.get=function(t){const[e,r]=t.split("."),n=this[e]();if(r){const t=e.indexOf(r)-("ok"===e.substr(0,2)?2:0);if(t>-1)return n[t];throw new Error(`unknown channel ${r} in mode ${e}`)}return n};const{pow:B}=Math;y.prototype.luminance=function(t,e="rgb"){if(void 0!==t&&"number"===s(t)){if(0===t)return new y([0,0,0,this._rgb[3]],"rgb");if(1===t)return new y([255,255,255,this._rgb[3]],"rgb");let r=this.luminance(),n=20;const o=(r,s)=>{const a=r.interpolate(s,.5,e),c=a.luminance();return Math.abs(t-c)<1e-7||!n--?a:c>t?o(r,a):o(a,s)},s=(r>t?o(new y([0,0,0]),this):o(this,new y([255,255,255]))).rgb();return new y([...s,this._rgb[3]])}return G(...this._rgb.slice(0,3))};const G=(t,e,r)=>.2126*(t=D(t))+.7152*(e=D(e))+.0722*(r=D(r)),D=t=>(t/=255)<=.03928?t/12.92:B((t+.055)/1.055,2.4);var Y={},q=(t,e,r=.5,...n)=>{let o=n[0]||"lrgb";if(Y[o]||n.length||(o=Object.keys(Y)[0]),!Y[o])throw new Error(`interpolation mode ${o} is not defined`);return"object"!==s(t)&&(t=new y(t)),"object"!==s(e)&&(e=new y(e)),Y[o](t,e,r).alpha(t.alpha()+r*(e.alpha()-t.alpha()))};y.prototype.mix=y.prototype.interpolate=function(t,e=.5,...r){return q(this,t,e,...r)},y.prototype.premultiply=function(t=!1){const e=this._rgb,r=e[3];return t?(this._rgb=[e[0]*r,e[1]*r,e[2]*r,r],this):new y([e[0]*r,e[1]*r,e[2]*r,r],"rgb")};const{sin:I,cos:X}=Math,Z=(...t)=>{let[e,r,n]=a(t,"lch");return isNaN(n)&&(n=0),n*=m,[e,X(n)*r,I(n)*r]},K=(...t)=>{t=a(t,"lch");const[e,r,n]=t,[o,s,c]=Z(e,r,n),[i,l,h]=L(o,s,c);return[i,l,h,t.length>3?t[3]:1]},{sqrt:W,atan2:U,round:V}=Math,T=(...t)=>{const[e,r,n]=a(t,"lab"),o=W(r*r+n*n);let s=(U(n,r)*g+360)%360;return 0===V(1e4*o)&&(s=Number.NaN),[e,o,s]},H=(...t)=>{const[e,r,n,...o]=a(t,"rgb"),[s,c,i]=R(e,r,n),[l,h,f]=T(s,c,i);return[l,h,f,...o.length>0&&o[0]<1?[o[0]]:[]]};y.prototype.lch=function(){return H(this._rgb)},y.prototype.hcl=function(){return p(H(this._rgb))};Object.assign(x,{lch:(...t)=>new y(...t,"lch"),hcl:(...t)=>new y(...t,"hcl")}),w.format.lch=K,w.format.hcl=(...t)=>{const e=p(a(t,"hcl"));return K(...e)},["lch","hcl"].forEach((t=>w.autodetect.push({p:2,test:(...e)=>{if("array"===s(e=a(e,t))&&3===e.length)return t}}))),y.prototype.saturate=function(t=1){const e=this.lch();return e[1]+=A.Kn*t,e[1]<0&&(e[1]=0),new y(e,"lch").alpha(this.alpha(),!0)},y.prototype.desaturate=function(t=1){return this.saturate(-t)},y.prototype.set=function(t,e,r=!1){const[n,o]=t.split("."),a=this[n]();if(o){const t=n.indexOf(o)-("ok"===n.substr(0,2)?2:0);if(t>-1){if("string"==s(e))switch(e.charAt(0)){case"+":case"-":a[t]+=+e;break;case"*":a[t]*=+e.substr(1);break;case"/":a[t]/=+e.substr(1);break;default:a[t]=+e}else{if("number"!==s(e))throw new Error("unsupported value for Color.set");a[t]=e}const o=new y(a,n);return r?(this._rgb=o._rgb,this):o}throw new Error(`unknown channel ${o} in mode ${n}`)}return a},y.prototype.tint=function(t=.5,...e){return q(this,"white",t,...e)},y.prototype.shade=function(t=.5,...e){return q(this,"black",t,...e)};Y.rgb=(t,e,r)=>{const n=t._rgb,o=e._rgb;return new y(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),"rgb")};const{sqrt:J,pow:Q}=Math;Y.lrgb=(t,e,r)=>{const[n,o,s]=t._rgb,[a,c,i]=e._rgb;return new y(J(Q(n,2)*(1-r)+Q(a,2)*r),J(Q(o,2)*(1-r)+Q(c,2)*r),J(Q(s,2)*(1-r)+Q(i,2)*r),"rgb")};Y.lab=(t,e,r)=>{const n=t.lab(),o=e.lab();return new y(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),"lab")};var tt=(t,e,r,n)=>{let o,s,a,c,i,l,h,f,u,b,d,m;return"hsl"===n?(o=t.hsl(),s=e.hsl()):"hsv"===n?(o=t.hsv(),s=e.hsv()):"hcg"===n?(o=t.hcg(),s=e.hcg()):"hsi"===n?(o=t.hsi(),s=e.hsi()):"lch"===n||"hcl"===n?(n="hcl",o=t.hcl(),s=e.hcl()):"oklch"===n&&(o=t.oklch().reverse(),s=e.oklch().reverse()),"h"!==n.substr(0,1)&&"oklch"!==n||([a,i,h]=o,[c,l,f]=s),isNaN(a)||isNaN(c)?isNaN(a)?isNaN(c)?b=Number.NaN:(b=c,1!=h&&0!=h||"hsv"==n||(u=l)):(b=a,1!=f&&0!=f||"hsv"==n||(u=i)):(m=c>a&&c-a>180?c-(a+360):c<a&&a-c>180?c+360-a:c-a,b=a+r*m),void 0===u&&(u=i+r*(l-i)),d=h+r*(f-h),new y("oklch"===n?[d,u,b]:[b,u,d],n)};const et=(t,e,r)=>tt(t,e,r,"lch");Y.lch=et,Y.hcl=et;y.prototype.num=function(){return((...t)=>{const[e,r,n]=a(t,"rgb");return(e<<16)+(r<<8)+n})(this._rgb)};Object.assign(x,{num:(...t)=>new y(...t,"num")}),w.format.num=t=>{if("number"==s(t)&&t>=0&&t<=16777215){return[t>>16,t>>8&255,255&t,1]}throw new Error("unknown num color: "+t)},w.autodetect.push({p:5,test:(...t)=>{if(1===t.length&&"number"===s(t[0])&&t[0]>=0&&t[0]<=16777215)return"num"}});Y.num=(t,e,r)=>{const n=t.num(),o=e.num();return new y(n+r*(o-n),"num")};const{floor:rt}=Math;y.prototype.hcg=function(){return((...t)=>{const[e,r,n]=a(t,"rgb"),o=l(e,r,n),s=h(e,r,n),c=s-o,i=100*c/255,f=o/(255-c)*100;let u;return 0===c?u=Number.NaN:(e===s&&(u=(r-n)/c),r===s&&(u=2+(n-e)/c),n===s&&(u=4+(e-r)/c),u*=60,u<0&&(u+=360)),[u,i,f]})(this._rgb)};x.hcg=(...t)=>new y(...t,"hcg"),w.format.hcg=(...t)=>{t=a(t,"hcg");let e,r,n,[o,s,c]=t;c*=255;const i=255*s;if(0===s)e=r=n=c;else{360===o&&(o=0),o>360&&(o-=360),o<0&&(o+=360),o/=60;const t=rt(o),a=o-t,l=c*(1-s),h=l+i*(1-a),f=l+i*a,u=l+i;switch(t){case 0:[e,r,n]=[u,f,l];break;case 1:[e,r,n]=[h,u,l];break;case 2:[e,r,n]=[l,u,f];break;case 3:[e,r,n]=[l,h,u];break;case 4:[e,r,n]=[f,l,u];break;case 5:[e,r,n]=[u,l,h]}}return[e,r,n,t.length>3?t[3]:1]},w.autodetect.push({p:1,test:(...t)=>{if("array"===s(t=a(t,"hcg"))&&3===t.length)return"hcg"}});Y.hcg=(t,e,r)=>tt(t,e,r,"hcg");const{cos:nt}=Math,{min:ot,sqrt:st,acos:at}=Math;y.prototype.hsi=function(){return((...t)=>{let e,[r,n,o]=a(t,"rgb");r/=255,n/=255,o/=255;const s=ot(r,n,o),c=(r+n+o)/3,i=c>0?1-s/c:0;return 0===i?e=NaN:(e=(r-n+(r-o))/2,e/=st((r-n)*(r-n)+(r-o)*(n-o)),e=at(e),o>n&&(e=b-e),e/=b),[360*e,i,c]})(this._rgb)};x.hsi=(...t)=>new y(...t,"hsi"),w.format.hsi=(...t)=>{t=a(t,"hsi");let e,n,o,[s,c,i]=t;return isNaN(s)&&(s=0),isNaN(c)&&(c=0),s>360&&(s-=360),s<0&&(s+=360),s/=360,s<1/3?(o=(1-c)/3,e=(1+c*nt(b*s)/nt(d-b*s))/3,n=1-(o+e)):s<2/3?(s-=1/3,e=(1-c)/3,n=(1+c*nt(b*s)/nt(d-b*s))/3,o=1-(e+n)):(s-=2/3,n=(1-c)/3,o=(1+c*nt(b*s)/nt(d-b*s))/3,e=1-(n+o)),e=r(i*e*3),n=r(i*n*3),o=r(i*o*3),[255*e,255*n,255*o,t.length>3?t[3]:1]},w.autodetect.push({p:2,test:(...t)=>{if("array"===s(t=a(t,"hsi"))&&3===t.length)return"hsi"}});Y.hsi=(t,e,r)=>tt(t,e,r,"hsi");const ct=(...t)=>{t=a(t,"hsl");const[e,r,n]=t;let o,s,c;if(0===r)o=s=c=255*n;else{const t=[0,0,0],a=[0,0,0],i=n<.5?n*(1+r):n+r-n*r,l=2*n-i,h=e/360;t[0]=h+1/3,t[1]=h,t[2]=h-1/3;for(let e=0;e<3;e++)t[e]<0&&(t[e]+=1),t[e]>1&&(t[e]-=1),6*t[e]<1?a[e]=l+6*(i-l)*t[e]:2*t[e]<1?a[e]=i:3*t[e]<2?a[e]=l+(i-l)*(2/3-t[e])*6:a[e]=l;[o,s,c]=[255*a[0],255*a[1],255*a[2]]}return t.length>3?[o,s,c,t[3]]:[o,s,c,1]},it=(...t)=>{t=a(t,"rgba");let[e,r,n]=t;e/=255,r/=255,n/=255;const o=l(e,r,n),s=h(e,r,n),c=(s+o)/2;let i,f;return s===o?(i=0,f=Number.NaN):i=c<.5?(s-o)/(s+o):(s-o)/(2-s-o),e==s?f=(r-n)/(s-o):r==s?f=2+(n-e)/(s-o):n==s&&(f=4+(e-r)/(s-o)),f*=60,f<0&&(f+=360),t.length>3&&void 0!==t[3]?[f,i,c,t[3]]:[f,i,c]};y.prototype.hsl=function(){return it(this._rgb)};x.hsl=(...t)=>new y(...t,"hsl"),w.format.hsl=ct,w.autodetect.push({p:2,test:(...t)=>{if("array"===s(t=a(t,"hsl"))&&3===t.length)return"hsl"}});Y.hsl=(t,e,r)=>tt(t,e,r,"hsl");const{floor:lt}=Math,{min:ht,max:ft}=Math;y.prototype.hsv=function(){return((...t)=>{t=a(t,"rgb");let[e,r,n]=t;const o=ht(e,r,n),s=ft(e,r,n),c=s-o;let i,l,h;return h=s/255,0===s?(i=Number.NaN,l=0):(l=c/s,e===s&&(i=(r-n)/c),r===s&&(i=2+(n-e)/c),n===s&&(i=4+(e-r)/c),i*=60,i<0&&(i+=360)),[i,l,h]})(this._rgb)};x.hsv=(...t)=>new y(...t,"hsv"),w.format.hsv=(...t)=>{t=a(t,"hsv");let e,r,n,[o,s,c]=t;if(c*=255,0===s)e=r=n=c;else{360===o&&(o=0),o>360&&(o-=360),o<0&&(o+=360),o/=60;const t=lt(o),a=o-t,i=c*(1-s),l=c*(1-s*a),h=c*(1-s*(1-a));switch(t){case 0:[e,r,n]=[c,h,i];break;case 1:[e,r,n]=[l,c,i];break;case 2:[e,r,n]=[i,c,h];break;case 3:[e,r,n]=[i,l,c];break;case 4:[e,r,n]=[h,i,c];break;case 5:[e,r,n]=[c,i,l]}}return[e,r,n,t.length>3?t[3]:1]},w.autodetect.push({p:2,test:(...t)=>{if("array"===s(t=a(t,"hsv"))&&3===t.length)return"hsv"}});function ut(t,e){let r=t.length;Array.isArray(t[0])||(t=[t]),Array.isArray(e[0])||(e=e.map((t=>[t])));let n=e[0].length,o=e[0].map(((t,r)=>e.map((t=>t[r])))),s=t.map((t=>o.map((e=>Array.isArray(t)?t.reduce(((t,r,n)=>t+r*(e[n]||0)),0):e.reduce(((e,r)=>e+r*t),0)))));return 1===r&&(s=s[0]),1===n?s.map((t=>t[0])):s}Y.hsv=(t,e,r)=>tt(t,e,r,"hsv");const bt=(...t)=>{t=a(t,"lab");const[e,r,n,...o]=t,[s,c,i]=(l=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],h=ut([[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],[e,r,n]),ut(l,h.map((t=>t**3))));var l,h;const[f,u,b]=j(s,c,i);return[f,u,b,...o.length>0&&o[0]<1?[o[0]]:[]]};const dt=(...t)=>{const[e,r,n,...o]=a(t,"rgb");return[...function(t){const e=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],r=ut([[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],t);return ut(e,r.map((t=>Math.cbrt(t))))}(z(e,r,n)),...o.length>0&&o[0]<1?[o[0]]:[]]};y.prototype.oklab=function(){return dt(this._rgb)};Object.assign(x,{oklab:(...t)=>new y(...t,"oklab")}),w.format.oklab=bt,w.autodetect.push({p:2,test:(...t)=>{if("array"===s(t=a(t,"oklab"))&&3===t.length)return"oklab"}});Y.oklab=(t,e,r)=>{const n=t.oklab(),o=e.oklab();return new y(n[0]+r*(o[0]-n[0]),n[1]+r*(o[1]-n[1]),n[2]+r*(o[2]-n[2]),"oklab")};Y.oklch=(t,e,r)=>tt(t,e,r,"oklch");const{pow:mt,sqrt:gt,PI:pt,cos:wt,sin:yt,atan2:xt}=Math;const kt=(t,e)=>{const r=t.length,o=[0,0,0,0];for(let n=0;n<t.length;n++){const s=t[n],a=e[n]/r,c=s._rgb;o[0]+=mt(c[0],2)*a,o[1]+=mt(c[1],2)*a,o[2]+=mt(c[2],2)*a,o[3]+=c[3]*a}return o[0]=gt(o[0]),o[1]=gt(o[1]),o[2]=gt(o[2]),o[3]>.9999999&&(o[3]=1),new y(n(o))},{pow:Nt}=Math;function Mt(t){let e="rgb",n=x("#ccc"),o=0,a=[0,1],c=[],i=[0,0],l=!1,h=[],f=!1,u=0,b=1,d=!1,m={},g=!0,p=1;const w=function(t){if((t=t||["#fff","#000"])&&"string"===s(t)&&x.brewer&&x.brewer[t.toLowerCase()]&&(t=x.brewer[t.toLowerCase()]),"array"===s(t)){1===t.length&&(t=[t[0],t[0]]),t=t.slice(0);for(let e=0;e<t.length;e++)t[e]=x(t[e]);c.length=0;for(let e=0;e<t.length;e++)c.push(e/(t.length-1))}return M(),h=t};let y=t=>t,k=t=>t;const N=function(t,o){let a,f;if(null==o&&(o=!1),isNaN(t)||null===t)return n;if(o)f=t;else if(l&&l.length>2){f=function(t){if(null!=l){const e=l.length-1;let r=0;for(;r<e&&t>=l[r];)r++;return r-1}return 0}(t)/(l.length-2)}else f=b!==u?(t-u)/(b-u):1;f=k(f),o||(f=y(f)),1!==p&&(f=Nt(f,p)),f=i[0]+f*(1-i[0]-i[1]),f=r(f,0,1);const d=Math.floor(1e4*f);if(g&&m[d])a=m[d];else{if("array"===s(h))for(let t=0;t<c.length;t++){const r=c[t];if(f<=r){a=h[t];break}if(f>=r&&t===c.length-1){a=h[t];break}if(f>r&&f<c[t+1]){f=(f-r)/(c[t+1]-r),a=x.interpolate(h[t],h[t+1],f,e);break}}else"function"===s(h)&&(a=h(f));g&&(m[d]=a)}return a};var M=()=>m={};w(t);const v=function(t){const e=x(N(t));return f&&e[f]?e[f]():e};return v.classes=function(t){if(null!=t){if("array"===s(t))l=t,a=[t[0],t[t.length-1]];else{const e=x.analyze(a);l=0===t?[e.min,e.max]:x.limits(e,"e",t)}return v}return l},v.domain=function(t){if(!arguments.length)return a;u=t[0],b=t[t.length-1],c=[];const e=h.length;if(t.length===e&&u!==b)for(let e of Array.from(t))c.push((e-u)/(b-u));else{for(let t=0;t<e;t++)c.push(t/(e-1));if(t.length>2){const e=t.map(((e,r)=>r/(t.length-1))),r=t.map((t=>(t-u)/(b-u)));r.every(((t,r)=>e[r]===t))||(k=t=>{if(t<=0||t>=1)return t;let n=0;for(;t>=r[n+1];)n++;const o=(t-r[n])/(r[n+1]-r[n]);return e[n]+o*(e[n+1]-e[n])})}}return a=[u,b],v},v.mode=function(t){return arguments.length?(e=t,M(),v):e},v.range=function(t,e){return w(t),v},v.out=function(t){return f=t,v},v.spread=function(t){return arguments.length?(o=t,v):o},v.correctLightness=function(t){return null==t&&(t=!0),d=t,M(),y=d?function(t){const e=N(0,!0).lab()[0],r=N(1,!0).lab()[0],n=e>r;let o=N(t,!0).lab()[0];const s=e+(r-e)*t;let a=o-s,c=0,i=1,l=20;for(;Math.abs(a)>.01&&l-- >0;)n&&(a*=-1),a<0?(c=t,t+=.5*(i-t)):(i=t,t+=.5*(c-t)),o=N(t,!0).lab()[0],a=o-s;return t}:t=>t,v},v.padding=function(t){return null!=t?("number"===s(t)&&(t=[t,t]),i=t,v):i},v.colors=function(e,r){arguments.length<2&&(r="hex");let n=[];if(0===arguments.length)n=h.slice(0);else if(1===e)n=[v(.5)];else if(e>1){const t=a[0],r=a[1]-t;n=function(t,e){let r=[],n=t<e,o=e;for(let e=t;n?e<o:e>o;n?e++:e--)r.push(e);return r}(0,e).map((n=>v(t+n/(e-1)*r)))}else{t=[];let e=[];if(l&&l.length>2)for(let t=1,r=l.length,n=1<=r;n?t<r:t>r;n?t++:t--)e.push(.5*(l[t-1]+l[t]));else e=a;n=e.map((t=>v(t)))}return x[r]&&(n=n.map((t=>t[r]()))),n},v.cache=function(t){return null!=t?(g=t,v):g},v.gamma=function(t){return null!=t?(p=t,v):p},v.nodata=function(t){return null!=t?(n=x(t),v):n},v}const{round:vt}=Math;y.prototype.rgb=function(t=!0){return!1===t?this._rgb.slice(0,3):this._rgb.slice(0,3).map(vt)},y.prototype.rgba=function(t=!0){return this._rgb.slice(0,4).map(((e,r)=>r<3?!1===t?e:vt(e):e))};Object.assign(x,{rgb:(...t)=>new y(...t,"rgb")}),w.format.rgb=(...t)=>{const e=a(t,"rgba");return void 0===e[3]&&(e[3]=1),e},w.autodetect.push({p:3,test:(...t)=>{if("array"===s(t=a(t,"rgba"))&&(3===t.length||4===t.length&&"number"==s(t[3])&&t[3]>=0&&t[3]<=1))return"rgb"}});const $t=(t,e,r)=>{if(!$t[r])throw new Error("unknown blend mode "+r);return $t[r](t,e)},St=t=>(e,r)=>{const n=x(r).rgb(),o=x(e).rgb();return x.rgb(t(n,o))},At=t=>(e,r)=>{const n=[];return n[0]=t(e[0],r[0]),n[1]=t(e[1],r[1]),n[2]=t(e[2],r[2]),n};$t.normal=St(At((t=>t))),$t.multiply=St(At(((t,e)=>t*e/255))),$t.screen=St(At(((t,e)=>255*(1-(1-t/255)*(1-e/255))))),$t.overlay=St(At(((t,e)=>e<128?2*t*e/255:255*(1-2*(1-t/255)*(1-e/255))))),$t.darken=St(At(((t,e)=>t>e?e:t))),$t.lighten=St(At(((t,e)=>t>e?t:e))),$t.dodge=St(At(((t,e)=>255===t||(t=e/255*255/(1-t/255))>255?255:t))),$t.burn=St(At(((t,e)=>255*(1-(1-e/255)/(t/255)))));const{pow:Ct,sin:Ot,cos:Ft}=Math;const{floor:Lt,random:_t}=Math;const{log:Et,pow:jt,floor:Rt,abs:Pt}=Math;function zt(t,e=null){const r={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===s(t)&&(t=Object.values(t)),t.forEach((t=>{e&&"object"===s(t)&&(t=t[e]),null==t||isNaN(t)||(r.values.push(t),r.sum+=t,t<r.min&&(r.min=t),t>r.max&&(r.max=t),r.count+=1)})),r.domain=[r.min,r.max],r.limits=(t,e)=>Bt(r,t,e),r}function Bt(t,e="equal",r=7){"array"==s(t)&&(t=zt(t));const{min:n,max:o}=t,a=t.values.sort(((t,e)=>t-e));if(1===r)return[n,o];const c=[];if("c"===e.substr(0,1)&&(c.push(n),c.push(o)),"e"===e.substr(0,1)){c.push(n);for(let t=1;t<r;t++)c.push(n+t/r*(o-n));c.push(o)}else if("l"===e.substr(0,1)){if(n<=0)throw new Error("Logarithmic scales are only possible for values > 0");const t=Math.LOG10E*Et(n),e=Math.LOG10E*Et(o);c.push(n);for(let n=1;n<r;n++)c.push(jt(10,t+n/r*(e-t)));c.push(o)}else if("q"===e.substr(0,1)){c.push(n);for(let t=1;t<r;t++){const e=(a.length-1)*t/r,n=Rt(e);if(n===e)c.push(a[n]);else{const t=e-n;c.push(a[n]*(1-t)+a[n+1]*t)}}c.push(o)}else if("k"===e.substr(0,1)){let t;const e=a.length,s=new Array(e),i=new Array(r);let l=!0,h=0,f=null;f=[],f.push(n);for(let t=1;t<r;t++)f.push(n+t/r*(o-n));for(f.push(o);l;){for(let t=0;t<r;t++)i[t]=0;for(let t=0;t<e;t++){const e=a[t];let n,o=Number.MAX_VALUE;for(let a=0;a<r;a++){const r=Pt(f[a]-e);r<o&&(o=r,n=a),i[n]++,s[t]=n}}const n=new Array(r);for(let t=0;t<r;t++)n[t]=null;for(let r=0;r<e;r++)t=s[r],null===n[t]?n[t]=a[r]:n[t]+=a[r];for(let t=0;t<r;t++)n[t]*=1/i[t];l=!1;for(let t=0;t<r;t++)if(n[t]!==f[t]){l=!0;break}f=n,h++,h>200&&(l=!1)}const u={};for(let t=0;t<r;t++)u[t]=[];for(let r=0;r<e;r++)t=s[r],u[t].push(a[r]);let b=[];for(let t=0;t<r;t++)b.push(u[t][0]),b.push(u[t][u[t].length-1]);b=b.sort(((t,e)=>t-e)),c.push(b[0]);for(let t=1;t<b.length;t+=2){const e=b[t];isNaN(e)||-1!==c.indexOf(e)||c.push(e)}}return c}
54
+ /**
55
+ * @license
56
+ *
57
+ * The APCA contrast prediction algorithm is based of the formulas published
58
+ * in the APCA-1.0.98G specification by Myndex. The specification is available at:
59
+ * https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
60
+ *
61
+ * Note that the APCA implementation is still beta, so please update to
62
+ * future versions of chroma.js when they become available.
63
+ *
64
+ * You can read more about the APCA Readability Criterion at
65
+ * https://readtech.org/ARC/
66
+ */
67
+ const Gt=.022;function Dt(t,e,r){return.2126729*Math.pow(t/255,2.4)+.7151522*Math.pow(e/255,2.4)+.072175*Math.pow(r/255,2.4)}const{sqrt:Yt,pow:qt,min:It,max:Xt,atan2:Zt,abs:Kt,cos:Wt,sin:Ut,exp:Vt,PI:Tt}=Math;var Ht={cool:()=>Mt([x.hsl(180,1,.9),x.hsl(250,.7,.4)]),hot:()=>Mt(["#000","#f00","#ff0","#fff"]).mode("rgb")};const Jt={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Qt=Object.keys(Jt),te=new Map(Qt.map((t=>[t.toLowerCase(),t]))),ee="function"==typeof Proxy?new Proxy(Jt,{get(t,e){const r=e.toLowerCase();if(te.has(r))return t[te.get(r)]},getOwnPropertyNames:()=>Object.getOwnPropertyNames(Qt)}):Jt,{max:re}=Math;y.prototype.cmyk=function(){return((...t)=>{let[e,r,n]=a(t,"rgb");e/=255,r/=255,n/=255;const o=1-re(e,re(r,n)),s=o<1?1/(1-o):0;return[(1-e-o)*s,(1-r-o)*s,(1-n-o)*s,o]})(this._rgb)};Object.assign(x,{cmyk:(...t)=>new y(...t,"cmyk")}),w.format.cmyk=(...t)=>{t=a(t,"cmyk");const[e,r,n,o]=t,s=t.length>4?t[4]:1;return 1===o?[0,0,0,s]:[e>=1?0:255*(1-e)*(1-o),r>=1?0:255*(1-r)*(1-o),n>=1?0:255*(1-n)*(1-o),s]},w.autodetect.push({p:2,test:(...t)=>{if("array"===s(t=a(t,"cmyk"))&&4===t.length)return"cmyk"}});const ne=(...t)=>{const[e,r,n,...o]=a(t,"rgb"),[s,c,i]=dt(e,r,n),[l,h,f]=T(s,c,i);return[l,h,f,...o.length>0&&o[0]<1?[o[0]]:[]]},{round:oe}=Math,se=(...t)=>{const e=a(t,"rgba");let r=c(t)||"rgb";if("hsl"===r.substr(0,3))return((...t)=>{const e=a(t,"hsla");let r=c(t)||"lsa";return e[0]=f(e[0]||0)+"deg",e[1]=f(100*e[1])+"%",e[2]=f(100*e[2])+"%","hsla"===r||e.length>3&&e[3]<1?(e[3]="/ "+(e.length>3?e[3]:1),r="hsla"):e.length=3,`${r.substr(0,3)}(${e.join(" ")})`})(it(e),r);if("lab"===r.substr(0,3)){const t=F();O("d50");const n=((...t)=>{const e=a(t,"lab");let r=c(t)||"lab";return e[0]=f(e[0])+"%",e[1]=f(e[1]),e[2]=f(e[2]),"laba"===r||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lab(${e.join(" ")})`})(R(e),r);return O(t),n}if("lch"===r.substr(0,3)){const t=F();O("d50");const n=((...t)=>{const e=a(t,"lch");let r=c(t)||"lab";return e[0]=f(e[0])+"%",e[1]=f(e[1]),e[2]=isNaN(e[2])?"none":f(e[2])+"deg","lcha"===r||e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`lch(${e.join(" ")})`})(H(e),r);return O(t),n}return"oklab"===r.substr(0,5)?((...t)=>{const e=a(t,"lab");return e[0]=f(100*e[0])+"%",e[1]=u(e[1]),e[2]=u(e[2]),e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklab(${e.join(" ")})`})(dt(e)):"oklch"===r.substr(0,5)?((...t)=>{const e=a(t,"lch");return e[0]=f(100*e[0])+"%",e[1]=u(e[1]),e[2]=isNaN(e[2])?"none":f(e[2])+"deg",e.length>3&&e[3]<1?e[3]="/ "+(e.length>3?e[3]:1):e.length=3,`oklch(${e.join(" ")})`})(ne(e)):(e[0]=oe(e[0]),e[1]=oe(e[1]),e[2]=oe(e[2]),("rgba"===r||e.length>3&&e[3]<1)&&(e[3]="/ "+(e.length>3?e[3]:1),r="rgba"),`${r.substr(0,3)}(${e.slice(0,"rgb"===r?3:4).join(" ")})`)},ae=(...t)=>{t=a(t,"lch");const[e,r,n,...o]=t,[s,c,i]=Z(e,r,n),[l,h,f]=bt(s,c,i);return[l,h,f,...o.length>0&&o[0]<1?[o[0]]:[]]},ce=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,ie=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,le=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,he=/\s*/.source,fe=/\s+/.source,ue=/\s*,\s*/.source,be=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,de=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,me=new RegExp("^rgba?\\("+he+[ce,ce,ce].join(fe)+de+"\\)$"),ge=new RegExp("^rgb\\("+he+[ce,ce,ce].join(ue)+he+"\\)$"),pe=new RegExp("^rgba\\("+he+[ce,ce,ce,ie].join(ue)+he+"\\)$"),we=new RegExp("^hsla?\\("+he+[be,le,le].join(fe)+de+"\\)$"),ye=new RegExp("^hsl?\\("+he+[be,le,le].join(ue)+he+"\\)$"),xe=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,ke=new RegExp("^lab\\("+he+[ie,ie,ie].join(fe)+de+"\\)$"),Ne=new RegExp("^lch\\("+he+[ie,ie,be].join(fe)+de+"\\)$"),Me=new RegExp("^oklab\\("+he+[ie,ie,ie].join(fe)+de+"\\)$"),ve=new RegExp("^oklch\\("+he+[ie,ie,be].join(fe)+de+"\\)$"),{round:$e}=Math,Se=t=>t.map(((t,e)=>e<=2?r($e(t),0,255):t)),Ae=(t,e=0,r=100,n=!1)=>("string"==typeof t&&t.endsWith("%")&&(t=parseFloat(t.substring(0,t.length-1))/100,t=n?e+.5*(t+1)*(r-e):e+t*(r-e)),+t),Ce=(t,e)=>"none"===t?e:t,Oe=t=>{if("transparent"===(t=t.toLowerCase().trim()))return[0,0,0,0];let e;if(w.format.named)try{return w.format.named(t)}catch(t){}if((e=t.match(me))||(e=t.match(ge))){let t=e.slice(1,4);for(let e=0;e<3;e++)t[e]=+Ae(Ce(t[e],0),0,255);t=Se(t);const r=void 0!==e[4]?+Ae(e[4],0,1):1;return t[3]=r,t}if(e=t.match(pe)){const t=e.slice(1,5);for(let e=0;e<4;e++)t[e]=+Ae(t[e],0,255);return t}if((e=t.match(we))||(e=t.match(ye))){const t=e.slice(1,4);t[0]=+Ce(t[0].replace("deg",""),0),t[1]=.01*+Ae(Ce(t[1],0),0,100),t[2]=.01*+Ae(Ce(t[2],0),0,100);const r=Se(ct(t)),n=void 0!==e[4]?+Ae(e[4],0,1):1;return r[3]=n,r}if(e=t.match(xe)){const t=e.slice(1,4);t[1]*=.01,t[2]*=.01;const r=ct(t);for(let t=0;t<3;t++)r[t]=$e(r[t]);return r[3]=+e[4],r}if(e=t.match(ke)){const t=e.slice(1,4);t[0]=Ae(Ce(t[0],0),0,100),t[1]=Ae(Ce(t[1],0),-125,125,!0),t[2]=Ae(Ce(t[2],0),-125,125,!0);const r=F();O("d50");const n=Se(L(t));O(r);const o=void 0!==e[4]?+Ae(e[4],0,1):1;return n[3]=o,n}if(e=t.match(Ne)){const t=e.slice(1,4);t[0]=Ae(t[0],0,100),t[1]=Ae(Ce(t[1],0),0,150,!1),t[2]=+Ce(t[2].replace("deg",""),0);const r=F();O("d50");const n=Se(K(t));O(r);const o=void 0!==e[4]?+Ae(e[4],0,1):1;return n[3]=o,n}if(e=t.match(Me)){const t=e.slice(1,4);t[0]=Ae(Ce(t[0],0),0,1),t[1]=Ae(Ce(t[1],0),-.4,.4,!0),t[2]=Ae(Ce(t[2],0),-.4,.4,!0);const r=Se(bt(t)),n=void 0!==e[4]?+Ae(e[4],0,1):1;return r[3]=n,r}if(e=t.match(ve)){const t=e.slice(1,4);t[0]=Ae(Ce(t[0],0),0,1),t[1]=Ae(Ce(t[1],0),0,.4,!1),t[2]=+Ce(t[2].replace("deg",""),0);const r=Se(ae(t)),n=void 0!==e[4]?+Ae(e[4],0,1):1;return r[3]=n,r}};Oe.test=t=>me.test(t)||we.test(t)||ke.test(t)||Ne.test(t)||Me.test(t)||ve.test(t)||ge.test(t)||pe.test(t)||ye.test(t)||xe.test(t)||"transparent"===t,y.prototype.css=function(t){return se(this._rgb,t)};x.css=(...t)=>new y(...t,"css"),w.format.css=Oe,w.autodetect.push({p:5,test:(t,...e)=>{if(!e.length&&"string"===s(t)&&Oe.test(t))return"css"}}),w.format.gl=(...t)=>{const e=a(t,"rgba");return e[0]*=255,e[1]*=255,e[2]*=255,e};x.gl=(...t)=>new y(...t,"gl"),y.prototype.gl=function(){const t=this._rgb;return[t[0]/255,t[1]/255,t[2]/255,t[3]]},y.prototype.hex=function(t){return S(this._rgb,t)};x.hex=(...t)=>new y(...t,"hex"),w.format.hex=v,w.autodetect.push({p:4,test:(t,...e)=>{if(!e.length&&"string"===s(t)&&[3,4,5,6,7,8,9].indexOf(t.length)>=0)return"hex"}});const{log:Fe}=Math,Le=t=>{const e=t/100;let r,n,o;return e<66?(r=255,n=e<6?0:-155.25485562709179-.44596950469579133*(n=e-2)+104.49216199393888*Fe(n),o=e<20?0:.8274096064007395*(o=e-10)-254.76935184120902+115.67994401066147*Fe(o)):(r=351.97690566805693+.114206453784165*(r=e-55)-40.25366309332127*Fe(r),n=325.4494125711974+.07943456536662342*(n=e-50)-28.0852963507957*Fe(n),o=255),[r,n,o,1]},{round:_e}=Math;y.prototype.temp=y.prototype.kelvin=y.prototype.temperature=function(){return((...t)=>{const e=a(t,"rgb"),r=e[0],n=e[2];let o,s=1e3,c=4e4;for(;c-s>.4;){o=.5*(c+s);const t=Le(o);t[2]/t[0]>=n/r?c=o:s=o}return _e(o)})(this._rgb)};const Ee=(...t)=>new y(...t,"temp");Object.assign(x,{temp:Ee,kelvin:Ee,temperature:Ee}),w.format.temp=w.format.kelvin=w.format.temperature=Le,y.prototype.oklch=function(){return ne(this._rgb)};function je(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}Object.assign(x,{oklch:(...t)=>new y(...t,"oklch")}),w.format.oklch=ae,w.autodetect.push({p:2,test:(...t)=>{if("array"===s(t=a(t,"oklch"))&&3===t.length)return"oklch"}}),Object.assign(x,{analyze:zt,average:(t,e="lrgb",r=null)=>{const n=t.length;r||(r=Array.from(new Array(n)).map((()=>1)));const o=n/r.reduce((function(t,e){return t+e}));if(r.forEach(((t,e)=>{r[e]*=o})),t=t.map((t=>new y(t))),"lrgb"===e)return kt(t,r);const s=t.shift(),a=s.get(e),c=[];let i=0,l=0;for(let t=0;t<a.length;t++)if(a[t]=(a[t]||0)*r[0],c.push(isNaN(a[t])?0:r[0]),"h"===e.charAt(t)&&!isNaN(a[t])){const e=a[t]/180*pt;i+=wt(e)*r[0],l+=yt(e)*r[0]}let h=s.alpha()*r[0];t.forEach(((t,n)=>{const o=t.get(e);h+=t.alpha()*r[n+1];for(let t=0;t<a.length;t++)if(!isNaN(o[t]))if(c[t]+=r[n+1],"h"===e.charAt(t)){const e=o[t]/180*pt;i+=wt(e)*r[n+1],l+=yt(e)*r[n+1]}else a[t]+=o[t]*r[n+1]}));for(let t=0;t<a.length;t++)if("h"===e.charAt(t)){let e=xt(l/c[t],i/c[t])/pt*180;for(;e<0;)e+=360;for(;e>=360;)e-=360;a[t]=e}else a[t]=a[t]/c[t];return h/=n,new y(a,e).alpha(h>.99999?1:h,!0)},bezier:t=>{const e=function(t){let e,r,n,o;if(2===(t=t.map((t=>new y(t)))).length)[r,n]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>r[e]+t*(n[e]-r[e])));return new y(e,"lab")};else if(3===t.length)[r,n,o]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>(1-t)*(1-t)*r[e]+2*(1-t)*t*n[e]+t*t*o[e]));return new y(e,"lab")};else if(4===t.length){let s;[r,n,o,s]=t.map((t=>t.lab())),e=function(t){const e=[0,1,2].map((e=>(1-t)*(1-t)*(1-t)*r[e]+3*(1-t)*(1-t)*t*n[e]+3*(1-t)*t*t*o[e]+t*t*t*s[e]));return new y(e,"lab")}}else{if(!(t.length>=5))throw new RangeError("No point in running bezier with only one color.");{let r,n,o;r=t.map((t=>t.lab())),o=t.length-1,n=function(t){let e=[1,1];for(let r=1;r<t;r++){let t=[1];for(let r=1;r<=e.length;r++)t[r]=(e[r]||0)+e[r-1];e=t}return e}(o),e=function(t){const e=1-t,s=[0,1,2].map((s=>r.reduce(((r,a,c)=>r+n[c]*e**(o-c)*t**c*a[s]),0)));return new y(s,"lab")}}}return e}(t);return e.scale=()=>Mt(e),e},blend:$t,brewer:ee,Color:y,colors:k,contrast:(t,e)=>{t=new y(t),e=new y(e);const r=t.luminance(),n=e.luminance();return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)},contrastAPCA:(t,e)=>{t=new y(t),e=new y(e),t.alpha()<1&&(t=q(e,t,t.alpha(),"rgb"));const r=Dt(...t.rgb()),n=Dt(...e.rgb()),o=r>=Gt?r:r+Math.pow(Gt-r,1.414),s=n>=Gt?n:n+Math.pow(Gt-n,1.414),a=Math.pow(s,.56)-Math.pow(o,.57),c=Math.pow(s,.65)-Math.pow(o,.62),i=Math.abs(s-o)<5e-4?0:o<s?1.14*a:1.14*c;return 100*(Math.abs(i)<.1?0:i>0?i-.027:i+.027)},cubehelix:function(t=300,e=-1.5,r=1,o=1,a=[0,1]){let c,i=0;"array"===s(a)?c=a[1]-a[0]:(c=0,a=[a,a]);const l=function(s){const l=b*((t+120)/360+e*s),h=Ct(a[0]+c*s,o),f=(0!==i?r[0]+s*i:r)*h*(1-h)/2,u=Ft(l),d=Ot(l);return x(n([255*(h+f*(-.14861*u+1.78277*d)),255*(h+f*(-.29227*u-.90649*d)),255*(h+f*(1.97294*u)),1]))};return l.start=function(e){return null==e?t:(t=e,l)},l.rotations=function(t){return null==t?e:(e=t,l)},l.gamma=function(t){return null==t?o:(o=t,l)},l.hue=function(t){return null==t?r:("array"===s(r=t)?(i=r[1]-r[0],0===i&&(r=r[1])):i=0,l)},l.lightness=function(t){return null==t?a:("array"===s(t)?(a=t,c=t[1]-t[0]):(a=[t,t],c=0),l)},l.scale=()=>x.scale(l),l.hue(r),l},deltaE:function(t,e,r=1,n=1,o=1){var s=function(t){return 360*t/(2*Tt)},a=function(t){return 2*Tt*t/360};t=new y(t),e=new y(e);const[c,i,l]=Array.from(t.lab()),[h,f,u]=Array.from(e.lab()),b=(c+h)/2,d=(Yt(qt(i,2)+qt(l,2))+Yt(qt(f,2)+qt(u,2)))/2,m=.5*(1-Yt(qt(d,7)/(qt(d,7)+qt(25,7)))),g=i*(1+m),p=f*(1+m),w=Yt(qt(g,2)+qt(l,2)),x=Yt(qt(p,2)+qt(u,2)),k=(w+x)/2,N=s(Zt(l,g)),M=s(Zt(u,p)),v=N>=0?N:N+360,$=M>=0?M:M+360,S=Kt(v-$)>180?(v+$+360)/2:(v+$)/2,A=1-.17*Wt(a(S-30))+.24*Wt(a(2*S))+.32*Wt(a(3*S+6))-.2*Wt(a(4*S-63));let C=$-v;C=Kt(C)<=180?C:$<=v?C+360:C-360,C=2*Yt(w*x)*Ut(a(C)/2);const O=h-c,F=x-w,L=1+.015*qt(b-50,2)/Yt(20+qt(b-50,2)),_=1+.045*k,E=1+.015*k*A,j=30*Vt(-qt((S-275)/25,2)),R=-(2*Yt(qt(k,7)/(qt(k,7)+qt(25,7))))*Ut(2*a(j)),P=Yt(qt(O/(r*L),2)+qt(F/(n*_),2)+qt(C/(o*E),2)+R*(F/(n*_))*(C/(o*E)));return Xt(0,It(100,P))},distance:function(t,e,r="lab"){t=new y(t),e=new y(e);const n=t.get(r),o=e.get(r);let s=0;for(let t in n){const e=(n[t]||0)-(o[t]||0);s+=e*e}return Math.sqrt(s)},input:w,interpolate:q,limits:Bt,mix:q,random:()=>{let t="#";for(let e=0;e<6;e++)t+="0123456789abcdef".charAt(Lt(16*_t()));return new y(t,"hex")},scale:Mt,scales:Ht,valid:(...t)=>{try{return new y(...t),!0}catch(t){return!1}}});var Re,Pe={exports:{}};var ze,Be=(Re||(Re=1,ze=Pe,function(t){function e(t,r){if(!(t=n(t)))return null;var o,s,a,c=1/0;r||(r=e.DEFAULT_COLORS);for(var i=0;i<r.length;++i)s=r[i].rgb,(o=Math.pow(t.r-s.r,2)+Math.pow(t.g-s.g,2)+Math.pow(t.b-s.b,2))<c&&(c=o,a=r[i]);return a.name?{name:a.name,value:a.source,rgb:a.rgb,distance:Math.sqrt(c)}:a.source}function r(t){return t instanceof Array?t.map((function(t){return o(t)})):Object.keys(t).map((function(e){return o(t[e],e)}))}function n(t){if("object"==typeof t)return t;if(t in e.STANDARD_COLORS)return n(e.STANDARD_COLORS[t]);var r=t.match(/^#?((?:[0-9a-f]{3}){1,2})$/i);if(r)return r=3===(r=r[1]).length?[r.charAt(0)+r.charAt(0),r.charAt(1)+r.charAt(1),r.charAt(2)+r.charAt(2)]:[r.substring(0,2),r.substring(2,4),r.substring(4,6)],{r:parseInt(r[0],16),g:parseInt(r[1],16),b:parseInt(r[2],16)};var o=t.match(/^rgb\(\s*(\d{1,3}%?),\s*(\d{1,3}%?),\s*(\d{1,3}%?)\s*\)$/i);if(o)return{r:s(o[1]),g:s(o[2]),b:s(o[3])};throw Error('"'+t+'" is not a valid color')}function o(t,e){var r={};if(e&&(r.name=e),"string"==typeof t)r.source=t,r.rgb=n(t);else if("object"==typeof t){if(t.source)return o(t.source,t.name);r.rgb=t,r.source=function(t){return"#"+a(t.r.toString(16))+a(t.g.toString(16))+a(t.b.toString(16))}(t)}return r}function s(t){return"%"===t.charAt(t.length-1)?Math.round(255*parseInt(t,10)/100):Number(t)}function a(t){return 1===t.length&&(t="0"+t),t}e.from=function t(n){var o=r(n),s=e,a=function(t){return s(t,o)};return a.from=t,a.or=function(t){var n=o.concat(r(t));return e.from(n)},a},e.STANDARD_COLORS={aqua:"#0ff",black:"#000",blue:"#00f",fuchsia:"#f0f",gray:"#808080",green:"#008000",lime:"#0f0",maroon:"#800000",navy:"#000080",olive:"#808000",orange:"#ffa500",purple:"#800080",red:"#f00",silver:"#c0c0c0",teal:"#008080",white:"#fff",yellow:"#ff0"},e.DEFAULT_COLORS=r(["#f00","#f80","#ff0","#0f0","#00f","#008","#808"]),e.VERSION="0.4.4",ze&&ze.exports?ze.exports=e:t.nearestColor=e}(Pe.exports)),Pe.exports),Ge=je(Be);class De{h;s;l;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(0)),this.s=Number((100*e).toFixed(0)),this.l=Number((100*r).toFixed(0))}toString(){return`hsl(${this.h}, ${this.s}%, ${this.l}%)`}}class Ye{h;s;l;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(0)),this.s=Number(e.toFixed(2)),this.l=Number(r.toFixed(2))}toString(){return`${this.h}, ${this.s}, ${this.l}`}}class qe{x;y;z;constructor({x:t,y:e,z:r}){this.x=t,this.y=e,this.z=r}toString(){return`${this.x}, ${this.y}, ${this.z}`}}class Ie{c;m;y;k;constructor({c:t,m:e,y:r,k:n}){this.c=t,this.m=e,this.y=r,this.k=n}toString(){return`${this.c}, ${this.m}, ${this.y}, ${this.k}`}}class Xe{r;g;b;constructor({r:t,g:e,b:r}){this.r=t,this.g=e,this.b=r}toString(){return`${this.r}, ${this.g}, ${this.b}`}}class Ze{h;w;b;constructor({h:t,w:e,b:r}){this.h=t,this.w=e,this.b=r}toString(){return`${this.h}, ${this.w}, ${this.b}`}}class Ke{l;a;b;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.a=Number(e.toFixed(2)),this.b=Number(r.toFixed(2))}toString(){return`${this.l}, ${this.a}, ${this.b}`}}class We{l;a;b;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.a=Number(e.toFixed(2)),this.b=Number(r.toFixed(2))}toString(){return`${this.l}, ${this.a}, ${this.b}`}}class Ue{h;s;v;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(2)),this.s=Number(e.toFixed(2)),this.v=Number(r.toFixed(2))}toString(){return`${this.h}, ${this.s}, ${this.v}`}}class Ve{l;c;h;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.c=Number(e.toFixed(2)),this.h=Number(isNaN(r)?"0":r.toFixed(2))}toString(){return`${this.l}, ${this.c}, ${this.h}`}}class Te{l;c;h;constructor([t,e,r]){this.l=Number(t.toFixed(2)),this.c=Number(e.toFixed(2)),this.h=Number(isNaN(r)?"0":r.toFixed(2))}toString(){return`${this.l}, ${this.c}, ${this.h}`}}class He{h;s;i;constructor([t,e,r]){this.h=Number(isNaN(t)?"0":t.toFixed(2)),this.s=Number(e.toFixed(2)),this.i=Number(r.toFixed(2))}toString(){return`${this.h}, ${this.s}, ${this.i}`}}const Je=(t,e)=>{if("hsl"===e)return new Ye(x(t).hsl());const r=x(t).rgb();return new Xe({r:Number((r[0]/255).toFixed(2)),g:Number((r[1]/255).toFixed(2)),b:Number((r[2]/255).toFixed(2))})},Qe=t=>(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4),tr=t=>t>.008856452?Math.pow(t,1/3):t/.12841855+.137931034;class er{color;name;hex;rgb;hsl;hwb;hsv;lab;xyz;lch;oklch;hsi;oklab;cmyk;rgbFloat;hslFloat;constructor(t,e){this.color=t,this.name=e,this.hex=(t=>x(t).hex())(this.color),this.cmyk=(t=>{let[e,r,n]=x(t).rgb();e/=255,n/=255,r/=255;const o=+(1-Math.max(e,n,r)),s=+((1-n-o)/(1-o)||0),a=+((1-r-o)/(1-o)||0);return new Ie({c:Number((100*+((1-e-o)/(1-o)||0)).toFixed()),m:Number((100*s).toFixed()),y:Number((100*a).toFixed()),k:Number((100*o).toFixed())})})(this.color),this.xyz=(t=>{let[e,r,n]=x(t).rgb();e=Qe(e),n=Qe(n),r=Qe(r);const o=tr((.4124564*e+.3575761*n+.1804375*r)/.95047),s=tr((.2126729*e+.7151522*n+.072175*r)/1),a=tr((.0193339*e+.119192*n+.9503041*r)/1.08883);return new qe({x:Number(o.toFixed(2)),y:Number(s.toFixed(2)),z:Number(a.toFixed(2))})})(this.color),this.hsl=(t=>new De(x(t).hsl()))(this.color),this.hwb=(t=>{let[e,r,n]=x(t).rgb();e/=255,n/=255,r/=255;const o=Math.min(e,n,r),s=Math.max(e,n,r),a=1-s;return s===o?{h:0,w:o,b:a}:new Ze({h:Number((((e===o?3:n===o?5:1)-(e===o?n-r:n===o?r-e:e-n)/(s-o))/6).toFixed(2)),w:Number(o.toFixed(2)),b:Number(a.toFixed(2))})})(this.color),this.lab=(t=>new Ke(x(t).lab()))(this.color),this.oklab=(t=>new We(x(t).oklab()))(this.color),this.hsv=(t=>new Ue(x(t).hsv()))(this.color),this.lch=(t=>new Ve(x(t).lch()))(this.color),this.oklch=(t=>new Te(x(t).oklch()))(this.color),this.hsi=(t=>new He(x(t).hsi()))(this.color),this.rgb=(t=>{const[e,r,n]=x(t).rgb();return`rgb(${e}, ${r}, ${n})`})(this.color),this.rgbFloat=Je(this.color),this.hslFloat=Je(this.color,"hsl")}toObject(t){return((t,e)=>{if("hsl"===e){const[e,r,n]=x(t).hsl();return{h:Number(isNaN(e)?0:e.toFixed(0)),s:Number((100*r).toFixed()),l:Number((100*n).toFixed())}}const r=x(t).rgb();return{r:r[0],g:r[1],b:r[2]}})(this.color,t)}toFloat(t){return Je(this.color,t)}}const rr={diverging:!1,bezier:!1,randomOffset:!1,correctLightness:!1,noDuplicates:!0,colorScaleMode:"lch",reverseDirection:!1},nr=(t,e,r,n,o={})=>{const{noDuplicates:s=!0}=o,a=[x(t).hex()];let[c,i,l]=x(t).hsl();isNaN(c)&&(c=0),i=Number((100*i).toFixed()),l=Number((100*l).toFixed());for(let t=e;t<=r;t+=n){const e=Number(((c+t)%360).toFixed());a.push(x(`hsl(${e}, ${i}%, ${l}%)`).hex())}let h=a;return s&&(h=[...new Set(a)]),h},or=(t,e)=>Math.floor(Math.random()*(t-e+1))+e,sr=(t,e={})=>{const{numberOfColors:r=8,bezier:n=!1,randomOffset:o=!1,colorScaleMode:s,noDuplicates:a=!0,reverseDirection:c=!1,correctLightness:i=!0}=e;let[l,h,f]=x(t).hsl();isNaN(l)&&(l=0),l=Number(l.toFixed(0)),h=Number((100*h).toFixed(0)),f=Number((100*f).toFixed(0));const u=[];if(u.push(x(`hsl(${l}, ${h}%, ${f<0?0:f}%)`).hex()),o)for(let t=1;t<r;t++)c?(f+=or(0,10),l+=or(-5,5)):(f-=or(0,10),l-=or(-5,5)),l>359&&(l=359),l<0&&(l=0),u.push(x(`hsl(${l}, ${h}%, ${f<0?0:f}%)`).hex());else for(let t=1;t<r;t++)c?(f+=5,l+=5):(f-=5,l-=5),l>359&&(l=359),l<0&&(l=0),u.push(x(`hsl(${l}, ${h}%, ${f<0?0:f}%)`).hex());let b=u.map((t=>x(t).hex()));return a&&(b=[...new Set(b)]),n&&(b=b.length>1?x.bezier(b).scale().mode(s).correctLightness(i).colors(r):x.scale(b).mode(s).correctLightness(i).colors(r)),b},ar=(t,e={})=>{if(!t)throw Error("MoebiusPalettes: missing input `color`");const{diverging:r=!1,numberOfColors:n=7}=e,[o,s,a]=x(t).lab(),c=100*(.95-1/n),i=c/(n-1),l=.5*(100-c),h=((t,e,r)=>{const n=[];for(let o=t;o<e;o+=r)n.push(o);return n})(l,l+n*i,i);let f=0;if(!r){f=9999;for(let t=0;t<n;t++){const e=o-h[t];Math.abs(e)<Math.abs(f)&&(f=e)}}return h.map((t=>x.lab([t+f,s,a]).hex()))},cr=(t,e={})=>{const{numberOfColors:r,reverseDirection:n=!1,diverging:o=!1,divergentColor:s}=e;if(o){const e=ar(x(t).hex(),{numberOfColors:Math.ceil(r/2)}).concat(s);return n&&e.reverse(),e}return ar(t,{numberOfColors:r})},ir=(t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e;try{return x.bezier(t).scale().mode(n).correctLightness(o).colors(r)}catch{return[]}},lr=(t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e;try{return x.scale(t).mode(n).correctLightness(o).colors(r)}catch{return[]}};class hr{interpolate;luminanceShift;monochromatic;complement;split;triadic;tetradic;pentadic;hexadic;analogous;constructor(t,e){Object.keys(t).forEach((r=>{this[r]=t[r].map((t=>sr(t,{...e,numberOfColors:9})))}))}toArray(){return[...this.interpolate,...this.luminanceShift,...this.monochromatic,...this.complement,...this.split,...this.triadic,...this.tetradic,...this.pentadic,...this.hexadic,...this.analogous].flat()}}class fr{interpolate;luminanceShift;monochromatic;complement;split;triadic;tetradic;pentadic;hexadic;analogous;constructor(t){Object.keys(t).forEach((e=>{this[e]=t[e]}))}toArray(){return[...this.interpolate,...this.luminanceShift,...this.monochromatic,...this.complement,...this.split,...this.triadic,...this.tetradic,...this.pentadic,...this.hexadic,...this.analogous].flat()}}class ur{darkMode;constructor(t){Object.keys(t).forEach((e=>{this[e]=t[e]}))}}class br{baseColor;secondaryColor;colors={};themes={};defaultOptions={...rr,divergentColor:"#f5f5f5"};options;all=[];accents;constructor(t){this.options={...this.defaultOptions,...t},this.baseColor=this.options.baseColor,this.secondaryColor=this.options.secondaryColor,this.themes=new ur({darkMode:this.darkMode(this.baseColor.hex,this.secondaryColor.hex,{...this.options,reverseDirection:!this.options.reverseDirection})}),this.colors=new fr({interpolate:this.interpolate(this.baseColor.hex,this.secondaryColor.hex,this.options),luminanceShift:this.luminanceShift([this.baseColor.hex],[this.secondaryColor.hex],this.options),monochromatic:this.monochromatic(this.baseColor.hex),complement:this.complement(this.baseColor.hex),split:this.split(this.baseColor.hex),triadic:this.triadic(this.baseColor.hex),tetradic:this.tetradic(this.baseColor.hex),pentadic:this.pentadic(this.baseColor.hex),hexadic:this.hexadic(this.baseColor.hex),analogous:this.analogous(this.baseColor.hex)}),this.accents=new hr(this.colors,this.options),this.all=[...new Set([...this.accents.toArray(),...this.colors.toArray()].flat())]}complement(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=nr(t,180,180,1);return x.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}darkMode(t,e,r={}){return((t,e,r={})=>{const{bezier:n=!1,colorScaleMode:o,noDuplicates:s=!0}=r,a=sr(t,r),c=sr(e,r),i=c.map(((t,e)=>x.mix(a[e],t,.99-.02*e,o).hex())),l={primary:a,surface:c,mixed:i};return s&&(l.primary=[...new Set(a)],l.surface=[...new Set(c)],l.mixed=[...new Set(i)]),n&&(l.primary.length>1&&l.surface.length>1&&l.mixed.length>1?(l.primary=ir(l.primary,r),l.surface=ir(l.surface,r),l.mixed=ir(l.mixed,r)):(l.primary=lr(l.primary,r),l.surface=lr(l.surface,r),l.mixed=lr(l.mixed,r))),l})(t,e,{...this.options,...r})}split(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=nr(t,150,210,60);return x.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}triadic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=nr(t,120,240,120);return x.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}tetradic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=nr(t,90,270,90);return x.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}pentadic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=nr(t,144,360,72);return x.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}hexadic(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=nr(t,120,360,60);return x.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}analogous(t,e={}){return((t,e={})=>{const{numberOfColors:r=8,colorScaleMode:n,correctLightness:o=!0}=e,s=nr(t,30,90,30);return x.scale(s).mode(n).correctLightness(o).colors(r)})(t,{...this.options,...e})}interpolate(t,e,r={}){return((t,e,r={})=>{const{numberOfColors:n=8,colorScaleMode:o,bezier:s=!1,correctLightness:a=!0}=r;let c=x.scale([t,e]).mode(o).correctLightness(a).colors(n);return s&&(c=x.bezier([t,e]).scale().mode(o).correctLightness(a).colors(n)),c})(t,e,{...this.options,...r})}luminanceShift(t,e=[],r={}){return((t,e=[],r={})=>{const{numberOfColors:n=8,diverging:o=!1,colorScaleMode:s,bezier:a=!1,divergentColor:c="#f5f5f5",correctLightness:i=!0}=r;e=0===e.length?[nr(t[0],90,270,90)[3]]:e;const l=n%2==0,h=o?Math.ceil(n/2)+(l?1:0):n,f=o?Math.ceil(n/2)+(l?1:0):0,u=1!==t.length?t:cr(t[0],{numberOfColors:h,divergentColor:c});let b=[];o&&(b=1!==e.length?e:cr(e[0],{numberOfColors:f,divergentColor:c,diverging:o}));let d=t.length?x.scale(u).mode(s).correctLightness(i).colors(h):[];a&&(d=t.length?x.bezier(u).scale().mode(s).correctLightness(i).colors(h):[]);let m=o&&e.length?x.scale(b).mode(s).correctLightness(i).colors(f):[];a&&(m=o&&e.length?x.bezier(b).scale().mode(s).correctLightness(i).colors(f):[]);let g=d;return g=(o?d.slice(0,d.length-(h%2!=0?0:1)):d).concat(m.reverse()),g})(t,e,{...this.options,...r})}monochromatic(t,e={}){const r={...this.options,...e};return sr(t,r)}harmonize(t,e,r,n,o={}){const s={...this.options,...o};return nr(t,e,r,n,s)}}class dr{xlmns="http://www.w3.org/2000/svg";getColorPiePaths(t,e=256){const r=document.createDocumentFragment(),n=document.createElementNS(this.xlmns,"defs"),o=document.createElementNS(this.xlmns,"mask"),s=document.createElementNS(this.xlmns,"rect"),a=document.createElementNS(this.xlmns,"g"),c=360/t.length,i="_"+Math.random().toString(36).substring(2,11);o.setAttributeNS(null,"id",i),s.setAttributeNS(null,"height","100%"),s.setAttributeNS(null,"width","100%"),s.setAttributeNS(null,"fill","white"),a.setAttributeNS(null,"mask",`url(#${i})`),o.appendChild(s);const l=360/t.length;var h,f;for(let e=(h=l/2,4===(f=t.length)||8===f||12===f?0:3===f||9===f?30:7===f?12:5===f?55:h);e<360;e+=l){const t=document.createElementNS(this.xlmns,"line");t.setAttributeNS(null,"x1","128"),t.setAttributeNS(null,"y1","128"),t.setAttributeNS(null,"x2","0"),t.setAttributeNS(null,"y2","128"),t.setAttributeNS(null,"stroke","black"),t.setAttributeNS(null,"stroke-width","6"),t.setAttributeNS(null,"transform",`rotate(${e} 128 128)`),o.appendChild(t)}let u=0;return t.forEach((t=>{const r=e/2/t.length;return u+=c,t.forEach(((t,n)=>{const o=e/2-n*r,s=document.createElementNS(this.xlmns,"path");s.setAttributeNS(null,"fill",t),s.setAttributeNS(null,"data-color-hex",t),s.setAttributeNS(null,"data-r",`${o}`),s.setAttributeNS(null,"d",((t,e,r,n=256)=>{const o=n/2,s=o;let a=t+e;if(t>a){const e=t;t=a,a=e}return`M ${o+r*Math.cos((90-t)*(Math.PI/180))} ${s+r*Math.sin((90-t)*(Math.PI/180))} A ${r} ${r} 0 ${a-t<=180?"0":"1"} 0 ${o+r*Math.cos((90-a)*(Math.PI/180))} ${s+r*Math.sin((90-a)*(Math.PI/180))} L ${o} ${s} Z`})(u,c,o)),a.appendChild(s)}))})),n.appendChild(o),r.appendChild(n),r.appendChild(a),r}}async function mr(){const t=await(async()=>{const t=await fetch("https://color-names.herokuapp.com/v1/"),e=(await t.json()).colors,r={};return e.forEach((t=>{r[t.name]=t.hex})),Ge.from(r)})();return{MoebiusColor:class extends er{constructor(e){super(x(e).hex(),(t=>"string"==typeof t)(t(e))?t(e):t(e).name)}},MoebiusPalettes:br,MoebiusSVGHelper:dr}}export{mr as default};
54
68
  //# sourceMappingURL=moebius.js.map