'use strict';var chunkX5FCFNQN_cjs=require('../chunk-X5FCFNQN.cjs'),chunkEXPXWBLP_cjs=require('../chunk-EXPXWBLP.cjs');var f={Rsco:.2126729,Gsco:.7151522,Bsco:.072175},a={normBG:.56,normTXT:.57,revBG:.65,revTXT:.62,scale:1.14,loClip:.1,offset:.027,blkThrs:.022,blkClmp:1.414,deltaYmin:5e-4};function A(e,t,n){let o=l=>(l/255)**2.4,r=f.Rsco*o(e)+f.Gsco*o(t)+f.Bsco*o(n);return r>a.blkThrs?r:r+(a.blkThrs-r)**a.blkClmp}function p(e,t){let n=A(e.r,e.g,e.b),o=A(t.r,t.g,t.b);if(Math.abs(o-n)<a.deltaYmin)return 0;if(o>n){let r=(o**a.normBG-n**a.normTXT)*a.scale;return r<a.loClip?0:(r-a.offset)*100}else {let r=(o**a.revBG-n**a.revTXT)*a.scale;return r>-0.1?0:(r+a.offset)*100}}var h=e=>{e.prototype.luminance=function(){let{r:t,g:n,b:o}=this._rawRgb();return chunkEXPXWBLP_cjs.b(.2126*chunkX5FCFNQN_cjs.a(t/255)+.7152*chunkX5FCFNQN_cjs.a(n/255)+.0722*chunkX5FCFNQN_cjs.a(o/255),4)},e.prototype.contrast=function(t="#fff"){let n=new e(t),o=n._rawRgb(),r=this._rawRgb(),s=(r.alpha<1?new e({r:r.alpha*r.r+(1-r.alpha)*o.r,g:r.alpha*r.g+(1-r.alpha)*o.g,b:r.alpha*r.b+(1-r.alpha)*o.b,alpha:1}):this).luminance(),c=n.luminance(),i=Math.max(s,c),m=Math.min(s,c);return chunkEXPXWBLP_cjs.b((i+.05)/(m+.05),2)},e.prototype.apcaContrast=function(t="#fff"){let n=new e(t).toRgb(),o=this.toRgb(),r=o.alpha<1?{r:o.alpha*o.r+(1-o.alpha)*n.r,g:o.alpha*o.g+(1-o.alpha)*n.g,b:o.alpha*o.b+(1-o.alpha)*n.b}:o;return Math.round(p(r,n)*10)/10},e.prototype.isReadableApca=function(t="#fff",n={}){let{size:o="normal"}=n,r=Math.abs(this.apcaContrast(t));return o==="large"?r>=60:r>=75},e.prototype.readableScore=function(t="#fff"){let n=this.contrast(t);return n>=7?"AAA":n>=4.5?"AA":n>=3?"AA large":"fail"},e.prototype.isReadable=function(t="#fff",n={}){let{level:o="AA",size:r="normal"}=n,l=this.contrast(t);return o==="AAA"?r==="large"?l>=4.5:l>=7:r==="large"?l>=3:l>=4.5},e.prototype.minReadable=function(t="#fff"){let n=new e(t).luminance(),o=(n+.05)/.05,r=1.05/(n+.05),l=o>=r,s=i=>l?i.darken(.01):i.lighten(.01);if(this.contrast(t)>=4.5)return this;let c=s(this);for(let i=1;i<100&&!(c.contrast(t)>=4.5);i++)c=s(c);return c};},y=h;module.exports=y;//# sourceMappingURL=a11y.cjs.map
//# sourceMappingURL=a11y.cjs.map