@salty-css/react 0.0.1-alpha.194 → 0.0.1-alpha.195

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.
Files changed (3) hide show
  1. package/helpers.cjs +1 -1
  2. package/helpers.js +147 -138
  3. package/package.json +2 -2
package/helpers.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var C=Object.defineProperty;var S=(e,t,n)=>t in e?C(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var F=(e,t,n)=>S(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},O=Object.create(null);for(const e in k)Object.hasOwn(k,e)&&(O[k[e]]=e);const d={to:{},get:{}};d.get=function(e){const t=e.slice(0,3).toLowerCase();let n,r;switch(t){case"hsl":{n=d.get.hsl(e),r="hsl";break}case"hwb":{n=d.get.hwb(e),r="hwb";break}default:{n=d.get.rgb(e),r="rgb";break}}return n?{model:r,value:n}:null};d.get.rgb=function(e){if(!e)return null;const t=/^#([a-f\d]{3,4})$/i,n=/^#([a-f\d]{6})([a-f\d]{2})?$/i,r=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,o=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,l=/^(\w+)$/;let s=[0,0,0,1],a,c,u;if(a=e.match(n)){for(u=a[2],a=a[1],c=0;c<3;c++){const m=c*2;s[c]=Number.parseInt(a.slice(m,m+2),16)}u&&(s[3]=Number.parseInt(u,16)/255)}else if(a=e.match(t)){for(a=a[1],u=a[3],c=0;c<3;c++)s[c]=Number.parseInt(a[c]+a[c],16);u&&(s[3]=Number.parseInt(u+u,16)/255)}else if(a=e.match(r)){for(c=0;c<3;c++)s[c]=Number.parseInt(a[c+1],10);a[4]&&(s[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=e.match(o)){for(c=0;c<3;c++)s[c]=Math.round(Number.parseFloat(a[c+1])*2.55);a[4]&&(s[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=e.match(l))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(k,a[1])?(s=k[a[1]],s[3]=1,s):null:null;for(c=0;c<3;c++)s[c]=w(s[c],0,255);return s[3]=w(s[3],0,1),s};d.get.hsl=function(e){if(!e)return null;const t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,n=e.match(t);if(n){const r=Number.parseFloat(n[4]),o=(Number.parseFloat(n[1])%360+360)%360,l=w(Number.parseFloat(n[2]),0,100),s=w(Number.parseFloat(n[3]),0,100),a=w(Number.isNaN(r)?1:r,0,1);return[o,l,s,a]}return null};d.get.hwb=function(e){if(!e)return null;const t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,n=e.match(t);if(n){const r=Number.parseFloat(n[4]),o=(Number.parseFloat(n[1])%360+360)%360,l=w(Number.parseFloat(n[2]),0,100),s=w(Number.parseFloat(n[3]),0,100),a=w(Number.isNaN(r)?1:r,0,1);return[o,l,s,a]}return null};d.to.hex=function(...e){return"#"+x(e[0])+x(e[1])+x(e[2])+(e[3]<1?x(Math.round(e[3]*255)):"")};d.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};d.to.rgb.percent=function(...e){const t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+n+"%, "+r+"%)":"rgba("+t+"%, "+n+"%, "+r+"%, "+e[3]+")"};d.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};d.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};d.to.keyword=function(...e){return O[e.slice(0,3)]};function w(e,t,n){return Math.min(Math.max(t,e),n)}function x(e){const t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}const M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},q={};for(const e of Object.keys(M))q[M[e]]=e;const i={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},y=(6/29)**3;for(const e of Object.keys(i)){if(!("channels"in i[e]))throw new Error("missing channels property: "+e);if(!("labels"in i[e]))throw new Error("missing channel labels property: "+e);if(i[e].labels.length!==i[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:n}=i[e];delete i[e].channels,delete i[e].labels,Object.defineProperty(i[e],"channels",{value:t}),Object.defineProperty(i[e],"labels",{value:n})}i.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(t,n,r),l=Math.max(t,n,r),s=l-o;let a,c;switch(l){case o:{a=0;break}case t:{a=(n-r)/s;break}case n:{a=2+(r-t)/s;break}case r:{a=4+(t-n)/s;break}}a=Math.min(a*60,360),a<0&&(a+=360);const u=(o+l)/2;return l===o?c=0:u<=.5?c=s/(l+o):c=s/(2-l-o),[a,c*100,u*100]};i.rgb.hsv=function(e){let t,n,r,o,l;const s=e[0]/255,a=e[1]/255,c=e[2]/255,u=Math.max(s,a,c),m=u-Math.min(s,a,c),p=function(A){return(u-A)/6/m+1/2};if(m===0)o=0,l=0;else{switch(l=m/u,t=p(s),n=p(a),r=p(c),u){case s:{o=r-n;break}case a:{o=1/3+t-r;break}case c:{o=2/3+n-t;break}}o<0?o+=1:o>1&&(o-=1)}return[o*360,l*100,u*100]};i.rgb.hwb=function(e){const t=e[0],n=e[1];let r=e[2];const o=i.rgb.hsl(e)[0],l=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[o,l*100,r*100]};i.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(1-t,1-n,1-r),l=(1-t-o)/(1-o)||0,s=(1-n-o)/(1-o)||0,a=(1-r-o)/(1-o)||0;return[l*100,s*100,a*100,o*100]};function I(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}i.rgb.keyword=function(e){const t=q[e];if(t)return t;let n=Number.POSITIVE_INFINITY,r;for(const o of Object.keys(M)){const l=M[o],s=I(e,l);s<n&&(n=s,r=o)}return r};i.keyword.rgb=function(e){return M[e]};i.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const o=t*.4124564+n*.3575761+r*.1804375,l=t*.2126729+n*.7151522+r*.072175,s=t*.0193339+n*.119192+r*.9503041;return[o*100,l*100,s*100]};i.rgb.lab=function(e){const t=i.rgb.xyz(e);let n=t[0],r=t[1],o=t[2];n/=95.047,r/=100,o/=108.883,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116,o=o>y?o**(1/3):7.787*o+16/116;const l=116*r-16,s=500*(n-r),a=200*(r-o);return[l,s,a]};i.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;let o,l;if(n===0)return l=r*255,[l,l,l];const s=r<.5?r*(1+n):r+n-r*n,a=2*r-s,c=[0,0,0];for(let u=0;u<3;u++)o=t+1/3*-(u-1),o<0&&o++,o>1&&o--,6*o<1?l=a+(s-a)*6*o:2*o<1?l=s:3*o<2?l=a+(s-a)*(2/3-o)*6:l=a,c[u]=l*255;return c};i.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,r=e[2]/100,o=n;const l=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,o*=l<=1?l:2-l;const s=(r+n)/2,a=r===0?2*o/(l+o):2*n/(r+n);return[t,a*100,s*100]};i.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let r=e[2]/100;const o=Math.floor(t)%6,l=t-Math.floor(t),s=255*r*(1-n),a=255*r*(1-n*l),c=255*r*(1-n*(1-l));switch(r*=255,o){case 0:return[r,c,s];case 1:return[a,r,s];case 2:return[s,r,c];case 3:return[s,a,r];case 4:return[c,s,r];case 5:return[r,s,a]}};i.hsv.hsl=function(e){const t=e[0],n=e[1]/100,r=e[2]/100,o=Math.max(r,.01);let l,s;s=(2-n)*r;const a=(2-n)*o;return l=n*o,l/=a<=1?a:2-a,l=l||0,s/=2,[t,l*100,s*100]};i.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,r=e[2]/100;const o=n+r;let l;o>1&&(n/=o,r/=o);const s=Math.floor(6*t),a=1-r;l=6*t-s,s&1&&(l=1-l);const c=n+l*(a-n);let u,m,p;switch(s){default:case 6:case 0:{u=a,m=c,p=n;break}case 1:{u=c,m=a,p=n;break}case 2:{u=n,m=a,p=c;break}case 3:{u=n,m=c,p=a;break}case 4:{u=c,m=n,p=a;break}case 5:{u=a,m=n,p=c;break}}return[u*255,m*255,p*255]};i.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100,l=1-Math.min(1,t*(1-o)+o),s=1-Math.min(1,n*(1-o)+o),a=1-Math.min(1,r*(1-o)+o);return[l*255,s*255,a*255]};i.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100;let o,l,s;return o=t*3.2404542+n*-1.5371385+r*-.4985314,l=t*-.969266+n*1.8760108+r*.041556,s=t*.0556434+n*-.2040259+r*1.0572252,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=Math.min(Math.max(0,o),1),l=Math.min(Math.max(0,l),1),s=Math.min(Math.max(0,s),1),[o*255,l*255,s*255]};i.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>y?t**(1/3):7.787*t+16/116,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116;const o=116*n-16,l=500*(t-n),s=200*(n-r);return[o,l,s]};i.lab.xyz=function(e){const t=e[0],n=e[1],r=e[2];let o,l,s;l=(t+16)/116,o=n/500+l,s=l-r/200;const a=l**3,c=o**3,u=s**3;return l=a>y?a:(l-16/116)/7.787,o=c>y?c:(o-16/116)/7.787,s=u>y?u:(s-16/116)/7.787,o*=95.047,l*=100,s*=108.883,[o,l,s]};i.lab.lch=function(e){const t=e[0],n=e[1],r=e[2];let o;o=Math.atan2(r,n)*360/2/Math.PI,o<0&&(o+=360);const s=Math.sqrt(n*n+r*r);return[t,s,o]};i.lch.lab=function(e){const t=e[0],n=e[1],o=e[2]/360*2*Math.PI,l=n*Math.cos(o),s=n*Math.sin(o);return[t,l,s]};i.rgb.ansi16=function(e,t=null){const[n,r,o]=e;let l=t===null?i.rgb.hsv(e)[2]:t;if(l=Math.round(l/50),l===0)return 30;let s=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return l===2&&(s+=60),s};i.hsv.ansi16=function(e){return i.rgb.ansi16(i.hsv.rgb(e),e[2])};i.rgb.ansi256=function(e){const t=e[0],n=e[1],r=e[2];return t>>4===n>>4&&n>>4===r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)};i.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=(Math.trunc(e>50)+1)*.5,r=(t&1)*n*255,o=(t>>1&1)*n*255,l=(t>>2&1)*n*255;return[r,o,l]};i.ansi256.rgb=function(e){if(e=e[0],e>=232){const l=(e-232)*10+8;return[l,l,l]}e-=16;let t;const n=Math.floor(e/36)/5*255,r=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[n,r,o]};i.rgb.hex=function(e){const n=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(n.length)+n};i.hex.rgb=function(e){const t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(a=>a+a).join(""));const r=Number.parseInt(n,16),o=r>>16&255,l=r>>8&255,s=r&255;return[o,l,s]};i.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.max(Math.max(t,n),r),l=Math.min(Math.min(t,n),r),s=o-l;let a;const c=s<1?l/(1-s):0;return s<=0?a=0:o===t?a=(n-r)/s%6:o===n?a=2+(r-t)/s:a=4+(t-n)/s,a/=6,a%=1,[a*360,s*100,c*100]};i.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n);let o=0;return r<1&&(o=(n-.5*r)/(1-r)),[e[0],r*100,o*100]};i.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=t*n;let o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],r*100,o*100]};i.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];const o=[0,0,0],l=t%1*6,s=l%1,a=1-s;let c=0;switch(Math.floor(l)){case 0:{o[0]=1,o[1]=s,o[2]=0;break}case 1:{o[0]=a,o[1]=1,o[2]=0;break}case 2:{o[0]=0,o[1]=1,o[2]=s;break}case 3:{o[0]=0,o[1]=a,o[2]=1;break}case 4:{o[0]=s,o[1]=0,o[2]=1;break}default:o[0]=1,o[1]=0,o[2]=a}return c=(1-n)*r,[(n*o[0]+c)*255,(n*o[1]+c)*255,(n*o[2]+c)*255]};i.hcg.hsv=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);let o=0;return r>0&&(o=t/r),[e[0],o*100,r*100]};i.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let o=0;return r>0&&r<.5?o=t/(2*r):r>=.5&&r<1&&(o=t/(2*(1-r))),[e[0],o*100,r*100]};i.hcg.hwb=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};i.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,o=r-t;let l=0;return o<1&&(l=(r-o)/(1-o)),[e[0],o*100,l*100]};i.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};i.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};i.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};i.gray.hsl=function(e){return[0,0,e[0]]};i.gray.hsv=i.gray.hsl;i.gray.hwb=function(e){return[0,100,e[0]]};i.gray.cmyk=function(e){return[0,0,0,e[0]]};i.gray.lab=function(e){return[e[0],0,0]};i.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(r.length)+r};i.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function j(){const e={},t=Object.keys(i);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function E(e){const t=j(),n=[e];for(t[e].distance=0;n.length>0;){const r=n.pop(),o=Object.keys(i[r]);for(let{length:l}=o,s=0;s<l;s++){const a=o[s],c=t[a];c.distance===-1&&(c.distance=t[r].distance+1,c.parent=r,n.unshift(a))}}return t}function P(e,t){return function(n){return t(e(n))}}function $(e,t){const n=[t[e].parent,e];let r=i[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)n.unshift(t[o].parent),r=P(i[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}function U(e){const t=E(e),n={},r=Object.keys(t);for(let{length:o}=r,l=0;l<o;l++){const s=r[l];t[s].parent!==null&&(n[s]=$(s,t))}return n}const g={},T=Object.keys(i);function D(e){const t=function(...n){const r=n[0];return r==null?r:(r.length>1&&(n=r),e(n))};return"conversion"in e&&(t.conversion=e.conversion),t}function K(e){const t=function(...n){const r=n[0];if(r==null)return r;r.length>1&&(n=r);const o=e(n);if(typeof o=="object")for(let{length:l}=o,s=0;s<l;s++)o[s]=Math.round(o[s]);return o};return"conversion"in e&&(t.conversion=e.conversion),t}for(const e of T){g[e]={},Object.defineProperty(g[e],"channels",{value:i[e].channels}),Object.defineProperty(g[e],"labels",{value:i[e].labels});const t=U(e),n=Object.keys(t);for(const r of n){const o=t[r];g[e][r]=K(o),g[e][r].raw=D(o)}}const z=["keyword","gray","hex"],_={};for(const e of Object.keys(g))_[[...g[e].labels].sort().join("")]=e;const v={};function b(e,t){if(!(this instanceof b))return new b(e,t);if(t&&t in z&&(t=null),t&&!(t in g))throw new Error("Unknown model: "+t);let n,r;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof b)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const o=d.get(e);if(o===null)throw new Error("Unable to parse color from string: "+e);this.model=o.model,r=g[this.model].channels,this.color=o.value.slice(0,r),this.valpha=typeof o.value[r]=="number"?o.value[r]:1}else if(e.length>0){this.model=t||"rgb",r=g[this.model].channels;const o=Array.prototype.slice.call(e,0,r);this.color=N(o,r),this.valpha=typeof e[r]=="number"?e[r]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const o=Object.keys(e);"alpha"in e&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const l=o.sort().join("");if(!(l in _))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=_[l];const{labels:s}=g[this.model],a=[];for(n=0;n<s.length;n++)a.push(e[s[n]]);this.color=N(a)}if(v[this.model])for(r=g[this.model].channels,n=0;n<r;n++){const o=v[this.model][n];o&&(this.color[n]=o(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}b.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in d.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);const n=t.valpha===1?t.color:[...t.color,this.valpha];return d.to[t.model](...n)},percentString(e){const t=this.rgb().round(typeof e=="number"?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return d.to.rgb.percent(...n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=g[this.model],{labels:n}=g[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new b([...this.color.map(R(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new b([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:h("rgb",0,f(255)),green:h("rgb",1,f(255)),blue:h("rgb",2,f(255)),hue:h(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:h("hsl",1,f(100)),lightness:h("hsl",2,f(100)),saturationv:h("hsv",1,f(100)),value:h("hsv",2,f(100)),chroma:h("hcg",1,f(100)),gray:h("hcg",2,f(100)),white:h("hwb",1,f(100)),wblack:h("hwb",2,f(100)),cyan:h("cmyk",0,f(100)),magenta:h("cmyk",1,f(100)),yellow:h("cmyk",2,f(100)),black:h("cmyk",3,f(100)),x:h("xyz",0,f(95.047)),y:h("xyz",1,f(100)),z:h("xyz",2,f(108.833)),l:h("lab",0,f(100)),a:h("lab",1),b:h("lab",2),keyword(e){return e!==void 0?new b(e):g[this.model].keyword(this.color)},hex(e){return e!==void 0?new b(e):d.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new b(e);const t=this.rgb().round().color;let n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n="0"+n),d.to.hex(...t)+n},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,t=[];for(const[n,r]of e.entries()){const o=r/255;t[n]=o<=.04045?o/12.92:((o+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return b.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const n=e.rgb(),r=this.rgb(),o=t===void 0?.5:t,l=2*o-1,s=n.alpha()-r.alpha(),a=((l*s===-1?l:(l+s)/(1+l*s))+1)/2,c=1-a;return b.rgb(a*n.red()+c*r.red(),a*n.green()+c*r.green(),a*n.blue()+c*r.blue(),n.alpha()*o+r.alpha()*(1-o))}};for(const e of Object.keys(g)){if(z.includes(e))continue;const{channels:t}=g[e];b.prototype[e]=function(...n){return this.model===e?new b(this):n.length>0?new b(n,e):new b([...B(g[this.model][e].raw(this.color)),this.valpha],e)},b[e]=function(...n){let r=n[0];return typeof r=="number"&&(r=N(n,t)),new b(r,e)}}function L(e,t){return Number(e.toFixed(t))}function R(e){return function(t){return L(t,e)}}function h(e,t,n){e=Array.isArray(e)?e:[e];for(const r of e)(v[r]||(v[r]=[]))[t]=n;return e=e[0],function(r){let o;return r!==void 0?(n&&(r=n(r)),o=this[e](),o.color[t]=r,o):(o=this[e]().color[t],n&&(o=n(o)),o)}}function f(e){return function(t){return Math.max(0,Math.min(e,t))}}function B(e){return Array.isArray(e)?e:[e]}function N(e,t){for(let n=0;n<t;n++)typeof e[n]!="number"&&(e[n]=0);return e}class J{constructor(t){F(this,"isColor",!0);F(this,"currentColor");return this.currentColor=b(t),new Proxy(this,{get(n,r){return r in n?n[r]:r in n.currentColor?n._handleColorMethod(r):n[r]}})}_handleColorMethod(t){const n=this.currentColor;return typeof n[t]!="function"?n[t]:(...r)=>(this.currentColor=n[t](...r),this)}toString(){return this.currentColor.toString()}}const G=e=>new J(e);exports.color=G;
1
+ "use strict";var A=Object.defineProperty;var S=(e,t,n)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _=(e,t,n)=>S(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},O=Object.create(null);for(const e in k)Object.hasOwn(k,e)&&(O[k[e]]=e);const d={to:{},get:{}};d.get=function(e){const t=e.slice(0,3).toLowerCase();let n,r;switch(t){case"hsl":{n=d.get.hsl(e),r="hsl";break}case"hwb":{n=d.get.hwb(e),r="hwb";break}default:{n=d.get.rgb(e),r="rgb";break}}return n?{model:r,value:n}:null};d.get.rgb=function(e){if(!e)return null;const t=/^#([a-f\d]{3,4})$/i,n=/^#([a-f\d]{6})([a-f\d]{2})?$/i,r=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,o=/^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/,l=/^(\w+)$/;let s=[0,0,0,1],a,i,u;if(a=e.match(n)){for(u=a[2],a=a[1],i=0;i<3;i++){const m=i*2;s[i]=Number.parseInt(a.slice(m,m+2),16)}u&&(s[3]=Number.parseInt(u,16)/255)}else if(a=e.match(t)){for(a=a[1],u=a[3],i=0;i<3;i++)s[i]=Number.parseInt(a[i]+a[i],16);u&&(s[3]=Number.parseInt(u+u,16)/255)}else if(a=e.match(r)){for(i=0;i<3;i++)s[i]=Number.parseInt(a[i+1],10);a[4]&&(s[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else if(a=e.match(o)){for(i=0;i<3;i++)s[i]=Math.round(Number.parseFloat(a[i+1])*2.55);a[4]&&(s[3]=a[5]?Number.parseFloat(a[4])*.01:Number.parseFloat(a[4]))}else return(a=e.match(l))?a[1]==="transparent"?[0,0,0,0]:Object.hasOwn(k,a[1])?(s=k[a[1]],s[3]=1,s):null:null;for(i=0;i<3;i++)s[i]=w(s[i],0,255);return s[3]=w(s[3],0,1),s};d.get.hsl=function(e){if(!e)return null;const t=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,n=e.match(t);if(n){const r=Number.parseFloat(n[4]),o=(Number.parseFloat(n[1])%360+360)%360,l=w(Number.parseFloat(n[2]),0,100),s=w(Number.parseFloat(n[3]),0,100),a=w(Number.isNaN(r)?1:r,0,1);return[o,l,s,a]}return null};d.get.hwb=function(e){if(!e)return null;const t=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,n=e.match(t);if(n){const r=Number.parseFloat(n[4]),o=(Number.parseFloat(n[1])%360+360)%360,l=w(Number.parseFloat(n[2]),0,100),s=w(Number.parseFloat(n[3]),0,100),a=w(Number.isNaN(r)?1:r,0,1);return[o,l,s,a]}return null};d.to.hex=function(...e){return"#"+x(e[0])+x(e[1])+x(e[2])+(e[3]<1?x(Math.round(e[3]*255)):"")};d.to.rgb=function(...e){return e.length<4||e[3]===1?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"};d.to.rgb.percent=function(...e){const t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?"rgb("+t+"%, "+n+"%, "+r+"%)":"rgba("+t+"%, "+n+"%, "+r+"%, "+e[3]+")"};d.to.hsl=function(...e){return e.length<4||e[3]===1?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"};d.to.hwb=function(...e){let t="";return e.length>=4&&e[3]!==1&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"};d.to.keyword=function(...e){return O[e.slice(0,3)]};function w(e,t,n){return Math.min(Math.max(t,e),n)}function x(e){const t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}const M={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},q={};for(const e of Object.keys(M))q[M[e]]=e;const c={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},y=(6/29)**3;for(const e of Object.keys(c)){if(!("channels"in c[e]))throw new Error("missing channels property: "+e);if(!("labels"in c[e]))throw new Error("missing channel labels property: "+e);if(c[e].labels.length!==c[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:n}=c[e];delete c[e].channels,delete c[e].labels,Object.defineProperty(c[e],"channels",{value:t}),Object.defineProperty(c[e],"labels",{value:n})}c.rgb.hsl=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(t,n,r),l=Math.max(t,n,r),s=l-o;let a,i;switch(l){case o:{a=0;break}case t:{a=(n-r)/s;break}case n:{a=2+(r-t)/s;break}case r:{a=4+(t-n)/s;break}}a=Math.min(a*60,360),a<0&&(a+=360);const u=(o+l)/2;return l===o?i=0:u<=.5?i=s/(l+o):i=s/(2-l-o),[a,i*100,u*100]};c.rgb.hsv=function(e){let t,n,r,o,l;const s=e[0]/255,a=e[1]/255,i=e[2]/255,u=Math.max(s,a,i),m=u-Math.min(s,a,i),p=function(C){return(u-C)/6/m+1/2};if(m===0)o=0,l=0;else{switch(l=m/u,t=p(s),n=p(a),r=p(i),u){case s:{o=r-n;break}case a:{o=1/3+t-r;break}case i:{o=2/3+n-t;break}}o<0?o+=1:o>1&&(o-=1)}return[o*360,l*100,u*100]};c.rgb.hwb=function(e){const t=e[0],n=e[1];let r=e[2];const o=c.rgb.hsl(e)[0],l=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[o,l*100,r*100]};c.rgb.cmyk=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.min(1-t,1-n,1-r),l=(1-t-o)/(1-o)||0,s=(1-n-o)/(1-o)||0,a=(1-r-o)/(1-o)||0;return[l*100,s*100,a*100,o*100]};function I(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}c.rgb.keyword=function(e){const t=q[e];if(t)return t;let n=Number.POSITIVE_INFINITY,r;for(const o of Object.keys(M)){const l=M[o],s=I(e,l);s<n&&(n=s,r=o)}return r};c.keyword.rgb=function(e){return M[e]};c.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;const o=t*.4124564+n*.3575761+r*.1804375,l=t*.2126729+n*.7151522+r*.072175,s=t*.0193339+n*.119192+r*.9503041;return[o*100,l*100,s*100]};c.rgb.lab=function(e){const t=c.rgb.xyz(e);let n=t[0],r=t[1],o=t[2];n/=95.047,r/=100,o/=108.883,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116,o=o>y?o**(1/3):7.787*o+16/116;const l=116*r-16,s=500*(n-r),a=200*(r-o);return[l,s,a]};c.hsl.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;let o,l;if(n===0)return l=r*255,[l,l,l];const s=r<.5?r*(1+n):r+n-r*n,a=2*r-s,i=[0,0,0];for(let u=0;u<3;u++)o=t+1/3*-(u-1),o<0&&o++,o>1&&o--,6*o<1?l=a+(s-a)*6*o:2*o<1?l=s:3*o<2?l=a+(s-a)*(2/3-o)*6:l=a,i[u]=l*255;return i};c.hsl.hsv=function(e){const t=e[0];let n=e[1]/100,r=e[2]/100,o=n;const l=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,o*=l<=1?l:2-l;const s=(r+n)/2,a=r===0?2*o/(l+o):2*n/(r+n);return[t,a*100,s*100]};c.hsv.rgb=function(e){const t=e[0]/60,n=e[1]/100;let r=e[2]/100;const o=Math.floor(t)%6,l=t-Math.floor(t),s=255*r*(1-n),a=255*r*(1-n*l),i=255*r*(1-n*(1-l));switch(r*=255,o){case 0:return[r,i,s];case 1:return[a,r,s];case 2:return[s,r,i];case 3:return[s,a,r];case 4:return[i,s,r];case 5:return[r,s,a]}};c.hsv.hsl=function(e){const t=e[0],n=e[1]/100,r=e[2]/100,o=Math.max(r,.01);let l,s;s=(2-n)*r;const a=(2-n)*o;return l=n*o,l/=a<=1?a:2-a,l=l||0,s/=2,[t,l*100,s*100]};c.hwb.rgb=function(e){const t=e[0]/360;let n=e[1]/100,r=e[2]/100;const o=n+r;let l;o>1&&(n/=o,r/=o);const s=Math.floor(6*t),a=1-r;l=6*t-s,s&1&&(l=1-l);const i=n+l*(a-n);let u,m,p;switch(s){default:case 6:case 0:{u=a,m=i,p=n;break}case 1:{u=i,m=a,p=n;break}case 2:{u=n,m=a,p=i;break}case 3:{u=n,m=i,p=a;break}case 4:{u=i,m=n,p=a;break}case 5:{u=a,m=n,p=i;break}}return[u*255,m*255,p*255]};c.cmyk.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100,o=e[3]/100,l=1-Math.min(1,t*(1-o)+o),s=1-Math.min(1,n*(1-o)+o),a=1-Math.min(1,r*(1-o)+o);return[l*255,s*255,a*255]};c.xyz.rgb=function(e){const t=e[0]/100,n=e[1]/100,r=e[2]/100;let o,l,s;return o=t*3.2404542+n*-1.5371385+r*-.4985314,l=t*-.969266+n*1.8760108+r*.041556,s=t*.0556434+n*-.2040259+r*1.0572252,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,l=l>.0031308?1.055*l**(1/2.4)-.055:l*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=Math.min(Math.max(0,o),1),l=Math.min(Math.max(0,l),1),s=Math.min(Math.max(0,s),1),[o*255,l*255,s*255]};c.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];t/=95.047,n/=100,r/=108.883,t=t>y?t**(1/3):7.787*t+16/116,n=n>y?n**(1/3):7.787*n+16/116,r=r>y?r**(1/3):7.787*r+16/116;const o=116*n-16,l=500*(t-n),s=200*(n-r);return[o,l,s]};c.lab.xyz=function(e){const t=e[0],n=e[1],r=e[2];let o,l,s;l=(t+16)/116,o=n/500+l,s=l-r/200;const a=l**3,i=o**3,u=s**3;return l=a>y?a:(l-16/116)/7.787,o=i>y?i:(o-16/116)/7.787,s=u>y?u:(s-16/116)/7.787,o*=95.047,l*=100,s*=108.883,[o,l,s]};c.lab.lch=function(e){const t=e[0],n=e[1],r=e[2];let o;o=Math.atan2(r,n)*360/2/Math.PI,o<0&&(o+=360);const s=Math.sqrt(n*n+r*r);return[t,s,o]};c.lch.lab=function(e){const t=e[0],n=e[1],o=e[2]/360*2*Math.PI,l=n*Math.cos(o),s=n*Math.sin(o);return[t,l,s]};c.rgb.ansi16=function(e,t=null){const[n,r,o]=e;let l=t===null?c.rgb.hsv(e)[2]:t;if(l=Math.round(l/50),l===0)return 30;let s=30+(Math.round(o/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return l===2&&(s+=60),s};c.hsv.ansi16=function(e){return c.rgb.ansi16(c.hsv.rgb(e),e[2])};c.rgb.ansi256=function(e){const t=e[0],n=e[1],r=e[2];return t>>4===n>>4&&n>>4===r>>4?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)};c.ansi16.rgb=function(e){e=e[0];let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const n=(Math.trunc(e>50)+1)*.5,r=(t&1)*n*255,o=(t>>1&1)*n*255,l=(t>>2&1)*n*255;return[r,o,l]};c.ansi256.rgb=function(e){if(e=e[0],e>=232){const l=(e-232)*10+8;return[l,l,l]}e-=16;let t;const n=Math.floor(e/36)/5*255,r=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[n,r,o]};c.rgb.hex=function(e){const n=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".slice(n.length)+n};c.hex.rgb=function(e){const t=e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=[...n].map(a=>a+a).join(""));const r=Number.parseInt(n,16),o=r>>16&255,l=r>>8&255,s=r&255;return[o,l,s]};c.rgb.hcg=function(e){const t=e[0]/255,n=e[1]/255,r=e[2]/255,o=Math.max(Math.max(t,n),r),l=Math.min(Math.min(t,n),r),s=o-l;let a;const i=s<1?l/(1-s):0;return s<=0?a=0:o===t?a=(n-r)/s%6:o===n?a=2+(r-t)/s:a=4+(t-n)/s,a/=6,a%=1,[a*360,s*100,i*100]};c.hsl.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n);let o=0;return r<1&&(o=(n-.5*r)/(1-r)),[e[0],r*100,o*100]};c.hsv.hcg=function(e){const t=e[1]/100,n=e[2]/100,r=t*n;let o=0;return r<1&&(o=(n-r)/(1-r)),[e[0],r*100,o*100]};c.hcg.rgb=function(e){const t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];const o=[0,0,0],l=t%1*6,s=l%1,a=1-s;let i=0;switch(Math.floor(l)){case 0:{o[0]=1,o[1]=s,o[2]=0;break}case 1:{o[0]=a,o[1]=1,o[2]=0;break}case 2:{o[0]=0,o[1]=1,o[2]=s;break}case 3:{o[0]=0,o[1]=a,o[2]=1;break}case 4:{o[0]=s,o[1]=0,o[2]=1;break}default:o[0]=1,o[1]=0,o[2]=a}return i=(1-n)*r,[(n*o[0]+i)*255,(n*o[1]+i)*255,(n*o[2]+i)*255]};c.hcg.hsv=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);let o=0;return r>0&&(o=t/r),[e[0],o*100,r*100]};c.hcg.hsl=function(e){const t=e[1]/100,r=e[2]/100*(1-t)+.5*t;let o=0;return r>0&&r<.5?o=t/(2*r):r>=.5&&r<1&&(o=t/(2*(1-r))),[e[0],o*100,r*100]};c.hcg.hwb=function(e){const t=e[1]/100,n=e[2]/100,r=t+n*(1-t);return[e[0],(r-t)*100,(1-r)*100]};c.hwb.hcg=function(e){const t=e[1]/100,r=1-e[2]/100,o=r-t;let l=0;return o<1&&(l=(r-o)/(1-o)),[e[0],o*100,l*100]};c.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};c.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};c.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};c.gray.hsl=function(e){return[0,0,e[0]]};c.gray.hsv=c.gray.hsl;c.gray.hwb=function(e){return[0,100,e[0]]};c.gray.cmyk=function(e){return[0,0,0,e[0]]};c.gray.lab=function(e){return[e[0],0,0]};c.gray.hex=function(e){const t=Math.round(e[0]/100*255)&255,r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".slice(r.length)+r};c.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function P(){const e={},t=Object.keys(c);for(let{length:n}=t,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function j(e){const t=P(),n=[e];for(t[e].distance=0;n.length>0;){const r=n.pop(),o=Object.keys(c[r]);for(let{length:l}=o,s=0;s<l;s++){const a=o[s],i=t[a];i.distance===-1&&(i.distance=t[r].distance+1,i.parent=r,n.unshift(a))}}return t}function E(e,t){return function(n){return t(e(n))}}function T(e,t){const n=[t[e].parent,e];let r=c[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)n.unshift(t[o].parent),r=E(c[t[o].parent][o],r),o=t[o].parent;return r.conversion=n,r}function $(e){const t=j(e),n={},r=Object.keys(t);for(let{length:o}=r,l=0;l<o;l++){const s=r[l];t[s].parent!==null&&(n[s]=T(s,t))}return n}const g={},U=Object.keys(c);function D(e){const t=function(...n){const r=n[0];return r==null?r:(r.length>1&&(n=r),e(n))};return"conversion"in e&&(t.conversion=e.conversion),t}function K(e){const t=function(...n){const r=n[0];if(r==null)return r;r.length>1&&(n=r);const o=e(n);if(typeof o=="object")for(let{length:l}=o,s=0;s<l;s++)o[s]=Math.round(o[s]);return o};return"conversion"in e&&(t.conversion=e.conversion),t}for(const e of U){g[e]={},Object.defineProperty(g[e],"channels",{value:c[e].channels}),Object.defineProperty(g[e],"labels",{value:c[e].labels});const t=$(e),n=Object.keys(t);for(const r of n){const o=t[r];g[e][r]=K(o),g[e][r].raw=D(o)}}const z=["keyword","gray","hex"],F={};for(const e of Object.keys(g))F[[...g[e].labels].sort().join("")]=e;const v={};function b(e,t){if(!(this instanceof b))return new b(e,t);if(t&&t in z&&(t=null),t&&!(t in g))throw new Error("Unknown model: "+t);let n,r;if(e==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof b)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e=="string"){const o=d.get(e);if(o===null)throw new Error("Unable to parse color from string: "+e);this.model=o.model,r=g[this.model].channels,this.color=o.value.slice(0,r),this.valpha=typeof o.value[r]=="number"?o.value[r]:1}else if(e.length>0){this.model=t||"rgb",r=g[this.model].channels;const o=Array.prototype.slice.call(e,0,r);this.color=N(o,r),this.valpha=typeof e[r]=="number"?e[r]:1}else if(typeof e=="number")this.model="rgb",this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;const o=Object.keys(e);"alpha"in e&&(o.splice(o.indexOf("alpha"),1),this.valpha=typeof e.alpha=="number"?e.alpha:0);const l=o.sort().join("");if(!(l in F))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=F[l];const{labels:s}=g[this.model],a=[];for(n=0;n<s.length;n++)a.push(e[s[n]]);this.color=N(a)}if(v[this.model])for(r=g[this.model].channels,n=0;n<r;n++){const o=v[this.model][n];o&&(this.color[n]=o(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}b.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in d.to?this:this.rgb();t=t.round(typeof e=="number"?e:1);const n=t.valpha===1?t.color:[...t.color,this.valpha];return d.to[t.model](...n)},percentString(e){const t=this.rgb().round(typeof e=="number"?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return d.to.rgb.percent(...n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){const e={},{channels:t}=g[this.model],{labels:n}=g[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){const e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){const e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new b([...this.color.map(L(e)),this.valpha],this.model)},alpha(e){return e!==void 0?new b([...this.color,Math.max(0,Math.min(1,e))],this.model):this.valpha},red:h("rgb",0,f(255)),green:h("rgb",1,f(255)),blue:h("rgb",2,f(255)),hue:h(["hsl","hsv","hsl","hwb","hcg"],0,e=>(e%360+360)%360),saturationl:h("hsl",1,f(100)),lightness:h("hsl",2,f(100)),saturationv:h("hsv",1,f(100)),value:h("hsv",2,f(100)),chroma:h("hcg",1,f(100)),gray:h("hcg",2,f(100)),white:h("hwb",1,f(100)),wblack:h("hwb",2,f(100)),cyan:h("cmyk",0,f(100)),magenta:h("cmyk",1,f(100)),yellow:h("cmyk",2,f(100)),black:h("cmyk",3,f(100)),x:h("xyz",0,f(95.047)),y:h("xyz",1,f(100)),z:h("xyz",2,f(108.833)),l:h("lab",0,f(100)),a:h("lab",1),b:h("lab",2),keyword(e){return e!==void 0?new b(e):g[this.model].keyword(this.color)},hex(e){return e!==void 0?new b(e):d.to.hex(...this.rgb().round().color)},hexa(e){if(e!==void 0)return new b(e);const t=this.rgb().round().color;let n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n="0"+n),d.to.hex(...t)+n},rgbNumber(){const e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){const e=this.rgb().color,t=[];for(const[n,r]of e.entries()){const o=r/255;t[n]=o<=.04045?o/12.92:((o+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return b.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const n=e.rgb(),r=this.rgb(),o=t===void 0?.5:t,l=2*o-1,s=n.alpha()-r.alpha(),a=((l*s===-1?l:(l+s)/(1+l*s))+1)/2,i=1-a;return b.rgb(a*n.red()+i*r.red(),a*n.green()+i*r.green(),a*n.blue()+i*r.blue(),n.alpha()*o+r.alpha()*(1-o))}};for(const e of Object.keys(g)){if(z.includes(e))continue;const{channels:t}=g[e];b.prototype[e]=function(...n){return this.model===e?new b(this):n.length>0?new b(n,e):new b([...R(g[this.model][e].raw(this.color)),this.valpha],e)},b[e]=function(...n){let r=n[0];return typeof r=="number"&&(r=N(n,t)),new b(r,e)}}function B(e,t){return Number(e.toFixed(t))}function L(e){return function(t){return B(t,e)}}function h(e,t,n){e=Array.isArray(e)?e:[e];for(const r of e)(v[r]||(v[r]=[]))[t]=n;return e=e[0],function(r){let o;return r!==void 0?(n&&(r=n(r)),o=this[e](),o.color[t]=r,o):(o=this[e]().color[t],n&&(o=n(o)),o)}}function f(e){return function(t){return Math.max(0,Math.min(e,t))}}function R(e){return Array.isArray(e)?e:[e]}function N(e,t){for(let n=0;n<t;n++)typeof e[n]!="number"&&(e[n]=0);return e}class J{constructor(t){_(this,"isColor",!0);_(this,"currentColor");this.base=t;const n=this._resolveBaseColor(t);return this.currentColor=b(n),this._createProxy()}_createProxy(){return new Proxy(this,{get(t,n){return n in t?t[n]:n in t.currentColor?t._handleColorMethod(n):t[n]}})}_resolveBaseColor(t){if(typeof t!="string"||!/\{[^{}]+\}/g.test(t))return t;throw new Error("Token values are not yet supported, use a color string instead")}_handleColorMethod(t){const n=this.currentColor;return typeof n[t]!="function"?n[t]:(...r)=>(this.currentColor=n[t](...r),this._createProxy())}toString(){return this.currentColor.toString()}}const V=e=>new J(e);exports.color=V;
package/helpers.js CHANGED
@@ -1,6 +1,6 @@
1
- var C = Object.defineProperty;
2
- var S = (e, t, n) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var F = (e, t, n) => S(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var A = Object.defineProperty;
2
+ var S = (e, t, n) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var _ = (e, t, n) => S(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  const k = {
5
5
  aliceblue: [240, 248, 255],
6
6
  antiquewhite: [250, 235, 215],
@@ -180,28 +180,28 @@ d.get.rgb = function(e) {
180
180
  if (!e)
181
181
  return null;
182
182
  const t = /^#([a-f\d]{3,4})$/i, n = /^#([a-f\d]{6})([a-f\d]{2})?$/i, r = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/, o = /^rgba?\(\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*,?\s*([+-]?[\d.]+)%\s*(?:[,|/]\s*([+-]?[\d.]+)(%?)\s*)?\)$/, l = /^(\w+)$/;
183
- let s = [0, 0, 0, 1], a, c, u;
183
+ let s = [0, 0, 0, 1], a, i, u;
184
184
  if (a = e.match(n)) {
185
- for (u = a[2], a = a[1], c = 0; c < 3; c++) {
186
- const m = c * 2;
187
- s[c] = Number.parseInt(a.slice(m, m + 2), 16);
185
+ for (u = a[2], a = a[1], i = 0; i < 3; i++) {
186
+ const m = i * 2;
187
+ s[i] = Number.parseInt(a.slice(m, m + 2), 16);
188
188
  }
189
189
  u && (s[3] = Number.parseInt(u, 16) / 255);
190
190
  } else if (a = e.match(t)) {
191
- for (a = a[1], u = a[3], c = 0; c < 3; c++)
192
- s[c] = Number.parseInt(a[c] + a[c], 16);
191
+ for (a = a[1], u = a[3], i = 0; i < 3; i++)
192
+ s[i] = Number.parseInt(a[i] + a[i], 16);
193
193
  u && (s[3] = Number.parseInt(u + u, 16) / 255);
194
194
  } else if (a = e.match(r)) {
195
- for (c = 0; c < 3; c++)
196
- s[c] = Number.parseInt(a[c + 1], 10);
195
+ for (i = 0; i < 3; i++)
196
+ s[i] = Number.parseInt(a[i + 1], 10);
197
197
  a[4] && (s[3] = a[5] ? Number.parseFloat(a[4]) * 0.01 : Number.parseFloat(a[4]));
198
198
  } else if (a = e.match(o)) {
199
- for (c = 0; c < 3; c++)
200
- s[c] = Math.round(Number.parseFloat(a[c + 1]) * 2.55);
199
+ for (i = 0; i < 3; i++)
200
+ s[i] = Math.round(Number.parseFloat(a[i + 1]) * 2.55);
201
201
  a[4] && (s[3] = a[5] ? Number.parseFloat(a[4]) * 0.01 : Number.parseFloat(a[4]));
202
202
  } else return (a = e.match(l)) ? a[1] === "transparent" ? [0, 0, 0, 0] : Object.hasOwn(k, a[1]) ? (s = k[a[1]], s[3] = 1, s) : null : null;
203
- for (c = 0; c < 3; c++)
204
- s[c] = w(s[c], 0, 255);
203
+ for (i = 0; i < 3; i++)
204
+ s[i] = w(s[i], 0, 255);
205
205
  return s[3] = w(s[3], 0, 1), s;
206
206
  };
207
207
  d.get.hsl = function(e) {
@@ -403,7 +403,7 @@ const M = {
403
403
  }, q = {};
404
404
  for (const e of Object.keys(M))
405
405
  q[M[e]] = e;
406
- const i = {
406
+ const c = {
407
407
  rgb: { channels: 3, labels: "rgb" },
408
408
  hsl: { channels: 3, labels: "hsl" },
409
409
  hsv: { channels: 3, labels: "hsv" },
@@ -420,19 +420,19 @@ const i = {
420
420
  apple: { channels: 3, labels: ["r16", "g16", "b16"] },
421
421
  gray: { channels: 1, labels: ["gray"] }
422
422
  }, y = (6 / 29) ** 3;
423
- for (const e of Object.keys(i)) {
424
- if (!("channels" in i[e]))
423
+ for (const e of Object.keys(c)) {
424
+ if (!("channels" in c[e]))
425
425
  throw new Error("missing channels property: " + e);
426
- if (!("labels" in i[e]))
426
+ if (!("labels" in c[e]))
427
427
  throw new Error("missing channel labels property: " + e);
428
- if (i[e].labels.length !== i[e].channels)
428
+ if (c[e].labels.length !== c[e].channels)
429
429
  throw new Error("channel and label counts mismatch: " + e);
430
- const { channels: t, labels: n } = i[e];
431
- delete i[e].channels, delete i[e].labels, Object.defineProperty(i[e], "channels", { value: t }), Object.defineProperty(i[e], "labels", { value: n });
430
+ const { channels: t, labels: n } = c[e];
431
+ delete c[e].channels, delete c[e].labels, Object.defineProperty(c[e], "channels", { value: t }), Object.defineProperty(c[e], "labels", { value: n });
432
432
  }
433
- i.rgb.hsl = function(e) {
433
+ c.rgb.hsl = function(e) {
434
434
  const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, o = Math.min(t, n, r), l = Math.max(t, n, r), s = l - o;
435
- let a, c;
435
+ let a, i;
436
436
  switch (l) {
437
437
  case o: {
438
438
  a = 0;
@@ -453,17 +453,17 @@ i.rgb.hsl = function(e) {
453
453
  }
454
454
  a = Math.min(a * 60, 360), a < 0 && (a += 360);
455
455
  const u = (o + l) / 2;
456
- return l === o ? c = 0 : u <= 0.5 ? c = s / (l + o) : c = s / (2 - l - o), [a, c * 100, u * 100];
456
+ return l === o ? i = 0 : u <= 0.5 ? i = s / (l + o) : i = s / (2 - l - o), [a, i * 100, u * 100];
457
457
  };
458
- i.rgb.hsv = function(e) {
458
+ c.rgb.hsv = function(e) {
459
459
  let t, n, r, o, l;
460
- const s = e[0] / 255, a = e[1] / 255, c = e[2] / 255, u = Math.max(s, a, c), m = u - Math.min(s, a, c), p = function(A) {
461
- return (u - A) / 6 / m + 1 / 2;
460
+ const s = e[0] / 255, a = e[1] / 255, i = e[2] / 255, u = Math.max(s, a, i), m = u - Math.min(s, a, i), p = function(C) {
461
+ return (u - C) / 6 / m + 1 / 2;
462
462
  };
463
463
  if (m === 0)
464
464
  o = 0, l = 0;
465
465
  else {
466
- switch (l = m / u, t = p(s), n = p(a), r = p(c), u) {
466
+ switch (l = m / u, t = p(s), n = p(a), r = p(i), u) {
467
467
  case s: {
468
468
  o = r - n;
469
469
  break;
@@ -472,7 +472,7 @@ i.rgb.hsv = function(e) {
472
472
  o = 1 / 3 + t - r;
473
473
  break;
474
474
  }
475
- case c: {
475
+ case i: {
476
476
  o = 2 / 3 + n - t;
477
477
  break;
478
478
  }
@@ -485,20 +485,20 @@ i.rgb.hsv = function(e) {
485
485
  u * 100
486
486
  ];
487
487
  };
488
- i.rgb.hwb = function(e) {
488
+ c.rgb.hwb = function(e) {
489
489
  const t = e[0], n = e[1];
490
490
  let r = e[2];
491
- const o = i.rgb.hsl(e)[0], l = 1 / 255 * Math.min(t, Math.min(n, r));
491
+ const o = c.rgb.hsl(e)[0], l = 1 / 255 * Math.min(t, Math.min(n, r));
492
492
  return r = 1 - 1 / 255 * Math.max(t, Math.max(n, r)), [o, l * 100, r * 100];
493
493
  };
494
- i.rgb.cmyk = function(e) {
494
+ c.rgb.cmyk = function(e) {
495
495
  const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, o = Math.min(1 - t, 1 - n, 1 - r), l = (1 - t - o) / (1 - o) || 0, s = (1 - n - o) / (1 - o) || 0, a = (1 - r - o) / (1 - o) || 0;
496
496
  return [l * 100, s * 100, a * 100, o * 100];
497
497
  };
498
498
  function I(e, t) {
499
499
  return (e[0] - t[0]) ** 2 + (e[1] - t[1]) ** 2 + (e[2] - t[2]) ** 2;
500
500
  }
501
- i.rgb.keyword = function(e) {
501
+ c.rgb.keyword = function(e) {
502
502
  const t = q[e];
503
503
  if (t)
504
504
  return t;
@@ -509,33 +509,33 @@ i.rgb.keyword = function(e) {
509
509
  }
510
510
  return r;
511
511
  };
512
- i.keyword.rgb = function(e) {
512
+ c.keyword.rgb = function(e) {
513
513
  return M[e];
514
514
  };
515
- i.rgb.xyz = function(e) {
515
+ c.rgb.xyz = function(e) {
516
516
  let t = e[0] / 255, n = e[1] / 255, r = e[2] / 255;
517
517
  t = t > 0.04045 ? ((t + 0.055) / 1.055) ** 2.4 : t / 12.92, n = n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92, r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
518
518
  const o = t * 0.4124564 + n * 0.3575761 + r * 0.1804375, l = t * 0.2126729 + n * 0.7151522 + r * 0.072175, s = t * 0.0193339 + n * 0.119192 + r * 0.9503041;
519
519
  return [o * 100, l * 100, s * 100];
520
520
  };
521
- i.rgb.lab = function(e) {
522
- const t = i.rgb.xyz(e);
521
+ c.rgb.lab = function(e) {
522
+ const t = c.rgb.xyz(e);
523
523
  let n = t[0], r = t[1], o = t[2];
524
524
  n /= 95.047, r /= 100, o /= 108.883, n = n > y ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > y ? r ** (1 / 3) : 7.787 * r + 16 / 116, o = o > y ? o ** (1 / 3) : 7.787 * o + 16 / 116;
525
525
  const l = 116 * r - 16, s = 500 * (n - r), a = 200 * (r - o);
526
526
  return [l, s, a];
527
527
  };
528
- i.hsl.rgb = function(e) {
528
+ c.hsl.rgb = function(e) {
529
529
  const t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
530
530
  let o, l;
531
531
  if (n === 0)
532
532
  return l = r * 255, [l, l, l];
533
- const s = r < 0.5 ? r * (1 + n) : r + n - r * n, a = 2 * r - s, c = [0, 0, 0];
533
+ const s = r < 0.5 ? r * (1 + n) : r + n - r * n, a = 2 * r - s, i = [0, 0, 0];
534
534
  for (let u = 0; u < 3; u++)
535
- o = t + 1 / 3 * -(u - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? l = a + (s - a) * 6 * o : 2 * o < 1 ? l = s : 3 * o < 2 ? l = a + (s - a) * (2 / 3 - o) * 6 : l = a, c[u] = l * 255;
536
- return c;
535
+ o = t + 1 / 3 * -(u - 1), o < 0 && o++, o > 1 && o--, 6 * o < 1 ? l = a + (s - a) * 6 * o : 2 * o < 1 ? l = s : 3 * o < 2 ? l = a + (s - a) * (2 / 3 - o) * 6 : l = a, i[u] = l * 255;
536
+ return i;
537
537
  };
538
- i.hsl.hsv = function(e) {
538
+ c.hsl.hsv = function(e) {
539
539
  const t = e[0];
540
540
  let n = e[1] / 100, r = e[2] / 100, o = n;
541
541
  const l = Math.max(r, 0.01);
@@ -543,33 +543,33 @@ i.hsl.hsv = function(e) {
543
543
  const s = (r + n) / 2, a = r === 0 ? 2 * o / (l + o) : 2 * n / (r + n);
544
544
  return [t, a * 100, s * 100];
545
545
  };
546
- i.hsv.rgb = function(e) {
546
+ c.hsv.rgb = function(e) {
547
547
  const t = e[0] / 60, n = e[1] / 100;
548
548
  let r = e[2] / 100;
549
- const o = Math.floor(t) % 6, l = t - Math.floor(t), s = 255 * r * (1 - n), a = 255 * r * (1 - n * l), c = 255 * r * (1 - n * (1 - l));
549
+ const o = Math.floor(t) % 6, l = t - Math.floor(t), s = 255 * r * (1 - n), a = 255 * r * (1 - n * l), i = 255 * r * (1 - n * (1 - l));
550
550
  switch (r *= 255, o) {
551
551
  case 0:
552
- return [r, c, s];
552
+ return [r, i, s];
553
553
  case 1:
554
554
  return [a, r, s];
555
555
  case 2:
556
- return [s, r, c];
556
+ return [s, r, i];
557
557
  case 3:
558
558
  return [s, a, r];
559
559
  case 4:
560
- return [c, s, r];
560
+ return [i, s, r];
561
561
  case 5:
562
562
  return [r, s, a];
563
563
  }
564
564
  };
565
- i.hsv.hsl = function(e) {
565
+ c.hsv.hsl = function(e) {
566
566
  const t = e[0], n = e[1] / 100, r = e[2] / 100, o = Math.max(r, 0.01);
567
567
  let l, s;
568
568
  s = (2 - n) * r;
569
569
  const a = (2 - n) * o;
570
570
  return l = n * o, l /= a <= 1 ? a : 2 - a, l = l || 0, s /= 2, [t, l * 100, s * 100];
571
571
  };
572
- i.hwb.rgb = function(e) {
572
+ c.hwb.rgb = function(e) {
573
573
  const t = e[0] / 360;
574
574
  let n = e[1] / 100, r = e[2] / 100;
575
575
  const o = n + r;
@@ -577,87 +577,87 @@ i.hwb.rgb = function(e) {
577
577
  o > 1 && (n /= o, r /= o);
578
578
  const s = Math.floor(6 * t), a = 1 - r;
579
579
  l = 6 * t - s, s & 1 && (l = 1 - l);
580
- const c = n + l * (a - n);
580
+ const i = n + l * (a - n);
581
581
  let u, m, p;
582
582
  switch (s) {
583
583
  default:
584
584
  case 6:
585
585
  case 0: {
586
- u = a, m = c, p = n;
586
+ u = a, m = i, p = n;
587
587
  break;
588
588
  }
589
589
  case 1: {
590
- u = c, m = a, p = n;
590
+ u = i, m = a, p = n;
591
591
  break;
592
592
  }
593
593
  case 2: {
594
- u = n, m = a, p = c;
594
+ u = n, m = a, p = i;
595
595
  break;
596
596
  }
597
597
  case 3: {
598
- u = n, m = c, p = a;
598
+ u = n, m = i, p = a;
599
599
  break;
600
600
  }
601
601
  case 4: {
602
- u = c, m = n, p = a;
602
+ u = i, m = n, p = a;
603
603
  break;
604
604
  }
605
605
  case 5: {
606
- u = a, m = n, p = c;
606
+ u = a, m = n, p = i;
607
607
  break;
608
608
  }
609
609
  }
610
610
  return [u * 255, m * 255, p * 255];
611
611
  };
612
- i.cmyk.rgb = function(e) {
612
+ c.cmyk.rgb = function(e) {
613
613
  const t = e[0] / 100, n = e[1] / 100, r = e[2] / 100, o = e[3] / 100, l = 1 - Math.min(1, t * (1 - o) + o), s = 1 - Math.min(1, n * (1 - o) + o), a = 1 - Math.min(1, r * (1 - o) + o);
614
614
  return [l * 255, s * 255, a * 255];
615
615
  };
616
- i.xyz.rgb = function(e) {
616
+ c.xyz.rgb = function(e) {
617
617
  const t = e[0] / 100, n = e[1] / 100, r = e[2] / 100;
618
618
  let o, l, s;
619
619
  return o = t * 3.2404542 + n * -1.5371385 + r * -0.4985314, l = t * -0.969266 + n * 1.8760108 + r * 0.041556, s = t * 0.0556434 + n * -0.2040259 + r * 1.0572252, o = o > 31308e-7 ? 1.055 * o ** (1 / 2.4) - 0.055 : o * 12.92, l = l > 31308e-7 ? 1.055 * l ** (1 / 2.4) - 0.055 : l * 12.92, s = s > 31308e-7 ? 1.055 * s ** (1 / 2.4) - 0.055 : s * 12.92, o = Math.min(Math.max(0, o), 1), l = Math.min(Math.max(0, l), 1), s = Math.min(Math.max(0, s), 1), [o * 255, l * 255, s * 255];
620
620
  };
621
- i.xyz.lab = function(e) {
621
+ c.xyz.lab = function(e) {
622
622
  let t = e[0], n = e[1], r = e[2];
623
623
  t /= 95.047, n /= 100, r /= 108.883, t = t > y ? t ** (1 / 3) : 7.787 * t + 16 / 116, n = n > y ? n ** (1 / 3) : 7.787 * n + 16 / 116, r = r > y ? r ** (1 / 3) : 7.787 * r + 16 / 116;
624
624
  const o = 116 * n - 16, l = 500 * (t - n), s = 200 * (n - r);
625
625
  return [o, l, s];
626
626
  };
627
- i.lab.xyz = function(e) {
627
+ c.lab.xyz = function(e) {
628
628
  const t = e[0], n = e[1], r = e[2];
629
629
  let o, l, s;
630
630
  l = (t + 16) / 116, o = n / 500 + l, s = l - r / 200;
631
- const a = l ** 3, c = o ** 3, u = s ** 3;
632
- return l = a > y ? a : (l - 16 / 116) / 7.787, o = c > y ? c : (o - 16 / 116) / 7.787, s = u > y ? u : (s - 16 / 116) / 7.787, o *= 95.047, l *= 100, s *= 108.883, [o, l, s];
631
+ const a = l ** 3, i = o ** 3, u = s ** 3;
632
+ return l = a > y ? a : (l - 16 / 116) / 7.787, o = i > y ? i : (o - 16 / 116) / 7.787, s = u > y ? u : (s - 16 / 116) / 7.787, o *= 95.047, l *= 100, s *= 108.883, [o, l, s];
633
633
  };
634
- i.lab.lch = function(e) {
634
+ c.lab.lch = function(e) {
635
635
  const t = e[0], n = e[1], r = e[2];
636
636
  let o;
637
637
  o = Math.atan2(r, n) * 360 / 2 / Math.PI, o < 0 && (o += 360);
638
638
  const s = Math.sqrt(n * n + r * r);
639
639
  return [t, s, o];
640
640
  };
641
- i.lch.lab = function(e) {
641
+ c.lch.lab = function(e) {
642
642
  const t = e[0], n = e[1], o = e[2] / 360 * 2 * Math.PI, l = n * Math.cos(o), s = n * Math.sin(o);
643
643
  return [t, l, s];
644
644
  };
645
- i.rgb.ansi16 = function(e, t = null) {
645
+ c.rgb.ansi16 = function(e, t = null) {
646
646
  const [n, r, o] = e;
647
- let l = t === null ? i.rgb.hsv(e)[2] : t;
647
+ let l = t === null ? c.rgb.hsv(e)[2] : t;
648
648
  if (l = Math.round(l / 50), l === 0)
649
649
  return 30;
650
650
  let s = 30 + (Math.round(o / 255) << 2 | Math.round(r / 255) << 1 | Math.round(n / 255));
651
651
  return l === 2 && (s += 60), s;
652
652
  };
653
- i.hsv.ansi16 = function(e) {
654
- return i.rgb.ansi16(i.hsv.rgb(e), e[2]);
653
+ c.hsv.ansi16 = function(e) {
654
+ return c.rgb.ansi16(c.hsv.rgb(e), e[2]);
655
655
  };
656
- i.rgb.ansi256 = function(e) {
656
+ c.rgb.ansi256 = function(e) {
657
657
  const t = e[0], n = e[1], r = e[2];
658
658
  return t >> 4 === n >> 4 && n >> 4 === r >> 4 ? t < 8 ? 16 : t > 248 ? 231 : Math.round((t - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(t / 255 * 5) + 6 * Math.round(n / 255 * 5) + Math.round(r / 255 * 5);
659
659
  };
660
- i.ansi16.rgb = function(e) {
660
+ c.ansi16.rgb = function(e) {
661
661
  e = e[0];
662
662
  let t = e % 10;
663
663
  if (t === 0 || t === 7)
@@ -665,7 +665,7 @@ i.ansi16.rgb = function(e) {
665
665
  const n = (Math.trunc(e > 50) + 1) * 0.5, r = (t & 1) * n * 255, o = (t >> 1 & 1) * n * 255, l = (t >> 2 & 1) * n * 255;
666
666
  return [r, o, l];
667
667
  };
668
- i.ansi256.rgb = function(e) {
668
+ c.ansi256.rgb = function(e) {
669
669
  if (e = e[0], e >= 232) {
670
670
  const l = (e - 232) * 10 + 8;
671
671
  return [l, l, l];
@@ -675,11 +675,11 @@ i.ansi256.rgb = function(e) {
675
675
  const n = Math.floor(e / 36) / 5 * 255, r = Math.floor((t = e % 36) / 6) / 5 * 255, o = t % 6 / 5 * 255;
676
676
  return [n, r, o];
677
677
  };
678
- i.rgb.hex = function(e) {
678
+ c.rgb.hex = function(e) {
679
679
  const n = (((Math.round(e[0]) & 255) << 16) + ((Math.round(e[1]) & 255) << 8) + (Math.round(e[2]) & 255)).toString(16).toUpperCase();
680
680
  return "000000".slice(n.length) + n;
681
681
  };
682
- i.hex.rgb = function(e) {
682
+ c.hex.rgb = function(e) {
683
683
  const t = e.toString(16).match(/[a-f\d]{6}|[a-f\d]{3}/i);
684
684
  if (!t)
685
685
  return [0, 0, 0];
@@ -688,28 +688,28 @@ i.hex.rgb = function(e) {
688
688
  const r = Number.parseInt(n, 16), o = r >> 16 & 255, l = r >> 8 & 255, s = r & 255;
689
689
  return [o, l, s];
690
690
  };
691
- i.rgb.hcg = function(e) {
691
+ c.rgb.hcg = function(e) {
692
692
  const t = e[0] / 255, n = e[1] / 255, r = e[2] / 255, o = Math.max(Math.max(t, n), r), l = Math.min(Math.min(t, n), r), s = o - l;
693
693
  let a;
694
- const c = s < 1 ? l / (1 - s) : 0;
695
- return s <= 0 ? a = 0 : o === t ? a = (n - r) / s % 6 : o === n ? a = 2 + (r - t) / s : a = 4 + (t - n) / s, a /= 6, a %= 1, [a * 360, s * 100, c * 100];
694
+ const i = s < 1 ? l / (1 - s) : 0;
695
+ return s <= 0 ? a = 0 : o === t ? a = (n - r) / s % 6 : o === n ? a = 2 + (r - t) / s : a = 4 + (t - n) / s, a /= 6, a %= 1, [a * 360, s * 100, i * 100];
696
696
  };
697
- i.hsl.hcg = function(e) {
697
+ c.hsl.hcg = function(e) {
698
698
  const t = e[1] / 100, n = e[2] / 100, r = n < 0.5 ? 2 * t * n : 2 * t * (1 - n);
699
699
  let o = 0;
700
700
  return r < 1 && (o = (n - 0.5 * r) / (1 - r)), [e[0], r * 100, o * 100];
701
701
  };
702
- i.hsv.hcg = function(e) {
702
+ c.hsv.hcg = function(e) {
703
703
  const t = e[1] / 100, n = e[2] / 100, r = t * n;
704
704
  let o = 0;
705
705
  return r < 1 && (o = (n - r) / (1 - r)), [e[0], r * 100, o * 100];
706
706
  };
707
- i.hcg.rgb = function(e) {
707
+ c.hcg.rgb = function(e) {
708
708
  const t = e[0] / 360, n = e[1] / 100, r = e[2] / 100;
709
709
  if (n === 0)
710
710
  return [r * 255, r * 255, r * 255];
711
711
  const o = [0, 0, 0], l = t % 1 * 6, s = l % 1, a = 1 - s;
712
- let c = 0;
712
+ let i = 0;
713
713
  switch (Math.floor(l)) {
714
714
  case 0: {
715
715
  o[0] = 1, o[1] = s, o[2] = 0;
@@ -734,62 +734,62 @@ i.hcg.rgb = function(e) {
734
734
  default:
735
735
  o[0] = 1, o[1] = 0, o[2] = a;
736
736
  }
737
- return c = (1 - n) * r, [
738
- (n * o[0] + c) * 255,
739
- (n * o[1] + c) * 255,
740
- (n * o[2] + c) * 255
737
+ return i = (1 - n) * r, [
738
+ (n * o[0] + i) * 255,
739
+ (n * o[1] + i) * 255,
740
+ (n * o[2] + i) * 255
741
741
  ];
742
742
  };
743
- i.hcg.hsv = function(e) {
743
+ c.hcg.hsv = function(e) {
744
744
  const t = e[1] / 100, n = e[2] / 100, r = t + n * (1 - t);
745
745
  let o = 0;
746
746
  return r > 0 && (o = t / r), [e[0], o * 100, r * 100];
747
747
  };
748
- i.hcg.hsl = function(e) {
748
+ c.hcg.hsl = function(e) {
749
749
  const t = e[1] / 100, r = e[2] / 100 * (1 - t) + 0.5 * t;
750
750
  let o = 0;
751
751
  return r > 0 && r < 0.5 ? o = t / (2 * r) : r >= 0.5 && r < 1 && (o = t / (2 * (1 - r))), [e[0], o * 100, r * 100];
752
752
  };
753
- i.hcg.hwb = function(e) {
753
+ c.hcg.hwb = function(e) {
754
754
  const t = e[1] / 100, n = e[2] / 100, r = t + n * (1 - t);
755
755
  return [e[0], (r - t) * 100, (1 - r) * 100];
756
756
  };
757
- i.hwb.hcg = function(e) {
757
+ c.hwb.hcg = function(e) {
758
758
  const t = e[1] / 100, r = 1 - e[2] / 100, o = r - t;
759
759
  let l = 0;
760
760
  return o < 1 && (l = (r - o) / (1 - o)), [e[0], o * 100, l * 100];
761
761
  };
762
- i.apple.rgb = function(e) {
762
+ c.apple.rgb = function(e) {
763
763
  return [e[0] / 65535 * 255, e[1] / 65535 * 255, e[2] / 65535 * 255];
764
764
  };
765
- i.rgb.apple = function(e) {
765
+ c.rgb.apple = function(e) {
766
766
  return [e[0] / 255 * 65535, e[1] / 255 * 65535, e[2] / 255 * 65535];
767
767
  };
768
- i.gray.rgb = function(e) {
768
+ c.gray.rgb = function(e) {
769
769
  return [e[0] / 100 * 255, e[0] / 100 * 255, e[0] / 100 * 255];
770
770
  };
771
- i.gray.hsl = function(e) {
771
+ c.gray.hsl = function(e) {
772
772
  return [0, 0, e[0]];
773
773
  };
774
- i.gray.hsv = i.gray.hsl;
775
- i.gray.hwb = function(e) {
774
+ c.gray.hsv = c.gray.hsl;
775
+ c.gray.hwb = function(e) {
776
776
  return [0, 100, e[0]];
777
777
  };
778
- i.gray.cmyk = function(e) {
778
+ c.gray.cmyk = function(e) {
779
779
  return [0, 0, 0, e[0]];
780
780
  };
781
- i.gray.lab = function(e) {
781
+ c.gray.lab = function(e) {
782
782
  return [e[0], 0, 0];
783
783
  };
784
- i.gray.hex = function(e) {
784
+ c.gray.hex = function(e) {
785
785
  const t = Math.round(e[0] / 100 * 255) & 255, r = ((t << 16) + (t << 8) + t).toString(16).toUpperCase();
786
786
  return "000000".slice(r.length) + r;
787
787
  };
788
- i.rgb.gray = function(e) {
788
+ c.rgb.gray = function(e) {
789
789
  return [(e[0] + e[1] + e[2]) / 3 / 255 * 100];
790
790
  };
791
- function j() {
792
- const e = {}, t = Object.keys(i);
791
+ function P() {
792
+ const e = {}, t = Object.keys(c);
793
793
  for (let { length: n } = t, r = 0; r < n; r++)
794
794
  e[t[r]] = {
795
795
  // http://jsperf.com/1-vs-infinity
@@ -800,29 +800,29 @@ function j() {
800
800
  return e;
801
801
  }
802
802
  function E(e) {
803
- const t = j(), n = [e];
803
+ const t = P(), n = [e];
804
804
  for (t[e].distance = 0; n.length > 0; ) {
805
- const r = n.pop(), o = Object.keys(i[r]);
805
+ const r = n.pop(), o = Object.keys(c[r]);
806
806
  for (let { length: l } = o, s = 0; s < l; s++) {
807
- const a = o[s], c = t[a];
808
- c.distance === -1 && (c.distance = t[r].distance + 1, c.parent = r, n.unshift(a));
807
+ const a = o[s], i = t[a];
808
+ i.distance === -1 && (i.distance = t[r].distance + 1, i.parent = r, n.unshift(a));
809
809
  }
810
810
  }
811
811
  return t;
812
812
  }
813
- function P(e, t) {
813
+ function j(e, t) {
814
814
  return function(n) {
815
815
  return t(e(n));
816
816
  };
817
817
  }
818
818
  function $(e, t) {
819
819
  const n = [t[e].parent, e];
820
- let r = i[t[e].parent][e], o = t[e].parent;
820
+ let r = c[t[e].parent][e], o = t[e].parent;
821
821
  for (; t[o].parent; )
822
- n.unshift(t[o].parent), r = P(i[t[o].parent][o], r), o = t[o].parent;
822
+ n.unshift(t[o].parent), r = j(c[t[o].parent][o], r), o = t[o].parent;
823
823
  return r.conversion = n, r;
824
824
  }
825
- function U(e) {
825
+ function T(e) {
826
826
  const t = E(e), n = {}, r = Object.keys(t);
827
827
  for (let { length: o } = r, l = 0; l < o; l++) {
828
828
  const s = r[l];
@@ -830,15 +830,15 @@ function U(e) {
830
830
  }
831
831
  return n;
832
832
  }
833
- const g = {}, D = Object.keys(i);
834
- function K(e) {
833
+ const g = {}, U = Object.keys(c);
834
+ function D(e) {
835
835
  const t = function(...n) {
836
836
  const r = n[0];
837
837
  return r == null ? r : (r.length > 1 && (n = r), e(n));
838
838
  };
839
839
  return "conversion" in e && (t.conversion = e.conversion), t;
840
840
  }
841
- function T(e) {
841
+ function K(e) {
842
842
  const t = function(...n) {
843
843
  const r = n[0];
844
844
  if (r == null)
@@ -852,12 +852,12 @@ function T(e) {
852
852
  };
853
853
  return "conversion" in e && (t.conversion = e.conversion), t;
854
854
  }
855
- for (const e of D) {
856
- g[e] = {}, Object.defineProperty(g[e], "channels", { value: i[e].channels }), Object.defineProperty(g[e], "labels", { value: i[e].labels });
857
- const t = U(e), n = Object.keys(t);
855
+ for (const e of U) {
856
+ g[e] = {}, Object.defineProperty(g[e], "channels", { value: c[e].channels }), Object.defineProperty(g[e], "labels", { value: c[e].labels });
857
+ const t = T(e), n = Object.keys(t);
858
858
  for (const r of n) {
859
859
  const o = t[r];
860
- g[e][r] = T(o), g[e][r].raw = K(o);
860
+ g[e][r] = K(o), g[e][r].raw = D(o);
861
861
  }
862
862
  }
863
863
  const z = [
@@ -867,9 +867,9 @@ const z = [
867
867
  "gray",
868
868
  // Shouldn't really be in color-convert either...
869
869
  "hex"
870
- ], _ = {};
870
+ ], F = {};
871
871
  for (const e of Object.keys(g))
872
- _[[...g[e].labels].sort().join("")] = e;
872
+ F[[...g[e].labels].sort().join("")] = e;
873
873
  const v = {};
874
874
  function b(e, t) {
875
875
  if (!(this instanceof b))
@@ -901,9 +901,9 @@ function b(e, t) {
901
901
  const o = Object.keys(e);
902
902
  "alpha" in e && (o.splice(o.indexOf("alpha"), 1), this.valpha = typeof e.alpha == "number" ? e.alpha : 0);
903
903
  const l = o.sort().join("");
904
- if (!(l in _))
904
+ if (!(l in F))
905
905
  throw new Error("Unable to parse color from object: " + JSON.stringify(e));
906
- this.model = _[l];
906
+ this.model = F[l];
907
907
  const { labels: s } = g[this.model], a = [];
908
908
  for (n = 0; n < s.length; n++)
909
909
  a.push(e[s[n]]);
@@ -951,7 +951,7 @@ b.prototype = {
951
951
  return e.r /= 255, e.g /= 255, e.b /= 255, this.valpha !== 1 && (e.alpha = this.valpha), e;
952
952
  },
953
953
  round(e) {
954
- return e = Math.max(e || 0, 0), new b([...this.color.map(R(e)), this.valpha], this.model);
954
+ return e = Math.max(e || 0, 0), new b([...this.color.map(L(e)), this.valpha], this.model);
955
955
  },
956
956
  alpha(e) {
957
957
  return e !== void 0 ? new b([...this.color, Math.max(0, Math.min(1, e))], this.model) : this.valpha;
@@ -1067,11 +1067,11 @@ b.prototype = {
1067
1067
  mix(e, t) {
1068
1068
  if (!e || !e.rgb)
1069
1069
  throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof e);
1070
- const n = e.rgb(), r = this.rgb(), o = t === void 0 ? 0.5 : t, l = 2 * o - 1, s = n.alpha() - r.alpha(), a = ((l * s === -1 ? l : (l + s) / (1 + l * s)) + 1) / 2, c = 1 - a;
1070
+ const n = e.rgb(), r = this.rgb(), o = t === void 0 ? 0.5 : t, l = 2 * o - 1, s = n.alpha() - r.alpha(), a = ((l * s === -1 ? l : (l + s) / (1 + l * s)) + 1) / 2, i = 1 - a;
1071
1071
  return b.rgb(
1072
- a * n.red() + c * r.red(),
1073
- a * n.green() + c * r.green(),
1074
- a * n.blue() + c * r.blue(),
1072
+ a * n.red() + i * r.red(),
1073
+ a * n.green() + i * r.green(),
1074
+ a * n.blue() + i * r.blue(),
1075
1075
  n.alpha() * o + r.alpha() * (1 - o)
1076
1076
  );
1077
1077
  }
@@ -1081,18 +1081,18 @@ for (const e of Object.keys(g)) {
1081
1081
  continue;
1082
1082
  const { channels: t } = g[e];
1083
1083
  b.prototype[e] = function(...n) {
1084
- return this.model === e ? new b(this) : n.length > 0 ? new b(n, e) : new b([...B(g[this.model][e].raw(this.color)), this.valpha], e);
1084
+ return this.model === e ? new b(this) : n.length > 0 ? new b(n, e) : new b([...R(g[this.model][e].raw(this.color)), this.valpha], e);
1085
1085
  }, b[e] = function(...n) {
1086
1086
  let r = n[0];
1087
1087
  return typeof r == "number" && (r = N(n, t)), new b(r, e);
1088
1088
  };
1089
1089
  }
1090
- function L(e, t) {
1090
+ function B(e, t) {
1091
1091
  return Number(e.toFixed(t));
1092
1092
  }
1093
- function R(e) {
1093
+ function L(e) {
1094
1094
  return function(t) {
1095
- return L(t, e);
1095
+ return B(t, e);
1096
1096
  };
1097
1097
  }
1098
1098
  function h(e, t, n) {
@@ -1109,7 +1109,7 @@ function f(e) {
1109
1109
  return Math.max(0, Math.min(e, t));
1110
1110
  };
1111
1111
  }
1112
- function B(e) {
1112
+ function R(e) {
1113
1113
  return Array.isArray(e) ? e : [e];
1114
1114
  }
1115
1115
  function N(e, t) {
@@ -1119,23 +1119,32 @@ function N(e, t) {
1119
1119
  }
1120
1120
  class J {
1121
1121
  constructor(t) {
1122
- F(this, "isColor", !0);
1123
- F(this, "currentColor");
1124
- return this.currentColor = b(t), new Proxy(this, {
1125
- get(n, r) {
1126
- return r in n ? n[r] : r in n.currentColor ? n._handleColorMethod(r) : n[r];
1122
+ _(this, "isColor", !0);
1123
+ _(this, "currentColor");
1124
+ this.base = t;
1125
+ const n = this._resolveBaseColor(t);
1126
+ return this.currentColor = b(n), this._createProxy();
1127
+ }
1128
+ _createProxy() {
1129
+ return new Proxy(this, {
1130
+ get(t, n) {
1131
+ return n in t ? t[n] : n in t.currentColor ? t._handleColorMethod(n) : t[n];
1127
1132
  }
1128
1133
  });
1129
1134
  }
1135
+ _resolveBaseColor(t) {
1136
+ if (typeof t != "string" || !/\{[^{}]+\}/g.test(t)) return t;
1137
+ throw new Error("Token values are not yet supported, use a color string instead");
1138
+ }
1130
1139
  _handleColorMethod(t) {
1131
1140
  const n = this.currentColor;
1132
- return typeof n[t] != "function" ? n[t] : (...r) => (this.currentColor = n[t](...r), this);
1141
+ return typeof n[t] != "function" ? n[t] : (...r) => (this.currentColor = n[t](...r), this._createProxy());
1133
1142
  }
1134
1143
  toString() {
1135
1144
  return this.currentColor.toString();
1136
1145
  }
1137
1146
  }
1138
- const H = (e) => new J(e);
1147
+ const G = (e) => new J(e);
1139
1148
  export {
1140
- H as color
1149
+ G as color
1141
1150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salty-css/react",
3
- "version": "0.0.1-alpha.194",
3
+ "version": "0.0.1-alpha.195",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "typings": "./dist/index.d.ts",
@@ -62,7 +62,7 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@salty-css/core": "^0.0.1-alpha.194",
65
+ "@salty-css/core": "^0.0.1-alpha.195",
66
66
  "clsx": ">=2.x",
67
67
  "react": ">=19.x || >=18.3.x"
68
68
  }