Skip to content

Instantly share code, notes, and snippets.

@hnakamur
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnakamur/b8af8ae9007674d18b2b to your computer and use it in GitHub Desktop.
Save hnakamur/b8af8ae9007674d18b2b to your computer and use it in GitHub Desktop.
An example for drawing an arrowhead at the intersection of a bezier curve and a circle using d3.js
!function(n){function t(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return n[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var e={};return t.m=n,t.c=e,t.p="dist/",t(0)}([function(n,t,e){function r(n){n.x=l.event.x,n.y=l.event.y,l.select(this).attr({cx:n.x,cy:n.y}),n.pathElem.attr("d",i),n.controlLineElem&&n.controlLineElem.attr("d",u),_.selectAll("text.handle-text.path"+n.pathID+".p"+(n.handleID+1)).attr({x:n.x,y:n.y}).text(o(n,n.handleID)),c()}function i(n){var t=n.points;switch(n.type){case"L":return["M",t[0].x," ",t[0].y," ",t[1].x," ",t[1].y].join("");case"Q":return["M",t[0].x," ",t[0].y,"Q",t[1].x," ",t[1].y," ",t[2].x," ",t[2].y].join("");case"C":return["M",t[0].x," ",t[0].y,"C",t[1].x," ",t[1].y," ",t[2].x," ",t[2].y," ",t[3].x," ",t[3].y].join("");case"A":return"M"+n.x1+" "+n.y1+"A"+n.rx+" "+n.ry+" "+n.xAxisRotation+" "+n.largeArcFlag+" "+n.sweepFlag+" "+n.x2+" "+n.y2}}function u(n){var t=[];return n.points.forEach(function(n){t.push(n.x),t.push(n.y)}),"M"+t.join(" ")}function o(n,t){return"p"+(t+1)+": "+n.x+"/"+n.y}function a(n){var t=n.xs,e=n.ys;return"M"+t[0]+" "+e[0]+"C"+t[1]+" "+e[1]+" "+t[2]+" "+e[2]+" "+t[3]+" "+e[3]}function s(n,t,e){var r=n.selectAll("path."+e).data([t]);r.attr({d:a}),r.enter().append("path").attr({"class":e,d:a,"marker-end":"url(#arrowhead)"}),r.exit().remove()}function c(){var n,t=m[0].points[3],e=new h(t.x,t.y,d,d,0,0,360),r=f.fromPoints(m[0].points),i=[r,e].map(function(n){return g.divideAtXYTangentPoints(n)}),u=g.getIntersectionsAndParameters(i[0],i[1]);u.length>0&&(n=u[0][1][0]);var o=r.getCurveFromZeroToT(n);s(b,o,"cut-curve")}var l=e(9);e(6);var f=e(1),h=e(2),g=e(3),p=l.select("#example").append("svg").attr({width:400,height:400}),v=8,d=30,m=[{type:"C",points:[{x:120,y:160},{x:35,y:200},{x:220,y:260},{x:220,y:40}]}],y=p.append("defs");y.append("marker").attr({id:"arrowhead",viewBox:"0 0 10 10",refX:10,refY:5,markerWidth:10,markerHeight:10,orient:"auto"}).append("path").attr({d:"M10 5 0 10 0 8.7 6.8 5.5 0 5.5 0 4.5 6.8 4.5 0 1.3 0 0Z",stroke:"none",fill:"black"});var x=p.append("g").attr("class","control-line-layer"),M=p.append("g").attr("class","main-layer"),b=p.append("g").attr("class","intersection-layer"),_=p.append("g").attr("class","handle-text-layer"),w=p.append("g").attr("class","handle-layer"),S=l.behavior.drag().origin(function(n){return n}).on("drag",r);M.selectAll("path.curves").data(m).enter().append("path").attr({"class":function(n,t){return"curves path"+t},d:i}).each(function(n,t){var e,r,i=l.select(this);("Q"===n.type||"C"===n.type)&&(e=x.selectAll("path.control-line.path"+t).data([n]).enter().append("path").attr({"class":"control-line path"+t,d:u(n)}),r=_.selectAll("text.handle-text.path"+t).data(n.points).enter().append("text").attr({"class":function(n,e){return"handle-text path"+t+" p"+(e+1)},x:function(n){return n.x},y:function(n){return n.y},dx:10,dy:0}).text(o),w.selectAll("circle.handle.path"+t).data(n.points).enter().append("circle").attr({"class":"handle path"+t,cx:function(n){return n.x},cy:function(n){return n.y},r:function(n,t){return 3>t?v:d}}).each(function(n,r){n.pathID=t,n.handleID=r,n.pathElem=i,n.controlLineElem=e}).call(S))}),c()},function(n,t,e){function r(n,t){this.xs=n,this.ys=t}function i(n,t){for(var e=n.length-1,r=1-t,i=1,u=1,o=n[0]*r,a=1;e>a;a++)u*=t,i*=(e-a+1)/a,o=(o+u*i*n[a])*r;return o+u*t*n[e]}function u(n){for(var t=n.length-1,e=new Array(t),r=0;t>r;r++)e[r]=t*(n[r+1]-n[r]);return e}function o(n){var t,e,r,i;3===n.length?(e=n[0]-2*n[1]+n[2],r=2*(n[1]-n[0]),i=n[0]):(e=0,r=n[1]-n[0],i=n[0]),t=s(e,r,i);var u,o=0,a=t.length,c=[];for(o=0;a>o;o++)u=t[o],u>=0&&1>=u&&c.push(u);return c}function a(n,t){return Math.sqrt(n*n+t*t)}var s=e(10);r.fromPoints=function(n){return new r(n.map(function(n){return n.x}),n.map(function(n){return n.y}))},r.prototype.getPointAtT=function(n){return{x:i(this.xs,n),y:i(this.ys,n)}},r.prototype.getXYTangentParameters=function(){var n=this._getDerivative();return n._getTangentParameters()},r.prototype._getDerivative=function(){return new r(u(this.xs),u(this.ys))},r.prototype._getTangentParameters=function(n){var t,e,r=o(this.xs),i=o(this.ys),u=r.concat(i).sort(),a=u.length,s=[],c=1;for(a>0&&s.push(u[0]);a>c;c++)t=u[c],e=u[c-1],this._nearlySamePointParameters(e,t,n)||s.push(t);return s},r.prototype._nearlySamePointParameters=function(n,t,e){var r=this.getPointAtT(n),i=this.getPointAtT(t),u=a(i.x-r.x,i.y-r.y);return void 0===e&&(e=1),e>=u},r.prototype.getCurveFromZeroToT=function(n){var t=this.xs,e=this.ys,i={x:t[0],y:e[0]},u=new r([t[0],t[1]],[e[0],e[1]]).getPointAtT(n),o=new r([t[1],t[2]],[e[1],e[2]]).getPointAtT(n),a=new r.fromPoints([u,o]).getPointAtT(n),s=this.getPointAtT(n);return r.fromPoints([i,u,a,s])},n.exports=r},function(n){function t(n,t,e,r,i,u,o){this.cx=n,this.cy=t,this.rx=e,this.ry=r,this.xAxisRotation=i,this.angleStart=u,this.angleExtent=o}function e(n){return n*Math.PI/180}function r(n){return 180*n/Math.PI}function i(n){return function(t,e){return(e>t?-1:t>e?1:0)*(n?1:-1)}}t.fromSvgPathParameters=function(n,i,u,o,a,s,c,l,f){var h,g,p,v,d,m,y,x,M,b,_,w,S,k,A,E,C,N,T,P,z,L=e(a%360),q=Math.cos(L),D=Math.sin(L),R=(n-l)/2,j=(i-f)/2,U=q*R+D*j,I=-D*R+q*j;u=Math.abs(u),o=Math.abs(o),h=u*u,g=o*o,p=U*U,v=I*I,d=p/h+v/g,d>1&&(u*=Math.sqrt(d),o*=Math.sqrt(d),h=u*u,g=o*o);var m=s===c?-1:1,y=h*v+g*p,x=h*g-y,M=0>x?0:m*Math.sqrt(x/y),b=M*(u*I/o),_=M*(-o*U/u),w=(n+l)/2,S=(i+f)/2,k=q*b-D*_+w,A=D*b+q*_+S,E=(U-b)/u,C=(I-_)/o,N=(-U-b)/u,T=(-I-_)/o;m=0>C?-1:1,x=E,y=Math.sqrt(E*E+C*C);var P=r(m*Math.acos(x/y));m=0>E*T-C*N?-1:1,x=E*N+C*T,y=Math.sqrt((E*E+C*C)*(N*N+T*T));var z=r(m*Math.acos(x/y));return!c&&z>0?z-=360:c&&0>z&&(z+=360),z%=360,P%=360,new t(k,A,u,o,a,P,z)},t.prototype.getPointAtT=function(n){return this.getPointAtAngle(this.getAngleAtT(n))},t.prototype.getAngleAtT=function(n){return this.angleStart+n*this.angleExtent},t.prototype.getTAtAngle=function(n){return(n-this.angleStart)/this.angleExtent},t.prototype.getPointAtAngle=function(n){var t=e(n),r=this.cx,i=this.cy,u=this.rx,o=this.ry,a=e(this.xAxisRotation%360),s=Math.cos(a),c=Math.sin(a),l=u*Math.cos(t),f=o*Math.sin(t);return{x:r+s*l-c*f,y:i+c*l+s*f}},t.prototype.getXYTangentParameters=function(){return this.getXYTangentAngles().map(function(n){return this.getTAtAngle(n)},this)},t.prototype.getXYTangentAngles=function(){var n=this.rx,t=this.ry,u=e(this.xAxisRotation%360),o=Math.cos(u),a=Math.sin(u),s=this.angleStart,c=this.angleExtent,l=r(Math.atan2(-t*a,n*o))%360,f=r(Math.atan2(t*o,n*a))%360,h=[],g=[];return s>=0?(0>=l&&(l+=360),0>=f&&(f+=360)):0>s&&(l>=0&&(l-=360),f>=0&&(f-=360)),h.push(l-360),h.push(f-360),h.push(l-180),h.push(f-180),h.push(l),h.push(f),h.push(l+180),h.push(f+180),h.push(l+360),h.push(f+360),g=h.filter(function(n){return this.isAngleInRange(n)},this),g.sort(i(c>0)),g},t.prototype.isAngleInRange=function(n){var t=this.angleStart,e=this.angleExtent;return e>=0?n>=t&&t+e>=n:n>=t+e&&t>=n},n.exports=t},function(n,t,e){function r(n,t,e){this.curve=n,this.t0=t,this.t1=e,this.p0=n.getPointAtT(t),this.p1=n.getPointAtT(e),this.bbox=u.fromTwoPoints(this.p0,this.p1)}var i=e(4),u=e(5);r.divideAtXYTangentPoints=function(n){for(var t=[].concat(0,n.getXYTangentParameters(),1),e=1,i=t.length,u=[];i>e;e++)u.push(new r(n,t[e-1],t[e]));return u},r.getBboxOverlappingPairs=function(n,t){var e,r,i,u,o=[],a=n.length,s=t.length;for(e=0;a>e;e++)for(i=n[e],r=0;s>r;r++)u=t[r],i.bbox.overlaps(u.bbox)&&o.push([i,u]);return o},r.isAnyOverlaps=function(n,t){for(var e=n.bbox,r=t.length,i=0;r>i;i++)if(e.overlaps(t[i].bbox))return!0;return!1},r.selectOverlappingSegments=function(n,t){var e=[],i=[];return n.forEach(function(n){r.isAnyOverlaps(n,t)&&e.push(n)}),t.forEach(function(t){r.isAnyOverlaps(t,n)&&i.push(t)}),[e,i]},r.divideSegment=function(n){var t=n.curve,e=n.t0,i=n.t1,u=(e+i)/2;return[new r(t,e,u),new r(t,u,i)]},r.divideSegments=function(n){for(var t,e=[],i=n.length,u=0;i>u;u++)t=r.divideSegment(n[u]),e.push(t[0]),e.push(t[1]);return e},r.getIntersectionAndParametersAsLines=function(n,t){var e=[n,t].map(function(n){return new i([n.p0,n.p1])});return i.getIntersectionAndParameters(e[0],e[1])},r.prototype.getParameterInCurve=function(n){return(1-n)*this.t0+n*this.t1},r.getIntersectionsAndParameters=function(n,t){var e,i,u,o=[],a=[n,t];for(e=0;5>e;e++)a=r.selectOverlappingSegments(a[0],a[1]),a=a.map(function(n){return r.divideSegments(n)});return a=r.selectOverlappingSegments(a[0],a[1]),i=r.getBboxOverlappingPairs(a[0],a[1]),i.forEach(function(n){var t;u=r.getIntersectionAndParametersAsLines(n[0],n[1]),null!==u&&(t=u[1],t[0]=n[0].getParameterInCurve(t[0]),t[1]=n[1].getParameterInCurve(t[1]),o.push(u))}),o},n.exports=r},function(n){function t(n){this.points=n}function e(n,t,e){this.x=n,this.y=t,this.w=void 0===e?1:e}function r(n,t,e){this.a=n,this.b=t,this.c=e}t.getIntersectionAndParameters=function(n,t){var i,u,o,a=[n,t],s=a.map(function(n){var t=n.points.map(function(n){return e.fromPoint2D(n.x,n.y)});return r.fromTwoHomogeneousPoints(t[0],t[1])});return i=e.getIntersection(s[0],s[1]),0!==i.w&&(u=i.toPoint2D(),o=a.map(function(n){return n.getParameterForPoint(u)}),0<=o[0]&&o[0]<=1&&0<=o[1]&&o[1]<=1)?[u,o]:null},t.prototype.getParameterForPoint=function(n){var t=this.points[0],e=this.points[1],r=(n.x-t.x)/(e.x-t.x),i=(n.y-t.y)/(e.y-t.y);return isNaN(r)?i:isNaN(i)?r:Math.abs(n.x-t.x)>Math.abs(n.y-t.y)?r:i},e.prototype.toPoint2D=function(){return{x:this.x/this.w,y:this.y/this.w}},e.fromPoint2D=function(n,t){return new e(n,t)},e.getIntersection=function(n,t){return new e(n.b*t.c-t.b*n.c,t.a*n.c-n.a*t.c,n.a*t.b-t.a*n.b)},r.fromTwoHomogeneousPoints=function(n,t){return new r(n.y*t.w-t.y*n.w,t.x*n.w-n.x*t.w,n.x*t.y-t.x*n.y)},n.exports=t},function(n){function t(n,t,e,r){this.x=n,this.y=t,this.width=e,this.height=r}t.fromTwoPoints=function(n,e){return new t(Math.min(n.x,e.x),Math.min(n.y,e.y),Math.abs(e.x-n.x),Math.abs(e.y-n.y))},t.prototype.overlaps=function(n){return this.x<n.x+n.width&&this.x+this.width>n.x&&this.y<n.y+n.height&&this.y+this.height>n.y},n.exports=t},function(n,t,e){e(8)(e(7))},function(n){n.exports="svg{border:1px solid #000}.curves{stroke:#ff0;fill:none;opacity:.3}.control-line{stroke:green;fill:none}.bbox0{stroke:#00f}.bbox0,.bbox1{stroke-width:2;fill:none;opacity:.5}.bbox1{stroke:orange}.intersection{stroke:none;fill:#00f;opacity:.5}.tangent-point{stroke:none;fill:red;opacity:.5}.handle{fill:red;opacity:.5;cursor:move}.handle-text{font-size:12px;font-family:'Noto Sans Japanese',sans}.cut-curve{stroke:purple;stroke-width:1;fill:none;opacity:.5}"},function(n){n.exports=function(n){var t=document.createElement("style");t.type="text/css";var e=document.getElementsByTagName("head")[0];return e.appendChild(t),t.styleSheet?t.styleSheet.cssText=n:t.appendChild(document.createTextNode(n)),function(){e.removeChild(t)}}},function(n,t,e){var r,i;!function(){function u(n,t){return t>n?-1:n>t?1:n>=t?0:0/0}function o(n){return null!=n&&!isNaN(n)}function a(n){return{left:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)<0?r=u+1:i=u}return r},right:function(t,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=t.length);i>r;){var u=r+i>>>1;n(t[u],e)>0?i=u:r=u+1}return r}}}function s(n){return n.length}function c(n){for(var t=1;n*t%1;)t*=10;return t}function l(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function f(){}function h(n){return la+n in this}function g(n){return n=la+n,n in this&&delete this[n]}function p(){var n=[];return this.forEach(function(t){n.push(t)}),n}function v(){var n=0;for(var t in this)t.charCodeAt(0)===fa&&++n;return n}function d(){for(var n in this)if(n.charCodeAt(0)===fa)return!1;return!0}function m(){}function y(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function x(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=ha.length;r>e;++e){var i=ha[e]+t;if(i in n)return i}}function M(){}function b(){}function _(n){function t(){for(var t,r=e,i=-1,u=r.length;++i<u;)(t=r[i].on)&&t.apply(this,arguments);return n}var e=[],r=new f;return t.on=function(t,i){var u,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,u=e.indexOf(o)).concat(e.slice(u+1)),r.remove(t)),i&&e.push(r.set(t,{on:i})),n)},t}function w(){Wo.event.preventDefault()}function S(){for(var n,t=Wo.event;n=t.sourceEvent;)t=n;return t}function k(n){for(var t=new b,e=0,r=arguments.length;++e<r;)t[arguments[e]]=_(t);return t.of=function(e,r){return function(i){try{var u=i.sourceEvent=Wo.event;i.target=n,Wo.event=i,t[i.type].apply(e,r)}finally{Wo.event=u}}},t}function A(n){return pa(n,xa),n}function E(n){return"function"==typeof n?n:function(){return va(n,this)}}function C(n){return"function"==typeof n?n:function(){return da(n,this)}}function N(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function i(){this.setAttribute(n,t)}function u(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=Wo.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?u:i}function T(n){return n.trim().replace(/\s+/g," ")}function P(n){return new RegExp("(?:^|\\s+)"+Wo.requote(n)+"(?:\\s+|$)","g")}function z(n){return(n+"").trim().split(/^|\s+/)}function L(n,t){function e(){for(var e=-1;++e<i;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<i;)n[e](this,r)}n=z(n).map(q);var i=n.length;return"function"==typeof t?r:e}function q(n){var t=P(n);return function(e,r){if(i=e.classList)return r?i.add(n):i.remove(n);var i=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(i)||e.setAttribute("class",T(i+" "+n))):e.setAttribute("class",T(i.replace(t," ")))}}function D(n,t,e){function r(){this.style.removeProperty(n)}function i(){this.style.setProperty(n,t,e)}function u(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?u:i}function R(n,t){function e(){delete this[n]}function r(){this[n]=t}function i(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?i:r}function j(n){return"function"==typeof n?n:(n=Wo.ns.qualify(n)).local?function(){return this.ownerDocument.createElementNS(n.space,n.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,n)}}function U(n){return{__data__:n}}function I(n){return function(){return ya(this,n)}}function F(n){return arguments.length||(n=u),function(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}}function H(n,t){for(var e=0,r=n.length;r>e;e++)for(var i,u=n[e],o=0,a=u.length;a>o;o++)(i=u[o])&&t(i,o,e);return n}function O(n){return pa(n,ba),n}function Y(n){var t,e;return function(r,i,u){var o,a=n[u].update,s=a.length;for(u!=e&&(e=u,t=0),i>=t&&(t=i+1);!(o=a[t])&&++t<s;);return o}}function Z(){var n=this.__transition__;n&&++n.active}function X(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function i(){var i=s(t,Qo(arguments));r.call(this),this.addEventListener(n,this[o]=i,i.$=e),i._=t}function u(){var t,e=new RegExp("^__on([^.]+)"+Wo.requote(n)+"$");for(var r in this)if(t=r.match(e)){var i=this[r];this.removeEventListener(t[1],i,i.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),s=V;a>0&&(n=n.substring(0,a));var c=wa.get(n);return c&&(n=c,s=B),a?t?i:r:t?M:u}function V(n,t){return function(e){var r=Wo.event;Wo.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{Wo.event=r}}}function B(n,t){var e=V(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function $(){var n=".dragsuppress-"+ ++ka,t="click"+n,e=Wo.select(na).on("touchmove"+n,w).on("dragstart"+n,w).on("selectstart"+n,w);if(Sa){var r=Ko.style,i=r[Sa];r[Sa]="none"}return function(u){function o(){e.on(t,null)}e.on(n,null),Sa&&(r[Sa]=i),u&&(e.on(t,function(){w(),o()},!0),setTimeout(o,0))}}function W(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>Aa&&(na.scrollX||na.scrollY)){e=Wo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=e[0][0].getScreenCTM();Aa=!(i.f||i.e),e.remove()}return Aa?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var u=n.getBoundingClientRect();return[t.clientX-u.left-n.clientLeft,t.clientY-u.top-n.clientTop]}function J(){return Wo.event.changedTouches[0].identifier}function Q(){return Wo.event.target}function G(){return na}function K(n){return n>0?1:0>n?-1:0}function nt(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function tt(n){return n>1?0:-1>n?Ea:Math.acos(n)}function et(n){return n>1?Na:-1>n?-Na:Math.asin(n)}function rt(n){return((n=Math.exp(n))-1/n)/2}function it(n){return((n=Math.exp(n))+1/n)/2}function ut(n){return((n=Math.exp(2*n))-1)/(n+1)}function ot(n){return(n=Math.sin(n/2))*n}function at(){}function st(n,t,e){return this instanceof st?(this.h=+n,this.s=+t,void(this.l=+e)):arguments.length<2?n instanceof st?new st(n.h,n.s,n.l):_t(""+n,wt,st):new st(n,t,e)}function ct(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?u+(o-u)*n/60:180>n?o:240>n?u+(o-u)*(240-n)/60:u}function i(n){return Math.round(255*r(n))}var u,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,u=2*e-o,new yt(i(n+120),i(n),i(n-120))}function lt(n,t,e){return this instanceof lt?(this.h=+n,this.c=+t,void(this.l=+e)):arguments.length<2?n instanceof lt?new lt(n.h,n.c,n.l):n instanceof ht?pt(n.l,n.a,n.b):pt((n=St((n=Wo.rgb(n)).r,n.g,n.b)).l,n.a,n.b):new lt(n,t,e)}function ft(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),new ht(e,Math.cos(n*=za)*t,Math.sin(n)*t)}function ht(n,t,e){return this instanceof ht?(this.l=+n,this.a=+t,void(this.b=+e)):arguments.length<2?n instanceof ht?new ht(n.l,n.a,n.b):n instanceof lt?ft(n.l,n.c,n.h):St((n=yt(n)).r,n.g,n.b):new ht(n,t,e)}function gt(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return i=vt(i)*Ya,r=vt(r)*Za,u=vt(u)*Xa,new yt(mt(3.2404542*i-1.5371385*r-.4985314*u),mt(-.969266*i+1.8760108*r+.041556*u),mt(.0556434*i-.2040259*r+1.0572252*u))}function pt(n,t,e){return n>0?new lt(Math.atan2(e,t)*La,Math.sqrt(t*t+e*e),n):new lt(0/0,0/0,n)}function vt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function dt(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function mt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function yt(n,t,e){return this instanceof yt?(this.r=~~n,this.g=~~t,void(this.b=~~e)):arguments.length<2?n instanceof yt?new yt(n.r,n.g,n.b):_t(""+n,yt,ct):new yt(n,t,e)}function xt(n){return new yt(n>>16,n>>8&255,255&n)}function Mt(n){return xt(n)+""}function bt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function _t(n,t,e){var r,i,u,o=0,a=0,s=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))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 t(At(i[0]),At(i[1]),At(i[2]))}return(u=$a.get(n))?t(u.r,u.g,u.b):(null==n||"#"!==n.charAt(0)||isNaN(u=parseInt(n.substring(1),16))||(4===n.length?(o=(3840&u)>>4,o=o>>4|o,a=240&u,a=a>>4|a,s=15&u,s=s<<4|s):7===n.length&&(o=(16711680&u)>>16,a=(65280&u)>>8,s=255&u)),t(o,a,s))}function wt(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-u,s=(o+u)/2;return a?(i=.5>s?a/(o+u):a/(2-o-u),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,i=s>0&&1>s?0:r),new st(r,i,s)}function St(n,t,e){n=kt(n),t=kt(t),e=kt(e);var r=dt((.4124564*n+.3575761*t+.1804375*e)/Ya),i=dt((.2126729*n+.7151522*t+.072175*e)/Za),u=dt((.0193339*n+.119192*t+.9503041*e)/Xa);return ht(116*i-16,500*(r-i),200*(i-u))}function kt(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function At(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function Et(n){return"function"==typeof n?n:function(){return n}}function Ct(n){return n}function Nt(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Tt(t,e,n,r)}}function Tt(n,t,e,r){function i(){var n,t=s.status;if(!t&&s.responseText||t>=200&&300>t||304===t){try{n=e.call(u,s)}catch(r){return void o.error.call(u,r)}o.load.call(u,n)}else o.error.call(u,s)}var u={},o=Wo.dispatch("beforesend","progress","load","error"),a={},s=new XMLHttpRequest,c=null;return!na.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(n)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=i:s.onreadystatechange=function(){s.readyState>3&&i()},s.onprogress=function(n){var t=Wo.event;Wo.event=n;try{o.progress.call(u,s)}finally{Wo.event=t}},u.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",u)},u.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",u):t},u.responseType=function(n){return arguments.length?(c=n,u):c},u.response=function(n){return e=n,u},["get","post"].forEach(function(n){u[n]=function(){return u.send.apply(u,[n].concat(Qo(arguments)))}}),u.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),s.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),s.setRequestHeader)for(var l in a)s.setRequestHeader(l,a[l]);return null!=t&&s.overrideMimeType&&s.overrideMimeType(t),null!=c&&(s.responseType=c),null!=i&&u.on("error",i).on("load",function(n){i(null,n)}),o.beforesend.call(u,s),s.send(null==r?null:r),u},u.abort=function(){return s.abort(),u},Wo.rebind(u,o,"on"),null==r?u:u.get(Pt(r))}function Pt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function zt(){var n=Lt(),t=qt()-n;t>24?(isFinite(t)&&(clearTimeout(Ga),Ga=setTimeout(zt,t)),Qa=0):(Qa=1,ns(zt))}function Lt(){var n=Date.now();for(Ka=Wa;Ka;)n>=Ka.t&&(Ka.f=Ka.c(n-Ka.t)),Ka=Ka.n;return n}function qt(){for(var n,t=Wa,e=1/0;t;)t.f?t=n?n.n=t.n:Wa=t.n:(t.t<e&&(e=t.t),t=(n=t).n);return Ja=n,e}function Dt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Rt(n,t){var e=Math.pow(10,3*ca(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function jt(n){var t=n.decimal,e=n.thousands,r=n.grouping,i=n.currency,u=r?function(n){for(var t=n.length,i=[],u=0,o=r[0];t>0&&o>0;)i.push(n.substring(t-=o,t+o)),o=r[u=(u+1)%r.length];return i.reverse().join(e)}:Ct;return function(n){var e=es.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"",s=e[4]||"",c=e[5],l=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1;switch(h&&(h=+h.substring(1)),(c||"0"===r&&"="===o)&&(c=r="0",o="=",f&&(l-=Math.floor((l-1)/4))),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===s&&(v="0"+g.toLowerCase());case"c":case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===s&&(v=i[0],d=i[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=rs.get(g)||Ut;var y=c&&f;return function(n){var e=d;if(m&&n%1)return"";var i=0>n||0===n&&0>1/n?(n=-n,"-"):a;if(0>p){var s=Wo.formatPrefix(n,h);n=s.scale(n),e=s.symbol+d}else n*=p;n=g(n,h);var x=n.lastIndexOf("."),M=0>x?n:n.substring(0,x),b=0>x?"":t+n.substring(x+1);!c&&f&&(M=u(M));var _=v.length+M.length+b.length+(y?0:i.length),w=l>_?new Array(_=l-_+1).join(r):"";return y&&(M=u(w+M)),i+=v,n=M+b,("<"===o?i+n+w:">"===o?w+i+n:"^"===o?w.substring(0,_>>=1)+i+n+w.substring(_):i+(y?n:w+n))+e}}}function Ut(n){return n+""}function It(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ft(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new us(e-1)),1),e}function u(n,e){return t(n=new us(+n),e),n}function o(n,r,u){var o=i(n),a=[];if(u>1)for(;r>o;)e(o)%u||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{us=It;var r=new It;return r._=n,o(r,t,e)}finally{us=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=o;var s=n.utc=Ht(n);return s.floor=s,s.round=Ht(r),s.ceil=Ht(i),s.offset=Ht(u),s.range=a,n}function Ht(n){return function(t,e){try{us=It;var r=new It;return r._=t,n(r,e)._}finally{us=Date}}}function Ot(n){function t(n){function t(t){for(var e,i,u,o=[],a=-1,s=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.substring(s,a)),null!=(i=as[e=n.charAt(++a)])&&(e=n.charAt(++a)),(u=C[e])&&(e=u(t,null==i?"e"===e?" ":"0":i)),o.push(e),s=a+1);return o.push(n.substring(s,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=e(r,n,t,0);if(i!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var u=null!=r.Z&&us!==It,o=new(u?It:us);return"j"in r?o.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+Math.floor(r.Z/100),r.M+r.Z%100,r.S,r.L),u?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var i,u,o,a=0,s=t.length,c=e.length;s>a;){if(r>=c)return-1;if(i=t.charCodeAt(a++),37===i){if(o=t.charAt(a++),u=N[o in as?t.charAt(a++):o],!u||(r=u(n,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){_.lastIndex=0;var r=_.exec(t.substring(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){M.lastIndex=0;var r=M.exec(t.substring(e));return r?(n.w=b.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){A.lastIndex=0;var r=A.exec(t.substring(e));return r?(n.m=E.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.substring(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,C.c.toString(),t,r)}function s(n,t,r){return e(n,C.x.toString(),t,r)}function c(n,t,r){return e(n,C.X.toString(),t,r)}function l(n,t,e){var r=x.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{us=It;var t=new us;return t._=n,r(t)}finally{us=Date}}var r=t(n);return e.parse=function(n){try{us=It;var t=r.parse(n);return t&&t._}finally{us=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=se;var x=Wo.map(),M=Zt(v),b=Xt(v),_=Zt(d),w=Xt(d),S=Zt(m),k=Xt(m),A=Zt(y),E=Xt(y);p.forEach(function(n,t){x.set(n.toLowerCase(),t)});var C={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return Yt(n.getDate(),t,2)},e:function(n,t){return Yt(n.getDate(),t,2)},H:function(n,t){return Yt(n.getHours(),t,2)},I:function(n,t){return Yt(n.getHours()%12||12,t,2)},j:function(n,t){return Yt(1+is.dayOfYear(n),t,3)},L:function(n,t){return Yt(n.getMilliseconds(),t,3)},m:function(n,t){return Yt(n.getMonth()+1,t,2)},M:function(n,t){return Yt(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return Yt(n.getSeconds(),t,2)},U:function(n,t){return Yt(is.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Yt(is.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return Yt(n.getFullYear()%100,t,2)},Y:function(n,t){return Yt(n.getFullYear()%1e4,t,4)},Z:oe,"%":function(){return"%"}},N={a:r,A:i,b:u,B:o,c:a,d:ne,e:ne,H:ee,I:ee,j:te,L:ue,m:Kt,M:re,p:l,S:ie,U:Bt,w:Vt,W:$t,x:s,X:c,y:Jt,Y:Wt,Z:Qt,"%":ae};return t}function Yt(n,t,e){var r=0>n?"-":"",i=(r?-n:n)+"",u=i.length;return r+(e>u?new Array(e-u+1).join(t)+i:i)}function Zt(n){return new RegExp("^(?:"+n.map(Wo.requote).join("|")+")","i")}function Xt(n){for(var t=new f,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Vt(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Bt(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e));return r?(n.U=+r[0],e+r[0].length):-1}function $t(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e));return r?(n.W=+r[0],e+r[0].length):-1}function Wt(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Jt(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+2));return r?(n.y=Gt(+r[0]),e+r[0].length):-1}function Qt(n,t,e){return/^[+-]\d{4}$/.test(t=t.substring(e,e+5))?(n.Z=-t,e+5):-1}function Gt(n){return n+(n>68?1900:2e3)}function Kt(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function ne(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function te(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function ee(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function re(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ie(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function ue(n,t,e){ss.lastIndex=0;var r=ss.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function oe(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=~~(ca(t)/60),i=ca(t)%60;return e+Yt(r,"0",2)+Yt(i,"0",2)}function ae(n,t,e){cs.lastIndex=0;var r=cs.exec(t.substring(e,e+1));return r?e+r[0].length:-1}function se(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function ce(){}function le(n,t,e){var r=e.s=n+t,i=r-n,u=r-i;e.t=n-u+(t-i)}function fe(n,t){n&&gs.hasOwnProperty(n.type)&&gs[n.type](n,t)}function he(n,t,e){var r,i=-1,u=n.length-e;for(t.lineStart();++i<u;)r=n[i],t.point(r[0],r[1],r[2]);t.lineEnd()}function ge(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)he(n[e],t,1);t.polygonEnd()}function pe(){function n(n,t){n*=za,t=t*za/2+Ea/4;var e=n-r,o=e>=0?1:-1,a=o*e,s=Math.cos(t),c=Math.sin(t),l=u*c,f=i*s+l*Math.cos(a),h=l*o*Math.sin(a);vs.add(Math.atan2(h,f)),r=n,i=s,u=c}var t,e,r,i,u;ds.point=function(o,a){ds.point=n,r=(t=o)*za,i=Math.cos(a=(e=a)*za/2+Ea/4),u=Math.sin(a)},ds.lineEnd=function(){n(t,e)}}function ve(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function de(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function me(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function ye(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function xe(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Me(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function be(n){return[Math.atan2(n[1],n[0]),et(n[2])]}function _e(n,t){return ca(n[0]-t[0])<Ta&&ca(n[1]-t[1])<Ta}function we(n,t){n*=za;var e=Math.cos(t*=za);Se(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function Se(n,t,e){++ms,xs+=(n-xs)/ms,Ms+=(t-Ms)/ms,bs+=(e-bs)/ms}function ke(){function n(n,i){n*=za;var u=Math.cos(i*=za),o=u*Math.cos(n),a=u*Math.sin(n),s=Math.sin(i),c=Math.atan2(Math.sqrt((c=e*s-r*a)*c+(c=r*o-t*s)*c+(c=t*a-e*o)*c),t*o+e*a+r*s);ys+=c,_s+=c*(t+(t=o)),ws+=c*(e+(e=a)),Ss+=c*(r+(r=s)),Se(t,e,r)}var t,e,r;Cs.point=function(i,u){i*=za;var o=Math.cos(u*=za);t=o*Math.cos(i),e=o*Math.sin(i),r=Math.sin(u),Cs.point=n,Se(t,e,r)}}function Ae(){Cs.point=we}function Ee(){function n(n,t){n*=za;var e=Math.cos(t*=za),o=e*Math.cos(n),a=e*Math.sin(n),s=Math.sin(t),c=i*s-u*a,l=u*o-r*s,f=r*a-i*o,h=Math.sqrt(c*c+l*l+f*f),g=r*o+i*a+u*s,p=h&&-tt(g)/h,v=Math.atan2(h,g);ks+=p*c,As+=p*l,Es+=p*f,ys+=v,_s+=v*(r+(r=o)),ws+=v*(i+(i=a)),Ss+=v*(u+(u=s)),Se(r,i,u)}var t,e,r,i,u;Cs.point=function(o,a){t=o,e=a,Cs.point=n,o*=za;var s=Math.cos(a*=za);r=s*Math.cos(o),i=s*Math.sin(o),u=Math.sin(a),Se(r,i,u)},Cs.lineEnd=function(){n(t,e),Cs.lineEnd=Ae,Cs.point=we}}function Ce(){return!0}function Ne(n,t,e,r,i){var u=[],o=[];
if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(_e(e,r)){i.lineStart();for(var a=0;t>a;++a)i.point((e=n[a])[0],e[1]);return void i.lineEnd()}var s=new Pe(e,n,null,!0),c=new Pe(e,null,s,!1);s.o=c,u.push(s),o.push(c),s=new Pe(r,n,null,!1),c=new Pe(r,null,s,!0),s.o=c,u.push(s),o.push(c)}}),o.sort(t),Te(u),Te(o),u.length){for(var a=0,s=e,c=o.length;c>a;++a)o[a].e=s=!s;for(var l,f,h=u[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;l=g.z,i.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,c=l.length;c>a;++a)i.point((f=l[a])[0],f[1]);else r(g.x,g.n.x,1,i);g=g.n}else{if(p){l=g.p.z;for(var a=l.length-1;a>=0;--a)i.point((f=l[a])[0],f[1])}else r(g.x,g.p.x,-1,i);g=g.p}g=g.o,l=g.z,p=!p}while(!g.v);i.lineEnd()}}}function Te(n){if(t=n.length){for(var t,e,r=0,i=n[0];++r<t;)i.n=e=n[r],e.p=i,i=e;i.n=e=n[0],e.p=i}}function Pe(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function ze(n,t,e,r){return function(i,u){function o(t,e){var r=i(t,e);n(t=r[0],e=r[1])&&u.point(t,e)}function a(n,t){var e=i(n,t);d.point(e[0],e[1])}function s(){y.point=a,d.lineStart()}function c(){y.point=o,d.lineEnd()}function l(n,t){v.push([n,t]);var e=i(n,t);M.point(e[0],e[1])}function f(){M.lineStart(),v=[]}function h(){l(v[0][0],v[0][1]),M.lineEnd();var n,t=M.clean(),e=x.buffer(),r=e.length;if(v.pop(),p.push(v),v=null,r)if(1&t){n=e[0];var i,r=n.length-1,o=-1;if(r>0){for(b||(u.polygonStart(),b=!0),u.lineStart();++o<r;)u.point((i=n[o])[0],i[1]);u.lineEnd()}}else r>1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Le))}var g,p,v,d=t(u),m=i.invert(r[0],r[1]),y={point:o,lineStart:s,lineEnd:c,polygonStart:function(){y.point=l,y.lineStart=f,y.lineEnd=h,g=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=s,y.lineEnd=c,g=Wo.merge(g);var n=Re(m,p);g.length?(b||(u.polygonStart(),b=!0),Ne(g,De,n,e,u)):n&&(b||(u.polygonStart(),b=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),b&&(u.polygonEnd(),b=!1),g=p=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}},x=qe(),M=t(x),b=!1;return y}}function Le(n){return n.length>1}function qe(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:M,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function De(n,t){return((n=n.x)[0]<0?n[1]-Na-Ta:Na-n[1])-((t=t.x)[0]<0?t[1]-Na-Ta:Na-t[1])}function Re(n,t){var e=n[0],r=n[1],i=[Math.sin(e),-Math.cos(e),0],u=0,o=0;vs.reset();for(var a=0,s=t.length;s>a;++a){var c=t[a],l=c.length;if(l)for(var f=c[0],h=f[0],g=f[1]/2+Ea/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===l&&(d=0),n=c[d];var m=n[0],y=n[1]/2+Ea/4,x=Math.sin(y),M=Math.cos(y),b=m-h,_=b>=0?1:-1,w=_*b,S=w>Ea,k=p*x;if(vs.add(Math.atan2(k*_*Math.sin(w),v*M+k*Math.cos(w))),u+=S?b+_*Ca:b,S^h>=e^m>=e){var A=me(ve(f),ve(n));Me(A);var E=me(i,A);Me(E);var C=(S^b>=0?-1:1)*et(E[2]);(r>C||r===C&&(A[0]||A[1]))&&(o+=S^b>=0?1:-1)}if(!d++)break;h=m,p=x,v=M,f=n}}return(-Ta>u||Ta>u&&0>vs)^1&o}function je(n){var t,e=0/0,r=0/0,i=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(u,o){var a=u>0?Ea:-Ea,s=ca(u-e);ca(s-Ea)<Ta?(n.point(e,r=(r+o)/2>0?Na:-Na),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(u,r),t=0):i!==a&&s>=Ea&&(ca(e-i)<Ta&&(e-=i*Ta),ca(u-a)<Ta&&(u-=a*Ta),r=Ue(e,r,u,o),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=u,r=o),i=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function Ue(n,t,e,r){var i,u,o=Math.sin(n-e);return ca(o)>Ta?Math.atan((Math.sin(t)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*u*o)):(t+r)/2}function Ie(n,t,e,r){var i;if(null==n)i=e*Na,r.point(-Ea,i),r.point(0,i),r.point(Ea,i),r.point(Ea,0),r.point(Ea,-i),r.point(0,-i),r.point(-Ea,-i),r.point(-Ea,0),r.point(-Ea,i);else if(ca(n[0]-t[0])>Ta){var u=n[0]<t[0]?Ea:-Ea;i=e*u/2,r.point(-u,i),r.point(0,i),r.point(u,i)}else r.point(t[0],t[1])}function Fe(n){function t(n,t){return Math.cos(n)*Math.cos(t)>u}function e(n){var e,u,s,c,l;return{lineStart:function(){c=s=!1,l=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:i(f,h):v?i(f+(0>f?Ea:-Ea),h):0;if(!e&&(c=s=v)&&n.lineStart(),v!==s&&(g=r(e,p),(_e(e,g)||_e(p,g))&&(p[0]+=Ta,p[1]+=Ta,v=t(p[0],p[1]))),v!==s)l=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&u||!(m=r(p,e,!0))||(l=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&_e(e,p)||n.point(p[0],p[1]),e=p,s=v,u=d},lineEnd:function(){s&&n.lineEnd(),e=null},clean:function(){return l|(c&&s)<<1}}}function r(n,t,e){var r=ve(n),i=ve(t),o=[1,0,0],a=me(r,i),s=de(a,a),c=a[0],l=s-c*c;if(!l)return!e&&n;var f=u*s/l,h=-u*c/l,g=me(o,a),p=xe(o,f),v=xe(a,h);ye(p,v);var d=g,m=de(p,d),y=de(d,d),x=m*m-y*(de(p,p)-1);if(!(0>x)){var M=Math.sqrt(x),b=xe(d,(-m-M)/y);if(ye(b,p),b=be(b),!e)return b;var _,w=n[0],S=t[0],k=n[1],A=t[1];w>S&&(_=w,w=S,S=_);var E=S-w,C=ca(E-Ea)<Ta,N=C||Ta>E;if(!C&&k>A&&(_=k,k=A,A=_),N?C?k+A>0^b[1]<(ca(b[0]-w)<Ta?k:A):k<=b[1]&&b[1]<=A:E>Ea^(w<=b[0]&&b[0]<=S)){var T=xe(d,(-m+M)/y);return ye(T,p),[b,be(T)]}}}function i(t,e){var r=o?n:Ea-n,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}var u=Math.cos(n),o=u>0,a=ca(u)>Ta,s=pr(n,6*za);return ze(t,e,s,o?[0,-n]:[-Ea,n-Ea])}function He(n,t,e,r){return function(i){var u,o=i.a,a=i.b,s=o.x,c=o.y,l=a.x,f=a.y,h=0,g=1,p=l-s,v=f-c;if(u=n-s,p||!(u>0)){if(u/=p,0>p){if(h>u)return;g>u&&(g=u)}else if(p>0){if(u>g)return;u>h&&(h=u)}if(u=e-s,p||!(0>u)){if(u/=p,0>p){if(u>g)return;u>h&&(h=u)}else if(p>0){if(h>u)return;g>u&&(g=u)}if(u=t-c,v||!(u>0)){if(u/=v,0>v){if(h>u)return;g>u&&(g=u)}else if(v>0){if(u>g)return;u>h&&(h=u)}if(u=r-c,v||!(0>u)){if(u/=v,0>v){if(u>g)return;u>h&&(h=u)}else if(v>0){if(h>u)return;g>u&&(g=u)}return h>0&&(i.a={x:s+h*p,y:c+h*v}),1>g&&(i.b={x:s+g*p,y:c+g*v}),i}}}}}}function Oe(n,t,e,r){function i(r,i){return ca(r[0]-n)<Ta?i>0?0:3:ca(r[0]-e)<Ta?i>0?2:1:ca(r[1]-t)<Ta?i>0?1:0:i>0?3:2}function u(n,t){return o(n.x,t.x)}function o(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function s(n){for(var t=0,e=d.length,r=n[1],i=0;e>i;++i)for(var u,o=1,a=d[i],s=a.length,c=a[0];s>o;++o)u=a[o],c[1]<=r?u[1]>r&&nt(c,u,n)>0&&++t:u[1]<=r&&nt(c,u,n)<0&&--t,c=u;return 0!==t}function c(u,a,s,c){var l=0,f=0;if(null==u||(l=i(u,s))!==(f=i(a,s))||o(u,a)<0^s>0){do c.point(0===l||3===l?n:e,l>1?r:t);while((l=(l+s+4)%4)!==f)}else c.point(a[0],a[1])}function l(i,u){return i>=n&&e>=i&&u>=t&&r>=u}function f(n,t){l(n,t)&&a.point(n,t)}function h(){N.point=p,d&&d.push(m=[]),S=!0,w=!1,b=_=0/0}function g(){v&&(p(y,x),M&&w&&E.rejoin(),v.push(E.buffer())),N.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Ts,Math.min(Ts,n)),t=Math.max(-Ts,Math.min(Ts,t));var e=l(n,t);if(d&&m.push([n,t]),S)y=n,x=t,M=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:b,y:_},b:{x:n,y:t}};C(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}b=n,_=t,w=e}var v,d,m,y,x,M,b,_,w,S,k,A=a,E=qe(),C=He(n,t,e,r),N={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=E,v=[],d=[],k=!0},polygonEnd:function(){a=A,v=Wo.merge(v);var t=s([n,r]),e=k&&t,i=v.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),c(null,null,1,a),a.lineEnd()),i&&Ne(v,u,t,c,a),a.polygonEnd()),v=d=m=null}};return N}}function Ye(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function Ze(n){var t=0,e=Ea/3,r=or(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Ea/180,e=n[1]*Ea/180):[t/Ea*180,e/Ea*180]},i}function Xe(n,t){function e(n,t){var e=Math.sqrt(u-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),o-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),o=Math.sqrt(u)/i;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/i,et((u-(n*n+e*e)*i*i)/(2*i))]},e}function Ve(){function n(n,t){zs+=i*n-r*t,r=n,i=t}var t,e,r,i;js.point=function(u,o){js.point=n,t=r=u,e=i=o},js.lineEnd=function(){n(t,e)}}function Be(n,t){Ls>n&&(Ls=n),n>Ds&&(Ds=n),qs>t&&(qs=t),t>Rs&&(Rs=t)}function $e(){function n(n,t){o.push("M",n,",",t,u)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function i(){o.push("Z")}var u=We(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return u=We(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function We(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Je(n,t){xs+=n,Ms+=t,++bs}function Qe(){function n(n,r){var i=n-t,u=r-e,o=Math.sqrt(i*i+u*u);_s+=o*(t+n)/2,ws+=o*(e+r)/2,Ss+=o,Je(t=n,e=r)}var t,e;Is.point=function(r,i){Is.point=n,Je(t=r,e=i)}}function Ge(){Is.point=Je}function Ke(){function n(n,t){var e=n-r,u=t-i,o=Math.sqrt(e*e+u*u);_s+=o*(r+n)/2,ws+=o*(i+t)/2,Ss+=o,o=i*n-r*t,ks+=o*(r+n),As+=o*(i+t),Es+=3*o,Je(r=n,i=t)}var t,e,r,i;Is.point=function(u,o){Is.point=n,Je(t=r=u,e=i=o)},Is.lineEnd=function(){n(t,e)}}function nr(n){function t(t,e){n.moveTo(t,e),n.arc(t,e,o,0,Ca)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function u(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return o=n,a},result:M};return a}function tr(n){function t(n){return(a?r:e)(n)}function e(t){return ir(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=0/0,S.point=u,t.lineStart()}function u(e,r){var u=ve([e,r]),o=n(e,r);i(x,M,y,b,_,w,x=o[0],M=o[1],y=e,b=u[0],_=u[1],w=u[2],a,t),t.point(x,M)}function o(){S.point=e,t.lineEnd()}function s(){r(),S.point=c,S.lineEnd=l}function c(n,t){u(f=n,h=t),g=x,p=M,v=b,d=_,m=w,S.point=u}function l(){i(x,M,y,b,_,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,x,M,b,_,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=s},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function i(t,e,r,a,s,c,l,f,h,g,p,v,d,m){var y=l-t,x=f-e,M=y*y+x*x;if(M>4*u&&d--){var b=a+g,_=s+p,w=c+v,S=Math.sqrt(b*b+_*_+w*w),k=Math.asin(w/=S),A=ca(ca(w)-1)<Ta||ca(r-h)<Ta?(r+h)/2:Math.atan2(_,b),E=n(A,k),C=E[0],N=E[1],T=C-t,P=N-e,z=x*T-y*P;(z*z/M>u||ca((y*T+x*P)/M-.5)>.3||o>a*g+s*p+c*v)&&(i(t,e,r,a,s,c,C,N,A,b/=S,_/=S,w,d,m),m.point(C,N),i(C,N,A,b,_,w,l,f,h,g,p,v,d,m))}}var u=.5,o=Math.cos(30*za),a=16;return t.precision=function(n){return arguments.length?(a=(u=n*n)>0&&16,t):Math.sqrt(u)},t}function er(n){var t=tr(function(t,e){return n([t*La,e*La])});return function(n){return ar(t(n))}}function rr(n){this.stream=n}function ir(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function ur(n){return or(function(){return n})()}function or(n){function t(n){return n=a(n[0]*za,n[1]*za),[n[0]*h+s,c-n[1]*h]}function e(n){return n=a.invert((n[0]-s)/h,(c-n[1])/h),n&&[n[0]*La,n[1]*La]}function r(){a=Ye(o=lr(m,y,x),u);var n=u(v,d);return s=g-n[0]*h,c=p+n[1]*h,i()}function i(){return l&&(l.valid=!1,l=null),t}var u,o,a,s,c,l,f=tr(function(n,t){return n=u(n,t),[n[0]*h+s,c-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,x=0,M=Ns,b=Ct,_=null,w=null;return t.stream=function(n){return l&&(l.valid=!1),l=ar(M(o,f(b(n)))),l.valid=!0,l},t.clipAngle=function(n){return arguments.length?(M=null==n?(_=n,Ns):Fe((_=+n)*za),i()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=n?Oe(n[0][0],n[0][1],n[1][0],n[1][1]):Ct,i()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*za,d=n[1]%360*za,r()):[v*La,d*La]},t.rotate=function(n){return arguments.length?(m=n[0]%360*za,y=n[1]%360*za,x=n.length>2?n[2]%360*za:0,r()):[m*La,y*La,x*La]},Wo.rebind(t,f,"precision"),function(){return u=n.apply(this,arguments),t.invert=u.invert&&e,r()}}function ar(n){return ir(n,function(t,e){n.point(t*za,e*za)})}function sr(n,t){return[n,t]}function cr(n,t){return[n>Ea?n-Ca:-Ea>n?n+Ca:n,t]}function lr(n,t,e){return n?t||e?Ye(hr(n),gr(t,e)):hr(n):t||e?gr(t,e):cr}function fr(n){return function(t,e){return t+=n,[t>Ea?t-Ca:-Ea>t?t+Ca:t,e]}}function hr(n){var t=fr(n);return t.invert=fr(-n),t}function gr(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,s=Math.sin(n)*e,c=Math.sin(t),l=c*r+a*i;return[Math.atan2(s*u-l*o,a*r-c*i),et(l*u+s*o)]}var r=Math.cos(n),i=Math.sin(n),u=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,s=Math.sin(n)*e,c=Math.sin(t),l=c*u-s*o;return[Math.atan2(s*u+c*o,a*r+l*i),et(l*r-a*i)]},e}function pr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,u,o,a){var s=o*t;null!=i?(i=vr(e,i),u=vr(e,u),(o>0?u>i:i>u)&&(i+=o*Ca)):(i=n+o*Ca,u=n-.5*s);for(var c,l=i;o>0?l>u:u>l;l-=s)a.point((c=be([e,-r*Math.cos(l),-r*Math.sin(l)]))[0],c[1])}}function vr(n,t){var e=ve(t);e[0]-=n,Me(e);var r=tt(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Ta)%(2*Math.PI)}function dr(n,t,e){var r=Wo.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function mr(n,t,e){var r=Wo.range(n,t-Ta,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function yr(n){return n.source}function xr(n){return n.target}function Mr(n,t,e,r){var i=Math.cos(t),u=Math.sin(t),o=Math.cos(r),a=Math.sin(r),s=i*Math.cos(n),c=i*Math.sin(n),l=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(ot(r-t)+i*o*ot(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*s+t*l,i=e*c+t*f,o=e*u+t*a;return[Math.atan2(i,r)*La,Math.atan2(o,Math.sqrt(r*r+i*i))*La]}:function(){return[n*La,t*La]};return p.distance=h,p}function br(){function n(n,i){var u=Math.sin(i*=za),o=Math.cos(i),a=ca((n*=za)-t),s=Math.cos(a);Fs+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*u-e*o*s)*a),e*u+r*o*s),t=n,e=u,r=o}var t,e,r;Hs.point=function(i,u){t=i*za,e=Math.sin(u*=za),r=Math.cos(u),Hs.point=n},Hs.lineEnd=function(){Hs.point=Hs.lineEnd=M}}function _r(n,t){function e(t,e){var r=Math.cos(t),i=Math.cos(e),u=n(r*i);return[u*i*Math.sin(t),u*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),i=t(r),u=Math.sin(i),o=Math.cos(i);return[Math.atan2(n*u,r*o),Math.asin(r&&e*u/r)]},e}function wr(n,t){function e(n,t){o>0?-Na+Ta>t&&(t=-Na+Ta):t>Na-Ta&&(t=Na-Ta);var e=o/Math.pow(i(t),u);return[e*Math.sin(u*n),o-e*Math.cos(u*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Ea/4+n/2)},u=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),o=r*Math.pow(i(n),u)/u;return u?(e.invert=function(n,t){var e=o-t,r=K(u)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/u,2*Math.atan(Math.pow(o/r,1/u))-Na]},e):kr}function Sr(n,t){function e(n,t){var e=u-t;return[e*Math.sin(i*n),u-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),u=r/i+n;return ca(i)<Ta?sr:(e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,u-K(i)*Math.sqrt(n*n+e*e)]},e)}function kr(n,t){return[n,Math.log(Math.tan(Ea/4+t/2))]}function Ar(n){var t,e=ur(n),r=e.scale,i=e.translate,u=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=i.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=u.apply(e,arguments);if(o===e){if(t=null==n){var a=Ea*r(),s=i();u([[s[0]-a,s[1]-a],[s[0]+a,s[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function Er(n,t){return[Math.log(Math.tan(Ea/4+t/2)),-n]}function Cr(n){return n[0]}function Nr(n){return n[1]}function Tr(n){for(var t=n.length,e=[0,1],r=2,i=2;t>i;i++){for(;r>1&&nt(n[e[r-2]],n[e[r-1]],n[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function Pr(n,t){return n[0]-t[0]||n[1]-t[1]}function zr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Lr(n,t,e,r){var i=n[0],u=e[0],o=t[0]-i,a=r[0]-u,s=n[1],c=e[1],l=t[1]-s,f=r[1]-c,h=(a*(s-c)-f*(i-u))/(f*o-a*l);return[i+h*o,s+h*l]}function qr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Dr(){ei(this),this.edge=this.site=this.circle=null}function Rr(n){var t=Ks.pop()||new Dr;return t.site=n,t}function jr(n){Br(n),Js.remove(n),Ks.push(n),ei(n)}function Ur(n){var t=n.circle,e=t.x,r=t.cy,i={x:e,y:r},u=n.P,o=n.N,a=[n];jr(n);for(var s=u;s.circle&&ca(e-s.circle.x)<Ta&&ca(r-s.circle.cy)<Ta;)u=s.P,a.unshift(s),jr(s),s=u;a.unshift(s),Br(s);for(var c=o;c.circle&&ca(e-c.circle.x)<Ta&&ca(r-c.circle.cy)<Ta;)o=c.N,a.push(c),jr(c),c=o;a.push(c),Br(c);var l,f=a.length;for(l=1;f>l;++l)c=a[l],s=a[l-1],Kr(c.edge,s.site,c.site,i);s=a[0],c=a[f-1],c.edge=Qr(s.site,c.site,null,i),Vr(s),Vr(c)}function Ir(n){for(var t,e,r,i,u=n.x,o=n.y,a=Js._;a;)if(r=Fr(a,o)-u,r>Ta)a=a.L;else{if(i=u-Hr(a,o),!(i>Ta)){r>-Ta?(t=a.P,e=a):i>-Ta?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var s=Rr(n);if(Js.insert(t,s),t||e){if(t===e)return Br(t),e=Rr(t.site),Js.insert(s,e),s.edge=e.edge=Qr(t.site,s.site),Vr(t),void Vr(e);if(!e)return void(s.edge=Qr(t.site,s.site));Br(t),Br(e);var c=t.site,l=c.x,f=c.y,h=n.x-l,g=n.y-f,p=e.site,v=p.x-l,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,x=v*v+d*d,M={x:(d*y-g*x)/m+l,y:(h*x-v*y)/m+f};Kr(e.edge,c,p,M),s.edge=Qr(c,n,null,M),e.edge=Qr(n,p,null,M),Vr(t),Vr(e)}}function Fr(n,t){var e=n.site,r=e.x,i=e.y,u=i-t;if(!u)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,s=e.y,c=s-t;if(!c)return a;var l=a-r,f=1/u-1/c,h=l/c;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*c)-s+c/2+i-u/2)))/f+r:(r+a)/2}function Hr(n,t){var e=n.N;if(e)return Fr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Or(n){this.site=n,this.edges=[]}function Yr(n){for(var t,e,r,i,u,o,a,s,c,l,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=Ws,d=v.length;d--;)if(u=v[d],u&&u.prepare())for(a=u.edges,s=a.length,o=0;s>o;)l=a[o].end(),r=l.x,i=l.y,c=a[++o%s].start(),t=c.x,e=c.y,(ca(r-t)>Ta||ca(i-e)>Ta)&&(a.splice(o,0,new ni(Gr(u.site,l,ca(r-f)<Ta&&p-i>Ta?{x:f,y:ca(t-f)<Ta?e:p}:ca(i-p)<Ta&&h-r>Ta?{x:ca(e-p)<Ta?t:h,y:p}:ca(r-h)<Ta&&i-g>Ta?{x:h,y:ca(t-h)<Ta?e:g}:ca(i-g)<Ta&&r-f>Ta?{x:ca(e-g)<Ta?t:f,y:g}:null),u.site,null)),++s)}function Zr(n,t){return t.angle-n.angle}function Xr(){ei(this),this.x=this.y=this.arc=this.site=this.cy=null}function Vr(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,i=n.site,u=e.site;if(r!==u){var o=i.x,a=i.y,s=r.x-o,c=r.y-a,l=u.x-o,f=u.y-a,h=2*(s*f-c*l);if(!(h>=-Pa)){var g=s*s+c*c,p=l*l+f*f,v=(f*g-c*p)/h,d=(s*p-l*g)/h,f=d+a,m=nc.pop()||new Xr;m.arc=n,m.site=i,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,x=Gs._;x;)if(m.y<x.y||m.y===x.y&&m.x<=x.x){if(!x.L){y=x.P;break}x=x.L}else{if(!x.R){y=x;break}x=x.R}Gs.insert(y,m),y||(Qs=m)}}}}function Br(n){var t=n.circle;t&&(t.P||(Qs=t.N),Gs.remove(t),nc.push(t),ei(t),n.circle=null)}function $r(n){for(var t,e=$s,r=He(n[0][0],n[0][1],n[1][0],n[1][1]),i=e.length;i--;)t=e[i],(!Wr(t,n)||!r(t)||ca(t.a.x-t.b.x)<Ta&&ca(t.a.y-t.b.y)<Ta)&&(t.a=t.b=null,e.splice(i,1))}function Wr(n,t){var e=n.b;if(e)return!0;var r,i,u=n.a,o=t[0][0],a=t[1][0],s=t[0][1],c=t[1][1],l=n.l,f=n.r,h=l.x,g=l.y,p=f.x,v=f.y,d=(h+p)/2,m=(g+v)/2;if(v===g){if(o>d||d>=a)return;if(h>p){if(u){if(u.y>=c)return}else u={x:d,y:s};e={x:d,y:c}}else{if(u){if(u.y<s)return}else u={x:d,y:c};e={x:d,y:s}}}else if(r=(h-p)/(v-g),i=m-r*d,-1>r||r>1)if(h>p){if(u){if(u.y>=c)return}else u={x:(s-i)/r,y:s};e={x:(c-i)/r,y:c}}else{if(u){if(u.y<s)return}else u={x:(c-i)/r,y:c};e={x:(s-i)/r,y:s}}else if(v>g){if(u){if(u.x>=a)return}else u={x:o,y:r*o+i};e={x:a,y:r*a+i}}else{if(u){if(u.x<o)return}else u={x:a,y:r*a+i};e={x:o,y:r*o+i}}return n.a=u,n.b=e,!0}function Jr(n,t){this.l=n,this.r=t,this.a=this.b=null}function Qr(n,t,e,r){var i=new Jr(n,t);return $s.push(i),e&&Kr(i,n,t,e),r&&Kr(i,t,n,r),Ws[n.i].edges.push(new ni(i,n,t)),Ws[t.i].edges.push(new ni(i,t,n)),i}function Gr(n,t,e){var r=new Jr(n,null);return r.a=t,r.b=e,$s.push(r),r}function Kr(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function ni(n,t,e){var r=n.a,i=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function ti(){this._=null}function ei(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function ri(n,t){var e=t,r=t.R,i=e.U;i?i.L===e?i.L=r:i.R=r:n._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function ii(n,t){var e=t,r=t.L,i=e.U;i?i.L===e?i.L=r:i.R=r:n._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function ui(n){for(;n.L;)n=n.L;return n}function oi(n,t){var e,r,i,u=n.sort(ai).pop();for($s=[],Ws=new Array(n.length),Js=new ti,Gs=new ti;;)if(i=Qs,u&&(!i||u.y<i.y||u.y===i.y&&u.x<i.x))(u.x!==e||u.y!==r)&&(Ws[u.i]=new Or(u),Ir(u),e=u.x,r=u.y),u=n.pop();else{if(!i)break;Ur(i.arc)}t&&($r(t),Yr(t));var o={cells:Ws,edges:$s};return Js=Gs=$s=Ws=null,o}function ai(n,t){return t.y-n.y||t.x-n.x}function si(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function ci(n){return n.x}function li(n){return n.y}function fi(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function hi(n,t,e,r,i,u){if(!n(t,e,r,i,u)){var o=.5*(e+i),a=.5*(r+u),s=t.nodes;s[0]&&hi(n,s[0],e,r,o,a),s[1]&&hi(n,s[1],o,r,i,a),s[2]&&hi(n,s[2],e,a,o,u),s[3]&&hi(n,s[3],o,a,i,u)}}function gi(n,t){n=Wo.rgb(n),t=Wo.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,o=t.g-r,a=t.b-i;return function(n){return"#"+bt(Math.round(e+u*n))+bt(Math.round(r+o*n))+bt(Math.round(i+a*n))}}function pi(n,t){var e,r={},i={};for(e in n)e in t?r[e]=mi(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function vi(n,t){return t-=n=+n,function(e){return n+t*e}}function di(n,t){var e,r,i,u=ec.lastIndex=rc.lastIndex=0,o=-1,a=[],s=[];for(n+="",t+="";(e=ec.exec(n))&&(r=rc.exec(t));)(i=r.index)>u&&(i=t.substring(u,i),a[o]?a[o]+=i:a[++o]=i),(e=e[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,s.push({i:o,x:vi(e,r)})),u=rc.lastIndex;return u<t.length&&(i=t.substring(u),a[o]?a[o]+=i:a[++o]=i),a.length<2?s[0]?(t=s[0].x,function(n){return t(n)+""}):function(){return t}:(t=s.length,function(n){for(var e,r=0;t>r;++r)a[(e=s[r]).i]=e.x(n);return a.join("")})}function mi(n,t){for(var e,r=Wo.interpolators.length;--r>=0&&!(e=Wo.interpolators[r](n,t)););return e}function yi(n,t){var e,r=[],i=[],u=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(mi(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;o>e;++e)i[e]=t[e];return function(n){for(e=0;a>e;++e)i[e]=r[e](n);return i}}function xi(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function Mi(n){return function(t){return 1-n(1-t)}}function bi(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function _i(n){return n*n}function wi(n){return n*n*n}function Si(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function ki(n){return function(t){return Math.pow(t,n)}}function Ai(n){return 1-Math.cos(n*Na)}function Ei(n){return Math.pow(2,10*(n-1))}function Ci(n){return 1-Math.sqrt(1-n*n)}function Ni(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/Ca*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*Ca/t)}}function Ti(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Pi(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function zi(n,t){n=Wo.hcl(n),t=Wo.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,o=t.c-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return ft(e+u*n,r+o*n,i+a*n)+""}}function Li(n,t){n=Wo.hsl(n),t=Wo.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,o=t.s-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return ct(e+u*n,r+o*n,i+a*n)+""}}function qi(n,t){n=Wo.lab(n),t=Wo.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,o=t.a-r,a=t.b-i;return function(n){return gt(e+u*n,r+o*n,i+a*n)+""}}function Di(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Ri(n){var t=[n.a,n.b],e=[n.c,n.d],r=Ui(t),i=ji(t,e),u=Ui(Ii(e,t,-i))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*La,this.translate=[n.e,n.f],this.scale=[r,u],this.skew=u?Math.atan2(i,u)*La:0}function ji(n,t){return n[0]*t[0]+n[1]*t[1]}function Ui(n){var t=Math.sqrt(ji(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Ii(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Fi(n,t){var e,r=[],i=[],u=Wo.transform(n),o=Wo.transform(t),a=u.translate,s=o.translate,c=u.rotate,l=o.rotate,f=u.skew,h=o.skew,g=u.scale,p=o.scale;return a[0]!=s[0]||a[1]!=s[1]?(r.push("translate(",null,",",null,")"),i.push({i:1,x:vi(a[0],s[0])},{i:3,x:vi(a[1],s[1])})):r.push(s[0]||s[1]?"translate("+s+")":""),c!=l?(c-l>180?l+=360:l-c>180&&(c+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:vi(c,l)})):l&&r.push(r.pop()+"rotate("+l+")"),f!=h?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:vi(f,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:vi(g[0],p[0])},{i:e-2,x:vi(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=i.length,function(n){for(var t,u=-1;++u<e;)r[(t=i[u]).i]=t.x(n);return r.join("")}}function Hi(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return(e-n)*t}}function Oi(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return Math.max(0,Math.min(1,(e-n)*t))}}function Yi(n){for(var t=n.source,e=n.target,r=Xi(t,e),i=[t];t!==r;)t=t.parent,i.push(t);for(var u=i.length;e!==r;)i.splice(u,0,e),e=e.parent;return i}function Zi(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Xi(n,t){if(n===t)return n;for(var e=Zi(n),r=Zi(t),i=e.pop(),u=r.pop(),o=null;i===u;)o=i,i=e.pop(),u=r.pop();return o}function Vi(n){n.fixed|=2}function Bi(n){n.fixed&=-7}function $i(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Wi(n){n.fixed&=-5}function Ji(n,t,e){var r=0,i=0;if(n.charge=0,!n.leaf)for(var u,o=n.nodes,a=o.length,s=-1;++s<a;)u=o[s],null!=u&&(Ji(u,t,e),n.charge+=u.charge,r+=u.charge*u.cx,i+=u.charge*u.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var c=t*e[n.point.index];n.charge+=n.pointCharge=c,r+=c*n.point.x,i+=c*n.point.y}n.cx=r/n.charge,n.cy=i/n.charge}function Qi(n,t){return Wo.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=ru,n}function Gi(n,t){for(var e=[n];null!=(n=e.pop());)if(t(n),(i=n.children)&&(r=i.length))for(var r,i;--r>=0;)e.push(i[r])}function Ki(n,t){for(var e=[n],r=[];null!=(n=e.pop());)if(r.push(n),(u=n.children)&&(i=u.length))for(var i,u,o=-1;++o<i;)e.push(u[o]);for(;null!=(n=r.pop());)t(n)}function nu(n){return n.children}function tu(n){return n.value}function eu(n,t){return t.value-n.value}function ru(n){return Wo.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function iu(n){return n.x}function uu(n){return n.y}function ou(n,t,e){n.y0=t,n.y=e}function au(n){return Wo.range(n.length)}function su(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function cu(n){for(var t,e=1,r=0,i=n[0][1],u=n.length;u>e;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function lu(n){return n.reduce(fu,0)}function fu(n,t){return n+t[1]}function hu(n,t){return gu(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function gu(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];++e<=t;)u[e]=i*e+r;return u}function pu(n){return[Wo.min(n),Wo.max(n)]}function vu(n,t){return n.value-t.value}function du(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function mu(n,t){n._pack_next=t,t._pack_prev=n}function yu(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function xu(n){function t(n){l=Math.min(n.x-n.r,l),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(c=e.length)){var e,r,i,u,o,a,s,c,l=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(Mu),r=e[0],r.x=-r.r,r.y=0,t(r),c>1&&(i=e[1],i.x=i.r,i.y=0,t(i),c>2))for(u=e[2],wu(r,i,u),t(u),du(r,u),r._pack_prev=u,du(u,i),i=r._pack_next,o=3;c>o;o++){wu(r,i,u=e[o]);var p=0,v=1,d=1;for(a=i._pack_next;a!==i;a=a._pack_next,v++)if(yu(a,u)){p=1;break}if(1==p)for(s=r._pack_prev;s!==a._pack_prev&&!yu(s,u);s=s._pack_prev,d++);p?(d>v||v==d&&i.r<r.r?mu(r,i=a):mu(r=s,i),o--):(du(r,u),i=u,t(u))}var m=(l+f)/2,y=(h+g)/2,x=0;for(o=0;c>o;o++)u=e[o],u.x-=m,u.y-=y,x=Math.max(x,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=x,e.forEach(bu)}}function Mu(n){n._pack_next=n._pack_prev=n}function bu(n){delete n._pack_next,delete n._pack_prev}function _u(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,o=i.length;++u<o;)_u(i[u],t,e,r)}function wu(n,t,e){var r=n.r+e.r,i=t.x-n.x,u=t.y-n.y;if(r&&(i||u)){var o=t.r+e.r,a=i*i+u*u;o*=o,r*=r;var s=.5+(r-o)/(2*a),c=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+s*i+c*u,e.y=n.y+s*u-c*i}else e.x=n.x+r,e.y=n.y}function Su(n,t){return n.parent==t.parent?1:2}function ku(n){var t=n.children;return t.length?t[0]:n.t}function Au(n){var t,e=n.children;return(t=e.length)?e[t-1]:n.t}function Eu(n,t,e){var r=e/(t.i-n.i);t.c-=r,t.s+=e,n.c+=r,t.z+=e,t.m+=e}function Cu(n){for(var t,e=0,r=0,i=n.children,u=i.length;--u>=0;)t=i[u],t.z+=e,t.m+=e,e+=t.s+(r+=t.c)}function Nu(n,t,e){return n.a.parent===t.parent?n.a:e}function Tu(n){return 1+Wo.max(n,function(n){return n.y})}function Pu(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function zu(n){var t=n.children;return t&&t.length?zu(t[0]):n}function Lu(n){var t,e=n.children;return e&&(t=e.length)?Lu(e[t-1]):n}function qu(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Du(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],u=n.dy-t[0]-t[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 Ru(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function ju(n){return n.rangeExtent?n.rangeExtent():Ru(n.range())}function Uu(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Iu(n,t){var e,r=0,i=n.length-1,u=n[r],o=n[i];return u>o&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function Fu(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:pc}function Hu(n,t,e,r){var i=[],u=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)i.push(e(n[o-1],n[o])),u.push(r(t[o-1],t[o]));return function(t){var e=Wo.bisect(n,t,1,a)-1;return u[e](i[e](t))}}function Ou(n,t,e,r){function i(){var i=Math.min(n.length,t.length)>2?Hu:Uu,s=r?Oi:Hi;return o=i(n,t,s,e),a=i(t,n,s,mi),u}function u(n){return o(n)}var o,a;return u.invert=function(n){return a(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Di)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return Vu(n,t)},u.tickFormat=function(t,e){return Bu(n,t,e)},u.nice=function(t){return Zu(n,t),i()},u.copy=function(){return Ou(n,t,e,r)},i()}function Yu(n,t){return Wo.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Zu(n,t){return Iu(n,Fu(Xu(n,t)[2]))}function Xu(n,t){null==t&&(t=10);var e=Ru(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/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 Vu(n,t){return Wo.range.apply(Wo,Xu(n,t))}function Bu(n,t,e){var r=Xu(n,t);if(e){var i=es.exec(e);if(i.shift(),"s"===i[8]){var u=Wo.formatPrefix(Math.max(ca(r[0]),ca(r[1])));
return i[7]||(i[7]="."+$u(u.scale(r[2]))),i[8]="f",e=Wo.format(i.join("")),function(n){return e(u.scale(n))+u.symbol}}i[7]||(i[7]="."+Wu(i[8],r)),e=i.join("")}else e=",."+$u(r[2])+"f";return Wo.format(e)}function $u(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Wu(n,t){var e=$u(t[2]);return n in vc?Math.abs(e-$u(Math.max(ca(t[0]),ca(t[1]))))+ +("e"!==n):e-2*("%"===n)}function Ju(n,t,e,r){function i(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function u(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(i(t))}return o.invert=function(t){return u(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),o):t},o.nice=function(){var t=Iu(r.map(i),e?Math:mc);return n.domain(t),r=t.map(u),o},o.ticks=function(){var n=Ru(r),o=[],a=n[0],s=n[1],c=Math.floor(i(a)),l=Math.ceil(i(s)),f=t%1?2:t;if(isFinite(l-c)){if(e){for(;l>c;c++)for(var h=1;f>h;h++)o.push(u(c)*h);o.push(u(c))}else for(o.push(u(c));c++<l;)for(var h=f-1;h>0;h--)o.push(u(c)*h);for(c=0;o[c]<a;c++);for(l=o.length;o[l-1]>s;l--);o=o.slice(c,l)}return o},o.tickFormat=function(n,t){if(!arguments.length)return dc;arguments.length<2?t=dc:"function"!=typeof t&&(t=Wo.format(t));var r,a=Math.max(.1,n/o.ticks().length),s=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/u(s(i(n)+r))<=a?t(n):""}},o.copy=function(){return Ju(n.copy(),t,e,r)},Yu(o,n)}function Qu(n,t,e){function r(t){return n(i(t))}var i=Gu(t),u=Gu(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return Vu(e,n)},r.tickFormat=function(n,t){return Bu(e,n,t)},r.nice=function(n){return r.domain(Zu(e,n))},r.exponent=function(o){return arguments.length?(i=Gu(t=o),u=Gu(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return Qu(n.copy(),t,e)},Yu(r,n)}function Gu(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Ku(n,t){function e(e){return u[((i.get(e)||("range"===t.t?i.set(e,n.push(e)):0/0))-1)%u.length]}function r(t,e){return Wo.range(n.length).map(function(n){return t+e*n})}var i,u,o;return e.domain=function(r){if(!arguments.length)return n;n=[],i=new f;for(var u,o=-1,a=r.length;++o<a;)i.has(u=r[o])||i.set(u,n.push(u));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(u=n,o=0,t={t:"range",a:arguments},e):u},e.rangePoints=function(i,a){arguments.length<2&&(a=0);var s=i[0],c=i[1],l=(c-s)/(Math.max(1,n.length-1)+a);return u=r(n.length<2?(s+c)/2:s+l*a/2,l),o=0,t={t:"rangePoints",a:arguments},e},e.rangeBands=function(i,a,s){arguments.length<2&&(a=0),arguments.length<3&&(s=a);var c=i[1]<i[0],l=i[c-0],f=i[1-c],h=(f-l)/(n.length-a+2*s);return u=r(l+h*s,h),c&&u.reverse(),o=h*(1-a),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(i,a,s){arguments.length<2&&(a=0),arguments.length<3&&(s=a);var c=i[1]<i[0],l=i[c-0],f=i[1-c],h=Math.floor((f-l)/(n.length-a+2*s)),g=f-l-(n.length-a)*h;return u=r(l+Math.round(g/2),h),c&&u.reverse(),o=Math.round(h*(1-a)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return o},e.rangeExtent=function(){return Ru(t.a[0])},e.copy=function(){return Ku(n,t)},e.domain(n)}function no(n,t){function e(){var e=0,u=t.length;for(i=[];++e<u;)i[e-1]=Wo.quantile(n,e/u);return r}function r(n){return isNaN(n=+n)?void 0:t[Wo.bisect(i,n)]}var i;return r.domain=function(t){return arguments.length?(n=t.filter(o).sort(u),e()):n},r.range=function(n){return arguments.length?(t=n,e()):t},r.quantiles=function(){return i},r.invertExtent=function(e){return e=t.indexOf(e),0>e?[0/0,0/0]:[e>0?i[e-1]:n[0],e<i.length?i[e]:n[n.length-1]]},r.copy=function(){return no(n,t)},e()}function to(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(u*(t-n))))]}function i(){return u=e.length/(t-n),o=e.length-1,r}var u,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],i()):[n,t]},r.range=function(n){return arguments.length?(e=n,i()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/u+n,[t,t+1/u]},r.copy=function(){return to(n,t,e)},i()}function eo(n,t){function e(e){return e>=e?t[Wo.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return eo(n,t)},e}function ro(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Vu(n,t)},t.tickFormat=function(t,e){return Bu(n,t,e)},t.copy=function(){return ro(n)},t}function io(n){return n.innerRadius}function uo(n){return n.outerRadius}function oo(n){return n.startAngle}function ao(n){return n.endAngle}function so(n){function t(t){function o(){c.push("M",u(n(l),a))}for(var s,c=[],l=[],f=-1,h=t.length,g=Et(e),p=Et(r);++f<h;)i.call(this,s=t[f],f)?l.push([+g.call(this,s,f),+p.call(this,s,f)]):l.length&&(o(),l=[]);return l.length&&o(),c.length?c.join(""):null}var e=Cr,r=Nr,i=Ce,u=co,o=u.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(i=n,t):i},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?u=n:(u=Sc.get(n)||co).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function co(n){return n.join("L")}function lo(n){return co(n)+"Z"}function fo(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&i.push("H",r[0]),i.join("")}function ho(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("V",(r=n[t])[1],"H",r[0]);return i.join("")}function go(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];++t<e;)i.push("H",(r=n[t])[0],"V",r[1]);return i.join("")}function po(n,t){return n.length<4?co(n):n[1]+yo(n.slice(1,n.length-1),xo(n,t))}function vo(n,t){return n.length<3?co(n):n[0]+yo((n.push(n[0]),n),xo([n[n.length-2]].concat(n,[n[1]]),t))}function mo(n,t){return n.length<3?co(n):n[0]+yo(n,xo(n,t))}function yo(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return co(n);var e=n.length!=t.length,r="",i=n[0],u=n[1],o=t[0],a=o,s=1;if(e&&(r+="Q"+(u[0]-2*o[0]/3)+","+(u[1]-2*o[1]/3)+","+u[0]+","+u[1],i=n[1],s=2),t.length>1){a=t[1],u=n[s],s++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1];for(var c=2;c<t.length;c++,s++)u=n[s],a=t[c],r+="S"+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1]}if(e){var l=n[s];r+="Q"+(u[0]+2*a[0]/3)+","+(u[1]+2*a[1]/3)+","+l[0]+","+l[1]}return r}function xo(n,t){for(var e,r=[],i=(1-t)/2,u=n[0],o=n[1],a=1,s=n.length;++a<s;)e=u,u=o,o=n[a],r.push([i*(o[0]-e[0]),i*(o[1]-e[1])]);return r}function Mo(n){if(n.length<3)return co(n);var t=1,e=n.length,r=n[0],i=r[0],u=r[1],o=[i,i,i,(r=n[1])[0]],a=[u,u,u,r[1]],s=[i,",",u,"L",So(Ec,o),",",So(Ec,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),ko(s,o,a);return n.pop(),s.push("L",r),s.join("")}function bo(n){if(n.length<4)return co(n);for(var t,e=[],r=-1,i=n.length,u=[0],o=[0];++r<3;)t=n[r],u.push(t[0]),o.push(t[1]);for(e.push(So(Ec,u)+","+So(Ec,o)),--r;++r<i;)t=n[r],u.shift(),u.push(t[0]),o.shift(),o.push(t[1]),ko(e,u,o);return e.join("")}function _o(n){for(var t,e,r=-1,i=n.length,u=i+4,o=[],a=[];++r<4;)e=n[r%i],o.push(e[0]),a.push(e[1]);for(t=[So(Ec,o),",",So(Ec,a)],--r;++r<u;)e=n[r%i],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),ko(t,o,a);return t.join("")}function wo(n,t){var e=n.length-1;if(e)for(var r,i,u=n[0][0],o=n[0][1],a=n[e][0]-u,s=n[e][1]-o,c=-1;++c<=e;)r=n[c],i=c/e,r[0]=t*r[0]+(1-t)*(u+i*a),r[1]=t*r[1]+(1-t)*(o+i*s);return Mo(n)}function So(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function ko(n,t,e){n.push("C",So(kc,t),",",So(kc,e),",",So(Ac,t),",",So(Ac,e),",",So(Ec,t),",",So(Ec,e))}function Ao(n,t){return(t[1]-n[1])/(t[0]-n[0])}function Eo(n){for(var t=0,e=n.length-1,r=[],i=n[0],u=n[1],o=r[0]=Ao(i,u);++t<e;)r[t]=(o+(o=Ao(i=u,u=n[t+1])))/2;return r[t]=o,r}function Co(n){for(var t,e,r,i,u=[],o=Eo(n),a=-1,s=n.length-1;++a<s;)t=Ao(n[a],n[a+1]),ca(t)<Ta?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,i=e*e+r*r,i>9&&(i=3*t/Math.sqrt(i),o[a]=i*e,o[a+1]=i*r));for(a=-1;++a<=s;)i=(n[Math.min(s,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),u.push([i||0,o[a]*i||0]);return u}function No(n){return n.length<3?co(n):n[0]+yo(n,Co(n))}function To(n){for(var t,e,r,i=-1,u=n.length;++i<u;)t=n[i],e=t[0],r=t[1]+_c,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Po(n){function t(t){function s(){v.push("M",a(n(m),f),l,c(n(d.reverse()),f),"Z")}for(var h,g,p,v=[],d=[],m=[],y=-1,x=t.length,M=Et(e),b=Et(i),_=e===r?function(){return g}:Et(r),w=i===u?function(){return p}:Et(u);++y<x;)o.call(this,h=t[y],y)?(d.push([g=+M.call(this,h,y),p=+b.call(this,h,y)]),m.push([+_.call(this,h,y),+w.call(this,h,y)])):d.length&&(s(),d=[],m=[]);return d.length&&s(),v.length?v.join(""):null}var e=Cr,r=Cr,i=0,u=Nr,o=Ce,a=co,s=a.key,c=a,l="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(i=u=n,t):u},t.y0=function(n){return arguments.length?(i=n,t):i},t.y1=function(n){return arguments.length?(u=n,t):u},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(s="function"==typeof n?a=n:(a=Sc.get(n)||co).key,c=a.reverse||a,l=a.closed?"M":"L",t):s},t.tension=function(n){return arguments.length?(f=n,t):f},t}function zo(n){return n.radius}function Lo(n){return[n.x,n.y]}function qo(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]+_c;return[e*Math.cos(r),e*Math.sin(r)]}}function Do(){return 64}function Ro(){return"circle"}function jo(n){var t=Math.sqrt(n/Ea);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Uo(n,t){return pa(n,Lc),n.id=t,n}function Io(n,t,e,r){var i=n.id;return H(n,"function"==typeof e?function(n,u,o){n.__transition__[i].tween.set(t,r(e.call(n,n.__data__,u,o)))}:(e=r(e),function(n){n.__transition__[i].tween.set(t,e)}))}function Fo(n){return null==n&&(n=""),function(){this.textContent=n}}function Ho(n,t,e,r){var i=n.__transition__||(n.__transition__={active:0,count:0}),u=i[e];if(!u){var o=r.time;u=i[e]={tween:new f,time:o,ease:r.ease,delay:r.delay,duration:r.duration},++i.count,Wo.timer(function(r){function a(r){return i.active>e?c():(i.active=e,u.event&&u.event.start.call(n,l,t),u.tween.forEach(function(e,r){(r=r.call(n,l,t))&&v.push(r)}),void Wo.timer(function(){return p.c=s(r||1)?Ce:s,1},0,o))}function s(r){if(i.active!==e)return c();for(var o=r/g,a=f(o),s=v.length;s>0;)v[--s].call(n,a);return o>=1?(u.event&&u.event.end.call(n,l,t),c()):void 0}function c(){return--i.count?delete i[e]:delete n.__transition__,1}var l=n.__data__,f=u.ease,h=u.delay,g=u.duration,p=Ka,v=[];return p.t=h+o,r>=h?a(r-h):void(p.c=a)},0,o)}}function Oo(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function Yo(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function Zo(n){return n.toISOString()}function Xo(n,t,e){function r(t){return n(t)}function i(n,e){var r=n[1]-n[0],i=r/e,u=Wo.bisect(Oc,i);return u==Oc.length?[t.year,Xu(n.map(function(n){return n/31536e6}),e)[2]]:u?t[i/Oc[u-1]<Oc[u]/i?u-1:u]:[Xc,Xu(n,e)[2]]}return r.invert=function(t){return Vo(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Vo)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,Vo(+e+1),t).length}var u=r.domain(),o=Ru(u),a=null==n?i(o,10):"number"==typeof n&&i(o,n);return a&&(n=a[0],t=a[1]),r.domain(Iu(u,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=Vo(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Vo(+t+1);return t}}:n))},r.ticks=function(n,t){var e=Ru(r.domain()),u=null==n?i(e,10):"number"==typeof n?i(e,n):!n.range&&[{range:n},t];return u&&(n=u[0],t=u[1]),n.range(e[0],Vo(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Xo(n.copy(),t,e)},Yu(r,n)}function Vo(n){return new Date(n)}function Bo(n){return JSON.parse(n.responseText)}function $o(n){var t=Go.createRange();return t.selectNode(Go.body),t.createContextualFragment(n.responseText)}var Wo={version:"3.4.11"};Date.now||(Date.now=function(){return+new Date});var Jo=[].slice,Qo=function(n){return Jo.call(n)},Go=document,Ko=Go.documentElement,na=window;try{Qo(Ko.childNodes)[0].nodeType}catch(ta){Qo=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{Go.createElement("div").style.setProperty("opacity",0,"")}catch(ea){var ra=na.Element.prototype,ia=ra.setAttribute,ua=ra.setAttributeNS,oa=na.CSSStyleDeclaration.prototype,aa=oa.setProperty;ra.setAttribute=function(n,t){ia.call(this,n,t+"")},ra.setAttributeNS=function(n,t,e){ua.call(this,n,t,e+"")},oa.setProperty=function(n,t,e){aa.call(this,n,t+"",e)}}Wo.ascending=u,Wo.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},Wo.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u&&!(null!=(e=n[i])&&e>=e);)e=void 0;for(;++i<u;)null!=(r=n[i])&&e>r&&(e=r)}else{for(;++i<u&&!(null!=(e=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;++i<u;)null!=(r=t.call(n,n[i],i))&&e>r&&(e=r)}return e},Wo.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;++i<u&&!(null!=(e=n[i])&&e>=e);)e=void 0;for(;++i<u;)null!=(r=n[i])&&r>e&&(e=r)}else{for(;++i<u&&!(null!=(e=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;++i<u;)null!=(r=t.call(n,n[i],i))&&r>e&&(e=r)}return e},Wo.extent=function(n,t){var e,r,i,u=-1,o=n.length;if(1===arguments.length){for(;++u<o&&!(null!=(e=i=n[u])&&e>=e);)e=i=void 0;for(;++u<o;)null!=(r=n[u])&&(e>r&&(e=r),r>i&&(i=r))}else{for(;++u<o&&!(null!=(e=i=t.call(n,n[u],u))&&e>=e);)e=void 0;for(;++u<o;)null!=(r=t.call(n,n[u],u))&&(e>r&&(e=r),r>i&&(i=r))}return[e,i]},Wo.sum=function(n,t){var e,r=0,i=n.length,u=-1;if(1===arguments.length)for(;++u<i;)isNaN(e=+n[u])||(r+=e);else for(;++u<i;)isNaN(e=+t.call(n,n[u],u))||(r+=e);return r},Wo.mean=function(n,t){var e,r=0,i=n.length,u=-1,a=i;if(1===arguments.length)for(;++u<i;)o(e=n[u])?r+=e:--a;else for(;++u<i;)o(e=t.call(n,n[u],u))?r+=e:--a;return a?r/a:void 0},Wo.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),i=+n[r-1],u=e-r;return u?i+u*(n[r]-i):i},Wo.median=function(n,t){return arguments.length>1&&(n=n.map(t)),n=n.filter(o),n.length?Wo.quantile(n.sort(u),.5):void 0};var sa=a(u);Wo.bisectLeft=sa.left,Wo.bisect=Wo.bisectRight=sa.right,Wo.bisector=function(n){return a(1===n.length?function(t,e){return u(n(t),e)}:n)},Wo.shuffle=function(n){for(var t,e,r=n.length;r;)e=Math.random()*r--|0,t=n[r],n[r]=n[e],n[e]=t;return n},Wo.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},Wo.pairs=function(n){for(var t,e=0,r=n.length-1,i=n[0],u=new Array(0>r?0:r);r>e;)u[e]=[t=i,i=n[++e]];return u},Wo.zip=function(){if(!(r=arguments.length))return[];for(var n=-1,t=Wo.min(arguments,s),e=new Array(t);++n<t;)for(var r,i=-1,u=e[n]=new Array(r);++i<r;)u[i]=arguments[i][n];return e},Wo.transpose=function(n){return Wo.zip.apply(Wo,n)},Wo.keys=function(n){var t=[];for(var e in n)t.push(e);return t},Wo.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},Wo.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},Wo.merge=function(n){for(var t,e,r,i=n.length,u=-1,o=0;++u<i;)o+=n[u].length;for(e=new Array(o);--i>=0;)for(r=n[i],t=r.length;--t>=0;)e[--o]=r[t];return e};var ca=Math.abs;Wo.range=function(n,t,e){if(arguments.length<3&&(e=1,arguments.length<2&&(t=n,n=0)),(t-n)/e===1/0)throw new Error("infinite range");var r,i=[],u=c(ca(e)),o=-1;if(n*=u,t*=u,e*=u,0>e)for(;(r=n+e*++o)>t;)i.push(r/u);else for(;(r=n+e*++o)<t;)i.push(r/u);return i},Wo.map=function(n){var t=new f;if(n instanceof f)n.forEach(function(n,e){t.set(n,e)});else for(var e in n)t.set(e,n[e]);return t},l(f,{has:h,get:function(n){return this[la+n]},set:function(n,t){return this[la+n]=t},remove:g,keys:p,values:function(){var n=[];return this.forEach(function(t,e){n.push(e)}),n},entries:function(){var n=[];return this.forEach(function(t,e){n.push({key:t,value:e})}),n},size:v,empty:d,forEach:function(n){for(var t in this)t.charCodeAt(0)===fa&&n.call(this,t.substring(1),this[t])}});var la="\x00",fa=la.charCodeAt(0);Wo.nest=function(){function n(t,o,a){if(a>=u.length)return r?r.call(i,o):e?o.sort(e):o;for(var s,c,l,h,g=-1,p=o.length,v=u[a++],d=new f;++g<p;)(h=d.get(s=v(c=o[g])))?h.push(c):d.set(s,[c]);return t?(c=t(),l=function(e,r){c.set(e,n(t,r,a))}):(c={},l=function(e,r){c[e]=n(t,r,a)}),d.forEach(l),c}function t(n,e){if(e>=u.length)return n;var r=[],i=o[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,i={},u=[],o=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(Wo.map,e,0),0)},i.key=function(n){return u.push(n),i},i.sortKeys=function(n){return o[u.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},Wo.set=function(n){var t=new m;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},l(m,{has:h,add:function(n){return this[la+n]=!0,n},remove:function(n){return n=la+n,n in this&&delete this[n]},values:p,size:v,empty:d,forEach:function(n){for(var t in this)t.charCodeAt(0)===fa&&n.call(this,t.substring(1))}}),Wo.behavior={},Wo.rebind=function(n,t){for(var e,r=1,i=arguments.length;++r<i;)n[e=arguments[r]]=y(n,t,t[e]);return n};var ha=["webkit","ms","moz","Moz","o","O"];Wo.dispatch=function(){for(var n=new b,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=_(n);return n},b.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},Wo.event=null,Wo.requote=function(n){return n.replace(ga,"\\$&")};var ga=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,pa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},va=function(n,t){return t.querySelector(n)},da=function(n,t){return t.querySelectorAll(n)},ma=Ko.matches||Ko[x(Ko,"matchesSelector")],ya=function(n,t){return ma.call(n,t)};"function"==typeof Sizzle&&(va=function(n,t){return Sizzle(n,t)[0]||null},da=Sizzle,ya=Sizzle.matchesSelector),Wo.selection=function(){return _a};var xa=Wo.selection.prototype=[];xa.select=function(n){var t,e,r,i,u=[];n=E(n);for(var o=-1,a=this.length;++o<a;){u.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var s=-1,c=r.length;++s<c;)(i=r[s])?(t.push(e=n.call(i,i.__data__,s,o)),e&&"__data__"in i&&(e.__data__=i.__data__)):t.push(null)}return A(u)},xa.selectAll=function(n){var t,e,r=[];n=C(n);for(var i=-1,u=this.length;++i<u;)for(var o=this[i],a=-1,s=o.length;++a<s;)(e=o[a])&&(r.push(t=Qo(n.call(e,e.__data__,a,i))),t.parentNode=e);return A(r)};var Ma={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/"};Wo.ns={prefix:Ma,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.substring(0,t),n=n.substring(t+1)),Ma.hasOwnProperty(e)?{space:Ma[e],local:n}:n}},xa.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=Wo.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(N(t,n[t]));return this}return this.each(N(n,t))},xa.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=z(n)).length,i=-1;if(t=e.classList){for(;++i<r;)if(!t.contains(n[i]))return!1}else for(t=e.getAttribute("class");++i<r;)if(!P(n[i]).test(t))return!1;return!0}for(t in n)this.each(L(t,n[t]));return this}return this.each(L(n,t))},xa.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(D(e,n[e],t));return this}if(2>r)return na.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(D(n,t,e))},xa.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(R(t,n[t]));return this}return this.each(R(n,t))},xa.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},xa.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},xa.append=function(n){return n=j(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},xa.insert=function(n,t){return n=j(n),t=E(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},xa.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},xa.data=function(n,t){function e(n,e){var r,i,u,o=n.length,l=e.length,h=Math.min(o,l),g=new Array(l),p=new Array(l),v=new Array(o);if(t){var d,m=new f,y=new f,x=[];for(r=-1;++r<o;)d=t.call(i=n[r],i.__data__,r),m.has(d)?v[r]=i:m.set(d,i),x.push(d);for(r=-1;++r<l;)d=t.call(e,u=e[r],r),(i=m.get(d))?(g[r]=i,i.__data__=u):y.has(d)||(p[r]=U(u)),y.set(d,u),m.remove(d);for(r=-1;++r<o;)m.has(x[r])&&(v[r]=n[r])}else{for(r=-1;++r<h;)i=n[r],u=e[r],i?(i.__data__=u,g[r]=i):p[r]=U(u);for(;l>r;++r)p[r]=U(e[r]);for(;o>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,a.push(p),s.push(g),c.push(v)}var r,i,u=-1,o=this.length;if(!arguments.length){for(n=new Array(o=(r=this[0]).length);++u<o;)(i=r[u])&&(n[u]=i.__data__);return n}var a=O([]),s=A([]),c=A([]);if("function"==typeof n)for(;++u<o;)e(r=this[u],n.call(r,r.parentNode.__data__,u));else for(;++u<o;)e(r=this[u],n);return s.enter=function(){return a},s.exit=function(){return c},s},xa.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},xa.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=I(n));for(var u=0,o=this.length;o>u;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var a=0,s=e.length;s>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return A(i)},xa.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],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},xa.sort=function(n){n=F.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},xa.each=function(n){return H(this,function(t,e,r){n.call(t,t.__data__,e,r)})},xa.call=function(n){var t=Qo(arguments);return n.apply(t[0]=this,t),this},xa.empty=function(){return!this.node()},xa.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},xa.size=function(){var n=0;return this.each(function(){++n}),n};var ba=[];Wo.selection.enter=O,Wo.selection.enter.prototype=ba,ba.append=xa.append,ba.empty=xa.empty,ba.node=xa.node,ba.call=xa.call,ba.size=xa.size,ba.select=function(n){for(var t,e,r,i,u,o=[],a=-1,s=this.length;++a<s;){r=(i=this[a]).update,o.push(t=[]),t.parentNode=i.parentNode;for(var c=-1,l=i.length;++c<l;)(u=i[c])?(t.push(r[c]=e=n.call(i.parentNode,u.__data__,c,a)),e.__data__=u.__data__):t.push(null)}return A(o)},ba.insert=function(n,t){return arguments.length<2&&(t=Y(this)),xa.insert.call(this,n,t)},xa.transition=function(){for(var n,t,e=Nc||++qc,r=[],i=Tc||{time:Date.now(),ease:Si,delay:0,duration:250},u=-1,o=this.length;++u<o;){r.push(n=[]);for(var a=this[u],s=-1,c=a.length;++s<c;)(t=a[s])&&Ho(t,s,e,i),n.push(t)}return Uo(r,e)},xa.interrupt=function(){return this.each(Z)},Wo.select=function(n){var t=["string"==typeof n?va(n,Go):n];return t.parentNode=Ko,A([t])},Wo.selectAll=function(n){var t=Qo("string"==typeof n?da(n,Go):n);return t.parentNode=Ko,A([t])};var _a=Wo.select(Ko);xa.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(X(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(X(n,t,e))};var wa=Wo.map({mouseenter:"mouseover",mouseleave:"mouseout"});wa.forEach(function(n){"on"+n in Go&&wa.remove(n)});var Sa="onselectstart"in Go?null:x(Ko.style,"userSelect"),ka=0;Wo.mouse=function(n){return W(n,S())};var Aa=/WebKit/.test(na.navigator.userAgent)?-1:0;Wo.touches=function(n,t){return arguments.length<2&&(t=S().touches),t?Qo(t).map(function(t){var e=W(n,t);return e.identifier=t.identifier,e}):[]},Wo.behavior.drag=function(){function n(){this.on("mousedown.drag",i).on("touchstart.drag",u)}function t(n,t,i,u,o){return function(){function a(){var n,e,r=t(h,v);r&&(n=r[0]-x[0],e=r[1]-x[1],p|=n|e,x=r,g({type:"drag",x:r[0]+c[0],y:r[1]+c[1],dx:n,dy:e}))}function s(){t(h,v)&&(m.on(u+d,null).on(o+d,null),y(p&&Wo.event.target===f),g({type:"dragend"}))}var c,l=this,f=Wo.event.target,h=l.parentNode,g=e.of(l,arguments),p=0,v=n(),d=".drag"+(null==v?"":"-"+v),m=Wo.select(i()).on(u+d,a).on(o+d,s),y=$(),x=t(h,v);r?(c=r.apply(l,arguments),c=[c.x-x[0],c.y-x[1]]):c=[0,0],g({type:"dragstart"})}}var e=k(n,"drag","dragstart","dragend"),r=null,i=t(M,Wo.mouse,G,"mousemove","mouseup"),u=t(J,Wo.touch,Q,"touchmove","touchend");return n.origin=function(t){return arguments.length?(r=t,n):r},Wo.rebind(n,e,"on")};var Ea=Math.PI,Ca=2*Ea,Na=Ea/2,Ta=1e-6,Pa=Ta*Ta,za=Ea/180,La=180/Ea,qa=Math.SQRT2,Da=2,Ra=4;Wo.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=it(v),o=u/(Da*h)*(e*ut(qa*t+v)-rt(v));return[r+o*c,i+o*l,u*e/it(qa*t+v)]}return[r+n*c,i+n*l,u*Math.exp(qa*t)]}var r=n[0],i=n[1],u=n[2],o=t[0],a=t[1],s=t[2],c=o-r,l=a-i,f=c*c+l*l,h=Math.sqrt(f),g=(s*s-u*u+Ra*f)/(2*u*Da*h),p=(s*s-u*u-Ra*f)/(2*s*Da*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(s/u))/qa;return e.duration=1e3*y,e},Wo.behavior.zoom=function(){function n(n){n.on(E,c).on(Ia+".zoom",f).on("dblclick.zoom",h).on(T,l)}function t(n){return[(n[0]-_.x)/_.k,(n[1]-_.y)/_.k]}function e(n){return[n[0]*_.k+_.x,n[1]*_.k+_.y]}function r(n){_.k=Math.max(A[0],Math.min(A[1],n))}function i(n,t){t=e(t),_.x+=n[0]-t[0],_.y+=n[1]-t[1]}function u(){x&&x.domain(y.range().map(function(n){return(n-_.x)/_.k}).map(y.invert)),b&&b.domain(M.range().map(function(n){return(n-_.y)/_.k}).map(M.invert))}function o(n){n({type:"zoomstart"})}function a(n){u(),n({type:"zoom",scale:_.k,translate:[_.x,_.y]})}function s(n){n({type:"zoomend"})}function c(){function n(){l=1,i(Wo.mouse(r),h),a(c)}function e(){f.on(C,null).on(N,null),g(l&&Wo.event.target===u),s(c)}var r=this,u=Wo.event.target,c=P.of(r,arguments),l=0,f=Wo.select(na).on(C,n).on(N,e),h=t(Wo.mouse(r)),g=$();Z.call(r),o(c)}function l(){function n(){var n=Wo.touches(g);return h=_.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){var t=Wo.event.target;Wo.select(t).on(x,u).on(M,f),b.push(t);for(var e=Wo.event.changedTouches,o=0,s=e.length;s>o;++o)v[e[o].identifier]=null;var c=n(),l=Date.now();if(1===c.length){if(500>l-m){var h=c[0],g=v[h.identifier];r(2*_.k),i(h,g),w(),a(p)}m=l}else if(c.length>1){var h=c[0],y=c[1],S=h[0]-y[0],k=h[1]-y[1];d=S*S+k*k}}function u(){for(var n,t,e,u,o=Wo.touches(g),s=0,c=o.length;c>s;++s,u=null)if(e=o[s],u=v[e.identifier]){if(t)break;n=e,t=u}if(u){var l=(l=e[0]-n[0])*l+(l=e[1]-n[1])*l,f=d&&Math.sqrt(l/d);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+u[0])/2,(t[1]+u[1])/2],r(f*h)}m=null,i(n,t),a(p)}function f(){if(Wo.event.touches.length){for(var t=Wo.event.changedTouches,e=0,r=t.length;r>e;++e)delete v[t[e].identifier];for(var i in v)return void n()}Wo.selectAll(b).on(y,null),S.on(E,c).on(T,l),k(),s(p)}var h,g=this,p=P.of(g,arguments),v={},d=0,y=".zoom-"+Wo.event.changedTouches[0].identifier,x="touchmove"+y,M="touchend"+y,b=[],S=Wo.select(g).on(E,null).on(T,e),k=$();Z.call(g),e(),o(p)}function f(){var n=P.of(this,arguments);d?clearTimeout(d):(g=t(p=v||Wo.mouse(this)),Z.call(this),o(n)),d=setTimeout(function(){d=null,s(n)},50),w(),r(Math.pow(2,.002*ja())*_.k),i(p,g),a(n)}function h(){var n=P.of(this,arguments),e=Wo.mouse(this),u=t(e),c=Math.log(_.k)/Math.LN2;o(n),r(Math.pow(2,Wo.event.shiftKey?Math.ceil(c)-1:Math.floor(c)+1)),i(e,u),a(n),s(n)}var g,p,v,d,m,y,x,M,b,_={x:0,y:0,k:1},S=[960,500],A=Ua,E="mousedown.zoom",C="mousemove.zoom",N="mouseup.zoom",T="touchstart.zoom",P=k(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=P.of(this,arguments),t=_;Nc?Wo.select(this).transition().each("start.zoom",function(){_=this.__chart__||{x:0,y:0,k:1},o(n)}).tween("zoom:zoom",function(){var e=S[0],r=S[1],i=e/2,u=r/2,o=Wo.interpolateZoom([(i-_.x)/_.k,(u-_.y)/_.k,e/_.k],[(i-t.x)/t.k,(u-t.y)/t.k,e/t.k]);return function(t){var r=o(t),s=e/r[2];this.__chart__=_={x:i-r[0]*s,y:u-r[1]*s,k:s},a(n)}}).each("end.zoom",function(){s(n)}):(this.__chart__=_,o(n),a(n),s(n))})},n.translate=function(t){return arguments.length?(_={x:+t[0],y:+t[1],k:_.k},u(),n):[_.x,_.y]},n.scale=function(t){return arguments.length?(_={x:_.x,y:_.y,k:+t},u(),n):_.k},n.scaleExtent=function(t){return arguments.length?(A=null==t?Ua:[+t[0],+t[1]],n):A},n.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],n):v},n.size=function(t){return arguments.length?(S=t&&[+t[0],+t[1]],n):S},n.x=function(t){return arguments.length?(x=t,y=t.copy(),_={x:0,y:0,k:1},n):x},n.y=function(t){return arguments.length?(b=t,M=t.copy(),_={x:0,y:0,k:1},n):b},Wo.rebind(n,P,"on")};var ja,Ua=[0,1/0],Ia="onwheel"in Go?(ja=function(){return-Wo.event.deltaY*(Wo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Go?(ja=function(){return Wo.event.wheelDelta},"mousewheel"):(ja=function(){return-Wo.event.detail},"MozMousePixelScroll");Wo.color=at,at.prototype.toString=function(){return this.rgb()+""},Wo.hsl=st;var Fa=st.prototype=new at;Fa.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),new st(this.h,this.s,this.l/n)},Fa.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new st(this.h,this.s,n*this.l)},Fa.rgb=function(){return ct(this.h,this.s,this.l)},Wo.hcl=lt;var Ha=lt.prototype=new at;Ha.brighter=function(n){return new lt(this.h,this.c,Math.min(100,this.l+Oa*(arguments.length?n:1)))},Ha.darker=function(n){return new lt(this.h,this.c,Math.max(0,this.l-Oa*(arguments.length?n:1)))},Ha.rgb=function(){return ft(this.h,this.c,this.l).rgb()},Wo.lab=ht;var Oa=18,Ya=.95047,Za=1,Xa=1.08883,Va=ht.prototype=new at;Va.brighter=function(n){return new ht(Math.min(100,this.l+Oa*(arguments.length?n:1)),this.a,this.b)},Va.darker=function(n){return new ht(Math.max(0,this.l-Oa*(arguments.length?n:1)),this.a,this.b)},Va.rgb=function(){return gt(this.l,this.a,this.b)},Wo.rgb=yt;var Ba=yt.prototype=new at;Ba.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),new yt(Math.min(255,t/n),Math.min(255,e/n),Math.min(255,r/n))):new yt(i,i,i)},Ba.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),new yt(n*this.r,n*this.g,n*this.b)},Ba.hsl=function(){return wt(this.r,this.g,this.b)},Ba.toString=function(){return"#"+bt(this.r)+bt(this.g)+bt(this.b)};var $a=Wo.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});
$a.forEach(function(n,t){$a.set(n,xt(t))}),Wo.functor=Et,Wo.xhr=Nt(Ct),Wo.dsv=function(n,t){function e(n,e,u){arguments.length<3&&(u=e,e=null);var o=Tt(n,t,null==e?r:i(e),u);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:i(n)):e},o}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function u(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),s=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(l>=c)return o;if(i)return i=!1,u;var t=l;if(34===n.charCodeAt(t)){for(var e=t;e++<c;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}l=e+2;var r=n.charCodeAt(e+1);return 13===r?(i=!0,10===n.charCodeAt(e+2)&&++l):10===r&&(i=!0),n.substring(t+1,e).replace(/""/g,'"')}for(;c>l;){var r=n.charCodeAt(l++),a=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(l)&&(++l,++a);else if(r!==s)continue;return n.substring(t,l-a)}return n.substring(t)}for(var r,i,u={},o={},a=[],c=n.length,l=0,f=0;(r=e())!==o;){for(var h=[];r!==u&&r!==o;)h.push(r),r=e();(!t||(h=t(h,f++)))&&a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new m,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(o).join(n)].concat(t.map(function(t){return i.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(u).join("\n")},e},Wo.csv=Wo.dsv(",","text/csv"),Wo.tsv=Wo.dsv(" ","text/tab-separated-values"),Wo.touch=function(n,t,e){if(arguments.length<3&&(e=t,t=S().changedTouches),t)for(var r,i=0,u=t.length;u>i;++i)if((r=t[i]).identifier===e)return W(n,r)};var Wa,Ja,Qa,Ga,Ka,ns=na[x(na,"requestAnimationFrame")]||function(n){setTimeout(n,17)};Wo.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var i=e+t,u={c:n,t:i,f:!1,n:null};Ja?Ja.n=u:Wa=u,Ja=u,Qa||(Ga=clearTimeout(Ga),Qa=1,ns(zt))},Wo.timer.flush=function(){Lt(),qt()},Wo.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var ts=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(Rt);Wo.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=Wo.round(n,Dt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),ts[8+e/3]};var es=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,rs=Wo.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=Wo.round(n,Dt(n,t))).toFixed(Math.max(0,Math.min(20,Dt(n*(1+1e-15),t))))}}),is=Wo.time={},us=Date;It.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(){os.setUTCDate.apply(this._,arguments)},setDay:function(){os.setUTCDay.apply(this._,arguments)},setFullYear:function(){os.setUTCFullYear.apply(this._,arguments)},setHours:function(){os.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){os.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){os.setUTCMinutes.apply(this._,arguments)},setMonth:function(){os.setUTCMonth.apply(this._,arguments)},setSeconds:function(){os.setUTCSeconds.apply(this._,arguments)},setTime:function(){os.setTime.apply(this._,arguments)}};var os=Date.prototype;is.year=Ft(function(n){return n=is.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),is.years=is.year.range,is.years.utc=is.year.utc.range,is.day=Ft(function(n){var t=new us(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),is.days=is.day.range,is.days.utc=is.day.utc.range,is.dayOfYear=function(n){var t=is.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=is[n]=Ft(function(n){return(n=is.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=is.year(n).getDay();return Math.floor((is.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});is[n+"s"]=e.range,is[n+"s"].utc=e.utc.range,is[n+"OfYear"]=function(n){var e=is.year(n).getDay();return Math.floor((is.dayOfYear(n)+(e+t)%7)/7)}}),is.week=is.sunday,is.weeks=is.sunday.range,is.weeks.utc=is.sunday.utc.range,is.weekOfYear=is.sundayOfYear;var as={"-":"",_:" ",0:"0"},ss=/^\s*\d+/,cs=/^%/;Wo.locale=function(n){return{numberFormat:jt(n),timeFormat:Ot(n)}};var ls=Wo.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Wo.format=ls.numberFormat,Wo.geo={},ce.prototype={s:0,t:0,add:function(n){le(n,this.t,fs),le(fs.s,this.s,this),this.s?this.t+=fs.t:this.s=fs.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var fs=new ce;Wo.geo.stream=function(n,t){n&&hs.hasOwnProperty(n.type)?hs[n.type](n,t):fe(n,t)};var hs={Feature:function(n,t){fe(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;++r<i;)fe(e[r].geometry,t)}},gs={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)n=e[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){he(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)he(e[r],t,0)},Polygon:function(n,t){ge(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;++r<i;)ge(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,i=e.length;++r<i;)fe(e[r],t)}};Wo.geo.area=function(n){return ps=0,Wo.geo.stream(n,ds),ps};var ps,vs=new ce,ds={sphere:function(){ps+=4*Ea},point:M,lineStart:M,lineEnd:M,polygonStart:function(){vs.reset(),ds.lineStart=pe},polygonEnd:function(){var n=2*vs;ps+=0>n?4*Ea+n:n,ds.lineStart=ds.lineEnd=ds.point=M}};Wo.geo.bounds=function(){function n(n,t){x.push(M=[l=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=ve([t*za,e*za]);if(m){var i=me(m,r),u=[i[1],-i[0],0],o=me(u,i);Me(o),o=be(o);var s=t-p,c=s>0?1:-1,v=o[0]*La*c,d=ca(s)>180;if(d^(v>c*p&&c*t>v)){var y=o[1]*La;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>c*p&&c*t>v)){var y=-o[1]*La;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t):h>=l?(l>t&&(l=t),t>h&&(h=t)):t>p?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t)}else n(t,e);m=r,p=t}function e(){b.point=t}function r(){M[0]=l,M[1]=h,b.point=n,m=null}function i(n,e){if(m){var r=n-p;y+=ca(r)>180?r+(r>0?360:-360):r}else v=n,d=e;ds.point(n,e),t(n,e)}function u(){ds.lineStart()}function o(){i(v,d),ds.lineEnd(),ca(y)>Ta&&(l=-(h=180)),M[0]=l,M[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function s(n,t){return n[0]-t[0]}function c(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var l,f,h,g,p,v,d,m,y,x,M,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=i,b.lineStart=u,b.lineEnd=o,y=0,ds.polygonStart()},polygonEnd:function(){ds.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>vs?(l=-(h=180),f=-(g=90)):y>Ta?g=90:-Ta>y&&(f=-90),M[0]=l,M[1]=h}};return function(n){g=h=-(l=f=1/0),x=[],Wo.geo.stream(n,b);var t=x.length;if(t){x.sort(s);for(var e,r=1,i=x[0],u=[i];t>r;++r)e=x[r],c(e[0],i)||c(e[1],i)?(a(i[0],e[1])>a(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):u.push(i=e);for(var o,e,p=-1/0,t=u.length-1,r=0,i=u[t];t>=r;i=e,++r)e=u[r],(o=a(i[1],e[0]))>p&&(p=o,l=e[0],h=i[1])}return x=M=null,1/0===l||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[l,f],[h,g]]}}(),Wo.geo.centroid=function(n){ms=ys=xs=Ms=bs=_s=ws=Ss=ks=As=Es=0,Wo.geo.stream(n,Cs);var t=ks,e=As,r=Es,i=t*t+e*e+r*r;return Pa>i&&(t=_s,e=ws,r=Ss,Ta>ys&&(t=xs,e=Ms,r=bs),i=t*t+e*e+r*r,Pa>i)?[0/0,0/0]:[Math.atan2(e,t)*La,et(r/Math.sqrt(i))*La]};var ms,ys,xs,Ms,bs,_s,ws,Ss,ks,As,Es,Cs={sphere:M,point:we,lineStart:ke,lineEnd:Ae,polygonStart:function(){Cs.lineStart=Ee},polygonEnd:function(){Cs.lineStart=ke}},Ns=ze(Ce,je,Ie,[-Ea,-Ea/2]),Ts=1e9;Wo.geo.clipExtent=function(){var n,t,e,r,i,u,o={stream:function(n){return i&&(i.valid=!1),i=u(n),i.valid=!0,i},extent:function(a){return arguments.length?(u=Oe(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),i&&(i.valid=!1,i=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(Wo.geo.conicEqualArea=function(){return Ze(Xe)}).raw=Xe,Wo.geo.albers=function(){return Wo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Wo.geo.albersUsa=function(){function n(n){var u=n[0],o=n[1];return t=null,e(u,o),t||(r(u,o),t)||i(u,o),t}var t,e,r,i,u=Wo.geo.albers(),o=Wo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=Wo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?o:i>=.166&&.234>i&&r>=-.214&&-.115>r?a:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),a.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),a.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var c=u.scale(),l=+t[0],f=+t[1];return e=u.translate(t).clipExtent([[l-.455*c,f-.238*c],[l+.455*c,f+.238*c]]).stream(s).point,r=o.translate([l-.307*c,f+.201*c]).clipExtent([[l-.425*c+Ta,f+.12*c+Ta],[l-.214*c-Ta,f+.234*c-Ta]]).stream(s).point,i=a.translate([l-.205*c,f+.212*c]).clipExtent([[l-.214*c+Ta,f+.166*c+Ta],[l-.115*c-Ta,f+.234*c-Ta]]).stream(s).point,n},n.scale(1070)};var Ps,zs,Ls,qs,Ds,Rs,js={point:M,lineStart:M,lineEnd:M,polygonStart:function(){zs=0,js.lineStart=Ve},polygonEnd:function(){js.lineStart=js.lineEnd=js.point=M,Ps+=ca(zs/2)}},Us={point:Be,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Is={point:Je,lineStart:Qe,lineEnd:Ge,polygonStart:function(){Is.lineStart=Ke},polygonEnd:function(){Is.point=Je,Is.lineStart=Qe,Is.lineEnd=Ge}};Wo.geo.path=function(){function n(n){return n&&("function"==typeof a&&u.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=i(u)),Wo.geo.stream(n,o)),u.result()}function t(){return o=null,n}var e,r,i,u,o,a=4.5;return n.area=function(n){return Ps=0,Wo.geo.stream(n,i(js)),Ps},n.centroid=function(n){return xs=Ms=bs=_s=ws=Ss=ks=As=Es=0,Wo.geo.stream(n,i(Is)),Es?[ks/Es,As/Es]:Ss?[_s/Ss,ws/Ss]:bs?[xs/bs,Ms/bs]:[0/0,0/0]},n.bounds=function(n){return Ds=Rs=-(Ls=qs=1/0),Wo.geo.stream(n,i(Us)),[[Ls,qs],[Ds,Rs]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||er(n):Ct,t()):e},n.context=function(n){return arguments.length?(u=null==(r=n)?new $e:new nr(n),"function"!=typeof a&&u.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(u.pointRadius(+t),+t),n):a},n.projection(Wo.geo.albersUsa()).context(null)},Wo.geo.transform=function(n){return{stream:function(t){var e=new rr(t);for(var r in n)e[r]=n[r];return e}}},rr.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},Wo.geo.projection=ur,Wo.geo.projectionMutator=or,(Wo.geo.equirectangular=function(){return ur(sr)}).raw=sr.invert=sr,Wo.geo.rotation=function(n){function t(t){return t=n(t[0]*za,t[1]*za),t[0]*=La,t[1]*=La,t}return n=lr(n[0]%360*za,n[1]*za,n.length>2?n[2]*za:0),t.invert=function(t){return t=n.invert(t[0]*za,t[1]*za),t[0]*=La,t[1]*=La,t},t},cr.invert=sr,Wo.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=lr(-n[0]*za,-n[1]*za,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=La,n[1]*=La}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=pr((t=+r)*za,i*za),n):t},n.precision=function(r){return arguments.length?(e=pr(t*za,(i=+r)*za),n):i},n.angle(90)},Wo.geo.distance=function(n,t){var e,r=(t[0]-n[0])*za,i=n[1]*za,u=t[1]*za,o=Math.sin(r),a=Math.cos(r),s=Math.sin(i),c=Math.cos(i),l=Math.sin(u),f=Math.cos(u);return Math.atan2(Math.sqrt((e=f*o)*e+(e=c*l-s*f*a)*e),s*l+c*f*a)},Wo.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return Wo.range(Math.ceil(u/d)*d,i,d).map(h).concat(Wo.range(Math.ceil(c/m)*m,s,m).map(g)).concat(Wo.range(Math.ceil(r/p)*p,e,p).filter(function(n){return ca(n%d)>Ta}).map(l)).concat(Wo.range(Math.ceil(a/v)*v,o,v).filter(function(n){return ca(n%m)>Ta}).map(f))}var e,r,i,u,o,a,s,c,l,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(s).slice(1),h(i).reverse().slice(1),g(c).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],c=+t[0][1],s=+t[1][1],u>i&&(t=u,u=i,i=t),c>s&&(t=c,c=s,s=t),n.precision(y)):[[u,c],[i,s]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,l=dr(a,o,90),f=mr(r,e,y),h=dr(c,s,90),g=mr(u,i,y),n):y},n.majorExtent([[-180,-90+Ta],[180,90-Ta]]).minorExtent([[-180,-80-Ta],[180,80+Ta]])},Wo.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=yr,i=xr;return n.distance=function(){return Wo.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},Wo.geo.interpolate=function(n,t){return Mr(n[0]*za,n[1]*za,t[0]*za,t[1]*za)},Wo.geo.length=function(n){return Fs=0,Wo.geo.stream(n,Hs),Fs};var Fs,Hs={sphere:M,point:M,lineStart:br,lineEnd:M,polygonStart:M,polygonEnd:M},Os=_r(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(Wo.geo.azimuthalEqualArea=function(){return ur(Os)}).raw=Os;var Ys=_r(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},Ct);(Wo.geo.azimuthalEquidistant=function(){return ur(Ys)}).raw=Ys,(Wo.geo.conicConformal=function(){return Ze(wr)}).raw=wr,(Wo.geo.conicEquidistant=function(){return Ze(Sr)}).raw=Sr;var Zs=_r(function(n){return 1/n},Math.atan);(Wo.geo.gnomonic=function(){return ur(Zs)}).raw=Zs,kr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Na]},(Wo.geo.mercator=function(){return Ar(kr)}).raw=kr;var Xs=_r(function(){return 1},Math.asin);(Wo.geo.orthographic=function(){return ur(Xs)}).raw=Xs;var Vs=_r(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(Wo.geo.stereographic=function(){return ur(Vs)}).raw=Vs,Er.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Na]},(Wo.geo.transverseMercator=function(){var n=Ar(Er),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},e([0,0,90])}).raw=Er,Wo.geom={},Wo.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,i=Et(e),u=Et(r),o=n.length,a=[],s=[];for(t=0;o>t;t++)a.push([+i.call(this,n[t],t),+u.call(this,n[t],t),t]);for(a.sort(Pr),t=0;o>t;t++)s.push([a[t][0],-a[t][1]]);var c=Tr(a),l=Tr(s),f=l[0]===c[0],h=l[l.length-1]===c[c.length-1],g=[];for(t=c.length-1;t>=0;--t)g.push(n[a[c[t]][2]]);for(t=+f;t<l.length-h;++t)g.push(n[a[l[t]][2]]);return g}var e=Cr,r=Nr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},Wo.geom.polygon=function(n){return pa(n,Bs),n};var Bs=Wo.geom.polygon.prototype=[];Bs.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],i=0;++t<e;)n=r,r=this[t],i+=n[1]*r[0]-n[0]*r[1];return.5*i},Bs.centroid=function(n){var t,e,r=-1,i=this.length,u=0,o=0,a=this[i-1];for(arguments.length||(n=-1/(6*this.area()));++r<i;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],u+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[u*n,o*n]},Bs.clip=function(n){for(var t,e,r,i,u,o,a=qr(n),s=-1,c=this.length-qr(this),l=this[c-1];++s<c;){for(t=n.slice(),n.length=0,i=this[s],u=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],zr(o,l,i)?(zr(u,l,i)||n.push(Lr(u,o,l,i)),n.push(o)):zr(u,l,i)&&n.push(Lr(u,o,l,i)),u=o;a&&n.push(n[0]),l=i}return n};var $s,Ws,Js,Qs,Gs,Ks=[],nc=[];Or.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(Zr),t.length},ni.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},ti.prototype={insert:function(n,t){var e,r,i;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=ui(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(i=r.R,i&&i.C?(e.C=i.C=!1,r.C=!0,n=r):(n===e.R&&(ri(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ii(this,r))):(i=r.L,i&&i.C?(e.C=i.C=!1,r.C=!0,n=r):(n===e.L&&(ii(this,e),n=e,e=n.U),e.C=!1,r.C=!0,ri(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,i=n.U,u=n.L,o=n.R;if(e=u?o?ui(o):u:o,i?i.L===n?i.L=e:i.R=e:this._=e,u&&o?(r=e.C,e.C=n.C,e.L=u,u.U=e,e!==o?(i=e.U,e.U=n.U,n=e.R,i.L=n,e.R=o,o.U=e):(e.U=i,i=e,n=e.R)):(r=n.C,n=e),n&&(n.U=i),!r){if(n&&n.C)return void(n.C=!1);do{if(n===this._)break;if(n===i.L){if(t=i.R,t.C&&(t.C=!1,i.C=!0,ri(this,i),t=i.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,ii(this,t),t=i.R),t.C=i.C,i.C=t.R.C=!1,ri(this,i),n=this._;break}}else if(t=i.L,t.C&&(t.C=!1,i.C=!0,ii(this,i),t=i.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,ri(this,t),t=i.L),t.C=i.C,i.C=t.L.C=!1,ii(this,i),n=this._;break}t.C=!0,n=i,i=i.U}while(!n.C);n&&(n.C=!1)}}},Wo.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],i=a[0][1],u=a[1][0],o=a[1][1];return oi(e(n),a).cells.forEach(function(e,a){var s=e.edges,c=e.site,l=t[a]=s.length?s.map(function(n){var t=n.start();return[t.x,t.y]}):c.x>=r&&c.x<=u&&c.y>=i&&c.y<=o?[[r,o],[u,o],[u,i],[r,i]]:[];l.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(u(n,t)/Ta)*Ta,y:Math.round(o(n,t)/Ta)*Ta,i:t}})}var r=Cr,i=Nr,u=r,o=i,a=tc;return n?t(n):(t.links=function(n){return oi(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return oi(e(n)).cells.forEach(function(e,r){for(var i,u,o=e.site,a=e.edges.sort(Zr),s=-1,c=a.length,l=a[c-1].edge,f=l.l===o?l.r:l.l;++s<c;)i=l,u=f,l=a[s].edge,f=l.l===o?l.r:l.l,r<u.i&&r<f.i&&si(o,u,f)<0&&t.push([n[r],n[u.i],n[f.i]])}),t},t.x=function(n){return arguments.length?(u=Et(r=n),t):r},t.y=function(n){return arguments.length?(o=Et(i=n),t):i},t.clipExtent=function(n){return arguments.length?(a=null==n?tc:n,t):a===tc?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===tc?null:a&&a[1]},t)};var tc=[[-1e6,-1e6],[1e6,1e6]];Wo.geom.delaunay=function(n){return Wo.geom.voronoi().triangles(n)},Wo.geom.quadtree=function(n,t,e,r,i){function u(n){function u(n,t,e,r,i,u,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var s=n.x,l=n.y;if(null!=s)if(ca(s-e)+ca(l-r)<.01)c(n,t,e,r,i,u,o,a);else{var f=n.point;n.x=n.y=n.point=null,c(n,f,s,l,i,u,o,a),c(n,t,e,r,i,u,o,a)}else n.x=e,n.y=r,n.point=t}else c(n,t,e,r,i,u,o,a)}function c(n,t,e,r,i,o,a,s){var c=.5*(i+a),l=.5*(o+s),f=e>=c,h=r>=l,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=fi()),f?i=c:a=c,h?o=l:s=l,u(n,t,e,r,i,o,a,s)}var l,f,h,g,p,v,d,m,y,x=Et(a),M=Et(s);if(null!=t)v=t,d=e,m=r,y=i;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)l=n[g],l.x<v&&(v=l.x),l.y<d&&(d=l.y),l.x>m&&(m=l.x),l.y>y&&(y=l.y),f.push(l.x),h.push(l.y);else for(g=0;p>g;++g){var b=+x(l=n[g],g),_=+M(l,g);v>b&&(v=b),d>_&&(d=_),b>m&&(m=b),_>y&&(y=_),f.push(b),h.push(_)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=fi();if(k.add=function(n){u(k,n,+x(n,++g),+M(n,g),v,d,m,y)},k.visit=function(n){hi(n,k,v,d,m,y)},g=-1,null==t){for(;++g<p;)u(k,n[g],f[g],h[g],v,d,m,y);--g}else n.forEach(k.add);return f=h=n=l=null,k}var o,a=Cr,s=Nr;return(o=arguments.length)?(a=ci,s=li,3===o&&(i=e,r=t,e=t=0),u(n)):(u.x=function(n){return arguments.length?(a=n,u):a},u.y=function(n){return arguments.length?(s=n,u):s},u.extent=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],i=+n[1][1]),u):null==t?null:[[t,e],[r,i]]},u.size=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=e=0,r=+n[0],i=+n[1]),u):null==t?null:[r-t,i-e]},u)},Wo.interpolateRgb=gi,Wo.interpolateObject=pi,Wo.interpolateNumber=vi,Wo.interpolateString=di;var ec=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rc=new RegExp(ec.source,"g");Wo.interpolate=mi,Wo.interpolators=[function(n,t){var e=typeof t;return("string"===e?$a.has(t)||/^(#|rgb\(|hsl\()/.test(t)?gi:di:t instanceof at?gi:Array.isArray(t)?yi:"object"===e&&isNaN(t)?pi:vi)(n,t)}],Wo.interpolateArray=yi;var ic=function(){return Ct},uc=Wo.map({linear:ic,poly:ki,quad:function(){return _i},cubic:function(){return wi},sin:function(){return Ai},exp:function(){return Ei},circle:function(){return Ci},elastic:Ni,back:Ti,bounce:function(){return Pi}}),oc=Wo.map({"in":Ct,out:Mi,"in-out":bi,"out-in":function(n){return bi(Mi(n))}});Wo.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):"in";return e=uc.get(e)||ic,r=oc.get(r)||Ct,xi(r(e.apply(null,Jo.call(arguments,1))))},Wo.interpolateHcl=zi,Wo.interpolateHsl=Li,Wo.interpolateLab=qi,Wo.interpolateRound=Di,Wo.transform=function(n){var t=Go.createElementNS(Wo.ns.prefix.svg,"g");return(Wo.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Ri(e?e.matrix:ac)})(n)},Ri.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ac={a:1,b:0,c:0,d:1,e:0,f:0};Wo.interpolateTransform=Fi,Wo.layout={},Wo.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Yi(n[e]));return t}},Wo.layout.chord=function(){function n(){var n,c,f,h,g,p={},v=[],d=Wo.range(u),m=[];for(e=[],r=[],n=0,h=-1;++h<u;){for(c=0,g=-1;++g<u;)c+=i[h][g];v.push(c),m.push(Wo.range(u)),n+=c}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&m.forEach(function(n,t){n.sort(function(n,e){return a(i[t][n],i[t][e])})}),n=(Ca-l*u)/n,c=0,h=-1;++h<u;){for(f=c,g=-1;++g<u;){var y=d[h],x=m[y][g],M=i[y][x],b=c,_=c+=M*n;p[y+"-"+x]={index:y,subindex:x,startAngle:b,endAngle:_,value:M}}r[y]={index:y,startAngle:f,endAngle:c,value:(c-f)/n},c+=l}for(h=-1;++h<u;)for(g=h-1;++g<u;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}s&&t()}function t(){e.sort(function(n,t){return s((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,i,u,o,a,s,c={},l=0;return c.matrix=function(n){return arguments.length?(u=(i=n)&&i.length,e=r=null,c):i},c.padding=function(n){return arguments.length?(l=n,e=r=null,c):l},c.sortGroups=function(n){return arguments.length?(o=n,e=r=null,c):o},c.sortSubgroups=function(n){return arguments.length?(a=n,e=null,c):a},c.sortChords=function(n){return arguments.length?(s=n,e&&t(),c):s},c.chords=function(){return e||n(),e},c.groups=function(){return r||n(),r},c},Wo.layout.force=function(){function n(n){return function(t,e,r,i){if(t.point!==n){var u=t.cx-n.x,o=t.cy-n.y,a=i-e,s=u*u+o*o;if(s>a*a/d){if(p>s){var c=t.charge/s;n.px-=u*c,n.py-=o*c}return!0}if(t.point&&s&&p>s){var c=t.pointCharge/s;n.px-=u*c,n.py-=o*c}}return!t.charge}}function t(n){n.px=Wo.event.x,n.py=Wo.event.y,a.resume()}var e,r,i,u,o,a={},s=Wo.dispatch("start","tick","end"),c=[1,1],l=.9,f=sc,h=cc,g=-30,p=lc,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return s.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,x,M,b=m.length,_=y.length;for(e=0;_>e;++e)a=y[e],f=a.source,h=a.target,x=h.x-f.x,M=h.y-f.y,(p=x*x+M*M)&&(p=r*u[e]*((p=Math.sqrt(p))-i[e])/p,x*=p,M*=p,h.x-=x*(d=f.weight/(h.weight+f.weight)),h.y-=M*d,f.x+=x*(d=1-d),f.y+=M*d);if((d=r*v)&&(x=c[0]/2,M=c[1]/2,e=-1,d))for(;++e<b;)a=m[e],a.x+=(x-a.x)*d,a.y+=(M-a.y)*d;if(g)for(Ji(t=Wo.geom.quadtree(m),r,o),e=-1;++e<b;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<b;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*l,a.y-=(a.py-(a.py=a.y))*l);s.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(y=n,a):y},a.size=function(n){return arguments.length?(c=n,a):c},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(l=+n,a):l},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(s.start({type:"start",alpha:r=n}),Wo.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(s),a=0;s>a;++a)e[a]=[];for(a=0;c>a;++a){var i=y[a];e[i.source.index].push(i.target),e[i.target.index].push(i.source)}}for(var u,o=e[t],a=-1,c=o.length;++a<c;)if(!isNaN(u=o[a][n]))return u;return Math.random()*r}var t,e,r,s=m.length,l=y.length,p=c[0],v=c[1];for(t=0;s>t;++t)(r=m[t]).index=t,r.weight=0;for(t=0;l>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;s>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(i=[],"function"==typeof f)for(t=0;l>t;++t)i[t]=+f.call(this,y[t],t);else for(t=0;l>t;++t)i[t]=f;if(u=[],"function"==typeof h)for(t=0;l>t;++t)u[t]=+h.call(this,y[t],t);else for(t=0;l>t;++t)u[t]=h;if(o=[],"function"==typeof g)for(t=0;s>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;s>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=Wo.behavior.drag().origin(Ct).on("dragstart.force",Vi).on("drag.force",t).on("dragend.force",Bi)),arguments.length?void this.on("mouseover.force",$i).on("mouseout.force",Wi).call(e):e},Wo.rebind(a,s,"on")};var sc=20,cc=1,lc=1/0;Wo.layout.hierarchy=function(){function n(i){var u,o=[i],a=[];for(i.depth=0;null!=(u=o.pop());)if(a.push(u),(c=e.call(n,u,u.depth))&&(s=c.length)){for(var s,c,l;--s>=0;)o.push(l=c[s]),l.parent=u,l.depth=u.depth+1;r&&(u.value=0),u.children=c}else r&&(u.value=+r.call(n,u,u.depth)||0),delete u.children;return Ki(i,function(n){var e,i;t&&(e=n.children)&&e.sort(t),r&&(i=n.parent)&&(i.value+=n.value)}),a}var t=eu,e=nu,r=tu;return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Gi(t,function(n){n.children&&(n.value=0)}),Ki(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},Wo.layout.partition=function(){function n(t,e,r,i){var u=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,u&&(o=u.length)){var o,a,s,c=-1;for(r=t.value?r/t.value:0;++c<o;)n(a=u[c],e,s=a.value*r,i),e+=s}}function t(n){var e=n.children,r=0;if(e&&(i=e.length))for(var i,u=-1;++u<i;)r=Math.max(r,t(e[u]));return 1+r}function e(e,u){var o=r.call(this,e,u);return n(o[0],0,i[0],i[1]/t(o[0])),o}var r=Wo.layout.hierarchy(),i=[1,1];return e.size=function(n){return arguments.length?(i=n,e):i},Qi(e,r)},Wo.layout.pie=function(){function n(u){var o=u.map(function(e,r){return+t.call(n,e,r)}),a=+("function"==typeof r?r.apply(this,arguments):r),s=(("function"==typeof i?i.apply(this,arguments):i)-a)/Wo.sum(o),c=Wo.range(u.length);null!=e&&c.sort(e===fc?function(n,t){return o[t]-o[n]}:function(n,t){return e(u[n],u[t])});var l=[];return c.forEach(function(n){var t;l[n]={data:u[n],value:t=o[n],startAngle:a,endAngle:a+=t*s}}),l}var t=Number,e=fc,r=0,i=Ca;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(i=t,n):i},n};var fc={};Wo.layout.stack=function(){function n(a,s){var c=a.map(function(e,r){return t.call(n,e,r)}),l=c.map(function(t){return t.map(function(t,e){return[u.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,l,s);c=Wo.permute(c,f),l=Wo.permute(l,f);var h,g,p,v=r.call(n,l,s),d=c.length,m=c[0].length;for(g=0;m>g;++g)for(i.call(n,c[0][g],p=v[g],l[0][g][1]),h=1;d>h;++h)i.call(n,c[h][g],p+=l[h-1][g][1],l[h][g][1]);return a}var t=Ct,e=au,r=su,i=ou,u=iu,o=uu;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:hc.get(t)||au,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:gc.get(t)||su,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(i=t,n):i},n};var hc=Wo.map({"inside-out":function(n){var t,e,r=n.length,i=n.map(cu),u=n.map(lu),o=Wo.range(r).sort(function(n,t){return i[n]-i[t]
}),a=0,s=0,c=[],l=[];for(t=0;r>t;++t)e=o[t],s>a?(a+=u[e],c.push(e)):(s+=u[e],l.push(e));return l.reverse().concat(c)},reverse:function(n){return Wo.range(n.length).reverse()},"default":au}),gc=Wo.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,o=[],a=0,s=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;u>e;++e)s[e]=(a-o[e])/2;return s},wiggle:function(n){var t,e,r,i,u,o,a,s,c,l=n.length,f=n[0],h=f.length,g=[];for(g[0]=s=c=0,e=1;h>e;++e){for(t=0,i=0;l>t;++t)i+=n[t][e][1];for(t=0,u=0,a=f[e][0]-f[e-1][0];l>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;u+=o*n[t][e][1]}g[e]=s-=i?u/i*a:0,c>s&&(c=s)}for(e=0;h>e;++e)g[e]-=c;return g},expand:function(n){var t,e,r,i=n.length,u=n[0].length,o=1/i,a=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=o}for(e=0;u>e;++e)a[e]=0;return a},zero:su});Wo.layout.histogram=function(){function n(n,u){for(var o,a,s=[],c=n.map(e,this),l=r.call(this,c,u),f=i.call(this,l,c,u),u=-1,h=c.length,g=f.length-1,p=t?1:1/h;++u<g;)o=s[u]=[],o.dx=f[u+1]-(o.x=f[u]),o.y=0;if(g>0)for(u=-1;++u<h;)a=c[u],a>=l[0]&&a<=l[1]&&(o=s[Wo.bisect(f,a,1,g)-1],o.y+=p,o.push(n[u]));return s}var t=!0,e=Number,r=pu,i=hu;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=Et(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return gu(n,t)}:Et(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},Wo.layout.pack=function(){function n(n,u){var o=e.call(this,n,u),a=o[0],s=i[0],c=i[1],l=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Ki(a,function(n){n.r=+l(n.value)}),Ki(a,xu),r){var f=r*(t?1:Math.max(2*a.r/s,2*a.r/c))/2;Ki(a,function(n){n.r+=f}),Ki(a,xu),Ki(a,function(n){n.r-=f})}return _u(a,s/2,c/2,t?1:1/Math.max(2*a.r/s,2*a.r/c)),o}var t,e=Wo.layout.hierarchy().sort(vu),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Qi(n,e)},Wo.layout.tree=function(){function n(n,i){var l=o.call(this,n,i),f=l[0],h=t(f);if(Ki(h,e),h.parent.m=-h.z,Gi(h,r),c)Gi(f,u);else{var g=f,p=f,v=f;Gi(f,function(n){n.x<g.x&&(g=n),n.x>p.x&&(p=n),n.depth>v.depth&&(v=n)});var d=a(g,p)/2-g.x,m=s[0]/(p.x+a(p,g)/2+d),y=s[1]/(v.depth||1);Gi(f,function(n){n.x=(n.x+d)*m,n.y=n.depth*y})}return l}function t(n){for(var t,e={A:null,children:[n]},r=[e];null!=(t=r.pop());)for(var i,u=t.children,o=0,a=u.length;a>o;++o)r.push((u[o]=i={_:u[o],parent:t,children:(i=u[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return e.children[0]}function e(n){var t=n.children,e=n.parent.children,r=n.i?e[n.i-1]:null;if(t.length){Cu(n);var u=(t[0].z+t[t.length-1].z)/2;r?(n.z=r.z+a(n._,r._),n.m=n.z-u):n.z=u}else r&&(n.z=r.z+a(n._,r._));n.parent.A=i(n,r,n.parent.A||e[0])}function r(n){n._.x=n.z+n.parent.m,n.m+=n.parent.m}function i(n,t,e){if(t){for(var r,i=n,u=n,o=t,s=i.parent.children[0],c=i.m,l=u.m,f=o.m,h=s.m;o=Au(o),i=ku(i),o&&i;)s=ku(s),u=Au(u),u.a=n,r=o.z+f-i.z-c+a(o._,i._),r>0&&(Eu(Nu(o,n,e),n,r),c+=r,l+=r),f+=o.m,c+=i.m,h+=s.m,l+=u.m;o&&!Au(u)&&(u.t=o,u.m+=f-l),i&&!ku(s)&&(s.t=i,s.m+=c-h,e=n)}return e}function u(n){n.x*=s[0],n.y=n.depth*s[1]}var o=Wo.layout.hierarchy().sort(null).value(null),a=Su,s=[1,1],c=null;return n.separation=function(t){return arguments.length?(a=t,n):a},n.size=function(t){return arguments.length?(c=null==(s=t)?u:null,n):c?null:s},n.nodeSize=function(t){return arguments.length?(c=null==(s=t)?null:u,n):c?s:null},Qi(n,o)},Wo.layout.cluster=function(){function n(n,u){var o,a=t.call(this,n,u),s=a[0],c=0;Ki(s,function(n){var t=n.children;t&&t.length?(n.x=Pu(t),n.y=Tu(t)):(n.x=o?c+=e(n,o):0,n.y=0,o=n)});var l=zu(s),f=Lu(s),h=l.x-e(l,f)/2,g=f.x+e(f,l)/2;return Ki(s,i?function(n){n.x=(n.x-s.x)*r[0],n.y=(s.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(s.y?n.y/s.y:1))*r[1]}),a}var t=Wo.layout.hierarchy().sort(null).value(null),e=Su,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},Qi(n,t)},Wo.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;++i<u;)r=(e=n[i]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var o,a,s,c=f(e),l=[],h=u.slice(),p=1/0,v="slice"===g?c.dx:"dice"===g?c.dy:"slice-dice"===g?1&e.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(n(h,c.dx*c.dy/e.value),l.area=0;(s=h.length)>0;)l.push(o=h[s-1]),l.area+=o.area,"squarify"!==g||(a=r(l,v))<=p?(h.pop(),p=a):(l.area-=l.pop().area,i(l,v,c,!1),v=Math.min(c.dx,c.dy),l.length=l.area=0,p=1/0);l.length&&(i(l,v,c,!0),l.length=l.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,o=f(t),a=r.slice(),s=[];for(n(a,o.dx*o.dy/t.value),s.area=0;u=a.pop();)s.push(u),s.area+=u.area,null!=u.z&&(i(s,u.z?o.dx:o.dy,o,!a.length),s.length=s.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(u>e&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*p/r,r/(t*u*p)):1/0}function i(n,t,e,r){var i,u=-1,o=n.length,a=e.x,c=e.y,l=t?s(n.area/t):0;if(t==e.dx){for((r||l>e.dy)&&(l=e.dy);++u<o;)i=n[u],i.x=a,i.y=c,i.dy=l,a+=i.dx=Math.min(e.x+e.dx-a,l?s(i.area/l):0);i.z=!0,i.dx+=e.x+e.dx-a,e.y+=l,e.dy-=l}else{for((r||l>e.dx)&&(l=e.dx);++u<o;)i=n[u],i.x=a,i.y=c,i.dx=l,c+=i.dy=Math.min(e.y+e.dy-c,l?s(i.area/l):0);i.z=!1,i.dy+=e.y+e.dy-c,e.x+=l,e.dx-=l}}function u(r){var i=o||a(r),u=i[0];return u.x=0,u.y=0,u.dx=c[0],u.dy=c[1],o&&a.revalue(u),n([u],u.dx*u.dy/u.value),(o?e:t)(u),h&&(o=i),i}var o,a=Wo.layout.hierarchy(),s=Math.round,c=[1,1],l=null,f=qu,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return u.size=function(n){return arguments.length?(c=n,u):c},u.padding=function(n){function t(t){var e=n.call(u,t,t.depth);return null==e?qu(t):Du(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Du(t,n)}if(!arguments.length)return l;var r;return f=null==(l=n)?qu:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,u},u.round=function(n){return arguments.length?(s=n?Math.round:Number,u):s!=Number},u.sticky=function(n){return arguments.length?(h=n,o=null,u):h},u.ratio=function(n){return arguments.length?(p=n,u):p},u.mode=function(n){return arguments.length?(g=n+"",u):g},Qi(u,a)},Wo.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=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 n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=Wo.random.normal.apply(Wo,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=Wo.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},Wo.scale={};var pc={floor:Ct,ceil:Ct};Wo.scale.linear=function(){return Ou([0,1],[0,1],mi,!1)};var vc={s:1,g:1,p:1,r:1,e:1};Wo.scale.log=function(){return Ju(Wo.scale.linear().domain([0,1]),10,!0,[1,10])};var dc=Wo.format(".0e"),mc={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};Wo.scale.pow=function(){return Qu(Wo.scale.linear(),1,[0,1])},Wo.scale.sqrt=function(){return Wo.scale.pow().exponent(.5)},Wo.scale.ordinal=function(){return Ku([],{t:"range",a:[[]]})},Wo.scale.category10=function(){return Wo.scale.ordinal().range(yc)},Wo.scale.category20=function(){return Wo.scale.ordinal().range(xc)},Wo.scale.category20b=function(){return Wo.scale.ordinal().range(Mc)},Wo.scale.category20c=function(){return Wo.scale.ordinal().range(bc)};var yc=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(Mt),xc=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(Mt),Mc=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(Mt),bc=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(Mt);Wo.scale.quantile=function(){return no([],[])},Wo.scale.quantize=function(){return to(0,1,[0,1])},Wo.scale.threshold=function(){return eo([.5],[0,1])},Wo.scale.identity=function(){return ro([0,1])},Wo.svg={},Wo.svg.arc=function(){function n(){var n=t.apply(this,arguments),u=e.apply(this,arguments),o=r.apply(this,arguments)+_c,a=i.apply(this,arguments)+_c,s=(o>a&&(s=o,o=a,a=s),a-o),c=Ea>s?"0":"1",l=Math.cos(o),f=Math.sin(o),h=Math.cos(a),g=Math.sin(a);return s>=wc?n?"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"Z":n?"M"+u*l+","+u*f+"A"+u+","+u+" 0 "+c+",1 "+u*h+","+u*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+c+",0 "+n*l+","+n*f+"Z":"M"+u*l+","+u*f+"A"+u+","+u+" 0 "+c+",1 "+u*h+","+u*g+"L0,0Z"}var t=io,e=uo,r=oo,i=ao;return n.innerRadius=function(e){return arguments.length?(t=Et(e),n):t},n.outerRadius=function(t){return arguments.length?(e=Et(t),n):e},n.startAngle=function(t){return arguments.length?(r=Et(t),n):r},n.endAngle=function(t){return arguments.length?(i=Et(t),n):i},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,u=(r.apply(this,arguments)+i.apply(this,arguments))/2+_c;return[Math.cos(u)*n,Math.sin(u)*n]},n};var _c=-Na,wc=Ca-Ta;Wo.svg.line=function(){return so(Ct)};var Sc=Wo.map({linear:co,"linear-closed":lo,step:fo,"step-before":ho,"step-after":go,basis:Mo,"basis-open":bo,"basis-closed":_o,bundle:wo,cardinal:mo,"cardinal-open":po,"cardinal-closed":vo,monotone:No});Sc.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var kc=[0,2/3,1/3,0],Ac=[0,1/3,2/3,0],Ec=[0,1/6,2/3,1/6];Wo.svg.line.radial=function(){var n=so(To);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},ho.reverse=go,go.reverse=ho,Wo.svg.area=function(){return Po(Ct)},Wo.svg.area.radial=function(){var n=Po(To);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},Wo.svg.chord=function(){function n(n,a){var s=t(this,u,n,a),c=t(this,o,n,a);return"M"+s.p0+r(s.r,s.p1,s.a1-s.a0)+(e(s,c)?i(s.r,s.p1,s.r,s.p0):i(s.r,s.p1,c.r,c.p0)+r(c.r,c.p1,c.a1-c.a0)+i(c.r,c.p1,s.r,s.p0))+"Z"}function t(n,t,e,r){var i=t.call(n,e,r),u=a.call(n,i,r),o=s.call(n,i,r)+_c,l=c.call(n,i,r)+_c;return{r:u,a0:o,a1:l,p0:[u*Math.cos(o),u*Math.sin(o)],p1:[u*Math.cos(l),u*Math.sin(l)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Ea)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var u=yr,o=xr,a=zo,s=oo,c=ao;return n.radius=function(t){return arguments.length?(a=Et(t),n):a},n.source=function(t){return arguments.length?(u=Et(t),n):u},n.target=function(t){return arguments.length?(o=Et(t),n):o},n.startAngle=function(t){return arguments.length?(s=Et(t),n):s},n.endAngle=function(t){return arguments.length?(c=Et(t),n):c},n},Wo.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),o=e.call(this,n,i),a=(u.y+o.y)/2,s=[u,{x:u.x,y:a},{x:o.x,y:a},o];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var t=yr,e=xr,r=Lo;return n.source=function(e){return arguments.length?(t=Et(e),n):t},n.target=function(t){return arguments.length?(e=Et(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},Wo.svg.diagonal.radial=function(){var n=Wo.svg.diagonal(),t=Lo,e=n.projection;return n.projection=function(n){return arguments.length?e(qo(t=n)):t},n},Wo.svg.symbol=function(){function n(n,r){return(Cc.get(t.call(this,n,r))||jo)(e.call(this,n,r))}var t=Ro,e=Do;return n.type=function(e){return arguments.length?(t=Et(e),n):t},n.size=function(t){return arguments.length?(e=Et(t),n):e},n};var Cc=Wo.map({circle:jo,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*zc)),e=t*zc;return"M0,"+-t+"L"+e+",0 0,"+t+" "+-e+",0Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Pc),e=t*Pc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});Wo.svg.symbolTypes=Cc.keys();var Nc,Tc,Pc=Math.sqrt(3),zc=Math.tan(30*za),Lc=[],qc=0;Lc.call=xa.call,Lc.empty=xa.empty,Lc.node=xa.node,Lc.size=xa.size,Wo.transition=function(n){return arguments.length?Nc?n.transition():n:_a.transition()},Wo.transition.prototype=Lc,Lc.select=function(n){var t,e,r,i=this.id,u=[];n=E(n);for(var o=-1,a=this.length;++o<a;){u.push(t=[]);for(var s=this[o],c=-1,l=s.length;++c<l;)(r=s[c])&&(e=n.call(r,r.__data__,c,o))?("__data__"in r&&(e.__data__=r.__data__),Ho(e,c,i,r.__transition__[i]),t.push(e)):t.push(null)}return Uo(u,i)},Lc.selectAll=function(n){var t,e,r,i,u,o=this.id,a=[];n=C(n);for(var s=-1,c=this.length;++s<c;)for(var l=this[s],f=-1,h=l.length;++f<h;)if(r=l[f]){u=r.__transition__[o],e=n.call(r,r.__data__,f,s),a.push(t=[]);for(var g=-1,p=e.length;++g<p;)(i=e[g])&&Ho(i,g,o,u),t.push(i)}return Uo(a,o)},Lc.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=I(n));for(var u=0,o=this.length;o>u;u++){i.push(t=[]);for(var e=this[u],a=0,s=e.length;s>a;a++)(r=e[a])&&n.call(r,r.__data__,a,u)&&t.push(r)}return Uo(i,this.id)},Lc.tween=function(n,t){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(n):H(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},Lc.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function i(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function u(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Fi:mi,a=Wo.ns.qualify(n);return Io(this,"attr."+n,t,a.local?u:i)},Lc.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=Wo.ns.qualify(n);return this.tween("attr."+n,i.local?r:e)},Lc.style=function(n,t,e){function r(){this.style.removeProperty(n)}function i(t){return null==t?r:(t+="",function(){var r,i=na.getComputedStyle(this,null).getPropertyValue(n);return i!==t&&(r=mi(i,t),function(t){this.style.setProperty(n,r(t),e)})})}var u=arguments.length;if(3>u){if("string"!=typeof n){2>u&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Io(this,"style."+n,t,i)},Lc.styleTween=function(n,t,e){function r(r,i){var u=t.call(this,r,i,na.getComputedStyle(this,null).getPropertyValue(n));return u&&function(t){this.style.setProperty(n,u(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Lc.text=function(n){return Io(this,"text",n,Fo)},Lc.remove=function(){return this.each("end.transition",function(){var n;this.__transition__.count<2&&(n=this.parentNode)&&n.removeChild(this)})},Lc.ease=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:("function"!=typeof n&&(n=Wo.ease.apply(Wo,arguments)),H(this,function(e){e.__transition__[t].ease=n}))},Lc.delay=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].delay:H(this,"function"==typeof n?function(e,r,i){e.__transition__[t].delay=+n.call(e,e.__data__,r,i)}:(n=+n,function(e){e.__transition__[t].delay=n}))},Lc.duration=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].duration:H(this,"function"==typeof n?function(e,r,i){e.__transition__[t].duration=Math.max(1,n.call(e,e.__data__,r,i))}:(n=Math.max(1,n),function(e){e.__transition__[t].duration=n}))},Lc.each=function(n,t){var e=this.id;if(arguments.length<2){var r=Tc,i=Nc;Nc=e,H(this,function(t,r,i){Tc=t.__transition__[e],n.call(t,t.__data__,r,i)}),Tc=r,Nc=i}else H(this,function(r){var i=r.__transition__[e];(i.event||(i.event=Wo.dispatch("start","end"))).on(n,t)});return this},Lc.transition=function(){for(var n,t,e,r,i=this.id,u=++qc,o=[],a=0,s=this.length;s>a;a++){o.push(n=[]);for(var t=this[a],c=0,l=t.length;l>c;c++)(e=t[c])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Ho(e,c,u,r)),n.push(e)}return Uo(o,u)},Wo.svg.axis=function(){function n(n){n.each(function(){var n,c=Wo.select(this),l=this.__chart__||e,f=this.__chart__=e.copy(),h=null==s?f.ticks?f.ticks.apply(f,a):f.domain():s,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):Ct:t,p=c.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Ta),d=Wo.transition(p.exit()).style("opacity",Ta).remove(),m=Wo.transition(p.order()).style("opacity",1),y=ju(f),x=c.selectAll(".domain").data([0]),M=(x.enter().append("path").attr("class","domain"),Wo.transition(x));v.append("line"),v.append("text");var b=v.select("line"),_=m.select("line"),w=p.select("text").text(g),S=v.select("text"),k=m.select("text");switch(r){case"bottom":n=Oo,b.attr("y2",i),S.attr("y",Math.max(i,0)+o),_.attr("x2",0).attr("y2",i),k.attr("x",0).attr("y",Math.max(i,0)+o),w.attr("dy",".71em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+u+"V0H"+y[1]+"V"+u);break;case"top":n=Oo,b.attr("y2",-i),S.attr("y",-(Math.max(i,0)+o)),_.attr("x2",0).attr("y2",-i),k.attr("x",0).attr("y",-(Math.max(i,0)+o)),w.attr("dy","0em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+-u+"V0H"+y[1]+"V"+-u);break;case"left":n=Yo,b.attr("x2",-i),S.attr("x",-(Math.max(i,0)+o)),_.attr("x2",-i).attr("y2",0),k.attr("x",-(Math.max(i,0)+o)).attr("y",0),w.attr("dy",".32em").style("text-anchor","end"),M.attr("d","M"+-u+","+y[0]+"H0V"+y[1]+"H"+-u);break;case"right":n=Yo,b.attr("x2",i),S.attr("x",Math.max(i,0)+o),_.attr("x2",i).attr("y2",0),k.attr("x",Math.max(i,0)+o).attr("y",0),w.attr("dy",".32em").style("text-anchor","start"),M.attr("d","M"+u+","+y[0]+"H0V"+y[1]+"H"+u)}if(f.rangeBand){var A=f,E=A.rangeBand()/2;l=f=function(n){return A(n)+E}}else l.rangeBand?l=f:d.call(n,f);v.call(n,l),m.call(n,f)})}var t,e=Wo.scale.linear(),r=Dc,i=6,u=6,o=3,a=[10],s=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Rc?t+"":Dc,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(s=t,n):s},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(i=+t,u=+arguments[e-1],n):i},n.innerTickSize=function(t){return arguments.length?(i=+t,n):i},n.outerTickSize=function(t){return arguments.length?(u=+t,n):u},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Dc="bottom",Rc={top:1,right:1,bottom:1,left:1};Wo.svg.brush=function(){function n(u){u.each(function(){var u=Wo.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),o=u.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),u.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=u.selectAll(".resize").data(p,Ct);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return jc[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var l,f=Wo.transition(u),h=Wo.transition(o);s&&(l=ju(s),h.attr("x",l[0]).attr("width",l[1]-l[0]),e(f)),c&&(l=ju(c),h.attr("y",l[0]).attr("height",l[1]-l[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+l[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",l[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",l[1]-l[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function i(){function i(){32==Wo.event.keyCode&&(C||(y=null,T[0]-=l[1],T[1]-=f[1],C=2),w())}function p(){32==Wo.event.keyCode&&2==C&&(T[0]+=l[1],T[1]+=f[1],C=0,w())}function v(){var n=Wo.mouse(M),i=!1;x&&(n[0]+=x[0],n[1]+=x[1]),C||(Wo.event.altKey?(y||(y=[(l[0]+l[1])/2,(f[0]+f[1])/2]),T[0]=l[+(n[0]<y[0])],T[1]=f[+(n[1]<y[1])]):y=null),A&&d(n,s,0)&&(e(S),i=!0),E&&d(n,c,1)&&(r(S),i=!0),i&&(t(S),_({type:"brush",mode:C?"move":"resize"}))}function d(n,t,e){var r,i,a=ju(t),s=a[0],c=a[1],p=T[e],v=e?f:l,d=v[1]-v[0];return C&&(s-=p,c-=d+p),r=(e?g:h)?Math.max(s,Math.min(c,n[e])):n[e],C?i=(r+=p)+d:(y&&(p=Math.max(s,Math.min(c,2*y[e]-r))),r>p?(i=r,r=p):i=p),v[0]!=r||v[1]!=i?(e?o=null:u=null,v[0]=r,v[1]=i,!0):void 0}function m(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),Wo.select("body").style("cursor",null),P.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),N(),_({type:"brushend"})}var y,x,M=this,b=Wo.select(Wo.event.target),_=a.of(M,arguments),S=Wo.select(M),k=b.datum(),A=!/^(n|s)$/.test(k)&&s,E=!/^(e|w)$/.test(k)&&c,C=b.classed("extent"),N=$(),T=Wo.mouse(M),P=Wo.select(na).on("keydown.brush",i).on("keyup.brush",p);if(Wo.event.changedTouches?P.on("touchmove.brush",v).on("touchend.brush",m):P.on("mousemove.brush",v).on("mouseup.brush",m),S.interrupt().selectAll("*").interrupt(),C)T[0]=l[0]-T[0],T[1]=f[0]-T[1];else if(k){var z=+/w$/.test(k),L=+/^n/.test(k);x=[l[1-z]-T[0],f[1-L]-T[1]],T[0]=l[z],T[1]=f[L]}else Wo.event.altKey&&(y=T.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),Wo.select("body").style("cursor",b.style("cursor")),_({type:"brushstart"}),v()}var u,o,a=k(n,"brushstart","brush","brushend"),s=null,c=null,l=[0,0],f=[0,0],h=!0,g=!0,p=Uc[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:l,y:f,i:u,j:o},e=this.__chart__||t;this.__chart__=t,Nc?Wo.select(this).transition().each("start.brush",function(){u=e.i,o=e.j,l=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=yi(l,t.x),r=yi(f,t.y);return u=o=null,function(i){l=t.x=e(i),f=t.y=r(i),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){u=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(s=t,p=Uc[!s<<1|!c],n):s},n.y=function(t){return arguments.length?(c=t,p=Uc[!s<<1|!c],n):c},n.clamp=function(t){return arguments.length?(s&&c?(h=!!t[0],g=!!t[1]):s?h=!!t:c&&(g=!!t),n):s&&c?[h,g]:s?h:c?g:null},n.extent=function(t){var e,r,i,a,h;return arguments.length?(s&&(e=t[0],r=t[1],c&&(e=e[0],r=r[0]),u=[e,r],s.invert&&(e=s(e),r=s(r)),e>r&&(h=e,e=r,r=h),(e!=l[0]||r!=l[1])&&(l=[e,r])),c&&(i=t[0],a=t[1],s&&(i=i[1],a=a[1]),o=[i,a],c.invert&&(i=c(i),a=c(a)),i>a&&(h=i,i=a,a=h),(i!=f[0]||a!=f[1])&&(f=[i,a])),n):(s&&(u?(e=u[0],r=u[1]):(e=l[0],r=l[1],s.invert&&(e=s.invert(e),r=s.invert(r)),e>r&&(h=e,e=r,r=h))),c&&(o?(i=o[0],a=o[1]):(i=f[0],a=f[1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(h=i,i=a,a=h))),s&&c?[[e,i],[r,a]]:s?[e,r]:c&&[i,a])},n.clear=function(){return n.empty()||(l=[0,0],f=[0,0],u=o=null),n},n.empty=function(){return!!s&&l[0]==l[1]||!!c&&f[0]==f[1]},Wo.rebind(n,a,"on")};var jc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Uc=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ic=is.format=ls.timeFormat,Fc=Ic.utc,Hc=Fc("%Y-%m-%dT%H:%M:%S.%LZ");Ic.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Zo:Hc,Zo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Zo.toString=Hc.toString,is.second=Ft(function(n){return new us(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),is.seconds=is.second.range,is.seconds.utc=is.second.utc.range,is.minute=Ft(function(n){return new us(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),is.minutes=is.minute.range,is.minutes.utc=is.minute.utc.range,is.hour=Ft(function(n){var t=n.getTimezoneOffset()/60;return new us(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),is.hours=is.hour.range,is.hours.utc=is.hour.utc.range,is.month=Ft(function(n){return n=is.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),is.months=is.month.range,is.months.utc=is.month.utc.range;var Oc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Yc=[[is.second,1],[is.second,5],[is.second,15],[is.second,30],[is.minute,1],[is.minute,5],[is.minute,15],[is.minute,30],[is.hour,1],[is.hour,3],[is.hour,6],[is.hour,12],[is.day,1],[is.day,2],[is.week,1],[is.month,1],[is.month,3],[is.year,1]],Zc=Ic.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",Ce]]),Xc={range:function(n,t,e){return Wo.range(Math.ceil(n/e)*e,+t,e).map(Vo)},floor:Ct,ceil:Ct};Yc.year=is.year,is.scale=function(){return Xo(Wo.scale.linear(),Yc,Zc)};var Vc=Yc.map(function(n){return[n[0].utc,n[1]]}),Bc=Fc.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",Ce]]);Vc.year=is.year.utc,is.scale.utc=function(){return Xo(Wo.scale.linear(),Vc,Bc)},Wo.text=Nt(function(n){return n.responseText}),Wo.json=function(n,t){return Tt(n,"application/json",Bo,t)},Wo.html=function(n,t){return Tt(n,"text/html",$o,t)},Wo.xml=Nt(function(n){return n.responseXML}),r=Wo,!("function"==typeof r?(i=r.call(t,e,t,n),void 0!==i&&(n.exports=i)):n.exports=r),this.d3=Wo}()},function(n){function t(n,t,e){var r,i,u,o=t*t-4*n*e;return 0===n?0===t?0===e?[void 0,void 0,void 0]:[]:[-e/t]:0>o?[]:0===o?[-t/(2*n)]:(r=Math.sqrt(o),t>=0?(i=-t-r,[i/(2*n),2*e/i]):(u=-t+r,[2*e/u,u/(2*n)]))}n.exports=t}]);
<!DOCTYPE html>
<head>
<meta charset='utf-8'>
</head>
<body>
<div id='example'></div>
<script src="bundle.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment