dicom-microscopy-viewer-changed
Version:
Interactive web-based viewer for DICOM Microscopy Images
2 lines • 19.7 kB
JavaScript
/*! For license information please see moo-color.min.js.LICENSE.txt */
!function(r,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MooColor=t():r.MooColor=t()}(this,(()=>(()=>{"use strict";var r={"./node_modules/color-name/index.js":r=>{r.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},"./src/color-converter.ts":(r,t,e)=>{e.r(t),e.d(t,{cmykToRgb:()=>u,hexToRgb:()=>f,hslToRgb:()=>n,hsvToHwb:()=>p,hsvToRgb:()=>i,hwbToHsv:()=>d,hwbToRgb:()=>s,resolveHwb:()=>g,rgbToCmyk:()=>l,rgbToHex:()=>m,rgbToHsl:()=>a,rgbToHsv:()=>h,rgbToHwb:()=>c});var o=e("./src/util/util.ts");function n(r,t,e){r/=60,t/=100,e/=100;var o,n,a,s=(1-Math.abs(2*e-1))*t,c=s*(1-Math.abs(r%2-1)),u=e-s/2;switch(Math.floor(r)){case 0:o=s,n=c,a=0;break;case 1:o=c,n=s,a=0;break;case 2:o=0,n=s,a=c;break;case 3:o=0,n=c,a=s;break;case 4:o=c,n=0,a=s;break;case 5:o=s,n=0,a=c}return[o,n,a].map((function(r){return 255*(r+u)}))}function a(r,t,e){r/=255,t/=255,e/=255;var o=Math.max(r,t,e),n=Math.min(r,t,e),a=o-n,s=(o+n)/2;return[0===a?0:o===r?(t-e)/a%6*60:o===t?60*((e-r)/a+2):60*((r-t)/a+4),100*(0===a?0:a/(1-Math.abs(2*s-1))),100*s]}function s(r,t,e){var o=d(r,t,e);return i(o[0],o[1],o[2])}function c(r,t,e){var o=h(r,t,e);return p(o[0],o[1],o[2])}function u(r,t,e,o){return[255*(1-(r/=100))*(1-(o/=100)),255*(1-(t/=100))*(1-o),255*(1-(e/=100))*(1-o)]}function l(r,t,e){r/=255,t/=255,e/=255;var o=1-Math.max(r,t,e);return[(1-r-o)/(1-o),(1-t-o)/(1-o),(1-e-o)/(1-o),o].map((function(r){return 100*r}))}function i(r,t,e){var o,n,a,s=r/60,c=(e/=100)*(t/=100),u=c*(1-Math.abs(s%2-1)),l=e-c;switch(Math.floor(s)){case 0:o=c,n=u,a=0;break;case 1:o=u,n=c,a=0;break;case 2:o=0,n=c,a=u;break;case 3:o=0,n=u,a=c;break;case 4:o=u,n=0,a=c;break;case 5:o=c,n=0,a=u}return[o,n,a].map((function(r){return 255*(r+l)}))}function h(r,t,e){r/=255,t/=255,e/=255;var o=Math.max(r,t,e),n=o-Math.min(r,t,e);return[0===n?0:o===r?(t-e)/n%6*60:o===t?60*((e-r)/n+2):60*((r-t)/n+4),100*(0===o?0:n/o),100*o]}function p(r,t,e){return[r,(1-(t/=100))*(e/=100)*100,100*(1-e)]}function d(r,t,e){var o;return r=(o=g(r,t,e))[0],t=o[1],e=o[2],[r,100*(1-(t/=100)/(1-(e/=100))),100*(1-e)]}function m(r,t,e,n,a){var s=[r,t,e];"number"==typeof n&&s.push(Math.round(255*n));var c=s.map((function(r){return(0,o.padStart)(r.toString(16),2,"0")})).join("");return a?function(r){var t=!0,e=r.match(/.{2}/g);return e.forEach((function(r){r.match(/(.)\1+/)||(t=!1)})),t?e.map((function(r){return r.substring(1)})).join(""):r}(c):c}function f(r){return r.replace(/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i,(function(r,t,e,o,n){return t+t+e+e+o+o+(n=void 0===n?"":n)+n})).match(/.{2}/g).map((function(r,t){return 3!==t?parseInt(r,16):parseInt(r,16)/255}))}function g(r,t,e){var o=t+e;return o>100&&(t=100*Number((t/o).toFixed(4)),e=100*Number((e/o).toFixed(4))),[r,t,e]}},"./src/color-formatter.ts":(r,t,e)=>{e.r(t),e.d(t,{ColorFormatter:()=>s,default:()=>c});var o=e("./src/color-converter.ts"),n=e("./src/color-names.ts"),a=e("./src/util/util.ts"),s=function(){function r(){this.resolveHwb=o.resolveHwb}return r.prototype.setColor=function(r){return r.alpha=(0,a.resolveAlpha)(r.alpha),this.color=r,this},r.prototype.getColor=function(){return this.color},r.prototype.getColorAs=function(r){return this.color.model===r?this.color:this.convert(this.color,r)},r.prototype.getModel=function(){return this.color?this.color.model:void 0},r.prototype.changeModel=function(r){return this.color.model===r?this:this.setColor(this.convert(this.color,r))},r.prototype.getAlpha=function(){return this.color.alpha},r.prototype.setAlpha=function(r){return this.color.alpha=r,this},r.prototype.convert=function(r,t){var e;switch(r.model){case"rgb":e=this.convertFromRgb(r.values,t);break;case"hwb":e=this.convertFromHwb(r.values,t);break;case"hsl":e=this.convertFromHsl(r.values,t);break;case"hsv":e=this.convertFromHsv(r.values,t);break;case"cmyk":e=this.convertFromCmyk(r.values,t)}if(!e.length)throw new Error("Converting Error!");return{model:t,values:e,alpha:r.alpha}},r.prototype.toString=function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];switch(r=r||this.color.model){case"hex":return this.toHex.apply(this,t);case"hwb":return this.toHwb();case"hsl":return this.toHsl();case"hsv":return this.toHsv();case"cmyk":return this.toCmyk();default:return this.toRgb.apply(this,t)}},r.prototype.toHex=function(r){void 0===r&&(r="full");var t=this.getColorAs("rgb"),e=t.values.map((function(r){return Math.round(r)})),s=e[0],c=e[1],u=e[2],l=1===t.alpha?null:t.alpha;switch(r){case"name":return function(){for(var r="",t=0,e=Object.keys(n.default);t<e.length;t++){var i=e[t];if((0,a.arrayIsEqual)(n.default[i],[s,c,u])){r=i;break}}return null===l&&""!==r?r:"#".concat(o.rgbToHex(s,c,u,l,!0))}();case"short":return"#".concat(o.rgbToHex(s,c,u,l,!0));default:return"#".concat(o.rgbToHex(s,c,u,l))}},r.prototype.toRgb=function(r){var t;void 0===r&&(r="default");var e=this.getColorAs("rgb"),o=e.values.map((function(r){return Math.round(r)})),n=o[0],a=o[1],s=o[2];return"percent"===r&&(t=[n,a,s].map((function(r){return"".concat(r/255*100,"%")})),n=t[0],a=t[1],s=t[2]),1===e.alpha?"rgb(".concat(n,", ").concat(a,", ").concat(s,")"):"rgba(".concat(n,", ").concat(a,", ").concat(s,", ").concat(e.alpha,")")},r.prototype.toHwb=function(){var r=this.getColorAs("hwb"),t=r.values.map((function(r){return(0,a.decimal)(r,2)})),e=t[0],o=t[1],n=t[2],s=1===r.alpha?"":", ".concat(r.alpha);return"hwb(".concat(e,", ").concat(o,"%, ").concat(n,"%").concat(s,")")},r.prototype.toHsl=function(){var r=this.getColorAs("hsl"),t=r.values.map((function(r){return(0,a.decimal)(r,2)})),e=t[0],o=t[1],n=t[2];return 1===r.alpha?"hsl(".concat(e,", ").concat(o,"%, ").concat(n,"%)"):"hsla(".concat(e,", ").concat(o,"%, ").concat(n,"%, ").concat(r.alpha,")")},r.prototype.toHsv=function(){var r=this.getColorAs("hsv"),t=r.values.map((function(r){return(0,a.decimal)(r,2)})),e=t[0],o=t[1],n=t[2];return 1===r.alpha?"hsv(".concat(e,", ").concat(o,"%, ").concat(n,"%)"):"hsva(".concat(e,", ").concat(o,"%, ").concat(n,"%, ").concat(r.alpha,")")},r.prototype.toCmyk=function(){var r=this.getColorAs("cmyk"),t=r.values.map((function(r){return(0,a.decimal)(r,2)})),e=t[0],o=t[1],n=t[2],s=t[3],c=1===r.alpha?"":", ".concat(r.alpha);return"cmyk(".concat(e,"%, ").concat(o,"%, ").concat(n,"%, ").concat(s,"%").concat(c,")")},r.prototype.convertFromRgb=function(r,t){var e=r[0],n=r[1],a=r[2];switch(t){case"rgb":return[e,n,a];case"hwb":return o.rgbToHwb(e,n,a);case"hsl":return o.rgbToHsl(e,n,a);case"hsv":return o.rgbToHsv(e,n,a);case"cmyk":return o.rgbToCmyk(e,n,a)}},r.prototype.convertFromHwb=function(r,t){var e=r[0],n=r[1],a=r[2],s=o.hwbToRgb(e,n,a),c=s[0],u=s[1],l=s[2];switch(t){case"rgb":return[c,u,l];case"hwb":return[e,n,a];case"hsl":return o.rgbToHsl(c,u,l);case"hsv":return o.hwbToHsv(e,n,a);case"cmyk":return o.rgbToCmyk(c,u,l)}},r.prototype.convertFromHsl=function(r,t){var e=r[0],n=r[1],a=r[2],s=o.hslToRgb(e,n,a),c=s[0],u=s[1],l=s[2];switch(t){case"rgb":return[c,u,l];case"hwb":return o.rgbToHwb(c,u,l);case"hsl":return[e,n,a];case"hsv":return o.rgbToHsv(c,u,l);case"cmyk":return o.rgbToCmyk(c,u,l)}},r.prototype.convertFromHsv=function(r,t){var e=r[0],n=r[1],a=r[2],s=o.hsvToRgb(e,n,a),c=s[0],u=s[1],l=s[2];switch(t){case"rgb":return[c,u,l];case"hwb":return o.hsvToHwb(e,n,a);case"hsl":return o.rgbToHsl(c,u,l);case"hsv":return[e,n,a];case"cmyk":return o.rgbToCmyk(c,u,l)}},r.prototype.convertFromCmyk=function(r,t){var e=r[0],n=r[1],a=r[2],s=r[3],c=o.cmykToRgb(e,n,a,s),u=c[0],l=c[1],i=c[2];switch(t){case"rgb":return[u,l,i];case"hwb":return o.rgbToHwb(u,l,i);case"hsl":return o.rgbToHsl(u,l,i);case"hsv":return o.rgbToHsv(u,l,i);case"cmyk":return[e,n,a,s]}},r}();const c=s},"./src/color-names.ts":(r,t,e)=>{e.r(t),e.d(t,{default:()=>o});const o=e("./node_modules/color-name/index.js")},"./src/color.ts":(r,t,e)=>{e.r(t)},"./src/input-parser.ts":(r,t,e)=>{e.r(t),e.d(t,{default:()=>s});var o=e("./src/color-converter.ts"),n=e("./src/color-names.ts"),a=e("./src/util/util.ts");function s(r){if(r in n.default)return{model:"rgb",values:n.default[r],alpha:1};if("transparent"===r)return{model:"rgb",values:[0,0,0],alpha:0};switch(r.substr(0,3).toLowerCase()){case"hwb":return function(r){var t=/^hwba?\s*\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/i;if(t.test(r)){var e=r.match(t),n=e[1],s=e[2],c=e[3],u=e[4];return{model:"hwb",values:(0,o.resolveHwb)((0,a.degree)(n),(0,a.clamp)(parseFloat(s),0,100),(0,a.clamp)(parseFloat(c),0,100)),alpha:(0,a.resolveAlpha)(u)}}return null}(r);case"hsl":return function(r){var t=/^hsla?\s*\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/i;if(t.test(r)){var e=r.match(t),o=e[1],n=e[2],s=e[3],c=e[4];return{model:"hsl",values:[(0,a.degree)(o),(0,a.clamp)(parseFloat(n),0,100),(0,a.clamp)(parseFloat(s),0,100)],alpha:(0,a.resolveAlpha)(c)}}return null}(r);case"hsv":return function(r){var t=/^hsva?\s*\(\s*([+-]?\d*[.]?\d+)(?:deg)?\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/i;if(t.test(r)){var e=r.match(t),o=e[1],n=e[2],s=e[3],c=e[4];return{model:"hsv",values:[(0,a.degree)(o),(0,a.clamp)(parseFloat(n),0,100),(0,a.clamp)(parseFloat(s),0,100)],alpha:(0,a.resolveAlpha)(c)}}return null}(r);case"cmy":return function(r){var t=/^cmyk\s*\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/i;if(t.test(r)){var e=r.match(t),o=e[1],n=e[2],s=e[3],c=e[4],u=e[5];return{model:"cmyk",values:[(0,a.clamp)(parseFloat(o),0,100),(0,a.clamp)(parseFloat(n),0,100),(0,a.clamp)(parseFloat(s),0,100),(0,a.clamp)(parseFloat(c),0,100)],alpha:(0,a.resolveAlpha)(u)}}return null}(r);default:return function(r){var t,e,o=/^#?([a-f0-9]{6})([a-f0-9]{2})?$/i,n=/^#?([a-f0-9]{3})([a-f0-9]{1})?$/i,s=/^rgba?\s*\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/,c=/^rgba?\s*\(\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*,\s*([+-]?[\d.]+)%\s*(?:,\s*([+-]?[\d.]+)\s*)?\)$/,u=function(r){return Math.round(parseInt(r,16)/255*100)/100};if(o.test(r)){var l=r.match(o),i=l[1],h=l[2];t=i.match(/.{2}/g).map((function(r){return parseInt(r,16)})),e=h?u(h):1}else if(n.test(r)){var p=r.match(n);i=p[1],h=p[2],t=i.match(/.{1}/g).map((function(r){return parseInt(r+r,16)})),e=h?u(h):1}else if(s.test(r)){var d=r.match(s),m=d[1],f=d[2],g=d[3];h=d[4],t=[m,f,g].map((function(r){return parseInt(r,0)})),e=(0,a.resolveAlpha)(h)}else{if(!c.test(r))return null;var b=r.match(c);m=b[1],f=b[2],g=b[3],h=b[4],t=[m,f,g].map((function(r){return Math.round(2.55*parseFloat(r))})),e=(0,a.resolveAlpha)(h)}return{model:"rgb",values:t.map((function(r){return(0,a.clamp)(r,0,255)})),alpha:(0,a.clamp)(e,0,1)}}(r)}}},"./src/util/util.ts":(r,t,e)=>{function o(r,t,e){var o=t-r.length;return o>0?"".concat(a(e,o)).concat(r):r}function n(r,t,e){var o=t-r.length;return o>0?"".concat(r).concat(a(e,o)):r}function a(r,t){for(;r.length<t;)r+=r;return r.substring(0,t)}function s(r,t,e){return Math.min(Math.max(t,r),e)}function c(r){return((r="string"==typeof r?parseFloat(r):r)%360+360)%360}function u(r){return r="string"==typeof r?parseFloat(r):r,s(isNaN(r)?1:r,0,1)}function l(r,t){var e=Math.pow(10,t);return Math.round(r*e)/e}function i(r,t,e){return void 0===e&&(e=0),l(Math.random()*(t-r)+r,e)}function h(r,t){return r.length===t.length&&r.every((function(r,e){return Array.isArray(r)?h(r,t[e]):r===t[e]}))}e.r(t),e.d(t,{arrayIsEqual:()=>h,clamp:()=>s,decimal:()=>l,degree:()=>c,getRandom:()=>i,padEnd:()=>n,padStart:()=>o,resolveAlpha:()=>u})}},t={};function e(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return r[o](a,a.exports,e),a.exports}e.n=r=>{var t=r&&r.__esModule?()=>r.default:()=>r;return e.d(t,{a:t}),t},e.d=(r,t)=>{for(var o in t)e.o(t,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:t[o]})},e.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t),e.r=r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})};var o={};return(()=>{e.r(o),e.d(o,{ColorFormatter:()=>n.default,MooColor:()=>u,default:()=>l});var r,t=e("./src/color-converter.ts"),n=e("./src/color-formatter.ts"),a=e("./src/input-parser.ts"),s=e("./src/util/util.ts"),c=(e("./src/color.ts"),r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])},r(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}),u=function(r){function e(t){var e=r.call(this)||this;return"object"==typeof t&&null!==t?e.setColor(t):"string"!=typeof t&&void 0!==t||(t=t||"#000",e.setColorByParser(t)),e}return c(e,r),e.mix=function(r,t,o){void 0===o&&(o=50);var n=r instanceof e?r:new e(r);return(t instanceof e?t:new e(t)).mix(n,o)},e.random=function(r){var o,n=void 0===r?{}:r,a=n.hue,c=n.white,u=n.black;return o=[a,c,u].map((function(r,t){if("number"==typeof r)return r;if(Array.isArray(r)){var e=0===t?0:2;return(0,s.getRandom)(Math.min.apply(Math,r),Math.max.apply(Math,r),e)}return 0===t?(0,s.getRandom)(0,360):(0,s.getRandom)(0,100,2)})),a=o[0],c=o[1],u=o[2],new e({model:"hwb",values:(0,t.resolveHwb)((0,s.degree)(a),(0,s.clamp)(c,0,100),(0,s.clamp)(u,0,100)),alpha:1})},e.prototype.setColorByParser=function(r){var t=(0,a.default)(r);if(!t)throw new Error("parsing error!");return this.setColor(t)},e.prototype.clone=function(){return new e(this.color)},Object.defineProperty(e.prototype,"brightness",{get:function(){var r=this.getColorAs("rgb").values;return(299*r[0]+587*r[1]+114*r[2])/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLight",{get:function(){return this.brightness>=128},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDark",{get:function(){return this.brightness<128},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"luminance",{get:function(){var r=this.getColorAs("rgb").values.map((function(r){return r/255}));return.2126*r[0]+.7152*r[1]+.0722*r[2]},enumerable:!1,configurable:!0}),e.prototype.contrastRatioWith=function(r){return(Math.max(this.luminance,r.luminance)+.05)/(Math.min(this.luminance,r.luminance)+.05)},e.prototype.isContrastEnough=function(r){return this.contrastRatioWith(r)>=4.5},e.prototype.lighten=function(r){return this.manipulate("hsl",(function(t,e,o){return[t,e,o=(0,s.clamp)(o+r,0,100)]}))},e.prototype.darken=function(r){return this.manipulate("hsl",(function(t,e,o){return[t,e,o=(0,s.clamp)(o-r,0,100)]}))},e.prototype.saturate=function(r){return this.manipulate("hsl",(function(t,e,o){return[t,e=(0,s.clamp)(e+r,0,100),o]}))},e.prototype.desaturate=function(r){return this.manipulate("hsl",(function(t,e,o){return[t,e=(0,s.clamp)(e-r,0,100),o]}))},e.prototype.grayscale=function(){return this.manipulate("hsl",(function(r,t,e){return[r,0,e]}))},e.prototype.whiten=function(r){var t=this;return this.manipulate("hwb",(function(e,o,n){return t.resolveHwb(e,(0,s.clamp)(o+r,0,100),n)}))},e.prototype.blacken=function(r){var t=this;return this.manipulate("hwb",(function(e,o,n){return t.resolveHwb(e,o,(0,s.clamp)(n+r,0,100))}))},e.prototype.rotate=function(r){return this.manipulate("hsl",(function(t,e,o){return[(0,s.degree)(t+r),e,o]}))},e.prototype.mix=function(r,t){void 0===t&&(t=50),t/=100;var o=this.getModel(),n=this.getColorAs("rgb"),a=r.getColorAs("rgb");return new e({model:"rgb",values:n.values.map((function(r,e){return r+(a.values[e]-r)*t})),alpha:n.alpha+(a.alpha-n.alpha)*t}).changeModel(o)},e.prototype.complement=function(){return this.manipulate("hsl",(function(r,t,e){return[(0,s.degree)(r+180),t,e]}))},e.prototype.invert=function(r){return void 0===r&&(r=100),r/=100,this.manipulate("rgb",(function(t,e,o){return[t,e,o].map((function(t){return function(r){return Math.round(Math.abs(r))}(255*r-t)}))}))},e.prototype.manipulate=function(r,t){var e=this.color.model,o=this.getColorAs(r);return o.values=t.apply(void 0,o.values),this.setColor(o).changeModel(e)},e}(n.default);const l=u})(),o})()));