@antv/scale
Advanced tools
Comparing version 0.4.11 to 0.4.12
@@ -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 l(t,...e){return e.reduce((e,n)=>t=>e(n(t)),t)}function h(e,n){return n-e?t=>(t-e)/(n-e):t=>.5}function H(t,e,n,r,o){let i=n||0,a=r||t.length;const s=o||(t=>t);for(;i<a;){var u=Math.floor((i+a)/2);s(t[u])>e?a=u:i=u+1}return i}const R=Math.sqrt(50),P=Math.sqrt(10),K=Math.sqrt(2);function d(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>=R?10:n>=P?5:n>=K?2:1)*10**t:-(10**-t)/(n>=R?10:n>=P?5:n>=K?2:1)}function q(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>=R?r*=10:n>=P?r*=5:n>=K&&(r*=2),e<t?-r:r}const E=(t,e,n=5)=>{const r=[t,e];let o=0,i=r.length-1,a=r[o],s=r[i],u;return s<a&&([a,s]=[s,a],[o,i]=[i,o]),0<(u=d(a,s,n))?(a=Math.floor(a/u)*u,s=Math.ceil(s/u)*u,u=d(a,s,n)):u<0&&(a=Math.ceil(a*u)/u,s=Math.floor(s*u)/u,u=d(a,s,n)),0<u?(r[o]=Math.floor(a/u)*u,r[i]=Math.ceil(s/u)*u):u<0&&(r[o]=Math.ceil(a*u)/u,r[i]=Math.floor(s*u)/u),r},n=1e3,r=6e4,o=36e5,i=24*o,a=7*i;var W=30*i,B=365*i;function e(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 i=Math.floor(n),a=r?l(t,n):l(t);+a<+e;s(a,i),u(a))o.push(new Date(+a));return o},duration:t}}var s=e(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),u=e(n,t=>{t.setMilliseconds(0)},(t,e=1)=>{t.setTime(+t+n*e)},t=>t.getSeconds()),c=e(r,t=>{t.setSeconds(0,0)},(t,e=1)=>{t.setTime(+t+r*e)},t=>t.getMinutes()),g=e(o,t=>{t.setMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getHours()),p=e(i,t=>{t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+i*e)},t=>t.getDate()-1);const $=e(W,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 f=e(a,t=>{t.setDate(t.getDate()-t.getDay()%7),t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+a*e)},t=>{var e=$.floor(t),t=new Date(+t);return Math.floor((+t-+e)/a)}),_=e(B,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 z={millisecond:s,second:u,minute:c,hour:g,day:p,week:f,month:$,year:_};s=e(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),u=e(n,t=>{t.setUTCMilliseconds(0)},(t,e=1)=>{t.setTime(+t+n*e)},t=>t.getUTCSeconds()),c=e(r,t=>{t.setUTCSeconds(0,0)},(t,e=1)=>{t.setTime(+t+r*e)},t=>t.getUTCMinutes()),g=e(o,t=>{t.setUTCMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getUTCHours()),p=e(i,t=>{t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+i*e)},t=>t.getUTCDate()-1);const L=e(W,t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCMonth();t.setUTCMonth(n+e)},t=>t.getUTCMonth());f=e(a,t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7)%7),t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+a*e)},t=>{var e=L.floor(t),t=new Date(+t);return Math.floor((+t-+e)/a)}),_=e(B,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 Z={millisecond:s,second:u,minute:c,hour:g,day:p,week:f,month:L,year:_};function J(t,e,n,r,o){var t=+t,e=+e,{tickIntervals:o,year:i,millisecond:a}=function(t){var{year:t,month:e,week:n,day:r,hour:o,minute:i,second:a,millisecond:s}=t?Z:z;return{tickIntervals:[[a,1],[a,5],[a,15],[a,30],[i,1],[i,5],[i,15],[i,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=H(o,u,0,l,s);let d;return d=h===l?[i,q(t/i.duration,e/i.duration,n)]:h?([l,i]=u/s(o[h-1])<s(o[h])/u?o[h-1]:o[h],[l,r?Math.ceil(r/l.duration):i]):[a,Math.max(q(t,e,n),1)]}const Q=(t,e,n,r,o)=>{var i=e<t,a=i?e:t,t=i?t:e;const[s,u]=J(a,t,n,r,o),l=[s.floor(a,u),s.ceil(t,u)];return i?l.reverse():l};function V(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)}function G(t){return m(t,"Function")}function X(t){return null==t}var tt={}.toString,m=function(t,e){return tt.call(t)==="[object "+e+"]"},et=function(t){return Array.isArray?Array.isArray(t):m(t,"Array")};var nt=function(t){if("object"!=typeof(e=t)||null===e||!m(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},v=function(t){return m(t,"Number")},rt=(Object.values,5);function ot(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 i in r=r||0,o=o||rt,n){var a;n.hasOwnProperty(i)&&(null!==(a=n[i])&&nt(a)?(nt(e[i])||(e[i]={}),r<o?t(e[i],a,r+1,o):e[i]=n[i]):et(a)?(e[i]=[],e[i]=e[i].concat(a)):void 0!==a&&(e[i]=a))}}(t,e[r]);return t}function M(t){return t}var it,at=function(t,e){if(!V(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 st(t){return X(t)?0:(V(t)?t:Object.keys(t)).length}function ut(t,e,n,r){var o,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(o=t[s])&&(a=(i<3?o(a):3<i?o(e,n,a):o(e,n))||a);return 3<i&&a&&Object.defineProperty(e,n,a),a}s=function(t,e){var n=(e=void 0===e?{}:e).fontSize,r=e.fontFamily,o=e.fontWeight,i=e.fontStyle,e=e.fontVariant;return(it=it||document.createElement("canvas").getContext("2d")).font=[i,e,o,n+"px",r].join(" "),it.measureText(m(t,"String")?t:"").width};if(!G(s))throw new TypeError("Expected a function");function y(t){return null!=t&&!Number.isNaN(t)}new Map;const lt=e=>t=>-e(-t),ht=(t,e)=>{const n=Math.log(t);t=t===Math.E?Math.log:t=>Math.log(t)/n;return e?lt(t):t},dt=(e,t)=>{var n=e===Math.E?Math.exp:t=>e**t;return t?lt(n):n},ct=(t,e,n,r)=>{var o=t<0;const i=ht(r,o),a=dt(r,o);r=e<t,o=r?t:e;const s=[a(Math.floor(i(r?e:t))),a(Math.ceil(i(o)))];return r?s.reverse():s};function gt(e,u){return t=>{t.prototype.rescale=function(){this.initRange(),this.nice();var[t]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t))},t.prototype.initRange=function(){var t=this.options["interpolator"];this.options.range=e(t)},t.prototype.composeOutput=function(t,e){const{domain:n,interpolator:r,round:o}=this.getOptions();var i,a=u(n.map(t)),s=o?(i=r,t=>{t=i(t);return v(t)?Math.round(t):t}):r;this.output=l(s,a,e,t)},t.prototype.invert=void 0}}var k,u={exports:{}},c={exports:{}},pt=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))},ft=Array.prototype.concat,mt=Array.prototype.slice,vt=c.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n];pt(o)?e=ft.call(e,mt.call(o)):e.push(o)}return e},b=(vt.wrap=function(t){return function(){return t(vt(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]}),w=c.exports,Mt=Object.hasOwnProperty,yt={};for(k in b)Mt.call(b,k)&&(yt[b[k]]=k);var D=u.exports={to:{},get:{}};function T(t,e,n){return Math.min(Math.max(e,t),n)}function O(t){t=Math.round(t).toString(16).toUpperCase();return t.length<2?"0"+t:t}D.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=D.get.hsl(t),n="hsl";break;case"hwb":e=D.get.hwb(t),n="hwb";break;default:e=D.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},D.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 i=2*n;o[n]=parseInt(e.slice(i,2+i),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]:Mt.call(b,e[1])?((o=b[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]=T(o[n],0,255);return o[3]=T(o[3],0,1),o},D.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,T(parseFloat(t[2]),0,100),T(parseFloat(t[3]),0,100),T(isNaN(e)?1:e,0,1)]):null},D.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,T(parseFloat(t[2]),0,100),T(parseFloat(t[3]),0,100),T(isNaN(e)?1:e,0,1)]):null},D.to.hex=function(){var t=w(arguments);return"#"+O(t[0])+O(t[1])+O(t[2])+(t[3]<1?O(Math.round(255*t[3])):"")},D.to.rgb=function(){var t=w(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]+")"},D.to.rgb.percent=function(){var t=w(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]+")"},D.to.hsl=function(){var t=w(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},D.to.hwb=function(){var t=w(arguments),e="";return 4<=t.length&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},D.to.keyword=function(t){return yt[t.slice(0,3)]};var kt=u.exports;function bt(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 wt(t){t=kt.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*bt(n=2*n-(e=n<.5?n*(1+e):n+e-n*e),e,r+1/3),255*bt(n,e,r),255*bt(n,e,r-1/3),t]):null}const x=(e,n)=>t=>e*(1-t)+n*t,Dt=(t,e)=>{const u=wt(t),l=wt(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,i,a,s]=n;return`rgba(${Math.round(t)}, ${Math.round(i)}, ${Math.round(a)}, ${s})`}},S=(t,e)=>"number"==typeof t&&"number"==typeof e?x(t,e):"string"==typeof t&&"string"==typeof e?Dt(t,e):()=>t,Tt=(t,e)=>{const n=x(t,e);return t=>Math.round(n(t))};function Ot({map:t,initKey:e},n){e=e(n);return t.has(e)?t.get(e):n}function xt(t){return"object"==typeof t?t.valueOf():t}class St extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=xt,null!==t)for(var[e,n]of t)this.set(e,n)}get(t){return super.get(Ot({map:this.map,initKey:this.initKey},t))}has(t){return super.has(Ot({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(([{map:t,initKey:n},r]=[{map:this.map,initKey:this.initKey},t],n=n(r),t.has(n)?t.get(n):(t.set(n,r),r)),e);var n,r}delete(t){return super.delete(([{map:t,initKey:e},n]=[{map:this.map,initKey:this.initKey},t],e=e(n),t.has(e)&&(n=t.get(e),t.delete(e)),n));var e,n}}class C{constructor(t){this.options=ot({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=ot({},this.options,t),this.rescale(t)}rescale(t){}}const Y=Symbol("defaultUnknown");function Ct(e,n,r){for(let t=0;t<n.length;t+=1)e.has(n[t])||e.set(r(n[t]),t)}function Yt(t){const{value:e,from:n,to:r,mapper:o,notFoundReturn:i}=t;let a=o.get(e);if(void 0===a){if(i!==Y)return i;a=n.push(e)-1,o.set(e,a)}return r[a%r.length]}function Nt(t){return t instanceof Date?t=>""+t:"object"==typeof t?t=>JSON.stringify(t):t=>t}class It extends C{constructor(t){super(t)}getDefaultOptions(){return{domain:[],range:[],unknown:Y}}map(t){return 0===this.domainIndexMap.size&&Ct(this.domainIndexMap,this.getDomain(),this.domainKey),Yt({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&Ct(this.rangeIndexMap,this.getRange(),this.rangeKey),Yt({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=Nt(e),this.rangeKey=Nt(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 It(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 At(t){const{domain:e,range:n,paddingOuter:r,paddingInner:o,flex:i,round:a,align:s}=t;var u=e.length,l=0<(l=(t=u)-(h=i).length)?[...h,...new Array(l).fill(1)]:l<0?h.slice(0,t):h,[t,h]=n,h=h-t,d=h/(2/u*r+1-1/u*o);const c=d*o/u;d-=u*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 St(e.map((t,e)=>{e=g[e]*p;return[t,a?Math.floor(e):e]}));const f=new St(e.map((t,e)=>{e=g[e]*p+c;return[t,a?Math.floor(e):e]}));d=Array.from(f.values()).reduce((t,e)=>t+e),t+=(h-(d-d/u*o))*s;let m=a?Math.round(t):t;const v=new Array(u);for(let t=0;t<u;t+=1){v[t]=(M=m,Math.round(1e12*M)/1e12);var M=e[t];m+=f.get(M)}return{valueBandWidth:l,valueStep:f,adjustedRange:v}}class Ft extends It{constructor(t){super(t)}getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:Y,flex:[]}}clone(){return new Ft(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth: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}=function(t){var e=t["domain"];if(0===(e=e.length))return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(!(null==(n=t.flex)||!n.length))return At(t);var{range:n,paddingOuter:t,paddingInner:r,round:o,align:i}=t;let a,s,u=n[0];return n=n[1]-u,a=n/Math.max(1,2*t+(e-r)),o&&(a=Math.floor(a)),u+=(n-a*(e-r))*i,s=a*(1-r),o&&(u=Math.round(u),s=Math.round(s)),t=new Array(e).fill(0).map((t,e)=>u+e*a),{valueStep:a,valueBandWidth:s,adjustedRange:t}}({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}}const N=(t,e,n)=>{let r,o,i=t,a=e;if(i===a&&0<n)return[i];let s=d(i,a,n);if(0===s||!Number.isFinite(s))return[];if(0<s){i=Math.ceil(i/s),a=Math.floor(a/s),o=new Array(r=Math.ceil(a-i+1));for(let t=0;t<r;t+=1)o[t]=(i+t)*s}else{s=-s,i=Math.ceil(i*s),a=Math.floor(a*s),o=new Array(r=Math.ceil(a-i+1));for(let t=0;t<r;t+=1)o[t]=(i+t)/s}return o};class Ut extends C{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 v(r)&&v(o)?t(r,o,n):[]}clone(){return new Ut(this.options)}}function j(t){return Math.abs(t)<1e-15?t:parseFloat(t.toFixed(15))}const Ht=[1,5,2,2.5,4,3],jt=100*Number.EPSILON;const I=(n,r,t=5,o=!0,i=Ht,a=[.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<i.length;t+=1){var v=i[t],M=(h=v,d=i,c=m,g=void 0,g=st(d),1-at(d,h)/(g-1)-c+1);if(a[0]*M+a[1]+a[2]+a[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(a[0]*M+a[1]+a[2]*y+a[3]<f.score)break;var k=(r-n)/(e+1)/m/v;let t=Math.ceil(Math.log10(k));for(;t<1/0;){var b=m*v*10**t,w=(T=r,w=b*(e-1),(T-=n)<w?1-((w-T)/2)**2/(.1*T)**2:1);if(a[0]*M+a[1]*w+a[2]*y+a[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,i){var a=st(e),e=at(e,t);let s=0;return t=(r%i+i)%i,1-e/(a-1)-n+(s=(t<jt||i-t<jt)&&r<=0&&0<=o?1:s)}(v,i,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=a[0]*Y+a[1]*N+a[2]*I+ +a[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 Rt extends C{getDefaultOptions(){return{domain:[0,1],range:[0,1],tickCount:5,unknown:void 0,tickMethod:I}}map(t){return y(t)?t:this.options.unknown}invert(t){return this.map(t)}clone(){return new Rt(this.options)}getTicks(){const{domain:t,tickCount:e,tickMethod:n}=this.options;var[r,o]=t;return v(r)&&v(o)?n(r,o,e):[]}}const Pt=(t,e,n)=>{var[t,r]=t,[e,o]=e;let i,a;return l(a=t<r?(i=h(t,r),n(e,o)):(i=h(r,t),n(o,e)),i)},Kt=(r,t,e)=>{const o=Math.min(r.length,t.length)-1,i=new Array(o),a=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)i[t]=h(s[t],s[t+1]),a[t]=e(u[t],u[t+1]);return t=>{var e=H(r,t,1,o)-1,n=i[e];return l(a[e],n)(t)}},qt=(t,e,n,r)=>{const o=2<Math.min(t.length,e.length)?Kt:Pt;r=r?Tt:n;return o(t,e,r)};class A extends C{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:x,tickCount:5}}map(t){return y(t)?this.output(t):this.options.unknown}invert(t){return y(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 E}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 M}composeOutput(t,e){const{domain:n,range:r,round:o,interpolate:i}=this.options;var a=qt(n.map(t),r,i,o);this.output=l(a,e,t)}composeInput(t,e,n){const{domain:r,range:o}=this.options;t=qt(o,r.map(t),x);this.input=l(e,n,t)}}class F extends A{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:S,tickMethod:N,tickCount:5}}chooseTransforms(){return[M,M]}clone(){return new F(this.options)}}class Et extends Ft{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,padding:0,unknown:Y,paddingInner:1,paddingOuter:0}}constructor(t){super(t)}getPaddingInner(){return 1}clone(){return new Et(this.options)}update(t){super.update(t)}getPaddingOuter(){return this.options.padding}}const Wt=t=>t<0?-Math.sqrt(-t):Math.sqrt(t);class Bt extends A{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,exponent:2,interpolate:S,tickMethod:N,tickCount:5}}constructor(t){super(t)}chooseTransforms(){var t=this.options["exponent"];if(1===t)return[M,M];var e,n,r=.5===t?Wt:(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 Bt(this.options)}}class $t extends Bt{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:S,tickMethod:N,tickCount:5,exponent:.5}}constructor(t){super(t)}update(t){super.update(t)}clone(){return new $t(this.options)}}class _t extends C{constructor(t){super(t)}getDefaultOptions(){return{domain:[.5],range:[0,1]}}map(t){if(!y(t))return this.options.unknown;t=H(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 _t(this.options)}rescale(){var{domain:t,range:e}=this.options;this.n=Math.min(t.length,e.length-1),this.thresholds=t}}const zt=(t,e,n,r=10)=>{var o=t<0;const i=dt(r,o),a=ht(r,o);var s=e<t,u=s?e:t,l=s?t:e;let h=a(u),d=a(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=i(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=i(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(i);return s?c.reverse():c};class Lt extends A{getDefaultOptions(){return{domain:[1,10],range:[0,1],base:10,interpolate:S,tickMethod:zt,tickCount:5}}chooseNice(){return ct}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[ht(t,e),dt(t,e)]}clone(){return new Lt(this.options)}}class Zt extends _t{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=E(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 Zt(this.options)}}function Jt(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 Qt extends _t{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=Jt(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 Qt(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 Vt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Gt=/\[([^]*?)\]/gm;function Xt(t,e){for(var n=[],r=0,o=t.length;r<o;r++)n.push(t[r].substr(0,e));return n}function te(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 i,a=o[r];for(i in a)t[i]=a[i]}return t}function U(t,e){for(void 0===e&&(e=2),t=String(t);t.length<e;)t="0"+t;return t}var ee,g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],p=["January","February","March","April","May","June","July","August","September","October","November","December"],f=Xt(p,3),ne=te({},{dayNamesShort:Xt(g,3),dayNames:g,monthNamesShort:f,monthNames:p,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][3<t%10?0:(t-t%10!=10?1:0)*t%10]}}),re={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)}},oe={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 ie=(t,e,n,r,o)=>{var i=e<t,a=i?e:t,t=i?t:e;const[s,u]=J(a,t,n,r,o),l=s.range(a,new Date(+t+1),u,!0);return i?l.reverse():l};function ae(t){var e=t.getTimezoneOffset();const n=new Date(t);return n.setMinutes(n.getMinutes()+e,n.getSeconds(),n.getMilliseconds()),n}class se 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:ie,interpolate:x,mask:void 0,utc:!1}}chooseTransforms(){return[t=>+t,t=>new Date(t)]}chooseNice(){return Q}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:i,utc:t}=this.options,a=t?Z:z,s=t?ae:M;return t=>{var e=s(t),t=i||function(t,e){const{second:n,minute:r,hour:o,day:i,week:a,month:s,year:u}=e;return n.floor(t)<t?".SSS":r.floor(t)<t?":ss":o.floor(t)<t?"hh:mm":i.floor(t)<t?"hh A":s.floor(t)<t?a.floor(t)<t?"MMM DD":"ddd DD":u.floor(t)<t?"MMMM":"YYYY"}(t,a),n=void 0;if(void 0===t&&(t=oe.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=oe[t]||t).replace(Gt,function(t,e){return r.push(e),"@@@"}),te(te({},ne),n));return(t=t.replace(Vt,function(t){return re[t](e,o)})).replace(/@@@/g,function(){return r.shift()})}}clone(){return new se(this.options)}}var ue;t.Sequential=ee=class extends F{getDefaultOptions(){return{domain:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolator:M,tickMethod:N,tickCount:5}}constructor(t){super(t)}clone(){return new ee(this.options)}},t.Sequential=ee=ut([gt(function(t){return[t(0),t(1)]},t=>{var[t,e]=t;return l(x(0,1),h(t,e))})],t.Sequential);t.Diverging=ue=class extends F{getDefaultOptions(){return{domain:[0,.5,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolator:M,tickMethod:N,tickCount:5}}constructor(t){super(t)}clone(){return new ue(this.options)}},t.Diverging=ue=ut([gt(function(t){return[t(0),t(.5),t(1)]},t=>{const[e,n,r]=t,o=l(x(0,.5),h(e,n)),i=l(x(.5,1),h(n,r));return t=>(e>r?t<n?i:o:t<n?o:i)(t)})],t.Diverging);t.Band=Ft,t.Base=C,t.Constant=Ut,t.Continuous=A,t.DURATION_DAY=i,t.DURATION_HOUR=o,t.DURATION_MINUTE=r,t.DURATION_MONTH=W,t.DURATION_SECOND=n,t.DURATION_WEEK=a,t.DURATION_YEAR=B,t.Identity=Rt,t.Linear=F,t.Log=Lt,t.Ordinal=It,t.Point=Et,t.Pow=Bt,t.Quantile=Qt,t.Quantize=Zt,t.Sqrt=$t,t.Threshold=_t,t.Time=se,t.createInterpolateColor=Dt,t.createInterpolateNumber=x,t.createInterpolateValue=S,t.d3Log=zt,t.d3Ticks=N,t.d3Time=ie,t.rPretty=(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),i=Math.min(r*o,t),a=Math.floor((n-i)/o)+1;const s=new Array(a);for(let t=0;t<a;t+=1)s[t]=j(i+t*o);return s},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 l(t,...e){return e.reduce((e,n)=>t=>e(n(t)),t)}function h(e,n){return n-e?t=>(t-e)/(n-e):t=>.5}function j(t,e,n,r,o){let a=n||0,i=r||t.length;for(var s=o||(t=>t);a<i;){var u=Math.floor((a+i)/2);s(t[u])>e?i=u:a=u+1}return a}const R=Math.sqrt(50),P=Math.sqrt(10),K=Math.sqrt(2);function u(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>=R?10:n>=P?5:n>=K?2:1)*10**t:-(10**-t)/(n>=R?10:n>=P?5:n>=K?2:1)}function q(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>=R?r*=10:n>=P?r*=5:n>=K&&(r*=2),e<t?-r:r}const E=(t,e,n=5)=>{t=[t,e];let r=0,o=t.length-1,a=t[r],i=t[o],s;return i<a&&([a,i]=[i,a],[r,o]=[o,r]),0<(s=u(a,i,n))?(a=Math.floor(a/s)*s,i=Math.ceil(i/s)*s,s=u(a,i,n)):s<0&&(a=Math.ceil(a*s)/s,i=Math.floor(i*s)/s,s=u(a,i,n)),0<s?(t[r]=Math.floor(a/s)*s,t[o]=Math.ceil(i/s)*s):s<0&&(t[r]=Math.ceil(a*s)/s,t[o]=Math.floor(i*s)/s),t},n=1e3,r=6e4,o=36e5,a=24*o,i=7*a;var W=30*a,B=365*a;function e(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)=>{for(var o=[],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 s=e(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),d=e(n,t=>{t.setMilliseconds(0)},(t,e=1)=>{t.setTime(+t+n*e)},t=>t.getSeconds()),c=e(r,t=>{t.setSeconds(0,0)},(t,e=1)=>{t.setTime(+t+r*e)},t=>t.getMinutes()),g=e(o,t=>{t.setMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getHours()),p=e(a,t=>{t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+a*e)},t=>t.getDate()-1);const $=e(W,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 _=e(i,t=>{t.setDate(t.getDate()-t.getDay()%7),t.setHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+i*e)},t=>{var e=$.floor(t),t=new Date(+t);return Math.floor((+t-+e)/i)}),z=e(B,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 L={millisecond:s,second:d,minute:c,hour:g,day:p,week:_,month:$,year:z};s=e(1,t=>t,(t,e=1)=>{t.setTime(+t+e)},t=>t.getTime()),d=e(n,t=>{t.setUTCMilliseconds(0)},(t,e=1)=>{t.setTime(+t+n*e)},t=>t.getUTCSeconds()),c=e(r,t=>{t.setUTCSeconds(0,0)},(t,e=1)=>{t.setTime(+t+r*e)},t=>t.getUTCMinutes()),g=e(o,t=>{t.setUTCMinutes(0,0,0)},(t,e=1)=>{t.setTime(+t+o*e)},t=>t.getUTCHours()),p=e(a,t=>{t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+a*e)},t=>t.getUTCDate()-1);const Z=e(W,t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e=1)=>{var n=t.getUTCMonth();t.setUTCMonth(n+e)},t=>t.getUTCMonth());_=e(i,t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7)%7),t.setUTCHours(0,0,0,0)},(t,e=1)=>{t.setTime(+t+i*e)},t=>{var e=Z.floor(t),t=new Date(+t);return Math.floor((+t-+e)/i)}),z=e(B,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 J={millisecond:s,second:d,minute:c,hour:g,day:p,week:_,month:Z,year:z};function Q(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?J:L;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=j(o,u,0,l,s);let d;return d=h===l?[a,q(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(q(t,e,n),1)]}const V=(t,e,n,r,o)=>{var a=e<t,i=a?e:t,t=a?t:e,[e,n]=Q(i,t,n,r,o),r=[e.floor(i,n),e.ceil(t,n)];return a?r.reverse():r};function G(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)}function X(t){return f(t,"Function")}function tt(t){return null==t}var et={}.toString,f=function(t,e){return et.call(t)==="[object "+e+"]"},nt=function(t){return Array.isArray?Array.isArray(t):f(t,"Array")};var rt=function(t){if("object"!=typeof(e=t)||null===e||!f(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},m=function(t){return f(t,"Number")},ot=Object.values?function(t){return Object.values(t)}:function(n){var t,r=[],e=n,o=function(t,e){X(n)&&"prototype"===e||r.push(t)};if(e)if(nt(e))for(var a=0,i=e.length;a<i&&!1!==o(e[a],a);a++);else if(t=typeof e,null!==e&&"object"==t||"function"==t)for(var s in e)if(e.hasOwnProperty(s)&&!1===o(e[s],s))break;return r},at=5;function it(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||at,n){var i;n.hasOwnProperty(a)&&(null!==(i=n[a])&&rt(i)?(rt(e[a])||(e[a]={}),r<o?t(e[a],i,r+1,o):e[a]=n[a]):nt(i)?(e[a]=[],e[a]=e[a].concat(i)):void 0!==i&&(e[a]=i))}}(t,e[r]);return t}function v(t){return t}var st,ut=function(t,e){if(!G(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 lt(t){return tt(t)?0:(G(t)?t:Object.keys(t)).length}function ht(t,e,n,r){var o,a=arguments.length,i=a<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;0<=s;s--)(o=t[s])&&(i=(a<3?o(i):3<a?o(e,n,i):o(e,n))||i);return 3<a&&i&&Object.defineProperty(e,n,i),i}function M(t){return null!=t&&!Number.isNaN(t)}!function(a,i){var s;if(X(a))return(s=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n,r=i?i.apply(this,t):t[0],o=s.cache;return o.has(r)?o.get(r):(n=a.apply(this,t),o.set(r,n),n)}).cache=new Map;throw new TypeError("Expected a function")}(function(t,e){var n=(e=void 0===e?{}:e).fontSize,r=e.fontFamily,o=e.fontWeight,a=e.fontStyle,e=e.fontVariant;return(st=st||document.createElement("canvas").getContext("2d")).font=[a,e,o,n+"px",r].join(" "),st.measureText(f(t,"String")?t:"").width},function(t,e){return function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;for(var r=Array(t),o=0,e=0;e<n;e++)for(var a=arguments[e],i=0,s=a.length;i<s;i++,o++)r[o]=a[i];return r}([t],ot(e=void 0===e?{}:e)).join("")});const dt=e=>t=>-e(-t),ct=(t,e)=>{const n=Math.log(t);t=t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:t=>Math.log(t)/n;return e?dt(t):t},gt=(e,t)=>{var n=e===Math.E?Math.exp:t=>e**t;return t?dt(n):n},pt=(t,e,n,r)=>{var o=t<0,a=ct(r,o),r=gt(r,o),o=e<t,i=o?t:e,e=[r(Math.floor(a(o?e:t))),r(Math.ceil(a(i)))];return o?e.reverse():e};function ft(e,i){return t=>{t.prototype.rescale=function(){this.initRange(),this.nice();var[t]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t))},t.prototype.initRange=function(){var t=this.options["interpolator"];this.options.range=e(t)},t.prototype.composeOutput=function(t,e){var n,{domain:r,interpolator:o,round:a}=this.getOptions(),r=i(r.map(t)),a=a?(n=o,t=>{t=n(t);return m(t)?Math.round(t):t}):o;this.output=l(a,r,e,t)},t.prototype.invert=void 0}}var y,s={exports:{}},d={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,Mt=Array.prototype.slice,yt=d.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var o=t[n];mt(o)?e=vt.call(e,Mt.call(o)):e.push(o)}return e},k=(yt.wrap=function(t){return function(){return t(yt(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]}),b=d.exports,kt=Object.hasOwnProperty,bt=Object.create(null);for(y in k)kt.call(k,y)&&(bt[k[y]]=y);var w=s.exports={to:{},get:{}};function D(t,e,n){return Math.min(Math.max(e,t),n)}function T(t){t=Math.round(t).toString(16).toUpperCase();return t.length<2?"0"+t:t}w.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=w.get.hsl(t),n="hsl";break;case"hwb":e=w.get.hwb(t),n="hwb";break;default:e=w.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},w.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);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]:kt.call(k,e[1])?((o=k[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]=D(o[n],0,255);return o[3]=D(o[3],0,1),o},w.get.hsl=function(t){var e;return(t=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*)?\)$/))?(e=parseFloat(t[4]),[(parseFloat(t[1])%360+360)%360,D(parseFloat(t[2]),0,100),D(parseFloat(t[3]),0,100),D(isNaN(e)?1:e,0,1)]):null},w.get.hwb=function(t){var e;return(t=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*)?\)$/))?(e=parseFloat(t[4]),[(parseFloat(t[1])%360+360)%360,D(parseFloat(t[2]),0,100),D(parseFloat(t[3]),0,100),D(isNaN(e)?1:e,0,1)]):null},w.to.hex=function(){var t=b(arguments);return"#"+T(t[0])+T(t[1])+T(t[2])+(t[3]<1?T(Math.round(255*t[3])):"")},w.to.rgb=function(){var t=b(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]+")"},w.to.rgb.percent=function(){var t=b(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]+")"},w.to.hsl=function(){var t=b(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},w.to.hwb=function(){var t=b(arguments),e="";return 4<=t.length&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},w.to.keyword=function(t){return bt[t.slice(0,3)]};var wt=s.exports;function Dt(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 Tt(t){var e,n,r,t=wt.get(t);return t?({model:t,value:e}=t,"rgb"===t?e:"hsl"===t?(e=(t=e)[0]/360,n=t[1]/100,r=t[2]/100,t=t[3],0==n?[255*r,255*r,255*r,t]:[255*Dt(n=2*r-(r=r<.5?r*(1+n):r+n-r*n),r,e+1/3),255*Dt(n,r,e),255*Dt(n,r,e-1/3),t]):null):null}const O=(e,n)=>t=>e*(1-t)+n*t,Ot=(t,e)=>{const u=Tt(t),l=Tt(e);return null===u||null===l?u?()=>t:()=>e:e=>{var 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})`}},x=(t,e)=>"number"==typeof t&&"number"==typeof e?O(t,e):"string"==typeof t&&"string"==typeof e?Ot(t,e):()=>t,xt=(t,e)=>{const n=O(t,e);return t=>Math.round(n(t))};function St({map:t,initKey:e},n){e=e(n);return t.has(e)?t.get(e):n}function Ct(t){return"object"==typeof t?t.valueOf():t}class Yt extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=Ct,null!==t)for(var[e,n]of t)this.set(e,n)}get(t){return super.get(St({map:this.map,initKey:this.initKey},t))}has(t){return super.has(St({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(([{map:t,initKey:n},r]=[{map:this.map,initKey:this.initKey},t],n=n(r),t.has(n)?t.get(n):(t.set(n,r),r)),e);var n,r}delete(t){return super.delete(([{map:t,initKey:e},n]=[{map:this.map,initKey:this.initKey},t],e=e(n),t.has(e)&&(n=t.get(e),t.delete(e)),n));var e,n}}class S{constructor(t){this.options=it({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=it({},this.options,t),this.rescale(t)}rescale(t){}}const C=Symbol("defaultUnknown");function Nt(e,n,r){for(let t=0;t<n.length;t+=1)e.has(n[t])||e.set(r(n[t]),t)}function It(t){var{value:t,from:e,to:n,mapper:r,notFoundReturn:o}=t;let a=r.get(t);if(void 0===a){if(o!==C)return o;a=e.push(t)-1,r.set(t,a)}return n[a%n.length]}function At(t){return t instanceof Date?t=>""+t:"object"==typeof t?t=>JSON.stringify(t):t=>t}class Ft extends S{getDefaultOptions(){return{domain:[],range:[],unknown:C}}constructor(t){super(t)}map(t){return 0===this.domainIndexMap.size&&Nt(this.domainIndexMap,this.getDomain(),this.domainKey),It({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&Nt(this.rangeIndexMap,this.getRange(),this.rangeKey),It({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;this.domainKey=At(e),this.rangeKey=At(n),this.rangeIndexMap?(t&&!t.range||this.rangeIndexMap.clear(),t&&!t.domain&&!t.compare||(this.domainIndexMap.clear(),this.sortedDomain=void 0)):(this.rangeIndexMap=new Map,this.domainIndexMap=new Map)}clone(){return new Ft(this.options)}getRange(){return this.options.range}getDomain(){var t,e;return this.sortedDomain||({domain:t,compare:e}=this.options,this.sortedDomain=e?[...t].sort(e):t),this.sortedDomain}}function Ut(t){const{domain:e,range:n,paddingOuter:r,paddingInner:o,flex:a,round:i,align:s}=t;var u=e.length,l=0<(l=(t=u)-(h=a).length)?[...h,...new Array(l).fill(1)]:l<0?h.slice(0,t):h,[t,h]=n,h=h-t,d=h/(2/u*r+1-1/u*o);const c=d*o/u;d-=u*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);var l=new Yt(e.map((t,e)=>{e=g[e]*p;return[t,i?Math.floor(e):e]})),f=new Yt(e.map((t,e)=>{e=g[e]*p+c;return[t,i?Math.floor(e):e]})),d=Array.from(f.values()).reduce((t,e)=>t+e),t=t+(h-(d-d/u*o))*s;let m=i?Math.round(t):t;var v=new Array(u);for(let t=0;t<u;t+=1){v[t]=(M=m,Math.round(1e12*M)/1e12);var M=e[t];m+=f.get(M)}return{valueBandWidth:l,valueStep:f,adjustedRange:v}}class jt extends Ft{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:C,flex:[]}}constructor(t){super(t)}clone(){return new jt(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth: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}=function(t){var e=t["domain"];if(0===(e=e.length))return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(!(null==(n=t.flex)||!n.length))return Ut(t);var{range:n,paddingOuter:t,paddingInner:r,round:o,align:a}=t;let i,s,u=n[0];return n=n[1]-u,i=n/Math.max(1,2*t+(e-r)),o&&(i=Math.floor(i)),u+=(n-i*(e-r))*a,s=i*(1-r),o&&(u=Math.round(u),s=Math.round(s)),t=new Array(e).fill(0).map((t,e)=>u+e*i),{valueStep:i,valueBandWidth:s,adjustedRange:t}}({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}}const Y=(t,e,n)=>{let r,o,a=t,i=e;if(a===i&&0<n)return[a];let s=u(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 Ht extends S{getDefaultOptions(){return{range:[0],domain:[0,1],unknown:void 0,tickCount:5,tickMethod:Y}}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(){var{tickMethod:t,domain:e,tickCount:n}=this.options,[e,r]=e;return m(e)&&m(r)?t(e,r,n):[]}clone(){return new Ht(this.options)}}function H(t){return Math.abs(t)<1e-15?t:parseFloat(t.toFixed(15))}const Rt=[1,5,2,2.5,4,3],Pt=100*Number.EPSILON;const N=(n,r,t=5,o=!0,a=Rt,i=[.25,.2,.5,.05])=>{var s=t<0?0:Math.round(t);if(Number.isNaN(n)||Number.isNaN(r)||"number"!=typeof n||"number"!=typeof r||!s)return[];if(r-n<1e-15||1===s)return[n];var u,l,h,d,c,g,p,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 v=a[t],M=(d=v,c=a,g=m,p=void 0,p=lt(c),1-ut(c,d)/(p-1)-g+1);if(i[0]*M+i[1]+i[2]+i[3]<f.score){m=1/0;break}let e=2;for(;e<1/0;){k=e;var y=(h=s)<=k?2-(k-1)/(h-1):1;if(i[0]*M+i[1]+i[2]*y+i[3]<f.score)break;var k=(r-n)/(e+1)/m/v;let t=Math.ceil(Math.log10(k));for(;t<1/0;){var b=m*v*10**t,w=(T=r,w=b*(e-1),(T-=n)<w?1-((w-T)/2)**2/(.1*T)**2:1);if(i[0]*M+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=lt(e),e=ut(e,t);let s=0;return t=(r%a+a)%a,1-e/(i-1)-n+(s=(t<Pt||a-t<Pt)&&r<=0&&0<=o?1:s)}(v,a,m,x,S,C),N=1-.5*((r-S)**2+(n-x)**2)/(.1*(r-n))**2,I=(u=e,I=n,u=(u-1)/(S-(A=x)),l=((l=s)-1)/(Math.max(S,r)-Math.min(I,A)),2-Math.max(u/l,l/u)),A=i[0]*Y+i[1]*N+i[2]*I+ +i[3];f.score<A&&(!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=H(f.lmax),e=H(f.lmin),F=H(f.lstep),U=Math.floor((t=(t-e)/F,Math.round(1e12*t)/1e12))+1,j=new Array(U);j[0]=H(e);for(let t=1;t<U;t+=1)j[t]=H(j[t-1]+F);return j};class Kt extends S{getDefaultOptions(){return{domain:[0,1],range:[0,1],tickCount:5,unknown:void 0,tickMethod:N}}map(t){return M(t)?t:this.options.unknown}invert(t){return this.map(t)}clone(){return new Kt(this.options)}getTicks(){var{domain:t,tickCount:e,tickMethod:n}=this.options,[t,r]=t;return m(t)&&m(r)?n(t,r,e):[]}}const qt=(t,e,n)=>{var[t,r]=t,[e,o]=e;let a,i;return l(i=t<r?(a=h(t,r),n(e,o)):(a=h(r,t),n(o,e)),a)},Et=(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]=h(s[t],s[t+1]),i[t]=e(u[t],u[t+1]);return t=>{var e=j(r,t,1,o)-1,n=a[e];return l(i[e],n)(t)}},Wt=(t,e,n,r)=>{return(2<Math.min(t.length,e.length)?Et:qt)(t,e,r?xt:n)};class I extends S{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:O,tickCount:5}}map(t){return M(t)?this.output(t):this.options.unknown}invert(t){return M(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(){var t=this.options["tickMethod"],[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 E}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 v}composeOutput(t,e){var{domain:n,range:r,round:o,interpolate:a}=this.options,n=Wt(n.map(t),r,a,o);this.output=l(n,e,t)}composeInput(t,e,n){var{domain:r,range:o}=this.options,o=Wt(o,r.map(t),O);this.input=l(e,n,o)}}class A extends I{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:x,tickMethod:Y,tickCount:5}}chooseTransforms(){return[v,v]}clone(){return new A(this.options)}}class Bt extends jt{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,padding:0,unknown:C,paddingInner:1,paddingOuter:0}}constructor(t){super(t)}getPaddingInner(){return 1}clone(){return new Bt(this.options)}update(t){super.update(t)}getPaddingOuter(){return this.options.padding}}const $t=t=>t<0?-Math.sqrt(-t):Math.sqrt(t);class _t extends I{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,exponent:2,interpolate:x,tickMethod:Y,tickCount:5}}constructor(t){super(t)}chooseTransforms(){var t,e,n,r=this.options["exponent"];return 1===r?[v,v]:(t=.5===r?$t:(e=r,t=>t<0?-((-t)**e):t**e),n=r,[t,t=>t<0?-((-t)**(1/n)):t**(1/n)])}clone(){return new _t(this.options)}}class zt extends _t{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:x,tickMethod:Y,tickCount:5,exponent:.5}}constructor(t){super(t)}update(t){super.update(t)}clone(){return new zt(this.options)}}class F extends S{getDefaultOptions(){return{domain:[.5],range:[0,1]}}constructor(t){super(t)}map(t){return M(t)?(t=j(this.thresholds,t,0,this.n),this.options.range[t]):this.options.unknown}invert(t){var e=this.options["range"],e=e.indexOf(t),t=this.thresholds;return[t[e-1],t[e]]}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 Lt=(t,e,n,r=10)=>{var o=t<0,a=gt(r,o),i=ct(r,o),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=Y(u,l,n))}else{t=-1===n?d-h:Math.min(d-h,n);c=Y(h,d,t).map(a)}return s?c.reverse():c};class Zt extends I{getDefaultOptions(){return{domain:[1,10],range:[0,1],base:10,interpolate:x,tickMethod:Lt,tickCount:5}}chooseNice(){return pt}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[ct(t,e),gt(t,e)]}clone(){return new Zt(this.options)}}class Jt extends F{getDefaultOptions(){return{domain:[0,1],range:[.5],nice:!1,tickCount:5,tickMethod:N}}constructor(t){super(t)}nice(){var t,e,n=this.options["nice"];n&&([n,t,e]=this.getTickMethodOptions(),this.options.domain=E(n,t,e))}getTicks(){var t=this.options["tickMethod"],[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 Jt(this.options)}}function Qt(t,e,n=!1){var r=t,o=(n||r.sort((t,e)=>t-e),[]);for(let t=1;t<e;t+=1)o.push(function(t,e){var n,r=t.length;if(r)return r<2?t[r-1]:(r=(r-1)*e,(n=t[e=Math.floor(r)])+(t[e+1]-n)*(r-e))}(r,t/e));return o}class Vt extends F{getDefaultOptions(){return{domain:[],range:[],tickCount:5,unknown:void 0,tickMethod:N}}constructor(t){super(t)}rescale(){var{domain:t,range:e}=this.options;this.n=e.length-1,this.thresholds=Qt(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 Vt(this.options)}getTicks(){var{tickCount:t,domain:e,tickMethod:n}=this.options,r=e.length-1;return n(e[0],e[r],t)}}var Gt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,Xt=/\[([^]*?)\]/gm;function te(t,e){for(var n=[],r=0,o=t.length;r<o;r++)n.push(t[r].substr(0,e));return n}function ee(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 ne,c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],g=["January","February","March","April","May","June","July","August","September","October","November","December"],p=te(g,3),re=ee({},{dayNamesShort:te(c,3),dayNames:c,monthNamesShort:p,monthNames:g,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][3<t%10?0:(t-t%10!=10?1:0)*t%10]}}),oe={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)}},ae={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 ie=(t,e,n,r,o)=>{var a=e<t,i=a?e:t,t=a?t:e,[e,n]=Q(i,t,n,r,o),r=e.range(i,new Date(+t+1),n,!0);return a?r.reverse():r};function se(t){var e=t.getTimezoneOffset(),t=new Date(t);return t.setMinutes(t.getMinutes()+e,t.getSeconds(),t.getMilliseconds()),t}class ue extends I{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:ie,interpolate:O,mask:void 0,utc:!1}}chooseTransforms(){return[t=>+t,t=>new Date(t)]}chooseNice(){return V}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?J:L,s=t?se:v;return t=>{var e=s(t),t=a||function(t,e){var{second:e,minute:n,hour:r,day:o,week:a,month:i,year:s}=e;return e.floor(t)<t?".SSS":n.floor(t)<t?":ss":r.floor(t)<t?"hh:mm":o.floor(t)<t?"hh A":i.floor(t)<t?a.floor(t)<t?"MMM DD":"ddd DD":s.floor(t)<t?"MMMM":"YYYY"}(t,i),n=void 0;if(void 0===t&&(t=ae.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=ae[t]||t).replace(Xt,function(t,e){return r.push(e),"@@@"}),ee(ee({},re),n));return(t=t.replace(Gt,function(t){return oe[t](e,o)})).replace(/@@@/g,function(){return r.shift()})}}clone(){return new ue(this.options)}}var le;t.Sequential=ne=class extends A{getDefaultOptions(){return{domain:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolator:v,tickMethod:Y,tickCount:5}}constructor(t){super(t)}clone(){return new ne(this.options)}},t.Sequential=ne=ht([ft(function(t){return[t(0),t(1)]},t=>{var[t,e]=t;return l(O(0,1),h(t,e))})],t.Sequential);t.Diverging=le=class extends A{getDefaultOptions(){return{domain:[0,.5,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolator:v,tickMethod:Y,tickCount:5}}constructor(t){super(t)}clone(){return new le(this.options)}},t.Diverging=le=ht([ft(function(t){return[t(0),t(.5),t(1)]},t=>{const[e,n,r]=t,o=l(O(0,.5),h(e,n)),a=l(O(.5,1),h(n,r));return t=>(e>r?t<n?a:o:t<n?o:a)(t)})],t.Diverging);t.Band=jt,t.Base=S,t.Constant=Ht,t.Continuous=I,t.DURATION_DAY=a,t.DURATION_HOUR=o,t.DURATION_MINUTE=r,t.DURATION_MONTH=W,t.DURATION_SECOND=n,t.DURATION_WEEK=i,t.DURATION_YEAR=B,t.Identity=Kt,t.Linear=A,t.Log=Zt,t.Ordinal=Ft,t.Point=Bt,t.Pow=_t,t.Quantile=Vt,t.Quantize=Jt,t.Sqrt=zt,t.Threshold=F,t.Time=ue,t.createInterpolateColor=Ot,t.createInterpolateNumber=O,t.createInterpolateValue=x,t.d3Log=Lt,t.d3Ticks=Y,t.d3Time=ie,t.rPretty=(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,s=new Array(i);for(let t=0;t<i;t+=1)s[t]=H(a+t*o);return s},t.wilkinsonExtended=N,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -156,6 +156,2 @@ import { InternMap } from '../utils'; | ||
export class Band extends Ordinal { | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
// 覆盖默认配置 | ||
@@ -175,2 +171,6 @@ getDefaultOptions() { | ||
} | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
clone() { | ||
@@ -177,0 +177,0 @@ return new Band(this.options); |
import { OrdinalOptions, Domain, Range } from '../types'; | ||
import { Base } from './base'; | ||
declare type Transform = (x: any) => any; | ||
type Transform = (x: any) => any; | ||
export declare const defaultUnknown: unique symbol; | ||
@@ -5,0 +5,0 @@ /** |
@@ -57,6 +57,2 @@ import { Base } from './base'; | ||
export class Ordinal extends Base { | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
// 覆盖默认配置 | ||
@@ -70,2 +66,6 @@ getDefaultOptions() { | ||
} | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
map(x) { | ||
@@ -72,0 +72,0 @@ if (this.domainIndexMap.size === 0) { |
@@ -7,5 +7,2 @@ import { Base } from './base'; | ||
export class Threshold extends Base { | ||
constructor(options) { | ||
super(options); | ||
} | ||
getDefaultOptions() { | ||
@@ -17,2 +14,5 @@ return { | ||
} | ||
constructor(options) { | ||
super(options); | ||
} | ||
/** | ||
@@ -19,0 +19,0 @@ * 二分查找到输入值在哪一段,返回对应的值域中的值 |
@@ -45,3 +45,4 @@ import { d3Ticks } from './d3-ticks'; | ||
else { | ||
ticks = d3Ticks(i, j, Math.min(j - i, n)).map(pow); | ||
const count = n === -1 ? j - i : Math.min(j - i, n); | ||
ticks = d3Ticks(i, j, count).map(pow); | ||
} | ||
@@ -48,0 +49,0 @@ return r ? ticks.reverse() : ticks; |
/** 获得 ticks 的方法 */ | ||
export declare type TickMethod<T = number> = (min: T, max: T, n?: number, ...rest: any[]) => T[]; | ||
export type TickMethod<T = number> = (min: T, max: T, n?: number, ...rest: any[]) => T[]; | ||
/** nice domain 的方法 */ | ||
export declare type NiceMethod<T = number> = TickMethod<T>; | ||
export type NiceMethod<T = number> = TickMethod<T>; | ||
/** 插值器工厂 */ | ||
export declare type Interpolate<T = number> = (a: T, b: T) => (t: number) => T; | ||
export type Interpolate<T = number> = (a: T, b: T) => (t: number) => T; | ||
/** 插值器函数 */ | ||
export declare type Interpolator = (t: number) => any; | ||
export type Interpolator = (t: number) => any; | ||
/** 所有支持的插值器工厂 */ | ||
export declare type Interpolates = Interpolate<number> | Interpolate<string> | Interpolate<number | string>; | ||
export type Interpolates = Interpolate<number> | Interpolate<string> | Interpolate<number | string>; | ||
/** 比较器 */ | ||
export declare type Comparator = (a: any, b: any) => number; | ||
export type Comparator = (a: any, b: any) => number; | ||
/** tickMethod 和 nice 需要使用的参数 */ | ||
export declare type TickMethodOptions<T = number | Date> = [T, T, number, number?, boolean?]; | ||
export type TickMethodOptions<T = number | Date> = [T, T, number, number?, boolean?]; | ||
/** 柯里化后的函数的类型,对输入的值进行处理 */ | ||
export declare type Transform = (x: any) => any; | ||
export type Transform = (x: any) => any; | ||
/** 柯里化后的函数的工厂函数类型 */ | ||
export declare type CreateTransform = (...args: any[]) => Transform; | ||
export type CreateTransform = (...args: any[]) => Transform; | ||
/** 通用的配置 */ | ||
export declare type BaseOptions = { | ||
export type BaseOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -29,10 +29,10 @@ unknown?: any; | ||
/** 获得比例尺选项中定义域元素的类型 */ | ||
export declare type Domain<O extends BaseOptions> = O['domain'][number]; | ||
export type Domain<O extends BaseOptions> = O['domain'][number]; | ||
/** 获得比例尺选项中值域元素的类型 */ | ||
export declare type Range<O extends BaseOptions> = O['range'][number]; | ||
export type Range<O extends BaseOptions> = O['range'][number]; | ||
/** 获得比例尺选项中 unknown 的类型 */ | ||
export declare type Unknown<O extends BaseOptions> = O['unknown']; | ||
export type Unknown<O extends BaseOptions> = O['unknown']; | ||
/** Identity 比例尺的选项 */ | ||
/** Identity 比例尺的选项 */ | ||
export declare type IdentityOptions = { | ||
export type IdentityOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -50,3 +50,3 @@ unknown?: any; | ||
/** Constant 比例尺的选项 */ | ||
export declare type ConstantOptions = { | ||
export type ConstantOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -64,3 +64,3 @@ unknown?: any; | ||
/** Constant 比例尺的选项 */ | ||
export declare type ContinuousOptions = { | ||
export type ContinuousOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -86,3 +86,3 @@ unknown?: any; | ||
/** Linear 比例尺的选项 */ | ||
export declare type LinearOptions = { | ||
export type LinearOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -108,3 +108,3 @@ unknown?: any; | ||
/** Pow 比例尺的选项 */ | ||
export declare type PowOptions = LinearOptions & { | ||
export type PowOptions = LinearOptions & { | ||
/** 指数 */ | ||
@@ -114,5 +114,5 @@ exponent?: number; | ||
/** Sqrt 比例尺的选项 */ | ||
export declare type SqrtOptions = LinearOptions; | ||
export type SqrtOptions = LinearOptions; | ||
/** Log 比例尺的选项 */ | ||
export declare type LogOptions = LinearOptions & { | ||
export type LogOptions = LinearOptions & { | ||
/** 底数 */ | ||
@@ -122,3 +122,3 @@ base?: number; | ||
/** time 比例尺的选项 */ | ||
export declare type TimeOptions = { | ||
export type TimeOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -150,3 +150,3 @@ unknown?: any; | ||
/** OrdinalOptions 比例尺的选项 */ | ||
export declare type OrdinalOptions = { | ||
export type OrdinalOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -162,3 +162,3 @@ unknown?: any; | ||
/** 详细请参阅 scale/band.ts */ | ||
export declare type BandOptions = { | ||
export type BandOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -186,5 +186,5 @@ unknown?: any; | ||
/** Point 比例尺的选项 */ | ||
export declare type PointOptions = Omit<BandOptions, 'paddingInner' | 'paddingOuter'>; | ||
export type PointOptions = Omit<BandOptions, 'paddingInner' | 'paddingOuter'>; | ||
/** Threshold 比例尺的选项 */ | ||
export declare type ThresholdOptions = { | ||
export type ThresholdOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -198,3 +198,3 @@ unknown?: any; | ||
/** Quantize 比例尺的选项 */ | ||
export declare type QuantizeOptions = { | ||
export type QuantizeOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -214,3 +214,3 @@ unknown?: any; | ||
/** Quantile 比例尺的选项 */ | ||
export declare type QuantileOptions = { | ||
export type QuantileOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -228,8 +228,8 @@ unknown?: any; | ||
/** Sequential 比例尺的选项 */ | ||
export declare type SequentialOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
export type SequentialOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
interpolator?: Interpolator; | ||
}; | ||
/** Diverging 比例尺的选项 */ | ||
export declare type DivergingOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
export type DivergingOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
interpolator?: Interpolator; | ||
}; |
import { Interval } from './time-interval'; | ||
declare type TickInterval = [Interval, number]; | ||
type TickInterval = [Interval, number]; | ||
export declare function findTickInterval(start: Date, stop: Date, count: number, interval: number, utc: boolean): TickInterval; | ||
export {}; |
@@ -6,3 +6,9 @@ const reflect = (f) => { | ||
const baseCache = Math.log(base); | ||
const log = base === Math.E ? Math.log : (x) => Math.log(x) / baseCache; | ||
const log = base === Math.E | ||
? Math.log | ||
: base === 10 | ||
? Math.log10 | ||
: base === 2 | ||
? Math.log2 | ||
: (x) => Math.log(x) / baseCache; | ||
return shouldReflect ? reflect(log) : log; | ||
@@ -9,0 +15,0 @@ }; |
@@ -1,5 +0,5 @@ | ||
export declare type TimeTransform = (d: Date, ...rest: any[]) => Date; | ||
declare type TimeRange = (start: Date, stop: Date, step: number, shouldAdjust?: boolean) => Date[]; | ||
declare type TimeProcess = (d: Date, ...rest: any[]) => void; | ||
declare type TimeField = (d: Date) => number; | ||
export type TimeTransform = (d: Date, ...rest: any[]) => Date; | ||
type TimeRange = (start: Date, stop: Date, step: number, shouldAdjust?: boolean) => Date[]; | ||
type TimeProcess = (d: Date, ...rest: any[]) => void; | ||
type TimeField = (d: Date) => number; | ||
export declare const DURATION_SECOND = 1000; | ||
@@ -12,3 +12,3 @@ export declare const DURATION_MINUTE: number; | ||
export declare const DURATION_YEAR: number; | ||
export declare type Interval = { | ||
export type Interval = { | ||
floor: TimeTransform; | ||
@@ -19,3 +19,3 @@ ceil: TimeTransform; | ||
}; | ||
export declare type IntervalMap = { | ||
export type IntervalMap = { | ||
millisecond: Interval; | ||
@@ -22,0 +22,0 @@ second: Interval; |
@@ -159,6 +159,2 @@ "use strict"; | ||
class Band extends ordinal_1.Ordinal { | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
// 覆盖默认配置 | ||
@@ -178,2 +174,6 @@ getDefaultOptions() { | ||
} | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
clone() { | ||
@@ -180,0 +180,0 @@ return new Band(this.options); |
import { OrdinalOptions, Domain, Range } from '../types'; | ||
import { Base } from './base'; | ||
declare type Transform = (x: any) => any; | ||
type Transform = (x: any) => any; | ||
export declare const defaultUnknown: unique symbol; | ||
@@ -5,0 +5,0 @@ /** |
@@ -60,6 +60,2 @@ "use strict"; | ||
class Ordinal extends base_1.Base { | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
// 覆盖默认配置 | ||
@@ -73,2 +69,6 @@ getDefaultOptions() { | ||
} | ||
// 显示指定 options 的类型为 OrdinalOptions,从而推断出 O 的类型 | ||
constructor(options) { | ||
super(options); | ||
} | ||
map(x) { | ||
@@ -75,0 +75,0 @@ if (this.domainIndexMap.size === 0) { |
@@ -10,5 +10,2 @@ "use strict"; | ||
class Threshold extends base_1.Base { | ||
constructor(options) { | ||
super(options); | ||
} | ||
getDefaultOptions() { | ||
@@ -20,2 +17,5 @@ return { | ||
} | ||
constructor(options) { | ||
super(options); | ||
} | ||
/** | ||
@@ -22,0 +22,0 @@ * 二分查找到输入值在哪一段,返回对应的值域中的值 |
@@ -48,3 +48,4 @@ "use strict"; | ||
else { | ||
ticks = (0, d3_ticks_1.d3Ticks)(i, j, Math.min(j - i, n)).map(pow); | ||
const count = n === -1 ? j - i : Math.min(j - i, n); | ||
ticks = (0, d3_ticks_1.d3Ticks)(i, j, count).map(pow); | ||
} | ||
@@ -51,0 +52,0 @@ return r ? ticks.reverse() : ticks; |
/** 获得 ticks 的方法 */ | ||
export declare type TickMethod<T = number> = (min: T, max: T, n?: number, ...rest: any[]) => T[]; | ||
export type TickMethod<T = number> = (min: T, max: T, n?: number, ...rest: any[]) => T[]; | ||
/** nice domain 的方法 */ | ||
export declare type NiceMethod<T = number> = TickMethod<T>; | ||
export type NiceMethod<T = number> = TickMethod<T>; | ||
/** 插值器工厂 */ | ||
export declare type Interpolate<T = number> = (a: T, b: T) => (t: number) => T; | ||
export type Interpolate<T = number> = (a: T, b: T) => (t: number) => T; | ||
/** 插值器函数 */ | ||
export declare type Interpolator = (t: number) => any; | ||
export type Interpolator = (t: number) => any; | ||
/** 所有支持的插值器工厂 */ | ||
export declare type Interpolates = Interpolate<number> | Interpolate<string> | Interpolate<number | string>; | ||
export type Interpolates = Interpolate<number> | Interpolate<string> | Interpolate<number | string>; | ||
/** 比较器 */ | ||
export declare type Comparator = (a: any, b: any) => number; | ||
export type Comparator = (a: any, b: any) => number; | ||
/** tickMethod 和 nice 需要使用的参数 */ | ||
export declare type TickMethodOptions<T = number | Date> = [T, T, number, number?, boolean?]; | ||
export type TickMethodOptions<T = number | Date> = [T, T, number, number?, boolean?]; | ||
/** 柯里化后的函数的类型,对输入的值进行处理 */ | ||
export declare type Transform = (x: any) => any; | ||
export type Transform = (x: any) => any; | ||
/** 柯里化后的函数的工厂函数类型 */ | ||
export declare type CreateTransform = (...args: any[]) => Transform; | ||
export type CreateTransform = (...args: any[]) => Transform; | ||
/** 通用的配置 */ | ||
export declare type BaseOptions = { | ||
export type BaseOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -29,10 +29,10 @@ unknown?: any; | ||
/** 获得比例尺选项中定义域元素的类型 */ | ||
export declare type Domain<O extends BaseOptions> = O['domain'][number]; | ||
export type Domain<O extends BaseOptions> = O['domain'][number]; | ||
/** 获得比例尺选项中值域元素的类型 */ | ||
export declare type Range<O extends BaseOptions> = O['range'][number]; | ||
export type Range<O extends BaseOptions> = O['range'][number]; | ||
/** 获得比例尺选项中 unknown 的类型 */ | ||
export declare type Unknown<O extends BaseOptions> = O['unknown']; | ||
export type Unknown<O extends BaseOptions> = O['unknown']; | ||
/** Identity 比例尺的选项 */ | ||
/** Identity 比例尺的选项 */ | ||
export declare type IdentityOptions = { | ||
export type IdentityOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -50,3 +50,3 @@ unknown?: any; | ||
/** Constant 比例尺的选项 */ | ||
export declare type ConstantOptions = { | ||
export type ConstantOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -64,3 +64,3 @@ unknown?: any; | ||
/** Constant 比例尺的选项 */ | ||
export declare type ContinuousOptions = { | ||
export type ContinuousOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -86,3 +86,3 @@ unknown?: any; | ||
/** Linear 比例尺的选项 */ | ||
export declare type LinearOptions = { | ||
export type LinearOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -108,3 +108,3 @@ unknown?: any; | ||
/** Pow 比例尺的选项 */ | ||
export declare type PowOptions = LinearOptions & { | ||
export type PowOptions = LinearOptions & { | ||
/** 指数 */ | ||
@@ -114,5 +114,5 @@ exponent?: number; | ||
/** Sqrt 比例尺的选项 */ | ||
export declare type SqrtOptions = LinearOptions; | ||
export type SqrtOptions = LinearOptions; | ||
/** Log 比例尺的选项 */ | ||
export declare type LogOptions = LinearOptions & { | ||
export type LogOptions = LinearOptions & { | ||
/** 底数 */ | ||
@@ -122,3 +122,3 @@ base?: number; | ||
/** time 比例尺的选项 */ | ||
export declare type TimeOptions = { | ||
export type TimeOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -150,3 +150,3 @@ unknown?: any; | ||
/** OrdinalOptions 比例尺的选项 */ | ||
export declare type OrdinalOptions = { | ||
export type OrdinalOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -162,3 +162,3 @@ unknown?: any; | ||
/** 详细请参阅 scale/band.ts */ | ||
export declare type BandOptions = { | ||
export type BandOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -186,5 +186,5 @@ unknown?: any; | ||
/** Point 比例尺的选项 */ | ||
export declare type PointOptions = Omit<BandOptions, 'paddingInner' | 'paddingOuter'>; | ||
export type PointOptions = Omit<BandOptions, 'paddingInner' | 'paddingOuter'>; | ||
/** Threshold 比例尺的选项 */ | ||
export declare type ThresholdOptions = { | ||
export type ThresholdOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -198,3 +198,3 @@ unknown?: any; | ||
/** Quantize 比例尺的选项 */ | ||
export declare type QuantizeOptions = { | ||
export type QuantizeOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -214,3 +214,3 @@ unknown?: any; | ||
/** Quantile 比例尺的选项 */ | ||
export declare type QuantileOptions = { | ||
export type QuantileOptions = { | ||
/** 当需要映射的值不合法的时候,返回的值 */ | ||
@@ -228,8 +228,8 @@ unknown?: any; | ||
/** Sequential 比例尺的选项 */ | ||
export declare type SequentialOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
export type SequentialOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
interpolator?: Interpolator; | ||
}; | ||
/** Diverging 比例尺的选项 */ | ||
export declare type DivergingOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
export type DivergingOptions = Omit<LinearOptions, 'Interpolates'> & { | ||
interpolator?: Interpolator; | ||
}; |
import { Interval } from './time-interval'; | ||
declare type TickInterval = [Interval, number]; | ||
type TickInterval = [Interval, number]; | ||
export declare function findTickInterval(start: Date, stop: Date, count: number, interval: number, utc: boolean): TickInterval; | ||
export {}; |
@@ -9,3 +9,9 @@ "use strict"; | ||
const baseCache = Math.log(base); | ||
const log = base === Math.E ? Math.log : (x) => Math.log(x) / baseCache; | ||
const log = base === Math.E | ||
? Math.log | ||
: base === 10 | ||
? Math.log10 | ||
: base === 2 | ||
? Math.log2 | ||
: (x) => Math.log(x) / baseCache; | ||
return shouldReflect ? reflect(log) : log; | ||
@@ -12,0 +18,0 @@ }; |
@@ -1,5 +0,5 @@ | ||
export declare type TimeTransform = (d: Date, ...rest: any[]) => Date; | ||
declare type TimeRange = (start: Date, stop: Date, step: number, shouldAdjust?: boolean) => Date[]; | ||
declare type TimeProcess = (d: Date, ...rest: any[]) => void; | ||
declare type TimeField = (d: Date) => number; | ||
export type TimeTransform = (d: Date, ...rest: any[]) => Date; | ||
type TimeRange = (start: Date, stop: Date, step: number, shouldAdjust?: boolean) => Date[]; | ||
type TimeProcess = (d: Date, ...rest: any[]) => void; | ||
type TimeField = (d: Date) => number; | ||
export declare const DURATION_SECOND = 1000; | ||
@@ -12,3 +12,3 @@ export declare const DURATION_MINUTE: number; | ||
export declare const DURATION_YEAR: number; | ||
export declare type Interval = { | ||
export type Interval = { | ||
floor: TimeTransform; | ||
@@ -19,3 +19,3 @@ ceil: TimeTransform; | ||
}; | ||
export declare type IntervalMap = { | ||
export type IntervalMap = { | ||
millisecond: Interval; | ||
@@ -22,0 +22,0 @@ second: Interval; |
{ | ||
"name": "@antv/scale", | ||
"version": "0.4.11", | ||
"version": "0.4.12", | ||
"description": "Toolkit for mapping abstract data into visual representation.", | ||
@@ -99,6 +99,6 @@ "license": "MIT", | ||
"type": "git", | ||
"url": "https://github.com/antvis/template" | ||
"url": "https://github.com/antvis/scale" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/antvis/template/issues" | ||
"url": "https://github.com/antvis/scale/issues" | ||
}, | ||
@@ -105,0 +105,0 @@ "dependencies": { |
@@ -42,3 +42,4 @@ import { TickMethod } from '../types'; | ||
} else { | ||
ticks = d3Ticks(i, j, Math.min(j - i, n)).map(pow); | ||
const count = n === -1 ? j - i : Math.min(j - i, n); | ||
ticks = d3Ticks(i, j, count).map(pow); | ||
} | ||
@@ -45,0 +46,0 @@ |
@@ -7,3 +7,10 @@ const reflect = (f: Function) => { | ||
const baseCache = Math.log(base); | ||
const log = base === Math.E ? Math.log : (x: number) => Math.log(x) / baseCache; | ||
const log = | ||
base === Math.E | ||
? Math.log | ||
: base === 10 | ||
? Math.log10 | ||
: base === 2 | ||
? Math.log2 | ||
: (x: number) => Math.log(x) / baseCache; | ||
return shouldReflect ? reflect(log) : log; | ||
@@ -10,0 +17,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
507303
8828
0