@gradient-js/svg
Version:
Gradient-js svg generation module
2 lines • 43.6 kB
JavaScript
/*! For license information please see svg.js.LICENSE.txt */
!function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.GradientJsSvg=e():r.GradientJsSvg=e()}(window,(function(){return function(r){var e={};function t(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return r[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var a in r)t.d(n,a,function(e){return r[e]}.bind(null,a));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=1)}([function(r,e,t){window,r.exports=function(r){var e={};function t(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return r[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}return t.m=r,t.c=e,t.d=function(r,e,n){t.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},t.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},t.t=function(r,e){if(1&e&&(r=t(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var a in r)t.d(n,a,function(e){return r[e]}.bind(null,a));return n},t.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return t.d(e,"a",e),e},t.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},t.p="",t(t.s=1)}([function(r,e,t){r.exports=function(){"use strict";for(var r=function(r,e,t){return void 0===e&&(e=0),void 0===t&&(t=1),r<e?e:r>t?t:r},e={},t=0,n=["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"];t<n.length;t+=1){var a=n[t];e["[object "+a+"]"]=a.toLowerCase()}var f=function(r){return e[Object.prototype.toString.call(r)]||"object"},o=Math.PI,u={clip_rgb:function(e){e._clipped=!1,e._unclipped=e.slice(0);for(var t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=r(e[t],0,255)):3===t&&(e[t]=r(e[t],0,1));return e},limit:r,type:f,unpack:function(r,e){return void 0===e&&(e=null),r.length>=3?Array.prototype.slice.call(r):"object"==f(r[0])&&e?e.split("").filter((function(e){return void 0!==r[0][e]})).map((function(e){return r[0][e]})):r[0]},last:function(r){if(r.length<2)return null;var e=r.length-1;return"string"==f(r[e])?r[e].toLowerCase():null},PI:o,TWOPI:2*o,PITHIRD:o/3,DEG2RAD:o/180,RAD2DEG:180/o},c={format:{},autodetect:[]},i=u.last,l=u.clip_rgb,s=u.type,d=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=this;if("object"===s(r[0])&&r[0].constructor&&r[0].constructor===this.constructor)return r[0];var n=i(r),a=!1;if(!n){a=!0,c.sorted||(c.autodetect=c.autodetect.sort((function(r,e){return e.p-r.p})),c.sorted=!0);for(var f=0,o=c.autodetect;f<o.length;f+=1){var u=o[f];if(n=u.test.apply(u,r))break}}if(!c.format[n])throw new Error("unknown format: "+r);var d=c.format[n].apply(null,a?r:r.slice(0,-1));t._rgb=l(d),3===t._rgb.length&&t._rgb.push(1)};d.prototype.toString=function(){return"function"==s(this.hex)?this.hex():"["+this._rgb.join(",")+"]"};var h=d,b=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(b.Color,[null].concat(r)))};b.Color=h,b.version="2.1.0";var p=b,g=u.unpack,v=Math.max,m=u.unpack,y=u.unpack,w=u.type;h.prototype.cmyk=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=g(r,"rgb"),n=t[0],a=t[1],f=t[2],o=1-v(n/=255,v(a/=255,f/=255)),u=o<1?1/(1-o):0,c=(1-n-o)*u,i=(1-a-o)*u,l=(1-f-o)*u;return[c,i,l,o]}(this._rgb)},p.cmyk=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["cmyk"])))},c.format.cmyk=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=(r=m(r,"cmyk"))[0],n=r[1],a=r[2],f=r[3],o=r.length>4?r[4]:1;return 1===f?[0,0,0,o]:[t>=1?0:255*(1-t)*(1-f),n>=1?0:255*(1-n)*(1-f),a>=1?0:255*(1-a)*(1-f),o]},c.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(r=y(r,"cmyk"),"array"===w(r)&&4===r.length)return"cmyk"}});var k=u.unpack,M=u.last,_=function(r){return Math.round(100*r)/100},N=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=k(r,"hsla"),n=M(r)||"lsa";return t[0]=_(t[0]||0),t[1]=_(100*t[1])+"%",t[2]=_(100*t[2])+"%","hsla"===n||t.length>3&&t[3]<1?(t[3]=t.length>3?t[3]:1,n="hsla"):t.length=3,n+"("+t.join(",")+")"},x=u.unpack,O=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=(r=x(r,"rgba"))[0],n=r[1],a=r[2];t/=255,n/=255,a/=255;var f,o,u=Math.min(t,n,a),c=Math.max(t,n,a),i=(c+u)/2;return c===u?(f=0,o=Number.NaN):f=i<.5?(c-u)/(c+u):(c-u)/(2-c-u),t==c?o=(n-a)/(c-u):n==c?o=2+(a-t)/(c-u):a==c&&(o=4+(t-n)/(c-u)),(o*=60)<0&&(o+=360),r.length>3&&void 0!==r[3]?[o,f,i,r[3]]:[o,f,i]},j=u.unpack,A=u.last,E=Math.round,S=u.unpack,P=Math.round,G=function(){for(var r,e=[],t=arguments.length;t--;)e[t]=arguments[t];var n,a,f,o=(e=S(e,"hsl"))[0],u=e[1],c=e[2];if(0===u)n=a=f=255*c;else{var i=[0,0,0],l=[0,0,0],s=c<.5?c*(1+u):c+u-c*u,d=2*c-s,h=o/360;i[0]=h+1/3,i[1]=h,i[2]=h-1/3;for(var b=0;b<3;b++)i[b]<0&&(i[b]+=1),i[b]>1&&(i[b]-=1),6*i[b]<1?l[b]=d+6*(s-d)*i[b]:2*i[b]<1?l[b]=s:3*i[b]<2?l[b]=d+(s-d)*(2/3-i[b])*6:l[b]=d;n=(r=[P(255*l[0]),P(255*l[1]),P(255*l[2])])[0],a=r[1],f=r[2]}return e.length>3?[n,a,f,e[3]]:[n,a,f,1]},C=/^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/,L=/^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/,F=/^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,B=/^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,q=/^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/,R=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,I=Math.round,T=function(r){var e;if(r=r.toLowerCase().trim(),c.format.named)try{return c.format.named(r)}catch(r){}if(e=r.match(C)){for(var t=e.slice(1,4),n=0;n<3;n++)t[n]=+t[n];return t[3]=1,t}if(e=r.match(L)){for(var a=e.slice(1,5),f=0;f<4;f++)a[f]=+a[f];return a}if(e=r.match(F)){for(var o=e.slice(1,4),u=0;u<3;u++)o[u]=I(2.55*o[u]);return o[3]=1,o}if(e=r.match(B)){for(var i=e.slice(1,5),l=0;l<3;l++)i[l]=I(2.55*i[l]);return i[3]=+i[3],i}if(e=r.match(q)){var s=e.slice(1,4);s[1]*=.01,s[2]*=.01;var d=G(s);return d[3]=1,d}if(e=r.match(R)){var h=e.slice(1,4);h[1]*=.01,h[2]*=.01;var b=G(h);return b[3]=+e[4],b}};T.test=function(r){return C.test(r)||L.test(r)||F.test(r)||B.test(r)||q.test(r)||R.test(r)};var D=T,z=u.type;h.prototype.css=function(r){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=j(r,"rgba"),n=A(r)||"rgb";return"hsl"==n.substr(0,3)?N(O(t),n):(t[0]=E(t[0]),t[1]=E(t[1]),t[2]=E(t[2]),("rgba"===n||t.length>3&&t[3]<1)&&(t[3]=t.length>3?t[3]:1,n="rgba"),n+"("+t.slice(0,"rgb"===n?3:4).join(",")+")")}(this._rgb,r)},p.css=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["css"])))},c.format.css=D,c.autodetect.push({p:5,test:function(r){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];if(!e.length&&"string"===z(r)&&D.test(r))return"css"}});var $=u.unpack;c.format.gl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=$(r,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t},p.gl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["gl"])))},h.prototype.gl=function(){var r=this._rgb;return[r[0]/255,r[1]/255,r[2]/255,r[3]]};var U=u.unpack,Y=u.unpack,V=Math.floor,W=u.unpack,X=u.type;h.prototype.hcg=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n=U(r,"rgb"),a=n[0],f=n[1],o=n[2],u=Math.min(a,f,o),c=Math.max(a,f,o),i=c-u,l=100*i/255,s=u/(255-i)*100;return 0===i?t=Number.NaN:(a===c&&(t=(f-o)/i),f===c&&(t=2+(o-a)/i),o===c&&(t=4+(a-f)/i),(t*=60)<0&&(t+=360)),[t,l,s]}(this._rgb)},p.hcg=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["hcg"])))},c.format.hcg=function(){for(var r,e,t,n,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,s=(o=Y(o,"hcg"))[0],d=o[1],h=o[2];h*=255;var b=255*d;if(0===d)c=i=l=h;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360);var p=V(s/=60),g=s-p,v=h*(1-d),m=v+b*(1-g),y=v+b*g,w=v+b;switch(p){case 0:c=(r=[w,y,v])[0],i=r[1],l=r[2];break;case 1:c=(e=[m,w,v])[0],i=e[1],l=e[2];break;case 2:c=(t=[v,w,y])[0],i=t[1],l=t[2];break;case 3:c=(n=[v,m,w])[0],i=n[1],l=n[2];break;case 4:c=(a=[y,v,w])[0],i=a[1],l=a[2];break;case 5:c=(f=[w,v,m])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},c.autodetect.push({p:1,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(r=W(r,"hcg"),"array"===X(r)&&3===r.length)return"hcg"}});var H=u.unpack,J=u.last,K=Math.round,Q=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=H(r,"rgba"),n=t[0],a=t[1],f=t[2],o=t[3],u=J(r)||"auto";void 0===o&&(o=1),"auto"===u&&(u=o<1?"rgba":"rgb");var c=(n=K(n))<<16|(a=K(a))<<8|(f=K(f)),i="000000"+c.toString(16);i=i.substr(i.length-6);var l="0"+K(255*o).toString(16);switch(l=l.substr(l.length-2),u.toLowerCase()){case"rgba":return"#"+i+l;case"argb":return"#"+l+i;default:return"#"+i}},Z=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,rr=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,er=function(r){if(r.match(Z)){4!==r.length&&7!==r.length||(r=r.substr(1)),3===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]);var e=parseInt(r,16);return[e>>16,e>>8&255,255&e,1]}if(r.match(rr)){5!==r.length&&9!==r.length||(r=r.substr(1)),4===r.length&&(r=(r=r.split(""))[0]+r[0]+r[1]+r[1]+r[2]+r[2]+r[3]+r[3]);var t=parseInt(r,16);return[t>>24&255,t>>16&255,t>>8&255,Math.round((255&t)/255*100)/100]}throw new Error("unknown hex color: "+r)},tr=u.type;h.prototype.hex=function(r){return Q(this._rgb,r)},p.hex=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["hex"])))},c.format.hex=er,c.autodetect.push({p:4,test:function(r){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];if(!e.length&&"string"===tr(r)&&[3,4,5,6,7,8,9].indexOf(r.length)>=0)return"hex"}});var nr=u.unpack,ar=u.TWOPI,fr=Math.min,or=Math.sqrt,ur=Math.acos,cr=u.unpack,ir=u.limit,lr=u.TWOPI,sr=u.PITHIRD,dr=Math.cos,hr=u.unpack,br=u.type;h.prototype.hsi=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n=nr(r,"rgb"),a=n[0],f=n[1],o=n[2],u=fr(a/=255,f/=255,o/=255),c=(a+f+o)/3,i=c>0?1-u/c:0;return 0===i?t=NaN:(t=(a-f+(a-o))/2,t/=or((a-f)*(a-f)+(a-o)*(f-o)),t=ur(t),o>f&&(t=ar-t),t/=ar),[360*t,i,c]}(this._rgb)},p.hsi=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["hsi"])))},c.format.hsi=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n,a,f=(r=cr(r,"hsi"))[0],o=r[1],u=r[2];return isNaN(f)&&(f=0),isNaN(o)&&(o=0),f>360&&(f-=360),f<0&&(f+=360),(f/=360)<1/3?n=1-((a=(1-o)/3)+(t=(1+o*dr(lr*f)/dr(sr-lr*f))/3)):f<2/3?a=1-((t=(1-o)/3)+(n=(1+o*dr(lr*(f-=1/3))/dr(sr-lr*f))/3)):t=1-((n=(1-o)/3)+(a=(1+o*dr(lr*(f-=2/3))/dr(sr-lr*f))/3)),[255*(t=ir(u*t*3)),255*(n=ir(u*n*3)),255*(a=ir(u*a*3)),r.length>3?r[3]:1]},c.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(r=hr(r,"hsi"),"array"===br(r)&&3===r.length)return"hsi"}});var pr=u.unpack,gr=u.type;h.prototype.hsl=function(){return O(this._rgb)},p.hsl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["hsl"])))},c.format.hsl=G,c.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(r=pr(r,"hsl"),"array"===gr(r)&&3===r.length)return"hsl"}});var vr=u.unpack,mr=Math.min,yr=Math.max,wr=u.unpack,kr=Math.floor,Mr=u.unpack,_r=u.type;h.prototype.hsv=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n,a,f=(r=vr(r,"rgb"))[0],o=r[1],u=r[2],c=mr(f,o,u),i=yr(f,o,u),l=i-c;return a=i/255,0===i?(t=Number.NaN,n=0):(n=l/i,f===i&&(t=(o-u)/l),o===i&&(t=2+(u-f)/l),u===i&&(t=4+(f-o)/l),(t*=60)<0&&(t+=360)),[t,n,a]}(this._rgb)},p.hsv=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["hsv"])))},c.format.hsv=function(){for(var r,e,t,n,a,f,o=[],u=arguments.length;u--;)o[u]=arguments[u];var c,i,l,s=(o=wr(o,"hsv"))[0],d=o[1],h=o[2];if(h*=255,0===d)c=i=l=h;else{360===s&&(s=0),s>360&&(s-=360),s<0&&(s+=360);var b=kr(s/=60),p=s-b,g=h*(1-d),v=h*(1-d*p),m=h*(1-d*(1-p));switch(b){case 0:c=(r=[h,m,g])[0],i=r[1],l=r[2];break;case 1:c=(e=[v,h,g])[0],i=e[1],l=e[2];break;case 2:c=(t=[g,h,m])[0],i=t[1],l=t[2];break;case 3:c=(n=[g,v,h])[0],i=n[1],l=n[2];break;case 4:c=(a=[m,g,h])[0],i=a[1],l=a[2];break;case 5:c=(f=[h,g,v])[0],i=f[1],l=f[2]}}return[c,i,l,o.length>3?o[3]:1]},c.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(r=Mr(r,"hsv"),"array"===_r(r)&&3===r.length)return"hsv"}});var Nr=u.unpack,xr=Math.pow,Or=function(r){return(r/=255)<=.04045?r/12.92:xr((r+.055)/1.055,2.4)},jr=function(r){return r>.008856452?xr(r,1/3):r/.12841855+.137931034},Ar=function(r,e,t){return r=Or(r),e=Or(e),t=Or(t),[jr((.4124564*r+.3575761*e+.1804375*t)/.95047),jr((.2126729*r+.7151522*e+.072175*t)/1),jr((.0193339*r+.119192*e+.9503041*t)/1.08883)]},Er=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=Nr(r,"rgb"),n=t[0],a=t[1],f=t[2],o=Ar(n,a,f),u=o[0],c=o[1],i=o[2],l=116*c-16;return[l<0?0:l,500*(u-c),200*(c-i)]},Sr=u.unpack,Pr=Math.pow,Gr=function(r){return 255*(r<=.00304?12.92*r:1.055*Pr(r,1/2.4)-.055)},Cr=function(r){return r>.206896552?r*r*r:.12841855*(r-.137931034)},Lr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t,n,a,f=(r=Sr(r,"lab"))[0],o=r[1],u=r[2];return n=(f+16)/116,t=isNaN(o)?n:n+o/500,a=isNaN(u)?n:n-u/200,n=1*Cr(n),t=.95047*Cr(t),a=1.08883*Cr(a),[Gr(3.2404542*t-1.5371385*n-.4985314*a),Gr(-.969266*t+1.8760108*n+.041556*a),Gr(.0556434*t-.2040259*n+1.0572252*a),r.length>3?r[3]:1]},Fr=u.unpack,Br=u.type;h.prototype.lab=function(){return Er(this._rgb)},p.lab=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["lab"])))},c.format.lab=Lr,c.autodetect.push({p:2,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(r=Fr(r,"lab"),"array"===Br(r)&&3===r.length)return"lab"}});var qr=u.unpack,Rr=u.RAD2DEG,Ir=Math.sqrt,Tr=Math.atan2,Dr=Math.round,zr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=qr(r,"lab"),n=t[0],a=t[1],f=t[2],o=Ir(a*a+f*f),u=(Tr(f,a)*Rr+360)%360;return 0===Dr(1e4*o)&&(u=Number.NaN),[n,o,u]},$r=u.unpack,Ur=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=$r(r,"rgb"),n=t[0],a=t[1],f=t[2],o=Er(n,a,f),u=o[0],c=o[1],i=o[2];return zr(u,c,i)},Yr=u.unpack,Vr=u.DEG2RAD,Wr=Math.sin,Xr=Math.cos,Hr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=Yr(r,"lch"),n=t[0],a=t[1],f=t[2];return isNaN(f)&&(f=0),[n,Xr(f*=Vr)*a,Wr(f)*a]},Jr=u.unpack,Kr=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=(r=Jr(r,"lch"))[0],n=r[1],a=r[2],f=Hr(t,n,a),o=f[0],u=f[1],c=f[2],i=Lr(o,u,c),l=i[0],s=i[1],d=i[2];return[l,s,d,r.length>3?r[3]:1]},Qr=u.unpack,Zr=u.unpack,re=u.type;h.prototype.lch=function(){return Ur(this._rgb)},h.prototype.hcl=function(){return Ur(this._rgb).reverse()},p.lch=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["lch"])))},p.hcl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["hcl"])))},c.format.lch=Kr,c.format.hcl=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=Qr(r,"hcl").reverse();return Kr.apply(void 0,t)},["lch","hcl"].forEach((function(r){return c.autodetect.push({p:2,test:function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(e=Zr(e,r),"array"===re(e)&&3===e.length)return r}})}));var ee={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflower:"#6495ed",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},te=u.type;h.prototype.name=function(){for(var r=Q(this._rgb,"rgb"),e=0,t=Object.keys(ee);e<t.length;e+=1){var n=t[e];if(ee[n]===r)return n.toLowerCase()}return r},c.format.named=function(r){if(r=r.toLowerCase(),ee[r])return er(ee[r]);throw new Error("unknown color name: "+r)},c.autodetect.push({p:5,test:function(r){for(var e=[],t=arguments.length-1;t-- >0;)e[t]=arguments[t+1];if(!e.length&&"string"===te(r)&&ee[r.toLowerCase()])return"named"}});var ne=u.unpack,ae=u.type,fe=u.type;h.prototype.num=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=ne(r,"rgb"),n=t[0],a=t[1],f=t[2];return(n<<16)+(a<<8)+f}(this._rgb)},p.num=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["num"])))},c.format.num=function(r){if("number"==ae(r)&&r>=0&&r<=16777215)return[r>>16,r>>8&255,255&r,1];throw new Error("unknown num color: "+r)},c.autodetect.push({p:5,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(1===r.length&&"number"===fe(r[0])&&r[0]>=0&&r[0]<=16777215)return"num"}});var oe=u.unpack,ue=u.type,ce=Math.round;h.prototype.rgb=function(r){return void 0===r&&(r=!0),!1===r?this._rgb.slice(0,3):this._rgb.slice(0,3).map(ce)},h.prototype.rgba=function(r){return void 0===r&&(r=!0),this._rgb.slice(0,4).map((function(e,t){return t<3?!1===r?e:ce(e):e}))},p.rgb=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["rgb"])))},c.format.rgb=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];var t=oe(r,"rgba");return void 0===t[3]&&(t[3]=1),t},c.autodetect.push({p:3,test:function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];if(r=oe(r,"rgba"),"array"===ue(r)&&(3===r.length||4===r.length&&"number"==ue(r[3])&&r[3]>=0&&r[3]<=1))return"rgb"}});var ie=Math.log,le=function(r){var e,t,n,a=r/100;return a<66?(e=255,t=-155.25485562709179-.44596950469579133*(t=a-2)+104.49216199393888*ie(t),n=a<20?0:.8274096064007395*(n=a-10)-254.76935184120902+115.67994401066147*ie(n)):(e=351.97690566805693+.114206453784165*(e=a-55)-40.25366309332127*ie(e),t=325.4494125711974+.07943456536662342*(t=a-50)-28.0852963507957*ie(t),n=255),[e,t,n,1]},se=u.unpack,de=Math.round;h.prototype.temp=h.prototype.kelvin=h.prototype.temperature=function(){return function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];for(var t,n=se(r,"rgb"),a=n[0],f=n[2],o=1e3,u=4e4,c=.4;u-o>c;){var i=le(t=.5*(u+o));i[2]/i[0]>=f/a?u=t:o=t}return de(t)}(this._rgb)},p.temp=p.kelvin=p.temperature=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return new(Function.prototype.bind.apply(h,[null].concat(r,["temp"])))},c.format.temp=c.format.kelvin=c.format.temperature=le;var he=u.type;h.prototype.alpha=function(r,e){return void 0===e&&(e=!1),void 0!==r&&"number"===he(r)?e?(this._rgb[3]=r,this):new h([this._rgb[0],this._rgb[1],this._rgb[2],r],"rgb"):this._rgb[3]},h.prototype.clipped=function(){return this._rgb._clipped||!1},h.prototype.darken=function(r){void 0===r&&(r=1);var e=this.lab();return e[0]-=18*r,new h(e,"lab").alpha(this.alpha(),!0)},h.prototype.brighten=function(r){return void 0===r&&(r=1),this.darken(-r)},h.prototype.darker=h.prototype.darken,h.prototype.brighter=h.prototype.brighten,h.prototype.get=function(r){var e=r.split("."),t=e[0],n=e[1],a=this[t]();if(n){var f=t.indexOf(n);if(f>-1)return a[f];throw new Error("unknown channel "+n+" in mode "+t)}return a};var be=u.type,pe=Math.pow;h.prototype.luminance=function(r){if(void 0!==r&&"number"===be(r)){if(0===r)return new h([0,0,0,this._rgb[3]],"rgb");if(1===r)return new h([255,255,255,this._rgb[3]],"rgb");var e=this.luminance(),t=20,n=function(e,a){var f=e.interpolate(a,.5,"rgb"),o=f.luminance();return Math.abs(r-o)<1e-7||!t--?f:o>r?n(e,f):n(f,a)},a=(e>r?n(new h([0,0,0]),this):n(this,new h([255,255,255]))).rgb();return new h(a.concat([this._rgb[3]]))}return ge.apply(void 0,this._rgb.slice(0,3))};var ge=function(r,e,t){return.2126*(r=ve(r))+.7152*(e=ve(e))+.0722*ve(t)},ve=function(r){return(r/=255)<=.03928?r/12.92:pe((r+.055)/1.055,2.4)},me={},ye=u.type,we=function(r,e,t){void 0===t&&(t=.5);for(var n=[],a=arguments.length-3;a-- >0;)n[a]=arguments[a+3];var f=n[0]||"lrgb";if(me[f]||n.length||(f=Object.keys(me)[0]),!me[f])throw new Error("interpolation mode "+f+" is not defined");return"object"!==ye(r)&&(r=new h(r)),"object"!==ye(e)&&(e=new h(e)),me[f](r,e,t).alpha(r.alpha()+t*(e.alpha()-r.alpha()))};h.prototype.mix=h.prototype.interpolate=function(r,e){void 0===e&&(e=.5);for(var t=[],n=arguments.length-2;n-- >0;)t[n]=arguments[n+2];return we.apply(void 0,[this,r,e].concat(t))},h.prototype.premultiply=function(r){void 0===r&&(r=!1);var e=this._rgb,t=e[3];return r?(this._rgb=[e[0]*t,e[1]*t,e[2]*t,t],this):new h([e[0]*t,e[1]*t,e[2]*t,t],"rgb")},h.prototype.saturate=function(r){void 0===r&&(r=1);var e=this.lch();return e[1]+=18*r,e[1]<0&&(e[1]=0),new h(e,"lch").alpha(this.alpha(),!0)},h.prototype.desaturate=function(r){return void 0===r&&(r=1),this.saturate(-r)};var ke=u.type;h.prototype.set=function(r,e,t){void 0===t&&(t=!1);var n=r.split("."),a=n[0],f=n[1],o=this[a]();if(f){var u=a.indexOf(f);if(u>-1){if("string"==ke(e))switch(e.charAt(0)){case"+":case"-":o[u]+=+e;break;case"*":o[u]*=+e.substr(1);break;case"/":o[u]/=+e.substr(1);break;default:o[u]=+e}else{if("number"!==ke(e))throw new Error("unsupported value for Color.set");o[u]=e}var c=new h(o,a);return t?(this._rgb=c._rgb,this):c}throw new Error("unknown channel "+f+" in mode "+a)}return o},me.rgb=function(r,e,t){var n=r._rgb,a=e._rgb;return new h(n[0]+t*(a[0]-n[0]),n[1]+t*(a[1]-n[1]),n[2]+t*(a[2]-n[2]),"rgb")};var Me=Math.sqrt,_e=Math.pow;me.lrgb=function(r,e,t){var n=r._rgb,a=n[0],f=n[1],o=n[2],u=e._rgb,c=u[0],i=u[1],l=u[2];return new h(Me(_e(a,2)*(1-t)+_e(c,2)*t),Me(_e(f,2)*(1-t)+_e(i,2)*t),Me(_e(o,2)*(1-t)+_e(l,2)*t),"rgb")},me.lab=function(r,e,t){var n=r.lab(),a=e.lab();return new h(n[0]+t*(a[0]-n[0]),n[1]+t*(a[1]-n[1]),n[2]+t*(a[2]-n[2]),"lab")};var Ne=function(r,e,t,n){var a,f,o,u,c,i,l,s,d,b,p,g;return"hsl"===n?(o=r.hsl(),u=e.hsl()):"hsv"===n?(o=r.hsv(),u=e.hsv()):"hcg"===n?(o=r.hcg(),u=e.hcg()):"hsi"===n?(o=r.hsi(),u=e.hsi()):"lch"!==n&&"hcl"!==n||(n="hcl",o=r.hcl(),u=e.hcl()),"h"===n.substr(0,1)&&(c=(a=o)[0],l=a[1],d=a[2],i=(f=u)[0],s=f[1],b=f[2]),isNaN(c)||isNaN(i)?isNaN(c)?isNaN(i)?g=Number.NaN:(g=i,1!=d&&0!=d||"hsv"==n||(p=s)):(g=c,1!=b&&0!=b||"hsv"==n||(p=l)):g=c+t*(i>c&&i-c>180?i-(c+360):i<c&&c-i>180?i+360-c:i-c),void 0===p&&(p=l+t*(s-l)),new h([g,p,d+t*(b-d)],n)},xe=function(r,e,t){return Ne(r,e,t,"lch")};me.lch=xe,me.hcl=xe,me.num=function(r,e,t){var n=r.num(),a=e.num();return new h(n+t*(a-n),"num")},me.hcg=function(r,e,t){return Ne(r,e,t,"hcg")},me.hsi=function(r,e,t){return Ne(r,e,t,"hsi")},me.hsl=function(r,e,t){return Ne(r,e,t,"hsl")},me.hsv=function(r,e,t){return Ne(r,e,t,"hsv")};var Oe=u.clip_rgb,je=Math.pow,Ae=Math.sqrt,Ee=Math.PI,Se=Math.cos,Pe=Math.sin,Ge=Math.atan2,Ce=u.type,Le=Math.pow,Fe=function(r){var e="rgb",t=p("#ccc"),n=0,a=[0,1],f=[],o=[0,0],u=!1,c=[],i=!1,l=0,s=1,d=!1,h={},b=!0,g=1,v=function(r){if((r=r||["#fff","#000"])&&"string"===Ce(r)&&p.brewer&&p.brewer[r.toLowerCase()]&&(r=p.brewer[r.toLowerCase()]),"array"===Ce(r)){1===r.length&&(r=[r[0],r[0]]),r=r.slice(0);for(var e=0;e<r.length;e++)r[e]=p(r[e]);f.length=0;for(var t=0;t<r.length;t++)f.push(t/(r.length-1))}return k(),c=r},m=function(r){return r},y=function(r){return r},w=function(r,n){var a,i;if(null==n&&(n=!1),isNaN(r)||null===r)return t;i=n?r:u&&u.length>2?function(r){if(null!=u){for(var e=u.length-1,t=0;t<e&&r>=u[t];)t++;return t-1}return 0}(r)/(u.length-2):s!==l?(r-l)/(s-l):1,i=y(i),n||(i=m(i)),1!==g&&(i=Le(i,g)),i=o[0]+i*(1-o[0]-o[1]),i=Math.min(1,Math.max(0,i));var d=Math.floor(1e4*i);if(b&&h[d])a=h[d];else{if("array"===Ce(c))for(var v=0;v<f.length;v++){var w=f[v];if(i<=w){a=c[v];break}if(i>=w&&v===f.length-1){a=c[v];break}if(i>w&&i<f[v+1]){i=(i-w)/(f[v+1]-w),a=p.interpolate(c[v],c[v+1],i,e);break}}else"function"===Ce(c)&&(a=c(i));b&&(h[d]=a)}return a},k=function(){return h={}};v(r);var M=function(r){var e=p(w(r));return i&&e[i]?e[i]():e};return M.classes=function(r){if(null!=r){if("array"===Ce(r))u=r,a=[r[0],r[r.length-1]];else{var e=p.analyze(a);u=0===r?[e.min,e.max]:p.limits(e,"e",r)}return M}return u},M.domain=function(r){if(!arguments.length)return a;l=r[0],s=r[r.length-1],f=[];var e=c.length;if(r.length===e&&l!==s)for(var t=0,n=Array.from(r);t<n.length;t+=1){var o=n[t];f.push((o-l)/(s-l))}else{for(var u=0;u<e;u++)f.push(u/(e-1));if(r.length>2){var i=r.map((function(e,t){return t/(r.length-1)})),d=r.map((function(r){return(r-l)/(s-l)}));d.every((function(r,e){return i[e]===r}))||(y=function(r){if(r<=0||r>=1)return r;for(var e=0;r>=d[e+1];)e++;var t=(r-d[e])/(d[e+1]-d[e]);return i[e]+t*(i[e+1]-i[e])})}}return a=[l,s],M},M.mode=function(r){return arguments.length?(e=r,k(),M):e},M.range=function(r,e){return v(r),M},M.out=function(r){return i=r,M},M.spread=function(r){return arguments.length?(n=r,M):n},M.correctLightness=function(r){return null==r&&(r=!0),d=r,k(),m=d?function(r){for(var e=w(0,!0).lab()[0],t=w(1,!0).lab()[0],n=e>t,a=w(r,!0).lab()[0],f=e+(t-e)*r,o=a-f,u=0,c=1,i=20;Math.abs(o)>.01&&i-- >0;)n&&(o*=-1),o<0?(u=r,r+=.5*(c-r)):(c=r,r+=.5*(u-r)),o=(a=w(r,!0).lab()[0])-f;return r}:function(r){return r},M},M.padding=function(r){return null!=r?("number"===Ce(r)&&(r=[r,r]),o=r,M):o},M.colors=function(e,t){arguments.length<2&&(t="hex");var n=[];if(0===arguments.length)n=c.slice(0);else if(1===e)n=[M(.5)];else if(e>1){var f=a[0],o=a[1]-f;n=Be(0,e,!1).map((function(r){return M(f+r/(e-1)*o)}))}else{r=[];var i=[];if(u&&u.length>2)for(var l=1,s=u.length,d=1<=s;d?l<s:l>s;d?l++:l--)i.push(.5*(u[l-1]+u[l]));else i=a;n=i.map((function(r){return M(r)}))}return p[t]&&(n=n.map((function(r){return r[t]()}))),n},M.cache=function(r){return null!=r?(b=r,M):b},M.gamma=function(r){return null!=r?(g=r,M):g},M.nodata=function(r){return null!=r?(t=p(r),M):t},M};function Be(r,e,t){for(var n=[],a=r<e,f=t?a?e+1:e-1:e,o=r;a?o<f:o>f;a?o++:o--)n.push(o);return n}var qe=function(r){var e,t,n,a,f,o,u;if(2===(r=r.map((function(r){return new h(r)}))).length)e=r.map((function(r){return r.lab()})),f=e[0],o=e[1],a=function(r){var e=[0,1,2].map((function(e){return f[e]+r*(o[e]-f[e])}));return new h(e,"lab")};else if(3===r.length)t=r.map((function(r){return r.lab()})),f=t[0],o=t[1],u=t[2],a=function(r){var e=[0,1,2].map((function(e){return(1-r)*(1-r)*f[e]+2*(1-r)*r*o[e]+r*r*u[e]}));return new h(e,"lab")};else if(4===r.length){var c;n=r.map((function(r){return r.lab()})),f=n[0],o=n[1],u=n[2],c=n[3],a=function(r){var e=[0,1,2].map((function(e){return(1-r)*(1-r)*(1-r)*f[e]+3*(1-r)*(1-r)*r*o[e]+3*(1-r)*r*r*u[e]+r*r*r*c[e]}));return new h(e,"lab")}}else if(5===r.length){var i=qe(r.slice(0,3)),l=qe(r.slice(2,5));a=function(r){return r<.5?i(2*r):l(2*(r-.5))}}return a},Re=function(r,e,t){if(!Re[t])throw new Error("unknown blend mode "+t);return Re[t](r,e)},Ie=function(r){return function(e,t){var n=p(t).rgb(),a=p(e).rgb();return p.rgb(r(n,a))}},Te=function(r){return function(e,t){var n=[];return n[0]=r(e[0],t[0]),n[1]=r(e[1],t[1]),n[2]=r(e[2],t[2]),n}};Re.normal=Ie(Te((function(r){return r}))),Re.multiply=Ie(Te((function(r,e){return r*e/255}))),Re.screen=Ie(Te((function(r,e){return 255*(1-(1-r/255)*(1-e/255))}))),Re.overlay=Ie(Te((function(r,e){return e<128?2*r*e/255:255*(1-2*(1-r/255)*(1-e/255))}))),Re.darken=Ie(Te((function(r,e){return r>e?e:r}))),Re.lighten=Ie(Te((function(r,e){return r>e?r:e}))),Re.dodge=Ie(Te((function(r,e){return 255===r||(r=e/255*255/(1-r/255))>255?255:r}))),Re.burn=Ie(Te((function(r,e){return 255*(1-(1-e/255)/(r/255))})));for(var De=Re,ze=u.type,$e=u.clip_rgb,Ue=u.TWOPI,Ye=Math.pow,Ve=Math.sin,We=Math.cos,Xe=Math.floor,He=Math.random,Je=Math.log,Ke=Math.pow,Qe=Math.floor,Ze=Math.abs,rt=function(r,e){void 0===e&&(e=null);var t={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0};return"object"===f(r)&&(r=Object.values(r)),r.forEach((function(r){e&&"object"===f(r)&&(r=r[e]),null==r||isNaN(r)||(t.values.push(r),t.sum+=r,r<t.min&&(t.min=r),r>t.max&&(t.max=r),t.count+=1)})),t.domain=[t.min,t.max],t.limits=function(r,e){return et(t,r,e)},t},et=function(r,e,t){void 0===e&&(e="equal"),void 0===t&&(t=7),"array"==f(r)&&(r=rt(r));var n=r.min,a=r.max,o=r.values.sort((function(r,e){return r-e}));if(1===t)return[n,a];var u=[];if("c"===e.substr(0,1)&&(u.push(n),u.push(a)),"e"===e.substr(0,1)){u.push(n);for(var c=1;c<t;c++)u.push(n+c/t*(a-n));u.push(a)}else if("l"===e.substr(0,1)){if(n<=0)throw new Error("Logarithmic scales are only possible for values > 0");var i=Math.LOG10E*Je(n),l=Math.LOG10E*Je(a);u.push(n);for(var s=1;s<t;s++)u.push(Ke(10,i+s/t*(l-i)));u.push(a)}else if("q"===e.substr(0,1)){u.push(n);for(var d=1;d<t;d++){var h=(o.length-1)*d/t,b=Qe(h);if(b===h)u.push(o[b]);else{var p=h-b;u.push(o[b]*(1-p)+o[b+1]*p)}}u.push(a)}else if("k"===e.substr(0,1)){var g,v=o.length,m=new Array(v),y=new Array(t),w=!0,k=0,M=null;(M=[]).push(n);for(var _=1;_<t;_++)M.push(n+_/t*(a-n));for(M.push(a);w;){for(var N=0;N<t;N++)y[N]=0;for(var x=0;x<v;x++)for(var O=o[x],j=Number.MAX_VALUE,A=void 0,E=0;E<t;E++){var S=Ze(M[E]-O);S<j&&(j=S,A=E),y[A]++,m[x]=A}for(var P=new Array(t),G=0;G<t;G++)P[G]=null;for(var C=0;C<v;C++)null===P[g=m[C]]?P[g]=o[C]:P[g]+=o[C];for(var L=0;L<t;L++)P[L]*=1/y[L];w=!1;for(var F=0;F<t;F++)if(P[F]!==M[F]){w=!0;break}M=P,++k>200&&(w=!1)}for(var B={},q=0;q<t;q++)B[q]=[];for(var R=0;R<v;R++)B[g=m[R]].push(o[R]);for(var I=[],T=0;T<t;T++)I.push(B[T][0]),I.push(B[T][B[T].length-1]);I=I.sort((function(r,e){return r-e})),u.push(I[0]);for(var D=1;D<I.length;D+=2){var z=I[D];isNaN(z)||-1!==u.indexOf(z)||u.push(z)}}return u},tt={analyze:rt,limits:et},nt=Math.sqrt,at=Math.atan2,ft=Math.abs,ot=Math.cos,ut=Math.PI,ct={cool:function(){return Fe([p.hsl(180,1,.9),p.hsl(250,.7,.4)])},hot:function(){return Fe(["#000","#f00","#ff0","#fff"]).mode("rgb")}},it={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},lt=0,st=Object.keys(it);lt<st.length;lt+=1){var dt=st[lt];it[dt.toLowerCase()]=it[dt]}var ht=it;return p.average=function(r,e,t){void 0===e&&(e="lrgb"),void 0===t&&(t=null);var n=r.length;t||(t=Array.from(new Array(n)).map((function(){return 1})));var a=n/t.reduce((function(r,e){return r+e}));if(t.forEach((function(r,e){t[e]*=a})),r=r.map((function(r){return new h(r)})),"lrgb"===e)return function(r,e){for(var t=r.length,n=[0,0,0,0],a=0;a<r.length;a++){var f=r[a],o=e[a]/t,u=f._rgb;n[0]+=je(u[0],2)*o,n[1]+=je(u[1],2)*o,n[2]+=je(u[2],2)*o,n[3]+=u[3]*o}return n[0]=Ae(n[0]),n[1]=Ae(n[1]),n[2]=Ae(n[2]),n[3]>.9999999&&(n[3]=1),new h(Oe(n))}(r,t);for(var f=r.shift(),o=f.get(e),u=[],c=0,i=0,l=0;l<o.length;l++)if(o[l]=(o[l]||0)*t[0],u.push(isNaN(o[l])?0:t[0]),"h"===e.charAt(l)&&!isNaN(o[l])){var s=o[l]/180*Ee;c+=Se(s)*t[0],i+=Pe(s)*t[0]}var d=f.alpha()*t[0];r.forEach((function(r,n){var a=r.get(e);d+=r.alpha()*t[n+1];for(var f=0;f<o.length;f++)if(!isNaN(a[f]))if(u[f]+=t[n+1],"h"===e.charAt(f)){var l=a[f]/180*Ee;c+=Se(l)*t[n+1],i+=Pe(l)*t[n+1]}else o[f]+=a[f]*t[n+1]}));for(var b=0;b<o.length;b++)if("h"===e.charAt(b)){for(var p=Ge(i/u[b],c/u[b])/Ee*180;p<0;)p+=360;for(;p>=360;)p-=360;o[b]=p}else o[b]=o[b]/u[b];return d/=n,new h(o,e).alpha(d>.99999?1:d,!0)},p.bezier=function(r){var e=qe(r);return e.scale=function(){return Fe(e)},e},p.blend=De,p.cubehelix=function(r,e,t,n,a){void 0===r&&(r=300),void 0===e&&(e=-1.5),void 0===t&&(t=1),void 0===n&&(n=1),void 0===a&&(a=[0,1]);var f,o=0;"array"===ze(a)?f=a[1]-a[0]:(f=0,a=[a,a]);var u=function(u){var c=Ue*((r+120)/360+e*u),i=Ye(a[0]+f*u,n),l=(0!==o?t[0]+u*o:t)*i*(1-i)/2,s=We(c),d=Ve(c);return p($e([255*(i+l*(-.14861*s+1.78277*d)),255*(i+l*(-.29227*s-.90649*d)),255*(i+l*(1.97294*s)),1]))};return u.start=function(e){return null==e?r:(r=e,u)},u.rotations=function(r){return null==r?e:(e=r,u)},u.gamma=function(r){return null==r?n:(n=r,u)},u.hue=function(r){return null==r?t:("array"===ze(t=r)?0==(o=t[1]-t[0])&&(t=t[1]):o=0,u)},u.lightness=function(r){return null==r?a:("array"===ze(r)?(a=r,f=r[1]-r[0]):(a=[r,r],f=0),u)},u.scale=function(){return p.scale(u)},u.hue(t),u},p.mix=p.interpolate=we,p.random=function(){for(var r="#",e=0;e<6;e++)r+="0123456789abcdef".charAt(Xe(16*He()));return new h(r,"hex")},p.scale=Fe,p.analyze=tt.analyze,p.contrast=function(r,e){r=new h(r),e=new h(e);var t=r.luminance(),n=e.luminance();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},p.deltaE=function(r,e,t,n){void 0===t&&(t=1),void 0===n&&(n=1),r=new h(r),e=new h(e);for(var a=Array.from(r.lab()),f=a[0],o=a[1],u=a[2],c=Array.from(e.lab()),i=c[0],l=c[1],s=c[2],d=nt(o*o+u*u),b=nt(l*l+s*s),p=f<16?.511:.040975*f/(1+.01765*f),g=.0638*d/(1+.0131*d)+.638,v=d<1e-6?0:180*at(u,o)/ut;v<0;)v+=360;for(;v>=360;)v-=360;var m=v>=164&&v<=345?.56+ft(.2*ot(ut*(v+168)/180)):.36+ft(.4*ot(ut*(v+35)/180)),y=d*d*d*d,w=nt(y/(y+1900)),k=g*(w*m+1-w),M=d-b,_=o-l,N=u-s,x=(f-i)/(t*p),O=M/(n*g);return nt(x*x+O*O+(_*_+N*N-M*M)/(k*k))},p.distance=function(r,e,t){void 0===t&&(t="lab"),r=new h(r),e=new h(e);var n=r.get(t),a=e.get(t),f=0;for(var o in n){var u=(n[o]||0)-(a[o]||0);f+=u*u}return Math.sqrt(f)},p.limits=tt.limits,p.valid=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];try{return new(Function.prototype.bind.apply(h,[null].concat(r))),!0}catch(r){return!1}},p.scales=ct,p.colors=ee,p.brewer=ht,p}()},function(r,e,t){"use strict";t.r(e),t.d(e,"Core",(function(){return f}));var n=t(0),a=t.n(n),f=function(){function r(){this.defaultOptions={useBezier:!1,interpolation:"rgb",samples:10,lightnessCorrection:!1}}return r.prototype.get=function(r,e){if(void 0===e&&(e=this.defaultOptions),r.find((function(r){return"string"!=typeof r})))throw new Error("Invalid color types. Only colors passed as the css strings are accepted");var t=this.getLinearScale,n=this.getBezierScale;return(0,this.getBase)((e.useBezier?n:t)(e,r))},r.prototype.getLinearScale=function(r,e){var t=a.a.scale(e);return r.interpolation?{scale:r.lightnessCorrection?t.mode(r.interpolation).correctLightness():t.mode(r.interpolation),options:r}:{scale:r.lightnessCorrection?t.correctLightness():t,options:r}},r.prototype.getBezierScale=function(r,e){var t=a.a.bezier(e).scale();return{scale:r.lightnessCorrection?t.correctLightness():t,options:r}},r.prototype.getBase=function(r){return new Array(r.options.samples).fill("").map((function(e,t){return r.scale(t/r.options.samples)}))},r}()}])},function(r,e,t){"use strict";t.r(e),t.d(e,"Svg",(function(){return f}));var n=t(0),a=function(){return(a=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var a in e=arguments[t])Object.prototype.hasOwnProperty.call(e,a)&&(r[a]=e[a]);return r}).apply(this,arguments)},f=function(){function r(){this.core=new n.Core}return r.prototype.get=function(r,e){return this.colors=this.core.get(r,e),this.options=e,this.createGradient()},r.prototype.createSvgElement=function(r){return document.createElementNS("http://www.w3.org/2000/svg",r)},r.prototype.createColorStop=function(r,e,t){var n=this.createSvgElement("stop");return n.offset=e/t*100+"%",n.setAttribute("stop-color",r),n},r.prototype.colorsToStops=function(){var r=this,e=this.colors;return e.map((function(t,n){var a="rgba("+t.rgba(!0)+")";return r.createColorStop(a,n,e.length)}))},r.prototype.createGradientElement=function(){var r=this.options,e=this.createSvgElement(r.type+"Gradient"),t=/((id)|([c|f|x|y|r][x|y|1|2]?)|(gradientUnits))/,n=r[r.type+"GradientOptions"],f=a({id:r.id,type:r.type,gradientUnits:r.gradientUnits},n);return Object.entries(f).filter((function(r){return t.test(r[0])})).forEach((function(r){"type"!==r[0]&&e.setAttribute(r[0],r[1])})),r.angle&&e.setAttribute("gradientTransform","rotate("+r.angle+")"),e},r.prototype.createGradient=function(){var r=this.createGradientElement();return this.colorsToStops().forEach((function(e){return r.appendChild(e)})),r},r}()}])}));