Socket
Socket
Sign inDemoInstall

d3-geo-scale-bar

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-geo-scale-bar - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

.babelrc

3

build/d3-geo-scale-bar.min.js

@@ -1,2 +0,1 @@

!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(){return new e}function e(){this.reset()}function r(t,n,e){var r=t.s=n+e,i=r-n,u=r-i;t.t=n-u+(e-i)}function i(t){return t>1?Je:t<-1?-Je:Math.asin(t)}function u(){}function o(t,n){t&&ar.hasOwnProperty(t.type)&&ar[t.type](t,n)}function a(t,n,e){var r,i=-1,u=t.length-e;for(n.lineStart();++i<u;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function c(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)a(t[e],n,1);n.polygonEnd()}function l(t,n){t&&or.hasOwnProperty(t.type)?or[t.type](t,n):o(t,n)}function s(){sr.point=h}function f(){g(De,Fe)}function h(t,n){sr.point=g,De=t,Fe=n,t*=tr,n*=tr,Ae=t,Ye=rr(n=n/2+Be),He=ir(n)}function g(t,n){t*=tr,n*=tr,n=n/2+Be;var e=t-Ae,r=e>=0?1:-1,i=r*e,u=rr(n),o=ir(n),a=He*o,c=Ye*u+a*rr(i),l=a*r*ir(i);cr.add(er(l,c)),Ae=t,Ye=u,He=o}function p(t){return[er(t[1],t[0]),i(t[2])]}function d(t){var n=t[0],e=t[1],r=rr(e);return[r*rr(n),r*ir(n),ir(e)]}function y(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function m(t){var n=ur(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function M(t,n){Ve.push(qe=[Ee=t,Le=t]),n<$e&&($e=n),n>ze&&(ze=n)}function v(t,n){var e=d([t*tr,n*tr]);if(Ie){var r=y(Ie,e),i=[r[1],-r[0],0],u=y(i,r);m(u),u=p(u);var o,a=t-je,c=a>0?1:-1,l=u[0]*Ke*c,s=nr(a)>180;s^(c*je<l&&l<c*t)?(o=u[1]*Ke)>ze&&(ze=o):(l=(l+360)%360-180,s^(c*je<l&&l<c*t)?(o=-u[1]*Ke)<$e&&($e=o):(n<$e&&($e=n),n>ze&&(ze=n))),s?t<je?k(Ee,t)>k(Ee,Le)&&(Le=t):k(t,Le)>k(Ee,Le)&&(Ee=t):Le>=Ee?(t<Ee&&(Ee=t),t>Le&&(Le=t)):t>je?k(Ee,t)>k(Ee,Le)&&(Le=t):k(t,Le)>k(Ee,Le)&&(Ee=t)}else Ve.push(qe=[Ee=t,Le=t]);n<$e&&($e=n),n>ze&&(ze=n),Ie=e,je=t}function w(){hr.point=v}function b(){qe[0]=Ee,qe[1]=Le,hr.point=M,Ie=null}function x(t,n){if(Ie){var e=t-je;fr.add(nr(e)>180?e+(e>0?360:-360):e)}else Oe=t,Pe=n;sr.point(t,n),v(t,n)}function T(){sr.lineStart()}function C(){x(Oe,Pe),sr.lineEnd(),nr(fr)>Qe&&(Ee=-(Le=180)),qe[0]=Ee,qe[1]=Le,Ie=null}function k(t,n){return(n-=t)<0?n+360:n}function U(t,n){return t[0]-n[0]}function N(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}function S(t){var n,e,r,i,u,o,a;if(ze=Le=-(Ee=$e=1/0),Ve=[],l(t,hr),e=Ve.length){for(Ve.sort(U),n=1,r=Ve[0],u=[r];n<e;++n)i=Ve[n],N(r,i[0])||N(r,i[1])?(k(r[0],i[1])>k(r[0],r[1])&&(r[1]=i[1]),k(i[0],r[1])>k(r[0],r[1])&&(r[0]=i[0])):u.push(r=i);for(o=-1/0,e=u.length-1,n=0,r=u[e];n<=e;r=i,++n)i=u[n],(a=k(r[1],i[0]))>o&&(o=a,Ee=i[0],Le=r[1])}return Ve=qe=null,Ee===1/0||$e===1/0?[[NaN,NaN],[NaN,NaN]]:[[Ee,$e],[Le,ze]]}function D(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function F(t){return function(n,e){return D(t(n),e)}}function A(t,n,e){var r,i,u,o,a=-1;if(n=+n,t=+t,e=+e,t===n&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(o=Y(t,n,e))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),n=Math.floor(n/o),u=new Array(i=Math.ceil(n-t+1));++a<i;)u[a]=(t+a)*o;else for(t=Math.floor(t*o),n=Math.ceil(n*o),u=new Array(i=Math.ceil(t-n+1));++a<i;)u[a]=(t-a)/o;return r&&u.reverse(),u}function Y(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),u=r/Math.pow(10,i);return i>=0?(u>=dr?10:u>=yr?5:u>=mr?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(u>=dr?10:u>=yr?5:u>=mr?2:1)}function H(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),u=r/i;return u>=dr?i*=10:u>=yr?i*=5:u>=mr&&(i*=2),n<t?-i:i}function E(){vr.point=L,vr.lineEnd=$}function $(){vr.point=vr.lineEnd=u}function L(t,n){t*=tr,n*=tr,Ze=t,Re=ir(n),We=rr(n),vr.point=z}function z(t,n){t*=tr,n*=tr;var e=ir(n),r=rr(n),i=nr(t-Ze),u=rr(i),o=ir(i),a=r*o,c=We*e-Re*r*u,l=Re*e+We*r*u;Mr.add(er(ur(a*a+c*c),l)),Ze=t,Re=e,We=r}function j(t){return Mr.reset(),l(t,vr),+Mr}function O(t,n){return wr[0]=t,wr[1]=n,j(br)}function P(){}function I(t,n){var e=new P;if(t instanceof P)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,u=t.length;if(null==n)for(;++i<u;)e.set(i,t[i]);else for(;++i<u;)e.set(n(r=t[i],i,t),r)}else if(t)for(var o in t)e.set(o,t[o]);return e}function V(){}function q(t,n){var e=new V;if(t instanceof V)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}function Z(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function R(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function W(){}function _(t){var n;return t=(t+"").trim().toLowerCase(),(n=Dr.exec(t))?(n=parseInt(n[1],16),new G(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1)):(n=Fr.exec(t))?Q(parseInt(n[1],16)):(n=Ar.exec(t))?new G(n[1],n[2],n[3],1):(n=Yr.exec(t))?new G(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Hr.exec(t))?X(n[1],n[2],n[3],n[4]):(n=Er.exec(t))?X(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=$r.exec(t))?tt(n[1],n[2]/100,n[3]/100,1):(n=Lr.exec(t))?tt(n[1],n[2]/100,n[3]/100,n[4]):zr.hasOwnProperty(t)?Q(zr[t]):"transparent"===t?new G(NaN,NaN,NaN,0):null}function Q(t){return new G(t>>16&255,t>>8&255,255&t,1)}function X(t,n,e,r){return r<=0&&(t=n=e=NaN),new G(t,n,e,r)}function J(t){return t instanceof W||(t=_(t)),t?(t=t.rgb(),new G(t.r,t.g,t.b,t.opacity)):new G}function B(t,n,e,r){return 1===arguments.length?J(t):new G(t,n,e,null==r?1:r)}function G(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function K(t){return t=Math.max(0,Math.min(255,Math.round(t)||0)),(t<16?"0":"")+t.toString(16)}function tt(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new rt(t,n,e,r)}function nt(t){if(t instanceof rt)return new rt(t.h,t.s,t.l,t.opacity);if(t instanceof W||(t=_(t)),!t)return new rt;if(t instanceof rt)return t;t=t.rgb();var n=t.r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),u=Math.max(n,e,r),o=NaN,a=u-i,c=(u+i)/2;return a?(o=n===u?(e-r)/a+6*(e<r):e===u?(r-n)/a+2:(n-e)/a+4,a/=c<.5?u+i:2-u-i,o*=60):a=c>0&&c<1?0:o,new rt(o,a,c,t.opacity)}function et(t,n,e,r){return 1===arguments.length?nt(t):new rt(t,n,e,null==r?1:r)}function rt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function it(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}function ut(t){if(t instanceof at)return new at(t.l,t.a,t.b,t.opacity);if(t instanceof pt){if(isNaN(t.h))return new at(t.l,0,0,t.opacity);var n=t.h*jr;return new at(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof G||(t=J(t));var e,r,i=ft(t.r),u=ft(t.g),o=ft(t.b),a=ct((.2225045*i+.7168786*u+.0606169*o)/Ir);return i===u&&u===o?e=r=a:(e=ct((.4360747*i+.3850649*u+.1430804*o)/Pr),r=ct((.0139322*i+.0971045*u+.7141733*o)/Vr)),new at(116*a-16,500*(e-a),200*(a-r),t.opacity)}function ot(t,n,e,r){return 1===arguments.length?ut(t):new at(t,n,e,null==r?1:r)}function at(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function ct(t){return t>Wr?Math.pow(t,1/3):t/Rr+qr}function lt(t){return t>Zr?t*t*t:Rr*(t-qr)}function st(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function ft(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ht(t){if(t instanceof pt)return new pt(t.h,t.c,t.l,t.opacity);if(t instanceof at||(t=ut(t)),0===t.a&&0===t.b)return new pt(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Or;return new pt(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function gt(t,n,e,r){return 1===arguments.length?ht(t):new pt(t,n,e,null==r?1:r)}function pt(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function dt(t){if(t instanceof mt)return new mt(t.h,t.s,t.l,t.opacity);t instanceof G||(t=J(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(ti*r+Gr*n-Kr*e)/(ti+Gr-Kr),u=r-i,o=(Br*(e-i)-Xr*u)/Jr,a=Math.sqrt(o*o+u*u)/(Br*i*(1-i)),c=a?Math.atan2(o,u)*Or-120:NaN;return new mt(c<0?c+360:c,a,i,t.opacity)}function yt(t,n,e,r){return 1===arguments.length?dt(t):new mt(t,n,e,null==r?1:r)}function mt(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Mt(t){return function(){return t}}function vt(t,n){return function(e){return t+e*n}}function wt(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}function bt(t){return 1==(t=+t)?xt:function(n,e){return e-n?wt(n,e,t):Mt(isNaN(n)?e:n)}}function xt(t,n){var e=n-t;return e?vt(t,e):Mt(isNaN(t)?n:t)}function Tt(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,u=new Array(i),o=new Array(r);for(e=0;e<i;++e)u[e]=Ft(t[e],n[e]);for(;e<r;++e)o[e]=n[e];return function(t){for(e=0;e<i;++e)o[e]=u[e](t);return o}}function Ct(t,n){var e=new Date;return t=+t,n-=t,function(r){return e.setTime(t+n*r),e}}function kt(t,n){return t=+t,n-=t,function(e){return t+n*e}}function Ut(t,n){var e,r={},i={};null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={});for(e in n)e in t?r[e]=Ft(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}function Nt(t){return function(){return t}}function St(t){return function(n){return t(n)+""}}function Dt(t,n){var e,r,i,u=ei.lastIndex=ri.lastIndex=0,o=-1,a=[],c=[];for(t+="",n+="";(e=ei.exec(t))&&(r=ri.exec(n));)(i=r.index)>u&&(i=n.slice(u,i),a[o]?a[o]+=i:a[++o]=i),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,c.push({i:o,x:kt(e,r)})),u=ri.lastIndex;return u<n.length&&(i=n.slice(u),a[o]?a[o]+=i:a[++o]=i),a.length<2?c[0]?St(c[0].x):Nt(n):(n=c.length,function(t){for(var e,r=0;r<n;++r)a[(e=c[r]).i]=e.x(t);return a.join("")})}function Ft(t,n){var e,r=typeof n;return null==n||"boolean"===r?Mt(n):("number"===r?kt:"string"===r?(e=_(n))?(n=e,ni):Dt:n instanceof _?ni:n instanceof Date?Ct:Array.isArray(n)?Tt:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Ut:kt)(t,n)}function At(t,n){return t=+t,n-=t,function(e){return Math.round(t+n*e)}}function Yt(t){return function(){return t}}function Ht(t){return+t}function Et(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:Yt(n)}function $t(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=n?0:t>=e?1:r(t)}}}function Lt(t){return function(n,e){var r=t(n=+n,e=+e);return function(t){return t<=0?n:t>=1?e:r(t)}}}function zt(t,n,e,r){var i=t[0],u=t[1],o=n[0],a=n[1];return u<i?(i=e(u,i),o=r(a,o)):(i=e(i,u),o=r(o,a)),function(t){return o(i(t))}}function jt(t,n,e,r){var i=Math.min(t.length,n.length)-1,u=new Array(i),o=new Array(i),a=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<i;)u[a]=e(t[a],t[a+1]),o[a]=r(n[a],n[a+1]);return function(n){var e=pr(t,n,1,i)-1;return o[e](u[e](n))}}function Ot(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp())}function Pt(t,n){function e(){return i=Math.min(a.length,c.length)>2?jt:zt,u=o=null,r}function r(n){return(u||(u=i(a,c,s?$t(t):t,l)))(+n)}var i,u,o,a=ii,c=ii,l=Ft,s=!1;return r.invert=function(t){return(o||(o=i(c,a,Et,s?Lt(n):n)))(+t)},r.domain=function(t){return arguments.length?(a=Cr.call(t,Ht),e()):a.slice()},r.range=function(t){return arguments.length?(c=kr.call(t),e()):c.slice()},r.rangeRound=function(t){return c=kr.call(t),l=At,e()},r.clamp=function(t){return arguments.length?(s=!!t,e()):s},r.interpolate=function(t){return arguments.length?(l=t,e()):l},e()}function It(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Vt(t){return t=It(Math.abs(t)),t?t[1]:NaN}function qt(t,n){return function(e,r){for(var i=e.length,u=[],o=0,a=t[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),u.push(e.substring(i-=a,i+a)),!((c+=a+1)>r));)a=t[o=(o+1)%t.length];return u.reverse().join(n)}}function Zt(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}function Rt(t){return new Wt(t)}function Wt(t){if(!(n=ui.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}function _t(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}function Qt(t,n){var e=It(t,n);if(!e)return t+"";var r=e[0],i=e[1],u=i-(oi=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return u===o?r:u>o?r+new Array(u-o+1).join("0"):u>0?r.slice(0,u)+"."+r.slice(u):"0."+new Array(1-u).join("0")+It(t,Math.max(0,n+u-1))[0]}function Xt(t,n){var e=It(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}function Jt(t){return t}function Bt(t){function n(t){function n(t){var n,i,a,s=m,b=M;if("c"===y)b=v(t)+b,t="";else{t=+t;var x=t<0;if(t=v(Math.abs(t),p),d&&(t=_t(t)),x&&0==+t&&(x=!1),s=(x?"("===l?l:"-":"-"===l||"("===l?"":l)+s,b=("s"===y?fi[8+oi/3]:"")+b+(x&&"("===l?")":""),w)for(n=-1,i=t.length;++n<i;)if(48>(a=t.charCodeAt(n))||a>57){b=(46===a?u+t.slice(n+1):t.slice(n))+b,t=t.slice(0,n);break}}g&&!f&&(t=r(t,1/0));var T=s.length+t.length+b.length,C=T<h?new Array(h-T+1).join(e):"";switch(g&&f&&(t=r(C+t,C.length?h-b.length:1/0),C=""),c){case"<":t=s+t+b+C;break;case"=":t=s+C+t+b;break;case"^":t=C.slice(0,T=C.length>>1)+s+t+b+C.slice(T);break;default:t=C+s+t+b}return o(t)}t=Rt(t);var e=t.fill,c=t.align,l=t.sign,s=t.symbol,f=t.zero,h=t.width,g=t.comma,p=t.precision,d=t.trim,y=t.type;"n"===y?(g=!0,y="g"):si[y]||(null==p&&(p=12),d=!0,y="g"),(f||"0"===e&&"="===c)&&(f=!0,e="0",c="=");var m="$"===s?i[0]:"#"===s&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",M="$"===s?i[1]:/[%p]/.test(y)?a:"",v=si[y],w=/[defgprs%]/.test(y);return p=null==p?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,p)):Math.max(0,Math.min(20,p)),n.toString=function(){return t+""},n}function e(t,e){var r=n((t=Rt(t),t.type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(Vt(e)/3))),u=Math.pow(10,-i),o=fi[8+i/3];return function(t){return r(u*t)+o}}var r=t.grouping&&t.thousands?qt(t.grouping,t.thousands):Jt,i=t.currency,u=t.decimal,o=t.numerals?Zt(t.numerals):Jt,a=t.percent||"%";return{format:n,formatPrefix:e}}function Gt(t){return Math.max(0,-Vt(Math.abs(t)))}function Kt(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vt(n)/3)))-Vt(Math.abs(t)))}function tn(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Vt(n)-Vt(t))+1}function nn(t,n,e){var r,i=t[0],u=t[t.length-1],o=H(i,u,null==n?10:n);switch(e=Rt(null==e?",f":e),e.type){case"s":var a=Math.max(Math.abs(i),Math.abs(u));return null!=e.precision||isNaN(r=Kt(o,a))||(e.precision=r),li(e,a);case"":case"e":case"g":case"p":case"r":null!=e.precision||isNaN(r=tn(o,Math.max(Math.abs(i),Math.abs(u))))||(e.precision=r-("e"===e.type));break;case"f":case"%":null!=e.precision||isNaN(r=Gt(o))||(e.precision=r-2*("%"===e.type))}return ci(e)}function en(t){var n=t.domain;return t.ticks=function(t){var e=n();return A(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){return nn(n(),t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),u=0,o=i.length-1,a=i[u],c=i[o];return c<a&&(r=a,a=c,c=r,r=u,u=o,o=r),r=Y(a,c,e),r>0?(a=Math.floor(a/r)*r,c=Math.ceil(c/r)*r,r=Y(a,c,e)):r<0&&(a=Math.ceil(a*r)/r,c=Math.floor(c*r)/r,r=Y(a,c,e)),r>0?(i[u]=Math.floor(a/r)*r,i[o]=Math.ceil(c/r)*r,n(i)):r<0&&(i[u]=Math.ceil(a*r)/r,i[o]=Math.floor(c*r)/r,n(i)),t},t}function rn(){var t=Pt(Et,kt);return t.copy=function(){return Ot(t,rn())},en(t)}function un(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,u){var o,a=[];if(e=i.ceil(e),u=null==u?1:Math.floor(u),!(e<r&&u>0))return a;do{a.push(o=new Date(+e)),n(e,u),t(e)}while(o<e&&e<r);return a},i.filter=function(e){return un(function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return hi.setTime(+n),gi.setTime(+r),t(hi),t(gi),Math.floor(e(hi,gi))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}function on(t){return un(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*di)/yi})}function an(t){return un(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/yi})}function cn(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function ln(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function sn(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}function fn(t){function n(t,n){return function(e){var r,i,u,o=[],a=-1,c=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++a<l;)37===t.charCodeAt(a)&&(o.push(t.slice(c,a)),null!=(i=Oi[r=t.charAt(++a)])?r=t.charAt(++a):i="e"===r?" ":"0",(u=n[r])&&(r=u(e,i)),o.push(r),c=a+1);return o.push(t.slice(c,a)),o.join("")}}function e(t,n){return function(e){var i,u,o=sn(1900),a=r(o,t,e+="",0);if(a!=e.length)return null;if("Q"in o)return new Date(o.Q);if("p"in o&&(o.H=o.H%12+12*o.p),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=ln(sn(o.y)),u=i.getUTCDay(),i=u>4||0===u?Fi.ceil(i):Fi(i),i=Si.offset(i,7*(o.V-1)),o.y=i.getUTCFullYear(),o.m=i.getUTCMonth(),o.d=i.getUTCDate()+(o.w+6)%7):(i=n(sn(o.y)),u=i.getDay(),i=u>4||0===u?xi.ceil(i):xi(i),i=wi.offset(i,7*(o.V-1)),o.y=i.getFullYear(),o.m=i.getMonth(),o.d=i.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),u="Z"in o?ln(sn(o.y)).getUTCDay():n(sn(o.y)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(u+5)%7:o.w+7*o.U-(u+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,ln(o)):n(o)}}function r(t,n,e,r){for(var i,u,o=0,a=n.length,c=e.length;o<a;){if(r>=c)return-1;if(37===(i=n.charCodeAt(o++))){if(i=n.charAt(o++),!(u=V[i in Oi?n.charAt(o++):i])||(r=u(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function i(t,n,e){var r=F.exec(n.slice(e));return r?(t.p=A[r[0].toLowerCase()],e+r[0].length):-1}function u(t,n,e){var r=E.exec(n.slice(e));return r?(t.w=$[r[0].toLowerCase()],e+r[0].length):-1}function o(t,n,e){var r=Y.exec(n.slice(e));return r?(t.w=H[r[0].toLowerCase()],e+r[0].length):-1}function a(t,n,e){var r=j.exec(n.slice(e));return r?(t.m=O[r[0].toLowerCase()],e+r[0].length):-1}function c(t,n,e){var r=L.exec(n.slice(e));return r?(t.m=z[r[0].toLowerCase()],e+r[0].length):-1}function l(t,n,e){return r(t,x,n,e)}function s(t,n,e){return r(t,T,n,e)}function f(t,n,e){return r(t,C,n,e)}function h(t){return N[t.getDay()]}function g(t){return U[t.getDay()]}function p(t){return D[t.getMonth()]}function d(t){return S[t.getMonth()]}function y(t){return k[+(t.getHours()>=12)]}function m(t){return N[t.getUTCDay()]}function M(t){return U[t.getUTCDay()]}function v(t){return D[t.getUTCMonth()]}function w(t){return S[t.getUTCMonth()]}function b(t){return k[+(t.getUTCHours()>=12)]}var x=t.dateTime,T=t.date,C=t.time,k=t.periods,U=t.days,N=t.shortDays,S=t.months,D=t.shortMonths,F=pn(k),A=dn(k),Y=pn(U),H=dn(U),E=pn(N),$=dn(N),L=pn(S),z=dn(S),j=pn(D),O=dn(D),P={a:h,A:g,b:p,B:d,c:null,d:$n,e:$n,f:Pn,H:Ln,I:zn,j:jn,L:On,m:In,M:Vn,p:y,Q:ye,s:me,S:qn,u:Zn,U:Rn,V:Wn,w:_n,W:Qn,x:null,X:null,y:Xn,Y:Jn,Z:Bn,"%":de},I={a:m,A:M,b:v,B:w,c:null,d:Gn,e:Gn,f:re,H:Kn,I:te,j:ne,L:ee,m:ie,M:ue,p:b,Q:ye,s:me,S:oe,u:ae,U:ce,V:le,w:se,W:fe,x:null,X:null,y:he,Y:ge,Z:pe,"%":de},V={a:u,A:o,b:a,B:c,c:l,d:kn,e:kn,f:An,H:Nn,I:Nn,j:Un,L:Fn,m:Cn,M:Sn,p:i,Q:Hn,s:En,S:Dn,u:mn,U:Mn,V:vn,w:yn,W:wn,x:s,X:f,y:xn,Y:bn,Z:Tn,"%":Yn};return P.x=n(T,P),P.X=n(C,P),P.c=n(x,P),I.x=n(T,I),I.X=n(C,I),I.c=n(x,I),{format:function(t){var e=n(t+="",P);return e.toString=function(){return t},e},parse:function(t){var n=e(t+="",cn);return n.toString=function(){return t},n},utcFormat:function(t){var e=n(t+="",I);return e.toString=function(){return t},e},utcParse:function(t){var n=e(t,ln);return n.toString=function(){return t},n}}}function hn(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",u=i.length;return r+(u<e?new Array(e-u+1).join(n)+i:i)}function gn(t){return t.replace(Vi,"\\$&")}function pn(t){return new RegExp("^(?:"+t.map(gn).join("|")+")","i")}function dn(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function yn(t,n,e){var r=Pi.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function mn(t,n,e){var r=Pi.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Mn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function vn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function wn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function bn(t,n,e){var r=Pi.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function xn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Tn(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Cn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function kn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Un(t,n,e){var r=Pi.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Nn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Sn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Dn(t,n,e){var r=Pi.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Fn(t,n,e){var r=Pi.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function An(t,n,e){var r=Pi.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Yn(t,n,e){var r=Ii.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Hn(t,n,e){var r=Pi.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function En(t,n,e){var r=Pi.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function $n(t,n){return hn(t.getDate(),n,2)}function Ln(t,n){return hn(t.getHours(),n,2)}function zn(t,n){return hn(t.getHours()%12||12,n,2)}function jn(t,n){return hn(1+wi.count(ki(t),t),n,3)}function On(t,n){return hn(t.getMilliseconds(),n,3)}function Pn(t,n){return On(t,n)+"000"}function In(t,n){return hn(t.getMonth()+1,n,2)}function Vn(t,n){return hn(t.getMinutes(),n,2)}function qn(t,n){return hn(t.getSeconds(),n,2)}function Zn(t){var n=t.getDay();return 0===n?7:n}function Rn(t,n){return hn(bi.count(ki(t),t),n,2)}function Wn(t,n){var e=t.getDay();return t=e>=4||0===e?Ti(t):Ti.ceil(t),hn(Ti.count(ki(t),t)+(4===ki(t).getDay()),n,2)}function _n(t){return t.getDay()}function Qn(t,n){return hn(xi.count(ki(t),t),n,2)}function Xn(t,n){return hn(t.getFullYear()%100,n,2)}function Jn(t,n){return hn(t.getFullYear()%1e4,n,4)}function Bn(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+hn(n/60|0,"0",2)+hn(n%60,"0",2)}function Gn(t,n){return hn(t.getUTCDate(),n,2)}function Kn(t,n){return hn(t.getUTCHours(),n,2)}function te(t,n){return hn(t.getUTCHours()%12||12,n,2)}function ne(t,n){return hn(1+Si.count(Hi(t),t),n,3)}function ee(t,n){return hn(t.getUTCMilliseconds(),n,3)}function re(t,n){return ee(t,n)+"000"}function ie(t,n){return hn(t.getUTCMonth()+1,n,2)}function ue(t,n){return hn(t.getUTCMinutes(),n,2)}function oe(t,n){return hn(t.getUTCSeconds(),n,2)}function ae(t){var n=t.getUTCDay();return 0===n?7:n}function ce(t,n){return hn(Di.count(Hi(t),t),n,2)}function le(t,n){var e=t.getUTCDay();return t=e>=4||0===e?Ai(t):Ai.ceil(t),hn(Ai.count(Hi(t),t)+(4===Hi(t).getUTCDay()),n,2)}function se(t){return t.getUTCDay()}function fe(t,n){return hn(Fi.count(Hi(t),t),n,2)}function he(t,n){return hn(t.getUTCFullYear()%100,n,2)}function ge(t,n){return hn(t.getUTCFullYear()%1e4,n,4)}function pe(){return"+0000"}function de(){return"%"}function ye(t){return+t}function me(t){return Math.floor(+t/1e3)}function Me(t){return t.toISOString()}function ve(t){var n=new Date(t);return isNaN(n)?null:n}function we(t){return t}function be(t){return"translate("+(t+.5)+",0)"}function xe(t){return"translate(0,"+(t+.5)+")"}function Te(t){return function(n){return+t(n)}}function Ce(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}function ke(){return!this.__axis}function Ue(t,n){function e(e){var h=null==i?n.ticks?n.ticks.apply(n,r):n.domain():i,g=null==u?n.tickFormat?n.tickFormat.apply(n,r):we:u,p=Math.max(o,0)+c,d=n.range(),y=+d[0]+.5,m=+d[d.length-1]+.5,M=(n.bandwidth?Ce:Te)(n.copy()),v=e.selection?e.selection():e,w=v.selectAll(".domain").data([null]),b=v.selectAll(".tick").data(h,n).order(),x=b.exit(),T=b.enter().append("g").attr("class","tick"),C=b.select("line"),k=b.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","#000")),b=b.merge(T),C=C.merge(T.append("line").attr("stroke","#000").attr(s+"2",l*o)),k=k.merge(T.append("text").attr("fill","#000").attr(s,l*p).attr("dy",t===Zi?"0em":t===Wi?"0.71em":"0.32em")),e!==v&&(w=w.transition(e),b=b.transition(e),C=C.transition(e),k=k.transition(e),x=x.transition(e).attr("opacity",Qi).attr("transform",function(t){return isFinite(t=M(t))?f(t):this.getAttribute("transform")}),T.attr("opacity",Qi).attr("transform",function(t){var n=this.parentNode.__axis;return f(n&&isFinite(n=n(t))?n:M(t))})),x.remove(),w.attr("d",t===_i||t==Ri?"M"+l*a+","+y+"H0.5V"+m+"H"+l*a:"M"+y+","+l*a+"V0.5H"+m+"V"+l*a),b.attr("opacity",1).attr("transform",function(t){return f(M(t))}),C.attr(s+"2",l*o),k.attr(s,l*p).text(g),v.filter(ke).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Ri?"start":t===_i?"end":"middle"),v.each(function(){this.__axis=M})}var r=[],i=null,u=null,o=6,a=6,c=3,l=t===Zi||t===_i?-1:1,s=t===_i||t===Ri?"x":"y",f=t===Zi||t===Wi?be:xe;return e.scale=function(t){return arguments.length?(n=t,e):n},e.ticks=function(){return r=qi.call(arguments),e},e.tickArguments=function(t){return arguments.length?(r=null==t?[]:qi.call(t),e):r.slice()},e.tickValues=function(t){return arguments.length?(i=null==t?null:qi.call(t),e):i&&i.slice()},e.tickFormat=function(t){return arguments.length?(u=t,e):u},e.tickSize=function(t){return arguments.length?(o=a=+t,e):o},e.tickSizeInner=function(t){return arguments.length?(o=+t,e):o},e.tickSizeOuter=function(t){return arguments.length?(a=+t,e):a},e.tickPadding=function(t){return arguments.length?(c=+t,e):c},e}function Ne(t){return Ue(Wi,t)}function Se(){function t(t){var v=S(u),w=i([0,v[0][1]]),b=i([0,v[1][1]]),x=Math.abs(w[1]-b[1]),T=Math.abs((v[1][1]-v[0][1])*d),C=[v[0][0],T],k=[v[1][0],T],U=O(C,k),N=U*m,D=i(C),F=i(k),A=F[0]-D[0];o=o||Math.pow(10,n(N)-1);var Y=o/N,H=Y*A,E=Math.min(w[1],b[1])+x*d,$=Math.min(D[0],F[0])+A*p;t.attr("width",r[0]).attr("height",r[1]),h=h||rn(),h.range([0,H]).domain([0,o]),1!==M&&h.domain([0,h.invert(H/M)]),f=f||Ne();var L=h.domain()[1]/o*o;f.scale(h).tickValues(a||[0,L/4,L/2,L]).tickSize(g),l=l||t.append("g").attr("class","scale-bar"),l.attr("transform","translate("+$+", "+(E+14)+")").call(f);var z=l.selectAll("rect").data(f.tickValues().map(function(t,n,e){return[t,e[n+1]]}).filter(function(t,n,e){return n!==e.length-1}));z.exit().remove(),z.enter().append("rect").attr("height",g).style("stroke","#000").style("fill",function(t,n){return n%2==0?"#000":"#fff"}).merge(z).attr("x",function(t){return h(t[0])}).attr("width",function(t){return h(t[1]-t[0])}),s=s||l.append("text").attr("class","label").style("fill","#000").style("text-anchor","start").style("font-size","12px").attr("y",-4),s.text(c||e(y))}function n(t){return Math.floor(t).toString().length}function e(t){return t.charAt(0).toUpperCase()+t.slice(1)}var r,i,u,o,a,c,l,s,f,h,g=4,p=0,d=0,y="kilometers",m=6371,M=1,v={miles:{radius:3959},kilometers:{radius:6371}};return t.fitSize=function(n,e){return r=n,u=e,t},t.extent=function(n){return arguments.length?(r=n,t):r},t.feature=function(n){return arguments.length?(u=n,t):u},t.projection=function(n){return arguments.length?(i=n,t):i},t.units=function(n){return arguments.length?(y=n,Object.keys(v).includes(n)&&(m=v[n].radius),t):y},t.distance=function(n){return arguments.length?(o=+n,t):o},t.radius=function(n){return arguments.length?(m=+n,t):m},t.tickValues=function(n){return arguments.length?(a=n,t):a},t.label=function(n){return arguments.length?(c=n,t):c},t.height=function(n){return arguments.length?(g=+n,t):g},t.left=function(n){return arguments.length?(p=n>1?1:n<0?0:+n,t):p},t.top=function(n){return arguments.length?(d=n>1?1:n<0?0:+n,t):d},t.scaleFactor=function(n){return arguments.length?(M=n,t):M},t}e.prototype={constructor:e,reset:function(){this.s=this.t=0},add:function(t){r(_e,t,this.t),r(this,_e.s,this.s),this.s?this.t+=_e.t:this.s=_e.t},valueOf:function(){return this.s}};var De,Fe,Ae,Ye,He,Ee,$e,Le,ze,je,Oe,Pe,Ie,Ve,qe,Ze,Re,We,_e=new e,Qe=1e-6,Xe=Math.PI,Je=Xe/2,Be=Xe/4,Ge=2*Xe,Ke=180/Xe,tr=Xe/180,nr=Math.abs,er=Math.atan2,rr=Math.cos,ir=Math.sin,ur=Math.sqrt,or={Feature:function(t,n){o(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)o(e[r].geometry,n)}},ar={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){a(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)a(e[r],n,0)},Polygon:function(t,n){c(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)c(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)o(e[r],n)}},cr=n(),lr=n(),sr={point:u,lineStart:u,lineEnd:u,polygonStart:function(){cr.reset(),sr.lineStart=s,sr.lineEnd=f},polygonEnd:function(){var t=+cr;lr.add(t<0?Ge+t:t),this.lineStart=this.lineEnd=this.point=u},sphere:function(){lr.add(Ge)}},fr=n(),hr={point:M,lineStart:w,lineEnd:b,polygonStart:function(){hr.point=x,hr.lineStart=T,hr.lineEnd=C,fr.reset(),sr.polygonStart()},polygonEnd:function(){sr.polygonEnd(),hr.point=M,hr.lineStart=w,hr.lineEnd=b,cr<0?(Ee=-(Le=180),$e=-(ze=90)):fr>Qe?ze=90:fr<-Qe&&($e=-90),qe[0]=Ee,qe[1]=Le}},gr=(n(),function(t){return 1===t.length&&(t=F(t)),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var u=r+i>>>1;t(n[u],e)<0?r=u+1:i=u}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var u=r+i>>>1;t(n[u],e)>0?i=u:r=u+1}return r}}}(D)),pr=gr.right,dr=Math.sqrt(50),yr=Math.sqrt(10),mr=Math.sqrt(2),Mr=n(),vr={sphere:u,point:u,lineStart:E,lineEnd:u,polygonStart:u,polygonEnd:u},wr=[null,null],br={type:"LineString",coordinates:wr};n(),n(),n();P.prototype=I.prototype={constructor:P,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var xr=I.prototype;V.prototype=q.prototype={constructor:V,has:xr.has,add:function(t){return t+="",this["$"+t]=t,this},remove:xr.remove,clear:xr.clear,values:xr.keys,
size:xr.size,empty:xr.empty,each:xr.each};var Tr=Array.prototype,Cr=Tr.map,kr=Tr.slice,Ur="\\s*([+-]?\\d+)\\s*",Nr="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Sr="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Dr=/^#([0-9a-f]{3})$/,Fr=/^#([0-9a-f]{6})$/,Ar=new RegExp("^rgb\\("+[Ur,Ur,Ur]+"\\)$"),Yr=new RegExp("^rgb\\("+[Sr,Sr,Sr]+"\\)$"),Hr=new RegExp("^rgba\\("+[Ur,Ur,Ur,Nr]+"\\)$"),Er=new RegExp("^rgba\\("+[Sr,Sr,Sr,Nr]+"\\)$"),$r=new RegExp("^hsl\\("+[Nr,Sr,Sr]+"\\)$"),Lr=new RegExp("^hsla\\("+[Nr,Sr,Sr,Nr]+"\\)$"),zr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Z(W,_,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),Z(G,B,R(W,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new G(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new G(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+K(this.r)+K(this.g)+K(this.b)},toString:function(){var t=this.opacity;return t=isNaN(t)?1:Math.max(0,Math.min(1,t)),(1===t?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),Z(rt,et,R(W,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new rt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new rt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new G(it(t>=240?t-240:t+120,i,r),it(t,i,r),it(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var jr=Math.PI/180,Or=180/Math.PI,Pr=.96422,Ir=1,Vr=.82521,qr=4/29,Zr=6/29,Rr=3*Zr*Zr,Wr=Zr*Zr*Zr;Z(at,ot,R(W,{brighter:function(t){return new at(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new at(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return n=Pr*lt(n),t=Ir*lt(t),e=Vr*lt(e),new G(st(3.1338561*n-1.6168667*t-.4906146*e),st(-.9787684*n+1.9161415*t+.033454*e),st(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Z(pt,gt,R(W,{brighter:function(t){return new pt(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new pt(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return ut(this).rgb()}}));var _r=-.14861,Qr=1.78277,Xr=-.29227,Jr=-.90649,Br=1.97294,Gr=Br*Jr,Kr=Br*Qr,ti=Qr*Xr-Jr*_r;Z(mt,yt,R(W,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new mt(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new mt(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*jr,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new G(255*(n+e*(_r*r+Qr*i)),255*(n+e*(Xr*r+Jr*i)),255*(n+e*(Br*r)),this.opacity)}}));var ni=function t(n){function e(t,n){var e=r((t=B(t)).r,(n=B(n)).r),i=r(t.g,n.g),u=r(t.b,n.b),o=xt(t.opacity,n.opacity);return function(n){return t.r=e(n),t.g=i(n),t.b=u(n),t.opacity=o(n),t+""}}var r=bt(n);return e.gamma=t,e}(1),ei=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ri=new RegExp(ei.source,"g"),ii=(Math.PI,Math.SQRT2,[0,1]),ui=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;Rt.prototype=Wt.prototype,Wt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var oi,ai,ci,li,si={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Xt(100*t,n)},r:Xt,s:Qt,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},fi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];!function(t){ai=Bt(t),ci=ai.format,li=ai.formatPrefix}({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var hi=new Date,gi=new Date,pi=un(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});pi.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?un(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):pi:null};var di=(pi.range,6e4),yi=6048e5,mi=un(function(t){t.setTime(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),Mi=(mi.range,un(function(t){t.setTime(Math.floor(t/di)*di)},function(t,n){t.setTime(+t+n*di)},function(t,n){return(n-t)/di},function(t){return t.getMinutes()})),vi=(Mi.range,un(function(t){var n=t.getTimezoneOffset()*di%36e5;n<0&&(n+=36e5),t.setTime(36e5*Math.floor((+t-n)/36e5)+n)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()})),wi=(vi.range,un(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*di)/864e5},function(t){return t.getDate()-1})),bi=(wi.range,on(0)),xi=on(1),Ti=(on(2),on(3),on(4)),Ci=(on(5),on(6),bi.range,xi.range,Ti.range,un(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()})),ki=(Ci.range,un(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()}));ki.every=function(t){return isFinite(t=Math.floor(t))&&t>0?un(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};var Ui=(ki.range,un(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*di)},function(t,n){return(n-t)/di},function(t){return t.getUTCMinutes()})),Ni=(Ui.range,un(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()})),Si=(Ni.range,un(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1})),Di=(Si.range,an(0)),Fi=an(1),Ai=(an(2),an(3),an(4)),Yi=(an(5),an(6),Di.range,Fi.range,Ai.range,un(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()})),Hi=(Yi.range,un(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()}));Hi.every=function(t){return isFinite(t=Math.floor(t))&&t>0?un(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};var Ei,$i,Li,zi,ji,Oi=(Hi.range,{"-":"",_:" ",0:"0"}),Pi=/^\s*\d+/,Ii=/^%/,Vi=/[\\^$*+?|[\]().{}]/g;!function(t){Ei=fn(t),$i=Ei.format,Li=Ei.parse,zi=Ei.utcFormat,ji=Ei.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var qi=(Date.prototype.toISOString||zi("%Y-%m-%dT%H:%M:%S.%LZ"),+new Date("2000-01-01T00:00:00.000Z")||ji("%Y-%m-%dT%H:%M:%S.%LZ"),Array.prototype.slice),Zi=1,Ri=2,Wi=3,_i=4,Qi=1e-6;t.geoScaleBar=Se,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3=t.d3||{})}(this,function(t){"use strict";function n(t){return"translate("+(t+.5)+",0)"}function r(t){return function(n){return+t(n)}}function e(){return!this.__axis}function i(t,i){function o(t){var n=null==u?i.ticks?i.ticks.apply(i,a):i.domain():u,o=null==c?i.tickFormat?i.tickFormat.apply(i,a):function(t){return t}:c,d=Math.max(l,0)+f,m=i.range(),v=+m[0]+.5,M=+m[m.length-1]+.5,y=r(i.copy()),x=t.selection?t.selection():t,b=x.selectAll(".domain").data([null]),k=x.selectAll(".tick").data(n,i).order(),w=k.exit(),N=k.enter().append("g").attr("class","tick"),S=k.select("line"),A=k.select("text");b=b.merge(b.enter().insert("path",".tick").attr("class","domain").attr("stroke","#000")),k=k.merge(N),S=S.merge(N.append("line").attr("stroke","#000").attr(g+"2",h*l)),A=A.merge(N.append("text").attr("fill","#000").attr(g,h*d).attr("dy","0.71em")),t!==x&&(b=b.transition(t),k=k.transition(t),S=S.transition(t),A=A.transition(t),w=w.transition(t).attr("opacity",it).attr("transform",function(t){return isFinite(t=y(t))?p(t):this.getAttribute("transform")}),N.attr("opacity",it).attr("transform",function(t){var n=this.parentNode.__axis;return p(n&&isFinite(n=n(t))?n:y(t))})),w.remove(),b.attr("d",s?"M"+v+","+h*s+"V0.5H"+M+"V"+h*s:"M"+v+",0.5H"+M),k.attr("opacity",1).attr("transform",function(t){return p(y(t))}),S.attr(g+"2",h*l),A.attr(g,h*d).text(o),x.filter(e).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor","middle"),x.each(function(){this.__axis=y})}var a=[],u=null,c=null,l=6,s=6,f=3,h=1,g="y",p=n;return o.scale=function(t){return arguments.length?(i=t,o):i},o.ticks=function(){return a=rt.call(arguments),o},o.tickArguments=function(t){return arguments.length?(a=null==t?[]:rt.call(t),o):a.slice()},o.tickValues=function(t){return arguments.length?(u=null==t?null:rt.call(t),o):u&&u.slice()},o.tickFormat=function(t){return arguments.length?(c=t,o):c},o.tickSize=function(t){return arguments.length?(l=s=+t,o):l},o.tickSizeInner=function(t){return arguments.length?(l=+t,o):l},o.tickSizeOuter=function(t){return arguments.length?(s=+t,o):s},o.tickPadding=function(t){return arguments.length?(f=+t,o):f},o}function o(t){return i(et,t)}function a(){this.reset()}function u(t,n,r){var e=t.s=n+r,i=e-n,o=e-i;t.t=n-o+(r-i)}function c(){}function l(t,n){t&&mt.hasOwnProperty(t.type)&&mt[t.type](t,n)}function s(t,n,r){var e,i=-1,o=t.length-r;for(n.lineStart();++i<o;)e=t[i],n.point(e[0],e[1],e[2]);n.lineEnd()}function f(t,n){var r=-1,e=t.length;for(n.polygonStart();++r<e;)s(t[r],n,1);n.polygonEnd()}function h(t,n){t&&dt.hasOwnProperty(t.type)?dt[t.type](t,n):l(t,n)}function g(){Mt.point=d,Mt.lineEnd=p}function p(){Mt.point=Mt.lineEnd=c}function d(t,n){t*=ht,n*=ht,ot=t,at=gt(n),ut=ft(n),Mt.point=m}function m(t,n){t*=ht,n*=ht;var r=gt(n),e=ft(n),i=lt(t-ot),o=ft(i),a=gt(i),u=e*a,c=ut*r-at*e*o,l=at*r+ut*e*o;vt.add(st(pt(u*u+c*c),l)),ot=t,at=r,ut=e}function v(t){return vt.reset(),h(t,Mt),+vt}function M(t,n){return yt[0]=t,yt[1]=n,v(xt)}function y(t,n,r){var e,i,o,a,u=-1;if(n=+n,t=+t,r=+r,t===n&&r>0)return[t];if((e=n<t)&&(i=t,t=n,n=i),0===(a=x(t,n,r))||!isFinite(a))return[];if(a>0)for(t=Math.ceil(t/a),n=Math.floor(n/a),o=new Array(i=Math.ceil(n-t+1));++u<i;)o[u]=(t+u)*a;else for(t=Math.floor(t*a),n=Math.ceil(n*a),o=new Array(i=Math.ceil(t-n+1));++u<i;)o[u]=(t-u)/a;return e&&o.reverse(),o}function x(t,n,r){var e=(n-t)/Math.max(0,r),i=Math.floor(Math.log(e)/Math.LN10),o=e/Math.pow(10,i);return i>=0?(o>=bt?10:o>=kt?5:o>=wt?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=bt?10:o>=kt?5:o>=wt?2:1)}function b(t,n,r){var e=Math.abs(n-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),o=e/i;return o>=bt?i*=10:o>=kt?i*=5:o>=wt&&(i*=2),n<t?-i:i}function k(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function w(t){return function(n,r){return k(t(n),r)}}function N(t,n){return t=+t,n=+n,function(r){return t*(1-r)+n*r}}function S(t,n){return t=+t,n=+n,function(r){return Math.round(t*(1-r)+n*r)}}function A(t,n){return N(t,n)}function z(t){return function(){return t}}function P(t){return+t}function F(t){return t}function E(t,n){return(n-=t=+t)?function(r){return(r-t)/n}:z(isNaN(n)?NaN:.5)}function j(t,n){var r;return t>n&&(r=t,t=n,n=r),function(r){return Math.max(t,Math.min(n,r))}}function _(t,n,r){var e=t[0],i=t[1],o=n[0],a=n[1];return i<e?(e=E(i,e),o=r(a,o)):(e=E(e,i),o=r(o,a)),function(t){return o(e(t))}}function O(t,n,r){var e=Math.min(t.length,n.length)-1,i=new Array(e),o=new Array(e),a=-1;for(t[e]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<e;)i[a]=E(t[a],t[a+1]),o[a]=r(n[a],n[a+1]);return function(n){var r=St(t,n,1,e)-1;return o[r](i[r](n))}}function C(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function L(){function t(){var t=Math.min(c.length,l.length);return f!==F&&(f=j(c[0],c[t-1])),o=t>2?O:_,a=u=null,n}function n(t){return isNaN(t=+t)?i:(a||(a=o(c.map(r),l,s)))(r(f(t)))}var r,e,i,o,a,u,c=At,l=At,s=A,f=F;return n.invert=function(t){return f(e((u||(u=o(l,c.map(r),N)))(t)))},n.domain=function(n){return arguments.length?(c=Array.from(n,P),t()):c.slice()},n.range=function(n){return arguments.length?(l=Array.from(n),t()):l.slice()},n.rangeRound=function(n){return l=Array.from(n),s=S,t()},n.clamp=function(n){return arguments.length?(f=!!n||F,t()):f!==F},n.interpolate=function(n){return arguments.length?(s=n,t()):s},n.unknown=function(t){return arguments.length?(i=t,n):i},function(n,i){return r=n,e=i,t()}}function V(){return L()(F,F)}function $(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function q(t,n){if((r=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var r,e=t.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+t.slice(r+1)]}function G(t){return t=q(Math.abs(t)),t?t[1]:NaN}function H(t,n){return function(r,e){for(var i=r.length,o=[],a=0,u=t[0],c=0;i>0&&u>0&&(c+u+1>e&&(u=Math.max(1,e-c)),o.push(r.substring(i-=u,i+u)),!((c+=u+1)>e));)u=t[a=(a+1)%t.length];return o.reverse().join(n)}}function I(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}function U(t){if(!(n=zt.exec(t)))throw new Error("invalid format: "+t);var n;return new X({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function X(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function B(t){t:for(var n,r=t.length,e=1,i=-1;e<r;++e)switch(t[e]){case".":i=n=e;break;case"0":0===i&&(i=e),n=e;break;default:if(i>0){if(!+t[e])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}function R(t,n){var r=q(t,n);if(!r)return t+"";var e=r[0],i=r[1],o=i-(Pt=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=e.length;return o===a?e:o>a?e+new Array(o-a+1).join("0"):o>0?e.slice(0,o)+"."+e.slice(o):"0."+new Array(1-o).join("0")+q(t,Math.max(0,n+o-1))[0]}function T(t,n){var r=q(t,n);if(!r)return t+"";var e=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+e:e.length>i+1?e.slice(0,i+1)+"."+e.slice(i+1):e+new Array(i-e.length+2).join("0")}function Y(t){return t}function Z(t){function n(t){function n(t){var n,i,o,c=x,g=b;if("c"===y)g=k(t)+g,t="";else{t=+t;var N=t<0;if(t=isNaN(t)?s:k(Math.abs(t),v),M&&(t=B(t)),N&&0==+t&&(N=!1),c=(N?"("===h?h:l:"-"===h||"("===h?"":h)+c,g=("s"===y?Ct[8+Pt/3]:"")+g+(N&&"("===h?")":""),w)for(n=-1,i=t.length;++n<i;)if(48>(o=t.charCodeAt(n))||o>57){g=(46===o?a+t.slice(n+1):t.slice(n))+g,t=t.slice(0,n);break}}m&&!p&&(t=e(t,1/0));var S=c.length+t.length+g.length,A=S<d?new Array(d-S+1).join(r):"";switch(m&&p&&(t=e(A+t,A.length?d-g.length:1/0),A=""),f){case"<":t=c+t+g+A;break;case"=":t=c+A+t+g;break;case"^":t=A.slice(0,S=A.length>>1)+c+t+g+A.slice(S);break;default:t=A+c+t+g}return u(t)}t=U(t);var r=t.fill,f=t.align,h=t.sign,g=t.symbol,p=t.zero,d=t.width,m=t.comma,v=t.precision,M=t.trim,y=t.type;"n"===y?(m=!0,y="g"):_t[y]||(void 0===v&&(v=12),M=!0,y="g"),(p||"0"===r&&"="===f)&&(p=!0,r="0",f="=");var x="$"===g?i:"#"===g&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",b="$"===g?o:/[%p]/.test(y)?c:"",k=_t[y],w=/[defgprs%]/.test(y);return v=void 0===v?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v)),n.toString=function(){return t+""},n}function r(t,r){var e=n((t=U(t),t.type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor(G(r)/3))),o=Math.pow(10,-i),a=Ct[8+i/3];return function(t){return e(o*t)+a}}var e=void 0===t.grouping||void 0===t.thousands?Y:H(Ot.call(t.grouping,Number),t.thousands+""),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Y:I(Ot.call(t.numerals,String)),c=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"-":t.minus+"",s=void 0===t.nan?"NaN":t.nan+"";return{format:n,formatPrefix:r}}function D(t){return Math.max(0,-G(Math.abs(t)))}function J(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(G(n)/3)))-G(Math.abs(t)))}function K(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,G(n)-G(t))+1}function Q(t,n,r,e){var i,o=b(t,n,r);switch(e=U(null==e?",f":e),e.type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=e.precision||isNaN(i=J(o,a))||(e.precision=i),jt(e,a);case"":case"e":case"g":case"p":case"r":null!=e.precision||isNaN(i=K(o,Math.max(Math.abs(t),Math.abs(n))))||(e.precision=i-("e"===e.type));break;case"f":case"%":null!=e.precision||isNaN(i=D(o))||(e.precision=i-2*("%"===e.type))}return Et(e)}function W(t){var n=t.domain;return t.tickFormat=function(t,r){var e=n();return Q(e[0],e[e.length-1],null==t?10:t,r)},t.ticks=function(t){var r=n();return y(r[0],r[r.length-1],null==t?10:t)},t}function tt(){var t=V();return t.copy=function(){return C(t,tt())},$.apply(t,arguments),W(t)}function nt(){function t(t){t.attr("width",e[0]).attr("height",e[1]);var d=e[0]*s,m=e[1]*f,v=i.invert([d,m]);a=a||Math.pow(10,n(M(i.invert([0,0]),i.invert([0,e[1]]))*g)-1);var y=a/(M(v,i.invert([d+1,m]))*g),x=tt().range([0,y]).domain([0,a]);1!==p&&x.domain([0,x.invert(y/p)]);var b=x.domain()[1],k=o().scale(x).tickValues(u||[0,b/4,b/2,b]).tickSize(l),w=t.select("g");w._groups[0][0]||(w=t.append("g").attr("class","scale-bar")),w.attr("transform","translate("+e[0]*s+", "+e[1]*f+")").call(k);var N=w.selectAll("rect").data(k.tickValues().map(function(t,n,r){return[t,r[n+1]]}).filter(function(t,n,r){return n!==r.length-1}));N.exit().remove(),N.enter().append("rect").attr("height",l).style("stroke","#000").style("fill",function(t,n){return n%2==0?"#000":"#fff"}).merge(N).attr("x",function(t){return x(t[0])}).attr("width",function(t){return x(t[1]-t[0])});var S=w.select(".label");S._groups[0][0]||(S=w.append("text").attr("class","label")),S.attr("class","label").style("fill","#000").style("text-anchor","start").style("font-size","12px").attr("y",-4),S.text(c||r(h))}function n(t){return Math.floor(t).toString().length}function r(t){return t.charAt(0).toUpperCase()+t.slice(1)}var e,i,a,u,c,l=4,s=0,f=0,h="kilometers",g=6371,p=1,d={miles:{radius:3959},kilometers:{radius:6371}};return t.extent=function(n){return arguments.length?(e=n,t):e},t.projection=function(n){return arguments.length?(i=n,t):i},t.units=function(n){return arguments.length?(h=n,Object.keys(d).includes(n)&&(g=d[n].radius),t):h},t.distance=function(n){return arguments.length?(a=+n,t):a},t.radius=function(n){return arguments.length?(g=+n,t):g},t.tickValues=function(n){return arguments.length?(u=n,t):u},t.label=function(n){return arguments.length?(c=n,t):c},t.height=function(n){return arguments.length?(l=+n,t):l},t.left=function(n){return arguments.length?(s=n>1?1:n<0?0:+n,t):s},t.top=function(n){return arguments.length?(f=n>1?1:n<0?0:+n,t):f},t.scaleFactor=function(n){return arguments.length?(p=n,t):p},t}var rt=Array.prototype.slice,et=3,it=1e-6;a.prototype={constructor:a,reset:function(){this.s=this.t=0},add:function(t){u(ct,t,this.t),u(this,ct.s,this.s),this.s?this.t+=ct.t:this.s=ct.t},valueOf:function(){return this.s}};var ot,at,ut,ct=new a,lt=Math.abs,st=Math.atan2,ft=Math.cos,ht=Math.PI/180,gt=Math.sin,pt=Math.sqrt,dt={Feature:function(t,n){l(t.geometry,n)},FeatureCollection:function(t,n){for(var r=t.features,e=-1,i=r.length;++e<i;)l(r[e].geometry,n)}},mt={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var r=t.coordinates,e=-1,i=r.length;++e<i;)t=r[e],n.point(t[0],t[1],t[2])},LineString:function(t,n){s(t.coordinates,n,0)},MultiLineString:function(t,n){for(var r=t.coordinates,e=-1,i=r.length;++e<i;)s(r[e],n,0)},Polygon:function(t,n){f(t.coordinates,n)},MultiPolygon:function(t,n){for(var r=t.coordinates,e=-1,i=r.length;++e<i;)f(r[e],n)},GeometryCollection:function(t,n){for(var r=t.geometries,e=-1,i=r.length;++e<i;)l(r[e],n)}},vt=function(){return new a}(),Mt={sphere:c,point:c,lineStart:g,lineEnd:c,polygonStart:c,polygonEnd:c},yt=[null,null],xt={type:"LineString",coordinates:yt},bt=Math.sqrt(50),kt=Math.sqrt(10),wt=Math.sqrt(2),Nt=function(t){return 1===t.length&&(t=w(t)),{left:function(n,r,e,i){for(null==e&&(e=0),null==i&&(i=n.length);e<i;){var o=e+i>>>1;t(n[o],r)<0?e=o+1:i=o}return e},right:function(n,r,e,i){for(null==e&&(e=0),null==i&&(i=n.length);e<i;){var o=e+i>>>1;t(n[o],r)>0?i=o:e=o+1}return e}}}(k),St=Nt.right,At=[0,1],zt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;U.prototype=X.prototype,X.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Pt,Ft,Et,jt,_t={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return T(100*t,n)},r:T,s:R,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},Ot=Array.prototype.map,Ct=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];!function(t){Ft=Z(t),Et=Ft.format,jt=Ft.formatPrefix}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),t.geoScaleBar=nt,Object.defineProperty(t,"__esModule",{value:!0})});

@@ -1,1 +0,1 @@

export {default as geoScaleBar} from "./src/geoScaleBar";
export { default as geoScaleBar } from "./src/geoScaleBar";
{
"name": "d3-geo-scale-bar",
"version": "0.2.0",
"version": "0.3.0",
"description": "Displays automatic scale bars for projected geospatial data.",

@@ -27,3 +27,3 @@ "keywords": [

"pretest": "rm -rf build && mkdir build && rollup -c --banner \"$(preamble)\"",
"test": "tape 'test/**/*-test.js' && eslint index.js src",
"test": "tape 'test/**/*-test.js'",
"prepublish": "npm run test && uglifyjs build/d3-geo-scale-bar.js -c -m -o build/d3-geo-scale-bar.min.js",

@@ -33,7 +33,11 @@ "postpublish": "zip -j build/d3-geo-scale-bar.zip -- LICENSE README.md build/d3-geo-scale-bar.js build/d3-geo-scale-bar.min.js"

"devDependencies": {
"@babel/core": "^7.7.7",
"@babel/preset-env": "^7.7.7",
"babel": "^6.23.0",
"d3-geo": "^1.11.9",
"d3-selection": "^1.3.0",
"eslint": "3",
"jsdom": "11",
"package-preamble": "0.1",
"rollup": "^0.62.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-node-resolve": "^3.3.0",

@@ -44,6 +48,4 @@ "tape": "4",

"dependencies": {
"d3-axis": "^1.0.8",
"d3-geo": "^1.10.0",
"d3-scale": "^2.1.0"
"d3-format": "^1.4.2"
}
}

@@ -14,3 +14,3 @@ # d3-geo-scale-bar

```html
<script src="https://unpkg.com/d3-geo-scale-bar@0.1.4/build/d3-geo-scale-bar.min.js"></script>
<script src="https://unpkg.com/d3-geo-scale-bar@0.3.0/build/d3-geo-scale-bar.min.js"></script>
<script>

@@ -77,48 +77,37 @@

<a name="_scaleBar" href="#_scaleBar">#</a> <i>scaleBar</i>(<i>context</i>) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L23 "Source")
<a name="_scaleBar" href="#_scaleBar">#</a> <i>scaleBar</i>(<i>context</i>) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L27 "Source")
Render the scale bar to the given *context*, which may be either a [selection](https://github.com/d3/d3-selection) of SVG containers (either SVG or G elements) or a corresponding [transition](https://github.com/d3/d3-transition). Configure the scale bar with [*scaleBar*.projection](#scaleBar_projection) and [*scaleBar*.fitSize](#scaleBar_fitSize) before rendering.
<a name="scaleBar_projection" href="#scaleBar_projection">#</a> <i>scaleBar</i>.<b>projection</b>([<i>projection</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L138 "Source")
<a name="scaleBar_projection" href="#scaleBar_projection">#</a> <i>scaleBar</i>.<b>projection</b>([<i>projection</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L95 "Source")
If *projection* is specified, sets the [projection](https://github.com/d3/d3-geo#projections) and returns the scale bar. If *projection* is not specified, returns the current projection.
<a name="scaleBar_fitSize" href="#scaleBar_fitSize">#</a> <i>scaleBar</i>.<b>fitSize</b>(<i>size</i>, <i>object</i>) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L124 "Source")
<a name="scaleBar_extent" href="#scaleBar_extent">#</a> <i>scaleBar</i>.<b>extent</b>([<i>size</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L91 "Source")
A convenience method combining the setter functions of [*scaleBar*.extent](#scaleBar_extent) and [*scaleBar*.feature](#scaleBar_feature). The following two statements are equivalent:
```js
scaleBar.extent([width, height]).feature(object);
scaleBar.fitExtent([width, height], object);
```
<a name="scaleBar_extent" href="#scaleBar_extent">#</a> <i>scaleBar</i>.<b>extent</b>([<i>size</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L130 "Source")
If *size* is specified, sets the extent such that (1) the scale bar's default top-left corner aligns with the top-left corner of the projected geospatial data, and (2) you can position the scale bar vertically with [*scaleBar*.top](#scaleBar_top) and horizontally with [*scaleBar*.left](#scaleBar_left). If *size* is not specified, returns the current extent.
<a name="scaleBar_feature" href="#scaleBar_feature">#</a> <i>scaleBar</i>.<b>feature</b>([<i>object</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L134 "Source")
<a name="scaleBar_units" href="#scaleBar_units">#</a> <i>scaleBar</i>.<b>units</b>([<i>units</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L99 "Source")
If *object<* is specified, passes the corresponding GeoJSON Feature or FeatureCollection to the scale bar to allow for calculation of mile and kilometer scales and for positioning of the scale bar on the projected geospatial data. If *object* is not specified, returns the current object.
If *units* is specifed, sets the units of the scale bar. Defaults to "kilometers". If you set *units* to "miles", the [*radius*]("#scaleBar_radius") will also update to 3,959, [the number of miles of Earth's radius](https://www.google.com/search?q=radius+of+earth+in+miles). You can override this if you are mapping planets other than Earth. If *units* is not specified, returns the current units string.
<a name="scaleBar_units" href="#scaleBar_units">#</a> <i>scaleBar</i>.<b>units</b>([<i>units</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L142 "Source")
<a name="scaleBar_distance" href="#scaleBar_distance">#</a> <i>scaleBar</i>.<b>distance</b>([<i>distance</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L114 "Source")
If *units* is specifed, sets the units of the scale bar. Defaults to "kilometers". If you set *units* to "miles", the [*radius*]("#scaleBar_radius") will also update to 3,959, [the number of miles of Earth's radius](https://www.google.com/search?q=radius+of+earth+in+miles). You can override this if you are mapping planets other than Earth. If *units* is not specified, returns the current number of kilometers of the scale bar.
<a name="scaleBar_distance" href="#scaleBar_distance">#</a> <i>scaleBar</i>.<b>distance</b>([<i>distance</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L142 "Source")
If *distance* is specifed, sets the maxiumum distance of the scale bar in the scale bar's units. Defaults to the largest exponent of 10 that will fit on the map. If *distance* is not specified, returns the current maximum distance of the scale bar.
<a name="scaleBar_radius" href="#scaleBar_radius">#</a> <i>scaleBar</i>.<b>radius</b>([<i>radius</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L146 "Source")
<a name="scaleBar_radius" href="#scaleBar_radius">#</a> <i>scaleBar</i>.<b>radius</b>([<i>radius</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L118 "Source")
If *radius* is specifed, sets the radius of the sphere on which the geospatial data is projected. Defaults to 6,371, [the radius of the Earth](https://www.google.com/search?q=radius+of+earth+in+kilometers). If you set [*units*]("#scaleBar_units") to "miles", the *radius* will also update to 3,959, [the number of miles of Earth's radius](https://www.google.com/search?q=radius+of+earth+in+miles). to If *radius* is not specified, returns the sphere's current radius.
<a name="scaleBar_tickValues" href="#scaleBar_tickValues">#</a> <i>scaleBar</i>.<b>tickValues</b>([<i>values</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L150 "Source")
<a name="scaleBar_tickValues" href="#scaleBar_tickValues">#</a> <i>scaleBar</i>.<b>tickValues</b>([<i>values</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L122 "Source")
If a *values* array is specified, the specified values are used for ticks rather than using the scale bar’s automatic tick generator. Defaults to [0, kilometers / 4, kilometers / 2, kilometers]. If *values* is not specified, returns the current tick values.
<a name="scaleBar_label" href="#scaleBar_label">#</a> <i>scaleBar</i>.<b>label</b>([<i>label</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L150 "Source")
<a name="scaleBar_label" href="#scaleBar_label">#</a> <i>scaleBar</i>.<b>label</b>([<i>label</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L126 "Source")
If a *label* string is specified, updates the text in the scale bar's label to the specified string. Defaults to the capitalized unit, e.g. "Kilometers". If *label* is not specified, returns the current label.
<a name="scaleBar_scaleFactor" href="#scaleBar_scaleFactor">#</a> <i>scaleBar</i>.<b>scaleFactor</b>([<i>k</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L150 "Source")
<a name="scaleBar_scaleFactor" href="#scaleBar_scaleFactor">#</a> <i>scaleBar</i>.<b>scaleFactor</b>([<i>k</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L142 "Source")
If *k* is specified, zooms the scale bar by the *k* scale factor. This will commonly be used in conjunction with [d3-zoom](https://github.com/d3/d3-zoom):
If *k* is specified, zooms the scale bar by the *k* scale factor. This will commonly [be used](https://bl.ocks.org/HarryStevens/64fc5f1a4489abe78433b7d19510f864) in conjunction with [d3-zoom](https://github.com/d3/d3-zoom):

@@ -142,12 +131,12 @@ ```js

<a name="scaleBar_height" href="#scaleBar_height">#</a> <i>scaleBar</i>.<b>height</b>([<i>height</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L166 "Source")
<a name="scaleBar_height" href="#scaleBar_height">#</a> <i>scaleBar</i>.<b>height</b>([<i>height</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L130 "Source")
If *height* is specified, sets the height of the scale bar in pixels. Defaults to 4. If *height* is not specified, returns the current height of the scale bar.
<a name="scaleBar_left" href="#scaleBar_left">#</a> <i>scaleBar</i>.<b>left</b>([<i>left</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L170 "Source")
<a name="scaleBar_left" href="#scaleBar_left">#</a> <i>scaleBar</i>.<b>left</b>([<i>left</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L134 "Source")
If *left* is specified, sets the left position to the specified value which must be in the range [0, 1], where 0 is the left-most side of the projected geospatial data and 1 is the right-most. If *left* is not specified, returns the current left position which defaults to 0.
<a name="scaleBar_top" href="#scaleBar_top">#</a> <i>scaleBar</i>.<b>top</b>([<i>top</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L174 "Source")
<a name="scaleBar_top" href="#scaleBar_top">#</a> <i>scaleBar</i>.<b>top</b>([<i>top</i>]) [<>](https://github.com/HarryStevens/d3-geo-scale-bar/blob/master/src/geoScaleBar.js#L138 "Source")
If *top* is specified, sets the top position to the specified value which must be in the range [0, 1], where 0 is the top-most side of the projected geospatial data and 1 is the bottom-most. If *top* is not specified, returns the current top position which defaults to 0.

@@ -0,1 +1,2 @@

import babel from "rollup-plugin-babel";
import resolve from "rollup-plugin-node-resolve";

@@ -9,7 +10,2 @@

format: "umd",
globals: {
"d3-axis": "d3",
"d3-geo": "d3",
"d3-scale": "d3"
},
name: "d3"

@@ -19,5 +15,8 @@ },

resolve({
only: ["d3-array", "d3-axis", "d3-collection", "d3-color", "d3-format", "d3-geo", "d3-interpolate", "d3-scale", "d3-time", "d3-time-format"]
only: ["d3-format"]
}),
babel({
exclude: "node_modules/**"
})
]
}
};

@@ -1,11 +0,8 @@

import {geoBounds, geoDistance} from "d3-geo";
import {scaleLinear} from "d3-scale";
import {axisBottom} from "d3-axis";
import { axisBottom } from "./axis/axis";
import { default as geoDistance } from "./geo/distance";
import { default as scaleLinear } from "./scale/linear";
export default function(){
// Exposed
var extent,
let extent,
projection,
feature,
height = 4,

@@ -21,6 +18,3 @@ left = 0,

// Unexposed
var g,
text,
unitPresets = {
const unitPresets = {
"miles": {

@@ -32,64 +26,42 @@ radius: 3959

}
},
axis,
scale;
};
function scaleBar(context){
var bounds = geoBounds(feature);
var vert_point_a_projected = projection([0, bounds[0][1]]);
var vert_point_b_projected = projection([0, bounds[1][1]]);
var height_projected = Math.abs(vert_point_a_projected[1] - vert_point_b_projected[1]);
var bottom = Math.abs((bounds[1][1] - bounds[0][1]) * top);
var point_a = [bounds[0][0], bottom];
var point_b = [bounds[1][0], bottom];
var distance_radians = geoDistance(point_a, point_b)
var d = distance_radians * radius;
var point_a_projected = projection(point_a);
var point_b_projected = projection(point_b);
var width_projected = point_b_projected[0] - point_a_projected[0];
// A very simple algorithm for determining a good mileage / kilometerage. This can be overridden.
distance = distance || Math.pow(10, countDigits(d) - 1);
var proportion_of_whole = distance / d;
var width_of_bar = proportion_of_whole * width_projected;
var top_of_bar = Math.min(vert_point_a_projected[1], vert_point_b_projected[1]) + (height_projected * top);
var left_of_bar = Math.min(point_a_projected[0], point_b_projected[0]) + (width_projected * left);
context.attr("width", extent[0]).attr("height", extent[1]);
scale = scale || scaleLinear();
scale
.range([0, width_of_bar])
.domain([0, distance]);
const x = extent[0] * left,
y = extent[1] * top,
start = projection.invert([x, y]);
distance = distance || Math.pow(10, countDigits(geoDistance(projection.invert([0, 0]), projection.invert([0, extent[1]])) * radius) - 1);
const w = distance / (geoDistance(start, projection.invert([x + 1, y])) * radius);
const scale = scaleLinear()
.range([0, w])
.domain([0, distance]);
if (scaleFactor !== 1){
scale
.domain([0, scale.invert(width_of_bar / scaleFactor)]);
.domain([0, scale.invert(w / scaleFactor)]);
}
axis = axis || axisBottom();
const tickMax = scale.domain()[1];
var max_tick_value = scale.domain()[1] / distance * distance;
const axis = axisBottom()
.scale(scale)
.tickValues(tickValues ? tickValues : [0, tickMax / 4, tickMax / 2, tickMax])
.tickSize(height);
axis
.scale(scale)
.tickValues(tickValues ? tickValues : [0, max_tick_value / 4, max_tick_value / 2, max_tick_value])
.tickSize(height);
g = g || context.append("g")
.attr("class", "scale-bar");
let g = context.select("g")
if (!g._groups[0][0]) {
g = context.append("g")
.attr("class", "scale-bar");
}
g
.attr("transform", "translate(" + left_of_bar + ", " + (top_of_bar + 14) + ")")
.attr("transform", "translate(" + (extent[0] * left) + ", " + (extent[1] * top) + ")")
.call(axis);
var rects = g.selectAll("rect")
.data(axis.tickValues().map(function(d, i, data){ return [d, data[i + 1]]; }).filter(function(d, i, data){ return i !== data.length - 1; }));
const rects = g.selectAll("rect")
.data(axis.tickValues().map((d, i, data) => [d, data[i + 1]]).filter((d, i, data) => i !== data.length - 1));

@@ -101,8 +73,13 @@ rects.exit().remove();

.style("stroke", "#000")
.style("fill", function(d, i){ return i % 2 === 0 ? "#000" : "#fff"; })
.style("fill", (d, i) => i % 2 === 0 ? "#000" : "#fff")
.merge(rects)
.attr("x", function(d){ return scale(d[0]); })
.attr("width", function(d){ return scale(d[1] - d[0]); });
.attr("x", d => scale(d[0]))
.attr("width", d => scale(d[1] - d[0]));
text = text || g.append("text")
let text = g.select(".label");
if (!text._groups[0][0]){
text = g.append("text")
.attr("class", "label")
}
text
.attr("class", "label")

@@ -112,13 +89,7 @@ .style("fill", "#000")

.style("font-size", "12px")
.attr("y", -4)
.attr("y", -4);
text.text(label || capitalizeFirstLetter(units))
text.text(label || capitalizeFirstLetter(units));
}
scaleBar.fitSize = function(e, o){
extent = e;
feature = o;
return scaleBar;
}
scaleBar.extent = function(_) {

@@ -128,6 +99,2 @@ return arguments.length ? (extent = _, scaleBar) : extent;

scaleBar.feature = function(_) {
return arguments.length ? (feature = _, scaleBar) : feature;
}
scaleBar.projection = function(_) {

@@ -187,2 +154,3 @@ return arguments.length ? (projection = _, scaleBar) : projection;

}
function capitalizeFirstLetter(_) {

@@ -189,0 +157,0 @@ return _.charAt(0).toUpperCase() + _.slice(1);

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc