'use strict';var chunkBBEOVRYB_cjs=require('./chunk-BBEOVRYB.cjs'),chunkIHOZOJHA_cjs=require('./chunk-IHOZOJHA.cjs'),chunkX5FCFNQN_cjs=require('./chunk-X5FCFNQN.cjs'),chunkEXPXWBLP_cjs=require('./chunk-EXPXWBLP.cjs');var K=/^oklch\(\s*([+-]?\d*\.?\d+)(%?)\s+([+-]?\d*\.?\d+)(%?)\s+([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,q=/^oklab\(\s*([+-]?\d*\.?\d+)(%?)\s+([+-]?\d*\.?\d+)(%?)\s+([+-]?\d*\.?\d+)(%?)\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,C=e=>{if(typeof e=="object"&&e!==null){let r=e;if("l"in r&&"a"in r&&"b"in r&&r.colorSpace!=="lab"&&!("c"in r)&&!("r"in r)){let n=e;if(typeof n.l=="number"&&typeof n.a=="number"&&typeof n.b=="number"&&typeof n.alpha=="number")return {l:n.l,a:n.a,b:n.b,alpha:n.alpha}}if("l"in r&&"c"in r&&"h"in r&&r.colorSpace!=="lch"&&!("a"in r)&&!("r"in r)){let n=e;if(typeof n.l=="number"&&typeof n.c=="number"&&typeof n.h=="number"){let o=n.h*Math.PI/180;return {l:n.l,a:n.c*Math.cos(o),b:n.c*Math.sin(o),alpha:n.alpha}}}if(r.colorSpace==="lab"){let n=e;if(typeof n.l!="number"||typeof n.a!="number"||typeof n.b!="number")return null;let{x:o,y:t,z:b}=chunkIHOZOJHA_cjs.d(n),[u,l,p]=chunkIHOZOJHA_cjs.b(o,t,b),[m,d,k]=chunkBBEOVRYB_cjs.a(u,l,p);return {l:m,a:d,b:k,alpha:typeof n.alpha=="number"?n.alpha:1}}return null}if(typeof e=="string"){let r=K.exec(e);if(r){let n=r[2]?Number(r[1])/100:Number(r[1]),o=r[4]?Number(r[3])*.004:Number(r[3]),t=r[6]?.toLowerCase()??"deg",u=Number(r[5])*(chunkEXPXWBLP_cjs.d[t]??1)*Math.PI/180,l=r[7]===void 0?1:Number(r[7])/(r[8]?100:1);return {l:n,a:o*Math.cos(u),b:o*Math.sin(u),alpha:l}}if(r=q.exec(e),r){let n=r[2]?Number(r[1])/100:Number(r[1]),o=r[4]?Number(r[3])*.004:Number(r[3]),t=r[6]?Number(r[5])*.004:Number(r[5]),b=r[7]===void 0?1:Number(r[7])/(r[8]?100:1);return {l:n,a:o,b:t,alpha:b}}return null}return null},c=5e-4,D=(e,r,n)=>e>=-c&&e<=1+c&&r>=-c&&r<=1+c&&n>=-c&&n<=1+c,O=(e,r,n)=>e>=0&&e<=1&&r>=0&&r<=1&&n>=0&&n<=1,Q=e=>{let r=C(e);if(r===null)return  true;let[n,o,t]=chunkBBEOVRYB_cjs.f(r.l,r.a,r.b);return D(n,o,t)},E=.02,U=1e-4,F=(e,r)=>{let n=e[0]-r[0],o=e[1]-r[1],t=e[2]-r[2];return Math.sqrt(n*n+o*o+t*t)},_=(e,r,n,o,t,b)=>{if(e>=1)return {l:1,a:0,b:0,alpha:o};if(e<=0)return {l:0,a:0,b:0,alpha:o};let[u,l,p]=t(e,r,n);if(O(u,l,p))return {l:e,a:r,b:n,alpha:o};let m=b(chunkEXPXWBLP_cjs.a(u,0,1),chunkEXPXWBLP_cjs.a(l,0,1),chunkEXPXWBLP_cjs.a(p,0,1));if(F(m,[e,r,n])<=E)return {l:m[0],a:m[1],b:m[2],alpha:o};let d=Math.atan2(n,r),k=Math.sqrt(r*r+n*n),f=0,L=k,M=true,y=m;for(;L-f>U;){let i=(f+L)/2,N=i*Math.cos(d),x=i*Math.sin(d),[A,T,R]=t(e,N,x);if(M&&O(A,T,R)){f=i;continue}let I=b(chunkEXPXWBLP_cjs.a(A,0,1),chunkEXPXWBLP_cjs.a(T,0,1),chunkEXPXWBLP_cjs.a(R,0,1));y=I,F(I,[e,N,x])<=E?(f=i,M=false):L=i;}return {l:y[0],a:y[1],b:y[2],alpha:o}},V=e=>{let r=C(e);if(r===null)return null;let{l:n,a:o,b:t,alpha:b}=r;return _(n,o,t,b,chunkBBEOVRYB_cjs.f,chunkBBEOVRYB_cjs.a)},W=(e,r)=>{let n=C(e);if(n===null)return  true;let[o,t,b]=r(n.l,n.a,n.b);return D(o,t,b)},Y=(e,r,n)=>{let o=C(e);if(o===null)return null;let{l:t,a:b,b:u,alpha:l}=o;return _(t,b,u,l,r,n)};var P=Math.PI/180,j=(e,r,n)=>{let o=n*P;return chunkBBEOVRYB_cjs.f(e,r*Math.cos(o),r*Math.sin(o))},z=(e,r,n,o)=>{let t=o*P;chunkBBEOVRYB_cjs.e(e,r,n*Math.cos(t),n*Math.sin(t));},er=(e,r,n)=>{let[o,t,b]=j(e,r,n);return [chunkX5FCFNQN_cjs.b(o),chunkX5FCFNQN_cjs.b(t),chunkX5FCFNQN_cjs.b(b)]},or=(e,r,n,o)=>{z(e,r,n,o),e[0]=chunkX5FCFNQN_cjs.b(e[0]),e[1]=chunkX5FCFNQN_cjs.b(e[1]),e[2]=chunkX5FCFNQN_cjs.b(e[2]);},tr=(e,r,n)=>{let[o,t,b]=j(e,r,n);return [[o,t,b],[chunkX5FCFNQN_cjs.b(o),chunkX5FCFNQN_cjs.b(t),chunkX5FCFNQN_cjs.b(b)]]},br=(e,r,n,o,t)=>{z(e,n,o,t),r[0]=chunkX5FCFNQN_cjs.b(e[0]),r[1]=chunkX5FCFNQN_cjs.b(e[1]),r[2]=chunkX5FCFNQN_cjs.b(e[2]);};exports.a=Q;exports.b=V;exports.c=W;exports.d=Y;exports.e=j;exports.f=z;exports.g=er;exports.h=or;exports.i=tr;exports.j=br;//# sourceMappingURL=chunk-EPG4VVQB.cjs.map
//# sourceMappingURL=chunk-EPG4VVQB.cjs.map