Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cobalt-ui/core

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cobalt-ui/core - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

6

CHANGELOG.md
# @cobalt-ui/core
## 1.3.1
### Patch Changes
- [#61](https://github.com/drwpow/cobalt-ui/pull/61) [`949481f`](https://github.com/drwpow/cobalt-ui/commit/949481ff53489baf485f6befd3befcd6ec176260) Thanks [@drwpow](https://github.com/drwpow)! - Replace better-color-tools with culori for faster, more accurate color operations
## 1.3.0

@@ -4,0 +10,0 @@

9

dist/index.min.js

@@ -1,4 +0,7 @@

var Ee=typeof process<"u"?!process.env.NODE_DISABLE_COLORS&&(!process.env.NO_COLOR||process.env.NO_COLOR=="0"):!0,ve=Ee?"\x1B[0m":"";var Ae=Ee?"\x1B[33m":"";var Ke=["0-9","A-Za-z","\xC0-\xFF","\u0100-\u017F","\u0180-\u024F","\u0370-\u03FF","\u0400-\u04FF","\u0530-\u058F","\u0590-\u05FF","\u0600-\u06FF","\u0900-\u097F","\u1100-\u11FF","\u3040-\u309F","\u30A0-\u30FF","\u3400-\u4DBF","\u4E00-\u9FFF"];var Xe=/[^-_.\s][-_.\s]+[^-_.\s]/g,wr=new RegExp(`^[${Ke.join("")}]+$`);function Ve(e){return e.length<2?e:e.replace(Xe,t=>`${t[0].toLocaleLowerCase()}${t[t.length-1].toLocaleUpperCase()}`)}function H(e){if(!e||typeof e=="string"||typeof e=="boolean"||typeof e=="number")return e;if(Array.isArray(e)){let r=[];for(let o of e)r.push(H(o));return r}let t={};for(let[r,o]of Object.entries(e))t[r]=H(o);return t}var ze=/^\{([^}]+)\}$/;function D(e){let t=e.match(ze);return t?t[1]??t[0]:e}function j(e){return typeof e!="string"?!1:ze.test(e)}function V(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Me(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:V(e)?Object.keys(e).length===0:!1}function oe(e,t){if(e==null&&t.undefined)return t.undefined(e);if(typeof e=="string"&&t.string)return t.string(e);if(typeof e=="number"&&t.number)return t.number(e);if(Array.isArray(e)&&t.array)return t.array(e);if(V(e)&&t.object)return t.object(e);if(t.default)return t.default(e)}function K(e,t=2){let r=e;for(;r.length<t;)r=`0${r}`;return r}function Pe(e){return e*(Math.PI/180)}function Ze(e){return e*(180/Math.PI)}function g(e,t,r){return Math.min(Math.max(e,t),r)}function G(e,t){let[r,o,n,l]=t,a=l<1?`/${z(l,5)}`:"";switch(e){case"rgb":case"rgba":return l<1?`rgba(${Math.round(r*255)}, ${Math.round(o*255)}, ${Math.round(n*255)}, ${z(l,5)})`:`rgb(${Math.round(r*255)}, ${Math.round(o*255)}, ${Math.round(n*255)})`;case"oklab":case"oklch":return`${e}(${z(r*100,6)}% ${z(o,6)} ${z(n,6)}${a})`;default:return`color(${e} ${z(r,6)} ${z(o,6)} ${z(n,6)}${a})`}}function T(e,t){let r=[...e];for(let o=0;o<t.length;o++){let n=0;for(let l=0;l<t[o].length;l++)n+=e[l]*t[o][l];r[o]=n}return r}function z(e,t=2){let r=10**t;return Math.round(e*r)/r}var Je=[[.4123907992659593,.357584339383878,.1804807884018343],[.2126390058715102,.715168678767756,.0721923153607337],[.0193308187155918,.119194779794626,.9505321522496607]],Qe=[[3.240969941904522,-1.537383177570094,-.4986107602930034],[-.9692436362808793,1.8759675015077202,.0415550574071756],[.0556300796969937,-.2039769588889766,1.0569715142428782]],er=[[.2104542553,.793617785,-.0040720468],[1.9779984951,-2.428592205,.4505937099],[.0259040371,.7827717662,-.808675766]],$=[[4.0767416621,-3.3077115913,.2309699292],[-1.2684380046,2.6097574011,-.3413193965],[-.0041960863,-.7034186147,1.707614701]],rr=[[.4122214708,.5363325363,.0514459929],[.2119034982,.6806995451,.1073969566],[.0883024619,.2817188376,.6299787005]],tr=[[1,.39633779217376774,.2158037580607588],[1,-.10556134232365633,-.0638541747717059],[1,-.08948418209496574,-1.2914855378640917]];function or(e,t){let r=[1/0,1/0,1/0,1/0,1/0],o=1/0,n=1/0,l=1/0;-1.88170328*e-.80936493*t>1?(r=[1.19086277,1.76576728,.59662641,.75515197,.56771245],o=4.0767416621,n=-3.3077115913,l=.2309699292):1.81444104*e-1.19445276*t>1?(r=[.73956515,-.45954404,.08285427,.1254107,.14503204],o=-1.2684380046,n=2.6097574011,l=-.3413193965):(r=[1.35733652,-.00915799,-1.1513021,-.50559606,.00692167],o=-.0041960863,n=-.7034186147,l=1.707614701);let a=r[0]+r[1]*e+r[2]*t+r[3]*e*e+r[4]*e*t,c=.3963377774*e+.2158037573*t,m=-.1055613458*e-.0638541728*t,s=-.0894841775*e-1.291485548*t;{let p=1+a*c,y=1+a*m,u=1+a*s,i=p**3,x=y**3,f=u**3,d=3*c*p**2,b=3*m*y**2,k=3*s*u**2,R=6*c**2*p,h=6*m**2*y,E=6*s**2*u,w=o*i+n*x+l*f,O=o*d+n*b+l*k,C=o*R+n*h+l*E;a=a-w*O/(O*O-.5*w*C)}return a}function nr(e,t){let r=or(e,t),[o,n,l]=X(se([1,r*e,r*t,1])),a=Math.cbrt(1/Math.max(o,n,l)),c=a*r;return{L:a,C:c}}function ir(e,t,r,o,n){let l=nr(e,t);if((r-n)*l.C-(l.L-n)*o<=0)return l.C*n/(o*l.L+l.C*(n-r));let a=l.C*(n-1)/(o*(l.L-1)+l.C*(n-r)),c=r-n,m=o,s=.3963377774*e+.2158037573*t,p=-.1055613458*e-.0638541728*t,y=-.0894841775*e-1.291485548*t,u=c+m*s,i=c+m*p,x=c+m*y,f=n*(1-a)+a*r,d=a*o,b=f+d*s,k=f+d*p,R=f+d*y,h=[[b**3,k**3,R**3],[3*u*b**2,3*i*k**2,3*x*R**2],[6*u**2*b,6*i**2*k,6*x**2*R]],E=$[0][0]*h[0][0]+$[0][1]*h[0][1]+$[0][2]*h[0][2]-1,w=$[0][0]*h[1][0]+$[0][1]*h[1][1]+$[0][2]*h[1][2],O=$[0][0]*h[2][0]+$[0][1]*h[2][1]+$[0][2]*h[2][2],C=w/(w*w-.5*E*O),L=C>=0?-E*C:1/0,U=$[1][0]*h[0][0]+$[1][1]*h[0][1]+$[1][2]*h[0][2]-1,A=$[1][0]*h[1][0]+$[1][1]*h[1][1]+$[1][2]*h[1][2],qe=$[1][0]*h[2][0]+$[1][1]*h[2][1]+$[1][2]*h[2][2],xe=A/(A*A-.5*U*qe),Ye=xe>=0?-U*xe:1/0,ke=$[2][0]*h[0][0]+$[2][1]*h[0][1]+$[2][2]*h[0][2]-1,te=$[2][0]*h[1][0]+$[2][1]*h[1][1]+$[2][2]*h[1][2],Ue=$[2][0]*h[2][0]+$[2][1]*h[2][1]+$[2][2]*h[2][2],we=te/(te*te-.5*ke*Ue),He=we>=0?-ke*we:1/0;return a+Math.min(L,Ye,He)}function ne(e){let t=Math.abs(e);return t<=.0031308?e*12.92:1.055*Math.pow(t,1/2.4)-.055}function ie(e){return Math.abs(e)<=.04045?e/12.92:((Math.abs(e)+.055)/1.055)**2.4}function ae(e){let[t,r,o,n]=e;t=Math.abs(t%360);let l=r*(1-Math.abs(2*o-1)),a=l*(1-Math.abs(t/60%2-1)),c=0,m=0,s=0;0<=t&&t<60?(c=l,m=a):60<=t&&t<120?(c=a,m=l):120<=t&&t<180?(m=l,s=a):180<=t&&t<240?(m=a,s=l):240<=t&&t<300?(c=a,s=l):300<=t&&t<360&&(c=l,s=a);let p=o-l/2;return[c+p,m+p,s+p,n]}function Fe(e){let[t,r,o,n]=e;if(r+o>=1){let a=r/(r+o);return[a,a,a,n]}let l=ae([t,100,50,n]);for(let a=0;a<3;a++)l[a]*=1-r-o,l[a]+=r;return l}function ar(e,t=2e-4){let[r,o,n,l]=e,a=Math.abs(o)<t&&Math.abs(n)<t?0:Ze(Math.atan2(n,o));for(;a<0;)a+=360;for(;a>=360;)a-=360;return[r,Math.sqrt(o**2+n**2),a,l]}function sr(e){let[t,r,o,n]=e;if(t===0)return[0,0,0,n];for(;o<0;)o+=360;for(;o>=360;)o-=360;let l=Pe(o);return[t,Math.cos(l)*r,Math.sin(l)*r,n]}function lr(e){return T(e,er)}function X(e){let[t,r,o,n]=e,[l,a,c]=T([t**3,r**3,o**3,n],$);return[l,a,c,n]}function _(e){let[t,r,o,n]=e;return[ne(t),ne(r),ne(o),n]}function Le(e){let[t,r,o,n]=T(e,rr);return[Math.cbrt(t),Math.cbrt(r),Math.cbrt(o),n]}function Re(e){return T(e,Je)}function se(e){return T(e,tr)}function P(e){let[t,r,o,n]=X(se(e));if(t>1.001||t<-.001||r>1.001||r<-.001||o>1.001||o<-.001){let[l,a,c]=e,m=Math.max(1e-5,Math.sqrt(a**2+c**2)),s=g(l,0,1),p=a/m,y=c/m,u=ir(p,y,l,m,s);return _(X(se([s*(1-u)+u*l,p*(u*m),y*(u*m),n])))}return _([t,r,o,n])}function Z(e){return P(sr(e))}function S(e){let[t,r,o,n]=e;return[ie(t),ie(r),ie(o),n]}function J(e){return lr(Le(S(e)))}function Q(e){return ar(J(e))}function je(e){return T(e,Qe)}function Ge(e,t){let[r,o,n,l]=Q(e);return typeof t.lightness=="number"&&(t.mode==="relative"?r+=t.lightness:r=t.lightness),typeof t.chroma=="number"&&(t.mode==="relative"?o+=t.chroma:o=t.chroma),typeof t.hue=="number"&&(t.mode==="relative"?n+=t.hue:n=t.hue),typeof t.alpha=="number"&&(t.mode==="relative"?l+=t.alpha:l=t.alpha),Z([r,o,n,l])}var ur={black:0,silver:12632256,gray:8421504,white:16777215,maroon:8388608,red:16711680,purple:8388736,fuchsia:16711935,green:32768,lime:65280,olive:8421376,yellow:16776960,navy:128,blue:255,teal:32896,aqua:65535,orange:16753920,aliceblue:15792383,antiquewhite:16444375,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,blanchedalmond:16772045,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,limegreen:3329330,linen:16445670,magenta:16711935,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,oldlace:16643558,olivedrab:7048739,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,whitesmoke:16119285,yellowgreen:10145074,rebeccapurple:6697881},Be=ur,fr=/-?[0-9.]+%?/g,cr=/^#[0-9a-f]{3,8}$/i,mr=/^([^( ]+)\s*\(\s*([^)]+)\)$/,pr=16**6,le=16**4,ue=16**2;function M(e){let t=dr(e),r={},o={get hex(){if(r.hex)return r.hex;let[n,l,a,c]=t,m="#";return m+=K(Math.round(g(n*255,0,255)).toString(16),2),m+=K(Math.round(g(l*255,0,255)).toString(16),2),m+=K(Math.round(g(a*255,0,255)).toString(16),2),t[3]<1&&(m+=K(Math.round(c*255).toString(16),2)),r.hex=m,r.hex},get hexVal(){if(typeof r.hexVal=="number")return r.hexVal;let[n,l,a,c]=t;return c<1&&console.warn(`hexVal converted a semi-transparent color (${c*100}%) to fully opaque`),n=Math.round(g(n*255,0,255)),l=Math.round(g(l*255,0,255)),a=Math.round(g(a*255,0,255)),r.hexVal=n*le+l*ue+a,r.hexVal},get rgb(){return r.rgb||(r.rgb=G("rgb",t)),r.rgb},get rgba(){return r.rgb||(r.rgb=G("rgb",t)),r.rgb},rgbVal:t,rgbaVal:t,get linearRGB(){return r.linearRGB||(r.linearRGB=G("srgb-linear",S(t))),r.linearRGB},get linearRGBVal(){return r.linearRGBVal||(r.linearRGBVal=S(t)),r.linearRGBVal},get p3(){return r.p3||(r.p3=G("display-p3",t)),r.p3},p3Val:t,get oklab(){return r.oklab||(r.oklab=G("oklab",J(t))),r.oklab},get oklabVal(){return r.oklabVal||(r.oklabVal=J(t)),r.oklabVal},get oklch(){return r.oklch||(r.oklch=G("oklch",Q(t))),r.oklch},get oklchVal(){return r.oklchVal||(r.oklchVal=Q(t)),r.oklchVal},get xyz(){return r.xyz||(r.xyz=G("xyz-d65",Re(S(t)))),r.xyz},get xyzVal(){return r.xyzVal||(r.xyzVal=Re(S(t))),r.xyzVal},adjust(n){return M(Ge(t,n))}};return o.toString=()=>o.hex,o}function Oe(e){if(e>pr)throw new Error("8-digit hex values (with transparency) aren\u2019t supported");let t=e,r=Math.floor(t/le);t-=r*le;let o=Math.floor(t/ue);t-=o*ue;let n=t;return[r/255,o/255,n/255,1]}function B(e,t){let r=e.match(fr);if(!r)throw new Error(`Unexpected color format: ${e}`);let o=[0,0,0,1];for(let n=0;n<r.length;n++)r[n]&&(r[n].includes("%")?o[n]=parseFloat(r[n])/100:!t||t[n]===1/0||t[n]===1?o[n]=parseFloat(r[n]):o[n]=parseFloat(r[n])/t[n]);return o}function dr(e){let t=new Error(`Unable to parse color ${JSON.stringify(e)}`);if(e==null||e==null||typeof e=="boolean")throw t;if(Array.isArray(e)){if(e.some(a=>typeof a!="number"))throw new Error(`Color array must be numbers, received ${e}`);if(e.length<3||e.length>4)throw new Error(`Expected [R, G, B, A?], received ${e}`);let[r,o,n,l]=e;return[g(r,0,1),g(o,0,1),g(n,0,1),typeof l=="number"?g(l,0,1):1]}if(typeof e=="number")return Oe(e);if(typeof e=="string"){let r=e.trim();if(!r)throw new Error("Expected color, received empty string");let o=r.toLowerCase();if(typeof Be[o]=="number")return Oe(Be[o]);if(cr.test(o)){let c=o.replace("#",""),m=[0,0,0,1];if(c.length===6||c.length===8)for(let s=0;s<c.length/2;s++){let p=s*2,y=p+2,u=c.substring(p,y);m[s]=parseInt(u,16)/255}else if(c.length===3||c.length===4)for(let s=0;s<c.length;s++){let p=c.charAt(s);m[s]=parseInt(`${p}${p}`,16)/255}else throw new Error(`Hex value "${o}" not a valid sRGB color`);return m}let n=r.match(mr);if(!n)throw t;let[,l,a]=n;if(l==="color"){let c=a.indexOf(" ");l=a.substring(0,c),a=a.substring(c)}switch(l){case"rgb":case"rgba":case"srgb":{let[c,m,s,p]=B(a,[255,255,255,1]);return[g(c,0,1),g(m,0,1),g(s,0,1),g(p,0,1)]}case"linear-rgb":case"linear-srgb":case"rgb-linear":case"srgb-linear":{let c=B(a);return _(c)}case"hsl":case"hsla":{let[c,m,s,p]=B(a);return ae([c,g(m,0,1),g(s,0,1),g(p,0,1)])}case"hwb":case"hwba":{let[c,m,s,p]=B(a);return Fe([c,g(m,0,1),g(s,0,1),g(p,0,1)])}case"p3":case"display-p3":{let[c,m,s,p]=B(a);return[g(c,0,1),g(m,0,1),g(s,0,1),g(p,0,1)]}case"lab":case"oklab":return P(B(a));case"lch":case"oklch":return Z(B(a));case"xyz":case"xyz-d65":return _(je(B(a)))}}if(typeof e=="object"){let r={...e},o=1;for(let n of Object.keys(r))n==="alpha"?o=g(r[n],0,1):r[n.toLowerCase()]=r[n];if("r"in r&&"g"in r&&"b"in r)return[g(r.r,0,1),g(r.g,0,1),g(r.b,0,1),o];if("h"in r&&"s"in r&&"l"in r)return ae([r.h,g(r.s,0,1),g(r.l,0,1),o]);if("h"in r&&"w"in r&&"b"in r)return Fe([r.h,g(r.w,0,1),g(r.b,0,1),o]);if("l"in r&&"a"in r&&"b"in r)return P([r.l,r.a,r.b,o]);if("l"in r&&"c"in r&&"h"in r)return Z([r.l,r.c,r.h,o]);if("x"in r&&"y"in r&&"z"in r)return _(je([r.x,r.y,r.z,o]));throw t}throw t}function fe(e,t,r=.5,o="oklab"){let n=g(r,0,1);if(r===0)return M(e);if(r===1)return M(t);let l=1-n,a=n,c={oklch:Q,oklab:J,lms:A=>S(Le(A)),linearRGB:S,sRGB:A=>A},m={oklch:Z,oklab:P,lms:A=>X(_(A)),linearRGB:_,sRGB:A=>A},s=c[o],p=m[o];if(!s)throw new Error(`Unknown color space "${o}", try "oklab", "oklch", "linearRGB", or "sRGB"`);let[y,u,i,x]=M(e).rgbVal,[f,d,b,k]=M(t).rgbVal;o==="oklch"&&(y===u&&u===i||f===d&&d===b)&&(s=c.oklab,p=m.oklab);let[R,h,E,w]=s([y,u,i,x]),[O,C,L,U]=s([f,d,b,k]);return o==="oklch"&&Math.abs(L-E)>180&&(Math.max(E,L)===L?L-=360:E-=360),M(p([R*l+O*a,h*l+C*a,E*l+L*a,w*l+U*a]))}function Se(e,t,r="oklab"){let o=g(t,-1,1);return o>=0?fe(e,"black",o,r):_e(e,-o)}function _e(e,t,r="oklab"){let o=g(t,-1,1);return o>=0?fe(e,"white",o,r):Se(e,-o)}function ee(e){return M(e).xyzVal[1]}function hr(e){return z(M(e).oklabVal[0],5)}function gr(e){return ee(e)<.36?"dark":"light"}function br(e,t){let r=ee(e),o=ee(t),n=Math.max(r,o),l=Math.min(r,o),a=(n+.05)/(l+.05);return{ratio:a,AA:a>=4.5,AAA:a>=7}}var Ce={adjust:Ge,contrastRatio:br,darken:Se,from:M,lighten:_e,lightness:hr,lightOrDark:gr,luminance:ee,mix:fe};function F(e,t){if(!e)throw new Error("missing value");if(typeof e=="string"||typeof e=="number")try{return t.convertToHex===!1&&typeof e=="string"?e:Ce.from(e).hex}catch{throw new Error(`invalid color "${e}"`)}throw new Error(`expected string, received ${typeof e}`)}function N(e){if(!e)throw new Error("missing value");if(typeof e=="string")return[e];if(Array.isArray(e)){if(e.every(t=>!!t&&typeof t=="string"))return e;throw new Error("expected array of strings")}throw new Error(`expected string or array of strings, received ${typeof e}`)}var yr=/^\d+(\.\d+)?(ms|s)$/;function I(e){if(typeof e=="number")return`${e}ms`;if(typeof e=="string"){if(parseFloat(e)===0)return"0ms";if(yr.test(e))return e;throw new Error(`invalid duration "${e}"`)}throw new Error(`expected string, received ${typeof e}`)}function v(e){if(typeof e=="number"){if(e===0)return"0";throw new Error("missing units")}if(typeof e=="string")return parseFloat(e)===0?"0":e;throw new Error(`expected string, received ${typeof e}`)}function W(e){if(!e)throw new Error("missing value");if(!Array.isArray(e)||e.length!==4||e.some(t=>typeof t!="number"))throw new Error(`expected [\u{1D465}1, \u{1D466}1, \u{1D465}2, \u{1D466}2], received ${e}`);return[Math.max(0,Math.min(1,e[0])),e[1],Math.max(0,Math.min(1,e[2])),e[3]]}function ce(e){if(!e)throw new Error("missing value");if(typeof e=="string")return e;throw new Error(`expected string, received ${typeof e}`)}var De=new Set(["solid","dashed","dotted","double","groove","ridge","outset","inset"]);function q(e){if(!De.has(e))throw new Error(`Unsupported stroke type "${e}", must be one of:
- ${[...De].join(`
- `)}`);return e}function me(e,t){if(!V(e))throw new Error(`Expected object, received ${Array.isArray(e)?"array":typeof e}`);let r=e;if(!("color"in r))throw new Error('Token missing required "color" property');if(!("width"in r))throw new Error('Token missing required "width" property');if(!("style"in r))throw new Error('Token missing required "style" property');return{color:F(r.color,t.color),width:v(r.width),style:q(r.style)}}var $r=[.25,.1,.25,1];function pe(e){if(!e)throw new Error("missing value");if(typeof e!="object"||Array.isArray(e))throw new Error("invalid transition format, e");if(!Object.keys(e).length)throw new Error("At least 1 transition property is required");let t=e;return{duration:I(t.duration||"0"),delay:I(t.delay||"0"),timingFunction:W(t.timingFunction||$r)}}function de(e,t){if(!e)throw new Error("missing value");if(typeof e!="object"||Array.isArray(e))throw new Error("invalid shadow");let r=e;for(let o of["offsetX","offsetX","blur","spread","color"]){if(typeof r[o]=="number"&&r[o]>0)throw new Error(`${o} missing units`);if((o==="offsetX"||o==="offsetY")&&typeof r[o]!="string"&&r[o]!==0)throw new Error(`missing ${o}`)}return{offsetX:v(r.offsetX||"0"),offsetY:v(r.offsetY||"0"),blur:v(r.blur||"0"),spread:v(r.spread||"0"),color:F(r.color,t.color)}}function he(e,t){if(!e)throw new Error("missing value");if(!Array.isArray(e))throw new Error(`expected array of gradient stops, received ${typeof e}`);if(e.some(r=>!r||!r.color))throw new Error("all gradient stops must have color");return e.map(r=>({color:F(r.color,t.color),position:typeof r.position=="number"?Math.max(0,Math.min(1,r.position)):void 0}))}var Te={thin:100,hairline:100,"extra-light":200,"ultra-light":200,light:300,normal:400,regular:400,book:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,black:900,heavy:900,"extra-black":950,"ultra-black":950};function Y(e){if(!e)throw new Error("missing value");if(typeof e=="number")return e;if(typeof e=="string"&&e in Te)return Te[e];throw new Error(`expected number or font weight alias, received ${e} (${typeof e})`)}function ge(e){if(!e)throw new Error("missing value");if(typeof e!="object"||Array.isArray(e))throw new Error(`expected object, received ${Array.isArray(e)?"array":typeof e}`);if(!Object.keys(e).length)throw new Error("must specify at least 1 font property");let t={};for(let[r,o]of Object.entries(e)){let n=Ve(r);switch(n){case"font":case"fontName":case"fontFamily":{t.fontFamily=N(o);break}case"fontWeight":{t.fontWeight=Y(o);break}default:{t[n]=typeof o=="string"&&parseFloat(o)>=0?v(o):o;break}}}return t}function be(e){if(e==null)throw new Error("missing value");if(typeof e=="number")return e;throw new Error(`expected number, received ${typeof e}`)}function Ie(e){let t=[],r=[],o={};function n(a,c){let m=[...c],s=m.pop(),p=o;for(let y of m)y in p||(p[y]={}),p=p[y];p[s]=a}function l(a,c){if(!(!a||typeof a!="object")){for(let[m,s]of Object.entries(a))if(!m.startsWith("$")){if(s&&typeof s=="object"&&"type"in s&&"value"in s){let p=[...c,m].join("."),y=c[0];if(typeof s.value=="string")s.value.trim().startsWith("{")&&!s.value.trim().startsWith(`{${y}`)&&(s.value=s.value.trim().replace("{",`{${y}.`));else if(s.value&&typeof s.value=="object")for(let[u,i]of Object.entries(s.value))typeof i=="string"&&i.trim().startsWith("{")&&!i.trim().startsWith(`{${y}`)&&(s.value[u]=s.value[u].trim().replace("{",`{${y}.`));switch(s.type){case"border":{n({$type:"border",$value:s.value},[...c,m]);break}case"borderRadius":{if(typeof s.value!="string"){n({$type:"borderRadius",$value:s.value},[...c,m]);break}let u=s.value.split(" ").map(i=>i.trim()).filter(Boolean);if(u.length===1)n({$type:"dimension",$value:s.value.trim()},[...c,m]);else if(u.length===2||u.length===3||u.length===4){r.push(`Token "${p}" is a multi value borderRadius token. Expanding into ${p}TopLeft, ${p}TopRight, ${p}BottomRight, and ${p}BottomLeft.`);let i=[u[0],u[1],u[0],u[1]];u.length===3?i=[u[0],u[1],u[2],u[1]]:u.length===4&&(i=[u[0],u[1],u[2],u[3]]),n({$type:"dimension",$value:i[0]},[...c,`${m}TopLeft`]),n({$type:"dimension",$value:i[1]},[...c,`${m}TopRight`]),n({$type:"dimension",$value:i[2]},[...c,`${m}BottomRight`]),n({$type:"dimension",$value:i[3]},[...c,`${m}BottomLeft`])}else n({$type:"borderRadius",$value:s.value},[...c,m]);break}case"boxShadow":{if(!s.value||typeof s.value!="object"){n({$type:"shadow",$value:s.value},[...c,m]);break}n({$type:"shadow",$value:{offsetX:s.value.x,offsetY:s.value.y,blur:s.value.blur,spread:s.value.spread,color:s.value.color}},[...c,m]);break}case"color":{if(s.value.includes("linear-gradient(")){let u=[],[i,...x]=s.value.replace(")","").split(",");for(let f of x){let[d,b]=f.trim().split(" ");d.includes("$")&&(d=`{${y}.${d.replace("$","")}}`),b.includes("%")?b=parseFloat(b)/100:typeof b=="string"&&b.length&&(b=parseFloat(b)),u.push({color:d,position:b})}n({$type:"gradient",$value:u},[...c,m]);break}n({$type:"color",$value:s.value},[...c,m]);break}case"fontFamilies":{n({$type:"fontFamily",$value:s.value},[...c,m]);break}case"borderWidth":case"dimension":case"fontSizes":case"letterSpacing":case"lineHeights":case"opacity":case"sizing":{typeof s.value=="number"||typeof s.value=="string"&&String(Number(s.value))===s.value?n({$type:"number",$value:Number(s.value)},[...c,m]):n({$type:"dimension",$value:s.value},[...c,m]);break}case"fontWeights":{n({$type:"fontWeight",$value:parseInt(s.value,10)||s.value},[...c,m]);break}case"spacing":{if(typeof s.value!="string"){n({$type:"spacing",$value:s.value},[...c,m]);break}let u=s.value.split(" ").map(i=>i.trim()).filter(Boolean);if(u.length===1)n({$type:"dimension",$value:s.value.trim()},[...c,m]);else if(u.length===2||u.length===3||u.length===4){r.push(`Token "${p}" is a multi value spacing token. Expanding into ${p}Top, ${p}Right, ${p}Bottom, and ${p}Left.`);let i=[u[0],u[1],u[0],u[1]];u.length===3?i=[u[0],u[1],u[2],u[1]]:u.length===4&&(i=[u[0],u[1],u[2],u[3]]),n({$type:"dimension",$value:i[0]},[...c,`${m}Top`]),n({$type:"dimension",$value:i[1]},[...c,`${m}Right`]),n({$type:"dimension",$value:i[2]},[...c,`${m}Bottom`]),n({$type:"dimension",$value:i[3]},[...c,`${m}Left`])}else n({$type:"spacing",$value:s.value},[...c,m]);break}case"textDecoration":case"textCase":break;case"typography":{if(s.value&&typeof s.value=="object"){for(let u of["textCase","textDecoration"])if(u in s.value&&j(s.value[u])){let i=new Set,x=D(s.value[u]).split("."),f=re(e,[...x,"value"])??re(e,[y,...x,"value"]);for(typeof f=="string"&&i.add(f);typeof f=="string"&&j(f);){let d=D(f).split(".");if(f=re(e,[...d,"value"])??re(e,[y,...d,"value"]),typeof f=="string"&&i.has(f)){t.push(`Alias "${s.value[u]}" is a circular reference`),f=void 0;break}typeof f=="string"&&i.add(f)}f?s.value[u]=f:delete s.value[u]}}n({$type:"typography",$value:s.value},[...c,m]);break}}continue}l(s,[...c,m])}}}return l(e,[]),{errors:t.length?t:void 0,warnings:r.length?r:void 0,result:o}}function Ne(e){return!!e&&typeof e=="object"&&"$themes"in e&&Array.isArray(e.$themes)&&"$metadata"in e&&typeof e.$metadata=="object"}function re(e,t){let r=e;for(let o of t){if(!r||typeof r!="object"||!(o in r))break;r=r[o]}return r}var We=new Set(["$description","$name","$type","$value","$extensions"]);function $e(e,t){let r=[],o=[],n={result:{metadata:{},tokens:[]}};if(!e||typeof e!="object"||Array.isArray(e))return r.push(`Invalid schema type. Expected object, received "${Array.isArray(e)?"Array":typeof e}"`),n.errors=r,n;let l=e;if(Ne(e)){let i=Ie(e);r.push(...i.errors??[]),o.push(...i.warnings??[]),l=i.result}let a={};function c(i,x=[],f={$extensions:{requiredModes:[]}}){if(!(!i||!V(i)))for(let[d,b]of Object.entries(i)){if(!b||!V(b)){r.push(`${d}: unexpected token format "${b}"`);continue}if(d.includes(".")||d.includes("{")||d.includes("}")||d.includes("#")){r.push(`${d}: IDs can\u2019t include any of the following: .{}#`);continue}Object.keys(b).length||r.push(`${d}: groups can\u2019t be empty`);let k={_original:H(b),_group:{id:x.join(".")||".",...f||{}},id:x.concat(d).join("."),$type:b.$type||f.$type,...b};if("$value"in k){if(d.startsWith("$")){r.push(`${d}: token ID can\u2019t start with the $ character`);continue}if(Me(k.$value)){r.push(`${k.id}: missing "$value"`);continue}if(k.$extensions&&k.$extensions.mode&&!V(k.$extensions.mode)&&r.push(`${k.id}: "mode" must be an object`),f.$extensions.requiredModes.length)for(let h of f.$extensions.requiredModes)(!k.$extensions||!k.$extensions.mode||!k.$extensions.mode[h])&&r.push(`${k.id}: missing mode "${h}" required from parent group`);a[k.id]=k}else{let h={...f},E={};for(let w of Object.keys(b))w.startsWith("$")?(w==="$extensions"?h.$extensions={...h.$extensions,...b.$extensions}:h[w]=b[w],We.has(w)||(n.warnings||(n.warnings=[]),n.warnings.push(`Unknown property "${w}"`))):E[w]=b[w];if(Object.values(E).every(w=>V(w)))c(E,[...x,d],h);else throw new Error(`${d}: missing $type`)}}}let m={$extensions:{requiredModes:[]}},s={};for(let i of Object.keys(l))i.startsWith("$")?(i==="$extensions"?m.$extensions={...l.$extensions,...m.$extensions}:m[i]=l[i],We.has(i)||(n.warnings||(n.warnings=[]),n.warnings.push(`Unknown property "${i}"`)),n.result.metadata[i]=l[i]):s[i]=l[i];if(c(s,[],m),r.length)return n.errors=r,n;let p={};for(let i of Object.values(a))if(p[i.id]=i.$value,i.$extensions&&i.$extensions.mode)for(let[x,f]of Object.entries(i.$extensions.mode||{}))p[`${i.id}#${x}`]=f;function y(i,x){return oe(x,{default(f){return f},string(f){if(!j(f))return f;let d=D(f);if(!(d in p))throw new Error(`${i}: can\u2019t find ${f}`);let b=p[d];if(typeof b=="string"&&j(b)&&i===D(b))throw new Error(`${i}: can\u2019t reference circular alias ${f}`);return p[d]},array(f){return f.map(d=>y(i,d))},object(f){for(let d of Object.keys(f))f[d]=y(i,f[d]);return f}})}for(;ye(p);)try{for(let[i,x]of Object.entries(p))p[i]=y(i,x)}catch(i){r.push(i.message||i);break}if(r.length)return n.errors=r,n;function u(i,x){let f=a[i];if(!(!f.$extensions||!f.$extensions.mode))for(let d of Object.keys(f.$extensions.mode||{}))a[i].$extensions.mode[d]=x(p[`${i}#${d}`])}for(let[i,x]of Object.entries(a))try{switch(x.$type){case"color":{a[i].$value=F(p[i],t.color),u(i,f=>F(f,t.color));break}case"dimension":{a[i].$value=v(p[i]),u(i,f=>v(f));break}case"font":case"fontFamily":{x.$type==="font"&&console.warn(`${Ae}@cobalt-ui/core${ve} $type: "font" is deprecated. Please use "fontFamily" instead.`),a[i].$value=N(p[i]),u(i,f=>N(f));break}case"fontWeight":{a[i].$value=Y(p[i]),u(i,f=>Y(f));break}case"duration":{a[i].$value=I(p[i]),u(i,f=>I(f));break}case"cubicBezier":{a[i].$value=W(p[i]),u(i,f=>W(f));break}case"number":{a[i].$value=be(p[i]),u(i,f=>be(f));break}case"link":{a[i].$value=ce(p[i]),u(i,f=>ce(f));break}case"strokeStyle":{a[i].$value=q(p[i]),u(i,f=>q(f));break}case"border":{a[i].$value=me(p[i],{color:t.color}),u(i,f=>me(f,{color:t.color}));break}case"transition":{a[i].$value=pe(p[i]),u(i,f=>pe(f));break}case"shadow":{a[i].$value=de(p[i],{color:t.color}),u(i,f=>de(f,{color:t.color}));break}case"gradient":{a[i].$value=he(p[i],{color:t.color}),u(i,f=>he(f,{color:t.color}));break}case"typography":{a[i].$value=ge(p[i]),u(i,f=>ge(f));break}default:{a[i].value=p[i],u(i,f=>f);break}}}catch(f){r.push(`${i}: ${f.message||f}`)}return r.length&&(n.errors=r),o.length&&(n.warnings=o),n.result.tokens=Object.values(a),n}function ye(e){return Object.values(e).some(t=>oe(t,{default:()=>!1,string:r=>j(r),array:r=>r.some(o=>typeof o=="string"?j(o):V(o)?ye(o):!1),object:r=>ye(r)}))}var Ft={parse:$e};export{Ft as default,$e as parse};
var wr=typeof process<"u"?!process.env.NODE_DISABLE_COLORS&&(!process.env.NO_COLOR||process.env.NO_COLOR=="0"):!0,Lr=wr?"\x1B[0m":"";var Rr=wr?"\x1B[33m":"";var tn=["0-9","A-Za-z","\xC0-\xFF","\u0100-\u017F","\u0180-\u024F","\u0370-\u03FF","\u0400-\u04FF","\u0530-\u058F","\u0590-\u05FF","\u0600-\u06FF","\u0900-\u097F","\u1100-\u11FF","\u3040-\u309F","\u30A0-\u30FF","\u3400-\u4DBF","\u4E00-\u9FFF"];var rn=/[^-_.\s][-_.\s]+[^-_.\s]/g,Pi=new RegExp(`^[${tn.join("")}]+$`);function _r(e){return e.length<2?e:e.replace(rn,t=>`${t[0].toLocaleLowerCase()}${t[t.length-1].toLocaleUpperCase()}`)}function qe(e){if(!e||typeof e=="string"||typeof e=="boolean"||typeof e=="number")return e;if(Array.isArray(e)){let r=[];for(let n of e)r.push(qe(n));return r}let t={};for(let[r,n]of Object.entries(e))t[r]=qe(n);return t}var Hr=/^\{([^}]+)\}$/;function pe(e){let t=e.match(Hr);return t?t[1]??t[0]:e}function W(e){return typeof e!="string"?!1:Hr.test(e)}function q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Sr(e){return e==null?!0:typeof e=="string"||Array.isArray(e)?e.length===0:q(e)?Object.keys(e).length===0:!1}function vt(e,t){if(e==null&&t.undefined)return t.undefined(e);if(typeof e=="string"&&t.string)return t.string(e);if(typeof e=="number"&&t.number)return t.number(e);if(Array.isArray(e)&&t.array)return t.array(e);if(q(e)&&t.object)return t.object(e);if(t.default)return t.default(e)}var on=(e,t)=>{if(typeof e=="number"){if(t===3)return{mode:"rgb",r:(e>>8&15|e>>4&240)/255,g:(e>>4&15|e&240)/255,b:(e&15|e<<4&240)/255};if(t===4)return{mode:"rgb",r:(e>>12&15|e>>8&240)/255,g:(e>>8&15|e>>4&240)/255,b:(e>>4&15|e&240)/255,alpha:(e&15|e<<4&240)/255};if(t===6)return{mode:"rgb",r:(e>>16&255)/255,g:(e>>8&255)/255,b:(e&255)/255};if(t===8)return{mode:"rgb",r:(e>>24&255)/255,g:(e>>16&255)/255,b:(e>>8&255)/255,alpha:(e&255)/255}}},De=on;var nn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Xr=nn;var an=e=>De(Xr[e.toLowerCase()],6),Ar=an;var fn=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,ln=e=>{let t;return(t=e.match(fn))?De(parseInt(t[1],16),t[1].length):void 0},Er=ln;var H="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",rf=`(?:${H}|none)`,ie=`${H}%`,of=`(?:${H}%|none)`,ke=`(?:${H}%|${H})`,sn=`(?:${H}%|${H}|none)`,Or=`(?:${H}(deg|grad|rad|turn)|${H})`,nf=`(?:${H}(deg|grad|rad|turn)|${H}|none)`,Z="\\s*,\\s*";var af=new RegExp("^"+sn+"$");var pn=new RegExp(`^rgba?\\(\\s*${H}${Z}${H}${Z}${H}\\s*(?:,\\s*${ke}\\s*)?\\)$`),un=new RegExp(`^rgba?\\(\\s*${ie}${Z}${ie}${Z}${ie}\\s*(?:,\\s*${ke}\\s*)?\\)$`),mn=e=>{let t={mode:"rgb"},r;if(r=e.match(pn))r[1]!==void 0&&(t.r=r[1]/255),r[2]!==void 0&&(t.g=r[2]/255),r[3]!==void 0&&(t.b=r[3]/255);else if(r=e.match(un))r[1]!==void 0&&(t.r=r[1]/100),r[2]!==void 0&&(t.g=r[2]/100),r[3]!==void 0&&(t.b=r[3]/100);else return;return r[4]!==void 0?t.alpha=r[4]/100:r[5]!==void 0&&(t.alpha=+r[5]),t},Nr=mn;var dn=(e,t)=>e===void 0?void 0:typeof e!="object"?$e(e):e.mode!==void 0?e:t?{...e,mode:t}:void 0,Cr=dn;var cn=(e="rgb")=>t=>(t=Cr(t,e))!==void 0?t.mode===e?t:j[t.mode][e]?j[t.mode][e](t):e==="rgb"?j[t.mode].rgb(t):j.rgb[e](j[t.mode].rgb(t)):void 0,ze=cn;var j={},Pr={},we=[],Mt={},bn=e=>e,T=e=>(j[e.mode]={...j[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(t=>{j[t]||(j[t]={}),j[t][e.mode]=e.fromMode[t]}),e.ranges||(e.ranges={}),e.difference||(e.difference={}),e.channels.forEach(t=>{if(e.ranges[t]===void 0&&(e.ranges[t]=[0,1]),!e.interpolate[t])throw new Error(`Missing interpolator for: ${t}`);typeof e.interpolate[t]=="function"&&(e.interpolate[t]={use:e.interpolate[t]}),e.interpolate[t].fixup||(e.interpolate[t].fixup=bn)}),Pr[e.mode]=e,(e.parse||[]).forEach(t=>{hn(t,e.mode)}),ze(e.mode)),Ir=e=>Pr[e],hn=(e,t)=>{if(typeof e=="string"){if(!t)throw new Error("'mode' required when 'parser' is a string");Mt[e]=t}else typeof e=="function"&&we.indexOf(e)<0&&we.push(e)};var Tt=/[^\x00-\x7F]|[a-zA-Z_]/,xn=/[^\x00-\x7F]|[-\w]/,s={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"},x=0;function Fe(e){let t=e[x],r=e[x+1];return t==="-"||t==="+"?/\d/.test(r)||r==="."&&/\d/.test(e[x+2]):t==="."?/\d/.test(r):/\d/.test(t)}function kt(e){if(x>=e.length)return!1;let t=e[x];if(Tt.test(t))return!0;if(t==="-"){if(e.length-x<2)return!1;let r=e[x+1];return!!(r==="-"||Tt.test(r))}return!1}var gn={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function Le(e){let t="";if((e[x]==="-"||e[x]==="+")&&(t+=e[x++]),t+=Ve(e),e[x]==="."&&/\d/.test(e[x+1])&&(t+=e[x++]+Ve(e)),(e[x]==="e"||e[x]==="E")&&((e[x+1]==="-"||e[x+1]==="+")&&/\d/.test(e[x+2])?t+=e[x++]+e[x++]+Ve(e):/\d/.test(e[x+1])&&(t+=e[x++]+Ve(e))),kt(e)){let r=Be(e);return r==="deg"||r==="rad"||r==="turn"||r==="grad"?{type:s.Hue,value:t*gn[r]}:void 0}return e[x]==="%"?(x++,{type:s.Percentage,value:+t}):{type:s.Number,value:+t}}function Ve(e){let t="";for(;/\d/.test(e[x]);)t+=e[x++];return t}function Be(e){let t="";for(;x<e.length&&xn.test(e[x]);)t+=e[x++];return t}function yn(e){let t=Be(e);return e[x]==="("?(x++,{type:s.Function,value:t}):t==="none"?{type:s.None,value:void 0}:{type:s.Ident,value:t}}function vn(e=""){let t=e.trim(),r=[],n;for(x=0;x<t.length;){if(n=t[x++],n===`
`||n===" "||n===" "){for(;x<t.length&&(t[x]===`
`||t[x]===" "||t[x]===" ");)x++;continue}if(n===",")return;if(n===")"){r.push({type:s.ParenClose});continue}if(n==="+"){if(x--,Fe(t)){r.push(Le(t));continue}return}if(n==="-"){if(x--,Fe(t)){r.push(Le(t));continue}if(kt(t)){r.push({type:s.Ident,value:Be(t)});continue}return}if(n==="."){if(x--,Fe(t)){r.push(Le(t));continue}return}if(n==="/"){for(;x<t.length&&(t[x]===`
`||t[x]===" "||t[x]===" ");)x++;let o;if(Fe(t)&&(o=Le(t),o.type!==s.Hue)){r.push({type:s.Alpha,value:o});continue}if(kt(t)&&Be(t)==="none"){r.push({type:s.Alpha,value:{type:s.None,value:void 0}});continue}return}if(/\d/.test(n)){x--,r.push(Le(t));continue}if(Tt.test(n)){x--,r.push(yn(t));continue}return}return r}function Mn(e){e._i=0;let t=e[e._i++];if(!t||t.type!==s.Function||t.value!=="color"||(t=e[e._i++],t.type!==s.Ident))return;let r=Mt[t.value];if(!r)return;let n={mode:r},o=jr(e,!1);if(!o)return;let a=Ir(r).channels;for(let i=0,l;i<a.length;i++)l=o[i],l.type!==s.None&&(n[a[i]]=l.type===s.Number?l.value:l.value/100);return n}function jr(e,t){let r=[],n;for(;e._i<e.length;){if(n=e[e._i++],n.type===s.None||n.type===s.Number||n.type===s.Alpha||n.type===s.Percentage||t&&n.type===s.Hue){r.push(n);continue}if(n.type===s.ParenClose){if(e._i<e.length)return;continue}return}if(!(r.length<3||r.length>4)){if(r.length===4){if(r[3].type!==s.Alpha)return;r[3]=r[3].value}return r.length===3&&r.push({type:s.None,value:void 0}),r.every(o=>o.type!==s.Alpha)?r:void 0}}function Tn(e,t){e._i=0;let r=e[e._i++];if(!r||r.type!==s.Function)return;let n=jr(e,t);if(n)return n.unshift(r.value),n}var kn=e=>{if(typeof e!="string")return;let t=vn(e),r=t?Tn(t,!0):void 0,n,o=0,a=we.length;for(;o<a;)if((n=we[o++](e,r))!==void 0)return n;return t?Mn(t):void 0},$e=kn;function $n(e,t){if(!t||t[0]!=="rgb"&&t[0]!=="rgba")return;let r={mode:"rgb"},[,n,o,a,i]=t;if(!(n.type===s.Hue||o.type===s.Hue||a.type===s.Hue))return n.type!==s.None&&(r.r=n.type===s.Number?n.value/255:n.value/100),o.type!==s.None&&(r.g=o.type===s.Number?o.value/255:o.value/100),a.type!==s.None&&(r.b=a.type===s.Number?a.value/255:a.value/100),i.type!==s.None&&(r.alpha=i.type===s.Number?i.value:i.value/100),r}var qr=$n;var zn=e=>e==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,Dr=zn;var Fr=(e,t,r)=>e+r*(t-e);var wn=e=>{let t=[];for(let r=0;r<e.length-1;r++){let n=e[r],o=e[r+1];n===void 0&&o===void 0?t.push(void 0):n!==void 0&&o!==void 0?t.push([n,o]):t.push(n!==void 0?[n,n]:[o,o])}return t},Vr=e=>t=>{let r=wn(t);return n=>{let o=n*r.length,a=n>=1?r.length-1:Math.max(Math.floor(o),0),i=r[a];return i===void 0?void 0:e(i[0],i[1],o-a)}};var m=Vr(Fr);var v=e=>{let t=!1,r=e.map(n=>n!==void 0?(t=!0,n):1);return t?r:e};var Ln={mode:"rgb",channels:["r","g","b","alpha"],parse:[qr,Er,Nr,Ar,Dr,"srgb"],serialize:"srgb",interpolate:{r:m,g:m,b:m,alpha:{use:m,fixup:v}},gamut:!0},E=Ln;var $t=e=>Math.pow(Math.abs(e),2.19921875)*Math.sign(e),Rn=e=>{let t=$t(e.r),r=$t(e.g),n=$t(e.b),o={mode:"xyz65",x:.5766690429101305*t+.1855582379065463*r+.1882286462349947*n,y:.297344975250536*t+.6273635662554661*r+.0752914584939979*n,z:.0270313613864123*t+.0706888525358272*r+.9913375368376386*n};return e.alpha!==void 0&&(o.alpha=e.alpha),o},zt=Rn;var wt=e=>Math.pow(Math.abs(e),.4547069271758437)*Math.sign(e),_n=({x:e,y:t,z:r,alpha:n})=>{let o={mode:"a98",r:wt(e*2.0415879038107465-t*.5650069742788597-.3447313507783297*r),g:wt(e*-.9692436362808798+t*1.8759675015077206+.0415550574071756*r),b:wt(e*.0134442806320312-t*.1183623922310184+1.0151749943912058*r)};return n!==void 0&&(o.alpha=n),o},Lt=_n;var Rt=e=>{let t=Math.abs(e);return t<.04045?e/12.92:(Math.sign(e)||1)*Math.pow((t+.055)/1.055,2.4)},Hn=({r:e,g:t,b:r,alpha:n})=>{let o={mode:"lrgb",r:Rt(e),g:Rt(t),b:Rt(r)};return n!==void 0&&(o.alpha=n),o},O=Hn;var Sn=e=>{let{r:t,g:r,b:n,alpha:o}=O(e),a={mode:"xyz65",x:.4123907992659593*t+.357584339383878*r+.1804807884018343*n,y:.2126390058715102*t+.715168678767756*r+.0721923153607337*n,z:.0193308187155918*t+.119194779794626*r+.9505321522496607*n};return o!==void 0&&(a.alpha=o),a},N=Sn;var _t=e=>{let t=Math.abs(e);return t>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(t,.4166666666666667)-.055):e*12.92},Xn=({r:e,g:t,b:r,alpha:n},o="rgb")=>{let a={mode:o,r:_t(e),g:_t(t),b:_t(r)};return n!==void 0&&(a.alpha=n),a},C=Xn;var An=({x:e,y:t,z:r,alpha:n})=>{let o=C({r:e*3.2409699419045226-t*1.537383177570094-.4986107602930034*r,g:e*-.9692436362808796+t*1.8759675015077204+.0415550574071756*r,b:e*.0556300796969936-t*.2039769588889765+1.0569715142428784*r});return n!==void 0&&(o.alpha=n),o},P=An;var En={...E,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>Lt(N(e)),xyz65:Lt},toMode:{rgb:e=>P(zt(e)),xyz65:zt}},Br=En;var On=e=>(e=e%360)<0?e+360:e,k=On;var Nn=(e,t)=>e.map((r,n,o)=>{if(r===void 0)return r;let a=k(r);return n===0||e[n-1]===void 0?a:t(a-k(o[n-1]))}).reduce((r,n)=>!r.length||n===void 0||r[r.length-1]===void 0?(r.push(n),r):(r.push(n+r[r.length-1]),r),[]),L=e=>Nn(e,t=>Math.abs(t)<=180?t:t-360*Math.sign(t));var w=[-.14861,1.78277,-.29227,-.90649,1.97294,0],Gr=Math.PI/180,Yr=180/Math.PI;var Jr=w[3]*w[4],Wr=w[1]*w[4],Zr=w[1]*w[2]-w[0]*w[3],Cn=({r:e,g:t,b:r,alpha:n})=>{let o=(Zr*r+e*Jr-t*Wr)/(Zr+Jr-Wr),a=r-o,i=(w[4]*(t-o)-w[2]*a)/w[3],l={mode:"cubehelix",l:o,s:o===0||o===1?void 0:Math.sqrt(a*a+i*i)/(w[4]*o*(1-o))};return l.s&&(l.h=Math.atan2(i,a)*Yr-120),n!==void 0&&(l.alpha=n),l},Kr=Cn;var Pn=({h:e,s:t,l:r,alpha:n})=>{let o={mode:"rgb"};e=(e===void 0?0:e+120)*Gr;let a=t===void 0?0:t*r*(1-r),i=Math.cos(e),l=Math.sin(e);return o.r=r+a*(w[0]*i+w[1]*l),o.g=r+a*(w[2]*i+w[3]*l),o.b=r+a*(w[4]*i+w[5]*l),n!==void 0&&(o.alpha=n),o},Ur=Pn;var K=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.s||!t.s)return 0;let r=k(e.h),n=k(t.h),o=Math.sin((n-r+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*t.s)*o},Qr=(e,t)=>{if(e.h===void 0||t.h===void 0)return 0;let r=k(e.h),n=k(t.h);return Math.abs(n-r)>180?r-(n-360*Math.sign(n-r)):n-r},U=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.c||!t.c)return 0;let r=k(e.h),n=k(t.h),o=Math.sin((n-r+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*t.c)*o};var R=e=>{let t=e.reduce((r,n)=>{if(n!==void 0){let o=n*Math.PI/180;r.sin+=Math.sin(o),r.cos+=Math.cos(o)}return r},{sin:0,cos:0});return Math.atan2(t.sin,t.cos)*180/Math.PI};var In={mode:"cubehelix",channels:["h","s","l","alpha"],parse:["--cubehelix"],serialize:"--cubehelix",ranges:{h:[0,360],s:[0,4.614],l:[0,1]},fromMode:{rgb:Kr},toMode:{rgb:Ur},interpolate:{h:{use:m,fixup:L},s:m,l:m,alpha:{use:m,fixup:v}},difference:{h:K},average:{h:R}},eo=In;var jn=({l:e,a:t,b:r,alpha:n},o="lch")=>{let a=Math.sqrt(t*t+r*r),i={mode:o,l:e,c:a};return a&&(i.h=k(Math.atan2(r,t)*180/Math.PI)),n!==void 0&&(i.alpha=n),i},X=jn;var qn=({l:e,c:t,h:r,alpha:n},o="lab")=>{let a={mode:o,l:e,a:t?t*Math.cos(r/180*Math.PI):0,b:t?t*Math.sin(r/180*Math.PI):0};return n!==void 0&&(a.alpha=n),a},A=qn;var Ge=Math.pow(29,3)/Math.pow(3,3),Ye=Math.pow(6,3)/Math.pow(29,3);var $={X:.9642956764295677,Y:1,Z:.8251046025104602},Q={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329},y0=Math.pow(29,3)/Math.pow(3,3),v0=Math.pow(6,3)/Math.pow(29,3);var Ht=e=>Math.pow(e,3)>Ye?Math.pow(e,3):(116*e-16)/Ge,Dn=({l:e,a:t,b:r,alpha:n})=>{let o=(e+16)/116,a=t/500+o,i=o-r/200,l={mode:"xyz65",x:Ht(a)*Q.X,y:Ht(o)*Q.Y,z:Ht(i)*Q.Z};return n!==void 0&&(l.alpha=n),l},Je=Dn;var Fn=e=>P(Je(e)),ee=Fn;var St=e=>e>Ye?Math.cbrt(e):(Ge*e+16)/116,Vn=({x:e,y:t,z:r,alpha:n})=>{let o=St(e/Q.X),a=St(t/Q.Y),i=St(r/Q.Z),l={mode:"lab65",l:116*a-16,a:500*(o-a),b:200*(a-i)};return n!==void 0&&(l.alpha=n),l},We=Vn;var Bn=e=>{let t=We(N(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},te=Bn;var fe=.14444444444444443*Math.PI,ue=Math.cos(fe),me=Math.sin(fe),Ze=100/Math.log(139/100);var Gn=({l:e,c:t,h:r,alpha:n})=>{let o={mode:"lab65",l:(Math.exp(e*1/Ze)-1)/.0039};if(r===void 0)o.a=o.b=0;else{let a=(Math.exp(.0435*t*1*1)-1)/.075,i=a*Math.cos(r/180*Math.PI-fe),l=a*Math.sin(r/180*Math.PI-fe);o.a=i*ue-l/.83*me,o.b=i*me+l/.83*ue}return n!==void 0&&(o.alpha=n),o},_e=Gn;var Yn=({l:e,a:t,b:r,alpha:n})=>{let o=t*ue+r*me,a=.83*(r*ue-t*me),i=Math.sqrt(o*o+a*a),l={mode:"dlch",l:Ze/1*Math.log(1+.0039*e),c:Math.log(1+.075*i)/(.0435*1*1)};return l.c&&(l.h=k((Math.atan2(a,o)+fe)/Math.PI*180)),n!==void 0&&(l.alpha=n),l},He=Yn;var to=e=>_e(X(e,"dlch")),ro=e=>A(He(e),"dlab"),Jn={mode:"dlab",parse:["--din99o-lab"],serialize:"--din99o-lab",toMode:{lab65:to,rgb:e=>ee(to(e))},fromMode:{lab65:ro,rgb:e=>ro(te(e))},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-40.09,45.501],b:[-40.469,44.344]},interpolate:{l:m,a:m,b:m,alpha:{use:m,fixup:v}}},oo=Jn;var Wn={mode:"dlch",parse:["--din99o-lch"],serialize:"--din99o-lch",toMode:{lab65:_e,dlab:e=>A(e,"dlab"),rgb:e=>ee(_e(e))},fromMode:{lab65:He,dlab:e=>X(e,"dlch"),rgb:e=>He(te(e))},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,51.484],h:[0,360]},interpolate:{l:m,c:m,h:{use:m,fixup:L},alpha:{use:m,fixup:v}},difference:{h:U},average:{h:R}},no=Wn;function At({h:e,s:t,i:r,alpha:n}){e=k(e);let o=Math.abs(e/60%2-1),a;switch(Math.floor(e/60)){case 0:a={r:r*(1+t*(3/(2-o)-1)),g:r*(1+t*(3*(1-o)/(2-o)-1)),b:r*(1-t)};break;case 1:a={r:r*(1+t*(3*(1-o)/(2-o)-1)),g:r*(1+t*(3/(2-o)-1)),b:r*(1-t)};break;case 2:a={r:r*(1-t),g:r*(1+t*(3/(2-o)-1)),b:r*(1+t*(3*(1-o)/(2-o)-1))};break;case 3:a={r:r*(1-t),g:r*(1+t*(3*(1-o)/(2-o)-1)),b:r*(1+t*(3/(2-o)-1))};break;case 4:a={r:r*(1+t*(3*(1-o)/(2-o)-1)),g:r*(1-t),b:r*(1+t*(3/(2-o)-1))};break;case 5:a={r:r*(1+t*(3/(2-o)-1)),g:r*(1-t),b:r*(1+t*(3*(1-o)/(2-o)-1))};break;default:a={r:r*(1-t),g:r*(1-t),b:r*(1-t)}}return a.mode="rgb",n!==void 0&&(a.alpha=n),a}function Et({r:e,g:t,b:r,alpha:n}){let o=Math.max(e,t,r),a=Math.min(e,t,r),i={mode:"hsi",s:e+t+r===0?0:1-3*a/(e+t+r),i:(e+t+r)/3};return o-a!==0&&(i.h=(o===e?(t-r)/(o-a)+(t<r)*6:o===t?(r-e)/(o-a)+2:(e-t)/(o-a)+4)*60),n!==void 0&&(i.alpha=n),i}var Zn={mode:"hsi",toMode:{rgb:At},parse:["--hsi"],serialize:"--hsi",fromMode:{rgb:Et},channels:["h","s","i","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:m,fixup:L},s:m,i:m,alpha:{use:m,fixup:v}},difference:{h:K},average:{h:R}},ao=Zn;function Ot({h:e,s:t,l:r,alpha:n}){e=k(e);let o=r+t*(r<.5?r:1-r),a=o-(o-r)*2*Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:o,g:a,b:2*r-o};break;case 1:i={r:a,g:o,b:2*r-o};break;case 2:i={r:2*r-o,g:o,b:a};break;case 3:i={r:2*r-o,g:a,b:o};break;case 4:i={r:a,g:2*r-o,b:o};break;case 5:i={r:o,g:2*r-o,b:a};break;default:i={r:2*r-o,g:2*r-o,b:2*r-o}}return i.mode="rgb",n!==void 0&&(i.alpha=n),i}function Nt({r:e,g:t,b:r,alpha:n}){let o=Math.max(e,t,r),a=Math.min(e,t,r),i={mode:"hsl",s:o===a?0:(o-a)/(1-Math.abs(o+a-1)),l:.5*(o+a)};return o-a!==0&&(i.h=(o===e?(t-r)/(o-a)+(t<r)*6:o===t?(r-e)/(o-a)+2:(e-t)/(o-a)+4)*60),n!==void 0&&(i.alpha=n),i}var Kn=(e,t)=>{switch(t){case"deg":return+e;case"rad":return e/Math.PI*180;case"grad":return e/10*9;case"turn":return e*360}},io=Kn;var Un=new RegExp(`^hsla?\\(\\s*${Or}${Z}${ie}${Z}${ie}\\s*(?:,\\s*${ke}\\s*)?\\)$`),Qn=e=>{let t=e.match(Un);if(!t)return;let r={mode:"hsl"};return t[3]!==void 0?r.h=+t[3]:t[1]!==void 0&&t[2]!==void 0&&(r.h=io(t[1],t[2])),t[4]!==void 0&&(r.s=Math.min(Math.max(0,t[4]/100),1)),t[5]!==void 0&&(r.l=Math.min(Math.max(0,t[5]/100),1)),t[6]!==void 0?r.alpha=t[6]/100:t[7]!==void 0&&(r.alpha=+t[7]),r},fo=Qn;function ea(e,t){if(!t||t[0]!=="hsl"&&t[0]!=="hsla")return;let r={mode:"hsl"},[,n,o,a,i]=t;if(n.type!==s.None){if(n.type===s.Percentage)return;r.h=n.value}if(o.type!==s.None){if(o.type===s.Hue)return;r.s=o.type===s.Number?o.value:o.value/100}if(a.type!==s.None){if(a.type===s.Hue)return;r.l=a.type===s.Number?a.value:a.value/100}return i.type!==s.None&&(r.alpha=i.type===s.Number?i.value:i.value/100),r}var lo=ea;var ta={mode:"hsl",toMode:{rgb:Ot},fromMode:{rgb:Nt},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[lo,fo],serialize:e=>`hsl(${e.h||0} ${e.s!==void 0?e.s*100+"%":"none"} ${e.l!==void 0?e.l*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:m,fixup:L},s:m,l:m,alpha:{use:m,fixup:v}},difference:{h:K},average:{h:R}},Ke=ta;function Se({h:e,s:t,v:r,alpha:n}){e=k(e);let o=Math.abs(e/60%2-1),a;switch(Math.floor(e/60)){case 0:a={r,g:r*(1-t*o),b:r*(1-t)};break;case 1:a={r:r*(1-t*o),g:r,b:r*(1-t)};break;case 2:a={r:r*(1-t),g:r,b:r*(1-t*o)};break;case 3:a={r:r*(1-t),g:r*(1-t*o),b:r};break;case 4:a={r:r*(1-t*o),g:r*(1-t),b:r};break;case 5:a={r,g:r*(1-t),b:r*(1-t*o)};break;default:a={r:r*(1-t),g:r*(1-t),b:r*(1-t)}}return a.mode="rgb",n!==void 0&&(a.alpha=n),a}function Xe({r:e,g:t,b:r,alpha:n}){let o=Math.max(e,t,r),a=Math.min(e,t,r),i={mode:"hsv",s:o===0?0:1-a/o,v:o};return o-a!==0&&(i.h=(o===e?(t-r)/(o-a)+(t<r)*6:o===t?(r-e)/(o-a)+2:(e-t)/(o-a)+4)*60),n!==void 0&&(i.alpha=n),i}var ra={mode:"hsv",toMode:{rgb:Se},parse:["--hsv"],serialize:"--hsv",fromMode:{rgb:Xe},channels:["h","s","v","alpha"],ranges:{h:[0,360]},gamut:"rgb",interpolate:{h:{use:m,fixup:L},s:m,v:m,alpha:{use:m,fixup:v}},difference:{h:K},average:{h:R}},Ue=ra;function Ct({h:e,w:t,b:r,alpha:n}){if(t+r>1){let o=t+r;t/=o,r/=o}return Se({h:e,s:r===1?1:1-t/(1-r),v:1-r,alpha:n})}function Pt(e){let t=Xe(e);if(t===void 0)return;let r={mode:"hwb",w:(1-t.s)*t.v,b:1-t.v};return t.h!==void 0&&(r.h=t.h),t.alpha!==void 0&&(r.alpha=t.alpha),r}function oa(e,t){if(!t||t[0]!=="hwb")return;let r={mode:"hwb"},[,n,o,a,i]=t;if(n.type!==s.None){if(n.type===s.Percentage)return;r.h=n.value}if(o.type!==s.None){if(o.type===s.Hue)return;r.w=o.type===s.Number?o.value:o.value/100}if(a.type!==s.None){if(a.type===s.Hue)return;r.b=a.type===s.Number?a.value:a.value/100}return i.type!==s.None&&(r.alpha=i.type===s.Number?i.value:i.value/100),r}var so=oa;var na={mode:"hwb",toMode:{rgb:Ct},fromMode:{rgb:Pt},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[so],serialize:e=>`hwb(${e.h||0} ${e.w*100}% ${e.b*100}%${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:m,fixup:L},w:m,b:m,alpha:{use:m,fixup:v}},difference:{h:Qr},average:{h:R}},po=na;var aa=.1593017578125,ia=134.03437499999998,fa=.8359375,la=18.8515625,sa=18.6875,pa=16295499532821565e-27,It=e=>{let t=Math.pow(e/1e4,aa);return Math.pow((fa+la*t)/(1+sa*t),ia)||0},jt=e=>Math.max(e*203,0),ua=({x:e,y:t,z:r,alpha:n})=>{e=jt(e),t=jt(t),r=jt(r);let o=1.15*e-.15*r,a=.66*t+.34*e,i=It(.41478972*o+.579999*a+.014648*r),l=It(-.20151*o+1.120649*a+.0531008*r),b=It(-.0166008*o+.2648*a+.6684799*r),p=(i+l)/2,c={mode:"jab",j:.44*p/(1-.56*p)-pa,a:3.524*i-4.066708*l+.542708*b,b:.199076*i+1.096799*l-1.295875*b};return n!==void 0&&(c.alpha=n),c},Qe=ua;var ma=.1593017578125,da=134.03437499999998,ca=.8359375,ba=18.8515625,ha=18.6875,uo=16295499532821565e-27,qt=e=>{let t=Math.pow(e,1/da);return 1e4*Math.pow((ca-t)/(ha*t-ba),1/ma)||0},Dt=e=>e/203,xa=({j:e,a:t,b:r,alpha:n})=>{let o=(e+uo)/(.44+.56*(e+uo)),a=qt(o+.13860504*t+.058047316*r),i=qt(o-.13860504*t-.058047316*r),l=qt(o-.096019242*t-.8118919*r),b={mode:"xyz65",x:Dt(1.661373024652174*a-.914523081304348*i+.23136208173913045*l),y:Dt(-.3250758611844533*a+1.571847026732543*i-.21825383453227928*l),z:Dt(-.090982811*a-.31272829*i+1.5227666*l)};return n!==void 0&&(b.alpha=n),b},et=xa;var ga=e=>{let t=Qe(N(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},tt=ga;var ya=e=>P(et(e)),rt=ya;var va={mode:"jab",channels:["j","a","b","alpha"],parse:["--jzazbz"],serialize:"--jzazbz",fromMode:{rgb:tt,xyz65:Qe},toMode:{rgb:rt,xyz65:et},ranges:{j:[0,.222],a:[-.109,.129],b:[-.185,.134]},interpolate:{j:m,a:m,b:m,alpha:{use:m,fixup:v}}},mo=va;var Ma=({j:e,a:t,b:r,alpha:n})=>{let o=Math.sqrt(t*t+r*r),a={mode:"jch",j:e,c:o};return o&&(a.h=k(Math.atan2(r,t)*180/Math.PI)),n!==void 0&&(a.alpha=n),a},Ft=Ma;var Ta=({j:e,c:t,h:r,alpha:n})=>{let o={mode:"jab",j:e,a:t?t*Math.cos(r/180*Math.PI):0,b:t?t*Math.sin(r/180*Math.PI):0};return n!==void 0&&(o.alpha=n),o},Vt=Ta;var ka={mode:"jch",parse:["--jzczhz"],serialize:"--jzczhz",toMode:{jab:Vt,rgb:e=>rt(Vt(e))},fromMode:{rgb:e=>Ft(tt(e)),jab:Ft},channels:["j","c","h","alpha"],ranges:{j:[0,.221],c:[0,.19],h:[0,360]},interpolate:{h:{use:m,fixup:L},c:m,j:m,alpha:{use:m,fixup:v}},difference:{h:U},average:{h:R}},co=ka;var re=Math.pow(29,3)/Math.pow(3,3),de=Math.pow(6,3)/Math.pow(29,3);var Bt=e=>Math.pow(e,3)>de?Math.pow(e,3):(116*e-16)/re,$a=({l:e,a:t,b:r,alpha:n})=>{let o=(e+16)/116,a=t/500+o,i=o-r/200,l={mode:"xyz50",x:Bt(a)*$.X,y:Bt(o)*$.Y,z:Bt(i)*$.Z};return n!==void 0&&(l.alpha=n),l},ce=$a;var za=({x:e,y:t,z:r,alpha:n})=>{let o=C({r:e*3.1341359569958707-t*1.6173863321612538-.4906619460083532*r,g:e*-.978795502912089+t*1.916254567259524+.03344273116131949*r,b:e*.07195537988411677-t*.2289768264158322+1.405386058324125*r});return n!==void 0&&(o.alpha=n),o},D=za;var wa=e=>D(ce(e)),ot=wa;var La=e=>{let{r:t,g:r,b:n,alpha:o}=O(e),a={mode:"xyz50",x:.436065742824811*t+.3851514688337912*r+.14307845442264197*n,y:.22249319175623702*t+.7168870538238823*r+.06061979053616537*n,z:.013923904500943465*t+.09708128566574634*r+.7140993584005155*n};return o!==void 0&&(a.alpha=o),a},F=La;var Gt=e=>e>de?Math.cbrt(e):(re*e+16)/116,Ra=({x:e,y:t,z:r,alpha:n})=>{let o=Gt(e/$.X),a=Gt(t/$.Y),i=Gt(r/$.Z),l={mode:"lab",l:116*a-16,a:500*(o-a),b:200*(a-i)};return n!==void 0&&(l.alpha=n),l},be=Ra;var _a=e=>{let t=be(F(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},nt=_a;function Ha(e,t){if(!t||t[0]!=="lab")return;let r={mode:"lab"},[,n,o,a,i]=t;if(!(n.type===s.Hue||o.type===s.Hue||a.type===s.Hue))return n.type!==s.None&&(r.l=n.value),o.type!==s.None&&(r.a=o.type===s.Number?o.value:o.value*125/100),a.type!==s.None&&(r.b=a.type===s.Number?a.value:a.value*125/100),i.type!==s.None&&(r.alpha=i.type===s.Number?i.value:i.value/100),r}var bo=Ha;var Sa={mode:"lab",toMode:{xyz50:ce,rgb:ot},fromMode:{xyz50:be,rgb:nt},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-100,100],b:[-100,100]},parse:[bo],serialize:e=>`lab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{l:m,a:m,b:m,alpha:{use:m,fixup:v}}},he=Sa;var Xa={...he,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:Je,rgb:ee},fromMode:{xyz65:We,rgb:te},ranges:{l:[0,100],a:[-86.182,98.234],b:[-107.86,94.477]}},ho=Xa;function Aa(e,t){if(!t||t[0]!=="lch")return;let r={mode:"lch"},[,n,o,a,i]=t;if(n.type!==s.None){if(n.type===s.Hue)return;r.l=n.value}if(o.type!==s.None&&(r.c=Math.max(0,o.type===s.Number?o.value:o.value*150/100)),a.type!==s.None){if(a.type===s.Percentage)return;r.h=a.value}return i.type!==s.None&&(r.alpha=i.type===s.Number?i.value:i.value/100),r}var xo=Aa;var Ea={mode:"lch",toMode:{lab:A,rgb:e=>ot(A(e))},fromMode:{rgb:e=>X(nt(e)),lab:X},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[xo],serialize:e=>`lch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h||0}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:m,fixup:L},c:m,l:m,alpha:{use:m,fixup:v}},difference:{h:U},average:{h:R}},xe=Ea;var Oa={...xe,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>A(e,"lab65"),rgb:e=>ee(A(e,"lab65"))},fromMode:{rgb:e=>X(te(e),"lch65"),lab65:e=>X(e,"lch65")},ranges:{l:[0,100],c:[0,133.807],h:[0,360]}},go=Oa;var Na=({l:e,u:t,v:r,alpha:n})=>{let o=Math.sqrt(t*t+r*r),a={mode:"lchuv",l:e,c:o};return o&&(a.h=k(Math.atan2(r,t)*180/Math.PI)),n!==void 0&&(a.alpha=n),a},Yt=Na;var Ca=({l:e,c:t,h:r,alpha:n})=>{let o={mode:"luv",l:e,u:t?t*Math.cos(r/180*Math.PI):0,v:t?t*Math.sin(r/180*Math.PI):0};return n!==void 0&&(o.alpha=n),o},Jt=Ca;var yo=(e,t,r)=>4*e/(e+15*t+3*r),vo=(e,t,r)=>9*t/(e+15*t+3*r),Pa=yo($.X,$.Y,$.Z),Ia=vo($.X,$.Y,$.Z),ja=e=>e<=de?re*e:116*Math.cbrt(e)-16,qa=({x:e,y:t,z:r,alpha:n})=>{let o=ja(t/$.Y),a=yo(e,t,r),i=vo(e,t,r);!isFinite(a)||!isFinite(i)?o=a=i=0:(a=13*o*(a-Pa),i=13*o*(i-Ia));let l={mode:"luv",l:o,u:a,v:i};return n!==void 0&&(l.alpha=n),l},Ae=qa;var Da=(e,t,r)=>4*e/(e+15*t+3*r),Fa=(e,t,r)=>9*t/(e+15*t+3*r),Va=Da($.X,$.Y,$.Z),Ba=Fa($.X,$.Y,$.Z),Ga=({l:e,u:t,v:r,alpha:n})=>{let o=t/(13*e)+Va,a=r/(13*e)+Ba,i=$.Y*(e<=8?e/re:Math.pow((e+16)/116,3)),l=i*(9*o)/(4*a),b=i*(12-3*o-20*a)/(4*a),p={mode:"xyz50",x:l,y:i,z:b};return n!==void 0&&(p.alpha=n),p},Ee=Ga;var Ya=e=>Yt(Ae(F(e))),Ja=e=>D(Ee(Jt(e))),Wa={mode:"lchuv",toMode:{luv:Jt,rgb:Ja},fromMode:{rgb:Ya,luv:Yt},channels:["l","c","h","alpha"],parse:["--lchuv"],serialize:"--lchuv",ranges:{l:[0,100],c:[0,176.956],h:[0,360]},interpolate:{h:{use:m,fixup:L},c:m,l:m,alpha:{use:m,fixup:v}},difference:{h:U},average:{h:R}},Mo=Wa;var Za={...E,mode:"lrgb",toMode:{rgb:C},fromMode:{rgb:O},parse:["srgb-linear"],serialize:"srgb-linear"},To=Za;var Ka={mode:"luv",toMode:{xyz50:Ee,rgb:e=>D(Ee(e))},fromMode:{xyz50:Ae,rgb:e=>Ae(F(e))},channels:["l","u","v","alpha"],parse:["--luv"],serialize:"--luv",ranges:{l:[0,100],u:[-84.936,175.042],v:[-125.882,87.243]},interpolate:{l:m,u:m,v:m,alpha:{use:m,fixup:v}}},ko=Ka;var Ua=({r:e,g:t,b:r,alpha:n})=>{let o=Math.cbrt(.41222147079999993*e+.5363325363*t+.0514459929*r),a=Math.cbrt(.2119034981999999*e+.6806995450999999*t+.1073969566*r),i=Math.cbrt(.08830246189999998*e+.2817188376*t+.6299787005000002*r),l={mode:"oklab",l:.2104542553*o+.793617785*a-.0040720468*i,a:1.9779984951*o-2.428592205*a+.4505937099*i,b:.0259040371*o+.7827717662*a-.808675766*i};return n!==void 0&&(l.alpha=n),l},at=Ua;var Qa=e=>{let t=at(O(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},oe=Qa;var ei=({l:e,a:t,b:r,alpha:n})=>{let o=Math.pow(e*.9999999984505198+.39633779217376786*t+.2158037580607588*r,3),a=Math.pow(e*1.0000000088817609-.10556134232365635*t-.06385417477170591*r,3),i=Math.pow(e*1.0000000546724108-.08948418209496575*t-1.2914855378640917*r,3),l={mode:"lrgb",r:4.076741661347994*o-3.307711590408193*a+.230969928729428*i,g:-1.2684380040921763*o+2.6097574006633715*a-.3413193963102197*i,b:-.004196086541837188*o-.7034186144594493*a+1.7076147009309444*i};return n!==void 0&&(l.alpha=n),l},V=ei;var ti=e=>C(V(e)),ne=ti;function Oe(e){let n=1.170873786407767;return .5*(n*e-.206+Math.sqrt((n*e-.206)*(n*e-.206)+4*.03*n*e))}function le(e){let n=1.170873786407767;return(e*e+.206*e)/(n*(e+.03))}function ri(e,t){let r,n,o,a,i,l,b,p;-1.88170328*e-.80936493*t>1?(r=1.19086277,n=1.76576728,o=.59662641,a=.75515197,i=.56771245,l=4.0767416621,b=-3.3077115913,p=.2309699292):1.81444104*e-1.19445276*t>1?(r=.73956515,n=-.45954404,o=.08285427,a=.1254107,i=.14503204,l=-1.2684380046,b=2.6097574011,p=-.3413193965):(r=1.35733652,n=-.00915799,o=-1.1513021,a=-.50559606,i=.00692167,l=-.0041960863,b=-.7034186147,p=1.707614701);let c=r+n*e+o*t+a*e*e+i*e*t,y=.3963377774*e+.2158037573*t,d=-.1055613458*e-.0638541728*t,f=-.0894841775*e-1.291485548*t;{let g=1+c*y,u=1+c*d,h=1+c*f,M=g*g*g,z=u*u*u,B=h*h*h,S=3*y*g*g,G=3*d*u*u,_=3*f*h*h,ye=6*y*y*g,ve=6*d*d*u,Me=6*f*f*h,se=l*M+b*z+p*B,ae=l*S+b*G+p*_,Te=l*ye+b*ve+p*Me;c=c-se*ae/(ae*ae-.5*se*Te)}return c}function Wt(e,t){let r=ri(e,t),n=V({l:1,a:r*e,b:r*t}),o=Math.cbrt(1/Math.max(n.r,n.g,n.b)),a=o*r;return[o,a]}function oi(e,t,r,n,o,a=null){a||(a=Wt(e,t));let i;if((r-o)*a[1]-(a[0]-o)*n<=0)i=a[1]*o/(n*a[0]+a[1]*(o-r));else{i=a[1]*(o-1)/(n*(a[0]-1)+a[1]*(o-r));{let l=r-o,b=n,p=.3963377774*e+.2158037573*t,c=-.1055613458*e-.0638541728*t,y=-.0894841775*e-1.291485548*t,d=l+b*p,f=l+b*c,g=l+b*y;{let u=o*(1-i)+i*r,h=i*n,M=u+h*p,z=u+h*c,B=u+h*y,S=M*M*M,G=z*z*z,_=B*B*B,ye=3*d*M*M,ve=3*f*z*z,Me=3*g*B*B,se=6*d*d*M,ae=6*f*f*z,Te=6*g*g*B,vr=4.0767416621*S-3.3077115913*G+.2309699292*_-1,ct=4.0767416621*ye-3.3077115913*ve+.2309699292*Me,Uo=4.0767416621*se-3.3077115913*ae+.2309699292*Te,Mr=ct/(ct*ct-.5*vr*Uo),bt=-vr*Mr,Tr=-1.2684380046*S+2.6097574011*G-.3413193965*_-1,ht=-1.2684380046*ye+2.6097574011*ve-.3413193965*Me,Qo=-1.2684380046*se+2.6097574011*ae-.3413193965*Te,kr=ht/(ht*ht-.5*Tr*Qo),xt=-Tr*kr,$r=-.0041960863*S-.7034186147*G+1.707614701*_-1,gt=-.0041960863*ye-.7034186147*ve+1.707614701*Me,en=-.0041960863*se-.7034186147*ae+1.707614701*Te,zr=gt/(gt*gt-.5*$r*en),yt=-$r*zr;bt=Mr>=0?bt:1e6,xt=kr>=0?xt:1e6,yt=zr>=0?yt:1e6,i+=Math.min(bt,Math.min(xt,yt))}}}return i}function Ne(e,t,r=null){r||(r=Wt(e,t));let n=r[0],o=r[1];return[o/n,o/(1-n)]}function it(e,t,r){let n=Wt(t,r),o=oi(t,r,e,1,e,n),a=Ne(t,r,n),i=.11516993+1/(7.4477897+4.1590124*r+t*(-2.19557347+1.75198401*r+t*(-2.13704948-10.02301043*r+t*(-4.24894561+5.38770819*r+4.69891013*t)))),l=.11239642+1/(1.6132032-.68124379*r+t*(.40370612+.90148123*r+t*(-.27087943+.6122399*r+t*(.00299215-.45399568*r-.14661872*t)))),b=o/Math.min(e*a[0],(1-e)*a[1]),p=e*i,c=(1-e)*l,y=.9*b*Math.sqrt(Math.sqrt(1/(1/(p*p*p*p)+1/(c*c*c*c))));return p=e*.4,c=(1-e)*.8,[Math.sqrt(1/(1/(p*p)+1/(c*c))),y,o]}function ft(e){let t={mode:"okhsl",l:Oe(e.l)};e.alpha!==void 0&&(t.alpha=e.alpha);let r=Math.sqrt(e.a*e.a+e.b*e.b);if(!r)return t.s=0,t;let[n,o,a]=it(e.l,e.a/r,e.b/r),i;if(r<o){let l=0,b=.8*n,p=1-b/o;i=(r-l)/(b+p*(r-l))*.8}else{let l=o,b=.2*o*o*1.25*1.25/n,p=1-b/(a-o);i=.8+.2*((r-l)/(b+p*(r-l)))}return i&&(t.s=i,t.h=k(Math.atan2(e.b,e.a)*180/Math.PI)),t}function lt(e){let t=le(e.l),r={mode:"oklab",l:t};if(e.alpha!==void 0&&(r.alpha=e.alpha),!e.s||e.l===1)return r.a=r.b=0,r;let n=Math.cos(e.h/180*Math.PI),o=Math.sin(e.h/180*Math.PI),[a,i,l]=it(t,n,o),b,p,c,y;e.s<.8?(b=1.25*e.s,p=0,c=.8*a,y=1-c/i):(b=5*(e.s-.8),p=i,c=.2*i*i*1.25*1.25/a,y=1-c/(l-i));let d=p+b*c/(1-y*b);return r.a=d*n,r.b=d*o,r}var ni={...Ke,mode:"okhsl",channels:["h","s","l","alpha"],parse:["--okhsl"],serialize:"--okhsl",fromMode:{oklab:ft,rgb:e=>ft(oe(e))},toMode:{oklab:lt,rgb:e=>ne(lt(e))}},$o=ni;function st(e){let t=Math.sqrt(e.a*e.a+e.b*e.b),r=e.l,n=t?e.a/t:1,o=t?e.b/t:1,[a,i]=Ne(n,o),l=.5,b=1-l/a,p=i/(t+r*i),c=p*r,y=p*t,d=le(c),f=y*d/c,g=V({l:d,a:n*f,b:o*f}),u=Math.cbrt(1/Math.max(g.r,g.g,g.b,0));r=r/u,t=t/u*Oe(r)/r,r=Oe(r);let h={mode:"okhsv",s:t?(l+i)*y/(i*l+i*b*y):0,v:r?r/c:0};return h.s&&(h.h=k(Math.atan2(e.b,e.a)*180/Math.PI)),e.alpha!==void 0&&(h.alpha=e.alpha),h}function pt(e){let t={mode:"oklab"};e.alpha!==void 0&&(t.alpha=e.alpha);let r=e.h||0,n=Math.cos(r/180*Math.PI),o=Math.sin(r/180*Math.PI),[a,i]=Ne(n,o),l=.5,b=1-l/a,p=1-e.s*l/(l+i-i*b*e.s),c=e.s*i*l/(l+i-i*b*e.s),y=le(p),d=c*y/p,f=V({l:y,a:n*d,b:o*d}),g=Math.cbrt(1/Math.max(f.r,f.g,f.b,0)),u=le(e.v*p),h=c*u/p;return t.l=u*g,t.a=h*n*g,t.b=h*o*g,t}var ai={...Ue,mode:"okhsv",channels:["h","s","v","alpha"],parse:["--okhsv"],serialize:"--okhsv",fromMode:{oklab:st,rgb:e=>st(oe(e))},toMode:{oklab:pt,rgb:e=>ne(pt(e))}},zo=ai;function ii(e,t){if(!t||t[0]!=="oklab")return;let r={mode:"oklab"},[,n,o,a,i]=t;if(!(n.type===s.Hue||o.type===s.Hue||a.type===s.Hue))return n.type!==s.None&&(r.l=n.type===s.Number?n.value:n.value/100),o.type!==s.None&&(r.a=o.type===s.Number?o.value:o.value*.4/100),a.type!==s.None&&(r.b=a.type===s.Number?a.value:a.value*.4/100),i.type!==s.None&&(r.alpha=i.type===s.Number?i.value:i.value/100),r}var wo=ii;var fi={...he,mode:"oklab",toMode:{lrgb:V,rgb:ne},fromMode:{lrgb:at,rgb:oe},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[wo],serialize:e=>`oklab(${e.l!==void 0?e.l:"none"} ${e.a!==void 0?e.a:"none"} ${e.b!==void 0?e.b:"none"}${e.alpha<1?` / ${e.alpha}`:""})`},Lo=fi;function li(e,t){if(!t||t[0]!=="oklch")return;let r={mode:"oklch"},[,n,o,a,i]=t;if(n.type!==s.None){if(n.type===s.Hue)return;r.l=n.type===s.Number?n.value:n.value/100}if(o.type!==s.None&&(r.c=Math.max(0,o.type===s.Number?o.value:o.value*.4/100)),a.type!==s.None){if(a.type===s.Percentage)return;r.h=a.value}return i.type!==s.None&&(r.alpha=i.type===s.Number?i.value:i.value/100),r}var Ro=li;var si={...xe,mode:"oklch",toMode:{oklab:e=>A(e,"oklab"),rgb:e=>ne(A(e,"oklab"))},fromMode:{rgb:e=>X(oe(e),"oklch"),oklab:e=>X(e,"oklch")},parse:[Ro],serialize:e=>`oklch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h||0}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},_o=si;var pi=e=>{let{r:t,g:r,b:n,alpha:o}=O(e),a={mode:"xyz65",x:.486570948648216*t+.265667693169093*r+.1982172852343625*n,y:.2289745640697487*t+.6917385218365062*r+.079286914093745*n,z:0*t+.0451133818589026*r+1.043944368900976*n};return o!==void 0&&(a.alpha=o),a},Zt=pi;var ui=({x:e,y:t,z:r,alpha:n})=>{let o=C({r:e*2.4934969119414263-t*.9313836179191242-.402710784450717*r,g:e*-.8294889695615749+t*1.7626640603183465+.0236246858419436*r,b:e*.0358458302437845-t*.0761723892680418+.9568845240076871*r},"p3");return n!==void 0&&(o.alpha=n),o},Kt=ui;var mi={...E,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>Kt(N(e)),xyz65:Kt},toMode:{rgb:e=>P(Zt(e)),xyz65:Zt}},Ho=mi;var Ut=e=>{let t=Math.abs(e);return t>=.001953125?Math.sign(e)*Math.pow(t,.5555555555555556):16*e},di=({x:e,y:t,z:r,alpha:n})=>{let o={mode:"prophoto",r:Ut(e*1.3457868816471585-t*.2555720873797946-.0511018649755453*r),g:Ut(e*-.5446307051249019+t*1.5082477428451466+.0205274474364214*r),b:Ut(e*0+t*0+1.2119675456389452*r)};return n!==void 0&&(o.alpha=n),o},Qt=di;var er=e=>{let t=Math.abs(e);return t>=.03125?Math.sign(e)*Math.pow(t,1.8):e/16},ci=e=>{let t=er(e.r),r=er(e.g),n=er(e.b),o={mode:"xyz50",x:.7977666449006423*t+.1351812974005331*r+.0313477341283922*n,y:.2880748288194013*t+.7118352342418731*r+899369387256e-16*n,z:0*t+0*r+.8251046025104602*n};return e.alpha!==void 0&&(o.alpha=e.alpha),o},tr=ci;var bi={...E,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:Qt,rgb:e=>Qt(F(e))},toMode:{xyz50:tr,rgb:e=>D(tr(e))}},So=bi;var Xo=1.09929682680944,hi=.018053968510807,rr=e=>{let t=Math.abs(e);return t>hi?(Math.sign(e)||1)*(Xo*Math.pow(t,.45)-(Xo-1)):4.5*e},xi=({x:e,y:t,z:r,alpha:n})=>{let o={mode:"rec2020",r:rr(e*1.7166511879712683-t*.3556707837763925-.2533662813736599*r),g:rr(e*-.6666843518324893+t*1.6164812366349395+.0157685458139111*r),b:rr(e*.0176398574453108-t*.0427706132578085+.9421031212354739*r)};return n!==void 0&&(o.alpha=n),o},or=xi;var Ao=1.09929682680944,gi=.018053968510807,nr=e=>{let t=Math.abs(e);return t<gi*4.5?e/4.5:(Math.sign(e)||1)*Math.pow((t+Ao-1)/Ao,1/.45)},yi=e=>{let t=nr(e.r),r=nr(e.g),n=nr(e.b),o={mode:"xyz65",x:.6369580483012911*t+.1446169035862083*r+.1688809751641721*n,y:.262700212011267*t+.6779980715188708*r+.059301716469862*n,z:0*t+.0280726930490874*r+1.0609850577107909*n};return e.alpha!==void 0&&(o.alpha=e.alpha),o},ar=yi;var vi={...E,mode:"rec2020",fromMode:{xyz65:or,rgb:e=>or(N(e))},toMode:{xyz65:ar,rgb:e=>P(ar(e))},parse:["rec2020"],serialize:"rec2020"},Eo=vi;var Y=.0037930732552754493,ut=Math.cbrt(Y);var ir=e=>Math.cbrt(e)-ut,Mi=e=>{let{r:t,g:r,b:n,alpha:o}=O(e),a=ir(.3*t+.622*r+.078*n+Y),i=ir(.23*t+.692*r+.078*n+Y),l=ir(.2434226892454782*t+.2047674442449682*r+.5518098665095535*n+Y),b={mode:"xyb",x:(a-i)/2,y:(a+i)/2,b:l-(a+i)/2};return o!==void 0&&(b.alpha=o),b},Oo=Mi;var fr=e=>Math.pow(e+ut,3),Ti=({x:e,y:t,b:r,alpha:n})=>{let o=fr(e+t)-Y,a=fr(t-e)-Y,i=fr(r+t)-Y,l=C({r:11.031566904639861*o-9.866943908131562*a-.16462299650829934*i,g:-3.2541473810744237*o+4.418770377582723*a-.16462299650829934*i,b:-3.6588512867136815*o+2.7129230459360922*a+1.9459282407775895*i});return n!==void 0&&(l.alpha=n),l},No=Ti;var ki={mode:"xyb",channels:["x","y","b","alpha"],parse:["--xyb"],serialize:"--xyb",toMode:{rgb:No},fromMode:{rgb:Oo},ranges:{x:[-.0154,.0281],y:[0,.8453],b:[-.2778,.388]},interpolate:{x:m,y:m,b:m,alpha:{use:m,fixup:v}}},Co=ki;var $i={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:D,lab:be},fromMode:{rgb:F,lab:ce},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:m,y:m,z:m,alpha:{use:m,fixup:v}}},Po=$i;var zi=e=>{let{x:t,y:r,z:n,alpha:o}=e,a={mode:"xyz50",x:1.0479298208405488*t+.0229467933410191*r-.0501922295431356*n,y:.0296278156881593*t+.990434484573249*r-.0170738250293851*n,z:-.0092430581525912*t+.0150551448965779*r+.7518742899580008*n};return o!==void 0&&(a.alpha=o),a},Io=zi;var wi=e=>{let{x:t,y:r,z:n,alpha:o}=e,a={mode:"xyz65",x:.9554734527042182*t-.0230985368742614*r+.0632593086610217*n,y:-.0283697069632081*t+1.0099954580058226*r+.021041398966943*n,z:.0123140016883199*t-.0205076964334779*r+1.3303659366080753*n};return o!==void 0&&(a.alpha=o),a},jo=wi;var Li={mode:"xyz65",toMode:{rgb:P,xyz50:Io},fromMode:{rgb:N,xyz50:jo},ranges:{x:[0,.95],y:[0,1],z:[0,1.088]},channels:["x","y","z","alpha"],parse:["xyz","xyz-d65"],serialize:"xyz-d65",interpolate:{x:m,y:m,z:m,alpha:{use:m,fixup:v}}},qo=Li;var Ri=({r:e,g:t,b:r,alpha:n})=>{let o={mode:"yiq",y:.29889531*e+.58662247*t+.11448223*r,i:.59597799*e-.2741761*t-.32180189*r,q:.21147017*e-.52261711*t+.31114694*r};return n!==void 0&&(o.alpha=n),o},Do=Ri;var _i=({y:e,i:t,q:r,alpha:n})=>{let o={mode:"rgb",r:e+.95608445*t+.6208885*r,g:e-.27137664*t-.6486059*r,b:e-1.10561724*t+1.70250126*r};return n!==void 0&&(o.alpha=n),o},Fo=_i;var Hi={mode:"yiq",toMode:{rgb:Fo},fromMode:{rgb:Do},channels:["y","i","q","alpha"],parse:["--yiq"],serialize:"--yiq",ranges:{i:[-.595,.595],q:[-.522,.522]},interpolate:{y:m,i:m,q:m,alpha:{use:m,fixup:v}}},Vo=Hi;var Si=(e,t)=>Math.round(e*(t=Math.pow(10,t)))/t,Xi=(e=4)=>t=>typeof t=="number"?Si(t,e):t,Bo=Xi;var Md=Bo(2),Ai=e=>Math.max(0,Math.min(1,e)),mt=e=>Math.round(Ai(e)*255),lr=e=>{if(e===void 0)return;let t=mt(e.r),r=mt(e.g),n=mt(e.b);return"#"+(1<<24|t<<16|r<<8|n).toString(16).slice(1)},Go=e=>{if(e===void 0)return;let t=mt(e.alpha!==void 0?e.alpha:1);return lr(e)+(256|t).toString(16).slice(1)};var sr=e=>lr(ze("rgb")(e)),pr=e=>Go(ze("rgb")(e));var nc=T(Br),ac=T(eo),ic=T(oo),fc=T(no),lc=T(ao),sc=T(Ke),pc=T(Ue),uc=T(po),mc=T(mo),dc=T(co),cc=T(he),bc=T(ho),hc=T(xe),xc=T(go),gc=T(Mo),yc=T(To),vc=T(ko),Mc=T($o),Tc=T(zo),kc=T(Lo),$c=T(_o),zc=T(Ho),wc=T(So),Lc=T(Eo),Rc=T(E),_c=T(Co),Hc=T(Po),Sc=T(qo),Xc=T(Vo);function J(e,t){if(!e)throw new Error("missing value");if(typeof e=="string"){if(t.convertToHex===!1)return e;let r=$e(e);if(!r)throw new Error(`invalid color "${e}"`);return typeof r.alpha=="number"&&r.alpha<1?pr(r):sr(r)}throw new Error(`expected string, received ${typeof e}`)}function Ce(e){if(!e)throw new Error("missing value");if(typeof e=="string")return[e];if(Array.isArray(e)){if(e.every(t=>!!t&&typeof t=="string"))return e;throw new Error("expected array of strings")}throw new Error(`expected string or array of strings, received ${typeof e}`)}var Ei=/^\d+(\.\d+)?(ms|s)$/;function ge(e){if(typeof e=="number")return`${e}ms`;if(typeof e=="string"){if(parseFloat(e)===0)return"0ms";if(Ei.test(e))return e;throw new Error(`invalid duration "${e}"`)}throw new Error(`expected string, received ${typeof e}`)}function I(e){if(typeof e=="number"){if(e===0)return"0";throw new Error("missing units")}if(typeof e=="string")return parseFloat(e)===0?"0":e;throw new Error(`expected string, received ${typeof e}`)}function Pe(e){if(!e)throw new Error("missing value");if(!Array.isArray(e)||e.length!==4||e.some(t=>typeof t!="number"))throw new Error(`expected [\u{1D465}1, \u{1D466}1, \u{1D465}2, \u{1D466}2], received ${e}`);return[Math.max(0,Math.min(1,e[0])),e[1],Math.max(0,Math.min(1,e[2])),e[3]]}function ur(e){if(!e)throw new Error("missing value");if(typeof e=="string")return e;throw new Error(`expected string, received ${typeof e}`)}var Yo=new Set(["solid","dashed","dotted","double","groove","ridge","outset","inset"]);function Ie(e){if(!Yo.has(e))throw new Error(`Unsupported stroke type "${e}", must be one of:
- ${[...Yo].join(`
- `)}`);return e}function mr(e,t){if(!q(e))throw new Error(`Expected object, received ${Array.isArray(e)?"array":typeof e}`);let r=e;if(!("color"in r))throw new Error('Token missing required "color" property');if(!("width"in r))throw new Error('Token missing required "width" property');if(!("style"in r))throw new Error('Token missing required "style" property');return{color:J(r.color,t.color),width:I(r.width),style:Ie(r.style)}}var Oi=[.25,.1,.25,1];function dr(e){if(!e)throw new Error("missing value");if(typeof e!="object"||Array.isArray(e))throw new Error("invalid transition format, e");if(!Object.keys(e).length)throw new Error("At least 1 transition property is required");let t=e;return{duration:ge(t.duration||"0"),delay:ge(t.delay||"0"),timingFunction:Pe(t.timingFunction||Oi)}}function cr(e,t){if(!e)throw new Error("missing value");if(typeof e!="object"||Array.isArray(e))throw new Error("invalid shadow");let r=e;for(let n of["offsetX","offsetX","blur","spread","color"]){if(typeof r[n]=="number"&&r[n]>0)throw new Error(`${n} missing units`);if((n==="offsetX"||n==="offsetY")&&typeof r[n]!="string"&&r[n]!==0)throw new Error(`missing ${n}`)}return{offsetX:I(r.offsetX||"0"),offsetY:I(r.offsetY||"0"),blur:I(r.blur||"0"),spread:I(r.spread||"0"),color:J(r.color,t.color)}}function br(e,t){if(!e)throw new Error("missing value");if(!Array.isArray(e))throw new Error(`expected array of gradient stops, received ${typeof e}`);if(e.some(r=>!r||!r.color))throw new Error("all gradient stops must have color");return e.map(r=>({color:J(r.color,t.color),position:typeof r.position=="number"?Math.max(0,Math.min(1,r.position)):void 0}))}var Jo={thin:100,hairline:100,"extra-light":200,"ultra-light":200,light:300,normal:400,regular:400,book:400,medium:500,"semi-bold":600,"demi-bold":600,bold:700,"extra-bold":800,"ultra-bold":800,black:900,heavy:900,"extra-black":950,"ultra-black":950};function je(e){if(!e)throw new Error("missing value");if(typeof e=="number")return e;if(typeof e=="string"&&e in Jo)return Jo[e];throw new Error(`expected number or font weight alias, received ${e} (${typeof e})`)}function hr(e){if(!e)throw new Error("missing value");if(typeof e!="object"||Array.isArray(e))throw new Error(`expected object, received ${Array.isArray(e)?"array":typeof e}`);if(!Object.keys(e).length)throw new Error("must specify at least 1 font property");let t={};for(let[r,n]of Object.entries(e)){let o=_r(r);switch(o){case"font":case"fontName":case"fontFamily":{t.fontFamily=Ce(n);break}case"fontWeight":{t.fontWeight=je(n);break}default:{t[o]=typeof n=="string"&&parseFloat(n)>=0?I(n):n;break}}}return t}function xr(e){if(e==null)throw new Error("missing value");if(typeof e=="number")return e;throw new Error(`expected number, received ${typeof e}`)}function Wo(e){let t=[],r=[],n={};function o(i,l){let b=[...l],p=b.pop(),c=n;for(let y of b)y in c||(c[y]={}),c=c[y];c[p]=i}function a(i,l){if(!(!i||typeof i!="object")){for(let[b,p]of Object.entries(i))if(!b.startsWith("$")){if(p&&typeof p=="object"&&"type"in p&&"value"in p){let c=[...l,b].join("."),y=l[0];if(typeof p.value=="string")p.value.trim().startsWith("{")&&!p.value.trim().startsWith(`{${y}`)&&(p.value=p.value.trim().replace("{",`{${y}.`));else if(p.value&&typeof p.value=="object")for(let[d,f]of Object.entries(p.value))typeof f=="string"&&f.trim().startsWith("{")&&!f.trim().startsWith(`{${y}`)&&(p.value[d]=p.value[d].trim().replace("{",`{${y}.`));switch(p.type){case"border":{o({$type:"border",$value:p.value},[...l,b]);break}case"borderRadius":{if(typeof p.value!="string"){o({$type:"borderRadius",$value:p.value},[...l,b]);break}let d=p.value.split(" ").map(f=>f.trim()).filter(Boolean);if(d.length===1)o({$type:"dimension",$value:p.value.trim()},[...l,b]);else if(d.length===2||d.length===3||d.length===4){r.push(`Token "${c}" is a multi value borderRadius token. Expanding into ${c}TopLeft, ${c}TopRight, ${c}BottomRight, and ${c}BottomLeft.`);let f=[d[0],d[1],d[0],d[1]];d.length===3?f=[d[0],d[1],d[2],d[1]]:d.length===4&&(f=[d[0],d[1],d[2],d[3]]),o({$type:"dimension",$value:f[0]},[...l,`${b}TopLeft`]),o({$type:"dimension",$value:f[1]},[...l,`${b}TopRight`]),o({$type:"dimension",$value:f[2]},[...l,`${b}BottomRight`]),o({$type:"dimension",$value:f[3]},[...l,`${b}BottomLeft`])}else o({$type:"borderRadius",$value:p.value},[...l,b]);break}case"boxShadow":{if(!p.value||typeof p.value!="object"){o({$type:"shadow",$value:p.value},[...l,b]);break}o({$type:"shadow",$value:{offsetX:p.value.x,offsetY:p.value.y,blur:p.value.blur,spread:p.value.spread,color:p.value.color}},[...l,b]);break}case"color":{if(p.value.includes("linear-gradient(")){let d=[],[f,...g]=p.value.replace(")","").split(",");for(let u of g){let[h,M]=u.trim().split(" ");h.includes("$")&&(h=`{${y}.${h.replace("$","")}}`),M.includes("%")?M=parseFloat(M)/100:typeof M=="string"&&M.length&&(M=parseFloat(M)),d.push({color:h,position:M})}o({$type:"gradient",$value:d},[...l,b]);break}o({$type:"color",$value:p.value},[...l,b]);break}case"fontFamilies":{o({$type:"fontFamily",$value:p.value},[...l,b]);break}case"borderWidth":case"dimension":case"fontSizes":case"letterSpacing":case"lineHeights":case"opacity":case"sizing":{typeof p.value=="number"||typeof p.value=="string"&&String(Number(p.value))===p.value?o({$type:"number",$value:Number(p.value)},[...l,b]):o({$type:"dimension",$value:p.value},[...l,b]);break}case"fontWeights":{o({$type:"fontWeight",$value:parseInt(p.value,10)||p.value},[...l,b]);break}case"spacing":{if(typeof p.value!="string"){o({$type:"spacing",$value:p.value},[...l,b]);break}let d=p.value.split(" ").map(f=>f.trim()).filter(Boolean);if(d.length===1)o({$type:"dimension",$value:p.value.trim()},[...l,b]);else if(d.length===2||d.length===3||d.length===4){r.push(`Token "${c}" is a multi value spacing token. Expanding into ${c}Top, ${c}Right, ${c}Bottom, and ${c}Left.`);let f=[d[0],d[1],d[0],d[1]];d.length===3?f=[d[0],d[1],d[2],d[1]]:d.length===4&&(f=[d[0],d[1],d[2],d[3]]),o({$type:"dimension",$value:f[0]},[...l,`${b}Top`]),o({$type:"dimension",$value:f[1]},[...l,`${b}Right`]),o({$type:"dimension",$value:f[2]},[...l,`${b}Bottom`]),o({$type:"dimension",$value:f[3]},[...l,`${b}Left`])}else o({$type:"spacing",$value:p.value},[...l,b]);break}case"textDecoration":case"textCase":break;case"typography":{if(p.value&&typeof p.value=="object"){for(let d of["textCase","textDecoration"])if(d in p.value&&W(p.value[d])){let f=new Set,g=pe(p.value[d]).split("."),u=dt(e,[...g,"value"])??dt(e,[y,...g,"value"]);for(typeof u=="string"&&f.add(u);typeof u=="string"&&W(u);){let h=pe(u).split(".");if(u=dt(e,[...h,"value"])??dt(e,[y,...h,"value"]),typeof u=="string"&&f.has(u)){t.push(`Alias "${p.value[d]}" is a circular reference`),u=void 0;break}typeof u=="string"&&f.add(u)}u?p.value[d]=u:delete p.value[d]}}o({$type:"typography",$value:p.value},[...l,b]);break}}continue}a(p,[...l,b])}}}return a(e,[]),{errors:t.length?t:void 0,warnings:r.length?r:void 0,result:n}}function Zo(e){return!!e&&typeof e=="object"&&"$themes"in e&&Array.isArray(e.$themes)&&"$metadata"in e&&typeof e.$metadata=="object"}function dt(e,t){let r=e;for(let n of t){if(!r||typeof r!="object"||!(n in r))break;r=r[n]}return r}var Ko=new Set(["$description","$name","$type","$value","$extensions"]);function yr(e,t){let r=[],n=[],o={result:{metadata:{},tokens:[]}};if(!e||typeof e!="object"||Array.isArray(e))return r.push(`Invalid schema type. Expected object, received "${Array.isArray(e)?"Array":typeof e}"`),o.errors=r,o;let a=e;if(Zo(e)){let f=Wo(e);r.push(...f.errors??[]),n.push(...f.warnings??[]),a=f.result}let i={};function l(f,g=[],u={$extensions:{requiredModes:[]}}){if(!(!f||!q(f)))for(let[h,M]of Object.entries(f)){if(!M||!q(M)){r.push(`${h}: unexpected token format "${M}"`);continue}if(h.includes(".")||h.includes("{")||h.includes("}")||h.includes("#")){r.push(`${h}: IDs can\u2019t include any of the following: .{}#`);continue}Object.keys(M).length||r.push(`${h}: groups can\u2019t be empty`);let z={_original:qe(M),_group:{id:g.join(".")||".",...u||{}},id:g.concat(h).join("."),$type:M.$type||u.$type,...M};if("$value"in z){if(h.startsWith("$")){r.push(`${h}: token ID can\u2019t start with the $ character`);continue}if(Sr(z.$value)){r.push(`${z.id}: missing "$value"`);continue}if(z.$extensions&&z.$extensions.mode&&!q(z.$extensions.mode)&&r.push(`${z.id}: "mode" must be an object`),u.$extensions.requiredModes.length)for(let S of u.$extensions.requiredModes)(!z.$extensions||!z.$extensions.mode||!z.$extensions.mode[S])&&r.push(`${z.id}: missing mode "${S}" required from parent group`);i[z.id]=z}else{let S={...u},G={};for(let _ of Object.keys(M))_.startsWith("$")?(_==="$extensions"?S.$extensions={...S.$extensions,...M.$extensions}:S[_]=M[_],Ko.has(_)||(o.warnings||(o.warnings=[]),o.warnings.push(`Unknown property "${_}"`))):G[_]=M[_];if(Object.values(G).every(_=>q(_)))l(G,[...g,h],S);else throw new Error(`${h}: missing $type`)}}}let b={$extensions:{requiredModes:[]}},p={};for(let f of Object.keys(a))f.startsWith("$")?(f==="$extensions"?b.$extensions={...a.$extensions,...b.$extensions}:b[f]=a[f],Ko.has(f)||(o.warnings||(o.warnings=[]),o.warnings.push(`Unknown property "${f}"`)),o.result.metadata[f]=a[f]):p[f]=a[f];if(l(p,[],b),r.length)return o.errors=r,o;let c={};for(let f of Object.values(i))if(c[f.id]=f.$value,f.$extensions&&f.$extensions.mode)for(let[g,u]of Object.entries(f.$extensions.mode||{}))c[`${f.id}#${g}`]=u;function y(f,g){return vt(g,{default(u){return u},string(u){if(!W(u))return u;let h=pe(u);if(!(h in c))throw new Error(`${f}: can\u2019t find ${u}`);let M=c[h];if(typeof M=="string"&&W(M)&&f===pe(M))throw new Error(`${f}: can\u2019t reference circular alias ${u}`);return c[h]},array(u){return u.map(h=>y(f,h))},object(u){for(let h of Object.keys(u))u[h]=y(f,u[h]);return u}})}for(;gr(c);)try{for(let[f,g]of Object.entries(c))c[f]=y(f,g)}catch(f){r.push(f.message||f);break}if(r.length)return o.errors=r,o;function d(f,g){let u=i[f];if(!(!u.$extensions||!u.$extensions.mode))for(let h of Object.keys(u.$extensions.mode||{}))i[f].$extensions.mode[h]=g(c[`${f}#${h}`])}for(let[f,g]of Object.entries(i))try{switch(g.$type){case"color":{i[f].$value=J(c[f],t.color),d(f,u=>J(u,t.color));break}case"dimension":{i[f].$value=I(c[f]),d(f,u=>I(u));break}case"font":case"fontFamily":{g.$type==="font"&&console.warn(`${Rr}@cobalt-ui/core${Lr} $type: "font" is deprecated. Please use "fontFamily" instead.`),i[f].$value=Ce(c[f]),d(f,u=>Ce(u));break}case"fontWeight":{i[f].$value=je(c[f]),d(f,u=>je(u));break}case"duration":{i[f].$value=ge(c[f]),d(f,u=>ge(u));break}case"cubicBezier":{i[f].$value=Pe(c[f]),d(f,u=>Pe(u));break}case"number":{i[f].$value=xr(c[f]),d(f,u=>xr(u));break}case"link":{i[f].$value=ur(c[f]),d(f,u=>ur(u));break}case"strokeStyle":{i[f].$value=Ie(c[f]),d(f,u=>Ie(u));break}case"border":{i[f].$value=mr(c[f],{color:t.color}),d(f,u=>mr(u,{color:t.color}));break}case"transition":{i[f].$value=dr(c[f]),d(f,u=>dr(u));break}case"shadow":{i[f].$value=cr(c[f],{color:t.color}),d(f,u=>cr(u,{color:t.color}));break}case"gradient":{i[f].$value=br(c[f],{color:t.color}),d(f,u=>br(u,{color:t.color}));break}case"typography":{i[f].$value=hr(c[f]),d(f,u=>hr(u));break}default:{i[f].value=c[f],d(f,u=>u);break}}}catch(u){r.push(`${f}: ${u.message||u}`)}return r.length&&(o.errors=r),n.length&&(o.warnings=n),o.result.tokens=Object.values(i),o}function gr(e){return Object.values(e).some(t=>vt(t,{default:()=>!1,string:r=>W(r),array:r=>r.some(n=>typeof n=="string"?W(n):q(n)?gr(n):!1),object:r=>gr(r)}))}var S1={parse:yr};export{S1 as default,yr as parse};
//# sourceMappingURL=index.min.js.map

@@ -1,2 +0,2 @@

import color from 'better-color-tools';
import { formatHex, formatHex8, parse } from 'culori';
/**

@@ -14,12 +14,10 @@ * 8.1 Color

throw new Error('missing value');
if (typeof value === 'string' || typeof value === 'number') {
try {
if (options.convertToHex === false && typeof value === 'string') {
return value;
}
return color.from(value).hex;
if (typeof value === 'string') {
if (options.convertToHex === false) {
return value;
}
catch (err) {
const parsed = parse(value);
if (!parsed)
throw new Error(`invalid color "${value}"`);
}
return typeof parsed.alpha === 'number' && parsed.alpha < 1 ? formatHex8(parsed) : formatHex(parsed);
}

@@ -26,0 +24,0 @@ throw new Error(`expected string, received ${typeof value}`);

{
"name": "@cobalt-ui/core",
"description": "CLI for using the W3C design token format",
"version": "1.3.0",
"version": "1.3.1",
"author": {

@@ -31,7 +31,8 @@ "name": "Drew Powers",

"@cobalt-ui/utils": "^1.1.1",
"better-color-tools": "^0.12.3"
"@types/culori": "^2.0.0",
"culori": "^3.2.0"
},
"devDependencies": {
"@types/node": "^20.4.2",
"esbuild": "^0.18.12",
"@types/node": "^20.4.5",
"esbuild": "^0.18.17",
"npm-run-all": "^4.1.5",

@@ -38,0 +39,0 @@ "vitest": "^0.33.0"

@@ -1,2 +0,2 @@

import color from 'better-color-tools';
import {formatHex, formatHex8, parse} from 'culori';
import type {ParsedColorToken} from '../../token.js';

@@ -20,13 +20,11 @@

if (!value) throw new Error('missing value');
if (typeof value === 'string' || typeof value === 'number') {
try {
if (options.convertToHex === false && typeof value === 'string') {
return value;
}
return color.from(value).hex;
} catch (err) {
throw new Error(`invalid color "${value}"`);
if (typeof value === 'string') {
if (options.convertToHex === false) {
return value;
}
const parsed = parse(value);
if (!parsed) throw new Error(`invalid color "${value}"`);
return typeof parsed.alpha === 'number' && parsed.alpha < 1 ? formatHex8(parsed) : formatHex(parsed);
}
throw new Error(`expected string, received ${typeof value}`);
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc