var dr=(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}}},ae=dr;var lr={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},ut=lr;var pr=e=>ae(ut[e.toLowerCase()],6),mt=pr;var ur=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,mr=e=>{let t;return(t=e.match(ur))?ae(parseInt(t[1],16),t[1].length):void 0},fe=mr;var c="([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)",Ko=`(?:${c}|none)`,N=`${c}%`,Qo=`(?:${c}%|none)`,W=`(?:${c}%|${c})`,sr=`(?:${c}%|${c}|none)`,st=`(?:${c}(deg|grad|rad|turn)|${c})`,Uo=`(?:${c}(deg|grad|rad|turn)|${c}|none)`,H="\\s*,\\s*";var Vo=new RegExp("^"+sr+"$");var cr=new RegExp(`^rgba?\\(\\s*${c}${H}${c}${H}${c}\\s*(?:,\\s*${W}\\s*)?\\)$`),br=new RegExp(`^rgba?\\(\\s*${N}${H}${N}${H}${N}\\s*(?:,\\s*${W}\\s*)?\\)$`),hr=e=>{let t={mode:"rgb"},r;if(r=e.match(cr))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(br))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=Math.max(0,Math.min(1,r[4]/100)):r[5]!==void 0&&(t.alpha=Math.max(0,Math.min(1,+r[5]))),t},ct=hr;var xr=(e,t)=>e===void 0?void 0:typeof e!="object"?de(e):e.mode!==void 0?e:t?{...e,mode:t}:void 0,ie=xr;var gr=(e="rgb")=>t=>(t=ie(t,e))!==void 0?t.mode===e?t:g[t.mode][e]?g[t.mode][e](t):e==="rgb"?g[t.mode].rgb(t):g.rgb[e](g[t.mode].rgb(t)):void 0,h=gr;var g={},bt={},K=[],Re={},vr=e=>e,u=e=>(g[e.mode]={...g[e.mode],...e.toMode},Object.keys(e.fromMode||{}).forEach(t=>{g[t]||(g[t]={}),g[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=vr)}),bt[e.mode]=e,(e.parse||[]).forEach(t=>{yr(t,e.mode)}),h(e.mode)),_=e=>bt[e],yr=(e,t)=>{if(typeof e=="string"){if(!t)throw new Error("'mode' required when 'parser' is a string");Re[e]=t}else typeof e=="function"&&K.indexOf(e)<0&&K.push(e)};var He=/[^\x00-\x7F]|[a-zA-Z_]/,Mr=/[^\x00-\x7F]|[-\w]/,f={Function:"function",Ident:"ident",Number:"number",Percentage:"percentage",ParenClose:")",None:"none",Hue:"hue",Alpha:"alpha"},d=0;function le(e){let t=e[d],r=e[d+1];return t==="-"||t==="+"?/\d/.test(r)||r==="."&&/\d/.test(e[d+2]):t==="."?/\d/.test(r):/\d/.test(t)}function ke(e){if(d>=e.length)return!1;let t=e[d];if(He.test(t))return!0;if(t==="-"){if(e.length-d<2)return!1;let r=e[d+1];return!!(r==="-"||He.test(r))}return!1}var Tr={deg:1,rad:180/Math.PI,grad:9/10,turn:360};function Q(e){let t="";if((e[d]==="-"||e[d]==="+")&&(t+=e[d++]),t+=pe(e),e[d]==="."&&/\d/.test(e[d+1])&&(t+=e[d++]+pe(e)),(e[d]==="e"||e[d]==="E")&&((e[d+1]==="-"||e[d+1]==="+")&&/\d/.test(e[d+2])?t+=e[d++]+e[d++]+pe(e):/\d/.test(e[d+1])&&(t+=e[d++]+pe(e))),ke(e)){let r=ue(e);return r==="deg"||r==="rad"||r==="turn"||r==="grad"?{type:f.Hue,value:t*Tr[r]}:void 0}return e[d]==="%"?(d++,{type:f.Percentage,value:+t}):{type:f.Number,value:+t}}function pe(e){let t="";for(;/\d/.test(e[d]);)t+=e[d++];return t}function ue(e){let t="";for(;d4)){if(r.length===4){if(r[3].type!==f.Alpha)return;r[3]=r[3].value}return r.length===3&&r.push({type:f.None,value:void 0}),r.every(n=>n.type!==f.Alpha)?r:void 0}}function Rr(e,t){e._i=0;let r=e[e._i++];if(!r||r.type!==f.Function)return;let o=ht(e,t);if(o)return o.unshift(r.value),o}var Hr=e=>{if(typeof e!="string")return;let t=Lr(e),r=t?Rr(t,!0):void 0,o,n=0,a=K.length;for(;ne==="transparent"?{mode:"rgb",r:0,g:0,b:0,alpha:0}:void 0,gt=Xr;var vt=(e,t,r)=>e+r*(t-e);var $r=e=>{let t=[];for(let r=0;rt=>{let r=$r(t);return o=>{let n=o*r.length,a=o>=1?r.length-1:Math.max(Math.floor(n),0),i=r[a];return i===void 0?void 0:e(i[0],i[1],n-a)}};var l=yt(vt);var m=e=>{let t=!1,r=e.map(o=>o!==void 0?(t=!0,o):1);return t?r:e};var Sr={mode:"rgb",channels:["r","g","b","alpha"],parse:[xt,fe,ct,mt,gt,"srgb"],serialize:"srgb",interpolate:{r:l,g:l,b:l,alpha:{use:l,fixup:m}},gamut:!0,white:{r:1,g:1,b:1},black:{r:0,g:0,b:0}},x=Sr;var Xe=(e=0)=>Math.pow(Math.abs(e),2.19921875)*Math.sign(e),Nr=e=>{let t=Xe(e.r),r=Xe(e.g),o=Xe(e.b),n={mode:"xyz65",x:.5766690429101305*t+.1855582379065463*r+.1882286462349947*o,y:.297344975250536*t+.6273635662554661*r+.0752914584939979*o,z:.0270313613864123*t+.0706888525358272*r+.9913375368376386*o};return e.alpha!==void 0&&(n.alpha=e.alpha),n},$e=Nr;var Se=e=>Math.pow(Math.abs(e),.4547069271758437)*Math.sign(e),Pr=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n={mode:"a98",r:Se(e*2.0415879038107465-t*.5650069742788597-.3447313507783297*r),g:Se(e*-.9692436362808798+t*1.8759675015077206+.0415550574071756*r),b:Se(e*.0134442806320312-t*.1183623922310184+1.0151749943912058*r)};return o!==void 0&&(n.alpha=o),n},Ne=Pr;var Pe=(e=0)=>{let t=Math.abs(e);return t<=.04045?e/12.92:(Math.sign(e)||1)*Math.pow((t+.055)/1.055,2.4)},Ir=({r:e,g:t,b:r,alpha:o})=>{let n={mode:"lrgb",r:Pe(e),g:Pe(t),b:Pe(r)};return o!==void 0&&(n.alpha=o),n},y=Ir;var Or=e=>{let{r:t,g:r,b:o,alpha:n}=y(e),a={mode:"xyz65",x:.4123907992659593*t+.357584339383878*r+.1804807884018343*o,y:.2126390058715102*t+.715168678767756*r+.0721923153607337*o,z:.0193308187155918*t+.119194779794626*r+.9505321522496607*o};return n!==void 0&&(a.alpha=n),a},M=Or;var Ie=(e=0)=>{let t=Math.abs(e);return t>.0031308?(Math.sign(e)||1)*(1.055*Math.pow(t,.4166666666666667)-.055):e*12.92},Cr=({r:e,g:t,b:r,alpha:o},n="rgb")=>{let a={mode:n,r:Ie(e),g:Ie(t),b:Ie(r)};return o!==void 0&&(a.alpha=o),a},T=Cr;var Ar=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=T({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 o!==void 0&&(n.alpha=o),n},z=Ar;var qr={...x,mode:"a98",parse:["a98-rgb"],serialize:"a98-rgb",fromMode:{rgb:e=>Ne(M(e)),xyz65:Ne},toMode:{rgb:e=>z($e(e)),xyz65:$e}},Mt=qr;var _r=e=>(e=e%360)<0?e+360:e,s=_r;function Oe({h:e,s:t,l:r,alpha:o}){e=s(e!==void 0?e:0),t===void 0&&(t=0),r===void 0&&(r=0);let n=r+t*(r<.5?r:1-r),a=n-(n-r)*2*Math.abs(e/60%2-1),i;switch(Math.floor(e/60)){case 0:i={r:n,g:a,b:2*r-n};break;case 1:i={r:a,g:n,b:2*r-n};break;case 2:i={r:2*r-n,g:n,b:a};break;case 3:i={r:2*r-n,g:a,b:n};break;case 4:i={r:a,g:2*r-n,b:n};break;case 5:i={r:n,g:2*r-n,b:a};break;default:i={r:2*r-n,g:2*r-n,b:2*r-n}}return i.mode="rgb",o!==void 0&&(i.alpha=o),i}function Ce({r:e,g:t,b:r,alpha:o}){e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=Math.max(e,t,r),a=Math.min(e,t,r),i={mode:"hsl",s:n===a?0:(n-a)/(1-Math.abs(n+a-1)),l:.5*(n+a)};return n-a!==0&&(i.h=(n===e?(t-r)/(n-a)+(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}},Tt=Dr;var Er=new RegExp(`^hsla?\\(\\s*${st}${H}${N}${H}${N}\\s*(?:,\\s*${W}\\s*)?\\)$`),Jr=e=>{let t=e.match(Er);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=Tt(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=Math.max(0,Math.min(1,t[6]/100)):t[7]!==void 0&&(r.alpha=Math.max(0,Math.min(1,+t[7]))),r},zt=Jr;function Yr(e,t){if(!t||t[0]!=="hsl"&&t[0]!=="hsla")return;let r={mode:"hsl"},[,o,n,a,i]=t;if(o.type!==f.None){if(o.type===f.Percentage)return;r.h=o.value}if(n.type!==f.None){if(n.type===f.Hue)return;r.s=n.value/100}if(a.type!==f.None){if(a.type===f.Hue)return;r.l=a.value/100}return i.type!==f.None&&(r.alpha=Math.min(1,Math.max(0,i.type===f.Number?i.value:i.value/100))),r}var Lt=Yr;var Fr=(e,t)=>e.map((r,o,n)=>{if(r===void 0)return r;let a=s(r);return o===0||e[o-1]===void 0?a:t(a-s(n[o-1]))}).reduce((r,o)=>!r.length||o===void 0||r[r.length-1]===void 0?(r.push(o),r):(r.push(o+r[r.length-1]),r),[]),k=e=>Fr(e,t=>Math.abs(t)<=180?t:t-360*Math.sign(t));var U=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.s||!t.s)return 0;let r=s(e.h),o=s(t.h),n=Math.sin((o-r+360)/2*Math.PI/180);return 2*Math.sqrt(e.s*t.s)*n},Ae=(e,t)=>{if(e.h===void 0||t.h===void 0)return 0;let r=s(e.h),o=s(t.h);return Math.abs(o-r)>180?r-(o-360*Math.sign(o-r)):o-r},qe=(e,t)=>{if(e.h===void 0||t.h===void 0||!e.c||!t.c)return 0;let r=s(e.h),o=s(t.h),n=Math.sin((o-r+360)/2*Math.PI/180);return 2*Math.sqrt(e.c*t.c)*n},_e=(e="rgb",t=[1,1,1,0])=>{let r=_(e),o=r.channels,n=r.difference,a=h(e);return(i,p)=>{let b=a(i),P=a(p);return Math.sqrt(o.reduce((R,I,te)=>{let O=n[I]?n[I](b,P):b[I]-P[I];return R+(t[te]||0)*Math.pow(isNaN(O)?0:O,2)},0))}};var wt=(e=1,t=1,r=1)=>{let o=h("lab65");return(n,a)=>{let i=o(n),p=o(a),b=i.l,P=i.a,R=i.b,I=Math.sqrt(P*P+R*R),te=p.l,O=p.a,C=p.b,er=Math.sqrt(O*O+C*C),nt=(I+er)/2,at=.5*(1-Math.sqrt(Math.pow(nt,7)/(Math.pow(nt,7)+Math.pow(25,7)))),re=P*(1+at),oe=O*(1+at),Z=Math.sqrt(re*re+R*R),B=Math.sqrt(oe*oe+C*C),A=Math.abs(re)+Math.abs(R)===0?0:Math.atan2(R,re);A+=(A<0)*2*Math.PI;let q=Math.abs(oe)+Math.abs(C)===0?0:Math.atan2(C,oe);q+=(q<0)*2*Math.PI;let tr=te-b,ft=B-Z,j=Z*B===0?0:q-A;j-=(j>Math.PI)*2*Math.PI,j+=(j<-Math.PI)*2*Math.PI;let it=2*Math.sqrt(Z*B)*Math.sin(j/2),rr=(b+te)/2,ne=(Z+B)/2,v;Z*B===0?v=A+q:(v=(A+q)/2,v-=(Math.abs(A-q)>Math.PI)*Math.PI,v+=(v<0)*2*Math.PI);let dt=Math.pow(rr-50,2),or=1-.17*Math.cos(v-Math.PI/6)+.24*Math.cos(2*v)+.32*Math.cos(3*v+Math.PI/30)-.2*Math.cos(4*v-63*Math.PI/180),nr=1+.015*dt/Math.sqrt(20+dt),lt=1+.045*ne,pt=1+.015*ne*or,ar=30*Math.PI/180*Math.exp(-1*Math.pow((180/Math.PI*v-275)/25,2)),fr=2*Math.sqrt(Math.pow(ne,7)/(Math.pow(ne,7)+Math.pow(25,7))),ir=-1*Math.sin(2*ar)*fr;return Math.sqrt(Math.pow(tr/(e*nr),2)+Math.pow(ft/(t*lt),2)+Math.pow(it/(r*pt),2)+ir*ft/(t*lt)*it/(r*pt))}};var X=e=>{let t=e.reduce((o,n)=>{if(n!==void 0){let a=n*Math.PI/180;o.sin+=Math.sin(a),o.cos+=Math.cos(a)}return o},{sin:0,cos:0}),r=Math.atan2(t.sin,t.cos)*180/Math.PI;return r<0?360+r:r};var Gr={mode:"hsl",toMode:{rgb:Oe},fromMode:{rgb:Ce},channels:["h","s","l","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[Lt,zt],serialize:e=>`hsl(${e.h!==void 0?e.h:"none"} ${e.s!==void 0?e.s*100+"%":"none"} ${e.l!==void 0?e.l*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:l,fixup:k},s:l,l,alpha:{use:l,fixup:m}},difference:{h:U},average:{h:X}},Rt=Gr;function V({h:e,s:t,v:r,alpha:o}){e=s(e!==void 0?e:0),t===void 0&&(t=0),r===void 0&&(r=0);let n=Math.abs(e/60%2-1),a;switch(Math.floor(e/60)){case 0:a={r,g:r*(1-t*n),b:r*(1-t)};break;case 1:a={r:r*(1-t*n),g:r,b:r*(1-t)};break;case 2:a={r:r*(1-t),g:r,b:r*(1-t*n)};break;case 3:a={r:r*(1-t),g:r*(1-t*n),b:r};break;case 4:a={r:r*(1-t*n),g:r*(1-t),b:r};break;case 5:a={r,g:r*(1-t),b:r*(1-t*n)};break;default:a={r:r*(1-t),g:r*(1-t),b:r*(1-t)}}return a.mode="rgb",o!==void 0&&(a.alpha=o),a}function ee({r:e,g:t,b:r,alpha:o}){e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=Math.max(e,t,r),a=Math.min(e,t,r),i={mode:"hsv",s:n===0?0:1-a/n,v:n};return n-a!==0&&(i.h=(n===e?(t-r)/(n-a)+(t1){let n=t+r;t/=n,r/=n}return V({h:e,s:r===1?1:1-t/(1-r),v:1-r,alpha:o})}function Ee(e){let t=ee(e);if(t===void 0)return;let r=t.s!==void 0?t.s:0,o=t.v!==void 0?t.v:0,n={mode:"hwb",w:(1-r)*o,b:1-o};return t.h!==void 0&&(n.h=t.h),t.alpha!==void 0&&(n.alpha=t.alpha),n}function Br(e,t){if(!t||t[0]!=="hwb")return;let r={mode:"hwb"},[,o,n,a,i]=t;if(o.type!==f.None){if(o.type===f.Percentage)return;r.h=o.value}if(n.type!==f.None){if(n.type===f.Hue)return;r.w=n.value/100}if(a.type!==f.None){if(a.type===f.Hue)return;r.b=a.value/100}return i.type!==f.None&&(r.alpha=Math.min(1,Math.max(0,i.type===f.Number?i.value:i.value/100))),r}var kt=Br;var jr={mode:"hwb",toMode:{rgb:De},fromMode:{rgb:Ee},channels:["h","w","b","alpha"],ranges:{h:[0,360]},gamut:"rgb",parse:[kt],serialize:e=>`hwb(${e.h!==void 0?e.h:"none"} ${e.w!==void 0?e.w*100+"%":"none"} ${e.b!==void 0?e.b*100+"%":"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:l,fixup:k},w:l,b:l,alpha:{use:l,fixup:m}},difference:{h:Ae},average:{h:X}},Xt=jr;var me=Math.pow(29,3)/Math.pow(3,3),se=Math.pow(6,3)/Math.pow(29,3);var $={X:.9642956764295677,Y:1,Z:.8251046025104602},S={X:.3127/.329,Y:1,Z:(1-.3127-.329)/.329},Fa=Math.pow(29,3)/Math.pow(3,3),Ga=Math.pow(6,3)/Math.pow(29,3);var Je=e=>Math.pow(e,3)>se?Math.pow(e,3):(116*e-16)/me,Wr=({l:e,a:t,b:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=(e+16)/116,a=t/500+n,i=n-r/200,p={mode:"xyz50",x:Je(a)*$.X,y:Je(n)*$.Y,z:Je(i)*$.Z};return o!==void 0&&(p.alpha=o),p},D=Wr;var Kr=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=T({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 o!==void 0&&(n.alpha=o),n},E=Kr;var Qr=e=>E(D(e)),ce=Qr;var Ur=e=>{let{r:t,g:r,b:o,alpha:n}=y(e),a={mode:"xyz50",x:.436065742824811*t+.3851514688337912*r+.14307845442264197*o,y:.22249319175623702*t+.7168870538238823*r+.06061979053616537*o,z:.013923904500943465*t+.09708128566574634*r+.7140993584005155*o};return n!==void 0&&(a.alpha=n),a},J=Ur;var Ye=e=>e>se?Math.cbrt(e):(me*e+16)/116,Vr=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=Ye(e/$.X),a=Ye(t/$.Y),i=Ye(r/$.Z),p={mode:"lab",l:116*a-16,a:500*(n-a),b:200*(a-i)};return o!==void 0&&(p.alpha=o),p},Y=Vr;var eo=e=>{let t=Y(J(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},be=eo;function to(e,t){if(!t||t[0]!=="lab")return;let r={mode:"lab"},[,o,n,a,i]=t;if(!(o.type===f.Hue||n.type===f.Hue||a.type===f.Hue))return o.type!==f.None&&(r.l=Math.min(Math.max(0,o.value),100)),n.type!==f.None&&(r.a=n.type===f.Number?n.value:n.value*125/100),a.type!==f.None&&(r.b=a.type===f.Number?a.value:a.value*125/100),i.type!==f.None&&(r.alpha=Math.min(1,Math.max(0,i.type===f.Number?i.value:i.value/100))),r}var $t=to;var ro={mode:"lab",toMode:{xyz50:D,rgb:ce},fromMode:{xyz50:Y,rgb:be},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-100,100],b:[-100,100]},parse:[$t],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,a:l,b:l,alpha:{use:l,fixup:m}}},F=ro;var he=Math.pow(29,3)/Math.pow(3,3),xe=Math.pow(6,3)/Math.pow(29,3);var Fe=e=>Math.pow(e,3)>xe?Math.pow(e,3):(116*e-16)/he,oo=({l:e,a:t,b:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=(e+16)/116,a=t/500+n,i=n-r/200,p={mode:"xyz65",x:Fe(a)*S.X,y:Fe(n)*S.Y,z:Fe(i)*S.Z};return o!==void 0&&(p.alpha=o),p},ge=oo;var no=e=>z(ge(e)),ve=no;var Ge=e=>e>xe?Math.cbrt(e):(he*e+16)/116,ao=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=Ge(e/S.X),a=Ge(t/S.Y),i=Ge(r/S.Z),p={mode:"lab65",l:116*a-16,a:500*(n-a),b:200*(a-i)};return o!==void 0&&(p.alpha=o),p},ye=ao;var fo=e=>{let t=ye(M(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},Me=fo;var io={...F,mode:"lab65",parse:["--lab-d65"],serialize:"--lab-d65",toMode:{xyz65:ge,rgb:ve},fromMode:{xyz65:ye,rgb:Me},ranges:{l:[0,100],a:[-86.182,98.234],b:[-107.86,94.477]}},St=io;var lo=({l:e,a:t,b:r,alpha:o},n="lch")=>{t===void 0&&(t=0),r===void 0&&(r=0);let a=Math.sqrt(t*t+r*r),i={mode:n,l:e,c:a};return a&&(i.h=s(Math.atan2(r,t)*180/Math.PI)),o!==void 0&&(i.alpha=o),i},L=lo;var po=({l:e,c:t,h:r,alpha:o},n="lab")=>{r===void 0&&(r=0);let a={mode:n,l:e,a:t?t*Math.cos(r/180*Math.PI):0,b:t?t*Math.sin(r/180*Math.PI):0};return o!==void 0&&(a.alpha=o),a},w=po;function uo(e,t){if(!t||t[0]!=="lch")return;let r={mode:"lch"},[,o,n,a,i]=t;if(o.type!==f.None){if(o.type===f.Hue)return;r.l=Math.min(Math.max(0,o.value),100)}if(n.type!==f.None&&(r.c=Math.max(0,n.type===f.Number?n.value:n.value*150/100)),a.type!==f.None){if(a.type===f.Percentage)return;r.h=a.value}return i.type!==f.None&&(r.alpha=Math.min(1,Math.max(0,i.type===f.Number?i.value:i.value/100))),r}var Nt=uo;var mo={mode:"lch",toMode:{lab:w,rgb:e=>ce(w(e))},fromMode:{rgb:e=>L(be(e)),lab:L},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,150],h:[0,360]},parse:[Nt],serialize:e=>`lch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,interpolate:{h:{use:l,fixup:k},c:l,l,alpha:{use:l,fixup:m}},difference:{h:qe},average:{h:X}},G=mo;var so={...G,mode:"lch65",parse:["--lch-d65"],serialize:"--lch-d65",toMode:{lab65:e=>w(e,"lab65"),rgb:e=>ve(w(e,"lab65"))},fromMode:{rgb:e=>L(Me(e),"lch65"),lab65:e=>L(e,"lch65")},ranges:{l:[0,100],c:[0,133.807],h:[0,360]}},Pt=so;var co={...x,mode:"lrgb",toMode:{rgb:T},fromMode:{rgb:y},parse:["srgb-linear"],serialize:"srgb-linear"},It=co;var bo=({l:e,a:t,b:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=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),p={mode:"lrgb",r:4.076741661347994*n-3.307711590408193*a+.230969928729428*i,g:-1.2684380040921763*n+2.6097574006633715*a-.3413193963102197*i,b:-.004196086541837188*n-.7034186144594493*a+1.7076147009309444*i};return o!==void 0&&(p.alpha=o),p},Te=bo;var ho=({r:e,g:t,b:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=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),p={mode:"oklab",l:.2104542553*n+.793617785*a-.0040720468*i,a:1.9779984951*n-2.428592205*a+.4505937099*i,b:.0259040371*n+.7827717662*a-.808675766*i};return o!==void 0&&(p.alpha=o),p},ze=ho;var xo=e=>{let t=ze(y(e));return e.r===e.b&&e.b===e.g&&(t.a=t.b=0),t},Le=xo;var go=e=>T(Te(e)),we=go;function vo(e,t){if(!t||t[0]!=="oklab")return;let r={mode:"oklab"},[,o,n,a,i]=t;if(!(o.type===f.Hue||n.type===f.Hue||a.type===f.Hue))return o.type!==f.None&&(r.l=Math.min(Math.max(0,o.type===f.Number?o.value:o.value/100),1)),n.type!==f.None&&(r.a=n.type===f.Number?n.value:n.value*.4/100),a.type!==f.None&&(r.b=a.type===f.Number?a.value:a.value*.4/100),i.type!==f.None&&(r.alpha=Math.min(1,Math.max(0,i.type===f.Number?i.value:i.value/100))),r}var Ot=vo;var yo={...F,mode:"oklab",toMode:{lrgb:Te,rgb:we},fromMode:{lrgb:ze,rgb:Le},ranges:{l:[0,1],a:[-.4,.4],b:[-.4,.4]},parse:[Ot],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}`:""})`},Ct=yo;function Mo(e,t){if(!t||t[0]!=="oklch")return;let r={mode:"oklch"},[,o,n,a,i]=t;if(o.type!==f.None){if(o.type===f.Hue)return;r.l=Math.min(Math.max(0,o.type===f.Number?o.value:o.value/100),1)}if(n.type!==f.None&&(r.c=Math.max(0,n.type===f.Number?n.value:n.value*.4/100)),a.type!==f.None){if(a.type===f.Percentage)return;r.h=a.value}return i.type!==f.None&&(r.alpha=Math.min(1,Math.max(0,i.type===f.Number?i.value:i.value/100))),r}var At=Mo;var To={...G,mode:"oklch",toMode:{oklab:e=>w(e,"oklab"),rgb:e=>we(w(e,"oklab"))},fromMode:{rgb:e=>L(Le(e),"oklch"),oklab:e=>L(e,"oklch")},parse:[At],serialize:e=>`oklch(${e.l!==void 0?e.l:"none"} ${e.c!==void 0?e.c:"none"} ${e.h!==void 0?e.h:"none"}${e.alpha<1?` / ${e.alpha}`:""})`,ranges:{l:[0,1],c:[0,.4],h:[0,360]}},qt=To;var zo=e=>{let{r:t,g:r,b:o,alpha:n}=y(e),a={mode:"xyz65",x:.486570948648216*t+.265667693169093*r+.1982172852343625*o,y:.2289745640697487*t+.6917385218365062*r+.079286914093745*o,z:0*t+.0451133818589026*r+1.043944368900976*o};return n!==void 0&&(a.alpha=n),a},Ze=zo;var Lo=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n=T({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 o!==void 0&&(n.alpha=o),n},Be=Lo;var wo={...x,mode:"p3",parse:["display-p3"],serialize:"display-p3",fromMode:{rgb:e=>Be(M(e)),xyz65:Be},toMode:{rgb:e=>z(Ze(e)),xyz65:Ze}},_t=wo;var je=e=>{let t=Math.abs(e);return t>=.001953125?Math.sign(e)*Math.pow(t,.5555555555555556):16*e},Ro=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n={mode:"prophoto",r:je(e*1.3457868816471585-t*.2555720873797946-.0511018649755453*r),g:je(e*-.5446307051249019+t*1.5082477428451466+.0205274474364214*r),b:je(e*0+t*0+1.2119675456389452*r)};return o!==void 0&&(n.alpha=o),n},We=Ro;var Ke=(e=0)=>{let t=Math.abs(e);return t>=.03125?Math.sign(e)*Math.pow(t,1.8):e/16},Ho=e=>{let t=Ke(e.r),r=Ke(e.g),o=Ke(e.b),n={mode:"xyz50",x:.7977666449006423*t+.1351812974005331*r+.0313477341283922*o,y:.2880748288194013*t+.7118352342418731*r+899369387256e-16*o,z:0*t+0*r+.8251046025104602*o};return e.alpha!==void 0&&(n.alpha=e.alpha),n},Qe=Ho;var ko={...x,mode:"prophoto",parse:["prophoto-rgb"],serialize:"prophoto-rgb",fromMode:{xyz50:We,rgb:e=>We(J(e))},toMode:{xyz50:Qe,rgb:e=>E(Qe(e))}},Dt=ko;var Et=1.09929682680944,Xo=.018053968510807,Ue=e=>{let t=Math.abs(e);return t>Xo?(Math.sign(e)||1)*(Et*Math.pow(t,.45)-(Et-1)):4.5*e},$o=({x:e,y:t,z:r,alpha:o})=>{e===void 0&&(e=0),t===void 0&&(t=0),r===void 0&&(r=0);let n={mode:"rec2020",r:Ue(e*1.7166511879712683-t*.3556707837763925-.2533662813736599*r),g:Ue(e*-.6666843518324893+t*1.6164812366349395+.0157685458139111*r),b:Ue(e*.0176398574453108-t*.0427706132578085+.9421031212354739*r)};return o!==void 0&&(n.alpha=o),n},Ve=$o;var Jt=1.09929682680944,So=.018053968510807,et=(e=0)=>{let t=Math.abs(e);return t{let t=et(e.r),r=et(e.g),o=et(e.b),n={mode:"xyz65",x:.6369580483012911*t+.1446169035862083*r+.1688809751641721*o,y:.262700212011267*t+.6779980715188708*r+.059301716469862*o,z:0*t+.0280726930490874*r+1.0609850577107909*o};return e.alpha!==void 0&&(n.alpha=e.alpha),n},tt=No;var Po={...x,mode:"rec2020",fromMode:{xyz65:Ve,rgb:e=>Ve(M(e))},toMode:{xyz65:tt,rgb:e=>z(tt(e))},parse:["rec2020"],serialize:"rec2020"},Yt=Po;var Io={mode:"xyz50",parse:["xyz-d50"],serialize:"xyz-d50",toMode:{rgb:E,lab:Y},fromMode:{rgb:J,lab:D},channels:["x","y","z","alpha"],ranges:{x:[0,.964],y:[0,.999],z:[0,.825]},interpolate:{x:l,y:l,z:l,alpha:{use:l,fixup:m}}},Ft=Io;var Oo=e=>{let{x:t,y:r,z:o,alpha:n}=e;t===void 0&&(t=0),r===void 0&&(r=0),o===void 0&&(o=0);let a={mode:"xyz50",x:1.0479298208405488*t+.0229467933410191*r-.0501922295431356*o,y:.0296278156881593*t+.990434484573249*r-.0170738250293851*o,z:-.0092430581525912*t+.0150551448965779*r+.7518742899580008*o};return n!==void 0&&(a.alpha=n),a},Gt=Oo;var Co=e=>{let{x:t,y:r,z:o,alpha:n}=e;t===void 0&&(t=0),r===void 0&&(r=0),o===void 0&&(o=0);let a={mode:"xyz65",x:.9554734527042182*t-.0230985368742614*r+.0632593086610217*o,y:-.0283697069632081*t+1.0099954580058226*r+.021041398966943*o,z:.0123140016883199*t-.0205076964334779*r+1.3303659366080753*o};return n!==void 0&&(a.alpha=n),a},Zt=Co;var Ao={mode:"xyz65",toMode:{rgb:z,xyz50:Gt},fromMode:{rgb:M,xyz50:Zt},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:l,y:l,z:l,alpha:{use:l,fixup:m}}},Bt=Ao;var Yi=u(Mt),Fi=u(Rt),Gi=u(Ht),Zi=u(Xt),Bi=u(F),ji=u(St),Wi=u(G),Ki=u(Pt),Qi=u(It),Ui=u(Ct),Vi=u(qt),ed=u(_t),td=u(Dt),rd=u(Yt),od=u(x),nd=u(Ft),ad=u(Bt);var qo=(e,t)=>Math.round(e*(t=Math.pow(10,t)))/t,_o=(e=4)=>t=>typeof t=="number"?qo(t,e):t,jt=_o;var md=jt(2),Do=e=>Math.max(0,Math.min(1,e||0)),rt=e=>Math.round(Do(e)*255),Eo=h("rgb"),sd=h("hsl"),Wt=e=>{if(e===void 0)return;let t=rt(e.r),r=rt(e.g),o=rt(e.b);return"#"+(1<<24|t<<16|r<<8|o).toString(16).slice(1)};var Kt=e=>{let t=ie(e);if(!t)return;let r=_(t.mode);if(!r.serialize||typeof r.serialize=="string"){let o=`color(${r.serialize||`--${t.mode}`} `;return r.channels.forEach((n,a)=>{n!=="alpha"&&(o+=(a?" ":"")+(t[n]!==void 0?t[n]:"none"))}),t.alpha!==void 0&&t.alpha<1&&(o+=` / ${t.alpha}`),o+")"}if(typeof r.serialize=="function")return r.serialize(t)},Qt=e=>Wt(Eo(e));var Jo=(e,t=_e(),r=o=>o)=>{let o=e.map((n,a)=>({color:r(n),i:a}));return(n,a=1,i=1/0)=>(isFinite(a)&&(a=Math.max(1,Math.min(a,o.length-1))),o.forEach(p=>{p.d=t(n,p.color)}),o.sort((p,b)=>p.d-b.d).slice(0,a).filter(p=>p.de[p.i]))},Ut=Jo;function ot(e){let t=h("lrgb")(e);return .2126*t.r+.7152*t.g+.0722*t.b}function Vt(e,t){let r=ot(e),o=ot(t);return(Math.max(r,o)+.05)/(Math.min(r,o)+.05)}var Ed=h("oklab");export{h as converter,wt as differenceCiede2000,Kt as formatCss,Qt as formatHex,Ut as nearest,Ed as oklab,de as parse,fe as parseHex,Vt as wcagContrast};