diff --git a/d3.js b/d3.js index 8bdf9d22..dfcc0b08 100644 --- a/d3.js +++ b/d3.js @@ -1695,11 +1695,12 @@ d3 = function() { }; d3_selectionPrototype.insert = function(name, before) { name = d3.ns.qualify(name); - function insert() { - return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), d3_select(before, this)); + if (typeof before !== "function") before = d3_selection_selector(before); + function insert(d, i) { + return this.insertBefore(d3_document.createElementNS(this.namespaceURI, name), before.call(this, d, i)); } - function insertNS() { - return this.insertBefore(d3_document.createElementNS(name.space, name.local), d3_select(before, this)); + function insertNS(d, i) { + return this.insertBefore(d3_document.createElementNS(name.space, name.local), before.call(this, d, i)); } return this.select(name.local ? insertNS : insert); }; diff --git a/d3.min.js b/d3.min.js index e0a5a393..f2e20a2e 100644 --- a/d3.min.js +++ b/d3.min.js @@ -1,5 +1,5 @@ d3=function(){function t(t){return t.target}function n(t){return t.source}function e(t){return Math.acos(Math.max(-1,Math.min(1,t)))}function r(t,n){try{for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}catch(r){t.prototype=n}}function i(t){for(var n=-1,e=t.length,r=[];e>++n;)r.push(t[n]);return r}function u(t){return Array.prototype.slice.call(t)}function a(){}function o(){}function c(t){return t}function l(){return!0}function f(t){return"function"==typeof t?t:function(){return t}}function s(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function h(t){return null!=t&&!isNaN(t)}function g(t){return t.length}function p(t){return t.trim().replace(/\s+/g," ")}function d(t){for(var n=1;t*n%1;)n*=10;return n}function m(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}function v(t){return t.responseText}function y(t){return JSON.parse(t.responseText)}function M(t){var n=Yu.createRange();return n.selectNode(Yu.body),n.createContextualFragment(t.responseText)}function b(t){return t.responseXML}function x(){}function _(t){function n(){for(var n,r=e,i=-1,u=r.length;u>++i;)(n=r[i].on)&&n.apply(this,arguments);return t}var e=[],r=new a;return n.on=function(n,i){var u,a=r.get(n);return 2>arguments.length?a&&a.on:(a&&(a.on=null,e=e.slice(0,u=e.indexOf(a)).concat(e.slice(u+1)),r.remove(n)),i&&e.push(r.set(n,{on:i})),t)},n}function w(t,n){return n-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function S(t){return t+""}function k(t,n){var e=Math.pow(10,3*Math.abs(8-n));return{scale:n>8?function(t){return t/e}:function(t){return t*e},symbol:t}}function E(t){return function(n){return 0>=n?0:n>=1?1:t(n)}}function A(t){return function(n){return 1-t(1-n)}}function N(t){return function(n){return.5*(.5>n?t(2*n):2-t(2-2*n))}}function T(t){return t*t}function q(t){return t*t*t}function C(t){if(0>=t)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(.5>t?e:3*(t-n)+e-.75)}function z(t){return function(n){return Math.pow(n,t)}}function D(t){return 1-Math.cos(t*Hu/2)}function L(t){return Math.pow(2,10*(t-1))}function F(t){return 1-Math.sqrt(1-t*t)}function H(t,n){var e;return 2>arguments.length&&(n=.45),arguments.length?e=n/(2*Hu)*Math.asin(1/t):(t=1,e=n/4),function(r){return 1+t*Math.pow(2,10*-r)*Math.sin(2*(r-e)*Hu/n)}}function j(t){return t||(t=1.70158),function(n){return n*n*((t+1)*n-t)}}function P(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function R(){Pu.event.stopPropagation(),Pu.event.preventDefault()}function O(){for(var t,n=Pu.event;t=n.sourceEvent;)n=t;return n}function Y(t){for(var n=new x,e=0,r=arguments.length;r>++e;)n[arguments[e]]=_(n);return n.of=function(e,r){return function(i){try{var u=i.sourceEvent=Pu.event;i.target=t,Pu.event=i,n[i.type].apply(e,r)}finally{Pu.event=u}}},n}function U(t){var n=[t.a,t.b],e=[t.c,t.d],r=V(n),i=I(n,e),u=V(Z(e,n,-i))||0;n[0]*e[1]t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function Q(t,n,e){var r,i,u,a=0,o=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(t))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return n(rn(i[0]),rn(i[1]),rn(i[2]))}return(u=pa.get(t))?n(u.r,u.g,u.b):(null!=t&&"#"===t.charAt(0)&&(4===t.length?(a=t.charAt(1),a+=a,o=t.charAt(2),o+=o,c=t.charAt(3),c+=c):7===t.length&&(a=t.substring(1,3),o=t.substring(3,5),c=t.substring(5,7)),a=parseInt(a,16),o=parseInt(o,16),c=parseInt(c,16)),n(a,o,c))}function tn(t,n,e){var r,i,u=Math.min(t/=255,n/=255,e/=255),a=Math.max(t,n,e),o=a-u,c=(a+u)/2;return o?(i=.5>c?o/(a+u):o/(2-a-u),r=t==a?(n-e)/o+(e>n?6:0):n==a?(e-t)/o+2:(t-n)/o+4,r*=60):i=r=0,un(r,i,c)}function nn(t,n,e){t=en(t),n=en(n),e=en(e);var r=mn((.4124564*t+.3575761*n+.1804375*e)/ya),i=mn((.2126729*t+.7151522*n+.072175*e)/Ma),u=mn((.0193339*t+.119192*n+.9503041*e)/ba);return sn(116*i-16,500*(r-i),200*(i-u))}function en(t){return.04045>=(t/=255)?t/12.92:Math.pow((t+.055)/1.055,2.4)}function rn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}function un(t,n,e){return new an(t,n,e)}function an(t,n,e){this.h=t,this.s=n,this.l=e}function on(t,n,e){function r(t){return t>360?t-=360:0>t&&(t+=360),60>t?u+(a-u)*t/60:180>t?a:240>t?u+(a-u)*(240-t)/60:u}function i(t){return Math.round(255*r(t))}var u,a;return t%=360,0>t&&(t+=360),n=0>n?0:n>1?1:n,e=0>e?0:e>1?1:e,a=.5>=e?e*(1+n):e+n-e*n,u=2*e-a,G(i(t+120),i(t),i(t-120))}function cn(t,n,e){return new ln(t,n,e)}function ln(t,n,e){this.h=t,this.c=n,this.l=e}function fn(t,n,e){return sn(e,Math.cos(t*=Ru)*n,Math.sin(t)*n)}function sn(t,n,e){return new hn(t,n,e)}function hn(t,n,e){this.l=t,this.a=n,this.b=e}function gn(t,n,e){var r=(t+16)/116,i=r+n/500,u=r-e/200;return i=dn(i)*ya,r=dn(r)*Ma,u=dn(u)*ba,G(vn(3.2404542*i-1.5371385*r-.4985314*u),vn(-.969266*i+1.8760108*r+.041556*u),vn(.0556434*i-.2040259*r+1.0572252*u))}function pn(t,n,e){return cn(180*(Math.atan2(e,n)/Hu),Math.sqrt(n*n+e*e),t)}function dn(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function mn(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function vn(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function yn(t){return Ku(t,Aa),t}function Mn(t){return function(){return _a(t,this)}}function bn(t){return function(){return wa(t,this)}}function xn(t,n){function e(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,n)}function u(){this.setAttributeNS(t.space,t.local,n)}function a(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}function o(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}return t=Pu.ns.qualify(t),null==n?t.local?r:e:"function"==typeof n?t.local?o:a:t.local?u:i}function _n(t){return RegExp("(?:^|\\s+)"+Pu.requote(t)+"(?:\\s+|$)","g")}function wn(t,n){function e(){for(var e=-1;i>++e;)t[e](this,n)}function r(){for(var e=-1,r=n.apply(this,arguments);i>++e;)t[e](this,r)}t=t.trim().split(/\s+/).map(Sn);var i=t.length;return"function"==typeof n?r:e}function Sn(t){var n=_n(t);return function(e,r){if(i=e.classList)return r?i.add(t):i.remove(t);var i=e.className,u=null!=i.baseVal,a=u?i.baseVal:i;r?(n.lastIndex=0,n.test(a)||(a=p(a+" "+t),u?i.baseVal=a:e.className=a)):a&&(a=p(a.replace(n," ")),u?i.baseVal=a:e.className=a)}}function kn(t,n,e){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,n,e)}function u(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}return null==n?r:"function"==typeof n?u:i}function En(t,n){function e(){delete this[t]}function r(){this[t]=n}function i(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}return null==n?e:"function"==typeof n?i:r}function An(t){return{__data__:t}}function Nn(t){return function(){return Ea(this,t)}}function Tn(t){return arguments.length||(t=Pu.ascending),function(n,e){return!n-!e||t(n.__data__,e.__data__)}}function qn(t,n,e){function r(){var n=this[u];n&&(this.removeEventListener(t,n,n.$),delete this[u])}function i(){function i(t){var e=Pu.event;Pu.event=t,o[0]=a.__data__;try{n.apply(a,o)}finally{Pu.event=e}}var a=this,o=Ju(arguments);r.call(this),this.addEventListener(t,this[u]=i,i.$=e),i._=n}var u="__on"+t,a=t.indexOf(".");return a>0&&(t=t.substring(0,a)),n?i:r}function Cn(t,n){for(var e=0,r=t.length;r>e;e++)for(var i,u=t[e],a=0,o=u.length;o>a;a++)(i=u[a])&&n(i,a,e);return t}function zn(t){return Ku(t,Ta),t}function Dn(t,n){return Ku(t,Ca),t.id=n,t}function Ln(t,n,e,r){var i=t.__transition__||(t.__transition__={active:0,count:0}),u=i[e];if(!u){var o=r.time;return u=i[e]={tween:new a,event:Pu.dispatch("start","end"),time:o,ease:r.ease,delay:r.delay,duration:r.duration},++i.count,Pu.timer(function(r){function a(r){return i.active>e?l():(i.active=e,h.start.call(t,f,n),u.tween.forEach(function(e,r){(r=r.call(t,f,n))&&d.push(r)}),c(r)||Pu.timer(c,0,o),1)}function c(r){if(i.active!==e)return l();for(var u=(r-g)/p,a=s(u),o=d.length;o>0;)d[--o].call(t,a);return u>=1?(l(),h.end.call(t,f,n),1):void 0}function l(){return--i.count?delete i[e]:delete t.__transition__,1}var f=t.__data__,s=u.ease,h=u.event,g=u.delay,p=u.duration,d=[];return r>=g?a(r):Pu.timer(a,g,o),1},0,o),u}}function Fn(t){return null==t&&(t=""),function(){this.textContent=t}}function Hn(t,n,e,r){var i=t.id;return Cn(t,"function"==typeof e?function(t,u,a){t.__transition__[i].tween.set(n,r(e.call(t,t.__data__,u,a)))}:(e=r(e),function(t){t.__transition__[i].tween.set(n,e)}))}function jn(){for(var t,n=Date.now(),e=Pa;e;)t=n-e.then,t>=e.delay&&(e.flush=e.callback(t)),e=e.next;var r=Pn()-n;r>24?(isFinite(r)&&(clearTimeout(Fa),Fa=setTimeout(jn,r)),La=0):(La=1,Ra(jn))}function Pn(){for(var t=null,n=Pa,e=1/0;n;)n.flush?(delete ja[n.callback.id],n=t?t.next=n.next:Pa=n.next):(e=Math.min(e,n.then+n.delay),n=(t=n).next);return e}function Rn(t,n){var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>Oa&&(Uu.scrollX||Uu.scrollY)){e=Pu.select(Yu.body).append("svg").style("position","absolute").style("top",0).style("left",0);var i=e[0][0].getScreenCTM();Oa=!(i.f||i.e),e.remove()}return Oa?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var u=t.getBoundingClientRect();return[n.clientX-u.left-t.clientLeft,n.clientY-u.top-t.clientTop]}function On(){}function Yn(t){var n=t[0],e=t[t.length-1];return e>n?[n,e]:[e,n]}function Un(t){return t.rangeExtent?t.rangeExtent():Yn(t.range())}function In(t,n){var e,r=0,i=t.length-1,u=t[r],a=t[i];return u>a&&(e=r,r=i,i=e,e=u,u=a,a=e),(n=n(a-u))&&(t[r]=n.floor(u),t[i]=n.ceil(a)),t}function Vn(t,n,e,r){function i(){var i=Math.min(t.length,n.length)>2?Kn:Gn,c=r?$:B;return a=i(t,n,c,e),o=i(n,t,c,Pu.interpolate),u}function u(t){return a(t)}var a,o;return u.invert=function(t){return o(t)},u.domain=function(n){return arguments.length?(t=n.map(Number),i()):t},u.range=function(t){return arguments.length?(n=t,i()):n},u.rangeRound=function(t){return u.range(t).interpolate(Pu.interpolateRound)},u.clamp=function(t){return arguments.length?(r=t,i()):r},u.interpolate=function(t){return arguments.length?(e=t,i()):e},u.ticks=function(n){return $n(t,n)},u.tickFormat=function(n){return Jn(t,n)},u.nice=function(){return In(t,Xn),i()},u.copy=function(){return Vn(t,n,e,r)},i()}function Zn(t,n){return Pu.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Xn(t){return t=Math.pow(10,Math.round(Math.log(t)/Math.LN10)-1),t&&{floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}}}function Bn(t,n){var e=Yn(t),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/n)/Math.LN10)),u=n/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function $n(t,n){return Pu.range.apply(Pu,Bn(t,n))}function Jn(t,n){return Pu.format(",."+Math.max(0,-Math.floor(Math.log(Bn(t,n)[2])/Math.LN10+.01))+"f")}function Gn(t,n,e,r){var i=e(t[0],t[1]),u=r(n[0],n[1]);return function(t){return u(i(t))}}function Kn(t,n,e,r){var i=[],u=[],a=0,o=Math.min(t.length,n.length)-1;for(t[o]=++a;)i.push(e(t[a-1],t[a])),u.push(r(n[a-1],n[a]));return function(n){var e=Pu.bisect(t,n,1,o)-1;return u[e](i[e](n))}}function Wn(t,n,e,r){function i(n){return t(e(n))}return i.invert=function(n){return r(t.invert(n))},i.domain=function(n){return arguments.length?(0>n[0]?(e=ne,r=ee):(e=Qn,r=te),t.domain(n.map(e)),i):t.domain().map(r)},i.base=function(t){return arguments.length?(n=+t,i):n},i.nice=function(){return t.domain(In(t.domain(),re(n))),i},i.ticks=function(){var i=Yn(t.domain()),u=[];if(i.every(isFinite)){var a=Math.log(n),o=Math.floor(i[0]/a),c=Math.ceil(i[1]/a),l=r(i[0]),f=r(i[1]),s=n%1?2:n;if(e===ne)for(u.push(-Math.pow(n,-o));c>o++;)for(var h=s-1;h>0;h--)u.push(-Math.pow(n,-o)*h);else{for(;c>o;o++)for(var h=1;s>h;h++)u.push(Math.pow(n,o)*h);u.push(Math.pow(n,o))}for(o=0;l>u[o];o++);for(c=u.length;u[c-1]>f;c--);u=u.slice(o,c)}return u},i.tickFormat=function(t,u){if(2>arguments.length&&(u=Ya),!arguments.length)return u;var a,o=Math.log(n),c=Math.max(.1,t/i.ticks().length),l=e===ne?(a=-1e-12,Math.floor):(a=1e-12,Math.ceil);return function(t){return c>=t/r(o*l(e(t)/o+a))?u(t):""}},i.copy=function(){return Wn(t.copy(),n,e,r)},Zn(i,t)}function Qn(t){return Math.log(0>t?0:t)}function te(t){return Math.exp(t)}function ne(t){return-Math.log(t>0?0:-t)}function ee(t){return-Math.exp(-t)}function re(t){t=Math.log(t);var n={floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}};return function(){return n}}function ie(t,n){function e(n){return t(r(n))}var r=ue(n),i=ue(1/n);return e.invert=function(n){return i(t.invert(n))},e.domain=function(n){return arguments.length?(t.domain(n.map(r)),e):t.domain().map(i)},e.ticks=function(t){return $n(e.domain(),t)},e.tickFormat=function(t){return Jn(e.domain(),t)},e.nice=function(){return e.domain(In(e.domain(),Xn))},e.exponent=function(t){if(!arguments.length)return n;var u=e.domain();return r=ue(n=t),i=ue(1/n),e.domain(u)},e.copy=function(){return ie(t.copy(),n)},Zn(e,t)}function ue(t){return function(n){return 0>n?-Math.pow(-n,t):Math.pow(n,t)}}function ae(t,n){function e(n){return u[((i.get(n)||i.set(n,t.push(n)))-1)%u.length]}function r(n,e){return Pu.range(t.length).map(function(t){return n+e*t})}var i,u,o;return e.domain=function(r){if(!arguments.length)return t;t=[],i=new a;for(var u,o=-1,c=r.length;c>++o;)i.has(u=r[o])||i.set(u,t.push(u));return e[n.t].apply(e,n.a)},e.range=function(t){return arguments.length?(u=t,o=0,n={t:"range",a:arguments},e):u},e.rangePoints=function(i,a){2>arguments.length&&(a=0);var c=i[0],l=i[1],f=(l-c)/(Math.max(1,t.length-1)+a);return u=r(2>t.length?(c+l)/2:c+f*a/2,f),o=0,n={t:"rangePoints",a:arguments},e},e.rangeBands=function(i,a,c){2>arguments.length&&(a=0),3>arguments.length&&(c=a);var l=i[1]arguments.length&&(a=0),3>arguments.length&&(c=a);var l=i[1]++e;)i[e-1]=Pu.quantile(t,e/u);return r}function r(t){return isNaN(t=+t)?0/0:n[Pu.bisect(i,t)]}var i;return r.domain=function(n){return arguments.length?(t=n.filter(function(t){return!isNaN(t)}).sort(Pu.ascending),e()):t},r.range=function(t){return arguments.length?(n=t,e()):n},r.quantiles=function(){return i},r.copy=function(){return oe(t,n)},e()}function ce(t,n,e){function r(n){return e[Math.max(0,Math.min(a,Math.floor(u*(n-t))))]}function i(){return u=e.length/(n-t),a=e.length-1,r}var u,a;return r.domain=function(e){return arguments.length?(t=+e[0],n=+e[e.length-1],i()):[t,n]},r.range=function(t){return arguments.length?(e=t,i()):e},r.copy=function(){return ce(t,n,e)},i()}function le(t,n){function e(e){return n[Pu.bisect(t,e)]}return e.domain=function(n){return arguments.length?(t=n,e):t},e.range=function(t){return arguments.length?(n=t,e):n},e.copy=function(){return le(t,n)},e}function fe(t){function n(t){return+t}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=e.map(n),n):t},n.ticks=function(n){return $n(t,n)},n.tickFormat=function(n){return Jn(t,n)},n.copy=function(){return fe(t)},n}function se(t){return t.innerRadius}function he(t){return t.outerRadius}function ge(t){return t.startAngle}function pe(t){return t.endAngle}function de(t){function n(n){function a(){l.push("M",u(t(s),o))}for(var c,l=[],s=[],h=-1,g=n.length,p=f(e),d=f(r);g>++h;)i.call(this,c=n[h],h)?s.push([+p.call(this,c,h),+d.call(this,c,h)]):s.length&&(a(),s=[]);return s.length&&a(),l.length?l.join(""):null}var e=me,r=ve,i=l,u=ye,a=u.key,o=.7;return n.x=function(t){return arguments.length?(e=t,n):e},n.y=function(t){return arguments.length?(r=t,n):r},n.defined=function(t){return arguments.length?(i=t,n):i},n.interpolate=function(t){return arguments.length?(a="function"==typeof t?u=t:(u=$a.get(t)||ye).key,n):a},n.tension=function(t){return arguments.length?(o=t,n):o},n}function me(t){return t[0]}function ve(t){return t[1]}function ye(t){return t.join("L")}function Me(t){return ye(t)+"Z"}function be(t){for(var n=0,e=t.length,r=t[0],i=[r[0],",",r[1]];e>++n;)i.push("V",(r=t[n])[1],"H",r[0]);return i.join("")}function xe(t){for(var n=0,e=t.length,r=t[0],i=[r[0],",",r[1]];e>++n;)i.push("H",(r=t[n])[0],"V",r[1]);return i.join("")}function _e(t,n){return 4>t.length?ye(t):t[1]+ke(t.slice(1,t.length-1),Ee(t,n))}function we(t,n){return 3>t.length?ye(t):t[0]+ke((t.push(t[0]),t),Ee([t[t.length-2]].concat(t,[t[1]]),n))}function Se(t,n){return 3>t.length?ye(t):t[0]+ke(t,Ee(t,n))}function ke(t,n){if(1>n.length||t.length!=n.length&&t.length!=n.length+2)return ye(t);var e=t.length!=n.length,r="",i=t[0],u=t[1],a=n[0],o=a,c=1;if(e&&(r+="Q"+(u[0]-2*a[0]/3)+","+(u[1]-2*a[1]/3)+","+u[0]+","+u[1],i=t[1],c=2),n.length>1){o=n[1],u=t[c],c++,r+="C"+(i[0]+a[0])+","+(i[1]+a[1])+","+(u[0]-o[0])+","+(u[1]-o[1])+","+u[0]+","+u[1];for(var l=2;n.length>l;l++,c++)u=t[c],o=n[l],r+="S"+(u[0]-o[0])+","+(u[1]-o[1])+","+u[0]+","+u[1]}if(e){var f=t[c];r+="Q"+(u[0]+2*o[0]/3)+","+(u[1]+2*o[1]/3)+","+f[0]+","+f[1]}return r}function Ee(t,n){for(var e,r=[],i=(1-n)/2,u=t[0],a=t[1],o=1,c=t.length;c>++o;)e=u,u=a,a=t[o],r.push([i*(a[0]-e[0]),i*(a[1]-e[1])]);return r}function Ae(t){if(3>t.length)return ye(t);var n=1,e=t.length,r=t[0],i=r[0],u=r[1],a=[i,i,i,(r=t[1])[0]],o=[u,u,u,r[1]],c=[i,",",u];for(ze(c,a,o);e>++n;)r=t[n],a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),ze(c,a,o);for(n=-1;2>++n;)a.shift(),a.push(r[0]),o.shift(),o.push(r[1]),ze(c,a,o);return c.join("")}function Ne(t){if(4>t.length)return ye(t);for(var n,e=[],r=-1,i=t.length,u=[0],a=[0];3>++r;)n=t[r],u.push(n[0]),a.push(n[1]);for(e.push(Ce(Ka,u)+","+Ce(Ka,a)),--r;i>++r;)n=t[r],u.shift(),u.push(n[0]),a.shift(),a.push(n[1]),ze(e,u,a);return e.join("")}function Te(t){for(var n,e,r=-1,i=t.length,u=i+4,a=[],o=[];4>++r;)e=t[r%i],a.push(e[0]),o.push(e[1]);for(n=[Ce(Ka,a),",",Ce(Ka,o)],--r;u>++r;)e=t[r%i],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),ze(n,a,o);return n.join("")}function qe(t,n){var e=t.length-1;if(e)for(var r,i,u=t[0][0],a=t[0][1],o=t[e][0]-u,c=t[e][1]-a,l=-1;e>=++l;)r=t[l],i=l/e,r[0]=n*r[0]+(1-n)*(u+i*o),r[1]=n*r[1]+(1-n)*(a+i*c);return Ae(t)}function Ce(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}function ze(t,n,e){t.push("C",Ce(Ja,n),",",Ce(Ja,e),",",Ce(Ga,n),",",Ce(Ga,e),",",Ce(Ka,n),",",Ce(Ka,e))}function De(t,n){return(n[1]-t[1])/(n[0]-t[0])}function Le(t){for(var n=0,e=t.length-1,r=[],i=t[0],u=t[1],a=r[0]=De(i,u);e>++n;)r[n]=(a+(a=De(i=u,u=t[n+1])))/2;return r[n]=a,r}function Fe(t){for(var n,e,r,i,u=[],a=Le(t),o=-1,c=t.length-1;c>++o;)n=De(t[o],t[o+1]),1e-6>Math.abs(n)?a[o]=a[o+1]=0:(e=a[o]/n,r=a[o+1]/n,i=e*e+r*r,i>9&&(i=3*n/Math.sqrt(i),a[o]=i*e,a[o+1]=i*r));for(o=-1;c>=++o;)i=(t[Math.min(c,o+1)][0]-t[Math.max(0,o-1)][0])/(6*(1+a[o]*a[o])),u.push([i||0,a[o]*i||0]);return u}function He(t){return 3>t.length?ye(t):t[0]+ke(t,Fe(t))}function je(t){for(var n,e,r,i=-1,u=t.length;u>++i;)n=t[i],e=n[0],r=n[1]+Xa,n[0]=e*Math.cos(r),n[1]=e*Math.sin(r);return t}function Pe(t){function n(n){function c(){m.push("M",o(t(y),g),h,s(t(v.reverse()),g),"Z")}for(var l,p,d,m=[],v=[],y=[],M=-1,b=n.length,x=f(e),_=f(i),w=e===r?function(){return p}:f(r),S=i===u?function(){return d}:f(u);b>++M;)a.call(this,l=n[M],M)?(v.push([p=+x.call(this,l,M),d=+_.call(this,l,M)]),y.push([+w.call(this,l,M),+S.call(this,l,M)])):v.length&&(c(),v=[],y=[]);return v.length&&c(),m.length?m.join(""):null}var e=me,r=me,i=0,u=ve,a=l,o=ye,c=o.key,s=o,h="L",g=.7;return n.x=function(t){return arguments.length?(e=r=t,n):r},n.x0=function(t){return arguments.length?(e=t,n):e},n.x1=function(t){return arguments.length?(r=t,n):r},n.y=function(t){return arguments.length?(i=u=t,n):u},n.y0=function(t){return arguments.length?(i=t,n):i},n.y1=function(t){return arguments.length?(u=t,n):u},n.defined=function(t){return arguments.length?(a=t,n):a},n.interpolate=function(t){return arguments.length?(c="function"==typeof t?o=t:(o=$a.get(t)||ye).key,s=o.reverse||o,h=o.closed?"M":"L",n):c},n.tension=function(t){return arguments.length?(g=t,n):g},n}function Re(t){return t.radius}function Oe(t){return[t.x,t.y]}function Ye(t){return function(){var n=t.apply(this,arguments),e=n[0],r=n[1]+Xa;return[e*Math.cos(r),e*Math.sin(r)]}}function Ue(){return 64}function Ie(){return"circle"}function Ve(t){var n=Math.sqrt(t/Hu);return"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z"}function Ze(t,n){t.attr("transform",function(t){return"translate("+n(t)+",0)"})}function Xe(t,n){t.attr("transform",function(t){return"translate(0,"+n(t)+")"})}function Be(t,n,e){if(r=[],e&&n.length>1){for(var r,i,u,a=Yn(t.domain()),o=-1,c=n.length,l=(n[1]-n[0])/++e;c>++o;)for(i=e;--i>0;)(u=+n[o]-i*l)>=a[0]&&r.push(u);for(--o,i=0;e>++i&&(u=+n[o]+i*l)++c;)u=a[c],null!=u&&(nr(u,n,e),t.charge+=u.charge,r+=u.charge*u.cx,i+=u.charge*u.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var l=n*e[t.point.index];t.charge+=t.pointCharge=l,r+=l*t.point.x,i+=l*t.point.y}t.cx=r/t.charge,t.cy=i/t.charge}function er(t){return t.x}function rr(t){return t.y}function ir(t,n,e){t.y0=n,t.y=e}function ur(t){return Pu.range(t.length)}function ar(t){for(var n=-1,e=t[0].length,r=[];e>++n;)r[n]=0;return r}function or(t){for(var n,e=1,r=0,i=t[0][1],u=t.length;u>e;++e)(n=t[e][1])>i&&(r=e,i=n);return r}function cr(t){return t.reduce(lr,0)}function lr(t,n){return t+n[1]}function fr(t,n){return sr(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function sr(t,n){for(var e=-1,r=+t[0],i=(t[1]-r)/n,u=[];n>=++e;)u[e]=i*e+r;return u}function hr(t){return[Pu.min(t),Pu.max(t)]}function gr(t,n){return Pu.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=vr,t}function pr(t){return t.children}function dr(t){return t.value}function mr(t,n){return n.value-t.value}function vr(t){return Pu.merge(t.map(function(t){return(t.children||[]).map(function(n){return{source:t,target:n}})}))}function yr(t,n){return t.value-n.value}function Mr(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function br(t,n){t._pack_next=n,n._pack_prev=t}function xr(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return i*i-e*e-r*r>.001}function _r(t){function n(t){f=Math.min(t.x-t.r,f),s=Math.max(t.x+t.r,s),h=Math.min(t.y-t.r,h),g=Math.max(t.y+t.r,g)}if((e=t.children)&&(l=e.length)){var e,r,i,u,a,o,c,l,f=1/0,s=-1/0,h=1/0,g=-1/0;if(e.forEach(wr),r=e[0],r.x=-r.r,r.y=0,n(r),l>1&&(i=e[1],i.x=i.r,i.y=0,n(i),l>2))for(u=e[2],Er(r,i,u),n(u),Mr(r,u),r._pack_prev=u,Mr(u,i),i=r._pack_next,a=3;l>a;a++){Er(r,i,u=e[a]);var p=0,d=1,m=1;for(o=i._pack_next;o!==i;o=o._pack_next,d++)if(xr(o,u)){p=1;break}if(1==p)for(c=r._pack_prev;c!==o._pack_prev&&!xr(c,u);c=c._pack_prev,m++);p?(m>d||d==m&&i.ra;a++)u=e[a],u.x-=v,u.y-=y,M=Math.max(M,u.r+Math.sqrt(u.x*u.x+u.y*u.y));t.r=M,e.forEach(Sr)}}function wr(t){t._pack_next=t._pack_prev=t}function Sr(t){delete t._pack_next,delete t._pack_prev}function kr(t,n,e,r){var i=t.children;if(t.x=n+=r*t.x,t.y=e+=r*t.y,t.r*=r,i)for(var u=-1,a=i.length;a>++u;)kr(i[u],n,e,r)}function Er(t,n,e){var r=t.r+e.r,i=n.x-t.x,u=n.y-t.y;if(r&&(i||u)){var a=n.r+e.r,o=i*i+u*u;a*=a,r*=r;var c=.5+(r-a)/(2*o),l=Math.sqrt(Math.max(0,2*a*(r+o)-(r-=o)*r-a*a))/(2*o);e.x=t.x+c*i+l*u,e.y=t.y+c*u-l*i}else e.x=t.x+r,e.y=t.y}function Ar(t){return 1+Pu.max(t,function(t){return t.y})}function Nr(t){return t.reduce(function(t,n){return t+n.x},0)/t.length}function Tr(t){var n=t.children;return n&&n.length?Tr(n[0]):t}function qr(t){var n,e=t.children;return e&&(n=e.length)?qr(e[n-1]):t}function Cr(t,n){return t.parent==n.parent?1:2}function zr(t){var n=t.children;return n&&n.length?n[0]:t._tree.thread}function Dr(t){var n,e=t.children;return e&&(n=e.length)?e[n-1]:t._tree.thread}function Lr(t,n){var e=t.children;if(e&&(i=e.length))for(var r,i,u=-1;i>++u;)n(r=Lr(e[u],n),t)>0&&(t=r);return t}function Fr(t,n){return t.x-n.x}function Hr(t,n){return n.x-t.x}function jr(t,n){return t.depth-n.depth}function Pr(t,n){function e(t,r){var i=t.children;if(i&&(a=i.length))for(var u,a,o=null,c=-1;a>++c;)u=i[c],e(u,o),o=u;n(t,r)}e(t,null)}function Rr(t){for(var n,e=0,r=0,i=t.children,u=i.length;--u>=0;)n=i[u]._tree,n.prelim+=e,n.mod+=e,e+=n.shift+(r+=n.change)}function Or(t,n,e){t=t._tree,n=n._tree;var r=e/(n.number-t.number);t.change+=r,n.change-=r,n.shift+=e,n.prelim+=e,n.mod+=e}function Yr(t,n,e){return t._tree.ancestor.parent==n.parent?t._tree.ancestor:e}function Ur(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Ir(t,n){var e=t.x+n[3],r=t.y+n[0],i=t.dx-n[1]-n[3],u=t.dy-n[0]-n[2];return 0>i&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function Vr(t,n){function e(t,e,u){3>arguments.length&&(u=e,e=null);var a=Pu.xhr(t,n,u);return a.row=function(t){return arguments.length?a.response(null==(e=t)?r:i(t)):e},a.row(e)}function r(t){return e.parse(t.responseText)}function i(t){return function(n){return e.parse(n.responseText,t)}}function u(n){return n.map(a).join(t)}function a(t){return o.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var o=RegExp('["'+t+"\n]"),c=t.charCodeAt(0);return e.parse=function(t,n){var r;return e.parseRows(t,function(t,e){if(r)return r(t,e-1);var i=Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}");r=n?function(t,e){return n(i(t),e)}:i})},e.parseRows=function(t,n){function e(){if(f>=l)return a;if(i)return i=!1,u;var n=f;if(34===t.charCodeAt(n)){for(var e=n;l>e++;)if(34===t.charCodeAt(e)){if(34!==t.charCodeAt(e+1))break;++e}f=e+2;var r=t.charCodeAt(e+1);return 13===r?(i=!0,10===t.charCodeAt(e+2)&&++f):10===r&&(i=!0),t.substring(n+1,e).replace(/""/g,'"')}for(;l>f;){var r=t.charCodeAt(f++),o=1;if(10===r)i=!0;else if(13===r)i=!0,10===t.charCodeAt(f)&&(++f,++o);else if(r!==c)continue;return t.substring(n,f-o)}return t.substring(n)}for(var r,i,u={},a={},o=[],l=t.length,f=0,s=0;(r=e())!==a;){for(var h=[];r!==u&&r!==a;)h.push(r),r=e();(!n||(h=n(h,s++)))&&o.push(h)}return o},e.format=function(t){return t.map(u).join("\n")},e}function Zr(t,n){po.hasOwnProperty(t.type)&&po[t.type](t,n)}function Xr(t,n,e){var r,i=-1,u=t.length-e;for(n.lineStart();u>++i;)r=t[i],n.point(r[0],r[1]);n.lineEnd()}function Br(t,n){var e=-1,r=t.length;for(n.polygonStart();r>++e;)Xr(t[e],n,1);n.polygonEnd()}function $r(t){return[Math.atan2(t[1],t[0]),Math.asin(Math.max(-1,Math.min(1,t[2])))]}function Jr(t,n){return ju>Math.abs(t[0]-n[0])&&ju>Math.abs(t[1]-n[1])}function Gr(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function Kr(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Wr(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 Qr(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function ti(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function ni(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function ei(t){function n(n){function r(e,r){e=t(e,r),n.point(e[0],e[1])}function u(){f=0/0,d.point=a,n.lineStart()}function a(r,u){var a=Gr([r,u]),o=t(r,u);e(f,s,l,h,g,p,f=o[0],s=o[1],l=r,h=a[0],g=a[1],p=a[2],i,n),n.point(f,s)}function o(){d.point=r,n.lineEnd()}function c(){var t,r,c,m,v,y,M;u(),d.point=function(n,e){a(t=n,r=e),c=f,m=s,v=h,y=g,M=p,d.point=a},d.lineEnd=function(){e(f,s,l,h,g,p,c,m,t,v,y,M,i,n),d.lineEnd=o,o()}}var l,f,s,h,g,p,d={point:r,lineStart:u,lineEnd:o,polygonStart:function(){n.polygonStart(),d.lineStart=c},polygonEnd:function(){n.polygonEnd(),d.lineStart=u}};return d}function e(n,i,u,a,o,c,l,f,s,h,g,p,d,m){var v=l-n,y=f-i,M=v*v+y*y;if(M>4*r&&d--){var b=a+h,x=o+g,_=c+p,w=Math.sqrt(b*b+x*x+_*_),S=Math.asin(_/=w),k=ju>Math.abs(Math.abs(_)-1)?(u+s)/2:Math.atan2(x,b),E=t(k,S),A=E[0],N=E[1],T=A-n,q=N-i,C=y*T-v*q;(C*C/M>r||Math.abs((v*T+y*q)/M-.5)>.3)&&(e(n,i,u,a,o,c,A,N,k,b/=w,x/=w,_,d,m),m.point(A,N),e(A,N,k,b,x,_,l,f,s,h,g,p,d,m))}}var r=.5,i=16;return n.precision=function(t){return arguments.length?(i=(r=t*t)>0&&16,n):Math.sqrt(r)},n}function ri(t,n){var e=t(n[0]),r=t([.5*(n[0][0]+n[1][0]),n[0][1]]),i=t([n[1][0],n[0][1]]),u=t(n[1]),a=r[1]-e[1],o=r[0]-e[0],c=i[1]-r[1],l=i[0]-r[0],f=a/o,s=c/l,h=.5*(f*s*(e[1]-i[1])+s*(e[0]+r[0])-f*(r[0]+i[0]))/(s-f),g=(.5*(e[0]+r[0])-h)/f+.5*(e[1]+r[1]),p=u[0]-h,d=u[1]-g,m=e[0]-h,v=e[1]-g,y=p*p+d*d,M=m*m+v*v,b=Math.atan2(d,p),x=Math.atan2(v,m);return function(n){var e=n[0]-h,r=n[1]-g,i=e*e+r*r,u=Math.atan2(r,e);return i>y&&M>i&&u>b&&x>u?t.invert(n):void 0}}function ii(t,n){function e(t,n){var e=Math.sqrt(u-2*i*Math.sin(n))/i;return[e*Math.sin(t*=i),a-e*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(n))/2,u=1+r*(2*i-r),a=Math.sqrt(u)/i;return e.invert=function(t,n){var e=a-n;return[Math.atan2(t,e)/i,Math.asin((u-(t*t+e*e)*i*i)/(2*i))]},e}function ui(t){function n(t,n){r>t&&(r=t),t>u&&(u=t),i>n&&(i=n),n>a&&(a=n)}function e(){o.point=o.lineEnd=On}var r,i,u,a,o={point:n,lineStart:On,lineEnd:On,polygonStart:function(){o.lineEnd=e},polygonEnd:function(){o.point=n}};return function(n){return a=u=-(r=i=1/0),Pu.geo.stream(n,t(o)),[[r,i],[u,a]]}}function ai(t,n){if(!yo){++Mo,t*=Ru;var e=Math.cos(n*=Ru);bo+=(e*Math.cos(t)-bo)/Mo,xo+=(e*Math.sin(t)-xo)/Mo,_o+=(Math.sin(n)-_o)/Mo}}function oi(){var t,n;yo=1,ci(),yo=2;var e=wo.point;wo.point=function(r,i){e(t=r,n=i)},wo.lineEnd=function(){wo.point(t,n),li(),wo.lineEnd=li}}function ci(){function t(t,i){t*=Ru;var u=Math.cos(i*=Ru),a=u*Math.cos(t),o=u*Math.sin(t),c=Math.sin(i),l=Math.atan2(Math.sqrt((l=e*c-r*o)*l+(l=r*a-n*c)*l+(l=n*o-e*a)*l),n*a+e*o+r*c);Mo+=l,bo+=l*(n+(n=a)),xo+=l*(e+(e=o)),_o+=l*(r+(r=c))}var n,e,r;yo>1||(1>yo&&(yo=1,Mo=bo=xo=_o=0),wo.point=function(i,u){i*=Ru;var a=Math.cos(u*=Ru);n=a*Math.cos(i),e=a*Math.sin(i),r=Math.sin(u),wo.point=t})}function li(){wo.point=ai}function fi(t,n){var e=Math.cos(t),r=Math.sin(t);return function(i,u,a,o){null!=i?(i=si(e,i),u=si(e,u),(a>0?u>i:i>u)&&(i+=2*a*Hu)):(i=t+2*a*Hu,u=t);for(var c,l=a*n,f=i;a>0?f>u:u>f;f-=l)o.point((c=$r([e,-r*Math.cos(f),-r*Math.sin(f)]))[0],c[1])}}function si(t,n){var r=Gr(n);r[0]-=t,ni(r);var i=e(-r[1]);return((0>-r[2]?-i:i)+2*Math.PI-ju)%(2*Math.PI)}function hi(t,n,e){return function(r){function i(n,e){t(n,e)&&r.point(n,e)}function u(t,n){m.point(t,n) }function a(){v.point=u,m.lineStart()}function o(){v.point=i,m.lineEnd()}function c(t,n){M.point(t,n),d.push([t,n])}function l(){M.lineStart(),d=[]}function f(){c(d[0][0],d[0][1]),M.lineEnd();var t,n=M.clean(),e=y.buffer(),i=e.length;if(!i)return p=!0,g+=yi(d,-1),d=null,void 0;if(d=null,1&n){t=e[0],h+=yi(t,1);var u,i=t.length-1,a=-1;for(r.lineStart();i>++a;)r.point((u=t[a])[0],u[1]);return r.lineEnd(),void 0}i>1&&2&n&&e.push(e.pop().concat(e.shift())),s.push(e.filter(mi))}var s,h,g,p,d,m=n(r),v={point:i,lineStart:a,lineEnd:o,polygonStart:function(){v.point=c,v.lineStart=l,v.lineEnd=f,p=!1,g=h=0,s=[],r.polygonStart()},polygonEnd:function(){v.point=i,v.lineStart=a,v.lineEnd=o,s=Pu.merge(s),s.length?gi(s,e,r):(-ju>h||p&&-ju>g)&&(r.lineStart(),e(null,null,1,r),r.lineEnd()),r.polygonEnd(),s=null},sphere:function(){r.polygonStart(),r.lineStart(),e(null,null,1,r),r.lineEnd(),r.polygonEnd()}},y=vi(),M=n(y);return v}}function gi(t,n,e){var r=[],i=[];if(t.forEach(function(t){if(!(1>=(n=t.length))){var n,u=t[0],a=t[n-1];if(Jr(u,a)){e.lineStart();for(var o=0;n>o;++o)e.point((u=t[o])[0],u[1]);return e.lineEnd(),void 0}var c={point:u,points:t,other:null,visited:!1,entry:!0,subject:!0},l={point:u,points:[u],other:c,visited:!1,entry:!1,subject:!1};c.other=l,r.push(c),i.push(l),c={point:a,points:[a],other:null,visited:!1,entry:!1,subject:!0},l={point:a,points:[a],other:c,visited:!1,entry:!0,subject:!1},c.other=l,r.push(c),i.push(l)}}),i.sort(di),pi(r),pi(i),r.length)for(var u,a,o,c=r[0];;){for(u=c;u.visited;)if((u=u.next)===c)return;a=u.points,e.lineStart();do{if(u.visited=u.other.visited=!0,u.entry){if(u.subject)for(var l=0;a.length>l;l++)e.point((o=a[l])[0],o[1]);else n(u.point,u.next.point,1,e);u=u.next}else{if(u.subject){a=u.prev.points;for(var l=a.length;--l>=0;)e.point((o=a[l])[0],o[1])}else n(u.point,u.prev.point,-1,e);u=u.prev}u=u.other,a=u.points}while(!u.visited);e.lineEnd()}}function pi(t){if(n=t.length){for(var n,e,r=0,i=t[0];n>++r;)i.next=e=t[r],e.prev=i,i=e;i.next=e=t[0],e.prev=i}}function di(t,n){return(0>(t=t.point)[0]?t[1]-Hu/2-ju:Hu/2-t[1])-(0>(n=n.point)[0]?n[1]-Hu/2-ju:Hu/2-n[1])}function mi(t){return t.length>1}function vi(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:On,buffer:function(){var e=n;return n=[],t=null,e}}}function yi(t,n){if(!(e=t.length))return 0;for(var e,r,i,u=0,a=0,o=t[0],c=o[0],l=o[1],f=Math.cos(l),s=Math.atan2(n*Math.sin(c)*f,Math.sin(l)),h=1-n*Math.cos(c)*f,g=s;e>++u;)o=t[u],f=Math.cos(l=o[1]),r=Math.atan2(n*Math.sin(c=o[0])*f,Math.sin(l)),i=1-n*Math.cos(c)*f,ju>Math.abs(h-2)&&ju>Math.abs(i-2)||(ju>Math.abs(i)||ju>Math.abs(h)||(ju>Math.abs(Math.abs(r-s)-Hu)?i+h>2&&(a+=4*(r-s)):a+=ju>Math.abs(h-2)?4*(r-g):((3*Hu+r-s)%(2*Hu)-Hu)*(h+i)),g=s,s=r,h=i);return a}function Mi(t){var n,e=0/0,r=0/0,i=0/0;return{lineStart:function(){t.lineStart(),n=1},point:function(u,a){var o=u>0?Hu:-Hu,c=Math.abs(u-e);ju>Math.abs(c-Hu)?(t.point(e,r=(r+a)/2>0?Hu/2:-Hu/2),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(u,r),n=0):i!==o&&c>=Hu&&(ju>Math.abs(e-i)&&(e-=i*ju),ju>Math.abs(u-o)&&(u-=o*ju),r=bi(e,r,u,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),n=0),t.point(e=u,r=a),i=o},lineEnd:function(){t.lineEnd(),e=r=0/0},clean:function(){return 2-n}}}function bi(t,n,e,r){var i,u,a=Math.sin(t-e);return Math.abs(a)>ju?Math.atan((Math.sin(n)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(n))*Math.sin(t))/(i*u*a)):(n+r)/2}function xi(t,n,e,r){var i;if(null==t)i=e*Hu/2,r.point(-Hu,i),r.point(0,i),r.point(Hu,i),r.point(Hu,0),r.point(Hu,-i),r.point(0,-i),r.point(-Hu,-i),r.point(-Hu,0),r.point(-Hu,i);else if(Math.abs(t[0]-n[0])>ju){var u=(t[0]u}function e(t){var e,i,u,a;return{lineStart:function(){u=i=!1,a=1},point:function(o,c){var l,f=[o,c],s=n(o,c);!e&&(u=i=s)&&t.lineStart(),s!==i&&(l=r(e,f),(Jr(e,l)||Jr(f,l))&&(f[0]+=ju,f[1]+=ju,s=n(f[0],f[1]))),s!==i&&(a=0,(i=s)?(t.lineStart(),l=r(f,e),t.point(l[0],l[1])):(l=r(e,f),t.point(l[0],l[1]),t.lineEnd()),e=l),!s||e&&Jr(e,f)||t.point(f[0],f[1]),e=f},lineEnd:function(){i&&t.lineEnd(),e=null},clean:function(){return a|(u&&i)<<1}}}function r(t,n){var e=Gr(t),r=Gr(n),i=[1,0,0],a=Wr(e,r),o=Kr(a,a),c=a[0],l=o-c*c;if(!l)return t;var f=u*o/l,s=-u*c/l,h=Wr(i,a),g=ti(i,f),p=ti(a,s);Qr(g,p);var d=h,m=Kr(g,d),v=Kr(d,d),y=Math.sqrt(m*m-v*(Kr(g,g)-1)),M=ti(d,(-m-y)/v);return Qr(M,g),$r(M)}var i=t*Ru,u=Math.cos(i),a=fi(i,6*Ru);return hi(n,e,a)}function wi(t,n,e,r){function i(t,n,e){if(ju>Math.abs(n))return 0>=t;var r=t/n;if(n>0){if(r>e[1])return!1;r>e[0]&&(e[0]=r)}else{if(e[0]>r)return!1;e[1]>r&&(e[1]=r)}return!0}return function(u,a){var o=a[0]-u[0],c=a[1]-u[1],l=[0,1];if(!(ju>Math.abs(o)&&ju>Math.abs(c)&&u[0]>=t&&n>=u[0]&&u[1]>=e&&r>=u[1]))return i(t-u[0],o,l)&&i(u[0]-n,-o,l)&&i(e-u[1],c,l)&&i(u[1]-r,-c,l)?(1>l[1]&&(a[0]=u[0]+l[1]*o,a[1]=u[1]+l[1]*c),l[0]>0&&(u[0]+=l[0]*o,u[1]+=l[0]*c),!0):!1}}function Si(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return e=n.invert(e,r),e&&t.invert(e[0],e[1])}),e}function ki(t,n){return[t,n]}function Ei(t,n,e){var r=Pu.range(t,n-ju,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function Ai(t,n,e){var r=Pu.range(t,n-ju,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function Ni(t){return(t=Math.sin(t/2))*t}function Ti(t,n,e,r){var i=Math.cos(n),u=Math.sin(n),a=Math.cos(r),o=Math.sin(r),c=i*Math.cos(t),l=i*Math.sin(t),f=a*Math.cos(e),s=a*Math.sin(e),h=2*Math.asin(Math.sqrt(Ni(r-n)+i*a*Ni(e-t))),g=1/Math.sin(h),p=h?function(t){var n=Math.sin(t*=h)*g,e=Math.sin(h-t)*g,r=e*c+n*f,i=e*l+n*s,a=e*u+n*o;return[Math.atan2(i,r)*Ou,Math.atan2(a,Math.sqrt(r*r+i*i))*Ou]}:function(){return[t*Ou,n*Ou]};return p.distance=h,p}function qi(t,n){return[t/(2*Hu),Math.max(-.5,Math.min(.5,Math.log(Math.tan(Hu/4+n/2))/(2*Hu)))]}function Ci(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function zi(t){var n=ei(function(n,e){return t([n*Ou,e*Ou])});return function(t){return t=n(t),{point:function(n,e){t.point(n*Ru,e*Ru)},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}}function Di(){function t(t,n){a.push("M",t,",",n,u)}function n(t,n){a.push("M",t,",",n),o.point=e}function e(t,n){a.push("L",t,",",n)}function r(){o.point=t}function i(){a.push("Z")}var u=Ci(4.5),a=[],o={point:t,lineStart:function(){o.point=n},lineEnd:r,polygonStart:function(){o.lineEnd=i},polygonEnd:function(){o.lineEnd=r,o.point=t},pointRadius:function(t){return u=Ci(t),o},result:function(){if(a.length){var t=a.join("");return a=[],t}}};return o}function Li(t){function n(n,e){t.moveTo(n,e),t.arc(n,e,a,0,2*Hu)}function e(n,e){t.moveTo(n,e),o.point=r}function r(n,e){t.lineTo(n,e)}function i(){o.point=n}function u(){t.closePath()}var a=4.5,o={point:n,lineStart:function(){o.point=e},lineEnd:i,polygonStart:function(){o.lineEnd=u},polygonEnd:function(){o.lineEnd=i,o.point=n},pointRadius:function(t){return a=t,o},result:On};return o}function Fi(){function t(t,n){No+=i*t-r*n,r=t,i=n}var n,e,r,i;To.point=function(u,a){To.point=t,n=r=u,e=i=a},To.lineEnd=function(){t(n,e)}}function Hi(t,n){yo||(bo+=t,xo+=n,++_o)}function ji(){function t(t,r){var i=t-n,u=r-e,a=Math.sqrt(i*i+u*u);bo+=a*(n+t)/2,xo+=a*(e+r)/2,_o+=a,n=t,e=r}var n,e;if(1!==yo){if(!(1>yo))return;yo=1,bo=xo=_o=0}qo.point=function(r,i){qo.point=t,n=r,e=i}}function Pi(){qo.point=Hi}function Ri(){function t(t,n){var e=i*t-r*n;bo+=e*(r+t),xo+=e*(i+n),_o+=3*e,r=t,i=n}var n,e,r,i;2>yo&&(yo=2,bo=xo=_o=0),qo.point=function(u,a){qo.point=t,n=r=u,e=i=a},qo.lineEnd=function(){t(n,e)}}function Oi(){function t(t,n){t*=Ru,n=n*Ru/2+Hu/4;var e=t-r,a=Math.cos(n),o=Math.sin(n),c=u*o,l=zo,f=Do,s=i*a+c*Math.cos(e),h=c*Math.sin(e);zo=l*s-f*h,Do=f*s+l*h,r=t,i=a,u=o}var n,e,r,i,u;Lo.point=function(a,o){Lo.point=t,r=(n=a)*Ru,i=Math.cos(o=(e=o)*Ru/2+Hu/4),u=Math.sin(o)},Lo.lineEnd=function(){t(n,e)}}function Yi(){function t(t,i){var u=Math.sin(i*=Ru),a=Math.cos(i),o=Math.abs((t*=Ru)-n),c=Math.cos(o);Fo+=Math.atan2(Math.sqrt((o=a*Math.sin(o))*o+(o=r*u-e*a*c)*o),e*u+r*a*c),n=t,e=u,r=a}var n,e,r;Ho.point=function(i,u){n=i*Ru,e=Math.sin(u*=Ru),r=Math.cos(u),Ho.point=t},Ho.lineEnd=function(){Ho.point=Ho.lineEnd=On}}function Ui(t){return Ii(function(){return t})()}function Ii(t){function n(t){return t=a(t[0]*Ru,t[1]*Ru),[t[0]*f+o,c-t[1]*f]}function e(t){return t=a.invert((t[0]-o)/f,(c-t[1])/f),t&&[t[0]*Ou,t[1]*Ou]}function r(){a=Si(u=Zi(d,m,v),i);var t=i(g,p);return o=s-t[0]*f,c=h+t[1]*f,n}var i,u,a,o,c,l=ei(function(t,n){return t=i(t,n),[t[0]*f+o,c-t[1]*f]}),f=150,s=480,h=250,g=0,p=0,d=0,m=0,v=0,y=So,M=null;return n.stream=function(t){return Vi(u,y(l(t)))},n.clipAngle=function(t){return arguments.length?(y=null==t?(M=t,So):_i(M=+t),n):M},n.scale=function(t){return arguments.length?(f=+t,r()):f},n.translate=function(t){return arguments.length?(s=+t[0],h=+t[1],r()):[s,h]},n.center=function(t){return arguments.length?(g=t[0]%360*Ru,p=t[1]%360*Ru,r()):[g*Ou,p*Ou]},n.rotate=function(t){return arguments.length?(d=t[0]%360*Ru,m=t[1]%360*Ru,v=t.length>2?t[2]%360*Ru:0,r()):[d*Ou,m*Ou,v*Ou]},Pu.rebind(n,l,"precision"),function(){return i=t.apply(this,arguments),n.invert=i.invert&&e,r()}}function Vi(t,n){return{point:function(e,r){r=t(e*Ru,r*Ru),e=r[0],n.point(e>Hu?e-2*Hu:-Hu>e?e+2*Hu:e,r[1])},sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function Zi(t,n,e){return t?n||e?Si(Bi(t),$i(n,e)):Bi(t):n||e?$i(n,e):ki}function Xi(t){return function(n,e){return n+=t,[n>Hu?n-2*Hu:-Hu>n?n+2*Hu:n,e]}}function Bi(t){var n=Xi(t);return n.invert=Xi(-t),n}function $i(t,n){function e(t,n){var e=Math.cos(n),o=Math.cos(t)*e,c=Math.sin(t)*e,l=Math.sin(n),f=l*r+o*i;return[Math.atan2(c*u-f*a,o*r-l*i),Math.asin(Math.max(-1,Math.min(1,f*u+c*a)))]}var r=Math.cos(t),i=Math.sin(t),u=Math.cos(n),a=Math.sin(n);return e.invert=function(t,n){var e=Math.cos(n),o=Math.cos(t)*e,c=Math.sin(t)*e,l=Math.sin(n),f=l*u-c*a;return[Math.atan2(c*u+l*a,o*r+f*i),Math.asin(Math.max(-1,Math.min(1,f*r-o*i)))]},e}function Ji(t,n){function e(n,e){var r=Math.cos(n),i=Math.cos(e),u=t(r*i);return[u*i*Math.sin(n),u*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),i=n(r),u=Math.sin(i),a=Math.cos(i);return[Math.atan2(t*u,r*a),Math.asin(r&&e*u/r)]},e}function Gi(t,n,e,r){var i,u,a,o,c,l,f;return i=r[t],u=i[0],a=i[1],i=r[n],o=i[0],c=i[1],i=r[e],l=i[0],f=i[1],(f-a)*(o-u)-(c-a)*(l-u)>0}function Ki(t,n,e){return(e[0]-n[0])*(t[1]-n[1])<(e[1]-n[1])*(t[0]-n[0])}function Wi(t,n,e,r){var i=t[0],u=e[0],a=n[0]-i,o=r[0]-u,c=t[1],l=e[1],f=n[1]-c,s=r[1]-l,h=(o*(c-l)-s*(i-u))/(s*a-o*f);return[i+h*a,c+h*f]}function Qi(t,n){var e={list:t.map(function(t,n){return{index:n,x:t[0],y:t[1]}}).sort(function(t,n){return t.yn.y?1:t.xn.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(t,n){return{edge:t,side:n,vertex:null,l:null,r:null}},insert:function(t,n){n.l=t,n.r=t.r,t.r.l=n,t.r=n},leftBound:function(t){var n=r.leftEnd;do n=n.r;while(n!=r.rightEnd&&i.rightOf(n,t));return n=n.l},del:function(t){t.l.r=t.r,t.r.l=t.l,t.edge=null},right:function(t){return t.r},left:function(t){return t.l},leftRegion:function(t){return null==t.edge?e.bottomSite:t.edge.region[t.side]},rightRegion:function(t){return null==t.edge?e.bottomSite:t.edge.region[Po[t.side]]}},i={bisect:function(t,n){var e={region:{l:t,r:n},ep:{l:null,r:null}},r=n.x-t.x,i=n.y-t.y,u=r>0?r:-r,a=i>0?i:-i;return e.c=t.x*r+t.y*i+.5*(r*r+i*i),u>a?(e.a=1,e.b=i/r,e.c/=r):(e.b=1,e.a=r/i,e.c/=i),e},intersect:function(t,n){var e=t.edge,r=n.edge;if(!e||!r||e.region.r==r.region.r)return null;var i=e.a*r.b-e.b*r.a;if(1e-10>Math.abs(i))return null;var u,a,o=(e.c*r.b-r.c*e.b)/i,c=(r.c*e.a-e.c*r.a)/i,l=e.region.r,f=r.region.r;l.y=a.region.r.x;return s&&"l"===u.side||!s&&"r"===u.side?null:{x:o,y:c}},rightOf:function(t,n){var e=t.edge,r=e.region.r,i=n.x>r.x;if(i&&"l"===t.side)return 1;if(!i&&"r"===t.side)return 0;if(1===e.a){var u=n.y-r.y,a=n.x-r.x,o=0,c=0;if(!i&&0>e.b||i&&e.b>=0?c=o=u>=e.b*a:(c=n.x+n.y*e.b>e.c,0>e.b&&(c=!c),c||(o=1)),!o){var l=r.x-e.region.l.x;c=e.b*(a*a-u*u)e.b&&(c=!c)}}else{var f=e.c-e.a*n.x,s=n.y-f,h=n.x-r.x,g=f-r.y;c=s*s>h*h+g*g}return"l"===t.side?c:!c},endPoint:function(t,e,r){t.ep[e]=r,t.ep[Po[e]]&&n(t)},distance:function(t,n){var e=t.x-n.x,r=t.y-n.y;return Math.sqrt(e*e+r*r)}},u={list:[],insert:function(t,n,e){t.vertex=n,t.ystar=n.y+e;for(var r=0,i=u.list,a=i.length;a>r;r++){var o=i[r];if(!(t.ystar>o.ystar||t.ystar==o.ystar&&n.x>o.vertex.x))break}i.splice(r,0,t)},del:function(t){for(var n=0,e=u.list,r=e.length;r>n&&e[n]!=t;++n);e.splice(n,1)},empty:function(){return 0===u.list.length},nextEvent:function(t){for(var n=0,e=u.list,r=e.length;r>n;++n)if(e[n]==t)return e[n+1];return null},min:function(){var t=u.list[0];return{x:t.vertex.x,y:t.ystar}},extractMin:function(){return u.list.shift()}};r.init(),e.bottomSite=e.list.shift();for(var a,o,c,l,f,s,h,g,p,d,m,v,y,M=e.list.shift();;)if(u.empty()||(a=u.min()),M&&(u.empty()||M.yg.y&&(p=h,h=g,g=p,y="r"),v=i.bisect(h,g),s=r.createHalfEdge(v,y),r.insert(l,s),i.endPoint(v,Po[y],m),d=i.intersect(l,s),d&&(u.del(l),u.insert(l,d,i.distance(d,h))),d=i.intersect(s,f),d&&u.insert(s,d,i.distance(d,h))}for(o=r.right(r.leftEnd);o!=r.rightEnd;o=r.right(o))n(o.edge)}function tu(){return{leaf:!0,nodes:[],point:null}}function nu(t,n,e,r,i,u){if(!t(n,e,r,i,u)){var a=.5*(e+i),o=.5*(r+u),c=n.nodes;c[0]&&nu(t,c[0],e,r,a,o),c[1]&&nu(t,c[1],a,r,i,o),c[2]&&nu(t,c[2],e,o,a,u),c[3]&&nu(t,c[3],a,o,i,u)}}function eu(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function ru(t,n,e,r){for(var i,u,a=0,o=n.length,c=e.length;o>a;){if(r>=c)return-1;if(i=n.charCodeAt(a++),37===i){if(u=rc[n.charAt(a++)],!u||0>(r=u(t,e,r)))return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function iu(t){return RegExp("^(?:"+t.map(Pu.requote).join("|")+")","i")}function uu(t){for(var n=new a,e=-1,r=t.length;r>++e;)n.set(t[e].toLowerCase(),e);return n}function au(t,n,e){t+="";var r=t.length;return e>r?Array(e-r+1).join(n)+t:t}function ou(t,n,e){Go.lastIndex=0;var r=Go.exec(n.substring(e));return r?e+=r[0].length:-1}function cu(t,n,e){Jo.lastIndex=0;var r=Jo.exec(n.substring(e));return r?e+=r[0].length:-1}function lu(t,n,e){Qo.lastIndex=0;var r=Qo.exec(n.substring(e));return r?(t.m=tc.get(r[0].toLowerCase()),e+=r[0].length):-1}function fu(t,n,e){Ko.lastIndex=0;var r=Ko.exec(n.substring(e));return r?(t.m=Wo.get(r[0].toLowerCase()),e+=r[0].length):-1}function su(t,n,e){return ru(t,""+ec.c,n,e)}function hu(t,n,e){return ru(t,""+ec.x,n,e)}function gu(t,n,e){return ru(t,""+ec.X,n,e)}function pu(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+4));return r?(t.y=+r[0],e+=r[0].length):-1}function du(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+2));return r?(t.y=mu(+r[0]),e+=r[0].length):-1}function mu(t){return t+(t>68?1900:2e3)}function vu(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+2));return r?(t.m=r[0]-1,e+=r[0].length):-1}function yu(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+2));return r?(t.d=+r[0],e+=r[0].length):-1}function Mu(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+2));return r?(t.H=+r[0],e+=r[0].length):-1}function bu(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+2));return r?(t.M=+r[0],e+=r[0].length):-1}function xu(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+2));return r?(t.S=+r[0],e+=r[0].length):-1}function _u(t,n,e){ic.lastIndex=0;var r=ic.exec(n.substring(e,e+3));return r?(t.L=+r[0],e+=r[0].length):-1}function wu(t,n,e){var r=uc.get(n.substring(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)}function Su(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=~~(Math.abs(n)/60),i=Math.abs(n)%60;return e+au(r,"0",2)+au(i,"0",2)}function ku(t){return t.toISOString()}function Eu(t,n,e){function r(n){var e=t(n),r=u(e,1);return r-n>n-e?e:r}function i(e){return n(e=t(new Ro(e-1)),1),e}function u(t,e){return n(t=new Ro(+t),e),t}function a(t,r,u){var a=i(t),o=[];if(u>1)for(;r>a;)e(a)%u||o.push(new Date(+a)),n(a,1);else for(;r>a;)o.push(new Date(+a)),n(a,1);return o}function o(t,n,e){try{Ro=eu;var r=new eu;return r._=t,a(r,n,e)}finally{Ro=Date}}t.floor=t,t.round=r,t.ceil=i,t.offset=u,t.range=a;var c=t.utc=Au(t);return c.floor=c,c.round=Au(r),c.ceil=Au(i),c.offset=Au(u),c.range=o,t}function Au(t){return function(n,e){try{Ro=eu;var r=new eu;return r._=n,t(r,e)._}finally{Ro=Date}}}function Nu(t,n,e){function r(n){return t(n)}return r.invert=function(n){return qu(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain(n),r):t.domain().map(qu)},r.nice=function(t){return r.domain(In(r.domain(),function(){return t}))},r.ticks=function(e,i){var u=Tu(r.domain());if("function"!=typeof e){var a=u[1]-u[0],o=a/e,c=Pu.bisect(oc,o);if(c==oc.length)return n.year(u,e);if(!c)return t.ticks(e).map(qu);Math.log(o/oc[c-1])n?[n,e]:[e,n]}function qu(t){return new Date(t)}function Cu(t){return function(n){for(var e=t.length-1,r=t[e];!r[1](n);)r=t[--e];return r[0](n)}}function zu(t){var n=new Date(t,0,1);return n.setFullYear(t),n}function Du(t){var n=t.getFullYear(),e=zu(n),r=zu(n+1);return n+(t-e)/(r-e)}function Lu(t){var n=new Date(Date.UTC(t,0,1));return n.setUTCFullYear(t),n}function Fu(t){var n=t.getUTCFullYear(),e=Lu(n),r=Lu(n+1);return n+(t-e)/(r-e)}var Hu=Math.PI,ju=1e-6,Pu={version:"3.0.8"},Ru=Hu/180,Ou=180/Hu,Yu=document,Uu=window,Iu=".",Vu=",",Zu=[3,3];Date.now||(Date.now=function(){return+new Date});try{Yu.createElement("div").style.setProperty("opacity",0,"")}catch(Xu){var Bu=Uu.CSSStyleDeclaration.prototype,$u=Bu.setProperty;Bu.setProperty=function(t,n,e){$u.call(this,t,n+"",e)}}var Ju=u;try{Ju(Yu.documentElement.childNodes)[0].nodeType}catch(Gu){Ju=i}var Ku=[].__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]};Pu.map=function(t){var n=new a;for(var e in t)n.set(e,t[e]);return n},r(a,{has:function(t){return Wu+t in this},get:function(t){return this[Wu+t]},set:function(t,n){return this[Wu+t]=n},remove:function(t){return t=Wu+t,t in this&&delete this[t]},keys:function(){var t=[];return this.forEach(function(n){t.push(n)}),t},values:function(){var t=[];return this.forEach(function(n,e){t.push(e)}),t},entries:function(){var t=[];return this.forEach(function(n,e){t.push({key:n,value:e})}),t},forEach:function(t){for(var n in this)n.charCodeAt(0)===Qu&&t.call(this,n.substring(1),this[n])}});var Wu="\0",Qu=Wu.charCodeAt(0);Pu.set=function(t){var n=new o;if(t)for(var e=0;t.length>e;e++)n.add(t[e]);return n},r(o,{has:function(t){return Wu+t in this},add:function(t){return this[Wu+t]=!0,t},remove:function(t){return t=Wu+t,t in this&&delete this[t]},values:function(){var t=[];return this.forEach(function(n){t.push(n)}),t},forEach:function(t){for(var n in this)n.charCodeAt(0)===Qu&&t.call(this,n.substring(1))}}),Pu.functor=f,Pu.rebind=function(t,n){for(var e,r=1,i=arguments.length;i>++r;)t[e=arguments[r]]=s(t,n,n[e]);return t},Pu.ascending=function(t,n){return n>t?-1:t>n?1:t>=n?0:0/0},Pu.descending=function(t,n){return t>n?-1:n>t?1:n>=t?0:0/0},Pu.mean=function(t,n){var e,r=t.length,i=0,u=-1,a=0;if(1===arguments.length)for(;r>++u;)h(e=t[u])&&(i+=(e-i)/++a);else for(;r>++u;)h(e=n.call(t,t[u],u))&&(i+=(e-i)/++a);return a?i:void 0},Pu.median=function(t,n){return arguments.length>1&&(t=t.map(n)),t=t.filter(h),t.length?Pu.quantile(t.sort(Pu.ascending),.5):void 0},Pu.min=function(t,n){var e,r,i=-1,u=t.length;if(1===arguments.length){for(;u>++i&&(null==(e=t[i])||e!=e);)e=void 0;for(;u>++i;)null!=(r=t[i])&&e>r&&(e=r)}else{for(;u>++i&&(null==(e=n.call(t,t[i],i))||e!=e);)e=void 0;for(;u>++i;)null!=(r=n.call(t,t[i],i))&&e>r&&(e=r)}return e},Pu.max=function(t,n){var e,r,i=-1,u=t.length;if(1===arguments.length){for(;u>++i&&(null==(e=t[i])||e!=e);)e=void 0;for(;u>++i;)null!=(r=t[i])&&r>e&&(e=r)}else{for(;u>++i&&(null==(e=n.call(t,t[i],i))||e!=e);)e=void 0;for(;u>++i;)null!=(r=n.call(t,t[i],i))&&r>e&&(e=r)}return e},Pu.extent=function(t,n){var e,r,i,u=-1,a=t.length;if(1===arguments.length){for(;a>++u&&(null==(e=i=t[u])||e!=e);)e=i=void 0;for(;a>++u;)null!=(r=t[u])&&(e>r&&(e=r),r>i&&(i=r))}else{for(;a>++u&&(null==(e=i=n.call(t,t[u],u))||e!=e);)e=void 0;for(;a>++u;)null!=(r=n.call(t,t[u],u))&&(e>r&&(e=r),r>i&&(i=r))}return[e,i]},Pu.random={normal:function(t,n){var e=arguments.length;return 2>e&&(n=1),1>e&&(t=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return t+n*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=Pu.random.normal.apply(Pu,arguments);return function(){return Math.exp(t())}},irwinHall:function(t){return function(){for(var n=0,e=0;t>e;e++)n+=Math.random();return n/t}}},Pu.sum=function(t,n){var e,r=0,i=t.length,u=-1;if(1===arguments.length)for(;i>++u;)isNaN(e=+t[u])||(r+=e);else for(;i>++u;)isNaN(e=+n.call(t,t[u],u))||(r+=e);return r},Pu.quantile=function(t,n){var e=(t.length-1)*n+1,r=Math.floor(e),i=+t[r-1],u=e-r;return u?i+u*(t[r]-i):i},Pu.shuffle=function(t){for(var n,e,r=t.length;r;)e=0|Math.random()*r--,n=t[r],t[r]=t[e],t[e]=n;return t},Pu.transpose=function(t){return Pu.zip.apply(Pu,t)},Pu.zip=function(){if(!(r=arguments.length))return[];for(var t=-1,n=Pu.min(arguments,g),e=Array(n);n>++t;)for(var r,i=-1,u=e[t]=Array(r);r>++i;)u[i]=arguments[i][t];return e},Pu.bisector=function(t){return{left:function(n,e,r,i){for(3>arguments.length&&(r=0),4>arguments.length&&(i=n.length);i>r;){var u=r+i>>>1;e>t.call(n,n[u],u)?r=u+1:i=u}return r},right:function(n,e,r,i){for(3>arguments.length&&(r=0),4>arguments.length&&(i=n.length);i>r;){var u=r+i>>>1;t.call(n,n[u],u)>e?i=u:r=u+1}return r}}};var ta=Pu.bisector(function(t){return t});Pu.bisectLeft=ta.left,Pu.bisect=Pu.bisectRight=ta.right,Pu.nest=function(){function t(n,o){if(o>=u.length)return r?r.call(i,n):e?n.sort(e):n;for(var c,l,f,s=-1,h=n.length,g=u[o++],p=new a,d={};h>++s;)(f=p.get(c=g(l=n[s])))?f.push(l):p.set(c,[l]);return p.forEach(function(n,e){d[n]=t(e,o)}),d}function n(t,e){if(e>=u.length)return t;var r,i=[],a=o[e++];for(r in t)i.push({key:r,values:n(t[r],e)});return a&&i.sort(function(t,n){return a(t.key,n.key)}),i}var e,r,i={},u=[],o=[];return i.map=function(n){return t(n,0)},i.entries=function(e){return n(t(e,0),0)},i.key=function(t){return u.push(t),i},i.sortKeys=function(t){return o[u.length-1]=t,i},i.sortValues=function(t){return e=t,i},i.rollup=function(t){return r=t,i},i},Pu.keys=function(t){var n=[];for(var e in t)n.push(e);return n},Pu.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},Pu.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},Pu.permute=function(t,n){for(var e=[],r=-1,i=n.length;i>++r;)e[r]=t[n[r]];return e},Pu.merge=function(t){return Array.prototype.concat.apply([],t)},Pu.range=function(t,n,e){if(3>arguments.length&&(e=1,2>arguments.length&&(n=t,t=0)),1/0===(n-t)/e)throw Error("infinite range");var r,i=[],u=d(Math.abs(e)),a=-1;if(t*=u,n*=u,e*=u,0>e)for(;(r=t+e*++a)>n;)i.push(r/u);else for(;n>(r=t+e*++a);)i.push(r/u);return i},Pu.requote=function(t){return t.replace(na,"\\$&")};var na=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;Pu.round=function(t,n){return n?Math.round(t*(n=Math.pow(10,n)))/n:Math.round(t)},Pu.xhr=function(t,n,e){function r(){var t=l.status;!t&&l.responseText||t>=200&&300>t||304===t?u.load.call(i,o.call(i,l)):u.error.call(i,l)}var i={},u=Pu.dispatch("progress","load","error"),a={},o=c,l=new(Uu.XDomainRequest&&/^(http(s)?:)?\/\//.test(t)?XDomainRequest:XMLHttpRequest);return"onload"in l?l.onload=l.onerror=r:l.onreadystatechange=function(){l.readyState>3&&r()},l.onprogress=function(t){var n=Pu.event;Pu.event=t;try{u.progress.call(i,l)}finally{Pu.event=n}},i.header=function(t,n){return t=(t+"").toLowerCase(),2>arguments.length?a[t]:(null==n?delete a[t]:a[t]=n+"",i)},i.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",i):n},i.response=function(t){return o=t,i},["get","post"].forEach(function(t){i[t]=function(){return i.send.apply(i,[t].concat(Ju(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),l.open(e,t,!0),null==n||"accept"in a||(a.accept=n+",*/*"),l.setRequestHeader)for(var o in a)l.setRequestHeader(o,a[o]);return null!=n&&l.overrideMimeType&&l.overrideMimeType(n),null!=u&&i.on("error",u).on("load",function(t){u(null,t)}),l.send(null==r?null:r),i},i.abort=function(){return l.abort(),i},Pu.rebind(i,u,"on"),2===arguments.length&&"function"==typeof n&&(e=n,n=null),null==e?i:i.get(m(e))},Pu.text=function(){return Pu.xhr.apply(Pu,arguments).response(v)},Pu.json=function(t,n){return Pu.xhr(t,"application/json",n).response(y)},Pu.html=function(t,n){return Pu.xhr(t,"text/html",n).response(M)},Pu.xml=function(){return Pu.xhr.apply(Pu,arguments).response(b)};var ea={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};Pu.ns={prefix:ea,qualify:function(t){var n=t.indexOf(":"),e=t;return n>=0&&(e=t.substring(0,n),t=t.substring(n+1)),ea.hasOwnProperty(e)?{space:ea[e],local:t}:t}},Pu.dispatch=function(){for(var t=new x,n=-1,e=arguments.length;e>++n;)t[arguments[n]]=_(t);return t},x.prototype.on=function(t,n){var e=t.indexOf("."),r="";return e>0&&(r=t.substring(e+1),t=t.substring(0,e)),2>arguments.length?this[t].on(r):this[t].on(r,n)},Pu.format=function(t){var n=ra.exec(t),e=n[1]||" ",r=n[2]||">",i=n[3]||"",u=n[4]||"",a=n[5],o=+n[6],c=n[7],l=n[8],f=n[9],s=1,h="",g=!1;switch(l&&(l=+l.substring(1)),(a||"0"===e&&"="===r)&&(a=e="0",r="=",c&&(o-=Math.floor((o-1)/4))),f){case"n":c=!0,f="g";break;case"%":s=100,h="%",f="f";break;case"p":s=100,h="%",f="r";break;case"b":case"o":case"x":case"X":u&&(u="0"+f.toLowerCase());case"c":case"d":g=!0,l=0;break;case"s":s=-1,f="r"}"#"===u&&(u=""),"r"!=f||l||(f="g"),f=ia.get(f)||S;var p=a&&c;return function(t){if(g&&t%1)return"";var n=0>t||0===t&&0>1/t?(t=-t,"-"):i;if(0>s){var d=Pu.formatPrefix(t,l);t=d.scale(t),h=d.symbol}else t*=s;t=f(t,l),!a&&c&&(t=ua(t));var m=u.length+t.length+(p?0:n.length),v=o>m?Array(m=o-m+1).join(e):"";return p&&(t=ua(v+t)),Iu&&t.replace(".",Iu),n+=u,("<"===r?n+t+v:">"===r?v+n+t:"^"===r?v.substring(0,m>>=1)+n+t+v.substring(m):n+(p?t:v+t))+h}};var ra=/(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/,ia=Pu.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=Pu.round(t,w(t,n))).toFixed(Math.max(0,Math.min(20,w(t*(1+1e-15),n))))}}),ua=c;if(Zu){var aa=Zu.length;ua=function(t){for(var n=t.lastIndexOf("."),e=n>=0?"."+t.substring(n+1):(n=t.length,""),r=[],i=0,u=Zu[0];n>0&&u>0;)r.push(t.substring(n-=u,n+u)),u=Zu[i=(i+1)%aa];return r.reverse().join(Vu||"")+e}}var oa=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"].map(k);Pu.formatPrefix=function(t,n){var e=0;return t&&(0>t&&(t*=-1),n&&(t=Pu.round(t,w(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),oa[8+e/3]};var ca=function(){return c},la=Pu.map({linear:ca,poly:z,quad:function(){return T},cubic:function(){return q},sin:function(){return D},exp:function(){return L},circle:function(){return F},elastic:H,back:j,bounce:function(){return P}}),fa=Pu.map({"in":c,out:A,"in-out":N,"out-in":function(t){return N(A(t))}});Pu.ease=function(t){var n=t.indexOf("-"),e=n>=0?t.substring(0,n):t,r=n>=0?t.substring(n+1):"in";return e=la.get(e)||ca,r=fa.get(r)||c,E(r(e.apply(null,Array.prototype.slice.call(arguments,1))))},Pu.event=null,Pu.transform=function(t){var n=Yu.createElementNS(Pu.ns.prefix.svg,"g");return(Pu.transform=function(t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate();return new U(e?e.matrix:sa)})(t)},U.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var sa={a:1,b:0,c:0,d:1,e:0,f:0};Pu.interpolate=function(t,n){for(var e,r=Pu.interpolators.length;--r>=0&&!(e=Pu.interpolators[r](t,n)););return e},Pu.interpolateNumber=function(t,n){return n-=t,function(e){return t+n*e}},Pu.interpolateRound=function(t,n){return n-=t,function(e){return Math.round(t+n*e)}},Pu.interpolateString=function(t,n){var e,r,i,u,a,o=0,c=0,l=[],f=[];for(ha.lastIndex=0,r=0;e=ha.exec(n);++r)e.index&&l.push(n.substring(o,c=e.index)),f.push({i:l.length,x:e[0]}),l.push(null),o=ha.lastIndex;for(n.length>o&&l.push(n.substring(o)),r=0,u=f.length;(e=ha.exec(t))&&u>r;++r)if(a=f[r],a.x==e[0]){if(a.i)if(null==l[a.i+1])for(l[a.i-1]+=a.x,l.splice(a.i,1),i=r+1;u>i;++i)f[i].i--;else for(l[a.i-1]+=a.x+l[a.i+1],l.splice(a.i,2),i=r+1;u>i;++i)f[i].i-=2;else if(null==l[a.i+1])l[a.i]=a.x;else for(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1),i=r+1;u>i;++i)f[i].i--;f.splice(r,1),u--,r--}else a.x=Pu.interpolateNumber(parseFloat(e[0]),parseFloat(a.x));for(;u>r;)a=f.pop(),null==l[a.i+1]?l[a.i]=a.x:(l[a.i]=a.x+l[a.i+1],l.splice(a.i+1,1)),u--;return 1===l.length?null==l[0]?f[0].x:function(){return n}:function(t){for(r=0;u>r;++r)l[(a=f[r]).i]=a.x(t);return l.join("")}},Pu.interpolateTransform=function(t,n){var e,r=[],i=[],u=Pu.transform(t),a=Pu.transform(n),o=u.translate,c=a.translate,l=u.rotate,f=a.rotate,s=u.skew,h=a.skew,g=u.scale,p=a.scale;return o[0]!=c[0]||o[1]!=c[1]?(r.push("translate(",null,",",null,")"),i.push({i:1,x:Pu.interpolateNumber(o[0],c[0])},{i:3,x:Pu.interpolateNumber(o[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),l!=f?(l-f>180?f+=360:f-l>180&&(l+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:Pu.interpolateNumber(l,f)})):f&&r.push(r.pop()+"rotate("+f+")"),s!=h?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:Pu.interpolateNumber(s,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:e-4,x:Pu.interpolateNumber(g[0],p[0])},{i:e-2,x:Pu.interpolateNumber(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=i.length,function(t){for(var n,u=-1;e>++u;)r[(n=i[u]).i]=n.x(t);return r.join("")}},Pu.interpolateRgb=function(t,n){t=Pu.rgb(t),n=Pu.rgb(n);var e=t.r,r=t.g,i=t.b,u=n.r-e,a=n.g-r,o=n.b-i;return function(t){return"#"+W(Math.round(e+u*t))+W(Math.round(r+a*t))+W(Math.round(i+o*t))}},Pu.interpolateHsl=function(t,n){t=Pu.hsl(t),n=Pu.hsl(n);var e=t.h,r=t.s,i=t.l,u=n.h-e,a=n.s-r,o=n.l-i;return u>180?u-=360:-180>u&&(u+=360),function(t){return on(e+u*t,r+a*t,i+o*t)+""}},Pu.interpolateLab=function(t,n){t=Pu.lab(t),n=Pu.lab(n); -var e=t.l,r=t.a,i=t.b,u=n.l-e,a=n.a-r,o=n.b-i;return function(t){return gn(e+u*t,r+a*t,i+o*t)+""}},Pu.interpolateHcl=function(t,n){t=Pu.hcl(t),n=Pu.hcl(n);var e=t.h,r=t.c,i=t.l,u=n.h-e,a=n.c-r,o=n.l-i;return u>180?u-=360:-180>u&&(u+=360),function(t){return fn(e+u*t,r+a*t,i+o*t)+""}},Pu.interpolateArray=function(t,n){var e,r=[],i=[],u=t.length,a=n.length,o=Math.min(t.length,n.length);for(e=0;o>e;++e)r.push(Pu.interpolate(t[e],n[e]));for(;u>e;++e)i[e]=t[e];for(;a>e;++e)i[e]=n[e];return function(t){for(e=0;o>e;++e)i[e]=r[e](t);return i}},Pu.interpolateObject=function(t,n){var e,r={},i={};for(e in t)e in n?r[e]=X(e)(t[e],n[e]):i[e]=t[e];for(e in n)e in t||(i[e]=n[e]);return function(t){for(e in r)i[e]=r[e](t);return i}};var ha=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;Pu.interpolators=[Pu.interpolateObject,function(t,n){return n instanceof Array&&Pu.interpolateArray(t,n)},function(t,n){return("string"==typeof t||"string"==typeof n)&&Pu.interpolateString(t+"",n+"")},function(t,n){return("string"==typeof n?pa.has(n)||/^(#|rgb\(|hsl\()/.test(n):n instanceof J)&&Pu.interpolateRgb(t,n)},function(t,n){return!isNaN(t=+t)&&!isNaN(n=+n)&&Pu.interpolateNumber(t,n)}],J.prototype.toString=function(){return this.rgb()+""},Pu.rgb=function(t,n,e){return 1===arguments.length?t instanceof K?G(t.r,t.g,t.b):Q(""+t,G,on):G(~~t,~~n,~~e)};var ga=K.prototype=new J;ga.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,i=30;return n||e||r?(n&&i>n&&(n=i),e&&i>e&&(e=i),r&&i>r&&(r=i),G(Math.min(255,Math.floor(n/t)),Math.min(255,Math.floor(e/t)),Math.min(255,Math.floor(r/t)))):G(i,i,i)},ga.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),G(Math.floor(t*this.r),Math.floor(t*this.g),Math.floor(t*this.b))},ga.hsl=function(){return tn(this.r,this.g,this.b)},ga.toString=function(){return"#"+W(this.r)+W(this.g)+W(this.b)};var pa=Pu.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});pa.forEach(function(t,n){pa.set(t,Q(n,G,on))}),Pu.hsl=function(t,n,e){return 1===arguments.length?t instanceof an?un(t.h,t.s,t.l):Q(""+t,tn,un):un(+t,+n,+e)};var da=an.prototype=new J;da.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),un(this.h,this.s,this.l/t)},da.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),un(this.h,this.s,t*this.l)},da.rgb=function(){return on(this.h,this.s,this.l)},Pu.hcl=function(t,n,e){return 1===arguments.length?t instanceof ln?cn(t.h,t.c,t.l):t instanceof hn?pn(t.l,t.a,t.b):pn((t=nn((t=Pu.rgb(t)).r,t.g,t.b)).l,t.a,t.b):cn(+t,+n,+e)};var ma=ln.prototype=new J;ma.brighter=function(t){return cn(this.h,this.c,Math.min(100,this.l+va*(arguments.length?t:1)))},ma.darker=function(t){return cn(this.h,this.c,Math.max(0,this.l-va*(arguments.length?t:1)))},ma.rgb=function(){return fn(this.h,this.c,this.l).rgb()},Pu.lab=function(t,n,e){return 1===arguments.length?t instanceof hn?sn(t.l,t.a,t.b):t instanceof ln?fn(t.l,t.c,t.h):nn((t=Pu.rgb(t)).r,t.g,t.b):sn(+t,+n,+e)};var va=18,ya=.95047,Ma=1,ba=1.08883,xa=hn.prototype=new J;xa.brighter=function(t){return sn(Math.min(100,this.l+va*(arguments.length?t:1)),this.a,this.b)},xa.darker=function(t){return sn(Math.max(0,this.l-va*(arguments.length?t:1)),this.a,this.b)},xa.rgb=function(){return gn(this.l,this.a,this.b)};var _a=function(t,n){return n.querySelector(t)},wa=function(t,n){return n.querySelectorAll(t)},Sa=Yu.documentElement,ka=Sa.matchesSelector||Sa.webkitMatchesSelector||Sa.mozMatchesSelector||Sa.msMatchesSelector||Sa.oMatchesSelector,Ea=function(t,n){return ka.call(t,n)};"function"==typeof Sizzle&&(_a=function(t,n){return Sizzle(t,n)[0]||null},wa=function(t,n){return Sizzle.uniqueSort(Sizzle(t,n))},Ea=Sizzle.matchesSelector);var Aa=[];Pu.selection=function(){return Na},Pu.selection.prototype=Aa,Aa.select=function(t){var n,e,r,i,u=[];"function"!=typeof t&&(t=Mn(t));for(var a=-1,o=this.length;o>++a;){u.push(n=[]),n.parentNode=(r=this[a]).parentNode;for(var c=-1,l=r.length;l>++c;)(i=r[c])?(n.push(e=t.call(i,i.__data__,c)),e&&"__data__"in i&&(e.__data__=i.__data__)):n.push(null)}return yn(u)},Aa.selectAll=function(t){var n,e,r=[];"function"!=typeof t&&(t=bn(t));for(var i=-1,u=this.length;u>++i;)for(var a=this[i],o=-1,c=a.length;c>++o;)(e=a[o])&&(r.push(n=Ju(t.call(e,e.__data__,o))),n.parentNode=e);return yn(r)},Aa.attr=function(t,n){if(2>arguments.length){if("string"==typeof t){var e=this.node();return t=Pu.ns.qualify(t),t.local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(xn(n,t[n]));return this}return this.each(xn(t,n))},Aa.classed=function(t,n){if(2>arguments.length){if("string"==typeof t){var e=this.node(),r=(t=t.trim().split(/^|\s+/g)).length,i=-1;if(n=e.classList){for(;r>++i;)if(!n.contains(t[i]))return!1}else for(n=e.className,null!=n.baseVal&&(n=n.baseVal);r>++i;)if(!_n(t[i]).test(n))return!1;return!0}for(n in t)this.each(wn(n,t[n]));return this}return this.each(wn(t,n))},Aa.style=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n="");for(e in t)this.each(kn(e,t[e],n));return this}if(2>r)return Uu.getComputedStyle(this.node(),null).getPropertyValue(t);e=""}return this.each(kn(t,n,e))},Aa.property=function(t,n){if(2>arguments.length){if("string"==typeof t)return this.node()[t];for(n in t)this.each(En(n,t[n]));return this}return this.each(En(t,n))},Aa.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Aa.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Aa.append=function(t){function n(){return this.appendChild(Yu.createElementNS(this.namespaceURI,t))}function e(){return this.appendChild(Yu.createElementNS(t.space,t.local))}return t=Pu.ns.qualify(t),this.select(t.local?e:n)},Aa.insert=function(t,n){function e(){return this.insertBefore(Yu.createElementNS(this.namespaceURI,t),_a(n,this))}function r(){return this.insertBefore(Yu.createElementNS(t.space,t.local),_a(n,this))}return t=Pu.ns.qualify(t),this.select(t.local?r:e)},Aa.remove=function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})},Aa.data=function(t,n){function e(t,e){var r,i,u,o=t.length,s=e.length,h=Math.min(o,s),g=Array(s),p=Array(s),d=Array(o);if(n){var m,v=new a,y=new a,M=[];for(r=-1;o>++r;)m=n.call(i=t[r],i.__data__,r),v.has(m)?d[r]=i:v.set(m,i),M.push(m);for(r=-1;s>++r;)m=n.call(e,u=e[r],r),(i=v.get(m))?(g[r]=i,i.__data__=u):y.has(m)||(p[r]=An(u)),y.set(m,u),v.remove(m);for(r=-1;o>++r;)v.has(M[r])&&(d[r]=t[r])}else{for(r=-1;h>++r;)i=t[r],u=e[r],i?(i.__data__=u,g[r]=i):p[r]=An(u);for(;s>r;++r)p[r]=An(e[r]);for(;o>r;++r)d[r]=t[r]}p.update=g,p.parentNode=g.parentNode=d.parentNode=t.parentNode,c.push(p),l.push(g),f.push(d)}var r,i,u=-1,o=this.length;if(!arguments.length){for(t=Array(o=(r=this[0]).length);o>++u;)(i=r[u])&&(t[u]=i.__data__);return t}var c=zn([]),l=yn([]),f=yn([]);if("function"==typeof t)for(;o>++u;)e(r=this[u],t.call(r,r.parentNode.__data__,u));else for(;o>++u;)e(r=this[u],t);return l.enter=function(){return c},l.exit=function(){return f},l},Aa.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Aa.filter=function(t){var n,e,r,i=[];"function"!=typeof t&&(t=Nn(t));for(var u=0,a=this.length;a>u;u++){i.push(n=[]),n.parentNode=(e=this[u]).parentNode;for(var o=0,c=e.length;c>o;o++)(r=e[o])&&t.call(r,r.__data__,o)&&n.push(r)}return yn(i)},Aa.order=function(){for(var t=-1,n=this.length;n>++t;)for(var e,r=this[t],i=r.length-1,u=r[i];--i>=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Aa.sort=function(t){t=Tn.apply(this,arguments);for(var n=-1,e=this.length;e>++n;)this[n].sort(t);return this.order()},Aa.on=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n=!1);for(e in t)this.each(qn(e,t[e],n));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(qn(t,n,e))},Aa.each=function(t){return Cn(this,function(n,e,r){t.call(n,n.__data__,e,r)})},Aa.call=function(t){var n=Ju(arguments);return t.apply(n[0]=this,n),this},Aa.empty=function(){return!this.node()},Aa.node=function(){for(var t=0,n=this.length;n>t;t++)for(var e=this[t],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Aa.transition=function(){var t,n,e=qa||++za,r=[],i=Object.create(Da);i.time=Date.now();for(var u=-1,a=this.length;a>++u;){r.push(t=[]);for(var o=this[u],c=-1,l=o.length;l>++c;)(n=o[c])&&Ln(n,c,e,i),t.push(n)}return Dn(r,e)};var Na=yn([[Yu]]);Na[0].parentNode=Sa,Pu.select=function(t){return"string"==typeof t?Na.select(t):yn([[t]])},Pu.selectAll=function(t){return"string"==typeof t?Na.selectAll(t):yn([Ju(t)])};var Ta=[];Pu.selection.enter=zn,Pu.selection.enter.prototype=Ta,Ta.append=Aa.append,Ta.insert=Aa.insert,Ta.empty=Aa.empty,Ta.node=Aa.node,Ta.select=function(t){for(var n,e,r,i,u,a=[],o=-1,c=this.length;c>++o;){r=(i=this[o]).update,a.push(n=[]),n.parentNode=i.parentNode;for(var l=-1,f=i.length;f>++l;)(u=i[l])?(n.push(r[l]=e=t.call(i.parentNode,u.__data__,l)),e.__data__=u.__data__):n.push(null)}return yn(a)};var qa,Ca=[],za=0,Da={ease:C,delay:0,duration:250};Ca.call=Aa.call,Ca.empty=Aa.empty,Ca.node=Aa.node,Pu.transition=function(t){return arguments.length?qa?t.transition():t:Na.transition()},Pu.transition.prototype=Ca,Ca.select=function(t){var n,e,r,i=this.id,u=[];"function"!=typeof t&&(t=Mn(t));for(var a=-1,o=this.length;o>++a;){u.push(n=[]);for(var c=this[a],l=-1,f=c.length;f>++l;)(r=c[l])&&(e=t.call(r,r.__data__,l))?("__data__"in r&&(e.__data__=r.__data__),Ln(e,l,i,r.__transition__[i]),n.push(e)):n.push(null)}return Dn(u,i)},Ca.selectAll=function(t){var n,e,r,i,u,a=this.id,o=[];"function"!=typeof t&&(t=bn(t));for(var c=-1,l=this.length;l>++c;)for(var f=this[c],s=-1,h=f.length;h>++s;)if(r=f[s]){u=r.__transition__[a],e=t.call(r,r.__data__,s),o.push(n=[]);for(var g=-1,p=e.length;p>++g;)Ln(i=e[g],g,a,u),n.push(i)}return Dn(o,a)},Ca.filter=function(t){var n,e,r,i=[];"function"!=typeof t&&(t=Nn(t));for(var u=0,a=this.length;a>u;u++){i.push(n=[]);for(var e=this[u],o=0,c=e.length;c>o;o++)(r=e[o])&&t.call(r,r.__data__,o)&&n.push(r)}return Dn(i,this.id,this.time).ease(this.ease())},Ca.attr=function(t,n){function e(){this.removeAttribute(u)}function r(){this.removeAttributeNS(u.space,u.local)}if(2>arguments.length){for(n in t)this.attr(n,t[n]);return this}var i=X(t),u=Pu.ns.qualify(t);return Hn(this,"attr."+t,n,function(t){function n(){var n,e=this.getAttribute(u);return e!==t&&(n=i(e,t),function(t){this.setAttribute(u,n(t))})}function a(){var n,e=this.getAttributeNS(u.space,u.local);return e!==t&&(n=i(e,t),function(t){this.setAttributeNS(u.space,u.local,n(t))})}return null==t?u.local?r:e:(t+="",u.local?a:n)})},Ca.attrTween=function(t,n){function e(t,e){var r=n.call(this,t,e,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,e){var r=n.call(this,t,e,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=Pu.ns.qualify(t);return this.tween("attr."+t,i.local?r:e)},Ca.style=function(t,n,e){function r(){this.style.removeProperty(t)}var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(n="");for(e in t)this.style(e,t[e],n);return this}e=""}var u=X(t);return Hn(this,"style."+t,n,function(n){function i(){var r,i=Uu.getComputedStyle(this,null).getPropertyValue(t);return i!==n&&(r=u(i,n),function(n){this.style.setProperty(t,r(n),e)})}return null==n?r:(n+="",i)})},Ca.styleTween=function(t,n,e){return 3>arguments.length&&(e=""),this.tween("style."+t,function(r,i){var u=n.call(this,r,i,Uu.getComputedStyle(this,null).getPropertyValue(t));return u&&function(n){this.style.setProperty(t,u(n),e)}})},Ca.text=function(t){return Hn(this,"text",t,Fn)},Ca.remove=function(){return this.each("end.transition",function(){var t;!this.__transition__&&(t=this.parentNode)&&t.removeChild(this)})},Ca.ease=function(t){var n=this.id;return 1>arguments.length?this.node().__transition__[n].ease:("function"!=typeof t&&(t=Pu.ease.apply(Pu,arguments)),Cn(this,function(e){e.__transition__[n].ease=t}))},Ca.delay=function(t){var n=this.id;return Cn(this,"function"==typeof t?function(e,r,i){e.__transition__[n].delay=0|t.call(e,e.__data__,r,i)}:(t|=0,function(e){e.__transition__[n].delay=t}))},Ca.duration=function(t){var n=this.id;return Cn(this,"function"==typeof t?function(e,r,i){e.__transition__[n].duration=Math.max(1,0|t.call(e,e.__data__,r,i))}:(t=Math.max(1,0|t),function(e){e.__transition__[n].duration=t}))},Ca.each=function(t,n){var e=this.id;if(2>arguments.length){var r=Da,i=qa;qa=e,Cn(this,function(n,r,i){Da=n.__transition__[e],t.call(n,n.__data__,r,i)}),Da=r,qa=i}else Cn(this,function(r){r.__transition__[e].event.on(t,n)});return this},Ca.transition=function(){for(var t,n,e,r,i=this.id,u=++za,a=[],o=0,c=this.length;c>o;o++){a.push(t=[]);for(var n=this[o],l=0,f=n.length;f>l;l++)(e=n[l])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Ln(e,l,u,r)),t.push(e)}return Dn(a,u)},Ca.tween=function(t,n){var e=this.id;return 2>arguments.length?this.node().__transition__[e].tween.get(t):Cn(this,null==n?function(n){n.__transition__[e].tween.remove(t)}:function(r){r.__transition__[e].tween.set(t,n)})};var La,Fa,Ha=0,ja={},Pa=null;Pu.timer=function(t,n,e){if(3>arguments.length){if(2>arguments.length)n=0;else if(!isFinite(n))return;e=Date.now()}var r=ja[t.id];r&&r.callback===t?(r.then=e,r.delay=n):ja[t.id=++Ha]=Pa={callback:t,then:e,delay:n,next:Pa},La||(Fa=clearTimeout(Fa),La=1,Ra(jn))},Pu.timer.flush=function(){for(var t,n=Date.now(),e=Pa;e;)t=n-e.then,e.delay||(e.flush=e.callback(t)),e=e.next;Pn()};var Ra=Uu.requestAnimationFrame||Uu.webkitRequestAnimationFrame||Uu.mozRequestAnimationFrame||Uu.oRequestAnimationFrame||Uu.msRequestAnimationFrame||function(t){setTimeout(t,17)};Pu.mouse=function(t){return Rn(t,O())};var Oa=/WebKit/.test(Uu.navigator.userAgent)?-1:0;Pu.touches=function(t,n){return 2>arguments.length&&(n=O().touches),n?Ju(n).map(function(n){var e=Rn(t,n);return e.identifier=n.identifier,e}):[]},Pu.scale={},Pu.scale.linear=function(){return Vn([0,1],[0,1],Pu.interpolate,!1)},Pu.scale.log=function(){return Wn(Pu.scale.linear().domain([0,Math.LN10]),10,Qn,te)};var Ya=Pu.format(".0e");Pu.scale.pow=function(){return ie(Pu.scale.linear(),1)},Pu.scale.sqrt=function(){return Pu.scale.pow().exponent(.5)},Pu.scale.ordinal=function(){return ae([],{t:"range",a:[[]]})},Pu.scale.category10=function(){return Pu.scale.ordinal().range(Ua)},Pu.scale.category20=function(){return Pu.scale.ordinal().range(Ia)},Pu.scale.category20b=function(){return Pu.scale.ordinal().range(Va)},Pu.scale.category20c=function(){return Pu.scale.ordinal().range(Za)};var Ua=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ia=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],Va=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],Za=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];Pu.scale.quantile=function(){return oe([],[])},Pu.scale.quantize=function(){return ce(0,1,[0,1])},Pu.scale.threshold=function(){return le([.5],[0,1])},Pu.scale.identity=function(){return fe([0,1])},Pu.svg={},Pu.svg.arc=function(){function t(){var t=n.apply(this,arguments),u=e.apply(this,arguments),a=r.apply(this,arguments)+Xa,o=i.apply(this,arguments)+Xa,c=(a>o&&(c=a,a=o,o=c),o-a),l=Hu>c?"0":"1",f=Math.cos(a),s=Math.sin(a),h=Math.cos(o),g=Math.sin(o);return c>=Ba?t?"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"Z":t?"M"+u*f+","+u*s+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L"+t*h+","+t*g+"A"+t+","+t+" 0 "+l+",0 "+t*f+","+t*s+"Z":"M"+u*f+","+u*s+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L0,0"+"Z"}var n=se,e=he,r=ge,i=pe;return t.innerRadius=function(e){return arguments.length?(n=f(e),t):n},t.outerRadius=function(n){return arguments.length?(e=f(n),t):e},t.startAngle=function(n){return arguments.length?(r=f(n),t):r},t.endAngle=function(n){return arguments.length?(i=f(n),t):i},t.centroid=function(){var t=(n.apply(this,arguments)+e.apply(this,arguments))/2,u=(r.apply(this,arguments)+i.apply(this,arguments))/2+Xa;return[Math.cos(u)*t,Math.sin(u)*t]},t};var Xa=-Hu/2,Ba=2*Hu-1e-6;Pu.svg.line=function(){return de(c)};var $a=Pu.map({linear:ye,"linear-closed":Me,"step-before":be,"step-after":xe,basis:Ae,"basis-open":Ne,"basis-closed":Te,bundle:qe,cardinal:Se,"cardinal-open":_e,"cardinal-closed":we,monotone:He});$a.forEach(function(t,n){n.key=t,n.closed=/-closed$/.test(t)});var Ja=[0,2/3,1/3,0],Ga=[0,1/3,2/3,0],Ka=[0,1/6,2/3,1/6];Pu.svg.line.radial=function(){var t=de(je);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},be.reverse=xe,xe.reverse=be,Pu.svg.area=function(){return Pe(c)},Pu.svg.area.radial=function(){var t=Pe(je);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},Pu.svg.chord=function(){function e(t,n){var e=r(this,o,t,n),l=r(this,c,t,n);return"M"+e.p0+u(e.r,e.p1,e.a1-e.a0)+(i(e,l)?a(e.r,e.p1,e.r,e.p0):a(e.r,e.p1,l.r,l.p0)+u(l.r,l.p1,l.a1-l.a0)+a(l.r,l.p1,e.r,e.p0))+"Z"}function r(t,n,e,r){var i=n.call(t,e,r),u=l.call(t,i,r),a=s.call(t,i,r)+Xa,o=h.call(t,i,r)+Xa;return{r:u,a0:a,a1:o,p0:[u*Math.cos(a),u*Math.sin(a)],p1:[u*Math.cos(o),u*Math.sin(o)]}}function i(t,n){return t.a0==n.a0&&t.a1==n.a1}function u(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Hu)+",1 "+n}function a(t,n,e,r){return"Q 0,0 "+r}var o=n,c=t,l=Re,s=ge,h=pe;return e.radius=function(t){return arguments.length?(l=f(t),e):l},e.source=function(t){return arguments.length?(o=f(t),e):o},e.target=function(t){return arguments.length?(c=f(t),e):c},e.startAngle=function(t){return arguments.length?(s=f(t),e):s},e.endAngle=function(t){return arguments.length?(h=f(t),e):h},e},Pu.svg.diagonal=function(){function e(t,n){var e=r.call(this,t,n),a=i.call(this,t,n),o=(e.y+a.y)/2,c=[e,{x:e.x,y:o},{x:a.x,y:o},a];return c=c.map(u),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var r=n,i=t,u=Oe;return e.source=function(t){return arguments.length?(r=f(t),e):r},e.target=function(t){return arguments.length?(i=f(t),e):i},e.projection=function(t){return arguments.length?(u=t,e):u},e},Pu.svg.diagonal.radial=function(){var t=Pu.svg.diagonal(),n=Oe,e=t.projection;return t.projection=function(t){return arguments.length?e(Ye(n=t)):n},t},Pu.svg.symbol=function(){function t(t,r){return(Wa.get(n.call(this,t,r))||Ve)(e.call(this,t,r))}var n=Ie,e=Ue;return t.type=function(e){return arguments.length?(n=f(e),t):n},t.size=function(n){return arguments.length?(e=f(n),t):e},t};var Wa=Pu.map({circle:Ve,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*to)),e=n*to;return"M0,"+-n+"L"+e+",0"+" 0,"+n+" "+-e+",0"+"Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/Qa),e=n*Qa/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/Qa),e=n*Qa/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});Pu.svg.symbolTypes=Wa.keys();var Qa=Math.sqrt(3),to=Math.tan(30*Ru);Pu.svg.axis=function(){function t(t){t.each(function(){var t,s=Pu.select(this),h=null==l?e.ticks?e.ticks.apply(e,c):e.domain():l,g=null==n?e.tickFormat?e.tickFormat.apply(e,c):String:n,p=Be(e,h,f),d=s.selectAll(".tick.minor").data(p,String),m=d.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),v=Pu.transition(d.exit()).style("opacity",1e-6).remove(),y=Pu.transition(d).style("opacity",1),M=s.selectAll(".tick.major").data(h,String),b=M.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),x=Pu.transition(M.exit()).style("opacity",1e-6).remove(),_=Pu.transition(M).style("opacity",1),w=Un(e),S=s.selectAll(".domain").data([0]),k=(S.enter().append("path").attr("class","domain"),Pu.transition(S)),E=e.copy(),A=this.__chart__||E;this.__chart__=E,b.append("line"),b.append("text");var N=b.select("line"),T=_.select("line"),q=M.select("text").text(g),C=b.select("text"),z=_.select("text");switch(r){case"bottom":t=Ze,m.attr("y2",u),y.attr("x2",0).attr("y2",u),N.attr("y2",i),C.attr("y",Math.max(i,0)+o),T.attr("x2",0).attr("y2",i),z.attr("x",0).attr("y",Math.max(i,0)+o),q.attr("dy",".71em").style("text-anchor","middle"),k.attr("d","M"+w[0]+","+a+"V0H"+w[1]+"V"+a);break;case"top":t=Ze,m.attr("y2",-u),y.attr("x2",0).attr("y2",-u),N.attr("y2",-i),C.attr("y",-(Math.max(i,0)+o)),T.attr("x2",0).attr("y2",-i),z.attr("x",0).attr("y",-(Math.max(i,0)+o)),q.attr("dy","0em").style("text-anchor","middle"),k.attr("d","M"+w[0]+","+-a+"V0H"+w[1]+"V"+-a);break;case"left":t=Xe,m.attr("x2",-u),y.attr("x2",-u).attr("y2",0),N.attr("x2",-i),C.attr("x",-(Math.max(i,0)+o)),T.attr("x2",-i).attr("y2",0),z.attr("x",-(Math.max(i,0)+o)).attr("y",0),q.attr("dy",".32em").style("text-anchor","end"),k.attr("d","M"+-a+","+w[0]+"H0V"+w[1]+"H"+-a);break;case"right":t=Xe,m.attr("x2",u),y.attr("x2",u).attr("y2",0),N.attr("x2",i),C.attr("x",Math.max(i,0)+o),T.attr("x2",i).attr("y2",0),z.attr("x",Math.max(i,0)+o).attr("y",0),q.attr("dy",".32em").style("text-anchor","start"),k.attr("d","M"+a+","+w[0]+"H0V"+w[1]+"H"+a)}if(e.ticks)b.call(t,A),_.call(t,E),x.call(t,E),m.call(t,A),y.call(t,E),v.call(t,E);else{var D=E.rangeBand()/2,L=function(t){return E(t)+D};b.call(t,L),_.call(t,L)}})}var n,e=Pu.scale.linear(),r=no,i=6,u=6,a=6,o=3,c=[10],l=null,f=0;return t.scale=function(n){return arguments.length?(e=n,t):e},t.orient=function(n){return arguments.length?(r=n in eo?n+"":no,t):r},t.ticks=function(){return arguments.length?(c=arguments,t):c},t.tickValues=function(n){return arguments.length?(l=n,t):l},t.tickFormat=function(e){return arguments.length?(n=e,t):n},t.tickSize=function(n,e){if(!arguments.length)return i;var r=arguments.length-1;return i=+n,u=r>1?+e:i,a=r>0?+arguments[r]:i,t},t.tickPadding=function(n){return arguments.length?(o=+n,t):o},t.tickSubdivide=function(n){return arguments.length?(f=+n,t):f},t};var no="bottom",eo={top:1,right:1,bottom:1,left:1};Pu.svg.brush=function(){function t(u){u.each(function(){var u,a=Pu.select(this),f=a.selectAll(".background").data([0]),s=a.selectAll(".extent").data([0]),h=a.selectAll(".resize").data(l,String);a.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),s.enter().append("rect").attr("class","extent").style("cursor","move"),h.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return ro[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),h.style("display",t.empty()?"none":null),h.exit().remove(),o&&(u=Un(o),f.attr("x",u[0]).attr("width",u[1]-u[0]),e(a)),c&&(u=Un(c),f.attr("y",u[0]).attr("height",u[1]-u[0]),r(a)),n(a)})}function n(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)][0]+","+f[+/^s/.test(t)][1]+")"})}function e(t){t.select(".extent").attr("x",f[0][0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(t){t.select(".extent").attr("y",f[0][1]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var t=Pu.event.changedTouches;return t?Pu.touches(v,t)[0]:Pu.mouse(v)}function l(){32==Pu.event.keyCode&&(S||(d=null,k[0]-=f[1][0],k[1]-=f[1][1],S=2),R())}function s(){32==Pu.event.keyCode&&2==S&&(k[0]+=f[1][0],k[1]+=f[1][1],S=0,R())}function h(){var t=i(),u=!1;m&&(t[0]+=m[0],t[1]+=m[1]),S||(Pu.event.altKey?(d||(d=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),k[0]=f[+(t[0]l?(i=r,r=l):i=l),f[0][e]!==r||f[1][e]!==i?(u=null,f[0][e]=r,f[1][e]=i,!0):void 0}function p(){h(),b.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),Pu.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),M({type:"brushend"}),R()}var d,m,v=this,y=Pu.select(Pu.event.target),M=a.of(v,arguments),b=Pu.select(v),x=y.datum(),_=!/^(n|s)$/.test(x)&&o,w=!/^(e|w)$/.test(x)&&c,S=y.classed("extent"),k=i(),E=Pu.select(Uu).on("mousemove.brush",h).on("mouseup.brush",p).on("touchmove.brush",h).on("touchend.brush",p).on("keydown.brush",l).on("keyup.brush",s);if(S)k[0]=f[0][0]-k[0],k[1]=f[0][1]-k[1];else if(x){var A=+/w$/.test(x),N=+/^n/.test(x);m=[f[1-A][0]-k[0],f[1-N][1]-k[1]],k[0]=f[A][0],k[1]=f[N][1]}else Pu.event.altKey&&(d=k.slice());b.style("pointer-events","none").selectAll(".resize").style("display",null),Pu.select("body").style("cursor",y.style("cursor")),M({type:"brushstart"}),h(),R()}var u,a=Y(t,"brushstart","brush","brushend"),o=null,c=null,l=io[0],f=[[0,0],[0,0]];return t.x=function(n){return arguments.length?(o=n,l=io[!o<<1|!c],t):o},t.y=function(n){return arguments.length?(c=n,l=io[!o<<1|!c],t):c},t.extent=function(n){var e,r,i,a,l;return arguments.length?(u=[[0,0],[0,0]],o&&(e=n[0],r=n[1],c&&(e=e[0],r=r[0]),u[0][0]=e,u[1][0]=r,o.invert&&(e=o(e),r=o(r)),e>r&&(l=e,e=r,r=l),f[0][0]=0|e,f[1][0]=0|r),c&&(i=n[0],a=n[1],o&&(i=i[1],a=a[1]),u[0][1]=i,u[1][1]=a,c.invert&&(i=c(i),a=c(a)),i>a&&(l=i,i=a,a=l),f[0][1]=0|i,f[1][1]=0|a),t):(n=u||f,o&&(e=n[0][0],r=n[1][0],u||(e=f[0][0],r=f[1][0],o.invert&&(e=o.invert(e),r=o.invert(r)),e>r&&(l=e,e=r,r=l))),c&&(i=n[0][1],a=n[1][1],u||(i=f[0][1],a=f[1][1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(l=i,i=a,a=l))),o&&c?[[e,i],[r,a]]:o?[e,r]:c&&[i,a])},t.clear=function(){return u=null,f[0][0]=f[0][1]=f[1][0]=f[1][1]=0,t},t.empty=function(){return o&&f[0][0]===f[1][0]||c&&f[0][1]===f[1][1]},Pu.rebind(t,a,"on")};var ro={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},io=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];Pu.behavior={},Pu.behavior.drag=function(){function t(){this.on("mousedown.drag",n).on("touchstart.drag",n)}function n(){function t(){var t=o.parentNode;return null!=f?Pu.touches(t).filter(function(t){return t.identifier===f})[0]:Pu.mouse(t)}function n(){if(!o.parentNode)return i();var n=t(),e=n[0]-s[0],r=n[1]-s[1];h|=e|r,s=n,R(),c({type:"drag",x:n[0]+a[0],y:n[1]+a[1],dx:e,dy:r})}function i(){c({type:"dragend"}),h&&(R(),Pu.event.target===l&&g.on("click.drag",u,!0)),g.on(null!=f?"touchmove.drag-"+f:"mousemove.drag",null).on(null!=f?"touchend.drag-"+f:"mouseup.drag",null)}function u(){R(),g.on("click.drag",null)}var a,o=this,c=e.of(o,arguments),l=Pu.event.target,f=Pu.event.touches?Pu.event.changedTouches[0].identifier:null,s=t(),h=0,g=Pu.select(Uu).on(null!=f?"touchmove.drag-"+f:"mousemove.drag",n).on(null!=f?"touchend.drag-"+f:"mouseup.drag",i,!0);r?(a=r.apply(o,arguments),a=[a.x-s[0],a.y-s[1]]):a=[0,0],null==f&&R(),c({type:"dragstart"})}var e=Y(t,"drag","dragstart","dragend"),r=null;return t.origin=function(n){return arguments.length?(r=n,t):r},Pu.rebind(t,e,"on")},Pu.behavior.zoom=function(){function t(){this.on("mousedown.zoom",o).on("mousemove.zoom",l).on(oo+".zoom",c).on("dblclick.zoom",f).on("touchstart.zoom",s).on("touchmove.zoom",h).on("touchend.zoom",s)}function n(t){return[(t[0]-b[0])/x,(t[1]-b[1])/x]}function e(t){return[t[0]*x+b[0],t[1]*x+b[1]]}function r(t){x=Math.max(_[0],Math.min(_[1],t))}function i(t,n){n=e(n),b[0]+=t[0]-n[0],b[1]+=t[1]-n[1]}function u(){m&&m.domain(d.range().map(function(t){return(t-b[0])/x}).map(d.invert)),y&&y.domain(v.range().map(function(t){return(t-b[1])/x}).map(v.invert))}function a(t){u(),Pu.event.preventDefault(),t({type:"zoom",scale:x,translate:b})}function o(){function t(){l=1,i(Pu.mouse(u),s),a(o)}function e(){l&&R(),f.on("mousemove.zoom",null).on("mouseup.zoom",null),l&&Pu.event.target===c&&f.on("click.zoom",r,!0)}function r(){R(),f.on("click.zoom",null)}var u=this,o=w.of(u,arguments),c=Pu.event.target,l=0,f=Pu.select(Uu).on("mousemove.zoom",t).on("mouseup.zoom",e),s=n(Pu.mouse(u)); -Uu.focus(),R()}function c(){g||(g=n(Pu.mouse(this))),r(Math.pow(2,.002*uo())*x),i(Pu.mouse(this),g),a(w.of(this,arguments))}function l(){g=null}function f(){var t=Pu.mouse(this),e=n(t),u=Math.log(x)/Math.LN2;r(Math.pow(2,Pu.event.shiftKey?Math.ceil(u)-1:Math.floor(u)+1)),i(t,e),a(w.of(this,arguments))}function s(){var t=Pu.touches(this),e=Date.now();if(p=x,g={},t.forEach(function(t){g[t.identifier]=n(t)}),R(),1===t.length){if(500>e-M){var u=t[0],o=n(t[0]);r(2*x),i(u,o),a(w.of(this,arguments))}M=e}}function h(){var t=Pu.touches(this),n=t[0],e=g[n.identifier];if(u=t[1]){var u,o=g[u.identifier];n=[(n[0]+u[0])/2,(n[1]+u[1])/2],e=[(e[0]+o[0])/2,(e[1]+o[1])/2],r(Pu.event.scale*p)}i(n,e),M=null,a(w.of(this,arguments))}var g,p,d,m,v,y,M,b=[0,0],x=1,_=ao,w=Y(t,"zoom");return t.translate=function(n){return arguments.length?(b=n.map(Number),u(),t):b},t.scale=function(n){return arguments.length?(x=+n,u(),t):x},t.scaleExtent=function(n){return arguments.length?(_=null==n?ao:n.map(Number),t):_},t.x=function(n){return arguments.length?(m=n,d=n.copy(),b=[0,0],x=1,t):m},t.y=function(n){return arguments.length?(y=n,v=n.copy(),b=[0,0],x=1,t):y},Pu.rebind(t,w,"on")};var uo,ao=[0,1/0],oo="onwheel"in document?(uo=function(){return-Pu.event.deltaY*(Pu.event.deltaMode?120:1)},"wheel"):"onmousewheel"in document?(uo=function(){return Pu.event.wheelDelta},"mousewheel"):(uo=function(){return-Pu.event.detail},"MozMousePixelScroll");Pu.layout={},Pu.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;r>++e;)n.push($e(t[e]));return n}},Pu.layout.chord=function(){function t(){var t,l,s,h,g,p={},d=[],m=Pu.range(u),v=[];for(e=[],r=[],t=0,h=-1;u>++h;){for(l=0,g=-1;u>++g;)l+=i[h][g];d.push(l),v.push(Pu.range(u)),t+=l}for(a&&m.sort(function(t,n){return a(d[t],d[n])}),o&&v.forEach(function(t,n){t.sort(function(t,e){return o(i[n][t],i[n][e])})}),t=(2*Hu-f*u)/t,l=0,h=-1;u>++h;){for(s=l,g=-1;u>++g;){var y=m[h],M=v[y][g],b=i[y][M],x=l,_=l+=b*t;p[y+"-"+M]={index:y,subindex:M,startAngle:x,endAngle:_,value:b}}r[y]={index:y,startAngle:s,endAngle:l,value:(l-s)/t},l+=f}for(h=-1;u>++h;)for(g=h-1;u>++g;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value(i-e)*o){var c=n.charge*o*o;return t.px-=u*c,t.py-=a*c,!0}if(n.point&&isFinite(o)){var c=n.pointCharge*o*o;t.px-=u*c,t.py-=a*c}}return!n.charge}}function n(t){t.px=Pu.event.x,t.py=Pu.event.y,o.resume()}var e,r,i,u,a,o={},l=Pu.dispatch("start","tick","end"),f=[1,1],s=.9,h=co,g=lo,p=-30,d=.1,m=.8,v=[],y=[];return o.tick=function(){if(.005>(r*=.99))return l.end({type:"end",alpha:r=0}),!0;var n,e,o,c,h,g,m,M,b,x=v.length,_=y.length;for(e=0;_>e;++e)o=y[e],c=o.source,h=o.target,M=h.x-c.x,b=h.y-c.y,(g=M*M+b*b)&&(g=r*u[e]*((g=Math.sqrt(g))-i[e])/g,M*=g,b*=g,h.x-=M*(m=c.weight/(h.weight+c.weight)),h.y-=b*m,c.x+=M*(m=1-m),c.y+=b*m);if((m=r*d)&&(M=f[0]/2,b=f[1]/2,e=-1,m))for(;x>++e;)o=v[e],o.x+=(M-o.x)*m,o.y+=(b-o.y)*m;if(p)for(nr(n=Pu.geom.quadtree(v),r,a),e=-1;x>++e;)(o=v[e]).fixed||n.visit(t(o));for(e=-1;x>++e;)o=v[e],o.fixed?(o.x=o.px,o.y=o.py):(o.x-=(o.px-(o.px=o.x))*s,o.y-=(o.py-(o.py=o.y))*s);l.tick({type:"tick",alpha:r})},o.nodes=function(t){return arguments.length?(v=t,o):v},o.links=function(t){return arguments.length?(y=t,o):y},o.size=function(t){return arguments.length?(f=t,o):f},o.linkDistance=function(t){return arguments.length?(h="function"==typeof t?t:+t,o):h},o.distance=o.linkDistance,o.linkStrength=function(t){return arguments.length?(g="function"==typeof t?t:+t,o):g},o.friction=function(t){return arguments.length?(s=+t,o):s},o.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,o):p},o.gravity=function(t){return arguments.length?(d=+t,o):d},o.theta=function(t){return arguments.length?(m=+t,o):m},o.alpha=function(t){return arguments.length?(t=+t,r?r=t>0?t:0:t>0&&(l.start({type:"start",alpha:r=t}),Pu.timer(o.tick)),o):r},o.start=function(){function t(t,r){for(var i,u=n(e),a=-1,o=u.length;o>++a;)if(!isNaN(i=u[a][t]))return i;return Math.random()*r}function n(){if(!c){for(c=[],r=0;s>r;++r)c[r]=[];for(r=0;d>r;++r){var t=y[r];c[t.source.index].push(t.target),c[t.target.index].push(t.source)}}return c[e]}var e,r,c,l,s=v.length,d=y.length,m=f[0],M=f[1];for(e=0;s>e;++e)(l=v[e]).index=e,l.weight=0;for(e=0;d>e;++e)l=y[e],"number"==typeof l.source&&(l.source=v[l.source]),"number"==typeof l.target&&(l.target=v[l.target]),++l.source.weight,++l.target.weight;for(e=0;s>e;++e)l=v[e],isNaN(l.x)&&(l.x=t("x",m)),isNaN(l.y)&&(l.y=t("y",M)),isNaN(l.px)&&(l.px=l.x),isNaN(l.py)&&(l.py=l.y);if(i=[],"function"==typeof h)for(e=0;d>e;++e)i[e]=+h.call(this,y[e],e);else for(e=0;d>e;++e)i[e]=h;if(u=[],"function"==typeof g)for(e=0;d>e;++e)u[e]=+g.call(this,y[e],e);else for(e=0;d>e;++e)u[e]=g;if(a=[],"function"==typeof p)for(e=0;s>e;++e)a[e]=+p.call(this,v[e],e);else for(e=0;s>e;++e)a[e]=p;return o.resume()},o.resume=function(){return o.alpha(.1)},o.stop=function(){return o.alpha(0)},o.drag=function(){return e||(e=Pu.behavior.drag().origin(c).on("dragstart.force",Ke).on("drag.force",n).on("dragend.force",We)),arguments.length?(this.on("mouseover.force",Qe).on("mouseout.force",tr).call(e),void 0):e},Pu.rebind(o,l,"on")};var co=20,lo=1;Pu.layout.partition=function(){function t(n,e,r,i){var u=n.children;if(n.x=e,n.y=n.depth*i,n.dx=r,n.dy=i,u&&(a=u.length)){var a,o,c,l=-1;for(r=n.value?r/n.value:0;a>++l;)t(o=u[l],e,c=o.value*r,i),e+=c}}function n(t){var e=t.children,r=0;if(e&&(i=e.length))for(var i,u=-1;i>++u;)r=Math.max(r,n(e[u]));return 1+r}function e(e,u){var a=r.call(this,e,u);return t(a[0],0,i[0],i[1]/n(a[0])),a}var r=Pu.layout.hierarchy(),i=[1,1];return e.size=function(t){return arguments.length?(i=t,e):i},gr(e,r)},Pu.layout.pie=function(){function t(u){var a=u.map(function(e,r){return+n.call(t,e,r)}),o=+("function"==typeof r?r.apply(this,arguments):r),c=(("function"==typeof i?i.apply(this,arguments):i)-r)/Pu.sum(a),l=Pu.range(u.length);null!=e&&l.sort(e===fo?function(t,n){return a[n]-a[t]}:function(t,n){return e(u[t],u[n])});var f=[];return l.forEach(function(t){var n;f[t]={data:u[t],value:n=a[t],startAngle:o,endAngle:o+=n*c}}),f}var n=Number,e=fo,r=0,i=2*Hu;return t.value=function(e){return arguments.length?(n=e,t):n},t.sort=function(n){return arguments.length?(e=n,t):e},t.startAngle=function(n){return arguments.length?(r=n,t):r},t.endAngle=function(n){return arguments.length?(i=n,t):i},t};var fo={};Pu.layout.stack=function(){function t(o,c){var l=o.map(function(e,r){return n.call(t,e,r)}),f=l.map(function(n){return n.map(function(n,e){return[u.call(t,n,e),a.call(t,n,e)]})}),s=e.call(t,f,c);l=Pu.permute(l,s),f=Pu.permute(f,s);var h,g,p,d=r.call(t,f,c),m=l.length,v=l[0].length;for(g=0;v>g;++g)for(i.call(t,l[0][g],p=d[g],f[0][g][1]),h=1;m>h;++h)i.call(t,l[h][g],p+=f[h-1][g][1],f[h][g][1]);return o}var n=c,e=ur,r=ar,i=ir,u=er,a=rr;return t.values=function(e){return arguments.length?(n=e,t):n},t.order=function(n){return arguments.length?(e="function"==typeof n?n:so.get(n)||ur,t):e},t.offset=function(n){return arguments.length?(r="function"==typeof n?n:ho.get(n)||ar,t):r},t.x=function(n){return arguments.length?(u=n,t):u},t.y=function(n){return arguments.length?(a=n,t):a},t.out=function(n){return arguments.length?(i=n,t):i},t};var so=Pu.map({"inside-out":function(t){var n,e,r=t.length,i=t.map(or),u=t.map(cr),a=Pu.range(r).sort(function(t,n){return i[t]-i[n]}),o=0,c=0,l=[],f=[];for(n=0;r>n;++n)e=a[n],c>o?(o+=u[e],l.push(e)):(c+=u[e],f.push(e));return f.reverse().concat(l)},reverse:function(t){return Pu.range(t.length).reverse()},"default":ur}),ho=Pu.map({silhouette:function(t){var n,e,r,i=t.length,u=t[0].length,a=[],o=0,c=[];for(e=0;u>e;++e){for(n=0,r=0;i>n;n++)r+=t[n][e][1];r>o&&(o=r),a.push(r)}for(e=0;u>e;++e)c[e]=(o-a[e])/2;return c},wiggle:function(t){var n,e,r,i,u,a,o,c,l,f=t.length,s=t[0],h=s.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(n=0,i=0;f>n;++n)i+=t[n][e][1];for(n=0,u=0,o=s[e][0]-s[e-1][0];f>n;++n){for(r=0,a=(t[n][e][1]-t[n][e-1][1])/(2*o);n>r;++r)a+=(t[r][e][1]-t[r][e-1][1])/o;u+=a*t[n][e][1]}g[e]=c-=i?u/i*o:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(t){var n,e,r,i=t.length,u=t[0].length,a=1/i,o=[];for(e=0;u>e;++e){for(n=0,r=0;i>n;n++)r+=t[n][e][1];if(r)for(n=0;i>n;n++)t[n][e][1]/=r;else for(n=0;i>n;n++)t[n][e][1]=a}for(e=0;u>e;++e)o[e]=0;return o},zero:ar});Pu.layout.histogram=function(){function t(t,u){for(var a,o,c=[],l=t.map(e,this),f=r.call(this,l,u),s=i.call(this,f,l,u),u=-1,h=l.length,g=s.length-1,p=n?1:1/h;g>++u;)a=c[u]=[],a.dx=s[u+1]-(a.x=s[u]),a.y=0;if(g>0)for(u=-1;h>++u;)o=l[u],o>=f[0]&&f[1]>=o&&(a=c[Pu.bisect(s,o,1,g)-1],a.y+=p,a.push(t[u]));return c}var n=!0,e=Number,r=hr,i=fr;return t.value=function(n){return arguments.length?(e=n,t):e},t.range=function(n){return arguments.length?(r=f(n),t):r},t.bins=function(n){return arguments.length?(i="number"==typeof n?function(t){return sr(t,n)}:f(n),t):i},t.frequency=function(e){return arguments.length?(n=!!e,t):n},t},Pu.layout.hierarchy=function(){function t(n,a,o){var c=i.call(e,n,a);if(n.depth=a,o.push(n),c&&(l=c.length)){for(var l,f,s=-1,h=n.children=[],g=0,p=a+1;l>++s;)f=t(c[s],p,o),f.parent=n,h.push(f),g+=f.value;r&&h.sort(r),u&&(n.value=g)}else u&&(n.value=+u.call(e,n,a)||0);return n}function n(t,r){var i=t.children,a=0;if(i&&(o=i.length))for(var o,c=-1,l=r+1;o>++c;)a+=n(i[c],l);else u&&(a=+u.call(e,t,r)||0);return u&&(t.value=a),a}function e(n){var e=[];return t(n,0,e),e}var r=mr,i=pr,u=dr;return e.sort=function(t){return arguments.length?(r=t,e):r},e.children=function(t){return arguments.length?(i=t,e):i},e.value=function(t){return arguments.length?(u=t,e):u},e.revalue=function(t){return n(t,0),t},e},Pu.layout.pack=function(){function t(t,i){var u=n.call(this,t,i),a=u[0];a.x=0,a.y=0,Pr(a,function(t){t.r=Math.sqrt(t.value)}),Pr(a,_r);var o=r[0],c=r[1],l=Math.max(2*a.r/o,2*a.r/c);if(e>0){var f=e*l/2;Pr(a,function(t){t.r+=f}),Pr(a,_r),Pr(a,function(t){t.r-=f}),l=Math.max(2*a.r/o,2*a.r/c)}return kr(a,o/2,c/2,1/l),u}var n=Pu.layout.hierarchy().sort(yr),e=0,r=[1,1];return t.size=function(n){return arguments.length?(r=n,t):r},t.padding=function(n){return arguments.length?(e=+n,t):e},gr(t,n)},Pu.layout.cluster=function(){function t(t,i){var u,a=n.call(this,t,i),o=a[0],c=0;Pr(o,function(t){var n=t.children;n&&n.length?(t.x=Nr(n),t.y=Ar(n)):(t.x=u?c+=e(t,u):0,t.y=0,u=t)});var l=Tr(o),f=qr(o),s=l.x-e(l,f)/2,h=f.x+e(f,l)/2;return Pr(o,function(t){t.x=(t.x-s)/(h-s)*r[0],t.y=(1-(o.y?t.y/o.y:1))*r[1]}),a}var n=Pu.layout.hierarchy().sort(null).value(null),e=Cr,r=[1,1];return t.separation=function(n){return arguments.length?(e=n,t):e},t.size=function(n){return arguments.length?(r=n,t):r},gr(t,n)},Pu.layout.tree=function(){function t(t,i){function u(t,n){var r=t.children,i=t._tree;if(r&&(a=r.length)){for(var a,c,l,f=r[0],s=f,h=-1;a>++h;)l=r[h],u(l,c),s=o(l,c,s),c=l;Rr(t);var g=.5*(f._tree.prelim+l._tree.prelim);n?(i.prelim=n._tree.prelim+e(t,n),i.mod=i.prelim-g):i.prelim=g}else n&&(i.prelim=n._tree.prelim+e(t,n))}function a(t,n){t.x=t._tree.prelim+n;var e=t.children;if(e&&(r=e.length)){var r,i=-1;for(n+=t._tree.mod;r>++i;)a(e[i],n)}}function o(t,n,r){if(n){for(var i,u=t,a=t,o=n,c=t.parent.children[0],l=u._tree.mod,f=a._tree.mod,s=o._tree.mod,h=c._tree.mod;o=Dr(o),u=zr(u),o&&u;)c=zr(c),a=Dr(a),a._tree.ancestor=t,i=o._tree.prelim+s-u._tree.prelim-l+e(o,u),i>0&&(Or(Yr(o,t,r),t,i),l+=i,f+=i),s+=o._tree.mod,l+=u._tree.mod,h+=c._tree.mod,f+=a._tree.mod;o&&!Dr(a)&&(a._tree.thread=o,a._tree.mod+=s-f),u&&!zr(c)&&(c._tree.thread=u,c._tree.mod+=l-h,r=t)}return r}var c=n.call(this,t,i),l=c[0];Pr(l,function(t,n){t._tree={ancestor:t,prelim:0,mod:0,change:0,shift:0,number:n?n._tree.number+1:0}}),u(l),a(l,-l._tree.prelim);var f=Lr(l,Hr),s=Lr(l,Fr),h=Lr(l,jr),g=f.x-e(f,s)/2,p=s.x+e(s,f)/2,d=h.depth||1;return Pr(l,function(t){t.x=(t.x-g)/(p-g)*r[0],t.y=t.depth/d*r[1],delete t._tree}),c}var n=Pu.layout.hierarchy().sort(null).value(null),e=Cr,r=[1,1];return t.separation=function(n){return arguments.length?(e=n,t):e},t.size=function(n){return arguments.length?(r=n,t):r},gr(t,n)},Pu.layout.treemap=function(){function t(t,n){for(var e,r,i=-1,u=t.length;u>++i;)r=(e=t[i]).value*(0>n?0:n),e.area=isNaN(r)||0>=r?0:r}function n(e){var u=e.children;if(u&&u.length){var a,o,c,l=s(e),f=[],h=u.slice(),p=1/0,d="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(t(h,l.dx*l.dy/e.value),f.area=0;(c=h.length)>0;)f.push(a=h[c-1]),f.area+=a.area,"squarify"!==g||p>=(o=r(f,d))?(h.pop(),p=o):(f.area-=f.pop().area,i(f,d,l,!1),d=Math.min(l.dx,l.dy),f.length=f.area=0,p=1/0);f.length&&(i(f,d,l,!0),f.length=f.area=0),u.forEach(n)}}function e(n){var r=n.children;if(r&&r.length){var u,a=s(n),o=r.slice(),c=[];for(t(o,a.dx*a.dy/n.value),c.area=0;u=o.pop();)c.push(u),c.area+=u.area,null!=u.z&&(i(c,u.z?a.dx:a.dy,a,!o.length),c.length=c.area=0);r.forEach(e)}}function r(t,n){for(var e,r=t.area,i=0,u=1/0,a=-1,o=t.length;o>++a;)(e=t[a].area)&&(u>e&&(u=e),e>i&&(i=e));return r*=r,n*=n,r?Math.max(n*i*p/r,r/(n*u*p)):1/0}function i(t,n,e,r){var i,u=-1,a=t.length,o=e.x,l=e.y,f=n?c(t.area/n):0;if(n==e.dx){for((r||f>e.dy)&&(f=e.dy);a>++u;)i=t[u],i.x=o,i.y=l,i.dy=f,o+=i.dx=Math.min(e.x+e.dx-o,f?c(i.area/f):0);i.z=!0,i.dx+=e.x+e.dx-o,e.y+=f,e.dy-=f}else{for((r||f>e.dx)&&(f=e.dx);a>++u;)i=t[u],i.x=o,i.y=l,i.dx=f,l+=i.dy=Math.min(e.y+e.dy-l,f?c(i.area/f):0);i.z=!1,i.dy+=e.y+e.dy-l,e.x+=f,e.dx-=f}}function u(r){var i=a||o(r),u=i[0];return u.x=0,u.y=0,u.dx=l[0],u.dy=l[1],a&&o.revalue(u),t([u],u.dx*u.dy/u.value),(a?e:n)(u),h&&(a=i),i}var a,o=Pu.layout.hierarchy(),c=Math.round,l=[1,1],f=null,s=Ur,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return u.size=function(t){return arguments.length?(l=t,u):l},u.padding=function(t){function n(n){var e=t.call(u,n,n.depth);return null==e?Ur(n):Ir(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return Ir(n,t)}if(!arguments.length)return f;var r;return s=null==(f=t)?Ur:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,u},u.round=function(t){return arguments.length?(c=t?Math.round:Number,u):c!=Number},u.sticky=function(t){return arguments.length?(h=t,a=null,u):h},u.ratio=function(t){return arguments.length?(p=t,u):p},u.mode=function(t){return arguments.length?(g=t+"",u):g},gr(u,o)},Pu.layout.voronoi=function(){function t(t){var e,u,a,o=[],c=f(r),l=f(i),s=t.length;for(a=0;s>a;++a)o.push([+c.call(this,u=t[a],a),+l.call(this,u,a)]);for(e=Pu.geom.voronoi(o),a=0;s>a;++a)e[a].data=t[a];if(n)for(a=0;s>a;++a)n(e[a]);return e}var n,e=null,r=me,i=ve;return t.x=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(i=n,t):i},t.size=function(r){if(!arguments.length)return e;if(null==r)n=null;else{var i=+r[0],u=+r[1];n=Pu.geom.polygon([[0,0],[0,u],[i,u],[i,0]]).clip}return t},t},Pu.csv=Vr(",","text/csv"),Pu.tsv=Vr(" ","text/tab-separated-values"),Pu.geo={},Pu.geo.stream=function(t,n){go.hasOwnProperty(t.type)?go[t.type](t,n):Zr(t,n)};var go={Feature:function(t,n){Zr(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;i>++r;)Zr(e[r].geometry,n)}},po={Sphere:function(t,n){n.sphere()},Point:function(t,n){var e=t.coordinates;n.point(e[0],e[1])},MultiPoint:function(t,n){for(var e,r=t.coordinates,i=-1,u=r.length;u>++i;)e=r[i],n.point(e[0],e[1])},LineString:function(t,n){Xr(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;i>++r;)Xr(e[r],n,0)},Polygon:function(t,n){Br(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;i>++r;)Br(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;i>++r;)Zr(e[r],n)}};Pu.geo.distance=function(t,n){var e,r=(n[0]-t[0])*Ru,i=t[1]*Ru,u=n[1]*Ru,a=Math.sin(r),o=Math.cos(r),c=Math.sin(i),l=Math.cos(i),f=Math.sin(u),s=Math.cos(u);return Math.atan2(Math.sqrt((e=s*a)*e+(e=l*f-c*s*o)*e),c*f+l*s*o)},Pu.geo.albersUsa=function(){function t(t){return n(t)(t)}function n(t){var n=t[0],e=t[1];return e>50?a:-140>n?o:21>e?c:u}var e,r,i,u=Pu.geo.albers(),a=Pu.geo.albers().rotate([160,0]).center([0,60]).parallels([55,65]),o=Pu.geo.albers().rotate([160,0]).center([0,20]).parallels([8,18]),c=Pu.geo.albers().rotate([60,0]).center([0,10]).parallels([8,18]);return t.invert=function(t){return e(t)||r(t)||i(t)||u.invert(t)},t.scale=function(n){return arguments.length?(u.scale(n),a.scale(.6*n),o.scale(n),c.scale(1.5*n),t.translate(u.translate())):u.scale()},t.translate=function(n){if(!arguments.length)return u.translate();var l=u.scale(),f=n[0],s=n[1];return u.translate(n),a.translate([f-.4*l,s+.17*l]),o.translate([f-.19*l,s+.2*l]),c.translate([f+.58*l,s+.43*l]),e=ri(a,[[-180,50],[-130,72]]),r=ri(o,[[-164,18],[-154,24]]),i=ri(c,[[-67.5,17.5],[-65,19]]),t},t.scale(u.scale())},(Pu.geo.albers=function(){var t=29.5*Ru,n=45.5*Ru,e=Ii(ii),r=e(t,n);return r.parallels=function(r){return arguments.length?e(t=r[0]*Ru,n=r[1]*Ru):[t*Ou,n*Ou]},r.rotate([98,0]).center([0,38]).scale(1e3)}).raw=ii;var mo=Ji(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Pu.geo.azimuthalEqualArea=function(){return Ui(mo)}).raw=mo;var vo=Ji(function(t){var n=Math.acos(t);return n&&n/Math.sin(n)},c);(Pu.geo.azimuthalEquidistant=function(){return Ui(vo)}).raw=vo,Pu.geo.bounds=ui(c),Pu.geo.centroid=function(t){yo=Mo=bo=xo=_o=0,Pu.geo.stream(t,wo);var n;return Mo&&Math.abs(n=Math.sqrt(bo*bo+xo*xo+_o*_o))>ju?[Math.atan2(xo,bo)*Ou,Math.asin(Math.max(-1,Math.min(1,_o/n)))*Ou]:void 0};var yo,Mo,bo,xo,_o,wo={sphere:function(){2>yo&&(yo=2,Mo=bo=xo=_o=0)},point:ai,lineStart:ci,lineEnd:li,polygonStart:function(){2>yo&&(yo=2,Mo=bo=xo=_o=0),wo.lineStart=oi},polygonEnd:function(){wo.lineStart=ci}};Pu.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,n=Zi(-t[0]*Ru,-t[1]*Ru,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Ou,t[1]*=Ou}}),{type:"Polygon",coordinates:[i]}}var n,e,r=[0,0],i=6;return t.origin=function(n){return arguments.length?(r=n,t):r},t.angle=function(r){return arguments.length?(e=fi((n=+r)*Ru,i*Ru),t):n},t.precision=function(r){return arguments.length?(e=fi(n*Ru,(i=+r)*Ru),t):i},t.angle(90)};var So=hi(l,Mi,xi);Pu.geo.clipView=function(t,n,e,r){var i=Pu.geom.polygon([[t,n],[t,r],[e,r],[e,n]]).clip,u=wi(t,e,n,r);return function(t){function n(t,n){return t>=g&&e>=t&&n>=p&&r>=n}function a(e,r){n(e,r)&&t.point(e,r)}function o(){y.point=l,m=!0,d=!1}function c(){y.point=a,d&&t.lineEnd()}function l(e,r){var i=n(e,r);if(m)i&&(t.lineStart(),t.point(e,r));else if(i&&d)t.point(e,r);else{var a=[g,p],o=[e,r];u(a,o)&&(d||(t.lineStart(),t.point(a[0],a[1])),t.point(o[0],o[1]),i||t.lineEnd())}m=!1,g=e,p=r,d=i}function f(){v=[]}function s(){v.pop(),v=i(v);var n=v.length;if(n){t.lineStart();for(var e,r=0,n=v.length;n>r;++r)t.point((e=v[r])[0],e[1]);t.point(v[0][0],v[0][1]),t.lineEnd()}}function h(t,n){v.push([t,n])}var g,p,d,m,v,y={point:a,lineStart:o,lineEnd:c,polygonStart:function(){t.polygonStart(),y.lineStart=f,y.lineEnd=s,y.point=h},polygonEnd:function(){y.point=a,y.lineEnd=c,y.lineStart=o,t.polygonEnd()}};return y}},(Pu.geo.equirectangular=function(){return Ui(ki).scale(250/Hu)}).raw=ki.invert=ki;var ko=Ji(function(t){return 1/t},Math.atan);(Pu.geo.gnomonic=function(){return Ui(ko)}).raw=ko,Pu.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:n()}}function n(){return Pu.range(Math.ceil(u/m)*m,i,m).map(h).concat(Pu.range(Math.ceil(l/v)*v,c,v).map(g)).concat(Pu.range(Math.ceil(r/p)*p,e,p).filter(function(t){return Math.abs(t%m)>ju}).map(f)).concat(Pu.range(Math.ceil(o/d)*d,a,d).filter(function(t){return Math.abs(t%v)>ju}).map(s))}var e,r,i,u,a,o,c,l,f,s,h,g,p=10,d=p,m=90,v=360,y=2.5;return t.lines=function(){return n().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(c).slice(1),h(i).reverse().slice(1),g(l).reverse().slice(1))]}},t.extent=function(n){return arguments.length?t.majorExtent(n).minorExtent(n):t.minorExtent()},t.majorExtent=function(n){return arguments.length?(u=+n[0][0],i=+n[1][0],l=+n[0][1],c=+n[1][1],u>i&&(n=u,u=i,i=n),l>c&&(n=l,l=c,c=n),t.precision(y)):[[u,l],[i,c]]},t.minorExtent=function(n){return arguments.length?(r=+n[0][0],e=+n[1][0],o=+n[0][1],a=+n[1][1],r>e&&(n=r,r=e,e=n),o>a&&(n=o,o=a,a=n),t.precision(y)):[[r,o],[e,a]]},t.step=function(n){return arguments.length?t.majorStep(n).minorStep(n):t.minorStep()},t.majorStep=function(n){return arguments.length?(m=+n[0],v=+n[1],t):[m,v]},t.minorStep=function(n){return arguments.length?(p=+n[0],d=+n[1],t):[p,d]},t.precision=function(n){return arguments.length?(y=+n,f=Ei(o,a,90),s=Ai(r,e,y),h=Ei(l,c,90),g=Ai(u,i,y),t):y},t.majorExtent([[-180,-90+ju],[180,90-ju]]).minorExtent([[-180,-80-ju],[180,80+ju]])},Pu.geo.interpolate=function(t,n){return Ti(t[0]*Ru,t[1]*Ru,n[0]*Ru,n[1]*Ru)},Pu.geo.greatArc=function(){function e(){return{type:"LineString",coordinates:[r||u.apply(this,arguments),i||a.apply(this,arguments)]}}var r,i,u=n,a=t;return e.distance=function(){return Pu.geo.distance(r||u.apply(this,arguments),i||a.apply(this,arguments))},e.source=function(t){return arguments.length?(u=t,r="function"==typeof t?null:t,e):u},e.target=function(t){return arguments.length?(a=t,i="function"==typeof t?null:t,e):a},e.precision=function(){return arguments.length?e:0},e},qi.invert=function(t,n){return[2*Hu*t,2*Math.atan(Math.exp(2*Hu*n))-Hu/2]},(Pu.geo.mercator=function(){return Ui(qi).scale(500)}).raw=qi;var Eo=Ji(function(){return 1},Math.asin);(Pu.geo.orthographic=function(){return Ui(Eo)}).raw=Eo,Pu.geo.path=function(){function t(t){return t&&Pu.geo.stream(t,r(i.pointRadius("function"==typeof u?+u.apply(this,arguments):u))),i.result()}var n,e,r,i,u=4.5;return t.area=function(t){return Ao=0,Pu.geo.stream(t,r(To)),Ao},t.centroid=function(t){return yo=bo=xo=_o=0,Pu.geo.stream(t,r(qo)),_o?[bo/_o,xo/_o]:void 0},t.bounds=function(t){return ui(r)(t)},t.projection=function(e){return arguments.length?(r=(n=e)?e.stream||zi(e):c,t):n},t.context=function(n){return arguments.length?(i=null==(e=n)?new Di:new Li(n),t):e},t.pointRadius=function(n){return arguments.length?(u="function"==typeof n?n:+n,t):u},t.projection(Pu.geo.albersUsa()).context(null)};var Ao,No,To={point:On,lineStart:On,lineEnd:On,polygonStart:function(){No=0,To.lineStart=Fi},polygonEnd:function(){To.lineStart=To.lineEnd=To.point=On,Ao+=Math.abs(No/2)}},qo={point:Hi,lineStart:ji,lineEnd:Pi,polygonStart:function(){qo.lineStart=Ri},polygonEnd:function(){qo.point=Hi,qo.lineStart=ji,qo.lineEnd=Pi}};Pu.geo.area=function(t){return Co=0,Pu.geo.stream(t,Lo),Co};var Co,zo,Do,Lo={sphere:function(){Co+=4*Hu},point:On,lineStart:On,lineEnd:On,polygonStart:function(){zo=1,Do=0,Lo.lineStart=Oi},polygonEnd:function(){var t=2*Math.atan2(Do,zo);Co+=0>t?4*Hu+t:t,Lo.lineStart=Lo.lineEnd=Lo.point=On}};Pu.geo.length=function(t){return Fo=0,Pu.geo.stream(t,Ho),Fo};var Fo,Ho={sphere:On,point:On,lineStart:Yi,lineEnd:On,polygonStart:On,polygonEnd:On};Pu.geo.projection=Ui,Pu.geo.projectionMutator=Ii,Pu.geo.rotation=function(t){return t=Zi(t[0]%360*Ru,t[1]*Ru,t.length>2?t[2]*Ru:0),function(n){return n=t(n[0]*Ru,n[1]*Ru),n[0]*=Ou,n[1]*=Ou,n}};var jo=Ji(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Pu.geo.stereographic=function(){return Ui(jo)}).raw=jo,Pu.geom={},Pu.geom.hull=function(t){if(3>t.length)return[];var n,e,r,i,u,a,o,c,l,f,s=t.length,h=s-1,g=[],p=[],d=0;for(n=1;s>n;++n)t[n][1]n;++n)n!==d&&(i=t[n][1]-t[d][1],r=t[n][0]-t[d][0],g.push({angle:Math.atan2(i,r),index:n}));for(g.sort(function(t,n){return t.angle-n.angle}),l=g[0].angle,c=g[0].index,o=0,n=1;h>n;++n)e=g[n].index,l==g[n].angle?(r=t[c][0]-t[d][0],i=t[c][1]-t[d][1],u=t[e][0]-t[d][0],a=t[e][1]-t[d][1],r*r+i*i>=u*u+a*a?g[n].index=-1:(g[o].index=-1,l=g[n].angle,o=n,c=e)):(l=g[n].angle,o=n,c=e);for(p.push(d),n=0,e=0;2>n;++e)-1!==g[e].index&&(p.push(g[e].index),n++);for(f=p.length;h>e;++e)if(-1!==g[e].index){for(;!Gi(p[f-2],p[f-1],g[e].index,t);)--f;p[f++]=g[e].index}var m=[];for(n=0;f>n;++n)m.push(t[p[n]]);return m},Pu.geom.polygon=function(t){return t.area=function(){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];e>++n;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return.5*r},t.centroid=function(n){var e,r,i=-1,u=t.length,a=0,o=0,c=t[u-1];for(arguments.length||(n=-1/(6*t.area()));u>++i;)e=c,c=t[i],r=e[0]*c[1]-c[0]*e[1],a+=(e[0]+c[0])*r,o+=(e[1]+c[1])*r;return[a*n,o*n]},t.clip=function(n){for(var e,r,i,u,a,o,c=-1,l=t.length,f=t[l-1];l>++c;){for(e=n.slice(),n.length=0,u=t[c],a=e[(i=e.length)-1],r=-1;i>++r;)o=e[r],Ki(o,f,u)?(Ki(a,f,u)||n.push(Wi(a,o,f,u)),n.push(o)):Ki(a,f,u)&&n.push(Wi(a,o,f,u)),a=o;f=u}return n},t},Pu.geom.voronoi=function(t){var n=t.map(function(){return[]}),e=1e6;return Qi(t,function(t){var r,i,u,a,o,c;1===t.a&&t.b>=0?(r=t.ep.r,i=t.ep.l):(r=t.ep.l,i=t.ep.r),1===t.a?(o=r?r.y:-e,u=t.c-t.b*o,c=i?i.y:e,a=t.c-t.b*c):(u=r?r.x:-e,o=t.c-t.a*u,a=i?i.x:e,c=t.c-t.a*a);var l=[u,o],f=[a,c];n[t.region.l.index].push(l,f),n[t.region.r.index].push(l,f)}),n=n.map(function(n,e){var r=t[e][0],i=t[e][1],u=n.map(function(t){return Math.atan2(t[0]-r,t[1]-i)}),a=Pu.range(n.length).sort(function(t,n){return u[t]-u[n]});return a.filter(function(t,n){return!n||u[t]-u[a[n-1]]>ju}).map(function(t){return n[t]})}),n.forEach(function(n,r){var i=n.length;if(!i)return n.push([-e,-e],[-e,e],[e,e],[e,-e]);if(!(i>2)){var u=t[r],a=n[0],o=n[1],c=u[0],l=u[1],f=a[0],s=a[1],h=o[0],g=o[1],p=Math.abs(h-f),d=g-s;if(ju>Math.abs(d)){var m=s>l?-e:e;n.push([-e,m],[e,m])}else if(ju>p){var v=f>c?-e:e;n.push([v,-e],[v,e])}else{var m=(f-c)*(g-s)>(h-f)*(s-l)?e:-e,y=Math.abs(d)-p;ju>Math.abs(y)?n.push([0>d?m:-m,m]):(y>0&&(m*=-1),n.push([-e,m],[e,m]))}}}),n};var Po={l:"r",r:"l"};Pu.geom.delaunay=function(t){var n=t.map(function(){return[]}),e=[];return Qi(t,function(e){n[e.region.l.index].push(t[e.region.r.index])}),n.forEach(function(n,r){var i=t[r],u=i[0],a=i[1];n.forEach(function(t){t.angle=Math.atan2(t[0]-u,t[1]-a)}),n.sort(function(t,n){return t.angle-n.angle});for(var o=0,c=n.length-1;c>o;o++)e.push([i,n[o],n[o+1]])}),e},Pu.geom.quadtree=function(t,n,e,r,i){function u(t,n,e,r,i,u){if(!isNaN(n.x)&&!isNaN(n.y))if(t.leaf){var o=t.point;o?.01>Math.abs(o.x-n.x)+Math.abs(o.y-n.y)?a(t,n,e,r,i,u):(t.point=null,a(t,o,e,r,i,u),a(t,n,e,r,i,u)):t.point=n}else a(t,n,e,r,i,u)}function a(t,n,e,r,i,a){var o=.5*(e+i),c=.5*(r+a),l=n.x>=o,f=n.y>=c,s=(f<<1)+l;t.leaf=!1,t=t.nodes[s]||(t.nodes[s]=tu()),l?e=o:i=o,f?r=c:a=c,u(t,n,e,r,i,a)}var o,c=-1,l=t.length;if(5>arguments.length)if(3===arguments.length)i=e,r=n,e=n=0;else for(n=e=1/0,r=i=-1/0;l>++c;)o=t[c],n>o.x&&(n=o.x),e>o.y&&(e=o.y),o.x>r&&(r=o.x),o.y>i&&(i=o.y);var f=r-n,s=i-e;f>s?i=e+f:r=n+s;var h=tu();return h.add=function(t){u(h,t,n,e,r,i)},h.visit=function(t){nu(t,h,n,e,r,i)},t.forEach(h.add),h},Pu.time={};var Ro=Date,Oo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];eu.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Yo.setUTCDate.apply(this._,arguments)},setDay:function(){Yo.setUTCDay.apply(this._,arguments)},setFullYear:function(){Yo.setUTCFullYear.apply(this._,arguments)},setHours:function(){Yo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Yo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Yo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Yo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Yo.setUTCSeconds.apply(this._,arguments)},setTime:function(){Yo.setTime.apply(this._,arguments)}};var Yo=Date.prototype,Uo="%a %b %e %X %Y",Io="%m/%d/%Y",Vo="%H:%M:%S",Zo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Xo=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Bo=["January","February","March","April","May","June","July","August","September","October","November","December"],$o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Pu.time.format=function(t){function n(n){for(var r,i,u,a=[],o=-1,c=0;e>++o;)37===t.charCodeAt(o)&&(a.push(t.substring(c,o)),null!=(i=nc[r=t.charAt(++o)])&&(r=t.charAt(++o)),(u=ec[r])&&(r=u(n,null==i?"e"===r?" ":"0":i)),a.push(r),c=o+1);return a.push(t.substring(c,o)),a.join("")}var e=t.length;return n.parse=function(n){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=ru(e,t,n,0);if(r!=n.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var i=new Ro;return i.setFullYear(e.y,e.m,e.d),i.setHours(e.H,e.M,e.S,e.L),i},n.toString=function(){return t},n};var Jo=iu(Zo),Go=iu(Xo),Ko=iu(Bo),Wo=uu(Bo),Qo=iu($o),tc=uu($o),nc={"-":"",_:" ",0:"0"},ec={a:function(t){return Xo[t.getDay()]},A:function(t){return Zo[t.getDay()]},b:function(t){return $o[t.getMonth()]},B:function(t){return Bo[t.getMonth()]},c:Pu.time.format(Uo),d:function(t,n){return au(t.getDate(),n,2)},e:function(t,n){return au(t.getDate(),n,2)},H:function(t,n){return au(t.getHours(),n,2)},I:function(t,n){return au(t.getHours()%12||12,n,2)},j:function(t,n){return au(1+Pu.time.dayOfYear(t),n,3)},L:function(t,n){return au(t.getMilliseconds(),n,3)},m:function(t,n){return au(t.getMonth()+1,n,2)},M:function(t,n){return au(t.getMinutes(),n,2)},p:function(t){return t.getHours()>=12?"PM":"AM"},S:function(t,n){return au(t.getSeconds(),n,2)},U:function(t,n){return au(Pu.time.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return au(Pu.time.mondayOfYear(t),n,2)},x:Pu.time.format(Io),X:Pu.time.format(Vo),y:function(t,n){return au(t.getFullYear()%100,n,2)},Y:function(t,n){return au(t.getFullYear()%1e4,n,4)},Z:Su,"%":function(){return"%"}},rc={a:ou,A:cu,b:lu,B:fu,c:su,d:yu,e:yu,H:Mu,I:Mu,L:_u,m:vu,M:bu,p:wu,S:xu,x:hu,X:gu,y:du,Y:pu},ic=/^\s*\d+/,uc=Pu.map({am:0,pm:1});Pu.time.format.utc=function(t){function n(t){try{Ro=eu;var n=new Ro;return n._=t,e(n)}finally{Ro=Date}}var e=Pu.time.format(t);return n.parse=function(t){try{Ro=eu;var n=e.parse(t);return n&&n._}finally{Ro=Date}},n.toString=e.toString,n};var ac=Pu.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");Pu.time.format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?ku:ac,ku.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},ku.toString=ac.toString,Pu.time.second=Eu(function(t){return new Ro(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))},function(t){return t.getSeconds()}),Pu.time.seconds=Pu.time.second.range,Pu.time.seconds.utc=Pu.time.second.utc.range,Pu.time.minute=Eu(function(t){return new Ro(6e4*Math.floor(t/6e4))},function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))},function(t){return t.getMinutes()}),Pu.time.minutes=Pu.time.minute.range,Pu.time.minutes.utc=Pu.time.minute.utc.range,Pu.time.hour=Eu(function(t){var n=t.getTimezoneOffset()/60;return new Ro(36e5*(Math.floor(t/36e5-n)+n))},function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))},function(t){return t.getHours() -}),Pu.time.hours=Pu.time.hour.range,Pu.time.hours.utc=Pu.time.hour.utc.range,Pu.time.day=Eu(function(t){var n=new Ro(1970,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n},function(t,n){t.setDate(t.getDate()+n)},function(t){return t.getDate()-1}),Pu.time.days=Pu.time.day.range,Pu.time.days.utc=Pu.time.day.utc.range,Pu.time.dayOfYear=function(t){var n=Pu.time.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},Oo.forEach(function(t,n){t=t.toLowerCase(),n=7-n;var e=Pu.time[t]=Eu(function(t){return(t=Pu.time.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t},function(t,n){t.setDate(t.getDate()+7*Math.floor(n))},function(t){var e=Pu.time.year(t).getDay();return Math.floor((Pu.time.dayOfYear(t)+(e+n)%7)/7)-(e!==n)});Pu.time[t+"s"]=e.range,Pu.time[t+"s"].utc=e.utc.range,Pu.time[t+"OfYear"]=function(t){var e=Pu.time.year(t).getDay();return Math.floor((Pu.time.dayOfYear(t)+(e+n)%7)/7)}}),Pu.time.week=Pu.time.sunday,Pu.time.weeks=Pu.time.sunday.range,Pu.time.weeks.utc=Pu.time.sunday.utc.range,Pu.time.weekOfYear=Pu.time.sundayOfYear,Pu.time.month=Eu(function(t){return t=Pu.time.day(t),t.setDate(1),t},function(t,n){t.setMonth(t.getMonth()+n)},function(t){return t.getMonth()}),Pu.time.months=Pu.time.month.range,Pu.time.months.utc=Pu.time.month.utc.range,Pu.time.year=Eu(function(t){return t=Pu.time.day(t),t.setMonth(0,1),t},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t){return t.getFullYear()}),Pu.time.years=Pu.time.year.range,Pu.time.years.utc=Pu.time.year.utc.range;var oc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],cc=[[Pu.time.second,1],[Pu.time.second,5],[Pu.time.second,15],[Pu.time.second,30],[Pu.time.minute,1],[Pu.time.minute,5],[Pu.time.minute,15],[Pu.time.minute,30],[Pu.time.hour,1],[Pu.time.hour,3],[Pu.time.hour,6],[Pu.time.hour,12],[Pu.time.day,1],[Pu.time.day,2],[Pu.time.week,1],[Pu.time.month,1],[Pu.time.month,3],[Pu.time.year,1]],lc=[[Pu.time.format("%Y"),l],[Pu.time.format("%B"),function(t){return t.getMonth()}],[Pu.time.format("%b %d"),function(t){return 1!=t.getDate()}],[Pu.time.format("%a %d"),function(t){return t.getDay()&&1!=t.getDate()}],[Pu.time.format("%I %p"),function(t){return t.getHours()}],[Pu.time.format("%I:%M"),function(t){return t.getMinutes()}],[Pu.time.format(":%S"),function(t){return t.getSeconds()}],[Pu.time.format(".%L"),function(t){return t.getMilliseconds()}]],fc=Pu.scale.linear(),sc=Cu(lc);cc.year=function(t,n){return fc.domain(t.map(Du)).ticks(n).map(zu)},Pu.time.scale=function(){return Nu(Pu.scale.linear(),cc,sc)};var hc=cc.map(function(t){return[t[0].utc,t[1]]}),gc=[[Pu.time.format.utc("%Y"),l],[Pu.time.format.utc("%B"),function(t){return t.getUTCMonth()}],[Pu.time.format.utc("%b %d"),function(t){return 1!=t.getUTCDate()}],[Pu.time.format.utc("%a %d"),function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],[Pu.time.format.utc("%I %p"),function(t){return t.getUTCHours()}],[Pu.time.format.utc("%I:%M"),function(t){return t.getUTCMinutes()}],[Pu.time.format.utc(":%S"),function(t){return t.getUTCSeconds()}],[Pu.time.format.utc(".%L"),function(t){return t.getUTCMilliseconds()}]],pc=Cu(gc);return hc.year=function(t,n){return fc.domain(t.map(Fu)).ticks(n).map(Lu)},Pu.time.scale.utc=function(){return Nu(Pu.scale.linear(),hc,pc)},Pu}(); \ No newline at end of file +var e=t.l,r=t.a,i=t.b,u=n.l-e,a=n.a-r,o=n.b-i;return function(t){return gn(e+u*t,r+a*t,i+o*t)+""}},Pu.interpolateHcl=function(t,n){t=Pu.hcl(t),n=Pu.hcl(n);var e=t.h,r=t.c,i=t.l,u=n.h-e,a=n.c-r,o=n.l-i;return u>180?u-=360:-180>u&&(u+=360),function(t){return fn(e+u*t,r+a*t,i+o*t)+""}},Pu.interpolateArray=function(t,n){var e,r=[],i=[],u=t.length,a=n.length,o=Math.min(t.length,n.length);for(e=0;o>e;++e)r.push(Pu.interpolate(t[e],n[e]));for(;u>e;++e)i[e]=t[e];for(;a>e;++e)i[e]=n[e];return function(t){for(e=0;o>e;++e)i[e]=r[e](t);return i}},Pu.interpolateObject=function(t,n){var e,r={},i={};for(e in t)e in n?r[e]=X(e)(t[e],n[e]):i[e]=t[e];for(e in n)e in t||(i[e]=n[e]);return function(t){for(e in r)i[e]=r[e](t);return i}};var ha=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;Pu.interpolators=[Pu.interpolateObject,function(t,n){return n instanceof Array&&Pu.interpolateArray(t,n)},function(t,n){return("string"==typeof t||"string"==typeof n)&&Pu.interpolateString(t+"",n+"")},function(t,n){return("string"==typeof n?pa.has(n)||/^(#|rgb\(|hsl\()/.test(n):n instanceof J)&&Pu.interpolateRgb(t,n)},function(t,n){return!isNaN(t=+t)&&!isNaN(n=+n)&&Pu.interpolateNumber(t,n)}],J.prototype.toString=function(){return this.rgb()+""},Pu.rgb=function(t,n,e){return 1===arguments.length?t instanceof K?G(t.r,t.g,t.b):Q(""+t,G,on):G(~~t,~~n,~~e)};var ga=K.prototype=new J;ga.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,i=30;return n||e||r?(n&&i>n&&(n=i),e&&i>e&&(e=i),r&&i>r&&(r=i),G(Math.min(255,Math.floor(n/t)),Math.min(255,Math.floor(e/t)),Math.min(255,Math.floor(r/t)))):G(i,i,i)},ga.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),G(Math.floor(t*this.r),Math.floor(t*this.g),Math.floor(t*this.b))},ga.hsl=function(){return tn(this.r,this.g,this.b)},ga.toString=function(){return"#"+W(this.r)+W(this.g)+W(this.b)};var pa=Pu.map({aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"});pa.forEach(function(t,n){pa.set(t,Q(n,G,on))}),Pu.hsl=function(t,n,e){return 1===arguments.length?t instanceof an?un(t.h,t.s,t.l):Q(""+t,tn,un):un(+t,+n,+e)};var da=an.prototype=new J;da.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),un(this.h,this.s,this.l/t)},da.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),un(this.h,this.s,t*this.l)},da.rgb=function(){return on(this.h,this.s,this.l)},Pu.hcl=function(t,n,e){return 1===arguments.length?t instanceof ln?cn(t.h,t.c,t.l):t instanceof hn?pn(t.l,t.a,t.b):pn((t=nn((t=Pu.rgb(t)).r,t.g,t.b)).l,t.a,t.b):cn(+t,+n,+e)};var ma=ln.prototype=new J;ma.brighter=function(t){return cn(this.h,this.c,Math.min(100,this.l+va*(arguments.length?t:1)))},ma.darker=function(t){return cn(this.h,this.c,Math.max(0,this.l-va*(arguments.length?t:1)))},ma.rgb=function(){return fn(this.h,this.c,this.l).rgb()},Pu.lab=function(t,n,e){return 1===arguments.length?t instanceof hn?sn(t.l,t.a,t.b):t instanceof ln?fn(t.l,t.c,t.h):nn((t=Pu.rgb(t)).r,t.g,t.b):sn(+t,+n,+e)};var va=18,ya=.95047,Ma=1,ba=1.08883,xa=hn.prototype=new J;xa.brighter=function(t){return sn(Math.min(100,this.l+va*(arguments.length?t:1)),this.a,this.b)},xa.darker=function(t){return sn(Math.max(0,this.l-va*(arguments.length?t:1)),this.a,this.b)},xa.rgb=function(){return gn(this.l,this.a,this.b)};var _a=function(t,n){return n.querySelector(t)},wa=function(t,n){return n.querySelectorAll(t)},Sa=Yu.documentElement,ka=Sa.matchesSelector||Sa.webkitMatchesSelector||Sa.mozMatchesSelector||Sa.msMatchesSelector||Sa.oMatchesSelector,Ea=function(t,n){return ka.call(t,n)};"function"==typeof Sizzle&&(_a=function(t,n){return Sizzle(t,n)[0]||null},wa=function(t,n){return Sizzle.uniqueSort(Sizzle(t,n))},Ea=Sizzle.matchesSelector);var Aa=[];Pu.selection=function(){return Na},Pu.selection.prototype=Aa,Aa.select=function(t){var n,e,r,i,u=[];"function"!=typeof t&&(t=Mn(t));for(var a=-1,o=this.length;o>++a;){u.push(n=[]),n.parentNode=(r=this[a]).parentNode;for(var c=-1,l=r.length;l>++c;)(i=r[c])?(n.push(e=t.call(i,i.__data__,c)),e&&"__data__"in i&&(e.__data__=i.__data__)):n.push(null)}return yn(u)},Aa.selectAll=function(t){var n,e,r=[];"function"!=typeof t&&(t=bn(t));for(var i=-1,u=this.length;u>++i;)for(var a=this[i],o=-1,c=a.length;c>++o;)(e=a[o])&&(r.push(n=Ju(t.call(e,e.__data__,o))),n.parentNode=e);return yn(r)},Aa.attr=function(t,n){if(2>arguments.length){if("string"==typeof t){var e=this.node();return t=Pu.ns.qualify(t),t.local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(xn(n,t[n]));return this}return this.each(xn(t,n))},Aa.classed=function(t,n){if(2>arguments.length){if("string"==typeof t){var e=this.node(),r=(t=t.trim().split(/^|\s+/g)).length,i=-1;if(n=e.classList){for(;r>++i;)if(!n.contains(t[i]))return!1}else for(n=e.className,null!=n.baseVal&&(n=n.baseVal);r>++i;)if(!_n(t[i]).test(n))return!1;return!0}for(n in t)this.each(wn(n,t[n]));return this}return this.each(wn(t,n))},Aa.style=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n="");for(e in t)this.each(kn(e,t[e],n));return this}if(2>r)return Uu.getComputedStyle(this.node(),null).getPropertyValue(t);e=""}return this.each(kn(t,n,e))},Aa.property=function(t,n){if(2>arguments.length){if("string"==typeof t)return this.node()[t];for(n in t)this.each(En(n,t[n]));return this}return this.each(En(t,n))},Aa.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Aa.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Aa.append=function(t){function n(){return this.appendChild(Yu.createElementNS(this.namespaceURI,t))}function e(){return this.appendChild(Yu.createElementNS(t.space,t.local))}return t=Pu.ns.qualify(t),this.select(t.local?e:n)},Aa.insert=function(t,n){function e(e,r){return this.insertBefore(Yu.createElementNS(this.namespaceURI,t),n.call(this,e,r))}function r(e,r){return this.insertBefore(Yu.createElementNS(t.space,t.local),n.call(this,e,r))}return t=Pu.ns.qualify(t),"function"!=typeof n&&(n=Mn(n)),this.select(t.local?r:e)},Aa.remove=function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})},Aa.data=function(t,n){function e(t,e){var r,i,u,o=t.length,s=e.length,h=Math.min(o,s),g=Array(s),p=Array(s),d=Array(o);if(n){var m,v=new a,y=new a,M=[];for(r=-1;o>++r;)m=n.call(i=t[r],i.__data__,r),v.has(m)?d[r]=i:v.set(m,i),M.push(m);for(r=-1;s>++r;)m=n.call(e,u=e[r],r),(i=v.get(m))?(g[r]=i,i.__data__=u):y.has(m)||(p[r]=An(u)),y.set(m,u),v.remove(m);for(r=-1;o>++r;)v.has(M[r])&&(d[r]=t[r])}else{for(r=-1;h>++r;)i=t[r],u=e[r],i?(i.__data__=u,g[r]=i):p[r]=An(u);for(;s>r;++r)p[r]=An(e[r]);for(;o>r;++r)d[r]=t[r]}p.update=g,p.parentNode=g.parentNode=d.parentNode=t.parentNode,c.push(p),l.push(g),f.push(d)}var r,i,u=-1,o=this.length;if(!arguments.length){for(t=Array(o=(r=this[0]).length);o>++u;)(i=r[u])&&(t[u]=i.__data__);return t}var c=zn([]),l=yn([]),f=yn([]);if("function"==typeof t)for(;o>++u;)e(r=this[u],t.call(r,r.parentNode.__data__,u));else for(;o>++u;)e(r=this[u],t);return l.enter=function(){return c},l.exit=function(){return f},l},Aa.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Aa.filter=function(t){var n,e,r,i=[];"function"!=typeof t&&(t=Nn(t));for(var u=0,a=this.length;a>u;u++){i.push(n=[]),n.parentNode=(e=this[u]).parentNode;for(var o=0,c=e.length;c>o;o++)(r=e[o])&&t.call(r,r.__data__,o)&&n.push(r)}return yn(i)},Aa.order=function(){for(var t=-1,n=this.length;n>++t;)for(var e,r=this[t],i=r.length-1,u=r[i];--i>=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Aa.sort=function(t){t=Tn.apply(this,arguments);for(var n=-1,e=this.length;e>++n;)this[n].sort(t);return this.order()},Aa.on=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n=!1);for(e in t)this.each(qn(e,t[e],n));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(qn(t,n,e))},Aa.each=function(t){return Cn(this,function(n,e,r){t.call(n,n.__data__,e,r)})},Aa.call=function(t){var n=Ju(arguments);return t.apply(n[0]=this,n),this},Aa.empty=function(){return!this.node()},Aa.node=function(){for(var t=0,n=this.length;n>t;t++)for(var e=this[t],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Aa.transition=function(){var t,n,e=qa||++za,r=[],i=Object.create(Da);i.time=Date.now();for(var u=-1,a=this.length;a>++u;){r.push(t=[]);for(var o=this[u],c=-1,l=o.length;l>++c;)(n=o[c])&&Ln(n,c,e,i),t.push(n)}return Dn(r,e)};var Na=yn([[Yu]]);Na[0].parentNode=Sa,Pu.select=function(t){return"string"==typeof t?Na.select(t):yn([[t]])},Pu.selectAll=function(t){return"string"==typeof t?Na.selectAll(t):yn([Ju(t)])};var Ta=[];Pu.selection.enter=zn,Pu.selection.enter.prototype=Ta,Ta.append=Aa.append,Ta.insert=Aa.insert,Ta.empty=Aa.empty,Ta.node=Aa.node,Ta.select=function(t){for(var n,e,r,i,u,a=[],o=-1,c=this.length;c>++o;){r=(i=this[o]).update,a.push(n=[]),n.parentNode=i.parentNode;for(var l=-1,f=i.length;f>++l;)(u=i[l])?(n.push(r[l]=e=t.call(i.parentNode,u.__data__,l)),e.__data__=u.__data__):n.push(null)}return yn(a)};var qa,Ca=[],za=0,Da={ease:C,delay:0,duration:250};Ca.call=Aa.call,Ca.empty=Aa.empty,Ca.node=Aa.node,Pu.transition=function(t){return arguments.length?qa?t.transition():t:Na.transition()},Pu.transition.prototype=Ca,Ca.select=function(t){var n,e,r,i=this.id,u=[];"function"!=typeof t&&(t=Mn(t));for(var a=-1,o=this.length;o>++a;){u.push(n=[]);for(var c=this[a],l=-1,f=c.length;f>++l;)(r=c[l])&&(e=t.call(r,r.__data__,l))?("__data__"in r&&(e.__data__=r.__data__),Ln(e,l,i,r.__transition__[i]),n.push(e)):n.push(null)}return Dn(u,i)},Ca.selectAll=function(t){var n,e,r,i,u,a=this.id,o=[];"function"!=typeof t&&(t=bn(t));for(var c=-1,l=this.length;l>++c;)for(var f=this[c],s=-1,h=f.length;h>++s;)if(r=f[s]){u=r.__transition__[a],e=t.call(r,r.__data__,s),o.push(n=[]);for(var g=-1,p=e.length;p>++g;)Ln(i=e[g],g,a,u),n.push(i)}return Dn(o,a)},Ca.filter=function(t){var n,e,r,i=[];"function"!=typeof t&&(t=Nn(t));for(var u=0,a=this.length;a>u;u++){i.push(n=[]);for(var e=this[u],o=0,c=e.length;c>o;o++)(r=e[o])&&t.call(r,r.__data__,o)&&n.push(r)}return Dn(i,this.id,this.time).ease(this.ease())},Ca.attr=function(t,n){function e(){this.removeAttribute(u)}function r(){this.removeAttributeNS(u.space,u.local)}if(2>arguments.length){for(n in t)this.attr(n,t[n]);return this}var i=X(t),u=Pu.ns.qualify(t);return Hn(this,"attr."+t,n,function(t){function n(){var n,e=this.getAttribute(u);return e!==t&&(n=i(e,t),function(t){this.setAttribute(u,n(t))})}function a(){var n,e=this.getAttributeNS(u.space,u.local);return e!==t&&(n=i(e,t),function(t){this.setAttributeNS(u.space,u.local,n(t))})}return null==t?u.local?r:e:(t+="",u.local?a:n)})},Ca.attrTween=function(t,n){function e(t,e){var r=n.call(this,t,e,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,e){var r=n.call(this,t,e,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=Pu.ns.qualify(t);return this.tween("attr."+t,i.local?r:e)},Ca.style=function(t,n,e){function r(){this.style.removeProperty(t)}var i=arguments.length;if(3>i){if("string"!=typeof t){2>i&&(n="");for(e in t)this.style(e,t[e],n);return this}e=""}var u=X(t);return Hn(this,"style."+t,n,function(n){function i(){var r,i=Uu.getComputedStyle(this,null).getPropertyValue(t);return i!==n&&(r=u(i,n),function(n){this.style.setProperty(t,r(n),e)})}return null==n?r:(n+="",i)})},Ca.styleTween=function(t,n,e){return 3>arguments.length&&(e=""),this.tween("style."+t,function(r,i){var u=n.call(this,r,i,Uu.getComputedStyle(this,null).getPropertyValue(t));return u&&function(n){this.style.setProperty(t,u(n),e)}})},Ca.text=function(t){return Hn(this,"text",t,Fn)},Ca.remove=function(){return this.each("end.transition",function(){var t;!this.__transition__&&(t=this.parentNode)&&t.removeChild(this)})},Ca.ease=function(t){var n=this.id;return 1>arguments.length?this.node().__transition__[n].ease:("function"!=typeof t&&(t=Pu.ease.apply(Pu,arguments)),Cn(this,function(e){e.__transition__[n].ease=t}))},Ca.delay=function(t){var n=this.id;return Cn(this,"function"==typeof t?function(e,r,i){e.__transition__[n].delay=0|t.call(e,e.__data__,r,i)}:(t|=0,function(e){e.__transition__[n].delay=t}))},Ca.duration=function(t){var n=this.id;return Cn(this,"function"==typeof t?function(e,r,i){e.__transition__[n].duration=Math.max(1,0|t.call(e,e.__data__,r,i))}:(t=Math.max(1,0|t),function(e){e.__transition__[n].duration=t}))},Ca.each=function(t,n){var e=this.id;if(2>arguments.length){var r=Da,i=qa;qa=e,Cn(this,function(n,r,i){Da=n.__transition__[e],t.call(n,n.__data__,r,i)}),Da=r,qa=i}else Cn(this,function(r){r.__transition__[e].event.on(t,n)});return this},Ca.transition=function(){for(var t,n,e,r,i=this.id,u=++za,a=[],o=0,c=this.length;c>o;o++){a.push(t=[]);for(var n=this[o],l=0,f=n.length;f>l;l++)(e=n[l])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Ln(e,l,u,r)),t.push(e)}return Dn(a,u)},Ca.tween=function(t,n){var e=this.id;return 2>arguments.length?this.node().__transition__[e].tween.get(t):Cn(this,null==n?function(n){n.__transition__[e].tween.remove(t)}:function(r){r.__transition__[e].tween.set(t,n)})};var La,Fa,Ha=0,ja={},Pa=null;Pu.timer=function(t,n,e){if(3>arguments.length){if(2>arguments.length)n=0;else if(!isFinite(n))return;e=Date.now()}var r=ja[t.id];r&&r.callback===t?(r.then=e,r.delay=n):ja[t.id=++Ha]=Pa={callback:t,then:e,delay:n,next:Pa},La||(Fa=clearTimeout(Fa),La=1,Ra(jn))},Pu.timer.flush=function(){for(var t,n=Date.now(),e=Pa;e;)t=n-e.then,e.delay||(e.flush=e.callback(t)),e=e.next;Pn()};var Ra=Uu.requestAnimationFrame||Uu.webkitRequestAnimationFrame||Uu.mozRequestAnimationFrame||Uu.oRequestAnimationFrame||Uu.msRequestAnimationFrame||function(t){setTimeout(t,17)};Pu.mouse=function(t){return Rn(t,O())};var Oa=/WebKit/.test(Uu.navigator.userAgent)?-1:0;Pu.touches=function(t,n){return 2>arguments.length&&(n=O().touches),n?Ju(n).map(function(n){var e=Rn(t,n);return e.identifier=n.identifier,e}):[]},Pu.scale={},Pu.scale.linear=function(){return Vn([0,1],[0,1],Pu.interpolate,!1)},Pu.scale.log=function(){return Wn(Pu.scale.linear().domain([0,Math.LN10]),10,Qn,te)};var Ya=Pu.format(".0e");Pu.scale.pow=function(){return ie(Pu.scale.linear(),1)},Pu.scale.sqrt=function(){return Pu.scale.pow().exponent(.5)},Pu.scale.ordinal=function(){return ae([],{t:"range",a:[[]]})},Pu.scale.category10=function(){return Pu.scale.ordinal().range(Ua)},Pu.scale.category20=function(){return Pu.scale.ordinal().range(Ia)},Pu.scale.category20b=function(){return Pu.scale.ordinal().range(Va)},Pu.scale.category20c=function(){return Pu.scale.ordinal().range(Za)};var Ua=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Ia=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"],Va=["#393b79","#5254a3","#6b6ecf","#9c9ede","#637939","#8ca252","#b5cf6b","#cedb9c","#8c6d31","#bd9e39","#e7ba52","#e7cb94","#843c39","#ad494a","#d6616b","#e7969c","#7b4173","#a55194","#ce6dbd","#de9ed6"],Za=["#3182bd","#6baed6","#9ecae1","#c6dbef","#e6550d","#fd8d3c","#fdae6b","#fdd0a2","#31a354","#74c476","#a1d99b","#c7e9c0","#756bb1","#9e9ac8","#bcbddc","#dadaeb","#636363","#969696","#bdbdbd","#d9d9d9"];Pu.scale.quantile=function(){return oe([],[])},Pu.scale.quantize=function(){return ce(0,1,[0,1])},Pu.scale.threshold=function(){return le([.5],[0,1])},Pu.scale.identity=function(){return fe([0,1])},Pu.svg={},Pu.svg.arc=function(){function t(){var t=n.apply(this,arguments),u=e.apply(this,arguments),a=r.apply(this,arguments)+Xa,o=i.apply(this,arguments)+Xa,c=(a>o&&(c=a,a=o,o=c),o-a),l=Hu>c?"0":"1",f=Math.cos(a),s=Math.sin(a),h=Math.cos(o),g=Math.sin(o);return c>=Ba?t?"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"Z":t?"M"+u*f+","+u*s+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L"+t*h+","+t*g+"A"+t+","+t+" 0 "+l+",0 "+t*f+","+t*s+"Z":"M"+u*f+","+u*s+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L0,0"+"Z"}var n=se,e=he,r=ge,i=pe;return t.innerRadius=function(e){return arguments.length?(n=f(e),t):n},t.outerRadius=function(n){return arguments.length?(e=f(n),t):e},t.startAngle=function(n){return arguments.length?(r=f(n),t):r},t.endAngle=function(n){return arguments.length?(i=f(n),t):i},t.centroid=function(){var t=(n.apply(this,arguments)+e.apply(this,arguments))/2,u=(r.apply(this,arguments)+i.apply(this,arguments))/2+Xa;return[Math.cos(u)*t,Math.sin(u)*t]},t};var Xa=-Hu/2,Ba=2*Hu-1e-6;Pu.svg.line=function(){return de(c)};var $a=Pu.map({linear:ye,"linear-closed":Me,"step-before":be,"step-after":xe,basis:Ae,"basis-open":Ne,"basis-closed":Te,bundle:qe,cardinal:Se,"cardinal-open":_e,"cardinal-closed":we,monotone:He});$a.forEach(function(t,n){n.key=t,n.closed=/-closed$/.test(t)});var Ja=[0,2/3,1/3,0],Ga=[0,1/3,2/3,0],Ka=[0,1/6,2/3,1/6];Pu.svg.line.radial=function(){var t=de(je);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},be.reverse=xe,xe.reverse=be,Pu.svg.area=function(){return Pe(c)},Pu.svg.area.radial=function(){var t=Pe(je);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},Pu.svg.chord=function(){function e(t,n){var e=r(this,o,t,n),l=r(this,c,t,n);return"M"+e.p0+u(e.r,e.p1,e.a1-e.a0)+(i(e,l)?a(e.r,e.p1,e.r,e.p0):a(e.r,e.p1,l.r,l.p0)+u(l.r,l.p1,l.a1-l.a0)+a(l.r,l.p1,e.r,e.p0))+"Z"}function r(t,n,e,r){var i=n.call(t,e,r),u=l.call(t,i,r),a=s.call(t,i,r)+Xa,o=h.call(t,i,r)+Xa;return{r:u,a0:a,a1:o,p0:[u*Math.cos(a),u*Math.sin(a)],p1:[u*Math.cos(o),u*Math.sin(o)]}}function i(t,n){return t.a0==n.a0&&t.a1==n.a1}function u(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Hu)+",1 "+n}function a(t,n,e,r){return"Q 0,0 "+r}var o=n,c=t,l=Re,s=ge,h=pe;return e.radius=function(t){return arguments.length?(l=f(t),e):l},e.source=function(t){return arguments.length?(o=f(t),e):o},e.target=function(t){return arguments.length?(c=f(t),e):c},e.startAngle=function(t){return arguments.length?(s=f(t),e):s},e.endAngle=function(t){return arguments.length?(h=f(t),e):h},e},Pu.svg.diagonal=function(){function e(t,n){var e=r.call(this,t,n),a=i.call(this,t,n),o=(e.y+a.y)/2,c=[e,{x:e.x,y:o},{x:a.x,y:o},a];return c=c.map(u),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var r=n,i=t,u=Oe;return e.source=function(t){return arguments.length?(r=f(t),e):r},e.target=function(t){return arguments.length?(i=f(t),e):i},e.projection=function(t){return arguments.length?(u=t,e):u},e},Pu.svg.diagonal.radial=function(){var t=Pu.svg.diagonal(),n=Oe,e=t.projection;return t.projection=function(t){return arguments.length?e(Ye(n=t)):n},t},Pu.svg.symbol=function(){function t(t,r){return(Wa.get(n.call(this,t,r))||Ve)(e.call(this,t,r))}var n=Ie,e=Ue;return t.type=function(e){return arguments.length?(n=f(e),t):n},t.size=function(n){return arguments.length?(e=f(n),t):e},t};var Wa=Pu.map({circle:Ve,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*to)),e=n*to;return"M0,"+-n+"L"+e+",0"+" 0,"+n+" "+-e+",0"+"Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/Qa),e=n*Qa/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/Qa),e=n*Qa/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});Pu.svg.symbolTypes=Wa.keys();var Qa=Math.sqrt(3),to=Math.tan(30*Ru);Pu.svg.axis=function(){function t(t){t.each(function(){var t,s=Pu.select(this),h=null==l?e.ticks?e.ticks.apply(e,c):e.domain():l,g=null==n?e.tickFormat?e.tickFormat.apply(e,c):String:n,p=Be(e,h,f),d=s.selectAll(".tick.minor").data(p,String),m=d.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),v=Pu.transition(d.exit()).style("opacity",1e-6).remove(),y=Pu.transition(d).style("opacity",1),M=s.selectAll(".tick.major").data(h,String),b=M.enter().insert("g","path").attr("class","tick major").style("opacity",1e-6),x=Pu.transition(M.exit()).style("opacity",1e-6).remove(),_=Pu.transition(M).style("opacity",1),w=Un(e),S=s.selectAll(".domain").data([0]),k=(S.enter().append("path").attr("class","domain"),Pu.transition(S)),E=e.copy(),A=this.__chart__||E;this.__chart__=E,b.append("line"),b.append("text");var N=b.select("line"),T=_.select("line"),q=M.select("text").text(g),C=b.select("text"),z=_.select("text");switch(r){case"bottom":t=Ze,m.attr("y2",u),y.attr("x2",0).attr("y2",u),N.attr("y2",i),C.attr("y",Math.max(i,0)+o),T.attr("x2",0).attr("y2",i),z.attr("x",0).attr("y",Math.max(i,0)+o),q.attr("dy",".71em").style("text-anchor","middle"),k.attr("d","M"+w[0]+","+a+"V0H"+w[1]+"V"+a);break;case"top":t=Ze,m.attr("y2",-u),y.attr("x2",0).attr("y2",-u),N.attr("y2",-i),C.attr("y",-(Math.max(i,0)+o)),T.attr("x2",0).attr("y2",-i),z.attr("x",0).attr("y",-(Math.max(i,0)+o)),q.attr("dy","0em").style("text-anchor","middle"),k.attr("d","M"+w[0]+","+-a+"V0H"+w[1]+"V"+-a);break;case"left":t=Xe,m.attr("x2",-u),y.attr("x2",-u).attr("y2",0),N.attr("x2",-i),C.attr("x",-(Math.max(i,0)+o)),T.attr("x2",-i).attr("y2",0),z.attr("x",-(Math.max(i,0)+o)).attr("y",0),q.attr("dy",".32em").style("text-anchor","end"),k.attr("d","M"+-a+","+w[0]+"H0V"+w[1]+"H"+-a);break;case"right":t=Xe,m.attr("x2",u),y.attr("x2",u).attr("y2",0),N.attr("x2",i),C.attr("x",Math.max(i,0)+o),T.attr("x2",i).attr("y2",0),z.attr("x",Math.max(i,0)+o).attr("y",0),q.attr("dy",".32em").style("text-anchor","start"),k.attr("d","M"+a+","+w[0]+"H0V"+w[1]+"H"+a)}if(e.ticks)b.call(t,A),_.call(t,E),x.call(t,E),m.call(t,A),y.call(t,E),v.call(t,E);else{var D=E.rangeBand()/2,L=function(t){return E(t)+D};b.call(t,L),_.call(t,L)}})}var n,e=Pu.scale.linear(),r=no,i=6,u=6,a=6,o=3,c=[10],l=null,f=0;return t.scale=function(n){return arguments.length?(e=n,t):e},t.orient=function(n){return arguments.length?(r=n in eo?n+"":no,t):r},t.ticks=function(){return arguments.length?(c=arguments,t):c},t.tickValues=function(n){return arguments.length?(l=n,t):l},t.tickFormat=function(e){return arguments.length?(n=e,t):n},t.tickSize=function(n,e){if(!arguments.length)return i;var r=arguments.length-1;return i=+n,u=r>1?+e:i,a=r>0?+arguments[r]:i,t},t.tickPadding=function(n){return arguments.length?(o=+n,t):o},t.tickSubdivide=function(n){return arguments.length?(f=+n,t):f},t};var no="bottom",eo={top:1,right:1,bottom:1,left:1};Pu.svg.brush=function(){function t(u){u.each(function(){var u,a=Pu.select(this),f=a.selectAll(".background").data([0]),s=a.selectAll(".extent").data([0]),h=a.selectAll(".resize").data(l,String);a.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),f.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),s.enter().append("rect").attr("class","extent").style("cursor","move"),h.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return ro[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),h.style("display",t.empty()?"none":null),h.exit().remove(),o&&(u=Un(o),f.attr("x",u[0]).attr("width",u[1]-u[0]),e(a)),c&&(u=Un(c),f.attr("y",u[0]).attr("height",u[1]-u[0]),r(a)),n(a)})}function n(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+f[+/e$/.test(t)][0]+","+f[+/^s/.test(t)][1]+")"})}function e(t){t.select(".extent").attr("x",f[0][0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",f[1][0]-f[0][0])}function r(t){t.select(".extent").attr("y",f[0][1]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1][1]-f[0][1])}function i(){function i(){var t=Pu.event.changedTouches;return t?Pu.touches(v,t)[0]:Pu.mouse(v)}function l(){32==Pu.event.keyCode&&(S||(d=null,k[0]-=f[1][0],k[1]-=f[1][1],S=2),R())}function s(){32==Pu.event.keyCode&&2==S&&(k[0]+=f[1][0],k[1]+=f[1][1],S=0,R())}function h(){var t=i(),u=!1;m&&(t[0]+=m[0],t[1]+=m[1]),S||(Pu.event.altKey?(d||(d=[(f[0][0]+f[1][0])/2,(f[0][1]+f[1][1])/2]),k[0]=f[+(t[0]l?(i=r,r=l):i=l),f[0][e]!==r||f[1][e]!==i?(u=null,f[0][e]=r,f[1][e]=i,!0):void 0}function p(){h(),b.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),Pu.select("body").style("cursor",null),E.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),M({type:"brushend"}),R()}var d,m,v=this,y=Pu.select(Pu.event.target),M=a.of(v,arguments),b=Pu.select(v),x=y.datum(),_=!/^(n|s)$/.test(x)&&o,w=!/^(e|w)$/.test(x)&&c,S=y.classed("extent"),k=i(),E=Pu.select(Uu).on("mousemove.brush",h).on("mouseup.brush",p).on("touchmove.brush",h).on("touchend.brush",p).on("keydown.brush",l).on("keyup.brush",s);if(S)k[0]=f[0][0]-k[0],k[1]=f[0][1]-k[1];else if(x){var A=+/w$/.test(x),N=+/^n/.test(x);m=[f[1-A][0]-k[0],f[1-N][1]-k[1]],k[0]=f[A][0],k[1]=f[N][1]}else Pu.event.altKey&&(d=k.slice());b.style("pointer-events","none").selectAll(".resize").style("display",null),Pu.select("body").style("cursor",y.style("cursor")),M({type:"brushstart"}),h(),R()}var u,a=Y(t,"brushstart","brush","brushend"),o=null,c=null,l=io[0],f=[[0,0],[0,0]];return t.x=function(n){return arguments.length?(o=n,l=io[!o<<1|!c],t):o},t.y=function(n){return arguments.length?(c=n,l=io[!o<<1|!c],t):c},t.extent=function(n){var e,r,i,a,l;return arguments.length?(u=[[0,0],[0,0]],o&&(e=n[0],r=n[1],c&&(e=e[0],r=r[0]),u[0][0]=e,u[1][0]=r,o.invert&&(e=o(e),r=o(r)),e>r&&(l=e,e=r,r=l),f[0][0]=0|e,f[1][0]=0|r),c&&(i=n[0],a=n[1],o&&(i=i[1],a=a[1]),u[0][1]=i,u[1][1]=a,c.invert&&(i=c(i),a=c(a)),i>a&&(l=i,i=a,a=l),f[0][1]=0|i,f[1][1]=0|a),t):(n=u||f,o&&(e=n[0][0],r=n[1][0],u||(e=f[0][0],r=f[1][0],o.invert&&(e=o.invert(e),r=o.invert(r)),e>r&&(l=e,e=r,r=l))),c&&(i=n[0][1],a=n[1][1],u||(i=f[0][1],a=f[1][1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(l=i,i=a,a=l))),o&&c?[[e,i],[r,a]]:o?[e,r]:c&&[i,a])},t.clear=function(){return u=null,f[0][0]=f[0][1]=f[1][0]=f[1][1]=0,t},t.empty=function(){return o&&f[0][0]===f[1][0]||c&&f[0][1]===f[1][1]},Pu.rebind(t,a,"on")};var ro={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},io=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];Pu.behavior={},Pu.behavior.drag=function(){function t(){this.on("mousedown.drag",n).on("touchstart.drag",n)}function n(){function t(){var t=o.parentNode;return null!=f?Pu.touches(t).filter(function(t){return t.identifier===f})[0]:Pu.mouse(t)}function n(){if(!o.parentNode)return i();var n=t(),e=n[0]-s[0],r=n[1]-s[1];h|=e|r,s=n,R(),c({type:"drag",x:n[0]+a[0],y:n[1]+a[1],dx:e,dy:r})}function i(){c({type:"dragend"}),h&&(R(),Pu.event.target===l&&g.on("click.drag",u,!0)),g.on(null!=f?"touchmove.drag-"+f:"mousemove.drag",null).on(null!=f?"touchend.drag-"+f:"mouseup.drag",null)}function u(){R(),g.on("click.drag",null)}var a,o=this,c=e.of(o,arguments),l=Pu.event.target,f=Pu.event.touches?Pu.event.changedTouches[0].identifier:null,s=t(),h=0,g=Pu.select(Uu).on(null!=f?"touchmove.drag-"+f:"mousemove.drag",n).on(null!=f?"touchend.drag-"+f:"mouseup.drag",i,!0);r?(a=r.apply(o,arguments),a=[a.x-s[0],a.y-s[1]]):a=[0,0],null==f&&R(),c({type:"dragstart"})}var e=Y(t,"drag","dragstart","dragend"),r=null;return t.origin=function(n){return arguments.length?(r=n,t):r},Pu.rebind(t,e,"on")},Pu.behavior.zoom=function(){function t(){this.on("mousedown.zoom",o).on("mousemove.zoom",l).on(oo+".zoom",c).on("dblclick.zoom",f).on("touchstart.zoom",s).on("touchmove.zoom",h).on("touchend.zoom",s)}function n(t){return[(t[0]-b[0])/x,(t[1]-b[1])/x]}function e(t){return[t[0]*x+b[0],t[1]*x+b[1]]}function r(t){x=Math.max(_[0],Math.min(_[1],t))}function i(t,n){n=e(n),b[0]+=t[0]-n[0],b[1]+=t[1]-n[1]}function u(){m&&m.domain(d.range().map(function(t){return(t-b[0])/x}).map(d.invert)),y&&y.domain(v.range().map(function(t){return(t-b[1])/x}).map(v.invert))}function a(t){u(),Pu.event.preventDefault(),t({type:"zoom",scale:x,translate:b})}function o(){function t(){l=1,i(Pu.mouse(u),s),a(o)}function e(){l&&R(),f.on("mousemove.zoom",null).on("mouseup.zoom",null),l&&Pu.event.target===c&&f.on("click.zoom",r,!0)}function r(){R(),f.on("click.zoom",null) +}var u=this,o=w.of(u,arguments),c=Pu.event.target,l=0,f=Pu.select(Uu).on("mousemove.zoom",t).on("mouseup.zoom",e),s=n(Pu.mouse(u));Uu.focus(),R()}function c(){g||(g=n(Pu.mouse(this))),r(Math.pow(2,.002*uo())*x),i(Pu.mouse(this),g),a(w.of(this,arguments))}function l(){g=null}function f(){var t=Pu.mouse(this),e=n(t),u=Math.log(x)/Math.LN2;r(Math.pow(2,Pu.event.shiftKey?Math.ceil(u)-1:Math.floor(u)+1)),i(t,e),a(w.of(this,arguments))}function s(){var t=Pu.touches(this),e=Date.now();if(p=x,g={},t.forEach(function(t){g[t.identifier]=n(t)}),R(),1===t.length){if(500>e-M){var u=t[0],o=n(t[0]);r(2*x),i(u,o),a(w.of(this,arguments))}M=e}}function h(){var t=Pu.touches(this),n=t[0],e=g[n.identifier];if(u=t[1]){var u,o=g[u.identifier];n=[(n[0]+u[0])/2,(n[1]+u[1])/2],e=[(e[0]+o[0])/2,(e[1]+o[1])/2],r(Pu.event.scale*p)}i(n,e),M=null,a(w.of(this,arguments))}var g,p,d,m,v,y,M,b=[0,0],x=1,_=ao,w=Y(t,"zoom");return t.translate=function(n){return arguments.length?(b=n.map(Number),u(),t):b},t.scale=function(n){return arguments.length?(x=+n,u(),t):x},t.scaleExtent=function(n){return arguments.length?(_=null==n?ao:n.map(Number),t):_},t.x=function(n){return arguments.length?(m=n,d=n.copy(),b=[0,0],x=1,t):m},t.y=function(n){return arguments.length?(y=n,v=n.copy(),b=[0,0],x=1,t):y},Pu.rebind(t,w,"on")};var uo,ao=[0,1/0],oo="onwheel"in document?(uo=function(){return-Pu.event.deltaY*(Pu.event.deltaMode?120:1)},"wheel"):"onmousewheel"in document?(uo=function(){return Pu.event.wheelDelta},"mousewheel"):(uo=function(){return-Pu.event.detail},"MozMousePixelScroll");Pu.layout={},Pu.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;r>++e;)n.push($e(t[e]));return n}},Pu.layout.chord=function(){function t(){var t,l,s,h,g,p={},d=[],m=Pu.range(u),v=[];for(e=[],r=[],t=0,h=-1;u>++h;){for(l=0,g=-1;u>++g;)l+=i[h][g];d.push(l),v.push(Pu.range(u)),t+=l}for(a&&m.sort(function(t,n){return a(d[t],d[n])}),o&&v.forEach(function(t,n){t.sort(function(t,e){return o(i[n][t],i[n][e])})}),t=(2*Hu-f*u)/t,l=0,h=-1;u>++h;){for(s=l,g=-1;u>++g;){var y=m[h],M=v[y][g],b=i[y][M],x=l,_=l+=b*t;p[y+"-"+M]={index:y,subindex:M,startAngle:x,endAngle:_,value:b}}r[y]={index:y,startAngle:s,endAngle:l,value:(l-s)/t},l+=f}for(h=-1;u>++h;)for(g=h-1;u>++g;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value(i-e)*o){var c=n.charge*o*o;return t.px-=u*c,t.py-=a*c,!0}if(n.point&&isFinite(o)){var c=n.pointCharge*o*o;t.px-=u*c,t.py-=a*c}}return!n.charge}}function n(t){t.px=Pu.event.x,t.py=Pu.event.y,o.resume()}var e,r,i,u,a,o={},l=Pu.dispatch("start","tick","end"),f=[1,1],s=.9,h=co,g=lo,p=-30,d=.1,m=.8,v=[],y=[];return o.tick=function(){if(.005>(r*=.99))return l.end({type:"end",alpha:r=0}),!0;var n,e,o,c,h,g,m,M,b,x=v.length,_=y.length;for(e=0;_>e;++e)o=y[e],c=o.source,h=o.target,M=h.x-c.x,b=h.y-c.y,(g=M*M+b*b)&&(g=r*u[e]*((g=Math.sqrt(g))-i[e])/g,M*=g,b*=g,h.x-=M*(m=c.weight/(h.weight+c.weight)),h.y-=b*m,c.x+=M*(m=1-m),c.y+=b*m);if((m=r*d)&&(M=f[0]/2,b=f[1]/2,e=-1,m))for(;x>++e;)o=v[e],o.x+=(M-o.x)*m,o.y+=(b-o.y)*m;if(p)for(nr(n=Pu.geom.quadtree(v),r,a),e=-1;x>++e;)(o=v[e]).fixed||n.visit(t(o));for(e=-1;x>++e;)o=v[e],o.fixed?(o.x=o.px,o.y=o.py):(o.x-=(o.px-(o.px=o.x))*s,o.y-=(o.py-(o.py=o.y))*s);l.tick({type:"tick",alpha:r})},o.nodes=function(t){return arguments.length?(v=t,o):v},o.links=function(t){return arguments.length?(y=t,o):y},o.size=function(t){return arguments.length?(f=t,o):f},o.linkDistance=function(t){return arguments.length?(h="function"==typeof t?t:+t,o):h},o.distance=o.linkDistance,o.linkStrength=function(t){return arguments.length?(g="function"==typeof t?t:+t,o):g},o.friction=function(t){return arguments.length?(s=+t,o):s},o.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,o):p},o.gravity=function(t){return arguments.length?(d=+t,o):d},o.theta=function(t){return arguments.length?(m=+t,o):m},o.alpha=function(t){return arguments.length?(t=+t,r?r=t>0?t:0:t>0&&(l.start({type:"start",alpha:r=t}),Pu.timer(o.tick)),o):r},o.start=function(){function t(t,r){for(var i,u=n(e),a=-1,o=u.length;o>++a;)if(!isNaN(i=u[a][t]))return i;return Math.random()*r}function n(){if(!c){for(c=[],r=0;s>r;++r)c[r]=[];for(r=0;d>r;++r){var t=y[r];c[t.source.index].push(t.target),c[t.target.index].push(t.source)}}return c[e]}var e,r,c,l,s=v.length,d=y.length,m=f[0],M=f[1];for(e=0;s>e;++e)(l=v[e]).index=e,l.weight=0;for(e=0;d>e;++e)l=y[e],"number"==typeof l.source&&(l.source=v[l.source]),"number"==typeof l.target&&(l.target=v[l.target]),++l.source.weight,++l.target.weight;for(e=0;s>e;++e)l=v[e],isNaN(l.x)&&(l.x=t("x",m)),isNaN(l.y)&&(l.y=t("y",M)),isNaN(l.px)&&(l.px=l.x),isNaN(l.py)&&(l.py=l.y);if(i=[],"function"==typeof h)for(e=0;d>e;++e)i[e]=+h.call(this,y[e],e);else for(e=0;d>e;++e)i[e]=h;if(u=[],"function"==typeof g)for(e=0;d>e;++e)u[e]=+g.call(this,y[e],e);else for(e=0;d>e;++e)u[e]=g;if(a=[],"function"==typeof p)for(e=0;s>e;++e)a[e]=+p.call(this,v[e],e);else for(e=0;s>e;++e)a[e]=p;return o.resume()},o.resume=function(){return o.alpha(.1)},o.stop=function(){return o.alpha(0)},o.drag=function(){return e||(e=Pu.behavior.drag().origin(c).on("dragstart.force",Ke).on("drag.force",n).on("dragend.force",We)),arguments.length?(this.on("mouseover.force",Qe).on("mouseout.force",tr).call(e),void 0):e},Pu.rebind(o,l,"on")};var co=20,lo=1;Pu.layout.partition=function(){function t(n,e,r,i){var u=n.children;if(n.x=e,n.y=n.depth*i,n.dx=r,n.dy=i,u&&(a=u.length)){var a,o,c,l=-1;for(r=n.value?r/n.value:0;a>++l;)t(o=u[l],e,c=o.value*r,i),e+=c}}function n(t){var e=t.children,r=0;if(e&&(i=e.length))for(var i,u=-1;i>++u;)r=Math.max(r,n(e[u]));return 1+r}function e(e,u){var a=r.call(this,e,u);return t(a[0],0,i[0],i[1]/n(a[0])),a}var r=Pu.layout.hierarchy(),i=[1,1];return e.size=function(t){return arguments.length?(i=t,e):i},gr(e,r)},Pu.layout.pie=function(){function t(u){var a=u.map(function(e,r){return+n.call(t,e,r)}),o=+("function"==typeof r?r.apply(this,arguments):r),c=(("function"==typeof i?i.apply(this,arguments):i)-r)/Pu.sum(a),l=Pu.range(u.length);null!=e&&l.sort(e===fo?function(t,n){return a[n]-a[t]}:function(t,n){return e(u[t],u[n])});var f=[];return l.forEach(function(t){var n;f[t]={data:u[t],value:n=a[t],startAngle:o,endAngle:o+=n*c}}),f}var n=Number,e=fo,r=0,i=2*Hu;return t.value=function(e){return arguments.length?(n=e,t):n},t.sort=function(n){return arguments.length?(e=n,t):e},t.startAngle=function(n){return arguments.length?(r=n,t):r},t.endAngle=function(n){return arguments.length?(i=n,t):i},t};var fo={};Pu.layout.stack=function(){function t(o,c){var l=o.map(function(e,r){return n.call(t,e,r)}),f=l.map(function(n){return n.map(function(n,e){return[u.call(t,n,e),a.call(t,n,e)]})}),s=e.call(t,f,c);l=Pu.permute(l,s),f=Pu.permute(f,s);var h,g,p,d=r.call(t,f,c),m=l.length,v=l[0].length;for(g=0;v>g;++g)for(i.call(t,l[0][g],p=d[g],f[0][g][1]),h=1;m>h;++h)i.call(t,l[h][g],p+=f[h-1][g][1],f[h][g][1]);return o}var n=c,e=ur,r=ar,i=ir,u=er,a=rr;return t.values=function(e){return arguments.length?(n=e,t):n},t.order=function(n){return arguments.length?(e="function"==typeof n?n:so.get(n)||ur,t):e},t.offset=function(n){return arguments.length?(r="function"==typeof n?n:ho.get(n)||ar,t):r},t.x=function(n){return arguments.length?(u=n,t):u},t.y=function(n){return arguments.length?(a=n,t):a},t.out=function(n){return arguments.length?(i=n,t):i},t};var so=Pu.map({"inside-out":function(t){var n,e,r=t.length,i=t.map(or),u=t.map(cr),a=Pu.range(r).sort(function(t,n){return i[t]-i[n]}),o=0,c=0,l=[],f=[];for(n=0;r>n;++n)e=a[n],c>o?(o+=u[e],l.push(e)):(c+=u[e],f.push(e));return f.reverse().concat(l)},reverse:function(t){return Pu.range(t.length).reverse()},"default":ur}),ho=Pu.map({silhouette:function(t){var n,e,r,i=t.length,u=t[0].length,a=[],o=0,c=[];for(e=0;u>e;++e){for(n=0,r=0;i>n;n++)r+=t[n][e][1];r>o&&(o=r),a.push(r)}for(e=0;u>e;++e)c[e]=(o-a[e])/2;return c},wiggle:function(t){var n,e,r,i,u,a,o,c,l,f=t.length,s=t[0],h=s.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(n=0,i=0;f>n;++n)i+=t[n][e][1];for(n=0,u=0,o=s[e][0]-s[e-1][0];f>n;++n){for(r=0,a=(t[n][e][1]-t[n][e-1][1])/(2*o);n>r;++r)a+=(t[r][e][1]-t[r][e-1][1])/o;u+=a*t[n][e][1]}g[e]=c-=i?u/i*o:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(t){var n,e,r,i=t.length,u=t[0].length,a=1/i,o=[];for(e=0;u>e;++e){for(n=0,r=0;i>n;n++)r+=t[n][e][1];if(r)for(n=0;i>n;n++)t[n][e][1]/=r;else for(n=0;i>n;n++)t[n][e][1]=a}for(e=0;u>e;++e)o[e]=0;return o},zero:ar});Pu.layout.histogram=function(){function t(t,u){for(var a,o,c=[],l=t.map(e,this),f=r.call(this,l,u),s=i.call(this,f,l,u),u=-1,h=l.length,g=s.length-1,p=n?1:1/h;g>++u;)a=c[u]=[],a.dx=s[u+1]-(a.x=s[u]),a.y=0;if(g>0)for(u=-1;h>++u;)o=l[u],o>=f[0]&&f[1]>=o&&(a=c[Pu.bisect(s,o,1,g)-1],a.y+=p,a.push(t[u]));return c}var n=!0,e=Number,r=hr,i=fr;return t.value=function(n){return arguments.length?(e=n,t):e},t.range=function(n){return arguments.length?(r=f(n),t):r},t.bins=function(n){return arguments.length?(i="number"==typeof n?function(t){return sr(t,n)}:f(n),t):i},t.frequency=function(e){return arguments.length?(n=!!e,t):n},t},Pu.layout.hierarchy=function(){function t(n,a,o){var c=i.call(e,n,a);if(n.depth=a,o.push(n),c&&(l=c.length)){for(var l,f,s=-1,h=n.children=[],g=0,p=a+1;l>++s;)f=t(c[s],p,o),f.parent=n,h.push(f),g+=f.value;r&&h.sort(r),u&&(n.value=g)}else u&&(n.value=+u.call(e,n,a)||0);return n}function n(t,r){var i=t.children,a=0;if(i&&(o=i.length))for(var o,c=-1,l=r+1;o>++c;)a+=n(i[c],l);else u&&(a=+u.call(e,t,r)||0);return u&&(t.value=a),a}function e(n){var e=[];return t(n,0,e),e}var r=mr,i=pr,u=dr;return e.sort=function(t){return arguments.length?(r=t,e):r},e.children=function(t){return arguments.length?(i=t,e):i},e.value=function(t){return arguments.length?(u=t,e):u},e.revalue=function(t){return n(t,0),t},e},Pu.layout.pack=function(){function t(t,i){var u=n.call(this,t,i),a=u[0];a.x=0,a.y=0,Pr(a,function(t){t.r=Math.sqrt(t.value)}),Pr(a,_r);var o=r[0],c=r[1],l=Math.max(2*a.r/o,2*a.r/c);if(e>0){var f=e*l/2;Pr(a,function(t){t.r+=f}),Pr(a,_r),Pr(a,function(t){t.r-=f}),l=Math.max(2*a.r/o,2*a.r/c)}return kr(a,o/2,c/2,1/l),u}var n=Pu.layout.hierarchy().sort(yr),e=0,r=[1,1];return t.size=function(n){return arguments.length?(r=n,t):r},t.padding=function(n){return arguments.length?(e=+n,t):e},gr(t,n)},Pu.layout.cluster=function(){function t(t,i){var u,a=n.call(this,t,i),o=a[0],c=0;Pr(o,function(t){var n=t.children;n&&n.length?(t.x=Nr(n),t.y=Ar(n)):(t.x=u?c+=e(t,u):0,t.y=0,u=t)});var l=Tr(o),f=qr(o),s=l.x-e(l,f)/2,h=f.x+e(f,l)/2;return Pr(o,function(t){t.x=(t.x-s)/(h-s)*r[0],t.y=(1-(o.y?t.y/o.y:1))*r[1]}),a}var n=Pu.layout.hierarchy().sort(null).value(null),e=Cr,r=[1,1];return t.separation=function(n){return arguments.length?(e=n,t):e},t.size=function(n){return arguments.length?(r=n,t):r},gr(t,n)},Pu.layout.tree=function(){function t(t,i){function u(t,n){var r=t.children,i=t._tree;if(r&&(a=r.length)){for(var a,c,l,f=r[0],s=f,h=-1;a>++h;)l=r[h],u(l,c),s=o(l,c,s),c=l;Rr(t);var g=.5*(f._tree.prelim+l._tree.prelim);n?(i.prelim=n._tree.prelim+e(t,n),i.mod=i.prelim-g):i.prelim=g}else n&&(i.prelim=n._tree.prelim+e(t,n))}function a(t,n){t.x=t._tree.prelim+n;var e=t.children;if(e&&(r=e.length)){var r,i=-1;for(n+=t._tree.mod;r>++i;)a(e[i],n)}}function o(t,n,r){if(n){for(var i,u=t,a=t,o=n,c=t.parent.children[0],l=u._tree.mod,f=a._tree.mod,s=o._tree.mod,h=c._tree.mod;o=Dr(o),u=zr(u),o&&u;)c=zr(c),a=Dr(a),a._tree.ancestor=t,i=o._tree.prelim+s-u._tree.prelim-l+e(o,u),i>0&&(Or(Yr(o,t,r),t,i),l+=i,f+=i),s+=o._tree.mod,l+=u._tree.mod,h+=c._tree.mod,f+=a._tree.mod;o&&!Dr(a)&&(a._tree.thread=o,a._tree.mod+=s-f),u&&!zr(c)&&(c._tree.thread=u,c._tree.mod+=l-h,r=t)}return r}var c=n.call(this,t,i),l=c[0];Pr(l,function(t,n){t._tree={ancestor:t,prelim:0,mod:0,change:0,shift:0,number:n?n._tree.number+1:0}}),u(l),a(l,-l._tree.prelim);var f=Lr(l,Hr),s=Lr(l,Fr),h=Lr(l,jr),g=f.x-e(f,s)/2,p=s.x+e(s,f)/2,d=h.depth||1;return Pr(l,function(t){t.x=(t.x-g)/(p-g)*r[0],t.y=t.depth/d*r[1],delete t._tree}),c}var n=Pu.layout.hierarchy().sort(null).value(null),e=Cr,r=[1,1];return t.separation=function(n){return arguments.length?(e=n,t):e},t.size=function(n){return arguments.length?(r=n,t):r},gr(t,n)},Pu.layout.treemap=function(){function t(t,n){for(var e,r,i=-1,u=t.length;u>++i;)r=(e=t[i]).value*(0>n?0:n),e.area=isNaN(r)||0>=r?0:r}function n(e){var u=e.children;if(u&&u.length){var a,o,c,l=s(e),f=[],h=u.slice(),p=1/0,d="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(t(h,l.dx*l.dy/e.value),f.area=0;(c=h.length)>0;)f.push(a=h[c-1]),f.area+=a.area,"squarify"!==g||p>=(o=r(f,d))?(h.pop(),p=o):(f.area-=f.pop().area,i(f,d,l,!1),d=Math.min(l.dx,l.dy),f.length=f.area=0,p=1/0);f.length&&(i(f,d,l,!0),f.length=f.area=0),u.forEach(n)}}function e(n){var r=n.children;if(r&&r.length){var u,a=s(n),o=r.slice(),c=[];for(t(o,a.dx*a.dy/n.value),c.area=0;u=o.pop();)c.push(u),c.area+=u.area,null!=u.z&&(i(c,u.z?a.dx:a.dy,a,!o.length),c.length=c.area=0);r.forEach(e)}}function r(t,n){for(var e,r=t.area,i=0,u=1/0,a=-1,o=t.length;o>++a;)(e=t[a].area)&&(u>e&&(u=e),e>i&&(i=e));return r*=r,n*=n,r?Math.max(n*i*p/r,r/(n*u*p)):1/0}function i(t,n,e,r){var i,u=-1,a=t.length,o=e.x,l=e.y,f=n?c(t.area/n):0;if(n==e.dx){for((r||f>e.dy)&&(f=e.dy);a>++u;)i=t[u],i.x=o,i.y=l,i.dy=f,o+=i.dx=Math.min(e.x+e.dx-o,f?c(i.area/f):0);i.z=!0,i.dx+=e.x+e.dx-o,e.y+=f,e.dy-=f}else{for((r||f>e.dx)&&(f=e.dx);a>++u;)i=t[u],i.x=o,i.y=l,i.dx=f,l+=i.dy=Math.min(e.y+e.dy-l,f?c(i.area/f):0);i.z=!1,i.dy+=e.y+e.dy-l,e.x+=f,e.dx-=f}}function u(r){var i=a||o(r),u=i[0];return u.x=0,u.y=0,u.dx=l[0],u.dy=l[1],a&&o.revalue(u),t([u],u.dx*u.dy/u.value),(a?e:n)(u),h&&(a=i),i}var a,o=Pu.layout.hierarchy(),c=Math.round,l=[1,1],f=null,s=Ur,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return u.size=function(t){return arguments.length?(l=t,u):l},u.padding=function(t){function n(n){var e=t.call(u,n,n.depth);return null==e?Ur(n):Ir(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return Ir(n,t)}if(!arguments.length)return f;var r;return s=null==(f=t)?Ur:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,u},u.round=function(t){return arguments.length?(c=t?Math.round:Number,u):c!=Number},u.sticky=function(t){return arguments.length?(h=t,a=null,u):h},u.ratio=function(t){return arguments.length?(p=t,u):p},u.mode=function(t){return arguments.length?(g=t+"",u):g},gr(u,o)},Pu.layout.voronoi=function(){function t(t){var e,u,a,o=[],c=f(r),l=f(i),s=t.length;for(a=0;s>a;++a)o.push([+c.call(this,u=t[a],a),+l.call(this,u,a)]);for(e=Pu.geom.voronoi(o),a=0;s>a;++a)e[a].data=t[a];if(n)for(a=0;s>a;++a)n(e[a]);return e}var n,e=null,r=me,i=ve;return t.x=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(i=n,t):i},t.size=function(r){if(!arguments.length)return e;if(null==r)n=null;else{var i=+r[0],u=+r[1];n=Pu.geom.polygon([[0,0],[0,u],[i,u],[i,0]]).clip}return t},t},Pu.csv=Vr(",","text/csv"),Pu.tsv=Vr(" ","text/tab-separated-values"),Pu.geo={},Pu.geo.stream=function(t,n){go.hasOwnProperty(t.type)?go[t.type](t,n):Zr(t,n)};var go={Feature:function(t,n){Zr(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;i>++r;)Zr(e[r].geometry,n)}},po={Sphere:function(t,n){n.sphere()},Point:function(t,n){var e=t.coordinates;n.point(e[0],e[1])},MultiPoint:function(t,n){for(var e,r=t.coordinates,i=-1,u=r.length;u>++i;)e=r[i],n.point(e[0],e[1])},LineString:function(t,n){Xr(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;i>++r;)Xr(e[r],n,0)},Polygon:function(t,n){Br(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;i>++r;)Br(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;i>++r;)Zr(e[r],n)}};Pu.geo.distance=function(t,n){var e,r=(n[0]-t[0])*Ru,i=t[1]*Ru,u=n[1]*Ru,a=Math.sin(r),o=Math.cos(r),c=Math.sin(i),l=Math.cos(i),f=Math.sin(u),s=Math.cos(u);return Math.atan2(Math.sqrt((e=s*a)*e+(e=l*f-c*s*o)*e),c*f+l*s*o)},Pu.geo.albersUsa=function(){function t(t){return n(t)(t)}function n(t){var n=t[0],e=t[1];return e>50?a:-140>n?o:21>e?c:u}var e,r,i,u=Pu.geo.albers(),a=Pu.geo.albers().rotate([160,0]).center([0,60]).parallels([55,65]),o=Pu.geo.albers().rotate([160,0]).center([0,20]).parallels([8,18]),c=Pu.geo.albers().rotate([60,0]).center([0,10]).parallels([8,18]);return t.invert=function(t){return e(t)||r(t)||i(t)||u.invert(t)},t.scale=function(n){return arguments.length?(u.scale(n),a.scale(.6*n),o.scale(n),c.scale(1.5*n),t.translate(u.translate())):u.scale()},t.translate=function(n){if(!arguments.length)return u.translate();var l=u.scale(),f=n[0],s=n[1];return u.translate(n),a.translate([f-.4*l,s+.17*l]),o.translate([f-.19*l,s+.2*l]),c.translate([f+.58*l,s+.43*l]),e=ri(a,[[-180,50],[-130,72]]),r=ri(o,[[-164,18],[-154,24]]),i=ri(c,[[-67.5,17.5],[-65,19]]),t},t.scale(u.scale())},(Pu.geo.albers=function(){var t=29.5*Ru,n=45.5*Ru,e=Ii(ii),r=e(t,n);return r.parallels=function(r){return arguments.length?e(t=r[0]*Ru,n=r[1]*Ru):[t*Ou,n*Ou]},r.rotate([98,0]).center([0,38]).scale(1e3)}).raw=ii;var mo=Ji(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Pu.geo.azimuthalEqualArea=function(){return Ui(mo)}).raw=mo;var vo=Ji(function(t){var n=Math.acos(t);return n&&n/Math.sin(n)},c);(Pu.geo.azimuthalEquidistant=function(){return Ui(vo)}).raw=vo,Pu.geo.bounds=ui(c),Pu.geo.centroid=function(t){yo=Mo=bo=xo=_o=0,Pu.geo.stream(t,wo);var n;return Mo&&Math.abs(n=Math.sqrt(bo*bo+xo*xo+_o*_o))>ju?[Math.atan2(xo,bo)*Ou,Math.asin(Math.max(-1,Math.min(1,_o/n)))*Ou]:void 0};var yo,Mo,bo,xo,_o,wo={sphere:function(){2>yo&&(yo=2,Mo=bo=xo=_o=0)},point:ai,lineStart:ci,lineEnd:li,polygonStart:function(){2>yo&&(yo=2,Mo=bo=xo=_o=0),wo.lineStart=oi},polygonEnd:function(){wo.lineStart=ci}};Pu.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,n=Zi(-t[0]*Ru,-t[1]*Ru,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Ou,t[1]*=Ou}}),{type:"Polygon",coordinates:[i]}}var n,e,r=[0,0],i=6;return t.origin=function(n){return arguments.length?(r=n,t):r},t.angle=function(r){return arguments.length?(e=fi((n=+r)*Ru,i*Ru),t):n},t.precision=function(r){return arguments.length?(e=fi(n*Ru,(i=+r)*Ru),t):i},t.angle(90)};var So=hi(l,Mi,xi);Pu.geo.clipView=function(t,n,e,r){var i=Pu.geom.polygon([[t,n],[t,r],[e,r],[e,n]]).clip,u=wi(t,e,n,r);return function(t){function n(t,n){return t>=g&&e>=t&&n>=p&&r>=n}function a(e,r){n(e,r)&&t.point(e,r)}function o(){y.point=l,m=!0,d=!1}function c(){y.point=a,d&&t.lineEnd()}function l(e,r){var i=n(e,r);if(m)i&&(t.lineStart(),t.point(e,r));else if(i&&d)t.point(e,r);else{var a=[g,p],o=[e,r];u(a,o)&&(d||(t.lineStart(),t.point(a[0],a[1])),t.point(o[0],o[1]),i||t.lineEnd())}m=!1,g=e,p=r,d=i}function f(){v=[]}function s(){v.pop(),v=i(v);var n=v.length;if(n){t.lineStart();for(var e,r=0,n=v.length;n>r;++r)t.point((e=v[r])[0],e[1]);t.point(v[0][0],v[0][1]),t.lineEnd()}}function h(t,n){v.push([t,n])}var g,p,d,m,v,y={point:a,lineStart:o,lineEnd:c,polygonStart:function(){t.polygonStart(),y.lineStart=f,y.lineEnd=s,y.point=h},polygonEnd:function(){y.point=a,y.lineEnd=c,y.lineStart=o,t.polygonEnd()}};return y}},(Pu.geo.equirectangular=function(){return Ui(ki).scale(250/Hu)}).raw=ki.invert=ki;var ko=Ji(function(t){return 1/t},Math.atan);(Pu.geo.gnomonic=function(){return Ui(ko)}).raw=ko,Pu.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:n()}}function n(){return Pu.range(Math.ceil(u/m)*m,i,m).map(h).concat(Pu.range(Math.ceil(l/v)*v,c,v).map(g)).concat(Pu.range(Math.ceil(r/p)*p,e,p).filter(function(t){return Math.abs(t%m)>ju}).map(f)).concat(Pu.range(Math.ceil(o/d)*d,a,d).filter(function(t){return Math.abs(t%v)>ju}).map(s))}var e,r,i,u,a,o,c,l,f,s,h,g,p=10,d=p,m=90,v=360,y=2.5;return t.lines=function(){return n().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(c).slice(1),h(i).reverse().slice(1),g(l).reverse().slice(1))]}},t.extent=function(n){return arguments.length?t.majorExtent(n).minorExtent(n):t.minorExtent()},t.majorExtent=function(n){return arguments.length?(u=+n[0][0],i=+n[1][0],l=+n[0][1],c=+n[1][1],u>i&&(n=u,u=i,i=n),l>c&&(n=l,l=c,c=n),t.precision(y)):[[u,l],[i,c]]},t.minorExtent=function(n){return arguments.length?(r=+n[0][0],e=+n[1][0],o=+n[0][1],a=+n[1][1],r>e&&(n=r,r=e,e=n),o>a&&(n=o,o=a,a=n),t.precision(y)):[[r,o],[e,a]]},t.step=function(n){return arguments.length?t.majorStep(n).minorStep(n):t.minorStep()},t.majorStep=function(n){return arguments.length?(m=+n[0],v=+n[1],t):[m,v]},t.minorStep=function(n){return arguments.length?(p=+n[0],d=+n[1],t):[p,d]},t.precision=function(n){return arguments.length?(y=+n,f=Ei(o,a,90),s=Ai(r,e,y),h=Ei(l,c,90),g=Ai(u,i,y),t):y},t.majorExtent([[-180,-90+ju],[180,90-ju]]).minorExtent([[-180,-80-ju],[180,80+ju]])},Pu.geo.interpolate=function(t,n){return Ti(t[0]*Ru,t[1]*Ru,n[0]*Ru,n[1]*Ru)},Pu.geo.greatArc=function(){function e(){return{type:"LineString",coordinates:[r||u.apply(this,arguments),i||a.apply(this,arguments)]}}var r,i,u=n,a=t;return e.distance=function(){return Pu.geo.distance(r||u.apply(this,arguments),i||a.apply(this,arguments))},e.source=function(t){return arguments.length?(u=t,r="function"==typeof t?null:t,e):u},e.target=function(t){return arguments.length?(a=t,i="function"==typeof t?null:t,e):a},e.precision=function(){return arguments.length?e:0},e},qi.invert=function(t,n){return[2*Hu*t,2*Math.atan(Math.exp(2*Hu*n))-Hu/2]},(Pu.geo.mercator=function(){return Ui(qi).scale(500)}).raw=qi;var Eo=Ji(function(){return 1},Math.asin);(Pu.geo.orthographic=function(){return Ui(Eo)}).raw=Eo,Pu.geo.path=function(){function t(t){return t&&Pu.geo.stream(t,r(i.pointRadius("function"==typeof u?+u.apply(this,arguments):u))),i.result()}var n,e,r,i,u=4.5;return t.area=function(t){return Ao=0,Pu.geo.stream(t,r(To)),Ao},t.centroid=function(t){return yo=bo=xo=_o=0,Pu.geo.stream(t,r(qo)),_o?[bo/_o,xo/_o]:void 0},t.bounds=function(t){return ui(r)(t)},t.projection=function(e){return arguments.length?(r=(n=e)?e.stream||zi(e):c,t):n},t.context=function(n){return arguments.length?(i=null==(e=n)?new Di:new Li(n),t):e},t.pointRadius=function(n){return arguments.length?(u="function"==typeof n?n:+n,t):u},t.projection(Pu.geo.albersUsa()).context(null)};var Ao,No,To={point:On,lineStart:On,lineEnd:On,polygonStart:function(){No=0,To.lineStart=Fi},polygonEnd:function(){To.lineStart=To.lineEnd=To.point=On,Ao+=Math.abs(No/2)}},qo={point:Hi,lineStart:ji,lineEnd:Pi,polygonStart:function(){qo.lineStart=Ri},polygonEnd:function(){qo.point=Hi,qo.lineStart=ji,qo.lineEnd=Pi}};Pu.geo.area=function(t){return Co=0,Pu.geo.stream(t,Lo),Co};var Co,zo,Do,Lo={sphere:function(){Co+=4*Hu},point:On,lineStart:On,lineEnd:On,polygonStart:function(){zo=1,Do=0,Lo.lineStart=Oi},polygonEnd:function(){var t=2*Math.atan2(Do,zo);Co+=0>t?4*Hu+t:t,Lo.lineStart=Lo.lineEnd=Lo.point=On}};Pu.geo.length=function(t){return Fo=0,Pu.geo.stream(t,Ho),Fo};var Fo,Ho={sphere:On,point:On,lineStart:Yi,lineEnd:On,polygonStart:On,polygonEnd:On};Pu.geo.projection=Ui,Pu.geo.projectionMutator=Ii,Pu.geo.rotation=function(t){return t=Zi(t[0]%360*Ru,t[1]*Ru,t.length>2?t[2]*Ru:0),function(n){return n=t(n[0]*Ru,n[1]*Ru),n[0]*=Ou,n[1]*=Ou,n}};var jo=Ji(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Pu.geo.stereographic=function(){return Ui(jo)}).raw=jo,Pu.geom={},Pu.geom.hull=function(t){if(3>t.length)return[];var n,e,r,i,u,a,o,c,l,f,s=t.length,h=s-1,g=[],p=[],d=0;for(n=1;s>n;++n)t[n][1]n;++n)n!==d&&(i=t[n][1]-t[d][1],r=t[n][0]-t[d][0],g.push({angle:Math.atan2(i,r),index:n}));for(g.sort(function(t,n){return t.angle-n.angle}),l=g[0].angle,c=g[0].index,o=0,n=1;h>n;++n)e=g[n].index,l==g[n].angle?(r=t[c][0]-t[d][0],i=t[c][1]-t[d][1],u=t[e][0]-t[d][0],a=t[e][1]-t[d][1],r*r+i*i>=u*u+a*a?g[n].index=-1:(g[o].index=-1,l=g[n].angle,o=n,c=e)):(l=g[n].angle,o=n,c=e);for(p.push(d),n=0,e=0;2>n;++e)-1!==g[e].index&&(p.push(g[e].index),n++);for(f=p.length;h>e;++e)if(-1!==g[e].index){for(;!Gi(p[f-2],p[f-1],g[e].index,t);)--f;p[f++]=g[e].index}var m=[];for(n=0;f>n;++n)m.push(t[p[n]]);return m},Pu.geom.polygon=function(t){return t.area=function(){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];e>++n;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return.5*r},t.centroid=function(n){var e,r,i=-1,u=t.length,a=0,o=0,c=t[u-1];for(arguments.length||(n=-1/(6*t.area()));u>++i;)e=c,c=t[i],r=e[0]*c[1]-c[0]*e[1],a+=(e[0]+c[0])*r,o+=(e[1]+c[1])*r;return[a*n,o*n]},t.clip=function(n){for(var e,r,i,u,a,o,c=-1,l=t.length,f=t[l-1];l>++c;){for(e=n.slice(),n.length=0,u=t[c],a=e[(i=e.length)-1],r=-1;i>++r;)o=e[r],Ki(o,f,u)?(Ki(a,f,u)||n.push(Wi(a,o,f,u)),n.push(o)):Ki(a,f,u)&&n.push(Wi(a,o,f,u)),a=o;f=u}return n},t},Pu.geom.voronoi=function(t){var n=t.map(function(){return[]}),e=1e6;return Qi(t,function(t){var r,i,u,a,o,c;1===t.a&&t.b>=0?(r=t.ep.r,i=t.ep.l):(r=t.ep.l,i=t.ep.r),1===t.a?(o=r?r.y:-e,u=t.c-t.b*o,c=i?i.y:e,a=t.c-t.b*c):(u=r?r.x:-e,o=t.c-t.a*u,a=i?i.x:e,c=t.c-t.a*a);var l=[u,o],f=[a,c];n[t.region.l.index].push(l,f),n[t.region.r.index].push(l,f)}),n=n.map(function(n,e){var r=t[e][0],i=t[e][1],u=n.map(function(t){return Math.atan2(t[0]-r,t[1]-i)}),a=Pu.range(n.length).sort(function(t,n){return u[t]-u[n]});return a.filter(function(t,n){return!n||u[t]-u[a[n-1]]>ju}).map(function(t){return n[t]})}),n.forEach(function(n,r){var i=n.length;if(!i)return n.push([-e,-e],[-e,e],[e,e],[e,-e]);if(!(i>2)){var u=t[r],a=n[0],o=n[1],c=u[0],l=u[1],f=a[0],s=a[1],h=o[0],g=o[1],p=Math.abs(h-f),d=g-s;if(ju>Math.abs(d)){var m=s>l?-e:e;n.push([-e,m],[e,m])}else if(ju>p){var v=f>c?-e:e;n.push([v,-e],[v,e])}else{var m=(f-c)*(g-s)>(h-f)*(s-l)?e:-e,y=Math.abs(d)-p;ju>Math.abs(y)?n.push([0>d?m:-m,m]):(y>0&&(m*=-1),n.push([-e,m],[e,m]))}}}),n};var Po={l:"r",r:"l"};Pu.geom.delaunay=function(t){var n=t.map(function(){return[]}),e=[];return Qi(t,function(e){n[e.region.l.index].push(t[e.region.r.index])}),n.forEach(function(n,r){var i=t[r],u=i[0],a=i[1];n.forEach(function(t){t.angle=Math.atan2(t[0]-u,t[1]-a)}),n.sort(function(t,n){return t.angle-n.angle});for(var o=0,c=n.length-1;c>o;o++)e.push([i,n[o],n[o+1]])}),e},Pu.geom.quadtree=function(t,n,e,r,i){function u(t,n,e,r,i,u){if(!isNaN(n.x)&&!isNaN(n.y))if(t.leaf){var o=t.point;o?.01>Math.abs(o.x-n.x)+Math.abs(o.y-n.y)?a(t,n,e,r,i,u):(t.point=null,a(t,o,e,r,i,u),a(t,n,e,r,i,u)):t.point=n}else a(t,n,e,r,i,u)}function a(t,n,e,r,i,a){var o=.5*(e+i),c=.5*(r+a),l=n.x>=o,f=n.y>=c,s=(f<<1)+l;t.leaf=!1,t=t.nodes[s]||(t.nodes[s]=tu()),l?e=o:i=o,f?r=c:a=c,u(t,n,e,r,i,a)}var o,c=-1,l=t.length;if(5>arguments.length)if(3===arguments.length)i=e,r=n,e=n=0;else for(n=e=1/0,r=i=-1/0;l>++c;)o=t[c],n>o.x&&(n=o.x),e>o.y&&(e=o.y),o.x>r&&(r=o.x),o.y>i&&(i=o.y);var f=r-n,s=i-e;f>s?i=e+f:r=n+s;var h=tu();return h.add=function(t){u(h,t,n,e,r,i)},h.visit=function(t){nu(t,h,n,e,r,i)},t.forEach(h.add),h},Pu.time={};var Ro=Date,Oo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];eu.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Yo.setUTCDate.apply(this._,arguments)},setDay:function(){Yo.setUTCDay.apply(this._,arguments)},setFullYear:function(){Yo.setUTCFullYear.apply(this._,arguments)},setHours:function(){Yo.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Yo.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Yo.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Yo.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Yo.setUTCSeconds.apply(this._,arguments)},setTime:function(){Yo.setTime.apply(this._,arguments)}};var Yo=Date.prototype,Uo="%a %b %e %X %Y",Io="%m/%d/%Y",Vo="%H:%M:%S",Zo=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Xo=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Bo=["January","February","March","April","May","June","July","August","September","October","November","December"],$o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Pu.time.format=function(t){function n(n){for(var r,i,u,a=[],o=-1,c=0;e>++o;)37===t.charCodeAt(o)&&(a.push(t.substring(c,o)),null!=(i=nc[r=t.charAt(++o)])&&(r=t.charAt(++o)),(u=ec[r])&&(r=u(n,null==i?"e"===r?" ":"0":i)),a.push(r),c=o+1);return a.push(t.substring(c,o)),a.join("")}var e=t.length;return n.parse=function(n){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=ru(e,t,n,0);if(r!=n.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var i=new Ro;return i.setFullYear(e.y,e.m,e.d),i.setHours(e.H,e.M,e.S,e.L),i},n.toString=function(){return t},n};var Jo=iu(Zo),Go=iu(Xo),Ko=iu(Bo),Wo=uu(Bo),Qo=iu($o),tc=uu($o),nc={"-":"",_:" ",0:"0"},ec={a:function(t){return Xo[t.getDay()]},A:function(t){return Zo[t.getDay()]},b:function(t){return $o[t.getMonth()]},B:function(t){return Bo[t.getMonth()]},c:Pu.time.format(Uo),d:function(t,n){return au(t.getDate(),n,2)},e:function(t,n){return au(t.getDate(),n,2)},H:function(t,n){return au(t.getHours(),n,2)},I:function(t,n){return au(t.getHours()%12||12,n,2)},j:function(t,n){return au(1+Pu.time.dayOfYear(t),n,3)},L:function(t,n){return au(t.getMilliseconds(),n,3)},m:function(t,n){return au(t.getMonth()+1,n,2)},M:function(t,n){return au(t.getMinutes(),n,2)},p:function(t){return t.getHours()>=12?"PM":"AM"},S:function(t,n){return au(t.getSeconds(),n,2)},U:function(t,n){return au(Pu.time.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return au(Pu.time.mondayOfYear(t),n,2)},x:Pu.time.format(Io),X:Pu.time.format(Vo),y:function(t,n){return au(t.getFullYear()%100,n,2)},Y:function(t,n){return au(t.getFullYear()%1e4,n,4)},Z:Su,"%":function(){return"%"}},rc={a:ou,A:cu,b:lu,B:fu,c:su,d:yu,e:yu,H:Mu,I:Mu,L:_u,m:vu,M:bu,p:wu,S:xu,x:hu,X:gu,y:du,Y:pu},ic=/^\s*\d+/,uc=Pu.map({am:0,pm:1});Pu.time.format.utc=function(t){function n(t){try{Ro=eu;var n=new Ro;return n._=t,e(n)}finally{Ro=Date}}var e=Pu.time.format(t);return n.parse=function(t){try{Ro=eu;var n=e.parse(t);return n&&n._}finally{Ro=Date}},n.toString=e.toString,n};var ac=Pu.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");Pu.time.format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?ku:ac,ku.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},ku.toString=ac.toString,Pu.time.second=Eu(function(t){return new Ro(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))},function(t){return t.getSeconds()}),Pu.time.seconds=Pu.time.second.range,Pu.time.seconds.utc=Pu.time.second.utc.range,Pu.time.minute=Eu(function(t){return new Ro(6e4*Math.floor(t/6e4))},function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))},function(t){return t.getMinutes()}),Pu.time.minutes=Pu.time.minute.range,Pu.time.minutes.utc=Pu.time.minute.utc.range,Pu.time.hour=Eu(function(t){var n=t.getTimezoneOffset()/60; +return new Ro(36e5*(Math.floor(t/36e5-n)+n))},function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))},function(t){return t.getHours()}),Pu.time.hours=Pu.time.hour.range,Pu.time.hours.utc=Pu.time.hour.utc.range,Pu.time.day=Eu(function(t){var n=new Ro(1970,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n},function(t,n){t.setDate(t.getDate()+n)},function(t){return t.getDate()-1}),Pu.time.days=Pu.time.day.range,Pu.time.days.utc=Pu.time.day.utc.range,Pu.time.dayOfYear=function(t){var n=Pu.time.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},Oo.forEach(function(t,n){t=t.toLowerCase(),n=7-n;var e=Pu.time[t]=Eu(function(t){return(t=Pu.time.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t},function(t,n){t.setDate(t.getDate()+7*Math.floor(n))},function(t){var e=Pu.time.year(t).getDay();return Math.floor((Pu.time.dayOfYear(t)+(e+n)%7)/7)-(e!==n)});Pu.time[t+"s"]=e.range,Pu.time[t+"s"].utc=e.utc.range,Pu.time[t+"OfYear"]=function(t){var e=Pu.time.year(t).getDay();return Math.floor((Pu.time.dayOfYear(t)+(e+n)%7)/7)}}),Pu.time.week=Pu.time.sunday,Pu.time.weeks=Pu.time.sunday.range,Pu.time.weeks.utc=Pu.time.sunday.utc.range,Pu.time.weekOfYear=Pu.time.sundayOfYear,Pu.time.month=Eu(function(t){return t=Pu.time.day(t),t.setDate(1),t},function(t,n){t.setMonth(t.getMonth()+n)},function(t){return t.getMonth()}),Pu.time.months=Pu.time.month.range,Pu.time.months.utc=Pu.time.month.utc.range,Pu.time.year=Eu(function(t){return t=Pu.time.day(t),t.setMonth(0,1),t},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t){return t.getFullYear()}),Pu.time.years=Pu.time.year.range,Pu.time.years.utc=Pu.time.year.utc.range;var oc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],cc=[[Pu.time.second,1],[Pu.time.second,5],[Pu.time.second,15],[Pu.time.second,30],[Pu.time.minute,1],[Pu.time.minute,5],[Pu.time.minute,15],[Pu.time.minute,30],[Pu.time.hour,1],[Pu.time.hour,3],[Pu.time.hour,6],[Pu.time.hour,12],[Pu.time.day,1],[Pu.time.day,2],[Pu.time.week,1],[Pu.time.month,1],[Pu.time.month,3],[Pu.time.year,1]],lc=[[Pu.time.format("%Y"),l],[Pu.time.format("%B"),function(t){return t.getMonth()}],[Pu.time.format("%b %d"),function(t){return 1!=t.getDate()}],[Pu.time.format("%a %d"),function(t){return t.getDay()&&1!=t.getDate()}],[Pu.time.format("%I %p"),function(t){return t.getHours()}],[Pu.time.format("%I:%M"),function(t){return t.getMinutes()}],[Pu.time.format(":%S"),function(t){return t.getSeconds()}],[Pu.time.format(".%L"),function(t){return t.getMilliseconds()}]],fc=Pu.scale.linear(),sc=Cu(lc);cc.year=function(t,n){return fc.domain(t.map(Du)).ticks(n).map(zu)},Pu.time.scale=function(){return Nu(Pu.scale.linear(),cc,sc)};var hc=cc.map(function(t){return[t[0].utc,t[1]]}),gc=[[Pu.time.format.utc("%Y"),l],[Pu.time.format.utc("%B"),function(t){return t.getUTCMonth()}],[Pu.time.format.utc("%b %d"),function(t){return 1!=t.getUTCDate()}],[Pu.time.format.utc("%a %d"),function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],[Pu.time.format.utc("%I %p"),function(t){return t.getUTCHours()}],[Pu.time.format.utc("%I:%M"),function(t){return t.getUTCMinutes()}],[Pu.time.format.utc(":%S"),function(t){return t.getUTCSeconds()}],[Pu.time.format.utc(".%L"),function(t){return t.getUTCMilliseconds()}]],pc=Cu(gc);return hc.year=function(t,n){return fc.domain(t.map(Fu)).ticks(n).map(Lu)},Pu.time.scale.utc=function(){return Nu(Pu.scale.linear(),hc,pc)},Pu}(); \ No newline at end of file diff --git a/src/core/selection-insert.js b/src/core/selection-insert.js index c1732d16..c39abf12 100644 --- a/src/core/selection-insert.js +++ b/src/core/selection-insert.js @@ -1,19 +1,18 @@ -// TODO insert(node, function)? -// TODO insert(function, string)? -// TODO insert(function, function)? d3_selectionPrototype.insert = function(name, before) { name = d3.ns.qualify(name); - function insert() { + if (typeof before !== "function") before = d3_selection_selector(before); + + function insert(d, i) { return this.insertBefore( d3_document.createElementNS(this.namespaceURI, name), - d3_select(before, this)); + before.call(this, d, i)); } - function insertNS() { + function insertNS(d, i) { return this.insertBefore( d3_document.createElementNS(name.space, name.local), - d3_select(before, this)); + before.call(this, d, i)); } return this.select(name.local ? insertNS : insert); diff --git a/test/core/selection-insert-test.js b/test/core/selection-insert-test.js index 8a99003a..0cafe027 100644 --- a/test/core/selection-insert-test.js +++ b/test/core/selection-insert-test.js @@ -18,6 +18,14 @@ suite.addBatch({ assert.domEqual(div[0][0], document.body.firstChild); assert.domEqual(div[0][0].nextSibling, span[0][0]); }, + "inserts before the specified node": function(body) { + var span = body.html("").append("span"); + var div = body.insert("div", function() { return span.node(); }); + assert.equal(div[0][0].tagName, "DIV"); + assert.isNull(div[0][0].namespaceURI); + assert.domEqual(div[0][0], document.body.firstChild); + assert.domEqual(div[0][0].nextSibling, span[0][0]); + }, "appends an HTML element": function(body) { var div = body.insert("div"); assert.equal(div[0][0].tagName, "DIV");