'use strict';var chunk2KB6V6KD_cjs=require('../chunk-2KB6V6KD.cjs'),chunkYISEJCI6_cjs=require('../chunk-YISEJCI6.cjs');var h=r=>({c:chunkYISEJCI6_cjs.a(r.c,0,100),m:chunkYISEJCI6_cjs.a(r.m,0,100),y:chunkYISEJCI6_cjs.a(r.y,0,100),k:chunkYISEJCI6_cjs.a(r.k,0,100),alpha:chunkYISEJCI6_cjs.a(r.alpha,0,1)}),R=({r,g:o,b:m,alpha:t})=>{let n=1-Math.max(r/255,o/255,m/255);return n===1?{c:0,m:0,y:0,k:100,alpha:t}:{c:(1-r/255-n)/(1-n)*100,m:(1-o/255-n)/(1-n)*100,y:(1-m/255-n)/(1-n)*100,k:n*100,alpha:t}};var d=({c:r,m:o,y:m,k:t,alpha:n})=>chunk2KB6V6KD_cjs.a({r:255*(1-r/100)*(1-t/100),g:255*(1-o/100)*(1-t/100),b:255*(1-m/100)*(1-t/100),alpha:n}),i=r=>{if(!chunkYISEJCI6_cjs.h(r)||!chunkYISEJCI6_cjs.i(r,["c","m","y","k"]))return null;let{c:o,m,y:t,k:n,alpha:e=1}=r;return !chunkYISEJCI6_cjs.f(o)||!chunkYISEJCI6_cjs.f(m)||!chunkYISEJCI6_cjs.f(t)||!chunkYISEJCI6_cjs.f(n)||!chunkYISEJCI6_cjs.f(e)?null:d(h({c:chunkYISEJCI6_cjs.g(o),m:chunkYISEJCI6_cjs.g(m),y:chunkYISEJCI6_cjs.g(t),k:chunkYISEJCI6_cjs.g(n),alpha:chunkYISEJCI6_cjs.g(e)}))},w=new RegExp(`^device-cmyk\\(\\s*(?<c>${chunkYISEJCI6_cjs.k})(?<cp>%?)\\s+(?<m>${chunkYISEJCI6_cjs.k})(?<mp>%?)\\s+(?<y>${chunkYISEJCI6_cjs.k})(?<yp>%?)\\s+(?<k>${chunkYISEJCI6_cjs.k})(?<kp>%?)\\s*(?:/\\s*(?<al>${chunkYISEJCI6_cjs.k})(?<alp>%?)\\s*)?\\)$`,"i"),g=r=>{if(typeof r!="string")return null;let o=w.exec(r.trim())?.groups;if(!o)return null;let m=(t,n)=>chunkYISEJCI6_cjs.l(t)*(n?1:100);return d(h({c:m(o.c,o.cp),m:m(o.m,o.mp),y:m(o.y,o.yp),k:m(o.k,o.kp),alpha:o.al===void 0?1:chunkYISEJCI6_cjs.l(o.al)/(o.alp?100:1)}))};var x=(r,o,m)=>{r.prototype.toCmyk=function(t=2){let{c:n,m:e,y:s,k:a,alpha:u}=R(this._rawRgb());return {c:chunkYISEJCI6_cjs.b(n,t),m:chunkYISEJCI6_cjs.b(e,t),y:chunkYISEJCI6_cjs.b(s,t),k:chunkYISEJCI6_cjs.b(a,t),alpha:u}},r.prototype.toCmykString=function(t=2){let{c:n,m:e,y:s,k:a,alpha:u}=this.toCmyk(t);return u<1?`device-cmyk(${n}% ${e}% ${s}% ${a}% / ${u})`:`device-cmyk(${n}% ${e}% ${s}% ${a}%)`},o.push(i,g),m.push([i,"cmyk"],[g,"cmyk"]);},_=x;module.exports=_;//# sourceMappingURL=cmyk.cjs.map
//# sourceMappingURL=cmyk.cjs.map