@antv/scale
Advanced tools
Comparing version 0.4.7 to 0.4.8
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Scale={})}(this,function(t){"use strict";function H(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)}function P(t){return i(t,"Function")}function R(t){return null==t}var q={}.toString,i=function(t,e){return q.call(t)==="[object "+e+"]"},E=function(t){return Array.isArray?Array.isArray(t):i(t,"Array")};function a(t){return i(t,"Number")}var W=function(t){if("object"!=typeof(e=t)||null===e||!i(t,"Object"))return!1;var e;if(null===Object.getPrototypeOf(t))return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n},$=(Object.values,5);function B(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)!function t(e,n,r,o){for(var a in r=r||0,o=o||$,n){var i;n.hasOwnProperty(a)&&(null!==(i=n[a])&&W(i)?(W(e[a])||(e[a]={}),r<o?t(e[a],i,r+1,o):e[a]=n[a]):E(i)?(e[a]=[],e[a]=e[a].concat(i)):void 0!==i&&(e[a]=i))}}(t,e[r]);return t}function u(t){return t}var s,_=function(t,e){if(!H(t))return-1;var n=Array.prototype.indexOf;if(n)return n.call(t,e);for(var r=-1,o=0;o<t.length;o++)if(t[o]===e){r=o;break}return r};function z(t){return R(t)?0:(H(t)?t:Object.keys(t)).length}var e=function(t,e){var n=(e=void 0===e?{}:e).fontSize,r=e.fontFamily,o=e.fontWeight,a=e.fontStyle,e=e.fontVariant;return(s=s||document.createElement("canvas").getContext("2d")).font=[a,e,o,n+"px",r].join(" "),s.measureText(i(t,"String")?t:"").width};if(!P(e))throw new TypeError("Expected a function");new Map;class n{constructor(t){this.options=B({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=B({},this.options,t),this.rescale(t)}rescale(t){}}function K(e,n,r){for(let t=0;t<n.length;t+=1)e.has(n[t])||e.set(r(n[t]),t)}function L(t){const{value:e,from:n,to:r,mapper:o,notFoundReturn:a}=t;let i=o.get(e);if(void 0===i){if(a)return a;i=n.push(e)-1,o.set(e,i)}return r[i%r.length]}function Z(t){return t instanceof Date?t=>""+t:"object"==typeof t?t=>JSON.stringify(t):t=>t}class r extends n{constructor(t){super(t)}getDefaultOptions(){return{domain:[],range:[]}}map(t){return 0===this.domainIndexMap.size&&K(this.domainIndexMap,this.getDomain(),this.domainKey),L({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&K(this.rangeIndexMap,this.getRange(),this.rangeKey),L({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){var[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=Z(e),this.rangeKey=Z(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),t&&!t.domain&&!t.compare||(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new r(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;var{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function J(t){const e=t["domain"];var n=e.length;if(0===n)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};const{range:r,paddingOuter:o,paddingInner:a,flex:i=[],round:s,align:u}=t,l=(t=i,d=e.length,0<(h=d-t.length)?[...t,...new Array(h).fill(1)]:h<0?t.slice(0,d):t);var[h,d]=r,t=d-h,d=t/(2/n*o+1-1/n*a);const c=d*a/n;d-=n*c;const g=function(t){const e=Math.min(...t);return t.map(t=>t/e)}(l),p=d/g.reduce((t,e)=>t+e);d=new Map(e.map((t,e)=>{e=l[e]*p;return[t,s?Math.floor(e):e]}));const f=new Map(e.map((t,e)=>{e=l[e]*p+c;return[t,s?Math.floor(e):e]}));var m=Array.from(f.values()).reduce((t,e)=>t+e),h=h+(t-(m-m/n*a))*u;let M=s?Math.round(h):h;const v=new Array(n);for(let t=0;t<n;t+=1){v[t]=(y=M,Math.round(1e12*y)/1e12);var y=e[t];M+=f.get(y)}return{valueBandWidth:d,valueStep:f,adjustedRange:v}}class Q extends r{constructor(t){super(t)}getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:void 0,flex:[]}}clone(){return new Q(this.options)}getStep(t){return void 0===this.valueStep?1:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){var{padding:t,paddingInner:e}=this.options;return 0<t?t:e}getPaddingOuter(){var{padding:t,paddingOuter:e}=this.options;return 0<t?t:e}rescale(){super.rescale();var{align:t,domain:e,range:n,round:r,flex:o}=this.options,{adjustedRange:t,valueBandWidth:n,valueStep:r}=J({align:t,range:n,round:r,flex:o,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=r,this.valueBandWidth=n,this.adjustedRange=t}}function l(t,...e){return e.reduce((e,n)=>t=>e(n(t)),t)}function V(e,n){return n-e?t=>(t-e)/(n-e):t=>.5}function G(t,e,n,r,o){let a=n||0,i=r||t.length;const s=o||(t=>t);for(;a<i;){var u=Math.floor((a+i)/2);s(t[u])>e?i=u:a=u+1}return a}const X=Math.sqrt(50),tt=Math.sqrt(10),et=Math.sqrt(2);function h(t,e,n){e=(e-t)/Math.max(0,n),t=Math.floor(Math.log(e)/Math.LN10),n=e/10**t;return 0<=t?(n>=X?10:n>=tt?5:n>=et?2:1)*10**t:-(10**-t)/(n>=X?10:n>=tt?5:n>=et?2:1)}function nt(t,e,n){n=Math.abs(e-t)/Math.max(0,n);let r=10**Math.floor(Math.log(n)/Math.LN10);n/=r;return n>=X?r*=10:n>=tt?r*=5:n>=et&&(r*=2),e<t?-r:r}const rt=(t,e,n=5)=>{const r=[t,e];let o=0,a=r.length-1,i=r[o],s=r[a],u;return s<i&&([i,s]=[s,i],[o,a]=[a,o]),0<(u=h(i,s,n))?(i=Math.floor(i/u)*u,s=Math.ceil(s/u)*u,u=h(i,s,n)):u<0&&(i=Math.ceil(i*u)/u,s=Math.floor(s*u)/u,u=h(i,s,n)),0<u?(r[o]=Math.floor(i/u)*u,r[a]=Math.ceil(s/u)*u):u<0&&(r[o]=Math.ceil(i*u)/u,r[a]=Math.floor(s*u)/u),r},o=1e3,d=6e4,c=36e5,g=24*c,p=7*g;var e=30*g,ot=365*g;function f(t,n,s,r){const o=(t,e)=>{let n=e;for(;n&&r(t)%e!=0;)s(t,-1),--n;return t},u=(t,e)=>{e&&o(t,e),n(t)};const l=(t,e)=>{t=new Date(+t-1);return u(t,e),s(t,e),u(t),t};return{ceil:l,floor:(t,e)=>{t=new Date(+t);return u(t,e),t},range:(t,e,n,r)=>{const o=[];for(var a=Math.floor(n),i=r?l(t,n):l(t);+i<+e;s(i,a),u(i))o.push(new Date(+i));return o},duration:t}}var m=f(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),M=f(o,t=>{t.setMilliseconds(0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getSeconds()),v=f(d,t=>{t.setSeconds(0,0)},(t,e=1)=>{t.setTime(+t+d*e)},t=>t.getMinutes()),y=f(c,t=>{t.setMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+c*e)},t=>t.getHours()),k=f(g,t=>{t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+g*e)},t=>t.getDate()-1);const at=f(e,t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e=1)=>{var n=t.getMonth();t.setMonth(n+e)},t=>t.getMonth());var it=f(p,t=>{t.setDate(t.getDate()-t.getDay()%7),t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+p*e)},t=>{var e=at.floor(t),t=new Date(+t);return Math.floor((+t-+e)/p)}),st=f(ot,t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e=1)=>{var n=t.getFullYear();t.setFullYear(n+e)},t=>t.getFullYear());const ut={millisecond:m,second:M,minute:v,hour:y,day:k,week:it,month:at,year:st};m=f(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),M=f(o,t=>{t.setUTCMilliseconds(0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getUTCSeconds()),v=f(d,t=>{t.setUTCSeconds(0,0)},(t,e=1)=>{t.setTime(+t+d*e)},t=>t.getUTCMinutes()),y=f(c,t=>{t.setUTCMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+c*e)},t=>t.getUTCHours()),k=f(g,t=>{t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+g*e)},t=>t.getUTCDate()-1);const lt=f(e,t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCMonth();t.setUTCMonth(n+e)},t=>t.getUTCMonth());it=f(p,t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7)%7),t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+p*e)},t=>{var e=lt.floor(t),t=new Date(+t);return Math.floor((+t-+e)/p)}),st=f(ot,t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCFullYear();t.setUTCFullYear(n+e)},t=>t.getUTCFullYear());const ht={millisecond:m,second:M,minute:v,hour:y,day:k,week:it,month:lt,year:st};function dt(t,e,n,r,o){var t=+t,e=+e,{tickIntervals:o,year:a,millisecond:i}=function(t){var{year:t,month:e,week:n,day:r,hour:o,minute:a,second:i,millisecond:s}=t?ht:ut;return{tickIntervals:[[i,1],[i,5],[i,15],[i,30],[a,1],[a,5],[a,15],[a,30],[o,1],[o,3],[o,6],[o,12],[r,1],[r,2],[n,1],[e,1],[e,3],[t,1]],year:t,millisecond:s}}(o),s=([t,e])=>t.duration*e,n=r?(e-t)/r:n||5,u=r||(e-t)/n,l=o.length,h=G(o,u,0,l,s);let d;return d=h===l?[a,nt(t/a.duration,e/a.duration,n)]:h?([l,a]=u/s(o[h-1])<s(o[h])/u?o[h-1]:o[h],[l,r?Math.ceil(r/l.duration):a]):[i,Math.max(nt(t,e,n),1)]}const ct=(t,e,n,r,o)=>{var a=e<t,i=a?e:t,t=a?t:e;const[s,u]=dt(i,t,n,r,o),l=[s.floor(i,u),s.ceil(t,u)];return a?l.reverse():l};function b(t){return null!=t&&!Number.isNaN(t)}const gt=e=>t=>-e(-t),pt=(t,e)=>{const n=Math.log(t);t=t===Math.E?Math.log:t=>Math.log(t)/n;return e?gt(t):t},ft=(e,t)=>{var n=e===Math.E?Math.exp:t=>e**t;return t?gt(n):n},mt=(t,e,n,r)=>{var o=t<0;const a=pt(r,o),i=ft(r,o);r=e<t,o=r?t:e;const s=[i(Math.floor(a(r?e:t))),i(Math.ceil(a(o)))];return r?s.reverse():s};var w,m={exports:{}},M={exports:{}},Mt=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||0<=t.length&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},vt=Array.prototype.concat,yt=Array.prototype.slice,kt=M.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n];Mt(o)?e=vt.call(e,yt.call(o)):e.push(o)}return e},D=(kt.wrap=function(t){return function(){return t(kt(arguments))}},{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),T=M.exports,bt=Object.hasOwnProperty,wt={};for(w in D)bt.call(D,w)&&(wt[D[w]]=w);var O=m.exports={to:{},get:{}};function x(t,e,n){return Math.min(Math.max(e,t),n)}function S(t){t=Math.round(t).toString(16).toUpperCase();return t.length<2?"0"+t:t}O.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=O.get.hsl(t),n="hsl";break;case"hwb":e=O.get.hwb(t),n="hwb";break;default:e=O.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},O.get.rgb=function(t){if(!t)return null;var e,n,r,o=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var a=2*n;o[n]=parseInt(e.slice(a,2+a),16)}r&&(o[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)o[n]=parseInt(e[n]+e[n],16);r&&(o[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)o[n]=parseInt(e[n+1],0);e[4]&&(e[5]?o[3]=.01*parseFloat(e[4]):o[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:bt.call(D,e[1])?((o=D[e[1]])[3]=1,o):null:null;for(n=0;n<3;n++)o[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?o[3]=.01*parseFloat(e[4]):o[3]=parseFloat(e[4]))}for(n=0;n<3;n++)o[n]=x(o[n],0,255);return o[3]=x(o[3],0,1),o},O.get.hsl=function(t){if(!t)return null;var e,t=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);return t?(e=parseFloat(t[4]),[(parseFloat(t[1])%360+360)%360,x(parseFloat(t[2]),0,100),x(parseFloat(t[3]),0,100),x(isNaN(e)?1:e,0,1)]):null},O.get.hwb=function(t){if(!t)return null;var e,t=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);return t?(e=parseFloat(t[4]),[(parseFloat(t[1])%360+360)%360,x(parseFloat(t[2]),0,100),x(parseFloat(t[3]),0,100),x(isNaN(e)?1:e,0,1)]):null},O.to.hex=function(){var t=T(arguments);return"#"+S(t[0])+S(t[1])+S(t[2])+(t[3]<1?S(Math.round(255*t[3])):"")},O.to.rgb=function(){var t=T(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},O.to.rgb.percent=function(){var t=T(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},O.to.hsl=function(){var t=T(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},O.to.hwb=function(){var t=T(arguments),e="";return 4<=t.length&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},O.to.keyword=function(t){return wt[t.slice(0,3)]};var Dt=m.exports;function Tt(t,e,n){let r=n;return r<0&&(r+=1),1<r&&--r,r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function Ot(t){t=Dt.get(t);if(!t)return null;var e,n,{model:t,value:r}=t;return"rgb"===t?r:"hsl"===t?(r=(t=r)[0]/360,e=t[1]/100,n=t[2]/100,t=t[3],0==e?[255*n,255*n,255*n,t]:[255*Tt(n=2*n-(e=n<.5?n*(1+e):n+e-n*e),e,r+1/3),255*Tt(n,e,r),255*Tt(n,e,r-1/3),t]):null}const C=(e,n)=>t=>e*(1-t)+n*t,xt=(t,e)=>{const u=Ot(t),l=Ot(e);return null===u||null===l?u?()=>t:()=>e:e=>{const n=new Array(4);for(let t=0;t<4;t+=1){var r=u[t],o=l[t];n[t]=r*(1-e)+o*e}var[t,a,i,s]=n;return`rgba(${Math.round(t)}, ${Math.round(a)}, ${Math.round(i)}, ${s})`}},Y=(t,e)=>"number"==typeof t&&"number"==typeof e?C(t,e):"string"==typeof t&&"string"==typeof e?xt(t,e):()=>t,St=(t,e)=>{const n=C(t,e);return t=>Math.round(n(t))};const N=(t,e,n)=>{let r,o,a=t,i=e;if(a===i&&0<n)return[a];let s=h(a,i,n);if(0===s||!Number.isFinite(s))return[];if(0<s){a=Math.ceil(a/s),i=Math.floor(i/s),o=new Array(r=Math.ceil(i-a+1));for(let t=0;t<r;t+=1)o[t]=(a+t)*s}else{s=-s,a=Math.ceil(a*s),i=Math.floor(i*s),o=new Array(r=Math.ceil(i-a+1));for(let t=0;t<r;t+=1)o[t]=(a+t)/s}return o};class Ct extends n{getDefaultOptions(){return{range:[0],domain:[0,1],unknown:void 0,tickCount:5,tickMethod:N}}map(t){var[e]=this.options.range;return void 0!==e?e:this.options.unknown}invert(t){var[e]=this.options.range;return t===e&&void 0!==e?this.options.domain:[]}getTicks(){const{tickMethod:t,domain:e,tickCount:n}=this.options;var[r,o]=e;return a(r)&&a(o)?t(r,o,n):[]}clone(){return new Ct(this.options)}}function j(t){return Math.abs(t)<1e-15?t:parseFloat(t.toFixed(15))}const Yt=[1,5,2,2.5,4,3],Nt=100*Number.EPSILON;const I=(n,r,t=5,o=!0,a=Yt,i=[.25,.2,.5,.05])=>{var s,u,l,h,d,c,g,p=t<0?0:Math.round(t);if(Number.isNaN(n)||Number.isNaN(r)||"number"!=typeof n||"number"!=typeof r||!p)return[];if(r-n<1e-15||1===p)return[n];const f={score:-2,lmin:0,lmax:0,lstep:0};let m=1;for(;m<1/0;){for(let t=0;t<a.length;t+=1){var M=a[t],v=(h=M,d=a,c=m,g=void 0,g=z(d),1-_(d,h)/(g-1)-c+1);if(i[0]*v+i[1]+i[2]+i[3]<f.score){m=1/0;break}let e=2;for(;e<1/0;){k=e;var y=(l=p)<=k?2-(k-1)/(l-1):1;if(i[0]*v+i[1]+i[2]*y+i[3]<f.score)break;var k=(r-n)/(e+1)/m/M;let t=Math.ceil(Math.log10(k));for(;t<1/0;){var b=m*M*10**t,w=(T=r,w=b*(e-1),(T-=n)<w?1-((w-T)/2)**2/(.1*T)**2:1);if(i[0]*v+i[1]*w+i[2]*y+i[3]<f.score)break;var D=Math.floor(r/b)*m-(e-1)*m,T=Math.ceil(n/b)*m;if(D<=T){var O=T-D;for(let t=0;t<=O;t+=1){var x=(D+t)*(b/m),S=x+b*(e-1),C=b,Y=function(t,e,n,r,o,a){var i=z(e),e=_(e,t);let s=0;return t=(r%a+a)%a,1-e/(i-1)-n+(s=(t<Nt||a-t<Nt)&&r<=0&&0<=o?1:s)}(M,a,m,x,S,C),N=1-.5*((r-S)**2+(n-x)**2)/(.1*(r-n))**2,I=(s=e,I=n,s=(s-1)/(S-(A=x)),u=((u=p)-1)/(Math.max(S,r)-Math.min(I,A)),2-Math.max(s/u,u/s)),A=i[0]*Y+i[1]*N+i[2]*I+ +i[3];A>f.score&&(!o||x<=n&&r<=S)&&(f.lmin=x,f.lmax=S,f.lstep=C,f.score=A)}}t+=1}e+=1}}m+=1}var t=j(f.lmax),e=j(f.lmin),F=j(f.lstep),U=Math.floor((t=(t-e)/F,Math.round(1e12*t)/1e12))+1;const H=new Array(U);H[0]=j(e);for(let t=1;t<U;t+=1)H[t]=j(H[t-1]+F);return H};class It extends n{getDefaultOptions(){return{domain:[0,1],range:[0,1],tickCount:5,unknown:void 0,tickMethod:I}}map(t){return b(t)?t:this.options.unknown}invert(t){return this.map(t)}clone(){return new It(this.options)}getTicks(){const{domain:t,tickCount:e,tickMethod:n}=this.options;var[r,o]=t;return a(r)&&a(o)?n(r,o,e):[]}}const At=(t,e,n)=>{var[t,r]=t,[e,o]=e;let a,i;return l(i=t<r?(a=V(t,r),n(e,o)):(a=V(r,t),n(o,e)),a)},Ft=(r,t,e)=>{const o=Math.min(r.length,t.length)-1,a=new Array(o),i=new Array(o);var n=r[0]>r[o],s=n?[...r].reverse():r,u=n?[...t].reverse():t;for(let t=0;t<o;t+=1)a[t]=V(s[t],s[t+1]),i[t]=e(u[t],u[t+1]);return t=>{var e=G(r,t,1,o)-1,n=a[e];return l(i[e],n)(t)}},Ut=(t,e,n,r)=>{const o=2<Math.min(t.length,e.length)?Ft:At;r=r?St:n;return o(t,e,r)};class A extends n{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:C,tickCount:5}}map(t){return b(t)?this.output(t):this.options.unknown}invert(t){return b(t)?this.input(t):this.options.unknown}nice(){var t,e,n,r;this.options.nice&&([t,e,n,...r]=this.getTickMethodOptions(),this.options.domain=this.chooseNice()(t,e,n,...r))}getTicks(){const t=this.options["tickMethod"];var[e,n,r,...o]=this.getTickMethodOptions();return t(e,n,r,...o)}getTickMethodOptions(){var{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return rt}rescale(){this.nice();var[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){var{clamp:e,range:n}=this.options,t=this.options.domain.map(t),n=Math.min(t.length,n.length);if(e){e=t[0],t=t[n-1];const r=t<e?t:e,o=t<e?e:t;return t=>Math.min(Math.max(r,t),o)}return u}composeOutput(t,e){const{domain:n,range:r,round:o,interpolate:a}=this.options;var i=Ut(n.map(t),r,a,o);this.output=l(i,e,t)}composeInput(t,e,n){const{domain:r,range:o}=this.options;t=Ut(o,r.map(t),C);this.input=l(e,n,t)}}class Ht extends A{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:Y,tickMethod:N,tickCount:5}}chooseTransforms(){return[u,u]}clone(){return new Ht(this.options)}}class jt extends Q{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,padding:0,unknown:void 0,paddingInner:1,paddingOuter:0}}constructor(t){super(t)}getPaddingInner(){return this.options.paddingInner}clone(){return new jt(this.options)}update(t){super.update(t)}getPaddingOuter(){return this.options.padding}}const Pt=t=>t<0?-Math.sqrt(-t):Math.sqrt(t);class Rt extends A{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,exponent:2,interpolate:Y,tickMethod:N,tickCount:5}}constructor(t){super(t)}chooseTransforms(){var t=this.options["exponent"];if(1===t)return[u,u];var e,n,r=.5===t?Pt:(e=t,t=>t<0?-((-t)**e):t**e);return n=t,[r,t=>t<0?-((-t)**(1/n)):t**(1/n)]}clone(){return new Rt(this.options)}}const qt=(t,e,n=5)=>{if(t===e)return[t];n=n<0?0:Math.round(n);if(0===n)return[];var n=(e-t)/n,r=10**Math.floor(Math.log10(n));let o=r;2*r-n<1.5*(n-o)&&5*r-n<2.75*(n-(o=2*r))&&10*r-n<1.5*(n-(o=5*r))&&(o=10*r);var n=Math.ceil(e/o),r=Math.floor(t/o),n=Math.max(n*o,e),a=Math.min(r*o,t),i=Math.floor((n-a)/o)+1;const s=new Array(i);for(let t=0;t<i;t+=1)s[t]=j(a+t*o);return s};class Et extends Rt{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Y,tickMethod:qt,tickCount:5,exponent:.5}}constructor(t){super(t)}update(t){super.update(t)}clone(){return new Et(this.options)}}class F extends n{constructor(t){super(t)}getDefaultOptions(){return{domain:[.5],range:[0,1]}}map(t){if(!b(t))return this.options.unknown;t=G(this.thresholds,t,0,this.n);return this.options.range[t]}invert(t){const e=this.options["range"];var t=e.indexOf(t),n=this.thresholds;return[n[t-1],n[t]]}clone(){return new F(this.options)}rescale(){var{domain:t,range:e}=this.options;this.n=Math.min(t.length,e.length-1),this.thresholds=t}}const Wt=(t,e,n,r=10)=>{var o=t<0;const a=ft(r,o),i=pt(r,o);var s=e<t,u=s?e:t,l=s?t:e;let h=i(u),d=i(l),c=[];if(!(r%1)&&d-h<n){if(h=Math.floor(h),d=Math.ceil(d),o)for(;h<=d;h+=1){var g=a(h);for(let t=r-1;1<=t;--t){var p=g*t;if(l<p)break;u<=p&&c.push(p)}}else for(;h<=d;h+=1){var f=a(h);for(let t=1;t<r;t+=1){var m=f*t;if(l<m)break;u<=m&&c.push(m)}}2*c.length<n&&(c=N(u,l,n))}else c=N(h,d,Math.min(d-h,n)).map(a);return s?c.reverse():c};class $t extends A{getDefaultOptions(){return{domain:[1,10],range:[0,1],base:10,interpolate:Y,tickMethod:Wt,tickCount:5}}chooseNice(){return mt}getTickMethodOptions(){var{domain:t,tickCount:e,base:n}=this.options;return[t[0],t[t.length-1],e,n]}chooseTransforms(){var{base:t,domain:e}=this.options,e=e[0]<0;return[pt(t,e),ft(t,e)]}clone(){return new $t(this.options)}}class Bt extends F{getDefaultOptions(){return{domain:[0,1],range:[.5],nice:!1,tickCount:5,tickMethod:I}}constructor(t){super(t)}nice(){var t,e,n=this.options["nice"];n&&([n,t,e]=this.getTickMethodOptions(),this.options.domain=rt(n,t,e))}getTicks(){const t=this.options["tickMethod"];var[e,n,r]=this.getTickMethodOptions();return t(e,n,r)}getTickMethodOptions(){var{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}rescale(){this.nice();var{range:t,domain:e}=this.options,[n,r]=e;this.n=t.length-1,this.thresholds=new Array(this.n);for(let t=0;t<this.n;t+=1)this.thresholds[t]=((t+1)*r-(t-this.n)*n)/(this.n+1)}invert(t){var[t,e]=super.invert(t),[n,r]=this.options.domain;return void 0===t&&void 0===e?[t,e]:[t||n,e||r]}getThresholds(){return this.thresholds}clone(){return new Bt(this.options)}}function _t(t,e,n=!1){const r=t,o=(n||r.sort((t,e)=>t-e),[]);for(let t=1;t<e;t+=1)o.push(function(t,e){if(n=t.length){if(n<2)return t[n-1];var n=(n-1)*e,e=Math.floor(n),r=t[e];return r+(t[e+1]-r)*(n-e)}}(r,t/e));return o}class zt extends F{getDefaultOptions(){return{domain:[],range:[],tickCount:5,unknown:void 0,tickMethod:I}}constructor(t){super(t)}rescale(){var{domain:t,range:e}=this.options;this.n=e.length-1,this.thresholds=_t(t,this.n+1,!1)}invert(t){var[t,e]=super.invert(t),n=this.options["domain"],r=n[0],n=n[n.length-1];return void 0===t&&void 0===e?[t,e]:[t||r,e||n]}getThresholds(){return this.thresholds}clone(){return new zt(this.options)}getTicks(){const{tickCount:t,domain:e,tickMethod:n}=this.options;var r=e.length-1,o=e[0],r=e[r];return n(o,r,t)}}var Kt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Lt=/\[([^]*?)\]/gm;function Zt(t,e){for(var n=[],r=0,o=t.length;r<o;r++)n.push(t[r].substr(0,e));return n}function Jt(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,o=e;r<o.length;r++){var a,i=o[r];for(a in i)t[a]=i[a]}return t}function U(t,e){for(void 0===e&&(e=2),t=String(t);t.length<e;)t="0"+t;return t}var v=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],y=["January","February","March","April","May","June","July","August","September","October","November","December"],k=Zt(y,3),Qt=Jt({},{dayNamesShort:Zt(v,3),dayNames:v,monthNamesShort:k,monthNames:y,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][3<t%10?0:(t-t%10!=10?1:0)*t%10]}}),Vt={D:function(t){return String(t.getDate())},DD:function(t){return U(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return U(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return U(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return U(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return U(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return U(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return U(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return U(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return U(t.getSeconds())},S:function(t){return String(Math.round(t.getMilliseconds()/100))},SS:function(t){return U(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return U(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return(t.getHours()<12?e.amPm[0]:e.amPm[1]).toUpperCase()},ZZ:function(t){t=t.getTimezoneOffset();return(0<t?"-":"+")+U(100*Math.floor(Math.abs(t)/60)+Math.abs(t)%60,4)},Z:function(t){t=t.getTimezoneOffset();return(0<t?"-":"+")+U(Math.floor(Math.abs(t)/60),2)+":"+U(Math.abs(t)%60,2)}},Gt={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"};const Xt=(t,e,n,r,o)=>{var a=e<t,i=a?e:t,t=a?t:e;const[s,u]=dt(i,t,n,r,o),l=s.range(i,new Date(+t+1),u,!0);return a?l.reverse():l};function te(t){var e=t.getTimezoneOffset();const n=new Date(t);return n.setMinutes(n.getMinutes()+e,n.getSeconds(),n.getMilliseconds()),n}class ee extends A{getDefaultOptions(){return{domain:[new Date(2e3,0,1),new Date(2e3,0,2)],range:[0,1],nice:!1,tickCount:5,tickInterval:void 0,unknown:void 0,clamp:!1,tickMethod:Xt,interpolate:C,mask:void 0,utc:!1}}chooseTransforms(){return[t=>+t,t=>new Date(t)]}chooseNice(){return ct}getTickMethodOptions(){var{domain:t,tickCount:e,tickInterval:n,utc:r}=this.options;return[t[0],t[t.length-1],e,n,r]}getFormatter(){const{mask:a,utc:t}=this.options,i=t?ht:ut,s=t?te:u;return t=>{var e=s(t),t=a||function(t,e){const{second:n,minute:r,hour:o,day:a,week:i,month:s,year:u}=e;return n.floor(t)<t?".SSS":r.floor(t)<t?":ss":o.floor(t)<t?"hh:mm":a.floor(t)<t?"hh A":s.floor(t)<t?i.floor(t)<t?"MMM DD":"ddd DD":u.floor(t)<t?"MMMM":"YYYY"}(t,i),n=void 0;if(void 0===t&&(t=Gt.default),void 0===n&&(n={}),"number"==typeof e&&(e=new Date(e)),"[object Date]"!==Object.prototype.toString.call(e)||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");var r=[],o=(t=(t=Gt[t]||t).replace(Lt,function(t,e){return r.push(e),"@@@"}),Jt(Jt({},Qt),n));return(t=t.replace(Kt,function(t){return Vt[t](e,o)})).replace(/@@@/g,function(){return r.shift()})}}clone(){return new ee(this.options)}}t.Band=Q,t.Base=n,t.Constant=Ct,t.Continuous=A,t.DURATION_DAY=g,t.DURATION_HOUR=c,t.DURATION_MINUTE=d,t.DURATION_MONTH=e,t.DURATION_SECOND=o,t.DURATION_WEEK=p,t.DURATION_YEAR=ot,t.Identity=It,t.Linear=Ht,t.Log=$t,t.Ordinal=r,t.Point=jt,t.Pow=Rt,t.Quantile=zt,t.Quantize=Bt,t.Sqrt=Et,t.Threshold=F,t.Time=ee,t.createInterpolateColor=xt,t.createInterpolateNumber=C,t.createInterpolateValue=Y,t.d3Log=Wt,t.d3Ticks=N,t.d3Time=Xt,t.rPretty=qt,t.wilkinsonExtended=I,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Scale={})}(this,function(t){"use strict";function H(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)}function P(t){return i(t,"Function")}function R(t){return null==t}var q={}.toString,i=function(t,e){return q.call(t)==="[object "+e+"]"},E=function(t){return Array.isArray?Array.isArray(t):i(t,"Array")};function a(t){return i(t,"Number")}var W=function(t){if("object"!=typeof(e=t)||null===e||!i(t,"Object"))return!1;var e;if(null===Object.getPrototypeOf(t))return!0;for(var n=t;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n},$=(Object.values,5);function B(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)!function t(e,n,r,o){for(var a in r=r||0,o=o||$,n){var i;n.hasOwnProperty(a)&&(null!==(i=n[a])&&W(i)?(W(e[a])||(e[a]={}),r<o?t(e[a],i,r+1,o):e[a]=n[a]):E(i)?(e[a]=[],e[a]=e[a].concat(i)):void 0!==i&&(e[a]=i))}}(t,e[r]);return t}function u(t){return t}var s,_=function(t,e){if(!H(t))return-1;var n=Array.prototype.indexOf;if(n)return n.call(t,e);for(var r=-1,o=0;o<t.length;o++)if(t[o]===e){r=o;break}return r};function z(t){return R(t)?0:(H(t)?t:Object.keys(t)).length}var e=function(t,e){var n=(e=void 0===e?{}:e).fontSize,r=e.fontFamily,o=e.fontWeight,a=e.fontStyle,e=e.fontVariant;return(s=s||document.createElement("canvas").getContext("2d")).font=[a,e,o,n+"px",r].join(" "),s.measureText(i(t,"String")?t:"").width};if(!P(e))throw new TypeError("Expected a function");new Map;class n{constructor(t){this.options=B({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=B({},this.options,t),this.rescale(t)}rescale(t){}}function K(e,n,r){for(let t=0;t<n.length;t+=1)e.has(n[t])||e.set(r(n[t]),t)}function L(t){const{value:e,from:n,to:r,mapper:o,notFoundReturn:a}=t;let i=o.get(e);if(void 0===i){if(a)return a;i=n.push(e)-1,o.set(e,i)}return r[i%r.length]}function Z(t){return t instanceof Date?t=>""+t:"object"==typeof t?t=>JSON.stringify(t):t=>t}class r extends n{constructor(t){super(t)}getDefaultOptions(){return{domain:[],range:[]}}map(t){return 0===this.domainIndexMap.size&&K(this.domainIndexMap,this.getDomain(),this.domainKey),L({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&K(this.rangeIndexMap,this.getRange(),this.rangeKey),L({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){var[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=Z(e),this.rangeKey=Z(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),t&&!t.domain&&!t.compare||(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new r(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;var{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function J(t){const e=t["domain"];var n=e.length;if(0===n)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};const{range:r,paddingOuter:o,paddingInner:a,flex:i=[],round:s,align:u}=t;t=i,h=e.length;var l=0<(l=h-t.length)?[...t,...new Array(l).fill(1)]:l<0?t.slice(0,h):t,[h,t]=r,t=t-h,d=t/(2/n*o+1-1/n*a);const c=d*a/n;d-=n*c;const g=function(t){const e=Math.min(...t);return t.map(t=>t/e)}(l),p=d/g.reduce((t,e)=>t+e);l=new Map(e.map((t,e)=>{e=g[e]*p;return[t,s?Math.floor(e):e]}));const f=new Map(e.map((t,e)=>{e=g[e]*p+c;return[t,s?Math.floor(e):e]}));d=Array.from(f.values()).reduce((t,e)=>t+e),h+=(t-(d-d/n*a))*u;let m=s?Math.round(h):h;const M=new Array(n);for(let t=0;t<n;t+=1){M[t]=(v=m,Math.round(1e12*v)/1e12);var v=e[t];m+=f.get(v)}return{valueBandWidth:l,valueStep:f,adjustedRange:M}}class Q extends r{constructor(t){super(t)}getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:void 0,flex:[]}}clone(){return new Q(this.options)}getStep(t){return void 0===this.valueStep?1:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){var{padding:t,paddingInner:e}=this.options;return 0<t?t:e}getPaddingOuter(){var{padding:t,paddingOuter:e}=this.options;return 0<t?t:e}rescale(){super.rescale();var{align:t,domain:e,range:n,round:r,flex:o}=this.options,{adjustedRange:t,valueBandWidth:n,valueStep:r}=J({align:t,range:n,round:r,flex:o,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=r,this.valueBandWidth=n,this.adjustedRange=t}}function l(t,...e){return e.reduce((e,n)=>t=>e(n(t)),t)}function V(e,n){return n-e?t=>(t-e)/(n-e):t=>.5}function G(t,e,n,r,o){let a=n||0,i=r||t.length;const s=o||(t=>t);for(;a<i;){var u=Math.floor((a+i)/2);s(t[u])>e?i=u:a=u+1}return a}const X=Math.sqrt(50),tt=Math.sqrt(10),et=Math.sqrt(2);function h(t,e,n){e=(e-t)/Math.max(0,n),t=Math.floor(Math.log(e)/Math.LN10),n=e/10**t;return 0<=t?(n>=X?10:n>=tt?5:n>=et?2:1)*10**t:-(10**-t)/(n>=X?10:n>=tt?5:n>=et?2:1)}function nt(t,e,n){n=Math.abs(e-t)/Math.max(0,n);let r=10**Math.floor(Math.log(n)/Math.LN10);n/=r;return n>=X?r*=10:n>=tt?r*=5:n>=et&&(r*=2),e<t?-r:r}const rt=(t,e,n=5)=>{const r=[t,e];let o=0,a=r.length-1,i=r[o],s=r[a],u;return s<i&&([i,s]=[s,i],[o,a]=[a,o]),0<(u=h(i,s,n))?(i=Math.floor(i/u)*u,s=Math.ceil(s/u)*u,u=h(i,s,n)):u<0&&(i=Math.ceil(i*u)/u,s=Math.floor(s*u)/u,u=h(i,s,n)),0<u?(r[o]=Math.floor(i/u)*u,r[a]=Math.ceil(s/u)*u):u<0&&(r[o]=Math.ceil(i*u)/u,r[a]=Math.floor(s*u)/u),r},o=1e3,d=6e4,c=36e5,g=24*c,p=7*g;var e=30*g,ot=365*g;function f(t,n,s,r){const o=(t,e)=>{let n=e;for(;n&&r(t)%e!=0;)s(t,-1),--n;return t},u=(t,e)=>{e&&o(t,e),n(t)};const l=(t,e)=>{t=new Date(+t-1);return u(t,e),s(t,e),u(t),t};return{ceil:l,floor:(t,e)=>{t=new Date(+t);return u(t,e),t},range:(t,e,n,r)=>{const o=[];for(var a=Math.floor(n),i=r?l(t,n):l(t);+i<+e;s(i,a),u(i))o.push(new Date(+i));return o},duration:t}}var m=f(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),M=f(o,t=>{t.setMilliseconds(0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getSeconds()),v=f(d,t=>{t.setSeconds(0,0)},(t,e=1)=>{t.setTime(+t+d*e)},t=>t.getMinutes()),y=f(c,t=>{t.setMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+c*e)},t=>t.getHours()),k=f(g,t=>{t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+g*e)},t=>t.getDate()-1);const at=f(e,t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e=1)=>{var n=t.getMonth();t.setMonth(n+e)},t=>t.getMonth());var it=f(p,t=>{t.setDate(t.getDate()-t.getDay()%7),t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+p*e)},t=>{var e=at.floor(t),t=new Date(+t);return Math.floor((+t-+e)/p)}),st=f(ot,t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e=1)=>{var n=t.getFullYear();t.setFullYear(n+e)},t=>t.getFullYear());const ut={millisecond:m,second:M,minute:v,hour:y,day:k,week:it,month:at,year:st};m=f(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),M=f(o,t=>{t.setUTCMilliseconds(0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getUTCSeconds()),v=f(d,t=>{t.setUTCSeconds(0,0)},(t,e=1)=>{t.setTime(+t+d*e)},t=>t.getUTCMinutes()),y=f(c,t=>{t.setUTCMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+c*e)},t=>t.getUTCHours()),k=f(g,t=>{t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+g*e)},t=>t.getUTCDate()-1);const lt=f(e,t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCMonth();t.setUTCMonth(n+e)},t=>t.getUTCMonth());it=f(p,t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7)%7),t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+p*e)},t=>{var e=lt.floor(t),t=new Date(+t);return Math.floor((+t-+e)/p)}),st=f(ot,t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCFullYear();t.setUTCFullYear(n+e)},t=>t.getUTCFullYear());const ht={millisecond:m,second:M,minute:v,hour:y,day:k,week:it,month:lt,year:st};function dt(t,e,n,r,o){var t=+t,e=+e,{tickIntervals:o,year:a,millisecond:i}=function(t){var{year:t,month:e,week:n,day:r,hour:o,minute:a,second:i,millisecond:s}=t?ht:ut;return{tickIntervals:[[i,1],[i,5],[i,15],[i,30],[a,1],[a,5],[a,15],[a,30],[o,1],[o,3],[o,6],[o,12],[r,1],[r,2],[n,1],[e,1],[e,3],[t,1]],year:t,millisecond:s}}(o),s=([t,e])=>t.duration*e,n=r?(e-t)/r:n||5,u=r||(e-t)/n,l=o.length,h=G(o,u,0,l,s);let d;return d=h===l?[a,nt(t/a.duration,e/a.duration,n)]:h?([l,a]=u/s(o[h-1])<s(o[h])/u?o[h-1]:o[h],[l,r?Math.ceil(r/l.duration):a]):[i,Math.max(nt(t,e,n),1)]}const ct=(t,e,n,r,o)=>{var a=e<t,i=a?e:t,t=a?t:e;const[s,u]=dt(i,t,n,r,o),l=[s.floor(i,u),s.ceil(t,u)];return a?l.reverse():l};function b(t){return null!=t&&!Number.isNaN(t)}const gt=e=>t=>-e(-t),pt=(t,e)=>{const n=Math.log(t);t=t===Math.E?Math.log:t=>Math.log(t)/n;return e?gt(t):t},ft=(e,t)=>{var n=e===Math.E?Math.exp:t=>e**t;return t?gt(n):n},mt=(t,e,n,r)=>{var o=t<0;const a=pt(r,o),i=ft(r,o);r=e<t,o=r?t:e;const s=[i(Math.floor(a(r?e:t))),i(Math.ceil(a(o)))];return r?s.reverse():s};var w,m={exports:{}},M={exports:{}},Mt=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||0<=t.length&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},vt=Array.prototype.concat,yt=Array.prototype.slice,kt=M.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n];Mt(o)?e=vt.call(e,yt.call(o)):e.push(o)}return e},D=(kt.wrap=function(t){return function(){return t(kt(arguments))}},{aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}),T=M.exports,bt=Object.hasOwnProperty,wt={};for(w in D)bt.call(D,w)&&(wt[D[w]]=w);var O=m.exports={to:{},get:{}};function x(t,e,n){return Math.min(Math.max(e,t),n)}function S(t){t=Math.round(t).toString(16).toUpperCase();return t.length<2?"0"+t:t}O.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=O.get.hsl(t),n="hsl";break;case"hwb":e=O.get.hwb(t),n="hwb";break;default:e=O.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},O.get.rgb=function(t){if(!t)return null;var e,n,r,o=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var a=2*n;o[n]=parseInt(e.slice(a,2+a),16)}r&&(o[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)o[n]=parseInt(e[n]+e[n],16);r&&(o[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)o[n]=parseInt(e[n+1],0);e[4]&&(e[5]?o[3]=.01*parseFloat(e[4]):o[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:bt.call(D,e[1])?((o=D[e[1]])[3]=1,o):null:null;for(n=0;n<3;n++)o[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?o[3]=.01*parseFloat(e[4]):o[3]=parseFloat(e[4]))}for(n=0;n<3;n++)o[n]=x(o[n],0,255);return o[3]=x(o[3],0,1),o},O.get.hsl=function(t){if(!t)return null;var e,t=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);return t?(e=parseFloat(t[4]),[(parseFloat(t[1])%360+360)%360,x(parseFloat(t[2]),0,100),x(parseFloat(t[3]),0,100),x(isNaN(e)?1:e,0,1)]):null},O.get.hwb=function(t){if(!t)return null;var e,t=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);return t?(e=parseFloat(t[4]),[(parseFloat(t[1])%360+360)%360,x(parseFloat(t[2]),0,100),x(parseFloat(t[3]),0,100),x(isNaN(e)?1:e,0,1)]):null},O.to.hex=function(){var t=T(arguments);return"#"+S(t[0])+S(t[1])+S(t[2])+(t[3]<1?S(Math.round(255*t[3])):"")},O.to.rgb=function(){var t=T(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},O.to.rgb.percent=function(){var t=T(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},O.to.hsl=function(){var t=T(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},O.to.hwb=function(){var t=T(arguments),e="";return 4<=t.length&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},O.to.keyword=function(t){return wt[t.slice(0,3)]};var Dt=m.exports;function Tt(t,e,n){let r=n;return r<0&&(r+=1),1<r&&--r,r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function Ot(t){t=Dt.get(t);if(!t)return null;var e,n,{model:t,value:r}=t;return"rgb"===t?r:"hsl"===t?(r=(t=r)[0]/360,e=t[1]/100,n=t[2]/100,t=t[3],0==e?[255*n,255*n,255*n,t]:[255*Tt(n=2*n-(e=n<.5?n*(1+e):n+e-n*e),e,r+1/3),255*Tt(n,e,r),255*Tt(n,e,r-1/3),t]):null}const C=(e,n)=>t=>e*(1-t)+n*t,xt=(t,e)=>{const u=Ot(t),l=Ot(e);return null===u||null===l?u?()=>t:()=>e:e=>{const n=new Array(4);for(let t=0;t<4;t+=1){var r=u[t],o=l[t];n[t]=r*(1-e)+o*e}var[t,a,i,s]=n;return`rgba(${Math.round(t)}, ${Math.round(a)}, ${Math.round(i)}, ${s})`}},Y=(t,e)=>"number"==typeof t&&"number"==typeof e?C(t,e):"string"==typeof t&&"string"==typeof e?xt(t,e):()=>t,St=(t,e)=>{const n=C(t,e);return t=>Math.round(n(t))};const N=(t,e,n)=>{let r,o,a=t,i=e;if(a===i&&0<n)return[a];let s=h(a,i,n);if(0===s||!Number.isFinite(s))return[];if(0<s){a=Math.ceil(a/s),i=Math.floor(i/s),o=new Array(r=Math.ceil(i-a+1));for(let t=0;t<r;t+=1)o[t]=(a+t)*s}else{s=-s,a=Math.ceil(a*s),i=Math.floor(i*s),o=new Array(r=Math.ceil(i-a+1));for(let t=0;t<r;t+=1)o[t]=(a+t)/s}return o};class Ct extends n{getDefaultOptions(){return{range:[0],domain:[0,1],unknown:void 0,tickCount:5,tickMethod:N}}map(t){var[e]=this.options.range;return void 0!==e?e:this.options.unknown}invert(t){var[e]=this.options.range;return t===e&&void 0!==e?this.options.domain:[]}getTicks(){const{tickMethod:t,domain:e,tickCount:n}=this.options;var[r,o]=e;return a(r)&&a(o)?t(r,o,n):[]}clone(){return new Ct(this.options)}}function j(t){return Math.abs(t)<1e-15?t:parseFloat(t.toFixed(15))}const Yt=[1,5,2,2.5,4,3],Nt=100*Number.EPSILON;const I=(n,r,t=5,o=!0,a=Yt,i=[.25,.2,.5,.05])=>{var s,u,l,h,d,c,g,p=t<0?0:Math.round(t);if(Number.isNaN(n)||Number.isNaN(r)||"number"!=typeof n||"number"!=typeof r||!p)return[];if(r-n<1e-15||1===p)return[n];const f={score:-2,lmin:0,lmax:0,lstep:0};let m=1;for(;m<1/0;){for(let t=0;t<a.length;t+=1){var M=a[t],v=(h=M,d=a,c=m,g=void 0,g=z(d),1-_(d,h)/(g-1)-c+1);if(i[0]*v+i[1]+i[2]+i[3]<f.score){m=1/0;break}let e=2;for(;e<1/0;){k=e;var y=(l=p)<=k?2-(k-1)/(l-1):1;if(i[0]*v+i[1]+i[2]*y+i[3]<f.score)break;var k=(r-n)/(e+1)/m/M;let t=Math.ceil(Math.log10(k));for(;t<1/0;){var b=m*M*10**t,w=(T=r,w=b*(e-1),(T-=n)<w?1-((w-T)/2)**2/(.1*T)**2:1);if(i[0]*v+i[1]*w+i[2]*y+i[3]<f.score)break;var D=Math.floor(r/b)*m-(e-1)*m,T=Math.ceil(n/b)*m;if(D<=T){var O=T-D;for(let t=0;t<=O;t+=1){var x=(D+t)*(b/m),S=x+b*(e-1),C=b,Y=function(t,e,n,r,o,a){var i=z(e),e=_(e,t);let s=0;return t=(r%a+a)%a,1-e/(i-1)-n+(s=(t<Nt||a-t<Nt)&&r<=0&&0<=o?1:s)}(M,a,m,x,S,C),N=1-.5*((r-S)**2+(n-x)**2)/(.1*(r-n))**2,I=(s=e,I=n,s=(s-1)/(S-(A=x)),u=((u=p)-1)/(Math.max(S,r)-Math.min(I,A)),2-Math.max(s/u,u/s)),A=i[0]*Y+i[1]*N+i[2]*I+ +i[3];A>f.score&&(!o||x<=n&&r<=S)&&(f.lmin=x,f.lmax=S,f.lstep=C,f.score=A)}}t+=1}e+=1}}m+=1}var t=j(f.lmax),e=j(f.lmin),F=j(f.lstep),U=Math.floor((t=(t-e)/F,Math.round(1e12*t)/1e12))+1;const H=new Array(U);H[0]=j(e);for(let t=1;t<U;t+=1)H[t]=j(H[t-1]+F);return H};class It extends n{getDefaultOptions(){return{domain:[0,1],range:[0,1],tickCount:5,unknown:void 0,tickMethod:I}}map(t){return b(t)?t:this.options.unknown}invert(t){return this.map(t)}clone(){return new It(this.options)}getTicks(){const{domain:t,tickCount:e,tickMethod:n}=this.options;var[r,o]=t;return a(r)&&a(o)?n(r,o,e):[]}}const At=(t,e,n)=>{var[t,r]=t,[e,o]=e;let a,i;return l(i=t<r?(a=V(t,r),n(e,o)):(a=V(r,t),n(o,e)),a)},Ft=(r,t,e)=>{const o=Math.min(r.length,t.length)-1,a=new Array(o),i=new Array(o);var n=r[0]>r[o],s=n?[...r].reverse():r,u=n?[...t].reverse():t;for(let t=0;t<o;t+=1)a[t]=V(s[t],s[t+1]),i[t]=e(u[t],u[t+1]);return t=>{var e=G(r,t,1,o)-1,n=a[e];return l(i[e],n)(t)}},Ut=(t,e,n,r)=>{const o=2<Math.min(t.length,e.length)?Ft:At;r=r?St:n;return o(t,e,r)};class A extends n{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:C,tickCount:5}}map(t){return b(t)?this.output(t):this.options.unknown}invert(t){return b(t)?this.input(t):this.options.unknown}nice(){var t,e,n,r;this.options.nice&&([t,e,n,...r]=this.getTickMethodOptions(),this.options.domain=this.chooseNice()(t,e,n,...r))}getTicks(){const t=this.options["tickMethod"];var[e,n,r,...o]=this.getTickMethodOptions();return t(e,n,r,...o)}getTickMethodOptions(){var{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return rt}rescale(){this.nice();var[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){var{clamp:e,range:n}=this.options,t=this.options.domain.map(t),n=Math.min(t.length,n.length);if(e){e=t[0],t=t[n-1];const r=t<e?t:e,o=t<e?e:t;return t=>Math.min(Math.max(r,t),o)}return u}composeOutput(t,e){const{domain:n,range:r,round:o,interpolate:a}=this.options;var i=Ut(n.map(t),r,a,o);this.output=l(i,e,t)}composeInput(t,e,n){const{domain:r,range:o}=this.options;t=Ut(o,r.map(t),C);this.input=l(e,n,t)}}class Ht extends A{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:Y,tickMethod:N,tickCount:5}}chooseTransforms(){return[u,u]}clone(){return new Ht(this.options)}}class jt extends Q{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,padding:0,unknown:void 0,paddingInner:1,paddingOuter:0}}constructor(t){super(t)}getPaddingInner(){return this.options.paddingInner}clone(){return new jt(this.options)}update(t){super.update(t)}getPaddingOuter(){return this.options.padding}}const Pt=t=>t<0?-Math.sqrt(-t):Math.sqrt(t);class Rt extends A{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,exponent:2,interpolate:Y,tickMethod:N,tickCount:5}}constructor(t){super(t)}chooseTransforms(){var t=this.options["exponent"];if(1===t)return[u,u];var e,n,r=.5===t?Pt:(e=t,t=>t<0?-((-t)**e):t**e);return n=t,[r,t=>t<0?-((-t)**(1/n)):t**(1/n)]}clone(){return new Rt(this.options)}}const qt=(t,e,n=5)=>{if(t===e)return[t];n=n<0?0:Math.round(n);if(0===n)return[];var n=(e-t)/n,r=10**Math.floor(Math.log10(n));let o=r;2*r-n<1.5*(n-o)&&5*r-n<2.75*(n-(o=2*r))&&10*r-n<1.5*(n-(o=5*r))&&(o=10*r);var n=Math.ceil(e/o),r=Math.floor(t/o),n=Math.max(n*o,e),a=Math.min(r*o,t),i=Math.floor((n-a)/o)+1;const s=new Array(i);for(let t=0;t<i;t+=1)s[t]=j(a+t*o);return s};class Et extends Rt{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Y,tickMethod:qt,tickCount:5,exponent:.5}}constructor(t){super(t)}update(t){super.update(t)}clone(){return new Et(this.options)}}class F extends n{constructor(t){super(t)}getDefaultOptions(){return{domain:[.5],range:[0,1]}}map(t){if(!b(t))return this.options.unknown;t=G(this.thresholds,t,0,this.n);return this.options.range[t]}invert(t){const e=this.options["range"];var t=e.indexOf(t),n=this.thresholds;return[n[t-1],n[t]]}clone(){return new F(this.options)}rescale(){var{domain:t,range:e}=this.options;this.n=Math.min(t.length,e.length-1),this.thresholds=t}}const Wt=(t,e,n,r=10)=>{var o=t<0;const a=ft(r,o),i=pt(r,o);var s=e<t,u=s?e:t,l=s?t:e;let h=i(u),d=i(l),c=[];if(!(r%1)&&d-h<n){if(h=Math.floor(h),d=Math.ceil(d),o)for(;h<=d;h+=1){var g=a(h);for(let t=r-1;1<=t;--t){var p=g*t;if(l<p)break;u<=p&&c.push(p)}}else for(;h<=d;h+=1){var f=a(h);for(let t=1;t<r;t+=1){var m=f*t;if(l<m)break;u<=m&&c.push(m)}}2*c.length<n&&(c=N(u,l,n))}else c=N(h,d,Math.min(d-h,n)).map(a);return s?c.reverse():c};class $t extends A{getDefaultOptions(){return{domain:[1,10],range:[0,1],base:10,interpolate:Y,tickMethod:Wt,tickCount:5}}chooseNice(){return mt}getTickMethodOptions(){var{domain:t,tickCount:e,base:n}=this.options;return[t[0],t[t.length-1],e,n]}chooseTransforms(){var{base:t,domain:e}=this.options,e=e[0]<0;return[pt(t,e),ft(t,e)]}clone(){return new $t(this.options)}}class Bt extends F{getDefaultOptions(){return{domain:[0,1],range:[.5],nice:!1,tickCount:5,tickMethod:I}}constructor(t){super(t)}nice(){var t,e,n=this.options["nice"];n&&([n,t,e]=this.getTickMethodOptions(),this.options.domain=rt(n,t,e))}getTicks(){const t=this.options["tickMethod"];var[e,n,r]=this.getTickMethodOptions();return t(e,n,r)}getTickMethodOptions(){var{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}rescale(){this.nice();var{range:t,domain:e}=this.options,[n,r]=e;this.n=t.length-1,this.thresholds=new Array(this.n);for(let t=0;t<this.n;t+=1)this.thresholds[t]=((t+1)*r-(t-this.n)*n)/(this.n+1)}invert(t){var[t,e]=super.invert(t),[n,r]=this.options.domain;return void 0===t&&void 0===e?[t,e]:[t||n,e||r]}getThresholds(){return this.thresholds}clone(){return new Bt(this.options)}}function _t(t,e,n=!1){const r=t,o=(n||r.sort((t,e)=>t-e),[]);for(let t=1;t<e;t+=1)o.push(function(t,e){if(n=t.length){if(n<2)return t[n-1];var n=(n-1)*e,e=Math.floor(n),r=t[e];return r+(t[e+1]-r)*(n-e)}}(r,t/e));return o}class zt extends F{getDefaultOptions(){return{domain:[],range:[],tickCount:5,unknown:void 0,tickMethod:I}}constructor(t){super(t)}rescale(){var{domain:t,range:e}=this.options;this.n=e.length-1,this.thresholds=_t(t,this.n+1,!1)}invert(t){var[t,e]=super.invert(t),n=this.options["domain"],r=n[0],n=n[n.length-1];return void 0===t&&void 0===e?[t,e]:[t||r,e||n]}getThresholds(){return this.thresholds}clone(){return new zt(this.options)}getTicks(){const{tickCount:t,domain:e,tickMethod:n}=this.options;var r=e.length-1,o=e[0],r=e[r];return n(o,r,t)}}var Kt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Lt=/\[([^]*?)\]/gm;function Zt(t,e){for(var n=[],r=0,o=t.length;r<o;r++)n.push(t[r].substr(0,e));return n}function Jt(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0,o=e;r<o.length;r++){var a,i=o[r];for(a in i)t[a]=i[a]}return t}function U(t,e){for(void 0===e&&(e=2),t=String(t);t.length<e;)t="0"+t;return t}var v=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],y=["January","February","March","April","May","June","July","August","September","October","November","December"],k=Zt(y,3),Qt=Jt({},{dayNamesShort:Zt(v,3),dayNames:v,monthNamesShort:k,monthNames:y,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][3<t%10?0:(t-t%10!=10?1:0)*t%10]}}),Vt={D:function(t){return String(t.getDate())},DD:function(t){return U(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return U(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return U(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return U(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return U(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return U(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return U(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return U(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return U(t.getSeconds())},S:function(t){return String(Math.round(t.getMilliseconds()/100))},SS:function(t){return U(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return U(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return(t.getHours()<12?e.amPm[0]:e.amPm[1]).toUpperCase()},ZZ:function(t){t=t.getTimezoneOffset();return(0<t?"-":"+")+U(100*Math.floor(Math.abs(t)/60)+Math.abs(t)%60,4)},Z:function(t){t=t.getTimezoneOffset();return(0<t?"-":"+")+U(Math.floor(Math.abs(t)/60),2)+":"+U(Math.abs(t)%60,2)}},Gt={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"};const Xt=(t,e,n,r,o)=>{var a=e<t,i=a?e:t,t=a?t:e;const[s,u]=dt(i,t,n,r,o),l=s.range(i,new Date(+t+1),u,!0);return a?l.reverse():l};function te(t){var e=t.getTimezoneOffset();const n=new Date(t);return n.setMinutes(n.getMinutes()+e,n.getSeconds(),n.getMilliseconds()),n}class ee extends A{getDefaultOptions(){return{domain:[new Date(2e3,0,1),new Date(2e3,0,2)],range:[0,1],nice:!1,tickCount:5,tickInterval:void 0,unknown:void 0,clamp:!1,tickMethod:Xt,interpolate:C,mask:void 0,utc:!1}}chooseTransforms(){return[t=>+t,t=>new Date(t)]}chooseNice(){return ct}getTickMethodOptions(){var{domain:t,tickCount:e,tickInterval:n,utc:r}=this.options;return[t[0],t[t.length-1],e,n,r]}getFormatter(){const{mask:a,utc:t}=this.options,i=t?ht:ut,s=t?te:u;return t=>{var e=s(t),t=a||function(t,e){const{second:n,minute:r,hour:o,day:a,week:i,month:s,year:u}=e;return n.floor(t)<t?".SSS":r.floor(t)<t?":ss":o.floor(t)<t?"hh:mm":a.floor(t)<t?"hh A":s.floor(t)<t?i.floor(t)<t?"MMM DD":"ddd DD":u.floor(t)<t?"MMMM":"YYYY"}(t,i),n=void 0;if(void 0===t&&(t=Gt.default),void 0===n&&(n={}),"number"==typeof e&&(e=new Date(e)),"[object Date]"!==Object.prototype.toString.call(e)||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");var r=[],o=(t=(t=Gt[t]||t).replace(Lt,function(t,e){return r.push(e),"@@@"}),Jt(Jt({},Qt),n));return(t=t.replace(Kt,function(t){return Vt[t](e,o)})).replace(/@@@/g,function(){return r.shift()})}}clone(){return new ee(this.options)}}t.Band=Q,t.Base=n,t.Constant=Ct,t.Continuous=A,t.DURATION_DAY=g,t.DURATION_HOUR=c,t.DURATION_MINUTE=d,t.DURATION_MONTH=e,t.DURATION_SECOND=o,t.DURATION_WEEK=p,t.DURATION_YEAR=ot,t.Identity=It,t.Linear=Ht,t.Log=$t,t.Ordinal=r,t.Point=jt,t.Pow=Rt,t.Quantile=zt,t.Quantize=Bt,t.Sqrt=Et,t.Threshold=F,t.Time=ee,t.createInterpolateColor=xt,t.createInterpolateNumber=C,t.createInterpolateValue=Y,t.d3Log=Wt,t.d3Ticks=N,t.d3Time=Xt,t.rPretty=qt,t.wilkinsonExtended=I,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -51,7 +51,7 @@ import { Ordinal } from './ordinal'; | ||
const valueBandWidth = new Map(domain.map((d, i) => { | ||
const bandWidth = flex[i] * minBandWidth; | ||
const bandWidth = normalizedFlex[i] * minBandWidth; | ||
return [d, round ? Math.floor(bandWidth) : bandWidth]; | ||
})); | ||
const valueStep = new Map(domain.map((d, i) => { | ||
const bandWidth = flex[i] * minBandWidth; | ||
const bandWidth = normalizedFlex[i] * minBandWidth; | ||
const step = bandWidth + PI; | ||
@@ -58,0 +58,0 @@ return [d, round ? Math.floor(step) : step]; |
@@ -54,7 +54,7 @@ "use strict"; | ||
const valueBandWidth = new Map(domain.map((d, i) => { | ||
const bandWidth = flex[i] * minBandWidth; | ||
const bandWidth = normalizedFlex[i] * minBandWidth; | ||
return [d, round ? Math.floor(bandWidth) : bandWidth]; | ||
})); | ||
const valueStep = new Map(domain.map((d, i) => { | ||
const bandWidth = flex[i] * minBandWidth; | ||
const bandWidth = normalizedFlex[i] * minBandWidth; | ||
const step = bandWidth + PI; | ||
@@ -61,0 +61,0 @@ return [d, round ? Math.floor(step) : step]; |
{ | ||
"name": "@antv/scale", | ||
"version": "0.4.7", | ||
"version": "0.4.8", | ||
"description": "Toolkit for mapping abstract data into visual representation.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -79,3 +79,3 @@ import { BandOptions, Domain } from '../types'; | ||
domain.map((d, i) => { | ||
const bandWidth = flex[i] * minBandWidth; | ||
const bandWidth = normalizedFlex[i] * minBandWidth; | ||
return [d, round ? Math.floor(bandWidth) : bandWidth]; | ||
@@ -86,3 +86,3 @@ }) | ||
domain.map((d, i) => { | ||
const bandWidth = flex[i] * minBandWidth; | ||
const bandWidth = normalizedFlex[i] * minBandWidth; | ||
const step = bandWidth + PI; | ||
@@ -89,0 +89,0 @@ return [d, round ? Math.floor(step) : step]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
452555