'use strict';var chunkGYCEEHZT_cjs=require('../chunk-GYCEEHZT.cjs'),chunkEXPXWBLP_cjs=require('../chunk-EXPXWBLP.cjs');var g=r=>({c:chunkEXPXWBLP_cjs.a(r.c,0,100),m:chunkEXPXWBLP_cjs.a(r.m,0,100),y:chunkEXPXWBLP_cjs.a(r.y,0,100),k:chunkEXPXWBLP_cjs.a(r.k,0,100),alpha:chunkEXPXWBLP_cjs.a(r.alpha,0,1)}),f=({r,g:o,b:t,alpha:e})=>{let n=1-Math.max(r/255,o/255,t/255);if(n===1)return {c:0,m:0,y:0,k:chunkEXPXWBLP_cjs.b(100*n),alpha:e};let m=(1-r/255-n)/(1-n),k=(1-o/255-n)/(1-n),u=(1-t/255-n)/(1-n);return {c:chunkEXPXWBLP_cjs.b(100*m,2),m:chunkEXPXWBLP_cjs.b(100*k,2),y:chunkEXPXWBLP_cjs.b(100*u,2),k:chunkEXPXWBLP_cjs.b(100*n,2),alpha:e}},b=({c:r,m:o,y:t,k:e,alpha:n})=>chunkGYCEEHZT_cjs.a({r:255*(1-r/100)*(1-e/100),g:255*(1-o/100)*(1-e/100),b:255*(1-t/100)*(1-e/100),alpha:n}),i=r=>{if(!chunkEXPXWBLP_cjs.h(r)||!chunkEXPXWBLP_cjs.i(r,["c","m","y","k"]))return null;let{c:o,m:t,y:e,k:n,alpha:m=1}=r;return !chunkEXPXWBLP_cjs.f(o)||!chunkEXPXWBLP_cjs.f(t)||!chunkEXPXWBLP_cjs.f(e)||!chunkEXPXWBLP_cjs.f(n)||!chunkEXPXWBLP_cjs.f(m)?null:b(g({c:chunkEXPXWBLP_cjs.g(o),m:chunkEXPXWBLP_cjs.g(t),y:chunkEXPXWBLP_cjs.g(e),k:chunkEXPXWBLP_cjs.g(n),alpha:chunkEXPXWBLP_cjs.g(m)}))},h=/^device-cmyk\(\s*([+-]?\d*\.?\d+)(%?)\s+([+-]?\d*\.?\d+)(%?)\s+([+-]?\d*\.?\d+)(%?)\s+([+-]?\d*\.?\d+)(%?)\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=r=>{if(typeof r!="string")return null;let o=h.exec(r.trim());if(!o)return null;let t=(e,n)=>Number(e)*(n?1:100);return b(g({c:t(o[1],o[2]),m:t(o[3],o[4]),y:t(o[5],o[6]),k:t(o[7],o[8]),alpha:o[9]===void 0?1:Number(o[9])/(o[10]?100:1)}))};var $=(r,o,t)=>{r.prototype.toCmyk=function(){return f(this._rawRgb())},r.prototype.toCmykString=function(){let{c:e,m:n,y:m,k,alpha:u}=this.toCmyk();return u<1?`device-cmyk(${e}% ${n}% ${m}% ${k}% / ${u})`:`device-cmyk(${e}% ${n}% ${m}% ${k}%)`},o.push(i,p),t.push([i,"cmyk"],[p,"cmyk"]);},S=$;module.exports=S;//# sourceMappingURL=cmyk.cjs.map
//# sourceMappingURL=cmyk.cjs.map