Comparing version 0.13.1 to 0.13.2
@@ -1,1 +0,1 @@ | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r="undefined"!=typeof globalThis?globalThis:r||self).culori={})}(this,(function(r){"use strict";function n(r,n){if("number"==typeof r)return 3===n?{mode:"rgb",r:(r>>8&15|r>>4&240)/255,g:(r>>4&15|240&r)/255,b:(15&r|r<<4&240)/255}:4===n?{mode:"rgb",r:(r>>12&15|r>>8&240)/255,g:(r>>8&15|r>>4&240)/255,b:(r>>4&15|240&r)/255,alpha:(15&r|r<<4&240)/255}:6===n?{mode:"rgb",r:(r>>16&255)/255,g:(r>>8&255)/255,b:(255&r)/255}:8===n?{mode:"rgb",r:(r>>24&255)/255,g:(r>>16&255)/255,b:(r>>8&255)/255,alpha:(255&r)/255}:void 0}var a={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};var t=(/([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)/+"").replace(/^\/|\/$/g,""),e=t+"%",o=t+"%?",i="(?:"+t+"%|"+t+")",u="(?:"+t+"(deg|grad|rad|turn)|"+t+")",h="\\s*,\\s*",l="\\s+",c=new RegExp("^rgba?\\(\\s*"+t+h+t+h+t+"\\s*(?:,\\s*"+i+"\\s*)?\\)$"),f=new RegExp("^rgba?\\(\\s*"+e+h+e+h+e+"\\s*(?:,\\s*"+i+"\\s*)?\\)$"),p=new RegExp("^rgba?\\(\\s*"+t+l+t+l+t+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),d=new RegExp("^rgba?\\(\\s*"+e+l+e+l+e+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),s=new RegExp("^hsla?\\(\\s*"+u+h+e+h+e+"\\s*(?:,\\s*"+i+"\\s*)?\\)$"),v=new RegExp("^hsla?\\(\\s*"+u+l+e+l+e+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),g=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,b=new RegExp("^hwb\\(\\s*"+u+l+e+l+e+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),M=new RegExp("^lab\\(\\s*"+o+l+t+l+t+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),m=new RegExp("^lch\\(\\s*"+o+l+t+l+u+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$");function w(r){return r}function y(r,n,a){return r+a*(n-r)}function x(r){return void 0===r&&(r=1),1===r?w:function(n){return Math.pow(n,r)}}var k=function(r){return function(n){var a=function(r){for(var n=[],a=0;a<r.length-1;a++){var t=r[a],e=r[a+1];void 0===t&&void 0===e?n.push(void 0):void 0!==t&&void 0!==e?n.push([t,e]):n.push(void 0!==t?[t,t]:[e,e])}return n}(n);return function(n){var t=n*a.length,e=1===n?a.length-1:Math.floor(t),o=a[e];return void 0===o?void 0:r(o[0],o[1],t-e)}}},q=k(y),I=function(r){var n=!1,a=r.map((function(r){return void 0!==r?(n=!0,r):1}));return n?a:r},P={mode:"rgb",channels:["r","g","b","alpha"],parsers:[function(r){var a;return(a=r.match(g))?n(parseInt(a[1],16),a[1].length):void 0},function(r){var n,a;if(n=r.match(c)||r.match(p))a={mode:"rgb",r:n[1]/255,g:n[2]/255,b:n[3]/255};else{if(!(n=r.match(f)||r.match(d)))return;a={mode:"rgb",r:n[1]/100,g:n[2]/100,b:n[3]/100}}return void 0!==n[4]?a.alpha=n[4]/100:void 0!==n[5]&&(a.alpha=+n[5]),a},function(r){return"string"==typeof r&&n(a[r.toLowerCase()],6)||void 0},function(r){return"transparent"===r?n(0,8):void 0}],interpolate:{r:q,g:q,b:q,alpha:{use:q,fixup:I}}},S=function(r){return r<.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)};function z(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o={mode:"lrgb",r:S(n),g:S(a),b:S(t)};return void 0!==e&&(o.alpha=e),o}var E=function(r){return r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r};function C(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o={mode:"rgb",r:E(n),g:E(a),b:E(t)};return void 0!==e&&(o.alpha=e),o}var R={mode:"lrgb",output:{rgb:C},input:{rgb:z},channels:["r","g","b","alpha"],interpolate:{r:q,g:q,b:q,alpha:{use:q,fixup:I}}};function A(r){return(r%=360)<0?r+360:r}var N=function(r,n){switch(n){case"deg":return+r;case"rad":return r/Math.PI*180;case"grad":return r/10*9;case"turn":return 360*r}};var H=function(r,n){return r.map((function(a,t,e){if(void 0===a)return a;var o=A(a);return 0===t||void 0===r[t-1]?o:n(o-A(e[t-1]))})).reduce((function(r,n){return r.length&&void 0!==n&&void 0!==r[r.length-1]?(r.push(n+r[r.length-1]),r):(r.push(n),r)}),[])},$=function(r){return H(r,(function(r){return Math.abs(r)<=180?r:r-360*Math.sign(r)}))},j={},O={},L=[],B=function(r){j[r.mode]=Object.assign(j[r.mode]||{},r.output),Object.keys(r.input||{}).forEach((function(n){j[n]||(j[n]={}),j[n][r.mode]=r.input[n]})),r.ranges||(r.ranges={}),r.difference||(r.difference={}),r.channels.forEach((function(n){if(void 0===r.ranges[n]&&(r.ranges[n]=[0,1]),!r.interpolate[n])throw new Error("Missing interpolator for: "+n);"function"==typeof r.interpolate[n]&&(r.interpolate[n]={use:r.interpolate[n]}),r.interpolate[n].fixup||(r.interpolate[n].fixup=w)})),O[r.mode]=r,(r.parsers||[]).forEach((function(r){return L.push(r)}))},D=function(r){return O[r]},T=function(r){for(var n,a=0,t=L.length;a<t&&void 0===(n=L[a++](r)););return n};function F(r,n){return void 0===r?void 0:"object"!=typeof r?T(r):void 0!==r.mode?r:n?Object.assign({},r,{mode:n}):void 0}var G=function(r){return void 0===r&&(r="rgb"),function(n){return void 0!==(n=F(n,r))?n.mode===r?n:j[n.mode][r]?j[n.mode][r](n):"rgb"===r?j[n.mode].rgb(n):j.rgb[r](j[n.mode].rgb(n)):void 0}},W=function(r,n){if(void 0===r.h||void 0===n.h||!r.s||!n.s)return 0;var a=A(r.h),t=A(n.h),e=Math.sin((t-a+360)/2*Math.PI/180);return 2*Math.sqrt(r.s*n.s)*e},_=function(r,n){if(void 0===r.h||void 0===n.h)return 0;var a=A(r.h),t=A(n.h);return Math.abs(t-a)>180?a-(t-360*Math.sign(t-a)):t-a},K=function(r,n){if(void 0===r.h||void 0===n.h||!r.c||!n.c)return 0;var a=A(r.h),t=A(n.h),e=Math.sin((t-a+360)/2*Math.PI/180);return 2*Math.sqrt(r.c*n.c)*e},J=function(r,n){void 0===r&&(r="rgb"),void 0===n&&(n=[1,1,1,0]);var a=D(r),t=a.channels,e=a.difference,o=G(r);return function(r,a){var i=o(r),u=o(a);return Math.sqrt(t.reduce((function(r,a,t){var o=e[a]?e[a](i,u):i[a]-u[a];return r+(n[t]||0)*Math.pow(isNaN(o)?0:o,2)}),0))}},Q={mode:"hsl",output:{rgb:function(r){var n=r.h,a=r.s,t=r.l,e=r.alpha;n=A(n);var o,i=t+a*(t<.5?t:1-t),u=i-2*(i-t)*Math.abs(n/60%2-1);switch(Math.floor(n/60)){case 0:o={r:i,g:u,b:2*t-i};break;case 1:o={r:u,g:i,b:2*t-i};break;case 2:o={r:2*t-i,g:i,b:u};break;case 3:o={r:2*t-i,g:u,b:i};break;case 4:o={r:u,g:2*t-i,b:i};break;case 5:o={r:i,g:2*t-i,b:u};break;default:o={r:2*t-i,g:2*t-i,b:2*t-i}}return o.mode="rgb",void 0!==e&&(o.alpha=e),o}},input:{rgb:function(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=Math.max(n,a,t),i=Math.min(n,a,t),u={mode:"hsl",s:o===i?0:(o-i)/(1-Math.abs(o+i-1)),l:.5*(o+i)};return o-i!=0&&(u.h=60*(o===n?(a-t)/(o-i)+6*(a<t):o===a?(t-n)/(o-i)+2:(n-a)/(o-i)+4)),void 0!==e&&(u.alpha=e),u}},channels:["h","s","l","alpha"],ranges:{h:[0,360]},parsers:[function(r){if("string"==typeof r){var n=r.match(s)||r.match(v);if(n){var a={mode:"hsl",h:void 0===n[3]?N(n[1],n[2]):+n[3],s:Math.min(Math.max(0,n[4]/100),1),l:Math.min(Math.max(0,n[5]/100),1)};return void 0!==n[6]?a.alpha=n[6]/100:void 0!==n[7]&&(a.alpha=n[7]/255),a}}}],interpolate:{h:{use:q,fixup:$},s:q,l:q,alpha:{use:q,fixup:I}},difference:{h:W}};function U(r){var n=r.h,a=r.s,t=r.v,e=r.alpha;n=A(n);var o,i=Math.abs(n/60%2-1);switch(Math.floor(n/60)){case 0:o={r:t,g:t*(1-a*i),b:t*(1-a)};break;case 1:o={r:t*(1-a*i),g:t,b:t*(1-a)};break;case 2:o={r:t*(1-a),g:t,b:t*(1-a*i)};break;case 3:o={r:t*(1-a),g:t*(1-a*i),b:t};break;case 4:o={r:t*(1-a*i),g:t*(1-a),b:t};break;case 5:o={r:t,g:t*(1-a),b:t*(1-a*i)};break;default:o={r:t*(1-a),g:t*(1-a),b:t*(1-a)}}return o.mode="rgb",void 0!==e&&(o.alpha=e),o}function V(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=Math.max(n,a,t),i=Math.min(n,a,t),u={mode:"hsv",s:0===o?0:1-i/o,v:o};return o-i!=0&&(u.h=60*(o===n?(a-t)/(o-i)+6*(a<t):o===a?(t-n)/(o-i)+2:(n-a)/(o-i)+4)),void 0!==e&&(u.alpha=e),u}var X={mode:"hsv",output:{rgb:U},input:{rgb:V},channels:["h","s","v","alpha"],ranges:{h:[0,360]},interpolate:{h:{use:q,fixup:$},s:q,v:q,alpha:{use:q,fixup:I}},difference:{h:W}};var Y={mode:"hsi",output:{rgb:function(r){var n=r.h,a=r.s,t=r.i,e=r.alpha;n=A(n);var o,i=Math.abs(n/60%2-1);switch(Math.floor(n/60)){case 0:o={r:t*(1+a*(3/(2-i)-1)),g:t*(1+a*(3*(1-i)/(2-i)-1)),b:t*(1-a)};break;case 1:o={r:t*(1+a*(3*(1-i)/(2-i)-1)),g:t*(1+a*(3/(2-i)-1)),b:t*(1-a)};break;case 2:o={r:t*(1-a),g:t*(1+a*(3/(2-i)-1)),b:t*(1+a*(3*(1-i)/(2-i)-1))};break;case 3:o={r:t*(1-a),g:t*(1+a*(3*(1-i)/(2-i)-1)),b:t*(1+a*(3/(2-i)-1))};break;case 4:o={r:t*(1+a*(3*(1-i)/(2-i)-1)),g:t*(1-a),b:t*(1+a*(3/(2-i)-1))};break;case 5:o={r:t*(1+a*(3/(2-i)-1)),g:t*(1-a),b:t*(1+a*(3*(1-i)/(2-i)-1))};break;default:o={r:t*(1-a),g:t*(1-a),b:t*(1-a)}}return o.mode="rgb",void 0!==e&&(o.alpha=e),o}},input:{rgb:function(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=Math.max(n,a,t),i=Math.min(n,a,t),u={mode:"hsi",s:n+a+t===0?0:1-3*i/(n+a+t),i:(n+a+t)/3};return o-i!=0&&(u.h=60*(o===n?(a-t)/(o-i)+6*(a<t):o===a?(t-n)/(o-i)+2:(n-a)/(o-i)+4)),void 0!==e&&(u.alpha=e),u}},channels:["h","s","i","alpha"],ranges:{h:[0,360]},interpolate:{h:{use:q,fixup:$},s:q,i:q,alpha:{use:q,fixup:I}},difference:{h:W}};var Z={mode:"hwb",output:{rgb:function(r){var n=r.h,a=r.w,t=r.b;if(a+t>1){var e=a+t;a/=e,t/=e}return U({h:n,s:1===t?1:1-a/(1-t),v:1-t,alpha:r.alpha})}},input:{rgb:function(r){var n=V(r);if(void 0!==n){var a={mode:"hwb",w:(1-n.s)*n.v,b:1-n.v};return void 0!==n.h&&(a.h=n.h),void 0!==n.alpha&&(a.alpha=n.alpha),a}}},channels:["h","w","b","alpha"],ranges:{h:[0,360]},parsers:[function(r){if("string"==typeof r){var n=r.match(b);if(n){var a={mode:"hwb",h:void 0===n[3]?N(n[1],n[2]):+n[3],w:n[4]/100,b:n[5]/100};if(a.w+a.b>1){var t=a.w+a.b;a.w/=t,a.b/=t}return void 0!==n[6]?a.alpha=n[6]/100:void 0!==n[7]&&(a.alpha=n[7]/255),a}}}],interpolate:{h:{use:q,fixup:$},w:q,b:q,alpha:{use:q,fixup:I}},difference:{h:_}},rr=.96422,nr=.82521,ar=Math.pow(29,3)/Math.pow(3,3),tr=Math.pow(6,3)/Math.pow(29,3),er=function(r){return Math.pow(r,3)>tr?Math.pow(r,3):(116*r-16)/ar};function or(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=(n+16)/116,i=o-t/200,u={mode:"xyz",x:er(a/500+o)*rr,y:1*er(o),z:er(i)*nr};return void 0!==e&&(u.alpha=e),u}function ir(r){var n=r.x,a=r.y,t=r.z,e=r.alpha,o=C({r:3.1338561*n-1.6168667*a-.4906146*t,g:-.9787684*n+1.9161415*a+.033454*t,b:.0719453*n-.2289914*a+1.4052427*t});return void 0!==e&&(o.alpha=e),o}function ur(r){return ir(or(r))}function hr(r){var n=z(r),a=n.r,t=n.g,e=n.b,o=n.alpha,i={mode:"xyz",x:.4360747*a+.3850649*t+.1430804*e,y:.2225045*a+.7168786*t+.0606169*e,z:.0139322*a+.0971045*t+.7141733*e};return void 0!==o&&(i.alpha=o),i}var lr=function(r){return r>tr?Math.cbrt(r):(ar*r+16)/116};function cr(r){var n=r.x,a=r.y,t=r.z,e=r.alpha,o=lr(n/rr),i=lr(a/1),u={mode:"lab",l:116*i-16,a:500*(o-i),b:200*(i-lr(t/nr))};return void 0!==e&&(u.alpha=e),u}function fr(r){var n=cr(hr(r));return r.r===r.b===r.g&&(n.a=n.b=0),n}var pr={mode:"lab",output:{xyz:or,rgb:ur},input:{xyz:cr,rgb:fr},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-79.167,93.408],b:[-111.859,93.246]},parsers:[function(r){if("string"==typeof r){var n=r.match(M);if(n){var a={mode:"lab",l:+n[1],a:+n[2],b:+n[3]};return void 0!==n[4]?a.alpha=n[4]/100:void 0!==n[5]&&(a.alpha=+n[5]),a}}}],interpolate:{l:q,a:q,b:q,alpha:{use:q,fixup:I}}};function dr(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=Math.sqrt(a*a+t*t),i={mode:"lch",l:n,c:o};return o&&(i.h=A(180*Math.atan2(t,a)/Math.PI)),void 0!==e&&(i.alpha=e),i}function sr(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"lab",l:n,a:a?a*Math.cos(t/180*Math.PI):0,b:a?a*Math.sin(t/180*Math.PI):0};return void 0!==e&&(o.alpha=e),o}var vr={mode:"lch",output:{lab:sr,rgb:function(r){return ur(sr(r))}},input:{rgb:function(r){return dr(fr(r))},lab:dr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,131.008],h:[0,360]},parsers:[function(r){if("string"==typeof r){var n=r.match(m);if(n){var a={mode:"lch",l:+n[1],c:Math.max(0,+n[2]),h:void 0===n[5]?N(n[3],n[4]):+n[5]};return void 0!==n[6]?a.alpha=n[6]/100:void 0!==n[7]&&(a.alpha=+n[7]),a}}}],interpolate:{h:{use:q,fixup:$},c:q,l:q,alpha:{use:q,fixup:I}},difference:{h:K}},gr=function(r,n,a){return 4*r/(r+15*n+3*a)},br=function(r,n,a){return 9*n/(r+15*n+3*a)},Mr=gr(rr,1,nr),mr=br(rr,1,nr);function wr(r){var n,a=r.x,t=r.y,e=r.z,o=r.alpha,i=(n=t/1)<=tr?ar*n:116*Math.cbrt(n)-16,u=gr(a,t,e),h=br(a,t,e);isFinite(u)&&isFinite(h)?(u=13*i*(u-Mr),h=13*i*(h-mr)):i=u=h=0;var l={mode:"luv",l:i,u:u,v:h};return void 0!==o&&(l.alpha=o),l}function yr(r){return wr(hr(r))}var xr,kr=4*(xr=rr)/(xr+15*1+3*nr),qr=function(r,n,a){return 9*n/(r+15*n+3*a)}(rr,1,nr);function Ir(r){var n=r.l,a=r.u,t=r.v,e=r.alpha,o=a/(13*n)+kr,i=t/(13*n)+qr,u=1*(n<=8?n/ar:Math.pow((n+16)/116,3)),h={mode:"xyz",x:u*(9*o)/(4*i),y:u,z:u*(12-3*o-20*i)/(4*i)};return void 0!==e&&(h.alpha=e),h}function Pr(r){return ir(Ir(r))}var Sr={mode:"luv",output:{xyz:Ir,rgb:Pr},input:{xyz:wr,rgb:yr},channels:["l","u","v","alpha"],ranges:{l:[0,100],u:[-84.86,174.87],v:[-125.744,87.165],alpha:[0,1]},interpolate:{l:q,u:q,v:q,alpha:{use:q,fixup:I}}};function zr(r){var n=r.l,a=r.u,t=r.v,e=r.alpha,o=Math.sqrt(a*a+t*t),i={mode:"lchuv",l:n,c:o};return o&&(i.h=A(180*Math.atan2(t,a)/Math.PI)),void 0!==e&&(i.alpha=e),i}function Er(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"luv",l:n,u:a?a*Math.cos(t/180*Math.PI):0,v:a?a*Math.sin(t/180*Math.PI):0};return void 0!==e&&(o.alpha=e),o}var Cr={mode:"lchuv",output:{luv:Er,rgb:function(r){return Pr(Er(r))}},input:{rgb:function(r){return zr(yr(r))},luv:zr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,131.008],h:[0,360]},interpolate:{h:{use:q,fixup:$},c:q,l:q,alpha:{use:q,fixup:I}},difference:{h:K}},Rr=[-.14861,1.78277,-.29227,-.90649,1.97294,0],Ar=Math.PI/180,Nr=180/Math.PI,Hr=Rr[3]*Rr[4],$r=Rr[1]*Rr[4],jr=Rr[1]*Rr[2]-Rr[0]*Rr[3];var Or={mode:"cubehelix",channels:["h","s","l","alpha"],ranges:{h:[0,360],s:[0,4.6143]},input:{rgb:function(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=(jr*t+n*Hr-a*$r)/(jr+Hr-$r),i=t-o,u=(Rr[4]*(a-o)-Rr[2]*i)/Rr[3],h={mode:"cubehelix",l:o,s:0===o||1===o?void 0:Math.sqrt(i*i+u*u)/(Rr[4]*o*(1-o))};return h.s&&(h.h=Math.atan2(u,i)*Nr-120),void 0!==e&&(h.alpha=e),h}},output:{rgb:function(r){var n=r.h,a=r.s,t=r.l,e=r.alpha,o={mode:"rgb"};n=(void 0===n?0:n+120)*Ar;var i=void 0===a?0:a*t*(1-t),u=Math.cos(n),h=Math.sin(n);return o.r=t+i*(Rr[0]*u+Rr[1]*h),o.g=t+i*(Rr[2]*u+Rr[3]*h),o.b=t+i*(Rr[4]*u+Rr[5]*h),void 0!==e&&(o.alpha=e),o}},interpolate:{h:{use:q,fixup:$},s:q,l:q,alpha:{use:q,fixup:I}},difference:{h:W}};function Lr(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=Math.sqrt(a*a+t*t),i={mode:"dlch",l:n,c:o};return o&&(i.h=A(180*Math.atan2(t,a)/Math.PI)),void 0!==e&&(i.alpha=e),i}var Br=26/180*Math.PI,Dr=Math.cos(Br),Tr=Math.sin(Br),Fr=100/Math.log(1.39);function Gr(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"lab",l:(Math.exp(1*n/Fr)-1)/.0039};if(void 0===t)o.a=o.b=0;else{var i=(Math.exp(.0435*a*1*1)-1)/.075,u=i*Math.cos(t/180*Math.PI-Br),h=i*Math.sin(t/180*Math.PI-Br);o.a=u*Dr-h/.83*Tr,o.b=u*Tr+h/.83*Dr}return void 0!==e&&(o.alpha=e),o}function Wr(r){return Gr(Lr(r))}function _r(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=a*Dr+t*Tr,i=.83*(t*Dr-a*Tr),u=Math.sqrt(o*o+i*i),h={mode:"dlch",l:Fr/1*Math.log(1+.0039*n),c:Math.log(1+.075*u)/.0435};return h.c&&(h.h=(Math.atan2(i,o)+Br)/Math.PI*180),void 0!==e&&(h.alpha=e),h}function Kr(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"dlab",l:n,a:0===a?0:a*Math.cos(t/180*Math.PI),b:0===a?0:a*Math.sin(t/180*Math.PI)};return void 0!==e&&(o.alpha=e),o}function Jr(r){return Kr(_r(r))}var Qr={mode:"dlab",output:{lab:Wr,rgb:function(r){return ur(Wr(r))}},input:{lab:Jr,rgb:function(r){return Jr(fr(r))}},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-39.229,45.166],b:[-43.002,44.424]},interpolate:{l:q,a:q,b:q,alpha:{use:q,fixup:I}}};var Ur={mode:"dlch",output:{lab:Gr,dlab:Kr,rgb:function(r){return ur(Gr(r))}},input:{lab:_r,dlab:Lr,rgb:function(r){return _r(fr(r))}},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,50.944],h:[0,360]},interpolate:{l:q,c:q,h:{use:q,fixup:$},alpha:{use:q,fixup:I}},difference:{h:K}},Vr={mode:"xyz",output:{rgb:ir,lab:cr},input:{rgb:hr,lab:or},channels:["x","y","z","alpha"],ranges:{x:[0,.962],y:[0,.997],z:[0,.823],alpha:[0,1]},interpolate:{x:q,y:q,z:q,alpha:{use:q,fixup:I}}};var Xr={mode:"yiq",output:{rgb:function(r){var n=r.y,a=r.i,t=r.q;return C({r:n+.95608445*a+.6208885*t,g:n-.27137664*a-.6486059*t,b:n-1.10561724*a+1.70250126*t,alpha:r.alpha})}},input:{rgb:function(r){var n=z(r),a=n.r,t=n.g,e=n.b,o=n.alpha,i={mode:"yiq",y:.29889531*a+.58662247*t+.11448223*e,i:.59597799*a-.2741761*t-.32180189*e,q:.21147017*a-.52261711*t+.31114694*e};return void 0!==o&&(i.alpha=o),i}},channels:["y","i","q","alpha"],ranges:{i:[-.593,.593],q:[-.52,.52]},interpolate:{y:q,i:q,q:q,alpha:{use:q,fixup:I}}};function Yr(r){return void 0===r&&(r=4),function(n){return"number"==typeof n?function(r,n){return Math.round(r*(n=Math.pow(10,n)))/n}(n,r):n}}function Zr(r){return Math.round(255*Math.max(0,Math.min(r,1)))}var rn=G("rgb"),nn=Yr(2),an=function(r){var n=rn(r);if(void 0!==n)return"#"+(1<<24|Zr(n.r)<<16|Zr(n.g)<<8|Zr(n.b)).toString(16).slice(1)},tn=function(r){var n=rn(r);if(void 0!==n){var a=Zr(n.r),t=Zr(n.g),e=Zr(n.b);return void 0===n.alpha||1===n.alpha?"rgb("+a+", "+t+", "+e+")":"rgba("+a+", "+t+", "+e+", "+nn(n.alpha)+")"}};function en(r){return void 0===r&&(r=.5),function(n){return r<=0?1:r>=1?0:Math.pow(n,Math.log(.5)/Math.log(r))}}var on=function(r,n){void 0===n&&(n="rgb");var a=n?D(n).channels:null,t=n?G(n):F;return function(e){var o=t(e);return(a||D(e.mode).channels).reduce((function(a,t){var e=r(o[t],t,o,n);return void 0===e||isNaN(e)||(a[t]=e),a}),{mode:n})}},un=function(r,n,a){return"alpha"!==n?(r||0)*(void 0!==a.alpha?a.alpha:1):r},hn=function(r,n,a){return"alpha"!==n&&0!==a.alpha?(r||0)/(void 0!==a.alpha?a.alpha:1):r},ln=function(r,n){return void 0===r&&(r=1),void 0===n&&(n=0),function(a,t){return"alpha"!==t?a*r+n:a}},cn=function(r){return"function"==typeof r},fn=function(r){return r&&"object"==typeof r},pn=function(r){return"number"==typeof r},dn=function(r,n,a,t){void 0===n&&(n="rgb");var e=D(n),o=G(n),i=[],u=[],h={};r.forEach((function(r){Array.isArray(r)?(i.push(o(r[0])),u.push(r[1])):pn(r)||cn(r)?h[u.length]=r:(i.push(o(r)),u.push(void 0))})),function(r){void 0===r[0]&&(r[0]=0),void 0===r[r.length-1]&&(r[r.length-1]=1);for(var n,a,t,e,o=1;o<r.length;){if(void 0===r[o]){for(a=o,t=r[o-1],n=o;void 0===r[n];)n++;for(e=(r[n]-t)/(n-o+1);o<n;)r[o]=t+(o+1-a)*e,o++}else r[o]<r[o-1]&&(r[o]=r[o-1]);o++}}(u);var l=e.channels.reduce((function(r,n){var t;return t=fn(a)&&fn(a[n])&&a[n].fixup?a[n].fixup:fn(e.interpolate[n])&&e.interpolate[n].fixup?e.interpolate[n].fixup:w,r[n]=t(i.map((function(r){return r[n]}))),r}),{});if(t){var c=i.map((function(r,a){return e.channels.reduce((function(r,n){return r[n]=l[n][a],r}),{mode:n})}));l=e.channels.reduce((function(r,a){return r[a]=c.map((function(r){var e=t(r[a],a,r,n);return isNaN(e)?void 0:e})),r}),{})}var f=e.channels.reduce((function(r,n){var t;return cn(a)?t=a:fn(a)&&cn(a[n])?t=a[n]:fn(a)&&fn(a[n])&&a[n].use?t=a[n].use:cn(e.interpolate[n])?t=e.interpolate[n]:fn(e.interpolate[n])&&(t=e.interpolate[n].use),r[n]=t(l[n]),r}),{}),p=i.length-1;return function(r){if((r=Math.min(Math.max(0,r),1))<=u[0])return i[0];if(r>u[p])return i[p];for(var a=0;u[a]<r;)a++;var t=u[a-1],o=u[a]-t,l=(r-t)/o,c=h[a]||h[0];void 0!==c&&(pn(c)&&(c=en((c-t)/o)),l=c(l));var d=(a-1+l)/p;return e.channels.reduce((function(r,n){var a=f[n](d);return void 0!==a&&(r[n]=a),r}),{mode:n})}},sn=function(r,n){return function(a,t,e){void 0===t&&(t="rgb");var o=n?on(n,t):void 0,i=dn(a,t,e,r);return o?function(r){return o(i(r))}:i}},vn=sn(un,hn);function gn(r){return(1-Math.cos(r*Math.PI))/2}var bn=function(r,n,a,t,e){var o=e*e,i=o*e;return((1-3*e+3*o-i)*r+(4-6*o+3*i)*n+(1+3*e+3*o-3*i)*a+i*t)/6},Mn=function(r){return function(n){var a=r.length-1,t=1===n?a-1:Math.floor(n*a);return bn(t>0?r[t-1]:2*r[t]-r[t+1],r[t],r[t+1],t<a-1?r[t+2]:2*r[t+1]-r[t],(n-t/a)*a)}},mn=function(r){return function(n){var a=r.length-1,t=1===n?a-1:Math.floor(n*a);return bn(r[(t-1+r.length)%r.length],r[t],r[(t+1)%r.length],r[(t+2)%r.length],(n-t/a)*a)}},wn=function(r){return function(r){throw new Error("open basis spline is not yet implemented")}},yn=function(r){var n,a=r.length-1,t=new Array(a),e=new Array(a),o=new Array(a);for(t[1]=1/4,e[1]=(6*r[1]-r[0])/4,n=2;n<a;++n)t[n]=1/(4-t[n-1]),e[n]=(6*r[n]-(n==a-1?r[a]:0)-e[n-1])*t[n];for(o[0]=r[0],o[a]=r[a],a-1>0&&(o[a-1]=e[a-1]),n=a-2;n>0;--n)o[n]=e[n]-t[n]*o[n+1];return o},xn=function(r){return Mn(yn(r))},kn=function(r){return mn(yn(r))},qn=function(r){return wn(yn(r))},In=Math.sign,Pn=Math.min,Sn=Math.abs,zn=function(r,n,a,t,e,o){var i=e*e,u=o*o,h=u*o,l=(a-n)/e,c=(n-r)/e,f=(a-r)/(2*e),p=(In(c)+In(l))*Pn(Sn(c),Sn(l),.5*Sn(f)),d=(t-a)/e,s=(t-n)/(2*e),v=(In(l)+In(d))*Pn(Sn(l),Sn(d),.5*Sn(s));return(p+v-2*l)/i*h+(3*l-2*p-v)/e*u+p*o+n},En=function(r){return function(n){var a,t=r.length-1;return 1===n?(a=t-1,n=1):a=Math.floor(n*t),zn(a>0?r[a-1]:2*r[a]-r[a+1],r[a],r[a+1],a<t-1?r[a+2]:2*r[a+1]-r[a],1/t,n-a/t)}},Cn=function(r){return function(n){var a,t=r.length-1;return 1===n?(a=t-1,n=1):a=Math.floor(n*t),zn(r[(a-1+r.length)%r.length],r[a],r[(a+1)%r.length],r[(a+2)%r.length],1/t,n-a/t)}},Rn=function(r){return function(n){var a,t=r.length-1;return 1===n?(a=t-1,n=1):a=Math.floor(n*t),zn(r[(a-1+r.length)%r.length],r[a],r[(a+1)%r.length],r[(a+2)%r.length],1/t,n-a/t)}};var An=G("rgb");function Nn(r){var n=An(r);return void 0!==n&&n.r>=0&&n.r<=1&&n.g>=0&&n.g<=1&&n.b>=0&&n.b<=1}var Hn=G("lch"),$n=G("rgb"),jn=function(r){var n=$n(r);return n.r=Math.max(0,Math.min(n.r,1)),n.g=Math.max(0,Math.min(n.g,1)),n.b=Math.max(0,Math.min(n.b,1)),n},On=function(r){return void 0===(r=F(r))||Nn(r)?r:G(r.mode)(jn(r))},Ln=function(r){if(void 0===(r=F(r))||Nn(r))return r;var n=G(r.mode);r=Hn(r);var a=Object.assign({},r,{c:0});if(!Nn(a))return n(jn(r));for(var t=0,e=r.c;e-t>.01;)a.c=t+.5*(e-t),Nn(a)?t=a.c:e=a.c;return n(a)},Bn=function(r){return r};var Dn={normal:function(r,n){return n},multiply:function(r,n){return r*n},screen:function(r,n){return r+n-r*n},"hard-light":function(r,n){return n<.5?2*r*n:2*n*(1-r)-1},overlay:function(r,n){return r<.5?2*n*r:2*r*(1-n)-1},darken:function(r,n){return Math.min(r,n)},lighten:function(r,n){return Math.max(r,n)},"color-dodge":function(r,n){return 0===r?0:1===n?1:Math.min(1,r/(1-n))},"color-burn":function(r,n){return 1===r?1:0===n?0:1-Math.min(1,(1-r)/n)},"soft-light":function(r,n){return n<.5?r-(1-2*n)*r*(1-r):r+(2*n-1)*((r<.25?((16*r-12)*r+4)*r:Math.sqrt(r))-r)},difference:function(r,n){return Math.abs(r-n)},exclusion:function(r,n){return r+n-2*r*n}};function Tn(r){var n=G("lrgb")(r);return.2126*n.r+.7152*n.g+.0722*n.b}var Fn=G("rgb"),Gn=[[1,0,-0,0,1,0,-0,-0,1],[.856167,.182038,-.038205,.029342,.955115,.015544,-.00288,-.001563,1.004443],[.734766,.334872,-.069637,.05184,.919198,.028963,-.004928,-.004209,1.009137],[.630323,.465641,-.095964,.069181,.890046,.040773,-.006308,-.007724,1.014032],[.539009,.579343,-.118352,.082546,.866121,.051332,-.007136,-.011959,1.019095],[.458064,.679578,-.137642,.092785,.846313,.060902,-.007494,-.016807,1.024301],[.38545,.769005,-.154455,.100526,.829802,.069673,-.007442,-.02219,1.029632],[.319627,.849633,-.169261,.106241,.815969,.07779,-.007025,-.028051,1.035076],[.259411,.923008,-.18242,.110296,.80434,.085364,-.006276,-.034346,1.040622],[.203876,.990338,-.194214,.112975,.794542,.092483,-.005222,-.041043,1.046265],[.152286,1.052583,-.204868,.114503,.786281,.099216,-.003882,-.048116,1.051998]],Wn=[[1,0,-0,0,1,0,-0,-0,1],[.866435,.177704,-.044139,.049567,.939063,.01137,-.003453,.007233,.99622],[.760729,.319078,-.079807,.090568,.889315,.020117,-.006027,.013325,.992702],[.675425,.43385,-.109275,.125303,.847755,.026942,-.00795,.018572,.989378],[.605511,.52856,-.134071,.155318,.812366,.032316,-.009376,.023176,.9862],[.547494,.607765,-.155259,.181692,.781742,.036566,-.01041,.027275,.983136],[.498864,.674741,-.173604,.205199,.754872,.039929,-.011131,.030969,.980162],[.457771,.731899,-.18967,.226409,.731012,.042579,-.011595,.034333,.977261],[.422823,.781057,-.203881,.245752,.709602,.044646,-.011843,.037423,.974421],[.392952,.82361,-.216562,.263559,.69021,.046232,-.01191,.040281,.97163],[.367322,.860646,-.227968,.280085,.672501,.047413,-.01182,.04294,.968881]],_n=[[1,0,-0,0,1,0,-0,-0,1],[.92667,.092514,-.019184,.021191,.964503,.014306,.008437,.054813,.93675],[.89572,.13333,-.02905,.029997,.9454,.024603,.013027,.104707,.882266],[.905871,.127791,-.033662,.026856,.941251,.031893,.01341,.148296,.838294],[.948035,.08949,-.037526,.014364,.946792,.038844,.010853,.193991,.795156],[1.017277,.027029,-.044306,-.006113,.958479,.047634,.006379,.248708,.744913],[1.104996,-.046633,-.058363,-.032137,.971635,.060503,.001336,.317922,.680742],[1.193214,-.109812,-.083402,-.058496,.97941,.079086,-.002346,.403492,.598854],[1.257728,-.139648,-.118081,-.078003,.975409,.102594,-.003316,.501214,.502102],[1.278864,-.125333,-.153531,-.084748,.957674,.127074,-989e-6,.601151,.399838],[1.255528,-.076749,-.178779,-.078411,.930809,.147602,.004733,.691367,.3039]],Kn=function(r,n){var a=Math.max(0,Math.min(1,n)),t=Math.round(a/.1),e=Math.round(a%.1),o=r[t];if(e>0&&t<r.length-1){var i=r[t+1];o=o.map((function(r,n){return y(o[n],i[n],e)}))}return function(r){var n=F(r);if(void 0!==n){var a=Fn(n),t=a.r,e=a.g,i=a.b,u={mode:"rgb",r:o[0]*t+o[1]*e+o[2]*i,g:o[3]*t+o[4]*e+o[5]*i,b:o[6]*t+o[7]*e+o[8]*i};return void 0!==n.alpha&&(u.alpha=n.alpha),G(n.mode)(u)}}};var Jn=function(r){return Math.max(r,0)},Qn=function(r){return Math.max(Math.min(r,1),0)},Un=function(r,n){var a=G(n),t=D(n).channels;return function(e){for(var o,i=a(e),u={mode:n},h=t.length,l=0;l<r.length;l++)void 0!==i[o=t[Math.floor(l/h)]]&&(u[o]=(u[o]||0)+r[l]*(i[t[l%h]]||0));return u}};B(P),B(R),B(Q),B(X),B(Y),B(Z),B(pr),B(vr),B(Sr),B(Cr),B(Or),B(Qr),B(Ur),B(Xr),B(Vr);var Vn=G("rgb"),Xn=G("lrgb"),Yn=G("hsl"),Zn=G("hsv"),ra=G("hsi"),na=G("hwb"),aa=G("lab"),ta=G("lch"),ea=G("luv"),oa=G("lchuv"),ia=G("cubehelix"),ua=G("dlab"),ha=G("dlch"),la=G("yiq"),ca=G("xyz");r.blend=function(r,n,a){void 0===n&&(n="normal"),void 0===a&&(a="rgb");var t="function"==typeof n?n:Dn[n],e=G(a),o=D(a).channels;return r.map((function(r){var n=e(r);return void 0===n.alpha&&(n.alpha=1),n})).reduce((function(r,n){if(void 0===r)return n;var e=n.alpha+r.alpha*(1-n.alpha);return o.reduce((function(a,o){return"alpha"!==o&&(0===e?a[o]=0:(a[o]=n.alpha*(1-r.alpha)*n[o]+n.alpha*r.alpha*t(r[o],n[o])+(1-n.alpha)*r.alpha*r[o],a[o]=Math.max(0,Math.min(1,a[o]/e)))),a}),{mode:a,alpha:e})}))},r.clamp=function(r){switch(void 0===r&&(r="rgb"),r){case"rgb":return On;case"lch":return Ln}},r.clampChroma=Ln,r.clampRgb=On,r.colorsNamed=a,r.converter=G,r.cubehelix=ia,r.deficiencyDeuter=function(r){return void 0===r&&(r=1),Kn(Wn,r)},r.deficiencyProt=function(r){return void 0===r&&(r=1),Kn(Gn,r)},r.deficiencyTrit=function(r){return void 0===r&&(r=1),Kn(_n,r)},r.defineMode=B,r.differenceCie76=function(){return J("lab")},r.differenceCie94=function(r,n,a){void 0===r&&(r=1),void 0===n&&(n=.045),void 0===a&&(a=.015);var t=G("lab");return function(e,o){var i=t(e),u=t(o),h=i.l,l=i.a,c=i.b,f=Math.sqrt(l*l+c*c),p=u.l,d=u.a,s=u.b,v=Math.sqrt(d*d+s*s),g=Math.pow(h-p,2),b=Math.pow(f-v,2),M=Math.pow(l-d,2)+Math.pow(c-s,2)-b;return Math.sqrt(g/Math.pow(r,2)+b/Math.pow(1+n*f,2)+M/Math.pow(1+a*f,2))}},r.differenceCiede2000=function(r,n,a){void 0===r&&(r=1),void 0===n&&(n=1),void 0===a&&(a=1);var t=G("lab");return function(e,o){var i=t(e),u=t(o),h=i.l,l=i.a,c=i.b,f=Math.sqrt(l*l+c*c),p=u.l,d=u.a,s=u.b,v=(f+Math.sqrt(d*d+s*s))/2,g=.5*(1-Math.sqrt(Math.pow(v,7)/(Math.pow(v,7)+Math.pow(25,7)))),b=l*(1+g),M=d*(1+g),m=Math.sqrt(b*b+c*c),w=Math.sqrt(M*M+s*s),y=Math.abs(b)+Math.abs(c)===0?0:Math.atan2(c,b);y+=2*(y<0)*Math.PI;var x=Math.abs(M)+Math.abs(s)===0?0:Math.atan2(s,M);x+=2*(x<0)*Math.PI;var k=p-h,q=w-m,I=m*w==0?0:x-y;I-=2*(I>Math.PI)*Math.PI,I+=2*(I<-Math.PI)*Math.PI;var P,S=2*Math.sqrt(m*w)*Math.sin(I/2),z=(h+p)/2,E=(m+w)/2;m*w==0?P=y+x:(P=(y+x)/2,P-=(Math.abs(y-x)>Math.PI)*Math.PI,P+=2*(P<0)*Math.PI);var C=Math.pow(z-50,2),R=1-.17*Math.cos(P-Math.PI/6)+.24*Math.cos(2*P)+.32*Math.cos(3*P+Math.PI/30)-.2*Math.cos(4*P-63*Math.PI/180),A=1+.015*C/Math.sqrt(20+C),N=1+.045*E,H=1+.015*E*R,$=30*Math.PI/180*Math.exp(-1*Math.pow((180/Math.PI*P-275)/25,2)),j=2*Math.sqrt(Math.pow(E,7)/(Math.pow(E,7)+Math.pow(25,7))),O=-1*Math.sin(2*$)*j;return Math.sqrt(Math.pow(k/(r*A),2)+Math.pow(q/(n*N),2)+Math.pow(S/(a*H),2)+O*q/(n*N)*S/(a*H))}},r.differenceCmc=function(r,n){void 0===r&&(r=1),void 0===n&&(n=1);var a=G("lab");return function(t,e){var o=a(t),i=o.l,u=o.a,h=o.b,l=Math.sqrt(u*u+h*h),c=Math.atan2(h,u);c+=2*Math.PI*(c<0);var f=a(e),p=f.l,d=f.a,s=f.b,v=Math.sqrt(d*d+s*s),g=Math.pow(i-p,2),b=Math.pow(l-v,2),M=Math.pow(u-d,2)+Math.pow(h-s,2)-b,m=Math.sqrt(Math.pow(l,4)/(Math.pow(l,4)+1900)),w=i<16?.511:.040975*i/(1+.01765*i),y=.0638*l/(1+.0131*l)+.638,x=y*(m*(c>=164/180*Math.PI&&c<=345/180*Math.PI?.56+Math.abs(.2*Math.cos(c+168/180*Math.PI)):.36+Math.abs(.4*Math.cos(c+35/180*Math.PI)))+1-m);return Math.sqrt(g/Math.pow(r*w,2)+b/Math.pow(n*y,2)+M/Math.pow(x,2))}},r.differenceDin99o=function(){return J("dlab")},r.differenceEuclidean=J,r.differenceHueChroma=K,r.differenceHueNaive=_,r.differenceHueSaturation=W,r.differenceKotsarenkoRamos=function(){return J("yiq",[.5053,.299,.1957])},r.displayable=Nn,r.dlab=ua,r.dlch=ha,r.easingGamma=x,r.easingInOutSine=gn,r.easingMidpoint=en,r.easingSmootherstep=function(r){return r*r*r*(r*(6*r-15)+10)},r.easingSmoothstep=function(r){return r*r*(3-2*r)},r.filterBrightness=function(r,n){void 0===r&&(r=1),void 0===n&&(n="rgb");var a=Jn(r);return on(ln(a),n)},r.filterContrast=function(r,n){void 0===r&&(r=1),void 0===n&&(n="rgb");var a=Jn(r);return on(ln(a,(1-a)/2),n)},r.filterGrayscale=function(r,n){return void 0===r&&(r=1),void 0===n&&(n="rgb"),Un([.2126+.7874*(a=1-Qn(r)),.7152-.7152*a,.0722-.0722*a,0,.2126-.2126*a,.7152+.2848*a,.0722-.0722*a,0,.2126-.2126*a,.7152-.7152*a,.0722+.9278*a,0,0,0,0,1],n);var a},r.filterHueRotate=function(r,n){return void 0===r&&(r=0),void 0===n&&(n="rgb"),Un(function(r){var n=Math.PI*r/180,a=Math.cos(n),t=Math.sin(n);return[.213+.787*a-.213*t,.715-.715*a-.715*t,.072-.072*a+.928*t,0,.213-.213*a+.143*t,.715+.285*a+.14*t,.072-.072*a-.283*t,0,.213-.213*a-.787*t,.715-.715*a+.715*t,.072+.928*a+.072*t,0,0,0,0,1]}(r),n)},r.filterInvert=function(r,n){void 0===r&&(r=1),void 0===n&&(n="rgb");var a=Qn(r);return on((function(r,n){return"alpha"===n?r:function(r,n,a){return void 0===r||void 0===n?void 0:r+a*(n-r)}(a,1-a,r)}),n)},r.filterSaturate=function(r,n){return void 0===r&&(r=1),void 0===n&&(n="rgb"),Un(function(r){var n=Jn(r);return[.213+.787*n,.715-.715*n,.072-.072*n,0,.213-.213*n,.715+.285*n,.072-.072*n,0,.213-.213*n,.715-.715*n,.072+.928*n,0,0,0,0,1]}(r),n)},r.filterSepia=function(r,n){return void 0===r&&(r=1),void 0===n&&(n="rgb"),Un([.393+.607*(a=1-Qn(r)),.769-.769*a,.189-.189*a,0,.349-.349*a,.686+.314*a,.168-.168*a,0,.272-.272*a,.534-.534*a,.131+.869*a,0,0,0,0,1],n);var a},r.fixupAlpha=I,r.fixupHueDecreasing=function(r){return H(r,(function(r){return r<=0?r:r-360}))},r.fixupHueIncreasing=function(r){return H(r,(function(r){return r>=0?r:r+360}))},r.fixupHueLonger=function(r){return H(r,(function(r){return Math.abs(r)>=180||0===r?r:r-360*Math.sign(r)}))},r.fixupHueShorter=$,r.formatHex=an,r.formatHex8=function(r){var n=rn(r);if(void 0!==n){var a=Zr(void 0!==n.alpha?n.alpha:1);return an(n)+(256|a).toString(16).slice(1)}},r.formatRgb=tn,r.formatter=function(r){switch(void 0===r&&(r="rgb"),r){case"rgb":return tn;case"hex":return an}},r.getModeDefinition=D,r.hsi=ra,r.hsl=Yn,r.hsv=Zn,r.hwb=na,r.interpolate=function(r,n,a){return void 0===n&&(n="rgb"),dn(r,n,a)},r.interpolateAlpha=I,r.interpolateCosine=function(r,n){return void 0===n&&(n=1),function(a){var t=x(n),e=k((function(r,n,a){return y(r,n,gn(a))}))((r||w)(a));return function(r){return e(t(r))}}},r.interpolateHue=$,r.interpolateLinear=function(r,n){return void 0===n&&(n=1),function(a){var t=x(n);return function(n){return q((r||w)(a))(t(n))}}},r.interpolateSplineBasis=function(r,n,a){return void 0===n&&(n="default"),void 0===a&&(a=1),function(t){var e=x(a);return"default"===n?function(n){return Mn((r||w)(t))(e(n))}:"closed"===n?function(n){return mn((r||w)(t))(e(n))}:"open"===n?function(n){return wn((r||w)(t))(e(n))}:void 0}},r.interpolateSplineMonotone=function(r,n,a){return void 0===n&&(n="default"),void 0===a&&(a=1),function(t){var e=x(a);return"closed"===n?function(n){return Cn((r||w)(t))(e(n))}:"open"===n?function(n){return Rn((r||w)(t))(e(n))}:"default"===n?function(n){return En((r||w)(t))(e(n))}:void 0}},r.interpolateSplineNatural=function(r,n,a){return void 0===n&&(n="default"),void 0===a&&(a=1),function(t){var e=x(a);return"default"===n?function(n){return xn((r||w)(t))(e(n))}:"closed"===n?function(n){return kn((r||w)(t))(e(n))}:"open"===n?function(n){return qn((r||w)(t))(e(n))}:void 0}},r.interpolateWith=sn,r.interpolateWithPremultipliedAlpha=vn,r.interpolatorLinear=q,r.interpolatorPiecewise=k,r.interpolatorSplineBasis=Mn,r.interpolatorSplineBasisClosed=mn,r.interpolatorSplineBasisOpen=wn,r.interpolatorSplineMonotone=En,r.interpolatorSplineMonotoneClosed=Cn,r.interpolatorSplineMonotoneOpen=Rn,r.interpolatorSplineNatural=xn,r.interpolatorSplineNaturalClosed=kn,r.interpolatorSplineNaturalOpen=qn,r.lab=aa,r.lch=ta,r.lchuv=oa,r.lerp=y,r.lrgb=Xn,r.luv=ea,r.mapAlphaDivide=hn,r.mapAlphaMultiply=un,r.mapTransferGamma=function(r,n,a){return void 0===r&&(r=1),void 0===n&&(n=1),void 0===a&&(a=0),function(t,e){return"alpha"!==e?r*pow(t,n)+a:t}},r.mapTransferLinear=ln,r.mapper=on,r.nearest=function(r,n,a){void 0===n&&(n=J()),void 0===a&&(a=Bn);var t=r.map((function(r,n){return{color:a(r),i:n}}));return function(a,e,o){return void 0===e&&(e=1),void 0===o&&(o=1/0),isFinite(e)&&(e=Math.max(1,Math.min(e,t.length-1))),t.forEach((function(r){r.d=n(a,r.color)})),t.sort((function(r,n){return r.d-n.d})).slice(0,e).filter((function(r){return r.d<o})).map((function(n){return r[n.i]}))}},r.parse=T,r.random=function(r,n){void 0===r&&(r="rgb"),void 0===n&&(n={});var a=D(r),t=function(r){return Object.keys(r).reduce((function(n,a){var t=r[a];return n[a]=Array.isArray(t)?t:[t,t],n}),{})}(n);return a.channels.reduce((function(r,n){return(t.alpha||"alpha"!==n)&&(r[n]=function(r){var n=r[0],a=r[1];return n+Math.random()*(a-n)}(t[n]||a.ranges[n])),r}),{mode:r})},r.rgb=Vn,r.round=Yr,r.samples=function(r,n){void 0===r&&(r=2),void 0===n&&(n=1);var a=x(n);if(r<2)return r<1?[]:[a(.5)];for(var t=[],e=0;e<r;e++)t.push(a(e/(r-1)));return t},r.wcagContrast=function(r,n){var a=Tn(r),t=Tn(n);return(Math.max(a,t)+.05)/(Math.min(a,t)+.05)},r.wcagLuminance=Tn,r.xyz=ca,r.yiq=la,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((r=r||self).culori={})}(this,(function(r){"use strict";function n(r,n){if("number"==typeof r)return 3===n?{mode:"rgb",r:(r>>8&15|r>>4&240)/255,g:(r>>4&15|240&r)/255,b:(15&r|r<<4&240)/255}:4===n?{mode:"rgb",r:(r>>12&15|r>>8&240)/255,g:(r>>8&15|r>>4&240)/255,b:(r>>4&15|240&r)/255,alpha:(15&r|r<<4&240)/255}:6===n?{mode:"rgb",r:(r>>16&255)/255,g:(r>>8&255)/255,b:(255&r)/255}:8===n?{mode:"rgb",r:(r>>24&255)/255,g:(r>>16&255)/255,b:(r>>8&255)/255,alpha:(255&r)/255}:void 0}var a={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};var t=(/([+-]?\d*\.?\d+(?:[eE][+-]?\d+)?)/+"").replace(/^\/|\/$/g,""),e=t+"%",o=t+"%?",i="(?:"+t+"%|"+t+")",u="(?:"+t+"(deg|grad|rad|turn)|"+t+")",h="\\s*,\\s*",l="\\s+",c=new RegExp("^rgba?\\(\\s*"+t+h+t+h+t+"\\s*(?:,\\s*"+i+"\\s*)?\\)$"),f=new RegExp("^rgba?\\(\\s*"+e+h+e+h+e+"\\s*(?:,\\s*"+i+"\\s*)?\\)$"),d=new RegExp("^rgba?\\(\\s*"+t+l+t+l+t+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),p=new RegExp("^rgba?\\(\\s*"+e+l+e+l+e+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),s=new RegExp("^hsla?\\(\\s*"+u+h+e+h+e+"\\s*(?:,\\s*"+i+"\\s*)?\\)$"),v=new RegExp("^hsla?\\(\\s*"+u+l+e+l+e+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),g=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,b=new RegExp("^hwb\\(\\s*"+u+l+e+l+e+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),M=new RegExp("^lab\\(\\s*"+o+l+t+l+t+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$"),m=new RegExp("^lch\\(\\s*"+o+l+t+l+u+"\\s*(?:\\/\\s*"+i+"\\s*)?\\)$");function w(r){return r}function y(r,n,a){return r+a*(n-r)}function x(r){return void 0===r&&(r=1),1===r?w:function(n){return Math.pow(n,r)}}var k=function(r){return function(n){var a=function(r){for(var n=[],a=0;a<r.length-1;a++){var t=r[a],e=r[a+1];void 0===t&&void 0===e?n.push(void 0):void 0!==t&&void 0!==e?n.push([t,e]):n.push(void 0!==t?[t,t]:[e,e])}return n}(n);return function(n){var t=n*a.length,e=1===n?a.length-1:Math.floor(t),o=a[e];return void 0===o?void 0:r(o[0],o[1],t-e)}}},q=k(y),P=function(r){var n=!1,a=r.map((function(r){return void 0!==r?(n=!0,r):1}));return n?a:r},I={mode:"rgb",channels:["r","g","b","alpha"],parsers:[function(r){var a;return(a=r.match(g))?n(parseInt(a[1],16),a[1].length):void 0},function(r){var n,a;if(n=r.match(c)||r.match(d))a={mode:"rgb",r:n[1]/255,g:n[2]/255,b:n[3]/255};else{if(!(n=r.match(f)||r.match(p)))return;a={mode:"rgb",r:n[1]/100,g:n[2]/100,b:n[3]/100}}return void 0!==n[4]?a.alpha=n[4]/100:void 0!==n[5]&&(a.alpha=+n[5]),a},function(r){return"string"==typeof r&&n(a[r.toLowerCase()],6)||void 0},function(r){return"transparent"===r?n(0,8):void 0}],interpolate:{r:q,g:q,b:q,alpha:{use:q,fixup:P}}},S=function(r){return r<.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)};function z(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o={mode:"lrgb",r:S(n),g:S(a),b:S(t)};return void 0!==e&&(o.alpha=e),o}var E=function(r){return r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r};function C(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o={mode:"rgb",r:E(n),g:E(a),b:E(t)};return void 0!==e&&(o.alpha=e),o}var R={mode:"lrgb",output:{rgb:C},input:{rgb:z},channels:["r","g","b","alpha"],interpolate:{r:q,g:q,b:q,alpha:{use:q,fixup:P}}};function A(r){return(r%=360)<0?r+360:r}var N=function(r,n){switch(n){case"deg":return+r;case"rad":return r/Math.PI*180;case"grad":return r/10*9;case"turn":return 360*r}};var H=function(r,n){return r.map((function(a,t,e){if(void 0===a)return a;var o=A(a);return 0===t||void 0===r[t-1]?o:n(o-A(e[t-1]))})).reduce((function(r,n){return r.length&&void 0!==n&&void 0!==r[r.length-1]?(r.push(n+r[r.length-1]),r):(r.push(n),r)}),[])},$=function(r){return H(r,(function(r){return Math.abs(r)<=180?r:r-360*Math.sign(r)}))},j={},O={},D=[],L=function(r){j[r.mode]=Object.assign(j[r.mode]||{},r.output),Object.keys(r.input||{}).forEach((function(n){j[n]||(j[n]={}),j[n][r.mode]=r.input[n]})),r.ranges||(r.ranges={}),r.difference||(r.difference={}),r.channels.forEach((function(n){if(void 0===r.ranges[n]&&(r.ranges[n]=[0,1]),!r.interpolate[n])throw new Error("Missing interpolator for: "+n);"function"==typeof r.interpolate[n]&&(r.interpolate[n]={use:r.interpolate[n]}),r.interpolate[n].fixup||(r.interpolate[n].fixup=w)})),O[r.mode]=r,(r.parsers||[]).forEach((function(r){return D.push(r)}))},B=function(r){return O[r]},T=function(r){for(var n,a=0,t=D.length;a<t&&void 0===(n=D[a++](r)););return n};function F(r,n){return void 0===r?void 0:"object"!=typeof r?T(r):void 0!==r.mode?r:n?Object.assign({},r,{mode:n}):void 0}var G=function(r){return void 0===r&&(r="rgb"),function(n){return void 0!==(n=F(n,r))?n.mode===r?n:j[n.mode][r]?j[n.mode][r](n):"rgb"===r?j[n.mode].rgb(n):j.rgb[r](j[n.mode].rgb(n)):void 0}},W=function(r,n){if(void 0===r.h||void 0===n.h||!r.s||!n.s)return 0;var a=A(r.h),t=A(n.h),e=Math.sin((t-a+360)/2*Math.PI/180);return 2*Math.sqrt(r.s*n.s)*e},_=function(r,n){if(void 0===r.h||void 0===n.h)return 0;var a=A(r.h),t=A(n.h);return Math.abs(t-a)>180?a-(t-360*Math.sign(t-a)):t-a},K=function(r,n){if(void 0===r.h||void 0===n.h||!r.c||!n.c)return 0;var a=A(r.h),t=A(n.h),e=Math.sin((t-a+360)/2*Math.PI/180);return 2*Math.sqrt(r.c*n.c)*e},J=function(r,n){void 0===r&&(r="rgb"),void 0===n&&(n=[1,1,1,0]);var a=B(r),t=a.channels,e=a.difference,o=G(r);return function(r,a){var i=o(r),u=o(a);return Math.sqrt(t.reduce((function(r,a,t){var o=e[a]?e[a](i,u):i[a]-u[a];return r+(n[t]||0)*Math.pow(isNaN(o)?0:o,2)}),0))}},Q={mode:"hsl",output:{rgb:function(r){var n=r.h,a=r.s,t=r.l,e=r.alpha;n=A(n);var o,i=t+a*(t<.5?t:1-t),u=i-2*(i-t)*Math.abs(n/60%2-1);switch(Math.floor(n/60)){case 0:o={r:i,g:u,b:2*t-i};break;case 1:o={r:u,g:i,b:2*t-i};break;case 2:o={r:2*t-i,g:i,b:u};break;case 3:o={r:2*t-i,g:u,b:i};break;case 4:o={r:u,g:2*t-i,b:i};break;case 5:o={r:i,g:2*t-i,b:u};break;default:o={r:2*t-i,g:2*t-i,b:2*t-i}}return o.mode="rgb",void 0!==e&&(o.alpha=e),o}},input:{rgb:function(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=Math.max(n,a,t),i=Math.min(n,a,t),u={mode:"hsl",s:o===i?0:(o-i)/(1-Math.abs(o+i-1)),l:.5*(o+i)};return o-i!=0&&(u.h=60*(o===n?(a-t)/(o-i)+6*(a<t):o===a?(t-n)/(o-i)+2:(n-a)/(o-i)+4)),void 0!==e&&(u.alpha=e),u}},channels:["h","s","l","alpha"],ranges:{h:[0,360]},parsers:[function(r){if("string"==typeof r){var n=r.match(s)||r.match(v);if(n){var a={mode:"hsl",h:void 0===n[3]?N(n[1],n[2]):+n[3],s:Math.min(Math.max(0,n[4]/100),1),l:Math.min(Math.max(0,n[5]/100),1)};return void 0!==n[6]?a.alpha=n[6]/100:void 0!==n[7]&&(a.alpha=n[7]/255),a}}}],interpolate:{h:{use:q,fixup:$},s:q,l:q,alpha:{use:q,fixup:P}},difference:{h:W}};function U(r){var n=r.h,a=r.s,t=r.v,e=r.alpha;n=A(n);var o,i=Math.abs(n/60%2-1);switch(Math.floor(n/60)){case 0:o={r:t,g:t*(1-a*i),b:t*(1-a)};break;case 1:o={r:t*(1-a*i),g:t,b:t*(1-a)};break;case 2:o={r:t*(1-a),g:t,b:t*(1-a*i)};break;case 3:o={r:t*(1-a),g:t*(1-a*i),b:t};break;case 4:o={r:t*(1-a*i),g:t*(1-a),b:t};break;case 5:o={r:t,g:t*(1-a),b:t*(1-a*i)};break;default:o={r:t*(1-a),g:t*(1-a),b:t*(1-a)}}return o.mode="rgb",void 0!==e&&(o.alpha=e),o}function V(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=Math.max(n,a,t),i=Math.min(n,a,t),u={mode:"hsv",s:0===o?0:1-i/o,v:o};return o-i!=0&&(u.h=60*(o===n?(a-t)/(o-i)+6*(a<t):o===a?(t-n)/(o-i)+2:(n-a)/(o-i)+4)),void 0!==e&&(u.alpha=e),u}var X={mode:"hsv",output:{rgb:U},input:{rgb:V},channels:["h","s","v","alpha"],ranges:{h:[0,360]},interpolate:{h:{use:q,fixup:$},s:q,v:q,alpha:{use:q,fixup:P}},difference:{h:W}};var Y={mode:"hsi",output:{rgb:function(r){var n=r.h,a=r.s,t=r.i,e=r.alpha;n=A(n);var o,i=Math.abs(n/60%2-1);switch(Math.floor(n/60)){case 0:o={r:t*(1+a*(3/(2-i)-1)),g:t*(1+a*(3*(1-i)/(2-i)-1)),b:t*(1-a)};break;case 1:o={r:t*(1+a*(3*(1-i)/(2-i)-1)),g:t*(1+a*(3/(2-i)-1)),b:t*(1-a)};break;case 2:o={r:t*(1-a),g:t*(1+a*(3/(2-i)-1)),b:t*(1+a*(3*(1-i)/(2-i)-1))};break;case 3:o={r:t*(1-a),g:t*(1+a*(3*(1-i)/(2-i)-1)),b:t*(1+a*(3/(2-i)-1))};break;case 4:o={r:t*(1+a*(3*(1-i)/(2-i)-1)),g:t*(1-a),b:t*(1+a*(3/(2-i)-1))};break;case 5:o={r:t*(1+a*(3/(2-i)-1)),g:t*(1-a),b:t*(1+a*(3*(1-i)/(2-i)-1))};break;default:o={r:t*(1-a),g:t*(1-a),b:t*(1-a)}}return o.mode="rgb",void 0!==e&&(o.alpha=e),o}},input:{rgb:function(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=Math.max(n,a,t),i=Math.min(n,a,t),u={mode:"hsi",s:n+a+t===0?0:1-3*i/(n+a+t),i:(n+a+t)/3};return o-i!=0&&(u.h=60*(o===n?(a-t)/(o-i)+6*(a<t):o===a?(t-n)/(o-i)+2:(n-a)/(o-i)+4)),void 0!==e&&(u.alpha=e),u}},channels:["h","s","i","alpha"],ranges:{h:[0,360]},interpolate:{h:{use:q,fixup:$},s:q,i:q,alpha:{use:q,fixup:P}},difference:{h:W}};var Z={mode:"hwb",output:{rgb:function(r){var n=r.h,a=r.w,t=r.b;if(a+t>1){var e=a+t;a/=e,t/=e}return U({h:n,s:1===t?1:1-a/(1-t),v:1-t,alpha:r.alpha})}},input:{rgb:function(r){var n=V(r);if(void 0!==n){var a={mode:"hwb",w:(1-n.s)*n.v,b:1-n.v};return void 0!==n.h&&(a.h=n.h),void 0!==n.alpha&&(a.alpha=n.alpha),a}}},channels:["h","w","b","alpha"],ranges:{h:[0,360]},parsers:[function(r){if("string"==typeof r){var n=r.match(b);if(n){var a={mode:"hwb",h:void 0===n[3]?N(n[1],n[2]):+n[3],w:n[4]/100,b:n[5]/100};if(a.w+a.b>1){var t=a.w+a.b;a.w/=t,a.b/=t}return void 0!==n[6]?a.alpha=n[6]/100:void 0!==n[7]&&(a.alpha=n[7]/255),a}}}],interpolate:{h:{use:q,fixup:$},w:q,b:q,alpha:{use:q,fixup:P}},difference:{h:_}},rr=.96422,nr=.82521,ar=Math.pow(29,3)/Math.pow(3,3),tr=Math.pow(6,3)/Math.pow(29,3),er=function(r){return Math.pow(r,3)>tr?Math.pow(r,3):(116*r-16)/ar};function or(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=(n+16)/116,i=o-t/200,u={mode:"xyz",x:er(a/500+o)*rr,y:1*er(o),z:er(i)*nr};return void 0!==e&&(u.alpha=e),u}function ir(r){var n=r.x,a=r.y,t=r.z,e=r.alpha,o=C({r:3.1338561*n-1.6168667*a-.4906146*t,g:-.9787684*n+1.9161415*a+.033454*t,b:.0719453*n-.2289914*a+1.4052427*t});return void 0!==e&&(o.alpha=e),o}function ur(r){return ir(or(r))}function hr(r){var n=z(r),a=n.r,t=n.g,e=n.b,o=n.alpha,i={mode:"xyz",x:.4360747*a+.3850649*t+.1430804*e,y:.2225045*a+.7168786*t+.0606169*e,z:.0139322*a+.0971045*t+.7141733*e};return void 0!==o&&(i.alpha=o),i}var lr=function(r){return r>tr?Math.cbrt(r):(ar*r+16)/116};function cr(r){var n=r.x,a=r.y,t=r.z,e=r.alpha,o=lr(n/rr),i=lr(a/1),u={mode:"lab",l:116*i-16,a:500*(o-i),b:200*(i-lr(t/nr))};return void 0!==e&&(u.alpha=e),u}function fr(r){var n=cr(hr(r));return r.r===r.b===r.g&&(n.a=n.b=0),n}var dr={mode:"lab",output:{xyz:or,rgb:ur},input:{xyz:cr,rgb:fr},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-79.167,93.408],b:[-111.859,93.246]},parsers:[function(r){if("string"==typeof r){var n=r.match(M);if(n){var a={mode:"lab",l:+n[1],a:+n[2],b:+n[3]};return void 0!==n[4]?a.alpha=n[4]/100:void 0!==n[5]&&(a.alpha=+n[5]),a}}}],interpolate:{l:q,a:q,b:q,alpha:{use:q,fixup:P}}};function pr(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=Math.sqrt(a*a+t*t),i={mode:"lch",l:n,c:o};return o&&(i.h=A(180*Math.atan2(t,a)/Math.PI)),void 0!==e&&(i.alpha=e),i}function sr(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"lab",l:n,a:a?a*Math.cos(t/180*Math.PI):0,b:a?a*Math.sin(t/180*Math.PI):0};return void 0!==e&&(o.alpha=e),o}var vr={mode:"lch",output:{lab:sr,rgb:function(r){return ur(sr(r))}},input:{rgb:function(r){return pr(fr(r))},lab:pr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,131.008],h:[0,360]},parsers:[function(r){if("string"==typeof r){var n=r.match(m);if(n){var a={mode:"lch",l:+n[1],c:Math.max(0,+n[2]),h:void 0===n[5]?N(n[3],n[4]):+n[5]};return void 0!==n[6]?a.alpha=n[6]/100:void 0!==n[7]&&(a.alpha=+n[7]),a}}}],interpolate:{h:{use:q,fixup:$},c:q,l:q,alpha:{use:q,fixup:P}},difference:{h:K}},gr=function(r,n,a){return 4*r/(r+15*n+3*a)},br=function(r,n,a){return 9*n/(r+15*n+3*a)},Mr=gr(rr,1,nr),mr=br(rr,1,nr);function wr(r){var n,a=r.x,t=r.y,e=r.z,o=r.alpha,i=(n=t/1)<=tr?ar*n:116*Math.cbrt(n)-16,u=gr(a,t,e),h=br(a,t,e);isFinite(u)&&isFinite(h)?(u=13*i*(u-Mr),h=13*i*(h-mr)):i=u=h=0;var l={mode:"luv",l:i,u:u,v:h};return void 0!==o&&(l.alpha=o),l}function yr(r){return wr(hr(r))}var xr,kr=4*(xr=rr)/(xr+15*1+3*nr),qr=function(r,n,a){return 9*n/(r+15*n+3*a)}(rr,1,nr);function Pr(r){var n=r.l,a=r.u,t=r.v,e=r.alpha,o=a/(13*n)+kr,i=t/(13*n)+qr,u=1*(n<=8?n/ar:Math.pow((n+16)/116,3)),h={mode:"xyz",x:u*(9*o)/(4*i),y:u,z:u*(12-3*o-20*i)/(4*i)};return void 0!==e&&(h.alpha=e),h}function Ir(r){return ir(Pr(r))}var Sr={mode:"luv",output:{xyz:Pr,rgb:Ir},input:{xyz:wr,rgb:yr},channels:["l","u","v","alpha"],ranges:{l:[0,100],u:[-84.86,174.87],v:[-125.744,87.165],alpha:[0,1]},interpolate:{l:q,u:q,v:q,alpha:{use:q,fixup:P}}};function zr(r){var n=r.l,a=r.u,t=r.v,e=r.alpha,o=Math.sqrt(a*a+t*t),i={mode:"lchuv",l:n,c:o};return o&&(i.h=A(180*Math.atan2(t,a)/Math.PI)),void 0!==e&&(i.alpha=e),i}function Er(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"luv",l:n,u:a?a*Math.cos(t/180*Math.PI):0,v:a?a*Math.sin(t/180*Math.PI):0};return void 0!==e&&(o.alpha=e),o}var Cr={mode:"lchuv",output:{luv:Er,rgb:function(r){return Ir(Er(r))}},input:{rgb:function(r){return zr(yr(r))},luv:zr},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,131.008],h:[0,360]},interpolate:{h:{use:q,fixup:$},c:q,l:q,alpha:{use:q,fixup:P}},difference:{h:K}},Rr=[-.14861,1.78277,-.29227,-.90649,1.97294,0],Ar=Math.PI/180,Nr=180/Math.PI,Hr=Rr[3]*Rr[4],$r=Rr[1]*Rr[4],jr=Rr[1]*Rr[2]-Rr[0]*Rr[3];var Or={mode:"cubehelix",channels:["h","s","l","alpha"],ranges:{h:[0,360],s:[0,4.6143]},input:{rgb:function(r){var n=r.r,a=r.g,t=r.b,e=r.alpha,o=(jr*t+n*Hr-a*$r)/(jr+Hr-$r),i=t-o,u=(Rr[4]*(a-o)-Rr[2]*i)/Rr[3],h={mode:"cubehelix",l:o,s:0===o||1===o?void 0:Math.sqrt(i*i+u*u)/(Rr[4]*o*(1-o))};return h.s&&(h.h=Math.atan2(u,i)*Nr-120),void 0!==e&&(h.alpha=e),h}},output:{rgb:function(r){var n=r.h,a=r.s,t=r.l,e=r.alpha,o={mode:"rgb"};n=(void 0===n?0:n+120)*Ar;var i=void 0===a?0:a*t*(1-t),u=Math.cos(n),h=Math.sin(n);return o.r=t+i*(Rr[0]*u+Rr[1]*h),o.g=t+i*(Rr[2]*u+Rr[3]*h),o.b=t+i*(Rr[4]*u+Rr[5]*h),void 0!==e&&(o.alpha=e),o}},interpolate:{h:{use:q,fixup:$},s:q,l:q,alpha:{use:q,fixup:P}},difference:{h:W}};function Dr(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=Math.sqrt(a*a+t*t),i={mode:"dlch",l:n,c:o};return o&&(i.h=A(180*Math.atan2(t,a)/Math.PI)),void 0!==e&&(i.alpha=e),i}var Lr=26/180*Math.PI,Br=Math.cos(Lr),Tr=Math.sin(Lr),Fr=100/Math.log(1.39);function Gr(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"lab",l:(Math.exp(1*n/Fr)-1)/.0039};if(void 0===t)o.a=o.b=0;else{var i=(Math.exp(.0435*a*1*1)-1)/.075,u=i*Math.cos(t/180*Math.PI-Lr),h=i*Math.sin(t/180*Math.PI-Lr);o.a=u*Br-h/.83*Tr,o.b=u*Tr+h/.83*Br}return void 0!==e&&(o.alpha=e),o}function Wr(r){return Gr(Dr(r))}function _r(r){var n=r.l,a=r.a,t=r.b,e=r.alpha,o=a*Br+t*Tr,i=.83*(t*Br-a*Tr),u=Math.sqrt(o*o+i*i),h={mode:"dlch",l:Fr/1*Math.log(1+.0039*n),c:Math.log(1+.075*u)/.0435};return h.c&&(h.h=(Math.atan2(i,o)+Lr)/Math.PI*180),void 0!==e&&(h.alpha=e),h}function Kr(r){var n=r.l,a=r.c,t=r.h,e=r.alpha,o={mode:"dlab",l:n,a:0===a?0:a*Math.cos(t/180*Math.PI),b:0===a?0:a*Math.sin(t/180*Math.PI)};return void 0!==e&&(o.alpha=e),o}function Jr(r){return Kr(_r(r))}var Qr={mode:"dlab",output:{lab:Wr,rgb:function(r){return ur(Wr(r))}},input:{lab:Jr,rgb:function(r){return Jr(fr(r))}},channels:["l","a","b","alpha"],ranges:{l:[0,100],a:[-39.229,45.166],b:[-43.002,44.424]},interpolate:{l:q,a:q,b:q,alpha:{use:q,fixup:P}}};var Ur={mode:"dlch",output:{lab:Gr,dlab:Kr,rgb:function(r){return ur(Gr(r))}},input:{lab:_r,dlab:Dr,rgb:function(r){return _r(fr(r))}},channels:["l","c","h","alpha"],ranges:{l:[0,100],c:[0,50.944],h:[0,360]},interpolate:{l:q,c:q,h:{use:q,fixup:$},alpha:{use:q,fixup:P}},difference:{h:K}},Vr={mode:"xyz",output:{rgb:ir,lab:cr},input:{rgb:hr,lab:or},channels:["x","y","z","alpha"],ranges:{x:[0,.962],y:[0,.997],z:[0,.823],alpha:[0,1]},interpolate:{x:q,y:q,z:q,alpha:{use:q,fixup:P}}};var Xr={mode:"yiq",output:{rgb:function(r){var n=r.y,a=r.i,t=r.q;return C({r:n+.95608445*a+.6208885*t,g:n-.27137664*a-.6486059*t,b:n-1.10561724*a+1.70250126*t,alpha:r.alpha})}},input:{rgb:function(r){var n=z(r),a=n.r,t=n.g,e=n.b,o=n.alpha,i={mode:"yiq",y:.29889531*a+.58662247*t+.11448223*e,i:.59597799*a-.2741761*t-.32180189*e,q:.21147017*a-.52261711*t+.31114694*e};return void 0!==o&&(i.alpha=o),i}},channels:["y","i","q","alpha"],ranges:{i:[-.593,.593],q:[-.52,.52]},interpolate:{y:q,i:q,q:q,alpha:{use:q,fixup:P}}};function Yr(r){return void 0===r&&(r=4),function(n){return"number"==typeof n?function(r,n){return Math.round(r*(n=Math.pow(10,n)))/n}(n,r):n}}function Zr(r){return Math.round(255*Math.max(0,Math.min(r,1)))}var rn=G("rgb"),nn=Yr(2),an=function(r){var n=rn(r);if(void 0!==n)return"#"+(1<<24|Zr(n.r)<<16|Zr(n.g)<<8|Zr(n.b)).toString(16).slice(1)},tn=function(r){var n=rn(r);if(void 0!==n){var a=Zr(n.r),t=Zr(n.g),e=Zr(n.b);return void 0===n.alpha||1===n.alpha?"rgb("+a+", "+t+", "+e+")":"rgba("+a+", "+t+", "+e+", "+nn(n.alpha)+")"}};function en(r){return void 0===r&&(r=.5),function(n){return r<=0?1:r>=1?0:Math.pow(n,Math.log(.5)/Math.log(r))}}var on=function(r,n,a){void 0===n&&(n="rgb"),void 0===a&&(a=!1);var t=n?B(n).channels:null,e=n?G(n):F;return function(o){var i=e(o),u=(t||B(o.mode).channels).reduce((function(a,t){var e=r(i[t],t,i,n);return void 0===e||isNaN(e)||(a[t]=e),a}),{mode:n});if(!a)return u;var h=F(o);return h&&h.mode!==u.mode?G(h.mode)(u):u}},un=function(r,n,a){return"alpha"!==n?(r||0)*(void 0!==a.alpha?a.alpha:1):r},hn=function(r,n,a){return"alpha"!==n&&0!==a.alpha?(r||0)/(void 0!==a.alpha?a.alpha:1):r},ln=function(r,n){return void 0===r&&(r=1),void 0===n&&(n=0),function(a,t){return"alpha"!==t?a*r+n:a}},cn=function(r){return"function"==typeof r},fn=function(r){return r&&"object"==typeof r},dn=function(r){return"number"==typeof r},pn=function(r,n,a,t){void 0===n&&(n="rgb");var e=B(n),o=G(n),i=[],u=[],h={};r.forEach((function(r){Array.isArray(r)?(i.push(o(r[0])),u.push(r[1])):dn(r)||cn(r)?h[u.length]=r:(i.push(o(r)),u.push(void 0))})),function(r){void 0===r[0]&&(r[0]=0),void 0===r[r.length-1]&&(r[r.length-1]=1);for(var n,a,t,e,o=1;o<r.length;){if(void 0===r[o]){for(a=o,t=r[o-1],n=o;void 0===r[n];)n++;for(e=(r[n]-t)/(n-o+1);o<n;)r[o]=t+(o+1-a)*e,o++}else r[o]<r[o-1]&&(r[o]=r[o-1]);o++}}(u);var l=e.channels.reduce((function(r,n){var t;return t=fn(a)&&fn(a[n])&&a[n].fixup?a[n].fixup:fn(e.interpolate[n])&&e.interpolate[n].fixup?e.interpolate[n].fixup:w,r[n]=t(i.map((function(r){return r[n]}))),r}),{});if(t){var c=i.map((function(r,a){return e.channels.reduce((function(r,n){return r[n]=l[n][a],r}),{mode:n})}));l=e.channels.reduce((function(r,a){return r[a]=c.map((function(r){var e=t(r[a],a,r,n);return isNaN(e)?void 0:e})),r}),{})}var f=e.channels.reduce((function(r,n){var t;return cn(a)?t=a:fn(a)&&cn(a[n])?t=a[n]:fn(a)&&fn(a[n])&&a[n].use?t=a[n].use:cn(e.interpolate[n])?t=e.interpolate[n]:fn(e.interpolate[n])&&(t=e.interpolate[n].use),r[n]=t(l[n]),r}),{}),d=i.length-1;return function(r){if((r=Math.min(Math.max(0,r),1))<=u[0])return i[0];if(r>u[d])return i[d];for(var a=0;u[a]<r;)a++;var t=u[a-1],o=u[a]-t,l=(r-t)/o,c=h[a]||h[0];void 0!==c&&(dn(c)&&(c=en((c-t)/o)),l=c(l));var p=(a-1+l)/d;return e.channels.reduce((function(r,n){var a=f[n](p);return void 0!==a&&(r[n]=a),r}),{mode:n})}},sn=function(r,n){return function(a,t,e){void 0===t&&(t="rgb");var o=n?on(n,t):void 0,i=pn(a,t,e,r);return o?function(r){return o(i(r))}:i}},vn=sn(un,hn);function gn(r){return(1-Math.cos(r*Math.PI))/2}var bn=function(r,n,a,t,e){var o=e*e,i=o*e;return((1-3*e+3*o-i)*r+(4-6*o+3*i)*n+(1+3*e+3*o-3*i)*a+i*t)/6},Mn=function(r){return function(n){var a=r.length-1,t=1===n?a-1:Math.floor(n*a);return bn(t>0?r[t-1]:2*r[t]-r[t+1],r[t],r[t+1],t<a-1?r[t+2]:2*r[t+1]-r[t],(n-t/a)*a)}},mn=function(r){return function(n){var a=r.length-1,t=1===n?a-1:Math.floor(n*a);return bn(r[(t-1+r.length)%r.length],r[t],r[(t+1)%r.length],r[(t+2)%r.length],(n-t/a)*a)}},wn=function(r){return function(r){throw new Error("open basis spline is not yet implemented")}},yn=function(r){var n,a=r.length-1,t=new Array(a),e=new Array(a),o=new Array(a);for(t[1]=1/4,e[1]=(6*r[1]-r[0])/4,n=2;n<a;++n)t[n]=1/(4-t[n-1]),e[n]=(6*r[n]-(n==a-1?r[a]:0)-e[n-1])*t[n];for(o[0]=r[0],o[a]=r[a],a-1>0&&(o[a-1]=e[a-1]),n=a-2;n>0;--n)o[n]=e[n]-t[n]*o[n+1];return o},xn=function(r){return Mn(yn(r))},kn=function(r){return mn(yn(r))},qn=function(r){return wn(yn(r))},Pn=Math.sign,In=Math.min,Sn=Math.abs,zn=function(r,n,a,t,e,o){var i=e*e,u=o*o,h=u*o,l=(a-n)/e,c=(n-r)/e,f=(a-r)/(2*e),d=(Pn(c)+Pn(l))*In(Sn(c),Sn(l),.5*Sn(f)),p=(t-a)/e,s=(t-n)/(2*e),v=(Pn(l)+Pn(p))*In(Sn(l),Sn(p),.5*Sn(s));return(d+v-2*l)/i*h+(3*l-2*d-v)/e*u+d*o+n},En=function(r){return function(n){var a,t=r.length-1;return 1===n?(a=t-1,n=1):a=Math.floor(n*t),zn(a>0?r[a-1]:2*r[a]-r[a+1],r[a],r[a+1],a<t-1?r[a+2]:2*r[a+1]-r[a],1/t,n-a/t)}},Cn=function(r){return function(n){var a,t=r.length-1;return 1===n?(a=t-1,n=1):a=Math.floor(n*t),zn(r[(a-1+r.length)%r.length],r[a],r[(a+1)%r.length],r[(a+2)%r.length],1/t,n-a/t)}},Rn=function(r){return function(n){var a,t=r.length-1;return 1===n?(a=t-1,n=1):a=Math.floor(n*t),zn(r[(a-1+r.length)%r.length],r[a],r[(a+1)%r.length],r[(a+2)%r.length],1/t,n-a/t)}};var An=G("rgb");function Nn(r){var n=An(r);return void 0!==n&&n.r>=0&&n.r<=1&&n.g>=0&&n.g<=1&&n.b>=0&&n.b<=1}var Hn=G("lch"),$n=G("rgb"),jn=function(r){var n=$n(r);return n.r=Math.max(0,Math.min(n.r,1)),n.g=Math.max(0,Math.min(n.g,1)),n.b=Math.max(0,Math.min(n.b,1)),n},On=function(r){return void 0===(r=F(r))||Nn(r)?r:G(r.mode)(jn(r))},Dn=function(r){if(void 0===(r=F(r))||Nn(r))return r;var n=G(r.mode);r=Hn(r);var a=Object.assign({},r,{c:0});if(!Nn(a))return n(jn(r));for(var t=0,e=r.c;e-t>.01;)a.c=t+.5*(e-t),Nn(a)?t=a.c:e=a.c;return n(a)},Ln=function(r){return r};var Bn={normal:function(r,n){return n},multiply:function(r,n){return r*n},screen:function(r,n){return r+n-r*n},"hard-light":function(r,n){return n<.5?2*r*n:2*n*(1-r)-1},overlay:function(r,n){return r<.5?2*n*r:2*r*(1-n)-1},darken:function(r,n){return Math.min(r,n)},lighten:function(r,n){return Math.max(r,n)},"color-dodge":function(r,n){return 0===r?0:1===n?1:Math.min(1,r/(1-n))},"color-burn":function(r,n){return 1===r?1:0===n?0:1-Math.min(1,(1-r)/n)},"soft-light":function(r,n){return n<.5?r-(1-2*n)*r*(1-r):r+(2*n-1)*((r<.25?((16*r-12)*r+4)*r:Math.sqrt(r))-r)},difference:function(r,n){return Math.abs(r-n)},exclusion:function(r,n){return r+n-2*r*n}};function Tn(r){var n=G("lrgb")(r);return.2126*n.r+.7152*n.g+.0722*n.b}var Fn=G("rgb"),Gn=[[1,0,-0,0,1,0,-0,-0,1],[.856167,.182038,-.038205,.029342,.955115,.015544,-.00288,-.001563,1.004443],[.734766,.334872,-.069637,.05184,.919198,.028963,-.004928,-.004209,1.009137],[.630323,.465641,-.095964,.069181,.890046,.040773,-.006308,-.007724,1.014032],[.539009,.579343,-.118352,.082546,.866121,.051332,-.007136,-.011959,1.019095],[.458064,.679578,-.137642,.092785,.846313,.060902,-.007494,-.016807,1.024301],[.38545,.769005,-.154455,.100526,.829802,.069673,-.007442,-.02219,1.029632],[.319627,.849633,-.169261,.106241,.815969,.07779,-.007025,-.028051,1.035076],[.259411,.923008,-.18242,.110296,.80434,.085364,-.006276,-.034346,1.040622],[.203876,.990338,-.194214,.112975,.794542,.092483,-.005222,-.041043,1.046265],[.152286,1.052583,-.204868,.114503,.786281,.099216,-.003882,-.048116,1.051998]],Wn=[[1,0,-0,0,1,0,-0,-0,1],[.866435,.177704,-.044139,.049567,.939063,.01137,-.003453,.007233,.99622],[.760729,.319078,-.079807,.090568,.889315,.020117,-.006027,.013325,.992702],[.675425,.43385,-.109275,.125303,.847755,.026942,-.00795,.018572,.989378],[.605511,.52856,-.134071,.155318,.812366,.032316,-.009376,.023176,.9862],[.547494,.607765,-.155259,.181692,.781742,.036566,-.01041,.027275,.983136],[.498864,.674741,-.173604,.205199,.754872,.039929,-.011131,.030969,.980162],[.457771,.731899,-.18967,.226409,.731012,.042579,-.011595,.034333,.977261],[.422823,.781057,-.203881,.245752,.709602,.044646,-.011843,.037423,.974421],[.392952,.82361,-.216562,.263559,.69021,.046232,-.01191,.040281,.97163],[.367322,.860646,-.227968,.280085,.672501,.047413,-.01182,.04294,.968881]],_n=[[1,0,-0,0,1,0,-0,-0,1],[.92667,.092514,-.019184,.021191,.964503,.014306,.008437,.054813,.93675],[.89572,.13333,-.02905,.029997,.9454,.024603,.013027,.104707,.882266],[.905871,.127791,-.033662,.026856,.941251,.031893,.01341,.148296,.838294],[.948035,.08949,-.037526,.014364,.946792,.038844,.010853,.193991,.795156],[1.017277,.027029,-.044306,-.006113,.958479,.047634,.006379,.248708,.744913],[1.104996,-.046633,-.058363,-.032137,.971635,.060503,.001336,.317922,.680742],[1.193214,-.109812,-.083402,-.058496,.97941,.079086,-.002346,.403492,.598854],[1.257728,-.139648,-.118081,-.078003,.975409,.102594,-.003316,.501214,.502102],[1.278864,-.125333,-.153531,-.084748,.957674,.127074,-989e-6,.601151,.399838],[1.255528,-.076749,-.178779,-.078411,.930809,.147602,.004733,.691367,.3039]],Kn=function(r,n){var a=Math.max(0,Math.min(1,n)),t=Math.round(a/.1),e=Math.round(a%.1),o=r[t];if(e>0&&t<r.length-1){var i=r[t+1];o=o.map((function(r,n){return y(o[n],i[n],e)}))}return function(r){var n=F(r);if(void 0!==n){var a=Fn(n),t=a.r,e=a.g,i=a.b,u={mode:"rgb",r:o[0]*t+o[1]*e+o[2]*i,g:o[3]*t+o[4]*e+o[5]*i,b:o[6]*t+o[7]*e+o[8]*i};return void 0!==n.alpha&&(u.alpha=n.alpha),G(n.mode)(u)}}},Jn=function(r){return void 0===r&&(r=1),Kn(Gn,r)},Qn=function(r){return void 0===r&&(r=1),Kn(Wn,r)},Un=function(r){return void 0===r&&(r=1),Kn(_n,r)};var Vn=function(r){return Math.max(r,0)},Xn=function(r){return Math.max(Math.min(r,1),0)},Yn=function(r,n,a){void 0===a&&(a=!1);var t=G(n),e=B(n).channels;return function(o){var i=t(o);if(i){for(var u,h={mode:n},l=e.length,c=0;c<r.length;c++)void 0!==i[u=e[Math.floor(c/l)]]&&(h[u]=(h[u]||0)+r[c]*(i[e[c%l]]||0));if(!a)return h;var f=F(o);return f&&h.mode!==f.mode?G(f.mode)(h):h}}};L(I),L(R),L(Q),L(X),L(Y),L(Z),L(dr),L(vr),L(Sr),L(Cr),L(Or),L(Qr),L(Ur),L(Xr),L(Vr);var Zn=G("rgb"),ra=G("lrgb"),na=G("hsl"),aa=G("hsv"),ta=G("hsi"),ea=G("hwb"),oa=G("lab"),ia=G("lch"),ua=G("luv"),ha=G("lchuv"),la=G("cubehelix"),ca=G("dlab"),fa=G("dlch"),da=G("yiq"),pa=G("xyz");r.blend=function(r,n,a){void 0===n&&(n="normal"),void 0===a&&(a="rgb");var t="function"==typeof n?n:Bn[n],e=G(a),o=B(a).channels;return r.map((function(r){var n=e(r);return void 0===n.alpha&&(n.alpha=1),n})).reduce((function(r,n){if(void 0===r)return n;var e=n.alpha+r.alpha*(1-n.alpha);return o.reduce((function(a,o){return"alpha"!==o&&(0===e?a[o]=0:(a[o]=n.alpha*(1-r.alpha)*n[o]+n.alpha*r.alpha*t(r[o],n[o])+(1-n.alpha)*r.alpha*r[o],a[o]=Math.max(0,Math.min(1,a[o]/e)))),a}),{mode:a,alpha:e})}))},r.clamp=function(r){switch(void 0===r&&(r="rgb"),r){case"rgb":return On;case"lch":return Dn}},r.clampChroma=Dn,r.clampRgb=On,r.colorsNamed=a,r.converter=G,r.cubehelix=la,r.deficiencyDeuter=Qn,r.deficiencyProt=Jn,r.deficiencyTrit=Un,r.defineMode=L,r.differenceCie76=function(){return J("lab")},r.differenceCie94=function(r,n,a){void 0===r&&(r=1),void 0===n&&(n=.045),void 0===a&&(a=.015);var t=G("lab");return function(e,o){var i=t(e),u=t(o),h=i.l,l=i.a,c=i.b,f=Math.sqrt(l*l+c*c),d=u.l,p=u.a,s=u.b,v=Math.sqrt(p*p+s*s),g=Math.pow(h-d,2),b=Math.pow(f-v,2),M=Math.pow(l-p,2)+Math.pow(c-s,2)-b;return Math.sqrt(g/Math.pow(r,2)+b/Math.pow(1+n*f,2)+M/Math.pow(1+a*f,2))}},r.differenceCiede2000=function(r,n,a){void 0===r&&(r=1),void 0===n&&(n=1),void 0===a&&(a=1);var t=G("lab");return function(e,o){var i=t(e),u=t(o),h=i.l,l=i.a,c=i.b,f=Math.sqrt(l*l+c*c),d=u.l,p=u.a,s=u.b,v=(f+Math.sqrt(p*p+s*s))/2,g=.5*(1-Math.sqrt(Math.pow(v,7)/(Math.pow(v,7)+Math.pow(25,7)))),b=l*(1+g),M=p*(1+g),m=Math.sqrt(b*b+c*c),w=Math.sqrt(M*M+s*s),y=Math.abs(b)+Math.abs(c)===0?0:Math.atan2(c,b);y+=2*(y<0)*Math.PI;var x=Math.abs(M)+Math.abs(s)===0?0:Math.atan2(s,M);x+=2*(x<0)*Math.PI;var k=d-h,q=w-m,P=m*w==0?0:x-y;P-=2*(P>Math.PI)*Math.PI,P+=2*(P<-Math.PI)*Math.PI;var I,S=2*Math.sqrt(m*w)*Math.sin(P/2),z=(h+d)/2,E=(m+w)/2;m*w==0?I=y+x:(I=(y+x)/2,I-=(Math.abs(y-x)>Math.PI)*Math.PI,I+=2*(I<0)*Math.PI);var C=Math.pow(z-50,2),R=1-.17*Math.cos(I-Math.PI/6)+.24*Math.cos(2*I)+.32*Math.cos(3*I+Math.PI/30)-.2*Math.cos(4*I-63*Math.PI/180),A=1+.015*C/Math.sqrt(20+C),N=1+.045*E,H=1+.015*E*R,$=30*Math.PI/180*Math.exp(-1*Math.pow((180/Math.PI*I-275)/25,2)),j=2*Math.sqrt(Math.pow(E,7)/(Math.pow(E,7)+Math.pow(25,7))),O=-1*Math.sin(2*$)*j;return Math.sqrt(Math.pow(k/(r*A),2)+Math.pow(q/(n*N),2)+Math.pow(S/(a*H),2)+O*q/(n*N)*S/(a*H))}},r.differenceCmc=function(r,n){void 0===r&&(r=1),void 0===n&&(n=1);var a=G("lab");return function(t,e){var o=a(t),i=o.l,u=o.a,h=o.b,l=Math.sqrt(u*u+h*h),c=Math.atan2(h,u);c+=2*Math.PI*(c<0);var f=a(e),d=f.l,p=f.a,s=f.b,v=Math.sqrt(p*p+s*s),g=Math.pow(i-d,2),b=Math.pow(l-v,2),M=Math.pow(u-p,2)+Math.pow(h-s,2)-b,m=Math.sqrt(Math.pow(l,4)/(Math.pow(l,4)+1900)),w=i<16?.511:.040975*i/(1+.01765*i),y=.0638*l/(1+.0131*l)+.638,x=y*(m*(c>=164/180*Math.PI&&c<=345/180*Math.PI?.56+Math.abs(.2*Math.cos(c+168/180*Math.PI)):.36+Math.abs(.4*Math.cos(c+35/180*Math.PI)))+1-m);return Math.sqrt(g/Math.pow(r*w,2)+b/Math.pow(n*y,2)+M/Math.pow(x,2))}},r.differenceDin99o=function(){return J("dlab")},r.differenceEuclidean=J,r.differenceHueChroma=K,r.differenceHueNaive=_,r.differenceHueSaturation=W,r.differenceKotsarenkoRamos=function(){return J("yiq",[.5053,.299,.1957])},r.displayable=Nn,r.dlab=ca,r.dlch=fa,r.easingGamma=x,r.easingInOutSine=gn,r.easingMidpoint=en,r.easingSmootherstep=function(r){return r*r*r*(r*(6*r-15)+10)},r.easingSmoothstep=function(r){return r*r*(3-2*r)},r.filterBrightness=function(r,n){void 0===r&&(r=1),void 0===n&&(n="rgb");var a=Vn(r);return on(ln(a),n,!0)},r.filterContrast=function(r,n){void 0===r&&(r=1),void 0===n&&(n="rgb");var a=Vn(r);return on(ln(a,(1-a)/2),n,!0)},r.filterDeficiencyDeuter=Qn,r.filterDeficiencyProt=Jn,r.filterDeficiencyTrit=Un,r.filterGrayscale=function(r,n){return void 0===r&&(r=1),void 0===n&&(n="rgb"),Yn([.2126+.7874*(a=1-Xn(r)),.7152-.7152*a,.0722-.0722*a,0,.2126-.2126*a,.7152+.2848*a,.0722-.0722*a,0,.2126-.2126*a,.7152-.7152*a,.0722+.9278*a,0,0,0,0,1],n,!0);var a},r.filterHueRotate=function(r,n){return void 0===r&&(r=0),void 0===n&&(n="rgb"),Yn(function(r){var n=Math.PI*r/180,a=Math.cos(n),t=Math.sin(n);return[.213+.787*a-.213*t,.715-.715*a-.715*t,.072-.072*a+.928*t,0,.213-.213*a+.143*t,.715+.285*a+.14*t,.072-.072*a-.283*t,0,.213-.213*a-.787*t,.715-.715*a+.715*t,.072+.928*a+.072*t,0,0,0,0,1]}(r),n,!0)},r.filterInvert=function(r,n){void 0===r&&(r=1),void 0===n&&(n="rgb");var a=Xn(r);return on((function(r,n){return"alpha"===n?r:function(r,n,a){return void 0===r||void 0===n?void 0:r+a*(n-r)}(a,1-a,r)}),n,!0)},r.filterSaturate=function(r,n){return void 0===r&&(r=1),void 0===n&&(n="rgb"),Yn(function(r){var n=Vn(r);return[.213+.787*n,.715-.715*n,.072-.072*n,0,.213-.213*n,.715+.285*n,.072-.072*n,0,.213-.213*n,.715-.715*n,.072+.928*n,0,0,0,0,1]}(r),n,!0)},r.filterSepia=function(r,n){return void 0===r&&(r=1),void 0===n&&(n="rgb"),Yn([.393+.607*(a=1-Xn(r)),.769-.769*a,.189-.189*a,0,.349-.349*a,.686+.314*a,.168-.168*a,0,.272-.272*a,.534-.534*a,.131+.869*a,0,0,0,0,1],n,!0);var a},r.fixupAlpha=P,r.fixupHueDecreasing=function(r){return H(r,(function(r){return r<=0?r:r-360}))},r.fixupHueIncreasing=function(r){return H(r,(function(r){return r>=0?r:r+360}))},r.fixupHueLonger=function(r){return H(r,(function(r){return Math.abs(r)>=180||0===r?r:r-360*Math.sign(r)}))},r.fixupHueShorter=$,r.formatHex=an,r.formatHex8=function(r){var n=rn(r);if(void 0!==n){var a=Zr(void 0!==n.alpha?n.alpha:1);return an(n)+(256|a).toString(16).slice(1)}},r.formatRgb=tn,r.formatter=function(r){switch(void 0===r&&(r="rgb"),r){case"rgb":return tn;case"hex":return an}},r.getModeDefinition=B,r.hsi=ta,r.hsl=na,r.hsv=aa,r.hwb=ea,r.interpolate=function(r,n,a){return void 0===n&&(n="rgb"),pn(r,n,a)},r.interpolateAlpha=P,r.interpolateCosine=function(r,n){return void 0===n&&(n=1),function(a){var t=x(n),e=k((function(r,n,a){return y(r,n,gn(a))}))((r||w)(a));return function(r){return e(t(r))}}},r.interpolateHue=$,r.interpolateLinear=function(r,n){return void 0===n&&(n=1),function(a){var t=x(n);return function(n){return q((r||w)(a))(t(n))}}},r.interpolateSplineBasis=function(r,n,a){return void 0===n&&(n="default"),void 0===a&&(a=1),function(t){var e=x(a);return"default"===n?function(n){return Mn((r||w)(t))(e(n))}:"closed"===n?function(n){return mn((r||w)(t))(e(n))}:"open"===n?function(n){return wn((r||w)(t))(e(n))}:void 0}},r.interpolateSplineMonotone=function(r,n,a){return void 0===n&&(n="default"),void 0===a&&(a=1),function(t){var e=x(a);return"closed"===n?function(n){return Cn((r||w)(t))(e(n))}:"open"===n?function(n){return Rn((r||w)(t))(e(n))}:"default"===n?function(n){return En((r||w)(t))(e(n))}:void 0}},r.interpolateSplineNatural=function(r,n,a){return void 0===n&&(n="default"),void 0===a&&(a=1),function(t){var e=x(a);return"default"===n?function(n){return xn((r||w)(t))(e(n))}:"closed"===n?function(n){return kn((r||w)(t))(e(n))}:"open"===n?function(n){return qn((r||w)(t))(e(n))}:void 0}},r.interpolateWith=sn,r.interpolateWithPremultipliedAlpha=vn,r.interpolatorLinear=q,r.interpolatorPiecewise=k,r.interpolatorSplineBasis=Mn,r.interpolatorSplineBasisClosed=mn,r.interpolatorSplineBasisOpen=wn,r.interpolatorSplineMonotone=En,r.interpolatorSplineMonotoneClosed=Cn,r.interpolatorSplineMonotoneOpen=Rn,r.interpolatorSplineNatural=xn,r.interpolatorSplineNaturalClosed=kn,r.interpolatorSplineNaturalOpen=qn,r.lab=oa,r.lch=ia,r.lchuv=ha,r.lerp=y,r.lrgb=ra,r.luv=ua,r.mapAlphaDivide=hn,r.mapAlphaMultiply=un,r.mapTransferGamma=function(r,n,a){return void 0===r&&(r=1),void 0===n&&(n=1),void 0===a&&(a=0),function(t,e){return"alpha"!==e?r*pow(t,n)+a:t}},r.mapTransferLinear=ln,r.mapper=on,r.nearest=function(r,n,a){void 0===n&&(n=J()),void 0===a&&(a=Ln);var t=r.map((function(r,n){return{color:a(r),i:n}}));return function(a,e,o){return void 0===e&&(e=1),void 0===o&&(o=1/0),isFinite(e)&&(e=Math.max(1,Math.min(e,t.length-1))),t.forEach((function(r){r.d=n(a,r.color)})),t.sort((function(r,n){return r.d-n.d})).slice(0,e).filter((function(r){return r.d<o})).map((function(n){return r[n.i]}))}},r.parse=T,r.random=function(r,n){void 0===r&&(r="rgb"),void 0===n&&(n={});var a=B(r),t=function(r){return Object.keys(r).reduce((function(n,a){var t=r[a];return n[a]=Array.isArray(t)?t:[t,t],n}),{})}(n);return a.channels.reduce((function(r,n){return(t.alpha||"alpha"!==n)&&(r[n]=function(r){var n=r[0],a=r[1];return n+Math.random()*(a-n)}(t[n]||a.ranges[n])),r}),{mode:r})},r.rgb=Zn,r.round=Yr,r.samples=function(r,n){void 0===r&&(r=2),void 0===n&&(n=1);var a=x(n);if(r<2)return r<1?[]:[a(.5)];for(var t=[],e=0;e<r;e++)t.push(a(e/(r-1)));return t},r.wcagContrast=function(r,n){var a=Tn(r),t=Tn(n);return(Math.max(a,t)+.05)/(Math.min(a,t)+.05)},r.wcagLuminance=Tn,r.xyz=pa,r.yiq=da,Object.defineProperty(r,"__esModule",{value:!0})})); |
{ | ||
"name": "culori", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"main": "build/culori.umd.js", | ||
@@ -5,0 +5,0 @@ "browser": "build/culori.umd.js", |
@@ -1,5 +0,7 @@ | ||
# Culori | ||
![culori](./docs/img/culori.svg) | ||
A color library for JavaScript that works across many color spaces to offer conversion, interpolation, color difference formulas, and blending functions. | ||
<a href="https://www.npmjs.org/package/culori"><img src="https://img.shields.io/npm/v/culori.svg?style=flat-square&labelColor=d84f4c&color=black" alt="npm version"></a> <a href="https://bundlephobia.com/result?p=culori"><img src="https://img.shields.io/bundlephobia/minzip/culori?style=flat-square&labelColor=d84f4c&color=black" alt="npm version"></a> | ||
[**Documentation**](https://culorijs.org) | ||
culori is a color library for JavaScript that works across many color spaces to offer conversion, interpolation, color difference formulas, blending functions, and more. | ||
[**Read the documentation**](https://culorijs.org) |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
286354
9690
8