/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports"],(function(n){"use strict";function t(n){return"r"in n&&"g"in n&&"b"in n}function r(n){return"h"in n&&"s"in n&&"v"in n}function e(n){return"l"in n&&"a"in n&&"b"in n}function o(n){return"l"in n&&"c"in n&&"h"in n}function u(n){return"x"in n&&"y"in n&&"z"in n}const c=[[.4124,.3576,.1805],[.2126,.7152,.0722],[.0193,.1192,.9505]],i=[[3.2406,-1.5372,-.4986],[-.9689,1.8758,.0415],[.0557,-.204,1.057]];function a(n,t){const r=[];let e,o;if(n[0].length!==t.length)throw"dimensions do not match";const u=n.length,c=n[0].length;let i=0;for(e=0;e<u;e++){for(i=0,o=0;o<c;o++)i+=n[e][o]*t[o];r.push(i)}return r}function s(n){const t=[n.r/255,n.g/255,n.b/255].map((n=>n<=.04045?n/12.92:((n+.055)/1.055)**2.4)),r=a(c,t);return{x:100*r[0],y:100*r[1],z:100*r[2]}}function f(n){const t=a(i,[n.x/100,n.y/100,n.z/100]).map((n=>{const t=n<=.0031308?12.92*n:1.055*n**(1/2.4)-.055;return Math.min(1,Math.max(t,0))}));return{r:Math.round(255*t[0]),g:Math.round(255*t[1]),b:Math.round(255*t[2])}}function h(n){const t=[n.x/95.047,n.y/100,n.z/108.883].map((n=>n>(6/29)**3?n**(1/3):1/3*(29/6)**2*n+4/29));return{l:116*t[1]-16,a:500*(t[0]-t[1]),b:200*(t[1]-t[2])}}function b(n){const t=n.l,r=[(t+16)/116+n.a/500,(t+16)/116,(t+16)/116-n.b/200].map((n=>n>6/29?n**3:3*(6/29)**2*(n-4/29)));return{x:95.047*r[0],y:100*r[1],z:108.883*r[2]}}function l(n){const t=n.l,r=n.a,e=n.b,o=Math.sqrt(r*r+e*e);let u=Math.atan2(e,r);return u=u>0?u:u+2*Math.PI,{l:t,c:o,h:u}}function g(n){const t=n.l,r=n.c,e=n.h;return{l:t,a:r*Math.cos(e),b:r*Math.sin(e)}}function M(n){return h(s(n))}function d(n){return f(b(n))}function m(n){return l(h(s(n)))}function x(n){return f(b(g(n)))}function k(n){const t=n.r,r=n.g,e=n.b,o=Math.max(t,r,e),u=o-Math.min(t,r,e);let c=o,i=0===u?0:o===t?(r-e)/u%6:o===r?(e-t)/u+2:(t-r)/u+4,a=0===u?0:u/c;return i<0&&(i+=6),i*=60,a*=100,c*=100/255,{h:i,s:a,v:c}}function p(n){const t=(n.h+360)%360/60,r=n.s/100,e=n.v/100*255,o=e*r,u=o*(1-Math.abs(t%2-1));let c;switch(Math.floor(t)){case 0:c={r:o,g:u,b:0};break;case 1:c={r:u,g:o,b:0};break;case 2:c={r:0,g:o,b:u};break;case 3:c={r:0,g:u,b:o};break;case 4:c={r:u,g:0,b:o};break;case 5:case 6:c={r:o,g:0,b:u};break;default:c={r:0,g:0,b:0}}return c.r=Math.round(c.r+e-o),c.g=Math.round(c.g+e-o),c.b=Math.round(c.b+e-o),c}function y(n){return t(n)?n:o(n)?x(n):e(n)?d(n):u(n)?f(n):r(n)?p(n):n}function v(n){if(r(n))return n;return k(y(n))}function z(n){return e(n)?n:M(y(n))}function S(n){return o(n)?n:m(y(n))}function w(n){return u(n)?n:s(y(n))}function B(n,t){const r=M(n);return r.l*=1-t,d(r)}n.darken=B,n.toHSV=v,n.toLAB=z,n.toLCH=S,n.toRGB=y,n.toXYZ=w,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
