@antv/scale
Advanced tools
Comparing version 0.4.10 to 0.4.11
@@ -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)}}const $t=(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};class _t extends Bt{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:S,tickMethod:$t,tickCount:5,exponent:.5}}constructor(t){super(t)}update(t){super.update(t)}clone(){return new _t(this.options)}}class zt 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 zt(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;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 Zt extends A{getDefaultOptions(){return{domain:[1,10],range:[0,1],base:10,interpolate:S,tickMethod:Lt,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 Zt(this.options)}}class Jt extends zt{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 Jt(this.options)}}function Qt(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 Vt extends zt{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=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(){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 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 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 ne,g=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],p=["January","February","March","April","May","June","July","August","September","October","November","December"],f=te(p,3),re=ee({},{dayNamesShort:te(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]}}),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)}},ie={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 ae=(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 se(t){var e=t.getTimezoneOffset();const n=new Date(t);return n.setMinutes(n.getMinutes()+e,n.getSeconds(),n.getMilliseconds()),n}class ue 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:ae,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?se: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=ie.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=ie[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 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 ne(this.options)}},t.Sequential=ne=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=le=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 le(this.options)}},t.Diverging=le=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=Zt,t.Ordinal=It,t.Point=Et,t.Pow=Bt,t.Quantile=Vt,t.Quantize=Jt,t.Sqrt=_t,t.Threshold=zt,t.Time=ue,t.createInterpolateColor=Dt,t.createInterpolateNumber=x,t.createInterpolateValue=S,t.d3Log=Lt,t.d3Ticks=N,t.d3Time=ae,t.rPretty=$t,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 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})}); |
import { createInterpolateValue } from '../utils'; | ||
import { rPretty } from '../tick-methods/r-pretty'; | ||
import { Pow } from './pow'; | ||
import { d3Ticks } from '../tick-methods/d3-ticks'; | ||
export class Sqrt extends Pow { | ||
@@ -13,3 +13,3 @@ getDefaultOptions() { | ||
interpolate: createInterpolateValue, | ||
tickMethod: rPretty, | ||
tickMethod: d3Ticks, | ||
tickCount: 5, | ||
@@ -16,0 +16,0 @@ exponent: 0.5, |
@@ -5,4 +5,4 @@ "use strict"; | ||
const utils_1 = require("../utils"); | ||
const r_pretty_1 = require("../tick-methods/r-pretty"); | ||
const pow_1 = require("./pow"); | ||
const d3_ticks_1 = require("../tick-methods/d3-ticks"); | ||
class Sqrt extends pow_1.Pow { | ||
@@ -17,3 +17,3 @@ getDefaultOptions() { | ||
interpolate: utils_1.createInterpolateValue, | ||
tickMethod: r_pretty_1.rPretty, | ||
tickMethod: d3_ticks_1.d3Ticks, | ||
tickCount: 5, | ||
@@ -20,0 +20,0 @@ exponent: 0.5, |
{ | ||
"name": "@antv/scale", | ||
"version": "0.4.10", | ||
"version": "0.4.11", | ||
"description": "Toolkit for mapping abstract data into visual representation.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
import { createInterpolateValue } from '../utils'; | ||
import { rPretty } from '../tick-methods/r-pretty'; | ||
import { SqrtOptions, PowOptions } from '../types'; | ||
import { Pow } from './pow'; | ||
import { d3Ticks } from '../tick-methods/d3-ticks'; | ||
@@ -15,3 +15,3 @@ export class Sqrt extends Pow<SqrtOptions & PowOptions> { | ||
interpolate: createInterpolateValue, | ||
tickMethod: rPretty, | ||
tickMethod: d3Ticks, | ||
tickCount: 5, | ||
@@ -18,0 +18,0 @@ exponent: 0.5, |
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
506485