Skip to content

Instantly share code, notes, and snippets.

@hnakamur
Last active August 29, 2015 14:05
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/73af30f05fced219a33f to your computer and use it in GitHub Desktop.
Save hnakamur/73af30f05fced219a33f to your computer and use it in GitHub Desktop.
bezier curve intersections
!function(t){function n(r){if(e[r])return e[r].exports;var i=e[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}var e={};return n.m=t,n.c=e,n.p="dist/",n(0)}([function(t,n,e){function r(t){t.x=c.event.x,t.y=c.event.y,c.select(this).attr({cx:t.x,cy:t.y}),t.pathElem.attr("d",i),t.controlLineElem&&t.controlLineElem.attr("d",o),v.selectAll("text.handle-text.path"+t.pathID+".p"+(t.handleID+1)).attr({x:t.x,y:t.y}).text(u(t,t.handleID)),s()}function i(t){var n=t.points;switch(t.type){case"L":return["M",n[0].x," ",n[0].y," ",n[1].x," ",n[1].y].join("");case"Q":return["M",n[0].x," ",n[0].y,"Q",n[1].x," ",n[1].y," ",n[2].x," ",n[2].y].join("");case"C":return["M",n[0].x," ",n[0].y,"C",n[1].x," ",n[1].y," ",n[2].x," ",n[2].y," ",n[3].x," ",n[3].y].join("")}}function o(t){var n=[];return t.points.forEach(function(t){n.push(t.x),n.push(t.y)}),"M"+n.join(" ")}function u(t,n){return"p"+(n+1)+": "+t.x+"/"+t.y}function a(){var t=x[0].points,n=x[1].points;return l.Intersection.intersectBezier2Bezier3(new l.Point2D(t[0].x,t[0].y),new l.Point2D(t[1].x,t[1].y),new l.Point2D(t[2].x,t[2].y),new l.Point2D(n[0].x,n[0].y),new l.Point2D(n[1].x,n[1].y),new l.Point2D(n[2].x,n[2].y),new l.Point2D(n[3].x,n[3].y))}function s(){var t,n;t=a(),console.log("intersections points",JSON.stringify(t.points)),n=d.selectAll("circle.intersections").data(t.points),n.attr({cx:function(t){return t.x},cy:function(t){return t.y}}),n.enter().append("circle").attr({"class":"intersections",cx:function(t){return t.x},cy:function(t){return t.y},r:h}),n.exit().remove()}var c=e(4);e(2);var l=e(1),f=c.select("#example").append("svg").attr({width:400,height:400}),y=8,h=4,x=[{type:"Q",points:[{x:25,y:150},{x:180,y:30},{x:320,y:254}]},{type:"C",points:[{x:150,y:125},{x:40,y:30},{x:240,y:120},{x:145,y:200}]}],p=f.append("g").attr("class","control-line-layer"),g=f.append("g").attr("class","main-layer"),d=f.append("g").attr("class","intersections-layer"),v=f.append("g").attr("class","handle-text-layer"),m=f.append("g").attr("class","handle-layer"),M=c.behavior.drag().origin(function(t){return t}).on("drag",r);g.selectAll("path.curves").data(x).enter().append("path").attr({"class":function(t,n){return"curves path"+n},d:i}).each(function(t,n){var e,r,i=c.select(this);"L"!==t.type&&(e=p.selectAll("path.control-line.path"+n).data([t]).enter().append("path").attr({"class":"control-line path"+n,d:o(t)})),r=v.selectAll("text.handle-text.path"+n).data(t.points).enter().append("text").attr({"class":function(t,e){return"handle-text path"+n+" p"+(e+1)},x:function(t){return t.x},y:function(t){return t.y},dx:10,dy:0}).text(u),m.selectAll("circle.handle.path"+n).data(t.points).enter().append("circle").attr({"class":"handle path"+n,cx:function(t){return t.x},cy:function(t){return t.y},r:y}).each(function(t,r){t.pathID=n,t.handleID=r,t.pathElem=i,t.controlLineElem=e}).call(M)}),s()},function(t,n,e){n.Intersection=e(6),n.IntersectionParams=e(7),n.Point2D=e(8).Point2D},function(t,n,e){e(5)(e(3))},function(t){t.exports="svg{border:1px solid #000}.curves{stroke:#000;fill:none}.control-line{stroke:green;fill:none}.handle{fill:red;opacity:.5;cursor:move}.handle-text{font-size:12px;font-family:'Noto Sans Japanese',sans}.intersections{fill:#00f;opacity:.5}"},function(t,n,e){var r,i;!function(){function o(t,n){return n>t?-1:t>n?1:t>=n?0:0/0}function u(t){return null!=t&&!isNaN(t)}function a(t){return{left:function(n,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)<0?r=o+1:i=o}return r},right:function(n,e,r,i){for(arguments.length<3&&(r=0),arguments.length<4&&(i=n.length);i>r;){var o=r+i>>>1;t(n[o],e)>0?i=o:r=o+1}return r}}}function s(t){return t.length}function c(t){for(var n=1;t*n%1;)n*=10;return n}function l(t,n){try{for(var e in n)Object.defineProperty(t.prototype,e,{value:n[e],enumerable:!1})}catch(r){t.prototype=n}}function f(){}function y(t){return fa+t in this}function h(t){return t=fa+t,t in this&&delete this[t]}function x(){var t=[];return this.forEach(function(n){t.push(n)}),t}function p(){var t=0;for(var n in this)n.charCodeAt(0)===ya&&++t;return t}function g(){for(var t in this)if(t.charCodeAt(0)===ya)return!1;return!0}function d(){}function v(t,n,e){return function(){var r=e.apply(n,arguments);return r===n?t:r}}function m(t,n){if(n in t)return n;n=n.charAt(0).toUpperCase()+n.substring(1);for(var e=0,r=ha.length;r>e;++e){var i=ha[e]+n;if(i in t)return i}}function M(){}function w(){}function b(t){function n(){for(var n,r=e,i=-1,o=r.length;++i<o;)(n=r[i].on)&&n.apply(this,arguments);return t}var e=[],r=new f;return n.on=function(n,i){var o,u=r.get(n);return arguments.length<2?u&&u.on:(u&&(u.on=null,e=e.slice(0,o=e.indexOf(u)).concat(e.slice(o+1)),r.remove(n)),i&&e.push(r.set(n,{on:i})),t)},n}function _(){Ju.event.preventDefault()}function E(){for(var t,n=Ju.event;t=n.sourceEvent;)n=t;return n}function S(t){for(var n=new w,e=0,r=arguments.length;++e<r;)n[arguments[e]]=b(n);return n.of=function(e,r){return function(i){try{var o=i.sourceEvent=Ju.event;i.target=t,Ju.event=i,n[i.type].apply(e,r)}finally{Ju.event=o}}},n}function N(t){return pa(t,Ma),t}function k(t){return"function"==typeof t?t:function(){return ga(t,this)}}function A(t){return"function"==typeof t?t:function(){return da(t,this)}}function C(t,n){function e(){this.removeAttribute(t)}function r(){this.removeAttributeNS(t.space,t.local)}function i(){this.setAttribute(t,n)}function o(){this.setAttributeNS(t.space,t.local,n)}function u(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}function a(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}return t=Ju.ns.qualify(t),null==n?t.local?r:e:"function"==typeof n?t.local?a:u:t.local?o:i}function L(t){return t.trim().replace(/\s+/g," ")}function P(t){return new RegExp("(?:^|\\s+)"+Ju.requote(t)+"(?:\\s+|$)","g")}function z(t){return(t+"").trim().split(/^|\s+/)}function q(t,n){function e(){for(var e=-1;++e<i;)t[e](this,n)}function r(){for(var e=-1,r=n.apply(this,arguments);++e<i;)t[e](this,r)}t=z(t).map(R);var i=t.length;return"function"==typeof n?r:e}function R(t){var n=P(t);return function(e,r){if(i=e.classList)return r?i.add(t):i.remove(t);var i=e.getAttribute("class")||"";r?(n.lastIndex=0,n.test(i)||e.setAttribute("class",L(i+" "+t))):e.setAttribute("class",L(i.replace(n," ")))}}function I(t,n,e){function r(){this.style.removeProperty(t)}function i(){this.style.setProperty(t,n,e)}function o(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}return null==n?r:"function"==typeof n?o:i}function T(t,n){function e(){delete this[t]}function r(){this[t]=n}function i(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}return null==n?e:"function"==typeof n?i:r}function D(t){return"function"==typeof t?t:(t=Ju.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,t)}}function U(t){return{__data__:t}}function j(t){return function(){return ma(this,t)}}function O(t){return arguments.length||(t=o),function(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}}function F(t,n){for(var e=0,r=t.length;r>e;e++)for(var i,o=t[e],u=0,a=o.length;a>u;u++)(i=o[u])&&n(i,u,e);return t}function H(t){return pa(t,ba),t}function B(t){var n,e;return function(r,i,o){var u,a=t[o].update,s=a.length;for(o!=e&&(e=o,n=0),i>=n&&(n=i+1);!(u=a[n])&&++n<s;);return u}}function Y(){var t=this.__transition__;t&&++t.active}function V(t,n,e){function r(){var n=this[u];n&&(this.removeEventListener(t,n,n.$),delete this[u])}function i(){var i=s(n,Gu(arguments));r.call(this),this.addEventListener(t,this[u]=i,i.$=e),i._=n}function o(){var n,e=new RegExp("^__on([^.]+)"+Ju.requote(t)+"$");for(var r in this)if(n=r.match(e)){var i=this[r];this.removeEventListener(n[1],i,i.$),delete this[r]}}var u="__on"+t,a=t.indexOf("."),s=Z;a>0&&(t=t.substring(0,a));var c=Ea.get(t);return c&&(t=c,s=X),a?n?i:r:n?M:o}function Z(t,n){return function(e){var r=Ju.event;Ju.event=e,n[0]=this.__data__;try{t.apply(this,n)}finally{Ju.event=r}}}function X(t,n){var e=Z(t,n);return function(t){var n=this,r=t.relatedTarget;r&&(r===n||8&r.compareDocumentPosition(n))||e.call(n,t)}}function $(){var t=".dragsuppress-"+ ++Na,n="click"+t,e=Ju.select(na).on("touchmove"+t,_).on("dragstart"+t,_).on("selectstart"+t,_);if(Sa){var r=ta.style,i=r[Sa];r[Sa]="none"}return function(o){function u(){e.on(n,null)}e.on(t,null),Sa&&(r[Sa]=i),o&&(e.on(n,function(){_(),u()},!0),setTimeout(u,0))}}function Q(t,n){n.changedTouches&&(n=n.changedTouches[0]);var e=t.ownerSVGElement||t;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>ka&&(na.scrollX||na.scrollY)){e=Ju.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=e[0][0].getScreenCTM();ka=!(i.f||i.e),e.remove()}return ka?(r.x=n.pageX,r.y=n.pageY):(r.x=n.clientX,r.y=n.clientY),r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}var o=t.getBoundingClientRect();return[n.clientX-o.left-t.clientLeft,n.clientY-o.top-t.clientTop]}function J(){return Ju.event.changedTouches[0].identifier}function W(){return Ju.event.target}function G(){return na}function K(t){return t>0?1:0>t?-1:0}function tn(t,n,e){return(n[0]-t[0])*(e[1]-t[1])-(n[1]-t[1])*(e[0]-t[0])}function nn(t){return t>1?0:-1>t?Aa:Math.acos(t)}function en(t){return t>1?La:-1>t?-La:Math.asin(t)}function rn(t){return((t=Math.exp(t))-1/t)/2}function on(t){return((t=Math.exp(t))+1/t)/2}function un(t){return((t=Math.exp(2*t))-1)/(t+1)}function an(t){return(t=Math.sin(t/2))*t}function sn(){}function cn(t,n,e){return this instanceof cn?(this.h=+t,this.s=+n,void(this.l=+e)):arguments.length<2?t instanceof cn?new cn(t.h,t.s,t.l):_n(""+t,En,cn):new cn(t,n,e)}function ln(t,n,e){function r(t){return t>360?t-=360:0>t&&(t+=360),60>t?o+(u-o)*t/60:180>t?u:240>t?o+(u-o)*(240-t)/60:o}function i(t){return Math.round(255*r(t))}var o,u;return t=isNaN(t)?0:(t%=360)<0?t+360:t,n=isNaN(n)?0:0>n?0:n>1?1:n,e=0>e?0:e>1?1:e,u=.5>=e?e*(1+n):e+n-e*n,o=2*e-u,new mn(i(t+120),i(t),i(t-120))}function fn(t,n,e){return this instanceof fn?(this.h=+t,this.c=+n,void(this.l=+e)):arguments.length<2?t instanceof fn?new fn(t.h,t.c,t.l):t instanceof hn?pn(t.l,t.a,t.b):pn((t=Sn((t=Ju.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new fn(t,n,e)}function yn(t,n,e){return isNaN(t)&&(t=0),isNaN(n)&&(n=0),new hn(e,Math.cos(t*=qa)*n,Math.sin(t)*n)}function hn(t,n,e){return this instanceof hn?(this.l=+t,this.a=+n,void(this.b=+e)):arguments.length<2?t instanceof hn?new hn(t.l,t.a,t.b):t instanceof fn?yn(t.l,t.c,t.h):Sn((t=mn(t)).r,t.g,t.b):new hn(t,n,e)}function xn(t,n,e){var r=(t+16)/116,i=r+n/500,o=r-e/200;return i=gn(i)*Ya,r=gn(r)*Va,o=gn(o)*Za,new mn(vn(3.2404542*i-1.5371385*r-.4985314*o),vn(-.969266*i+1.8760108*r+.041556*o),vn(.0556434*i-.2040259*r+1.0572252*o))}function pn(t,n,e){return t>0?new fn(Math.atan2(e,n)*Ra,Math.sqrt(n*n+e*e),t):new fn(0/0,0/0,t)}function gn(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function dn(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function vn(t){return Math.round(255*(.00304>=t?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function mn(t,n,e){return this instanceof mn?(this.r=~~t,this.g=~~n,void(this.b=~~e)):arguments.length<2?t instanceof mn?new mn(t.r,t.g,t.b):_n(""+t,mn,ln):new mn(t,n,e)}function Mn(t){return new mn(t>>16,t>>8&255,255&t)}function wn(t){return Mn(t)+""}function bn(t){return 16>t?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function _n(t,n,e){var r,i,o,u=0,a=0,s=0;if(r=/([a-z]+)\((.*)\)/i.exec(t))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return n(kn(i[0]),kn(i[1]),kn(i[2]))}return(o=Qa.get(t))?n(o.r,o.g,o.b):(null==t||"#"!==t.charAt(0)||isNaN(o=parseInt(t.substring(1),16))||(4===t.length?(u=(3840&o)>>4,u=u>>4|u,a=240&o,a=a>>4|a,s=15&o,s=s<<4|s):7===t.length&&(u=(16711680&o)>>16,a=(65280&o)>>8,s=255&o)),n(u,a,s))}function En(t,n,e){var r,i,o=Math.min(t/=255,n/=255,e/=255),u=Math.max(t,n,e),a=u-o,s=(u+o)/2;return a?(i=.5>s?a/(u+o):a/(2-u-o),r=t==u?(n-e)/a+(e>n?6:0):n==u?(e-t)/a+2:(t-n)/a+4,r*=60):(r=0/0,i=s>0&&1>s?0:r),new cn(r,i,s)}function Sn(t,n,e){t=Nn(t),n=Nn(n),e=Nn(e);var r=dn((.4124564*t+.3575761*n+.1804375*e)/Ya),i=dn((.2126729*t+.7151522*n+.072175*e)/Va),o=dn((.0193339*t+.119192*n+.9503041*e)/Za);return hn(116*i-16,500*(r-i),200*(i-o))}function Nn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function kn(t){var n=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*n):n}function An(t){return"function"==typeof t?t:function(){return t}}function Cn(t){return t}function Ln(t){return function(n,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),Pn(n,e,t,r)}}function Pn(t,n,e,r){function i(){var t,n=s.status;if(!n&&s.responseText||n>=200&&300>n||304===n){try{t=e.call(o,s)}catch(r){return void u.error.call(o,r)}u.load.call(o,t)}else u.error.call(o,s)}var o={},u=Ju.dispatch("beforesend","progress","load","error"),a={},s=new XMLHttpRequest,c=null;return!na.XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(t)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=i:s.onreadystatechange=function(){s.readyState>3&&i()},s.onprogress=function(t){var n=Ju.event;Ju.event=t;try{u.progress.call(o,s)}finally{Ju.event=n}},o.header=function(t,n){return t=(t+"").toLowerCase(),arguments.length<2?a[t]:(null==n?delete a[t]:a[t]=n+"",o)},o.mimeType=function(t){return arguments.length?(n=null==t?null:t+"",o):n},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return e=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(Gu(arguments)))}}),o.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),s.open(e,t,!0),null==n||"accept"in a||(a.accept=n+",*/*"),s.setRequestHeader)for(var l in a)s.setRequestHeader(l,a[l]);return null!=n&&s.overrideMimeType&&s.overrideMimeType(n),null!=c&&(s.responseType=c),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),u.beforesend.call(o,s),s.send(null==r?null:r),o},o.abort=function(){return s.abort(),o},Ju.rebind(o,u,"on"),null==r?o:o.get(zn(r))}function zn(t){return 1===t.length?function(n,e){t(null==n?e:null)}:t}function qn(){var t=Rn(),n=In()-t;n>24?(isFinite(n)&&(clearTimeout(Ka),Ka=setTimeout(qn,n)),Ga=0):(Ga=1,ns(qn))}function Rn(){var t=Date.now();for(ts=Ja;ts;)t>=ts.t&&(ts.f=ts.c(t-ts.t)),ts=ts.n;return t}function In(){for(var t,n=Ja,e=1/0;n;)n.f?n=t?t.n=n.n:Ja=n.n:(n.t<e&&(e=n.t),n=(t=n).n);return Wa=t,e}function Tn(t,n){return n-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function Dn(t,n){var e=Math.pow(10,3*la(8-n));return{scale:n>8?function(t){return t/e}:function(t){return t*e},symbol:t}}function Un(t){var n=t.decimal,e=t.thousands,r=t.grouping,i=t.currency,o=r?function(t){for(var n=t.length,i=[],o=0,u=r[0];n>0&&u>0;)i.push(t.substring(n-=u,n+u)),u=r[o=(o+1)%r.length];return i.reverse().join(e)}:Cn;return function(t){var e=rs.exec(t),r=e[1]||" ",u=e[2]||">",a=e[3]||"",s=e[4]||"",c=e[5],l=+e[6],f=e[7],y=e[8],h=e[9],x=1,p="",g="",d=!1;switch(y&&(y=+y.substring(1)),(c||"0"===r&&"="===u)&&(c=r="0",u="=",f&&(l-=Math.floor((l-1)/4))),h){case"n":f=!0,h="g";break;case"%":x=100,g="%",h="f";break;case"p":x=100,g="%",h="r";break;case"b":case"o":case"x":case"X":"#"===s&&(p="0"+h.toLowerCase());case"c":case"d":d=!0,y=0;break;case"s":x=-1,h="r"}"$"===s&&(p=i[0],g=i[1]),"r"!=h||y||(h="g"),null!=y&&("g"==h?y=Math.max(1,Math.min(21,y)):("e"==h||"f"==h)&&(y=Math.max(0,Math.min(20,y)))),h=is.get(h)||jn;var v=c&&f;return function(t){var e=g;if(d&&t%1)return"";var i=0>t||0===t&&0>1/t?(t=-t,"-"):a;if(0>x){var s=Ju.formatPrefix(t,y);t=s.scale(t),e=s.symbol+g}else t*=x;t=h(t,y);var m=t.lastIndexOf("."),M=0>m?t:t.substring(0,m),w=0>m?"":n+t.substring(m+1);!c&&f&&(M=o(M));var b=p.length+M.length+w.length+(v?0:i.length),_=l>b?new Array(b=l-b+1).join(r):"";return v&&(M=o(_+M)),i+=p,t=M+w,("<"===u?i+t+_:">"===u?_+i+t:"^"===u?_.substring(0,b>>=1)+i+t+_.substring(b):i+(v?t:_+t))+e}}}function jn(t){return t+""}function On(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Fn(t,n,e){function r(n){var e=t(n),r=o(e,1);return r-n>n-e?e:r}function i(e){return n(e=t(new us(e-1)),1),e}function o(t,e){return n(t=new us(+t),e),t}function u(t,r,o){var u=i(t),a=[];if(o>1)for(;r>u;)e(u)%o||a.push(new Date(+u)),n(u,1);else for(;r>u;)a.push(new Date(+u)),n(u,1);return a}function a(t,n,e){try{us=On;var r=new On;return r._=t,u(r,n,e)}finally{us=Date}}t.floor=t,t.round=r,t.ceil=i,t.offset=o,t.range=u;var s=t.utc=Hn(t);return s.floor=s,s.round=Hn(r),s.ceil=Hn(i),s.offset=Hn(o),s.range=a,t}function Hn(t){return function(n,e){try{us=On;var r=new On;return r._=n,t(r,e)._}finally{us=Date}}}function Bn(t){function n(t){function n(n){for(var e,i,o,u=[],a=-1,s=0;++a<r;)37===t.charCodeAt(a)&&(u.push(t.substring(s,a)),null!=(i=ss[e=t.charAt(++a)])&&(e=t.charAt(++a)),(o=A[e])&&(e=o(n,null==i?"e"===e?" ":"0":i)),u.push(e),s=a+1);return u.push(t.substring(s,a)),u.join("")}var r=t.length;return n.parse=function(n){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},i=e(r,t,n,0);if(i!=n.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var o=null!=r.Z&&us!==On,u=new(o?On:us);return"j"in r?u.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(u.setFullYear(r.y,0,1),u.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(u.getDay()+5)%7:r.w+7*r.U-(u.getDay()+6)%7)):u.setFullYear(r.y,r.m,r.d),u.setHours(r.H+Math.floor(r.Z/100),r.M+r.Z%100,r.S,r.L),o?u._:u},n.toString=function(){return t},n}function e(t,n,e,r){for(var i,o,u,a=0,s=n.length,c=e.length;s>a;){if(r>=c)return-1;if(i=n.charCodeAt(a++),37===i){if(u=n.charAt(a++),o=C[u in ss?n.charAt(a++):u],!o||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function r(t,n,e){b.lastIndex=0;var r=b.exec(n.substring(e));return r?(t.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(t,n,e){M.lastIndex=0;var r=M.exec(n.substring(e));return r?(t.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function o(t,n,e){N.lastIndex=0;var r=N.exec(n.substring(e));return r?(t.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function u(t,n,e){E.lastIndex=0;var r=E.exec(n.substring(e));return r?(t.m=S.get(r[0].toLowerCase()),e+r[0].length):-1}function a(t,n,r){return e(t,A.c.toString(),n,r)}function s(t,n,r){return e(t,A.x.toString(),n,r)}function c(t,n,r){return e(t,A.X.toString(),n,r)}function l(t,n,e){var r=m.get(n.substring(e,e+=2).toLowerCase());return null==r?-1:(t.p=r,e)}var f=t.dateTime,y=t.date,h=t.time,x=t.periods,p=t.days,g=t.shortDays,d=t.months,v=t.shortMonths;n.utc=function(t){function e(t){try{us=On;var n=new us;return n._=t,r(n)}finally{us=Date}}var r=n(t);return e.parse=function(t){try{us=On;var n=r.parse(t);return n&&n._}finally{us=Date}},e.toString=r.toString,e},n.multi=n.utc.multi=ce;var m=Ju.map(),M=Vn(p),w=Zn(p),b=Vn(g),_=Zn(g),E=Vn(d),S=Zn(d),N=Vn(v),k=Zn(v);x.forEach(function(t,n){m.set(t.toLowerCase(),n)});var A={a:function(t){return g[t.getDay()]},A:function(t){return p[t.getDay()]},b:function(t){return v[t.getMonth()]},B:function(t){return d[t.getMonth()]},c:n(f),d:function(t,n){return Yn(t.getDate(),n,2)},e:function(t,n){return Yn(t.getDate(),n,2)},H:function(t,n){return Yn(t.getHours(),n,2)},I:function(t,n){return Yn(t.getHours()%12||12,n,2)},j:function(t,n){return Yn(1+os.dayOfYear(t),n,3)},L:function(t,n){return Yn(t.getMilliseconds(),n,3)},m:function(t,n){return Yn(t.getMonth()+1,n,2)},M:function(t,n){return Yn(t.getMinutes(),n,2)},p:function(t){return x[+(t.getHours()>=12)]},S:function(t,n){return Yn(t.getSeconds(),n,2)},U:function(t,n){return Yn(os.sundayOfYear(t),n,2)},w:function(t){return t.getDay()},W:function(t,n){return Yn(os.mondayOfYear(t),n,2)},x:n(y),X:n(h),y:function(t,n){return Yn(t.getFullYear()%100,n,2)},Y:function(t,n){return Yn(t.getFullYear()%1e4,n,4)},Z:ae,"%":function(){return"%"}},C={a:r,A:i,b:o,B:u,c:a,d:ne,e:ne,H:re,I:re,j:ee,L:ue,m:te,M:ie,p:l,S:oe,U:$n,w:Xn,W:Qn,x:s,X:c,y:Wn,Y:Jn,Z:Gn,"%":se};return n}function Yn(t,n,e){var r=0>t?"-":"",i=(r?-t:t)+"",o=i.length;return r+(e>o?new Array(e-o+1).join(n)+i:i)}function Vn(t){return new RegExp("^(?:"+t.map(Ju.requote).join("|")+")","i")}function Zn(t){for(var n=new f,e=-1,r=t.length;++e<r;)n.set(t[e].toLowerCase(),e);return n}function Xn(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function $n(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e));return r?(t.U=+r[0],e+r[0].length):-1}function Qn(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e));return r?(t.W=+r[0],e+r[0].length):-1}function Jn(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function Wn(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+2));return r?(t.y=Kn(+r[0]),e+r[0].length):-1}function Gn(t,n,e){return/^[+-]\d{4}$/.test(n=n.substring(e,e+5))?(t.Z=-n,e+5):-1}function Kn(t){return t+(t>68?1900:2e3)}function te(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function ne(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function ee(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+3));return r?(t.j=+r[0],e+r[0].length):-1}function re(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function ie(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function oe(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function ue(t,n,e){cs.lastIndex=0;var r=cs.exec(n.substring(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function ae(t){var n=t.getTimezoneOffset(),e=n>0?"-":"+",r=~~(la(n)/60),i=la(n)%60;return e+Yn(r,"0",2)+Yn(i,"0",2)}function se(t,n,e){ls.lastIndex=0;var r=ls.exec(n.substring(e,e+1));return r?e+r[0].length:-1}function ce(t){for(var n=t.length,e=-1;++e<n;)t[e][0]=this(t[e][0]);return function(n){for(var e=0,r=t[e];!r[1](n);)r=t[++e];return r[0](n)}}function le(){}function fe(t,n,e){var r=e.s=t+n,i=r-t,o=r-i;e.t=t-o+(n-i)}function ye(t,n){t&&xs.hasOwnProperty(t.type)&&xs[t.type](t,n)}function he(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function xe(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)he(t[e],n,1);n.polygonEnd()}function pe(){function t(t,n){t*=qa,n=n*qa/2+Aa/4;var e=t-r,u=e>=0?1:-1,a=u*e,s=Math.cos(n),c=Math.sin(n),l=o*c,f=i*s+l*Math.cos(a),y=l*u*Math.sin(a);gs.add(Math.atan2(y,f)),r=t,i=s,o=c}var n,e,r,i,o;ds.point=function(u,a){ds.point=t,r=(n=u)*qa,i=Math.cos(a=(e=a)*qa/2+Aa/4),o=Math.sin(a)},ds.lineEnd=function(){t(n,e)}}function ge(t){var n=t[0],e=t[1],r=Math.cos(e);return[r*Math.cos(n),r*Math.sin(n),Math.sin(e)]}function de(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function ve(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function me(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Me(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function we(t){var n=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}function be(t){return[Math.atan2(t[1],t[0]),en(t[2])]}function _e(t,n){return la(t[0]-n[0])<Pa&&la(t[1]-n[1])<Pa}function Ee(t,n){t*=qa;var e=Math.cos(n*=qa);Se(e*Math.cos(t),e*Math.sin(t),Math.sin(n))}function Se(t,n,e){++vs,Ms+=(t-Ms)/vs,ws+=(n-ws)/vs,bs+=(e-bs)/vs}function Ne(){function t(t,i){t*=qa;var o=Math.cos(i*=qa),u=o*Math.cos(t),a=o*Math.sin(t),s=Math.sin(i),c=Math.atan2(Math.sqrt((c=e*s-r*a)*c+(c=r*u-n*s)*c+(c=n*a-e*u)*c),n*u+e*a+r*s);ms+=c,_s+=c*(n+(n=u)),Es+=c*(e+(e=a)),Ss+=c*(r+(r=s)),Se(n,e,r)}var n,e,r;Cs.point=function(i,o){i*=qa;var u=Math.cos(o*=qa);n=u*Math.cos(i),e=u*Math.sin(i),r=Math.sin(o),Cs.point=t,Se(n,e,r)}}function ke(){Cs.point=Ee}function Ae(){function t(t,n){t*=qa;var e=Math.cos(n*=qa),u=e*Math.cos(t),a=e*Math.sin(t),s=Math.sin(n),c=i*s-o*a,l=o*u-r*s,f=r*a-i*u,y=Math.sqrt(c*c+l*l+f*f),h=r*u+i*a+o*s,x=y&&-nn(h)/y,p=Math.atan2(y,h);Ns+=x*c,ks+=x*l,As+=x*f,ms+=p,_s+=p*(r+(r=u)),Es+=p*(i+(i=a)),Ss+=p*(o+(o=s)),Se(r,i,o)}var n,e,r,i,o;Cs.point=function(u,a){n=u,e=a,Cs.point=t,u*=qa;var s=Math.cos(a*=qa);r=s*Math.cos(u),i=s*Math.sin(u),o=Math.sin(a),Se(r,i,o)},Cs.lineEnd=function(){t(n,e),Cs.lineEnd=ke,Cs.point=Ee}}function Ce(){return!0}function Le(t,n,e,r,i){var o=[],u=[];if(t.forEach(function(t){if(!((n=t.length-1)<=0)){var n,e=t[0],r=t[n];if(_e(e,r)){i.lineStart();for(var a=0;n>a;++a)i.point((e=t[a])[0],e[1]);return void i.lineEnd()}var s=new ze(e,t,null,!0),c=new ze(e,null,s,!1);s.o=c,o.push(s),u.push(c),s=new ze(r,t,null,!1),c=new ze(r,null,s,!0),s.o=c,o.push(s),u.push(c)}}),u.sort(n),Pe(o),Pe(u),o.length){for(var a=0,s=e,c=u.length;c>a;++a)u[a].e=s=!s;for(var l,f,y=o[0];;){for(var h=y,x=!0;h.v;)if((h=h.n)===y)return;l=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(x)for(var a=0,c=l.length;c>a;++a)i.point((f=l[a])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(x){l=h.p.z;for(var a=l.length-1;a>=0;--a)i.point((f=l[a])[0],f[1])}else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,l=h.z,x=!x}while(!h.v);i.lineEnd()}}}function Pe(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}function ze(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function qe(t,n,e,r){return function(i,o){function u(n,e){var r=i(n,e);t(n=r[0],e=r[1])&&o.point(n,e)}function a(t,n){var e=i(t,n);g.point(e[0],e[1])}function s(){v.point=a,g.lineStart()}function c(){v.point=u,g.lineEnd()}function l(t,n){p.push([t,n]);var e=i(t,n);M.point(e[0],e[1])}function f(){M.lineStart(),p=[]}function y(){l(p[0][0],p[0][1]),M.lineEnd();var t,n=M.clean(),e=m.buffer(),r=e.length;if(p.pop(),x.push(p),p=null,r)if(1&n){t=e[0];var i,r=t.length-1,u=-1;if(r>0){for(w||(o.polygonStart(),w=!0),o.lineStart();++u<r;)o.point((i=t[u])[0],i[1]);o.lineEnd()}}else r>1&&2&n&&e.push(e.pop().concat(e.shift())),h.push(e.filter(Re))}var h,x,p,g=n(o),d=i.invert(r[0],r[1]),v={point:u,lineStart:s,lineEnd:c,polygonStart:function(){v.point=l,v.lineStart=f,v.lineEnd=y,h=[],x=[]},polygonEnd:function(){v.point=u,v.lineStart=s,v.lineEnd=c,h=Ju.merge(h);var t=De(d,x);h.length?(w||(o.polygonStart(),w=!0),Le(h,Te,t,e,o)):t&&(w||(o.polygonStart(),w=!0),o.lineStart(),e(null,null,1,o),o.lineEnd()),w&&(o.polygonEnd(),w=!1),h=x=null},sphere:function(){o.polygonStart(),o.lineStart(),e(null,null,1,o),o.lineEnd(),o.polygonEnd()}},m=Ie(),M=n(m),w=!1;return v}}function Re(t){return t.length>1}function Ie(){var t,n=[];return{lineStart:function(){n.push(t=[])},point:function(n,e){t.push([n,e])},lineEnd:M,buffer:function(){var e=n;return n=[],t=null,e},rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))}}}function Te(t,n){return((t=t.x)[0]<0?t[1]-La-Pa:La-t[1])-((n=n.x)[0]<0?n[1]-La-Pa:La-n[1])}function De(t,n){var e=t[0],r=t[1],i=[Math.sin(e),-Math.cos(e),0],o=0,u=0;gs.reset();for(var a=0,s=n.length;s>a;++a){var c=n[a],l=c.length;if(l)for(var f=c[0],y=f[0],h=f[1]/2+Aa/4,x=Math.sin(h),p=Math.cos(h),g=1;;){g===l&&(g=0),t=c[g];var d=t[0],v=t[1]/2+Aa/4,m=Math.sin(v),M=Math.cos(v),w=d-y,b=w>=0?1:-1,_=b*w,E=_>Aa,S=x*m;if(gs.add(Math.atan2(S*b*Math.sin(_),p*M+S*Math.cos(_))),o+=E?w+b*Ca:w,E^y>=e^d>=e){var N=ve(ge(f),ge(t));we(N);var k=ve(i,N);we(k);var A=(E^w>=0?-1:1)*en(k[2]);(r>A||r===A&&(N[0]||N[1]))&&(u+=E^w>=0?1:-1)}if(!g++)break;y=d,x=m,p=M,f=t}}return(-Pa>o||Pa>o&&0>gs)^1&u}function Ue(t){var n,e=0/0,r=0/0,i=0/0;return{lineStart:function(){t.lineStart(),n=1},point:function(o,u){var a=o>0?Aa:-Aa,s=la(o-e);la(s-Aa)<Pa?(t.point(e,r=(r+u)/2>0?La:-La),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),n=0):i!==a&&s>=Aa&&(la(e-i)<Pa&&(e-=i*Pa),la(o-a)<Pa&&(o-=a*Pa),r=je(e,r,o,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),n=0),t.point(e=o,r=u),i=a},lineEnd:function(){t.lineEnd(),e=r=0/0},clean:function(){return 2-n}}}function je(t,n,e,r){var i,o,u=Math.sin(t-e);return la(u)>Pa?Math.atan((Math.sin(n)*(o=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(n))*Math.sin(t))/(i*o*u)):(n+r)/2}function Oe(t,n,e,r){var i;if(null==t)i=e*La,r.point(-Aa,i),r.point(0,i),r.point(Aa,i),r.point(Aa,0),r.point(Aa,-i),r.point(0,-i),r.point(-Aa,-i),r.point(-Aa,0),r.point(-Aa,i);else if(la(t[0]-n[0])>Pa){var o=t[0]<n[0]?Aa:-Aa;i=e*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])}function Fe(t){function n(t,n){return Math.cos(t)*Math.cos(n)>o}function e(t){var e,o,s,c,l;return{lineStart:function(){c=s=!1,l=1},point:function(f,y){var h,x=[f,y],p=n(f,y),g=u?p?0:i(f,y):p?i(f+(0>f?Aa:-Aa),y):0;if(!e&&(c=s=p)&&t.lineStart(),p!==s&&(h=r(e,x),(_e(e,h)||_e(x,h))&&(x[0]+=Pa,x[1]+=Pa,p=n(x[0],x[1]))),p!==s)l=0,p?(t.lineStart(),h=r(x,e),t.point(h[0],h[1])):(h=r(e,x),t.point(h[0],h[1]),t.lineEnd()),e=h;else if(a&&e&&u^p){var d;g&o||!(d=r(x,e,!0))||(l=0,u?(t.lineStart(),t.point(d[0][0],d[0][1]),t.point(d[1][0],d[1][1]),t.lineEnd()):(t.point(d[1][0],d[1][1]),t.lineEnd(),t.lineStart(),t.point(d[0][0],d[0][1])))}!p||e&&_e(e,x)||t.point(x[0],x[1]),e=x,s=p,o=g},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return l|(c&&s)<<1}}}function r(t,n,e){var r=ge(t),i=ge(n),u=[1,0,0],a=ve(r,i),s=de(a,a),c=a[0],l=s-c*c;if(!l)return!e&&t;var f=o*s/l,y=-o*c/l,h=ve(u,a),x=Me(u,f),p=Me(a,y);me(x,p);var g=h,d=de(x,g),v=de(g,g),m=d*d-v*(de(x,x)-1);if(!(0>m)){var M=Math.sqrt(m),w=Me(g,(-d-M)/v);if(me(w,x),w=be(w),!e)return w;var b,_=t[0],E=n[0],S=t[1],N=n[1];_>E&&(b=_,_=E,E=b);var k=E-_,A=la(k-Aa)<Pa,C=A||Pa>k;if(!A&&S>N&&(b=S,S=N,N=b),C?A?S+N>0^w[1]<(la(w[0]-_)<Pa?S:N):S<=w[1]&&w[1]<=N:k>Aa^(_<=w[0]&&w[0]<=E)){var L=Me(g,(-d+M)/v);return me(L,x),[w,be(L)]}}}function i(n,e){var r=u?t:Aa-t,i=0;return-r>n?i|=1:n>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}var o=Math.cos(t),u=o>0,a=la(o)>Pa,s=pr(t,6*qa);return qe(n,e,s,u?[0,-t]:[-Aa,t-Aa])}function He(t,n,e,r){return function(i){var o,u=i.a,a=i.b,s=u.x,c=u.y,l=a.x,f=a.y,y=0,h=1,x=l-s,p=f-c;if(o=t-s,x||!(o>0)){if(o/=x,0>x){if(y>o)return;h>o&&(h=o)}else if(x>0){if(o>h)return;o>y&&(y=o)}if(o=e-s,x||!(0>o)){if(o/=x,0>x){if(o>h)return;o>y&&(y=o)}else if(x>0){if(y>o)return;h>o&&(h=o)}if(o=n-c,p||!(o>0)){if(o/=p,0>p){if(y>o)return;h>o&&(h=o)}else if(p>0){if(o>h)return;o>y&&(y=o)}if(o=r-c,p||!(0>o)){if(o/=p,0>p){if(o>h)return;o>y&&(y=o)}else if(p>0){if(y>o)return;h>o&&(h=o)}return y>0&&(i.a={x:s+y*x,y:c+y*p}),1>h&&(i.b={x:s+h*x,y:c+h*p}),i}}}}}}function Be(t,n,e,r){function i(r,i){return la(r[0]-t)<Pa?i>0?0:3:la(r[0]-e)<Pa?i>0?2:1:la(r[1]-n)<Pa?i>0?1:0:i>0?3:2}function o(t,n){return u(t.x,n.x)}function u(t,n){var e=i(t,1),r=i(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){function s(t){for(var n=0,e=g.length,r=t[1],i=0;e>i;++i)for(var o,u=1,a=g[i],s=a.length,c=a[0];s>u;++u)o=a[u],c[1]<=r?o[1]>r&&tn(c,o,t)>0&&++n:o[1]<=r&&tn(c,o,t)<0&&--n,c=o;return 0!==n}function c(o,a,s,c){var l=0,f=0;if(null==o||(l=i(o,s))!==(f=i(a,s))||u(o,a)<0^s>0){do c.point(0===l||3===l?t:e,l>1?r:n);while((l=(l+s+4)%4)!==f)}else c.point(a[0],a[1])}function l(i,o){return i>=t&&e>=i&&o>=n&&r>=o}function f(t,n){l(t,n)&&a.point(t,n)}function y(){C.point=x,g&&g.push(d=[]),E=!0,_=!1,w=b=0/0}function h(){p&&(x(v,m),M&&_&&k.rejoin(),p.push(k.buffer())),C.point=f,_&&a.lineEnd()}function x(t,n){t=Math.max(-Ps,Math.min(Ps,t)),n=Math.max(-Ps,Math.min(Ps,n));var e=l(t,n);if(g&&d.push([t,n]),E)v=t,m=n,M=e,E=!1,e&&(a.lineStart(),a.point(t,n));else if(e&&_)a.point(t,n);else{var r={a:{x:w,y:b},b:{x:t,y:n}};A(r)?(_||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),S=!1):e&&(a.lineStart(),a.point(t,n),S=!1)}w=t,b=n,_=e}var p,g,d,v,m,M,w,b,_,E,S,N=a,k=Ie(),A=He(t,n,e,r),C={point:f,lineStart:y,lineEnd:h,polygonStart:function(){a=k,p=[],g=[],S=!0},polygonEnd:function(){a=N,p=Ju.merge(p);var n=s([t,r]),e=S&&n,i=p.length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),c(null,null,1,a),a.lineEnd()),i&&Le(p,o,n,c,a),a.polygonEnd()),p=g=d=null}};return C
}}function Ye(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return e=n.invert(e,r),e&&t.invert(e[0],e[1])}),e}function Ve(t){var n=0,e=Aa/3,r=ar(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*Aa/180,e=t[1]*Aa/180):[n/Aa*180,e/Aa*180]},i}function Ze(t,n){function e(t,n){var e=Math.sqrt(o-2*i*Math.sin(n))/i;return[e*Math.sin(t*=i),u-e*Math.cos(t)]}var r=Math.sin(t),i=(r+Math.sin(n))/2,o=1+r*(2*i-r),u=Math.sqrt(o)/i;return e.invert=function(t,n){var e=u-n;return[Math.atan2(t,e)/i,en((o-(t*t+e*e)*i*i)/(2*i))]},e}function Xe(){function t(t,n){qs+=i*t-r*n,r=t,i=n}var n,e,r,i;Us.point=function(o,u){Us.point=t,n=r=o,e=i=u},Us.lineEnd=function(){t(n,e)}}function $e(t,n){Rs>t&&(Rs=t),t>Ts&&(Ts=t),Is>n&&(Is=n),n>Ds&&(Ds=n)}function Qe(){function t(t,n){u.push("M",t,",",n,o)}function n(t,n){u.push("M",t,",",n),a.point=e}function e(t,n){u.push("L",t,",",n)}function r(){a.point=t}function i(){u.push("Z")}var o=Je(4.5),u=[],a={point:t,lineStart:function(){a.point=n},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=t},pointRadius:function(t){return o=Je(t),a},result:function(){if(u.length){var t=u.join("");return u=[],t}}};return a}function Je(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function We(t,n){Ms+=t,ws+=n,++bs}function Ge(){function t(t,r){var i=t-n,o=r-e,u=Math.sqrt(i*i+o*o);_s+=u*(n+t)/2,Es+=u*(e+r)/2,Ss+=u,We(n=t,e=r)}var n,e;Os.point=function(r,i){Os.point=t,We(n=r,e=i)}}function Ke(){Os.point=We}function tr(){function t(t,n){var e=t-r,o=n-i,u=Math.sqrt(e*e+o*o);_s+=u*(r+t)/2,Es+=u*(i+n)/2,Ss+=u,u=i*t-r*n,Ns+=u*(r+t),ks+=u*(i+n),As+=3*u,We(r=t,i=n)}var n,e,r,i;Os.point=function(o,u){Os.point=t,We(n=r=o,e=i=u)},Os.lineEnd=function(){t(n,e)}}function nr(t){function n(n,e){t.moveTo(n,e),t.arc(n,e,u,0,Ca)}function e(n,e){t.moveTo(n,e),a.point=r}function r(n,e){t.lineTo(n,e)}function i(){a.point=n}function o(){t.closePath()}var u=4.5,a={point:n,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=o},polygonEnd:function(){a.lineEnd=i,a.point=n},pointRadius:function(t){return u=t,a},result:M};return a}function er(t){function n(t){return(a?r:e)(t)}function e(n){return or(n,function(e,r){e=t(e,r),n.point(e[0],e[1])})}function r(n){function e(e,r){e=t(e,r),n.point(e[0],e[1])}function r(){m=0/0,E.point=o,n.lineStart()}function o(e,r){var o=ge([e,r]),u=t(e,r);i(m,M,v,w,b,_,m=u[0],M=u[1],v=e,w=o[0],b=o[1],_=o[2],a,n),n.point(m,M)}function u(){E.point=e,n.lineEnd()}function s(){r(),E.point=c,E.lineEnd=l}function c(t,n){o(f=t,y=n),h=m,x=M,p=w,g=b,d=_,E.point=o}function l(){i(m,M,v,w,b,_,h,x,f,p,g,d,a,n),E.lineEnd=u,u()}var f,y,h,x,p,g,d,v,m,M,w,b,_,E={point:e,lineStart:r,lineEnd:u,polygonStart:function(){n.polygonStart(),E.lineStart=s},polygonEnd:function(){n.polygonEnd(),E.lineStart=r}};return E}function i(n,e,r,a,s,c,l,f,y,h,x,p,g,d){var v=l-n,m=f-e,M=v*v+m*m;if(M>4*o&&g--){var w=a+h,b=s+x,_=c+p,E=Math.sqrt(w*w+b*b+_*_),S=Math.asin(_/=E),N=la(la(_)-1)<Pa||la(r-y)<Pa?(r+y)/2:Math.atan2(b,w),k=t(N,S),A=k[0],C=k[1],L=A-n,P=C-e,z=m*L-v*P;(z*z/M>o||la((v*L+m*P)/M-.5)>.3||u>a*h+s*x+c*p)&&(i(n,e,r,a,s,c,A,C,N,w/=E,b/=E,_,g,d),d.point(A,C),i(A,C,N,w,b,_,l,f,y,h,x,p,g,d))}}var o=.5,u=Math.cos(30*qa),a=16;return n.precision=function(t){return arguments.length?(a=(o=t*t)>0&&16,n):Math.sqrt(o)},n}function rr(t){var n=er(function(n,e){return t([n*Ra,e*Ra])});return function(t){return sr(n(t))}}function ir(t){this.stream=t}function or(t,n){return{point:n,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function ur(t){return ar(function(){return t})()}function ar(t){function n(t){return t=a(t[0]*qa,t[1]*qa),[t[0]*y+s,c-t[1]*y]}function e(t){return t=a.invert((t[0]-s)/y,(c-t[1])/y),t&&[t[0]*Ra,t[1]*Ra]}function r(){a=Ye(u=fr(d,v,m),o);var t=o(p,g);return s=h-t[0]*y,c=x+t[1]*y,i()}function i(){return l&&(l.valid=!1,l=null),n}var o,u,a,s,c,l,f=er(function(t,n){return t=o(t,n),[t[0]*y+s,c-t[1]*y]}),y=150,h=480,x=250,p=0,g=0,d=0,v=0,m=0,M=Ls,w=Cn,b=null,_=null;return n.stream=function(t){return l&&(l.valid=!1),l=sr(M(u,f(w(t)))),l.valid=!0,l},n.clipAngle=function(t){return arguments.length?(M=null==t?(b=t,Ls):Fe((b=+t)*qa),i()):b},n.clipExtent=function(t){return arguments.length?(_=t,w=t?Be(t[0][0],t[0][1],t[1][0],t[1][1]):Cn,i()):_},n.scale=function(t){return arguments.length?(y=+t,r()):y},n.translate=function(t){return arguments.length?(h=+t[0],x=+t[1],r()):[h,x]},n.center=function(t){return arguments.length?(p=t[0]%360*qa,g=t[1]%360*qa,r()):[p*Ra,g*Ra]},n.rotate=function(t){return arguments.length?(d=t[0]%360*qa,v=t[1]%360*qa,m=t.length>2?t[2]%360*qa:0,r()):[d*Ra,v*Ra,m*Ra]},Ju.rebind(n,f,"precision"),function(){return o=t.apply(this,arguments),n.invert=o.invert&&e,r()}}function sr(t){return or(t,function(n,e){t.point(n*qa,e*qa)})}function cr(t,n){return[t,n]}function lr(t,n){return[t>Aa?t-Ca:-Aa>t?t+Ca:t,n]}function fr(t,n,e){return t?n||e?Ye(hr(t),xr(n,e)):hr(t):n||e?xr(n,e):lr}function yr(t){return function(n,e){return n+=t,[n>Aa?n-Ca:-Aa>n?n+Ca:n,e]}}function hr(t){var n=yr(t);return n.invert=yr(-t),n}function xr(t,n){function e(t,n){var e=Math.cos(n),a=Math.cos(t)*e,s=Math.sin(t)*e,c=Math.sin(n),l=c*r+a*i;return[Math.atan2(s*o-l*u,a*r-c*i),en(l*o+s*u)]}var r=Math.cos(t),i=Math.sin(t),o=Math.cos(n),u=Math.sin(n);return e.invert=function(t,n){var e=Math.cos(n),a=Math.cos(t)*e,s=Math.sin(t)*e,c=Math.sin(n),l=c*o-s*u;return[Math.atan2(s*o+c*u,a*r+l*i),en(l*r-a*i)]},e}function pr(t,n){var e=Math.cos(t),r=Math.sin(t);return function(i,o,u,a){var s=u*n;null!=i?(i=gr(e,i),o=gr(e,o),(u>0?o>i:i>o)&&(i+=u*Ca)):(i=t+u*Ca,o=t-.5*s);for(var c,l=i;u>0?l>o:o>l;l-=s)a.point((c=be([e,-r*Math.cos(l),-r*Math.sin(l)]))[0],c[1])}}function gr(t,n){var e=ge(n);e[0]-=t,we(e);var r=nn(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Pa)%(2*Math.PI)}function dr(t,n,e){var r=Ju.range(t,n-Pa,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function vr(t,n,e){var r=Ju.range(t,n-Pa,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function mr(t){return t.source}function Mr(t){return t.target}function wr(t,n,e,r){var i=Math.cos(n),o=Math.sin(n),u=Math.cos(r),a=Math.sin(r),s=i*Math.cos(t),c=i*Math.sin(t),l=u*Math.cos(e),f=u*Math.sin(e),y=2*Math.asin(Math.sqrt(an(r-n)+i*u*an(e-t))),h=1/Math.sin(y),x=y?function(t){var n=Math.sin(t*=y)*h,e=Math.sin(y-t)*h,r=e*s+n*l,i=e*c+n*f,u=e*o+n*a;return[Math.atan2(i,r)*Ra,Math.atan2(u,Math.sqrt(r*r+i*i))*Ra]}:function(){return[t*Ra,n*Ra]};return x.distance=y,x}function br(){function t(t,i){var o=Math.sin(i*=qa),u=Math.cos(i),a=la((t*=qa)-n),s=Math.cos(a);Fs+=Math.atan2(Math.sqrt((a=u*Math.sin(a))*a+(a=r*o-e*u*s)*a),e*o+r*u*s),n=t,e=o,r=u}var n,e,r;Hs.point=function(i,o){n=i*qa,e=Math.sin(o*=qa),r=Math.cos(o),Hs.point=t},Hs.lineEnd=function(){Hs.point=Hs.lineEnd=M}}function _r(t,n){function e(n,e){var r=Math.cos(n),i=Math.cos(e),o=t(r*i);return[o*i*Math.sin(n),o*Math.sin(e)]}return e.invert=function(t,e){var r=Math.sqrt(t*t+e*e),i=n(r),o=Math.sin(i),u=Math.cos(i);return[Math.atan2(t*o,r*u),Math.asin(r&&e*o/r)]},e}function Er(t,n){function e(t,n){u>0?-La+Pa>n&&(n=-La+Pa):n>La-Pa&&(n=La-Pa);var e=u/Math.pow(i(n),o);return[e*Math.sin(o*t),u-e*Math.cos(o*t)]}var r=Math.cos(t),i=function(t){return Math.tan(Aa/4+t/2)},o=t===n?Math.sin(t):Math.log(r/Math.cos(n))/Math.log(i(n)/i(t)),u=r*Math.pow(i(t),o)/o;return o?(e.invert=function(t,n){var e=u-n,r=K(o)*Math.sqrt(t*t+e*e);return[Math.atan2(t,e)/o,2*Math.atan(Math.pow(u/r,1/o))-La]},e):Nr}function Sr(t,n){function e(t,n){var e=o-n;return[e*Math.sin(i*t),o-e*Math.cos(i*t)]}var r=Math.cos(t),i=t===n?Math.sin(t):(r-Math.cos(n))/(n-t),o=r/i+t;return la(i)<Pa?cr:(e.invert=function(t,n){var e=o-n;return[Math.atan2(t,e)/i,o-K(i)*Math.sqrt(t*t+e*e)]},e)}function Nr(t,n){return[t,Math.log(Math.tan(Aa/4+n/2))]}function kr(t){var n,e=ur(t),r=e.scale,i=e.translate,o=e.clipExtent;return e.scale=function(){var t=r.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.translate=function(){var t=i.apply(e,arguments);return t===e?n?e.clipExtent(null):e:t},e.clipExtent=function(t){var u=o.apply(e,arguments);if(u===e){if(n=null==t){var a=Aa*r(),s=i();o([[s[0]-a,s[1]-a],[s[0]+a,s[1]+a]])}}else n&&(u=null);return u},e.clipExtent(null)}function Ar(t,n){return[Math.log(Math.tan(Aa/4+n/2)),-t]}function Cr(t){return t[0]}function Lr(t){return t[1]}function Pr(t){for(var n=t.length,e=[0,1],r=2,i=2;n>i;i++){for(;r>1&&tn(t[e[r-2]],t[e[r-1]],t[i])<=0;)--r;e[r++]=i}return e.slice(0,r)}function zr(t,n){return t[0]-n[0]||t[1]-n[1]}function qr(t,n,e){return(e[0]-n[0])*(t[1]-n[1])<(e[1]-n[1])*(t[0]-n[0])}function Rr(t,n,e,r){var i=t[0],o=e[0],u=n[0]-i,a=r[0]-o,s=t[1],c=e[1],l=n[1]-s,f=r[1]-c,y=(a*(s-c)-f*(i-o))/(f*u-a*l);return[i+y*u,s+y*l]}function Ir(t){var n=t[0],e=t[t.length-1];return!(n[0]-e[0]||n[1]-e[1])}function Tr(){ri(this),this.edge=this.site=this.circle=null}function Dr(t){var n=tc.pop()||new Tr;return n.site=t,n}function Ur(t){$r(t),Ws.remove(t),tc.push(t),ri(t)}function jr(t){var n=t.circle,e=n.x,r=n.cy,i={x:e,y:r},o=t.P,u=t.N,a=[t];Ur(t);for(var s=o;s.circle&&la(e-s.circle.x)<Pa&&la(r-s.circle.cy)<Pa;)o=s.P,a.unshift(s),Ur(s),s=o;a.unshift(s),$r(s);for(var c=u;c.circle&&la(e-c.circle.x)<Pa&&la(r-c.circle.cy)<Pa;)u=c.N,a.push(c),Ur(c),c=u;a.push(c),$r(c);var l,f=a.length;for(l=1;f>l;++l)c=a[l],s=a[l-1],ti(c.edge,s.site,c.site,i);s=a[0],c=a[f-1],c.edge=Gr(s.site,c.site,null,i),Xr(s),Xr(c)}function Or(t){for(var n,e,r,i,o=t.x,u=t.y,a=Ws._;a;)if(r=Fr(a,u)-o,r>Pa)a=a.L;else{if(i=o-Hr(a,u),!(i>Pa)){r>-Pa?(n=a.P,e=a):i>-Pa?(n=a,e=a.N):n=e=a;break}if(!a.R){n=a;break}a=a.R}var s=Dr(t);if(Ws.insert(n,s),n||e){if(n===e)return $r(n),e=Dr(n.site),Ws.insert(s,e),s.edge=e.edge=Gr(n.site,s.site),Xr(n),void Xr(e);if(!e)return void(s.edge=Gr(n.site,s.site));$r(n),$r(e);var c=n.site,l=c.x,f=c.y,y=t.x-l,h=t.y-f,x=e.site,p=x.x-l,g=x.y-f,d=2*(y*g-h*p),v=y*y+h*h,m=p*p+g*g,M={x:(g*v-h*m)/d+l,y:(y*m-p*v)/d+f};ti(e.edge,c,x,M),s.edge=Gr(c,t,null,M),e.edge=Gr(t,x,null,M),Xr(n),Xr(e)}}function Fr(t,n){var e=t.site,r=e.x,i=e.y,o=i-n;if(!o)return r;var u=t.P;if(!u)return-1/0;e=u.site;var a=e.x,s=e.y,c=s-n;if(!c)return a;var l=a-r,f=1/o-1/c,y=l/c;return f?(-y+Math.sqrt(y*y-2*f*(l*l/(-2*c)-s+c/2+i-o/2)))/f+r:(r+a)/2}function Hr(t,n){var e=t.N;if(e)return Fr(e,n);var r=t.site;return r.y===n?r.x:1/0}function Br(t){this.site=t,this.edges=[]}function Yr(t){for(var n,e,r,i,o,u,a,s,c,l,f=t[0][0],y=t[1][0],h=t[0][1],x=t[1][1],p=Js,g=p.length;g--;)if(o=p[g],o&&o.prepare())for(a=o.edges,s=a.length,u=0;s>u;)l=a[u].end(),r=l.x,i=l.y,c=a[++u%s].start(),n=c.x,e=c.y,(la(r-n)>Pa||la(i-e)>Pa)&&(a.splice(u,0,new ni(Kr(o.site,l,la(r-f)<Pa&&x-i>Pa?{x:f,y:la(n-f)<Pa?e:x}:la(i-x)<Pa&&y-r>Pa?{x:la(e-x)<Pa?n:y,y:x}:la(r-y)<Pa&&i-h>Pa?{x:y,y:la(n-y)<Pa?e:h}:la(i-h)<Pa&&r-f>Pa?{x:la(e-h)<Pa?n:f,y:h}:null),o.site,null)),++s)}function Vr(t,n){return n.angle-t.angle}function Zr(){ri(this),this.x=this.y=this.arc=this.site=this.cy=null}function Xr(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,o=e.site;if(r!==o){var u=i.x,a=i.y,s=r.x-u,c=r.y-a,l=o.x-u,f=o.y-a,y=2*(s*f-c*l);if(!(y>=-za)){var h=s*s+c*c,x=l*l+f*f,p=(f*h-c*x)/y,g=(s*x-l*h)/y,f=g+a,d=nc.pop()||new Zr;d.arc=t,d.site=i,d.x=p+u,d.y=f+Math.sqrt(p*p+g*g),d.cy=f,t.circle=d;for(var v=null,m=Ks._;m;)if(d.y<m.y||d.y===m.y&&d.x<=m.x){if(!m.L){v=m.P;break}m=m.L}else{if(!m.R){v=m;break}m=m.R}Ks.insert(v,d),v||(Gs=d)}}}}function $r(t){var n=t.circle;n&&(n.P||(Gs=n.N),Ks.remove(n),nc.push(n),ri(n),t.circle=null)}function Qr(t){for(var n,e=Qs,r=He(t[0][0],t[0][1],t[1][0],t[1][1]),i=e.length;i--;)n=e[i],(!Jr(n,t)||!r(n)||la(n.a.x-n.b.x)<Pa&&la(n.a.y-n.b.y)<Pa)&&(n.a=n.b=null,e.splice(i,1))}function Jr(t,n){var e=t.b;if(e)return!0;var r,i,o=t.a,u=n[0][0],a=n[1][0],s=n[0][1],c=n[1][1],l=t.l,f=t.r,y=l.x,h=l.y,x=f.x,p=f.y,g=(y+x)/2,d=(h+p)/2;if(p===h){if(u>g||g>=a)return;if(y>x){if(o){if(o.y>=c)return}else o={x:g,y:s};e={x:g,y:c}}else{if(o){if(o.y<s)return}else o={x:g,y:c};e={x:g,y:s}}}else if(r=(y-x)/(p-h),i=d-r*g,-1>r||r>1)if(y>x){if(o){if(o.y>=c)return}else o={x:(s-i)/r,y:s};e={x:(c-i)/r,y:c}}else{if(o){if(o.y<s)return}else o={x:(c-i)/r,y:c};e={x:(s-i)/r,y:s}}else if(p>h){if(o){if(o.x>=a)return}else o={x:u,y:r*u+i};e={x:a,y:r*a+i}}else{if(o){if(o.x<u)return}else o={x:a,y:r*a+i};e={x:u,y:r*u+i}}return t.a=o,t.b=e,!0}function Wr(t,n){this.l=t,this.r=n,this.a=this.b=null}function Gr(t,n,e,r){var i=new Wr(t,n);return Qs.push(i),e&&ti(i,t,n,e),r&&ti(i,n,t,r),Js[t.i].edges.push(new ni(i,t,n)),Js[n.i].edges.push(new ni(i,n,t)),i}function Kr(t,n,e){var r=new Wr(t,null);return r.a=n,r.b=e,Qs.push(r),r}function ti(t,n,e,r){t.a||t.b?t.l===e?t.b=r:t.a=r:(t.a=r,t.l=n,t.r=e)}function ni(t,n,e){var r=t.a,i=t.b;this.edge=t,this.site=n,this.angle=e?Math.atan2(e.y-n.y,e.x-n.x):t.l===n?Math.atan2(i.x-r.x,r.y-i.y):Math.atan2(r.x-i.x,i.y-r.y)}function ei(){this._=null}function ri(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function ii(t,n){var e=n,r=n.R,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function oi(t,n){var e=n,r=n.L,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function ui(t){for(;t.L;)t=t.L;return t}function ai(t,n){var e,r,i,o=t.sort(si).pop();for(Qs=[],Js=new Array(t.length),Ws=new ei,Ks=new ei;;)if(i=Gs,o&&(!i||o.y<i.y||o.y===i.y&&o.x<i.x))(o.x!==e||o.y!==r)&&(Js[o.i]=new Br(o),Or(o),e=o.x,r=o.y),o=t.pop();else{if(!i)break;jr(i.arc)}n&&(Qr(n),Yr(n));var u={cells:Js,edges:Qs};return Ws=Ks=Qs=Js=null,u}function si(t,n){return n.y-t.y||n.x-t.x}function ci(t,n,e){return(t.x-e.x)*(n.y-t.y)-(t.x-n.x)*(e.y-t.y)}function li(t){return t.x}function fi(t){return t.y}function yi(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function hi(t,n,e,r,i,o){if(!t(n,e,r,i,o)){var u=.5*(e+i),a=.5*(r+o),s=n.nodes;s[0]&&hi(t,s[0],e,r,u,a),s[1]&&hi(t,s[1],u,r,i,a),s[2]&&hi(t,s[2],e,a,u,o),s[3]&&hi(t,s[3],u,a,i,o)}}function xi(t,n){t=Ju.rgb(t),n=Ju.rgb(n);var e=t.r,r=t.g,i=t.b,o=n.r-e,u=n.g-r,a=n.b-i;return function(t){return"#"+bn(Math.round(e+o*t))+bn(Math.round(r+u*t))+bn(Math.round(i+a*t))}}function pi(t,n){var e,r={},i={};for(e in t)e in n?r[e]=vi(t[e],n[e]):i[e]=t[e];for(e in n)e in t||(i[e]=n[e]);return function(t){for(e in r)i[e]=r[e](t);return i}}function gi(t,n){return n-=t=+t,function(e){return t+n*e}}function di(t,n){var e,r,i,o=rc.lastIndex=ic.lastIndex=0,u=-1,a=[],s=[];for(t+="",n+="";(e=rc.exec(t))&&(r=ic.exec(n));)(i=r.index)>o&&(i=n.substring(o,i),a[u]?a[u]+=i:a[++u]=i),(e=e[0])===(r=r[0])?a[u]?a[u]+=r:a[++u]=r:(a[++u]=null,s.push({i:u,x:gi(e,r)})),o=ic.lastIndex;return o<n.length&&(i=n.substring(o),a[u]?a[u]+=i:a[++u]=i),a.length<2?s[0]?(n=s[0].x,function(t){return n(t)+""}):function(){return n}:(n=s.length,function(t){for(var e,r=0;n>r;++r)a[(e=s[r]).i]=e.x(t);return a.join("")})}function vi(t,n){for(var e,r=Ju.interpolators.length;--r>=0&&!(e=Ju.interpolators[r](t,n)););return e}function mi(t,n){var e,r=[],i=[],o=t.length,u=n.length,a=Math.min(t.length,n.length);for(e=0;a>e;++e)r.push(vi(t[e],n[e]));for(;o>e;++e)i[e]=t[e];for(;u>e;++e)i[e]=n[e];return function(t){for(e=0;a>e;++e)i[e]=r[e](t);return i}}function Mi(t){return function(n){return 0>=n?0:n>=1?1:t(n)}}function wi(t){return function(n){return 1-t(1-n)}}function bi(t){return function(n){return.5*(.5>n?t(2*n):2-t(2-2*n))}}function _i(t){return t*t}function Ei(t){return t*t*t}function Si(t){if(0>=t)return 0;if(t>=1)return 1;var n=t*t,e=n*t;return 4*(.5>t?e:3*(t-n)+e-.75)}function Ni(t){return function(n){return Math.pow(n,t)}}function ki(t){return 1-Math.cos(t*La)}function Ai(t){return Math.pow(2,10*(t-1))}function Ci(t){return 1-Math.sqrt(1-t*t)}function Li(t,n){var e;return arguments.length<2&&(n=.45),arguments.length?e=n/Ca*Math.asin(1/t):(t=1,e=n/4),function(r){return 1+t*Math.pow(2,-10*r)*Math.sin((r-e)*Ca/n)}}function Pi(t){return t||(t=1.70158),function(n){return n*n*((t+1)*n-t)}}function zi(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function qi(t,n){t=Ju.hcl(t),n=Ju.hcl(n);var e=t.h,r=t.c,i=t.l,o=n.h-e,u=n.c-r,a=n.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?n.c:r),isNaN(o)?(o=0,e=isNaN(e)?n.h:e):o>180?o-=360:-180>o&&(o+=360),function(t){return yn(e+o*t,r+u*t,i+a*t)+""}}function Ri(t,n){t=Ju.hsl(t),n=Ju.hsl(n);var e=t.h,r=t.s,i=t.l,o=n.h-e,u=n.s-r,a=n.l-i;return isNaN(u)&&(u=0,r=isNaN(r)?n.s:r),isNaN(o)?(o=0,e=isNaN(e)?n.h:e):o>180?o-=360:-180>o&&(o+=360),function(t){return ln(e+o*t,r+u*t,i+a*t)+""}}function Ii(t,n){t=Ju.lab(t),n=Ju.lab(n);var e=t.l,r=t.a,i=t.b,o=n.l-e,u=n.a-r,a=n.b-i;return function(t){return xn(e+o*t,r+u*t,i+a*t)+""}}function Ti(t,n){return n-=t,function(e){return Math.round(t+n*e)}}function Di(t){var n=[t.a,t.b],e=[t.c,t.d],r=ji(n),i=Ui(n,e),o=ji(Oi(e,n,-i))||0;n[0]*e[1]<e[0]*n[1]&&(n[0]*=-1,n[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(n[1],n[0]):Math.atan2(-e[0],e[1]))*Ra,this.translate=[t.e,t.f],this.scale=[r,o],this.skew=o?Math.atan2(i,o)*Ra:0}function Ui(t,n){return t[0]*n[0]+t[1]*n[1]}function ji(t){var n=Math.sqrt(Ui(t,t));return n&&(t[0]/=n,t[1]/=n),n}function Oi(t,n,e){return t[0]+=e*n[0],t[1]+=e*n[1],t}function Fi(t,n){var e,r=[],i=[],o=Ju.transform(t),u=Ju.transform(n),a=o.translate,s=u.translate,c=o.rotate,l=u.rotate,f=o.skew,y=u.skew,h=o.scale,x=u.scale;return a[0]!=s[0]||a[1]!=s[1]?(r.push("translate(",null,",",null,")"),i.push({i:1,x:gi(a[0],s[0])},{i:3,x:gi(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:gi(c,l)})):l&&r.push(r.pop()+"rotate("+l+")"),f!=y?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:gi(f,y)}):y&&r.push(r.pop()+"skewX("+y+")"),h[0]!=x[0]||h[1]!=x[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:e-4,x:gi(h[0],x[0])},{i:e-2,x:gi(h[1],x[1])})):(1!=x[0]||1!=x[1])&&r.push(r.pop()+"scale("+x+")"),e=i.length,function(t){for(var n,o=-1;++o<e;)r[(n=i[o]).i]=n.x(t);return r.join("")}}function Hi(t,n){return n=n-(t=+t)?1/(n-t):0,function(e){return(e-t)*n}}function Bi(t,n){return n=n-(t=+t)?1/(n-t):0,function(e){return Math.max(0,Math.min(1,(e-t)*n))}}function Yi(t){for(var n=t.source,e=t.target,r=Zi(n,e),i=[n];n!==r;)n=n.parent,i.push(n);for(var o=i.length;e!==r;)i.splice(o,0,e),e=e.parent;return i}function Vi(t){for(var n=[],e=t.parent;null!=e;)n.push(t),t=e,e=e.parent;return n.push(t),n}function Zi(t,n){if(t===n)return t;for(var e=Vi(t),r=Vi(n),i=e.pop(),o=r.pop(),u=null;i===o;)u=i,i=e.pop(),o=r.pop();return u}function Xi(t){t.fixed|=2}function $i(t){t.fixed&=-7}function Qi(t){t.fixed|=4,t.px=t.x,t.py=t.y}function Ji(t){t.fixed&=-5}function Wi(t,n,e){var r=0,i=0;if(t.charge=0,!t.leaf)for(var o,u=t.nodes,a=u.length,s=-1;++s<a;)o=u[s],null!=o&&(Wi(o,n,e),t.charge+=o.charge,r+=o.charge*o.cx,i+=o.charge*o.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var c=n*e[t.point.index];t.charge+=t.pointCharge=c,r+=c*t.point.x,i+=c*t.point.y}t.cx=r/t.charge,t.cy=i/t.charge}function Gi(t,n){return Ju.rebind(t,n,"sort","children","value"),t.nodes=t,t.links=io,t}function Ki(t,n){for(var e=[t];null!=(t=e.pop());)if(n(t),(i=t.children)&&(r=i.length))for(var r,i;--r>=0;)e.push(i[r])}function to(t,n){for(var e=[t],r=[];null!=(t=e.pop());)if(r.push(t),(o=t.children)&&(i=o.length))for(var i,o,u=-1;++u<i;)e.push(o[u]);for(;null!=(t=r.pop());)n(t)}function no(t){return t.children}function eo(t){return t.value}function ro(t,n){return n.value-t.value}function io(t){return Ju.merge(t.map(function(t){return(t.children||[]).map(function(n){return{source:t,target:n}})}))}function oo(t){return t.x}function uo(t){return t.y}function ao(t,n,e){t.y0=n,t.y=e}function so(t){return Ju.range(t.length)}function co(t){for(var n=-1,e=t[0].length,r=[];++n<e;)r[n]=0;return r}function lo(t){for(var n,e=1,r=0,i=t[0][1],o=t.length;o>e;++e)(n=t[e][1])>i&&(r=e,i=n);return r}function fo(t){return t.reduce(yo,0)}function yo(t,n){return t+n[1]}function ho(t,n){return xo(t,Math.ceil(Math.log(n.length)/Math.LN2+1))}function xo(t,n){for(var e=-1,r=+t[0],i=(t[1]-r)/n,o=[];++e<=n;)o[e]=i*e+r;return o}function po(t){return[Ju.min(t),Ju.max(t)]}function go(t,n){return t.value-n.value}function vo(t,n){var e=t._pack_next;t._pack_next=n,n._pack_prev=t,n._pack_next=e,e._pack_prev=n}function mo(t,n){t._pack_next=n,n._pack_prev=t}function Mo(t,n){var e=n.x-t.x,r=n.y-t.y,i=t.r+n.r;return.999*i*i>e*e+r*r}function wo(t){function n(t){l=Math.min(t.x-t.r,l),f=Math.max(t.x+t.r,f),y=Math.min(t.y-t.r,y),h=Math.max(t.y+t.r,h)}if((e=t.children)&&(c=e.length)){var e,r,i,o,u,a,s,c,l=1/0,f=-1/0,y=1/0,h=-1/0;if(e.forEach(bo),r=e[0],r.x=-r.r,r.y=0,n(r),c>1&&(i=e[1],i.x=i.r,i.y=0,n(i),c>2))for(o=e[2],So(r,i,o),n(o),vo(r,o),r._pack_prev=o,vo(o,i),i=r._pack_next,u=3;c>u;u++){So(r,i,o=e[u]);var x=0,p=1,g=1;for(a=i._pack_next;a!==i;a=a._pack_next,p++)if(Mo(a,o)){x=1;break}if(1==x)for(s=r._pack_prev;s!==a._pack_prev&&!Mo(s,o);s=s._pack_prev,g++);x?(g>p||p==g&&i.r<r.r?mo(r,i=a):mo(r=s,i),u--):(vo(r,o),i=o,n(o))}var d=(l+f)/2,v=(y+h)/2,m=0;for(u=0;c>u;u++)o=e[u],o.x-=d,o.y-=v,m=Math.max(m,o.r+Math.sqrt(o.x*o.x+o.y*o.y));t.r=m,e.forEach(_o)}}function bo(t){t._pack_next=t._pack_prev=t}function _o(t){delete t._pack_next,delete t._pack_prev}function Eo(t,n,e,r){var i=t.children;if(t.x=n+=r*t.x,t.y=e+=r*t.y,t.r*=r,i)for(var o=-1,u=i.length;++o<u;)Eo(i[o],n,e,r)}function So(t,n,e){var r=t.r+e.r,i=n.x-t.x,o=n.y-t.y;if(r&&(i||o)){var u=n.r+e.r,a=i*i+o*o;u*=u,r*=r;var s=.5+(r-u)/(2*a),c=Math.sqrt(Math.max(0,2*u*(r+a)-(r-=a)*r-u*u))/(2*a);e.x=t.x+s*i+c*o,e.y=t.y+s*o-c*i}else e.x=t.x+r,e.y=t.y}function No(t,n){return t.parent==n.parent?1:2}function ko(t){var n=t.children;return n.length?n[0]:t.t}function Ao(t){var n,e=t.children;return(n=e.length)?e[n-1]:t.t}function Co(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function Lo(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)n=i[o],n.z+=e,n.m+=e,e+=n.s+(r+=n.c)}function Po(t,n,e){return t.a.parent===n.parent?t.a:e}function zo(t){return 1+Ju.max(t,function(t){return t.y})}function qo(t){return t.reduce(function(t,n){return t+n.x},0)/t.length}function Ro(t){var n=t.children;return n&&n.length?Ro(n[0]):t}function Io(t){var n,e=t.children;return e&&(n=e.length)?Io(e[n-1]):t}function To(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Do(t,n){var e=t.x+n[3],r=t.y+n[0],i=t.dx-n[1]-n[3],o=t.dy-n[0]-n[2];return 0>i&&(e+=i/2,i=0),0>o&&(r+=o/2,o=0),{x:e,y:r,dx:i,dy:o}}function Uo(t){var n=t[0],e=t[t.length-1];return e>n?[n,e]:[e,n]}function jo(t){return t.rangeExtent?t.rangeExtent():Uo(t.range())}function Oo(t,n,e,r){var i=e(t[0],t[1]),o=r(n[0],n[1]);return function(t){return o(i(t))}}function Fo(t,n){var e,r=0,i=t.length-1,o=t[r],u=t[i];return o>u&&(e=r,r=i,i=e,e=o,o=u,u=e),t[r]=n.floor(o),t[i]=n.ceil(u),t}function Ho(t){return t?{floor:function(n){return Math.floor(n/t)*t},ceil:function(n){return Math.ceil(n/t)*t}}:pc}function Bo(t,n,e,r){var i=[],o=[],u=0,a=Math.min(t.length,n.length)-1;for(t[a]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<=a;)i.push(e(t[u-1],t[u])),o.push(r(n[u-1],n[u]));return function(n){var e=Ju.bisect(t,n,1,a)-1;return o[e](i[e](n))}}function Yo(t,n,e,r){function i(){var i=Math.min(t.length,n.length)>2?Bo:Oo,s=r?Bi:Hi;return u=i(t,n,s,e),a=i(n,t,s,vi),o}function o(t){return u(t)}var u,a;return o.invert=function(t){return a(t)},o.domain=function(n){return arguments.length?(t=n.map(Number),i()):t},o.range=function(t){return arguments.length?(n=t,i()):n},o.rangeRound=function(t){return o.range(t).interpolate(Ti)},o.clamp=function(t){return arguments.length?(r=t,i()):r},o.interpolate=function(t){return arguments.length?(e=t,i()):e},o.ticks=function(n){return $o(t,n)},o.tickFormat=function(n,e){return Qo(t,n,e)},o.nice=function(n){return Zo(t,n),i()},o.copy=function(){return Yo(t,n,e,r)},i()}function Vo(t,n){return Ju.rebind(t,n,"range","rangeRound","interpolate","clamp")}function Zo(t,n){return Fo(t,Ho(Xo(t,n)[2]))}function Xo(t,n){null==n&&(n=10);var e=Uo(t),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/n)/Math.LN10)),o=n/r*i;return.15>=o?i*=10:.35>=o?i*=5:.75>=o&&(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 $o(t,n){return Ju.range.apply(Ju,Xo(t,n))}function Qo(t,n,e){var r=Xo(t,n);if(e){var i=rs.exec(e);if(i.shift(),"s"===i[8]){var o=Ju.formatPrefix(Math.max(la(r[0]),la(r[1])));return i[7]||(i[7]="."+Jo(o.scale(r[2]))),i[8]="f",e=Ju.format(i.join("")),function(t){return e(o.scale(t))+o.symbol}}i[7]||(i[7]="."+Wo(i[8],r)),e=i.join("")}else e=",."+Jo(r[2])+"f";return Ju.format(e)}function Jo(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function Wo(t,n){var e=Jo(n[2]);return t in gc?Math.abs(e-Jo(Math.max(la(n[0]),la(n[1]))))+ +("e"!==t):e-2*("%"===t)}function Go(t,n,e,r){function i(t){return(e?Math.log(0>t?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function o(t){return e?Math.pow(n,t):-Math.pow(n,-t)}function u(n){return t(i(n))}return u.invert=function(n){return o(t.invert(n))},u.domain=function(n){return arguments.length?(e=n[0]>=0,t.domain((r=n.map(Number)).map(i)),u):r},u.base=function(e){return arguments.length?(n=+e,t.domain(r.map(i)),u):n},u.nice=function(){var n=Fo(r.map(i),e?Math:vc);return t.domain(n),r=n.map(o),u},u.ticks=function(){var t=Uo(r),u=[],a=t[0],s=t[1],c=Math.floor(i(a)),l=Math.ceil(i(s)),f=n%1?2:n;if(isFinite(l-c)){if(e){for(;l>c;c++)for(var y=1;f>y;y++)u.push(o(c)*y);u.push(o(c))}else for(u.push(o(c));c++<l;)for(var y=f-1;y>0;y--)u.push(o(c)*y);for(c=0;u[c]<a;c++);for(l=u.length;u[l-1]>s;l--);u=u.slice(c,l)}return u},u.tickFormat=function(t,n){if(!arguments.length)return dc;arguments.length<2?n=dc:"function"!=typeof n&&(n=Ju.format(n));var r,a=Math.max(.1,t/u.ticks().length),s=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(t){return t/o(s(i(t)+r))<=a?n(t):""}},u.copy=function(){return Go(t.copy(),n,e,r)},Vo(u,t)}function Ko(t,n,e){function r(n){return t(i(n))}var i=tu(n),o=tu(1/n);return r.invert=function(n){return o(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain((e=n.map(Number)).map(i)),r):e},r.ticks=function(t){return $o(e,t)},r.tickFormat=function(t,n){return Qo(e,t,n)},r.nice=function(t){return r.domain(Zo(e,t))},r.exponent=function(u){return arguments.length?(i=tu(n=u),o=tu(1/n),t.domain(e.map(i)),r):n},r.copy=function(){return Ko(t.copy(),n,e)},Vo(r,t)}function tu(t){return function(n){return 0>n?-Math.pow(-n,t):Math.pow(n,t)}}function nu(t,n){function e(e){return o[((i.get(e)||("range"===n.t?i.set(e,t.push(e)):0/0))-1)%o.length]}function r(n,e){return Ju.range(t.length).map(function(t){return n+e*t})}var i,o,u;return e.domain=function(r){if(!arguments.length)return t;t=[],i=new f;for(var o,u=-1,a=r.length;++u<a;)i.has(o=r[u])||i.set(o,t.push(o));return e[n.t].apply(e,n.a)},e.range=function(t){return arguments.length?(o=t,u=0,n={t:"range",a:arguments},e):o},e.rangePoints=function(i,a){arguments.length<2&&(a=0);var s=i[0],c=i[1],l=(c-s)/(Math.max(1,t.length-1)+a);return o=r(t.length<2?(s+c)/2:s+l*a/2,l),u=0,n={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],y=(f-l)/(t.length-a+2*s);return o=r(l+y*s,y),c&&o.reverse(),u=y*(1-a),n={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],y=Math.floor((f-l)/(t.length-a+2*s)),h=f-l-(t.length-a)*y;return o=r(l+Math.round(h/2),y),c&&o.reverse(),u=Math.round(y*(1-a)),n={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return u},e.rangeExtent=function(){return Uo(n.a[0])},e.copy=function(){return nu(t,n)},e.domain(t)}function eu(t,n){function e(){var e=0,o=n.length;for(i=[];++e<o;)i[e-1]=Ju.quantile(t,e/o);return r}function r(t){return isNaN(t=+t)?void 0:n[Ju.bisect(i,t)]}var i;return r.domain=function(n){return arguments.length?(t=n.filter(u).sort(o),e()):t},r.range=function(t){return arguments.length?(n=t,e()):n},r.quantiles=function(){return i},r.invertExtent=function(e){return e=n.indexOf(e),0>e?[0/0,0/0]:[e>0?i[e-1]:t[0],e<i.length?i[e]:t[t.length-1]]},r.copy=function(){return eu(t,n)},e()}function ru(t,n,e){function r(n){return e[Math.max(0,Math.min(u,Math.floor(o*(n-t))))]}function i(){return o=e.length/(n-t),u=e.length-1,r}var o,u;return r.domain=function(e){return arguments.length?(t=+e[0],n=+e[e.length-1],i()):[t,n]},r.range=function(t){return arguments.length?(e=t,i()):e},r.invertExtent=function(n){return n=e.indexOf(n),n=0>n?0/0:n/o+t,[n,n+1/o]},r.copy=function(){return ru(t,n,e)},i()}function iu(t,n){function e(e){return e>=e?n[Ju.bisect(t,e)]:void 0}return e.domain=function(n){return arguments.length?(t=n,e):t},e.range=function(t){return arguments.length?(n=t,e):n},e.invertExtent=function(e){return e=n.indexOf(e),[t[e-1],t[e]]},e.copy=function(){return iu(t,n)},e}function ou(t){function n(t){return+t}return n.invert=n,n.domain=n.range=function(e){return arguments.length?(t=e.map(n),n):t},n.ticks=function(n){return $o(t,n)},n.tickFormat=function(n,e){return Qo(t,n,e)},n.copy=function(){return ou(t)},n}function uu(t){return t.innerRadius}function au(t){return t.outerRadius}function su(t){return t.startAngle}function cu(t){return t.endAngle}function lu(t){function n(n){function u(){c.push("M",o(t(l),a))}for(var s,c=[],l=[],f=-1,y=n.length,h=An(e),x=An(r);++f<y;)i.call(this,s=n[f],f)?l.push([+h.call(this,s,f),+x.call(this,s,f)]):l.length&&(u(),l=[]);return l.length&&u(),c.length?c.join(""):null}var e=Cr,r=Lr,i=Ce,o=fu,u=o.key,a=.7;return n.x=function(t){return arguments.length?(e=t,n):e},n.y=function(t){return arguments.length?(r=t,n):r},n.defined=function(t){return arguments.length?(i=t,n):i},n.interpolate=function(t){return arguments.length?(u="function"==typeof t?o=t:(o=Sc.get(t)||fu).key,n):u},n.tension=function(t){return arguments.length?(a=t,n):a},n}function fu(t){return t.join("L")}function yu(t){return fu(t)+"Z"}function hu(t){for(var n=0,e=t.length,r=t[0],i=[r[0],",",r[1]];++n<e;)i.push("H",(r[0]+(r=t[n])[0])/2,"V",r[1]);return e>1&&i.push("H",r[0]),i.join("")}function xu(t){for(var n=0,e=t.length,r=t[0],i=[r[0],",",r[1]];++n<e;)i.push("V",(r=t[n])[1],"H",r[0]);return i.join("")}function pu(t){for(var n=0,e=t.length,r=t[0],i=[r[0],",",r[1]];++n<e;)i.push("H",(r=t[n])[0],"V",r[1]);return i.join("")}function gu(t,n){return t.length<4?fu(t):t[1]+mu(t.slice(1,t.length-1),Mu(t,n))}function du(t,n){return t.length<3?fu(t):t[0]+mu((t.push(t[0]),t),Mu([t[t.length-2]].concat(t,[t[1]]),n))}function vu(t,n){return t.length<3?fu(t):t[0]+mu(t,Mu(t,n))}function mu(t,n){if(n.length<1||t.length!=n.length&&t.length!=n.length+2)return fu(t);var e=t.length!=n.length,r="",i=t[0],o=t[1],u=n[0],a=u,s=1;if(e&&(r+="Q"+(o[0]-2*u[0]/3)+","+(o[1]-2*u[1]/3)+","+o[0]+","+o[1],i=t[1],s=2),n.length>1){a=n[1],o=t[s],s++,r+="C"+(i[0]+u[0])+","+(i[1]+u[1])+","+(o[0]-a[0])+","+(o[1]-a[1])+","+o[0]+","+o[1];for(var c=2;c<n.length;c++,s++)o=t[s],a=n[c],r+="S"+(o[0]-a[0])+","+(o[1]-a[1])+","+o[0]+","+o[1]}if(e){var l=t[s];r+="Q"+(o[0]+2*a[0]/3)+","+(o[1]+2*a[1]/3)+","+l[0]+","+l[1]}return r}function Mu(t,n){for(var e,r=[],i=(1-n)/2,o=t[0],u=t[1],a=1,s=t.length;++a<s;)e=o,o=u,u=t[a],r.push([i*(u[0]-e[0]),i*(u[1]-e[1])]);return r}function wu(t){if(t.length<3)return fu(t);var n=1,e=t.length,r=t[0],i=r[0],o=r[1],u=[i,i,i,(r=t[1])[0]],a=[o,o,o,r[1]],s=[i,",",o,"L",Su(Ac,u),",",Su(Ac,a)];for(t.push(t[e-1]);++n<=e;)r=t[n],u.shift(),u.push(r[0]),a.shift(),a.push(r[1]),Nu(s,u,a);return t.pop(),s.push("L",r),s.join("")}function bu(t){if(t.length<4)return fu(t);for(var n,e=[],r=-1,i=t.length,o=[0],u=[0];++r<3;)n=t[r],o.push(n[0]),u.push(n[1]);for(e.push(Su(Ac,o)+","+Su(Ac,u)),--r;++r<i;)n=t[r],o.shift(),o.push(n[0]),u.shift(),u.push(n[1]),Nu(e,o,u);return e.join("")}function _u(t){for(var n,e,r=-1,i=t.length,o=i+4,u=[],a=[];++r<4;)e=t[r%i],u.push(e[0]),a.push(e[1]);for(n=[Su(Ac,u),",",Su(Ac,a)],--r;++r<o;)e=t[r%i],u.shift(),u.push(e[0]),a.shift(),a.push(e[1]),Nu(n,u,a);
return n.join("")}function Eu(t,n){var e=t.length-1;if(e)for(var r,i,o=t[0][0],u=t[0][1],a=t[e][0]-o,s=t[e][1]-u,c=-1;++c<=e;)r=t[c],i=c/e,r[0]=n*r[0]+(1-n)*(o+i*a),r[1]=n*r[1]+(1-n)*(u+i*s);return wu(t)}function Su(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]}function Nu(t,n,e){t.push("C",Su(Nc,n),",",Su(Nc,e),",",Su(kc,n),",",Su(kc,e),",",Su(Ac,n),",",Su(Ac,e))}function ku(t,n){return(n[1]-t[1])/(n[0]-t[0])}function Au(t){for(var n=0,e=t.length-1,r=[],i=t[0],o=t[1],u=r[0]=ku(i,o);++n<e;)r[n]=(u+(u=ku(i=o,o=t[n+1])))/2;return r[n]=u,r}function Cu(t){for(var n,e,r,i,o=[],u=Au(t),a=-1,s=t.length-1;++a<s;)n=ku(t[a],t[a+1]),la(n)<Pa?u[a]=u[a+1]=0:(e=u[a]/n,r=u[a+1]/n,i=e*e+r*r,i>9&&(i=3*n/Math.sqrt(i),u[a]=i*e,u[a+1]=i*r));for(a=-1;++a<=s;)i=(t[Math.min(s,a+1)][0]-t[Math.max(0,a-1)][0])/(6*(1+u[a]*u[a])),o.push([i||0,u[a]*i||0]);return o}function Lu(t){return t.length<3?fu(t):t[0]+mu(t,Cu(t))}function Pu(t){for(var n,e,r,i=-1,o=t.length;++i<o;)n=t[i],e=n[0],r=n[1]+_c,n[0]=e*Math.cos(r),n[1]=e*Math.sin(r);return t}function zu(t){function n(n){function s(){p.push("M",a(t(d),f),l,c(t(g.reverse()),f),"Z")}for(var y,h,x,p=[],g=[],d=[],v=-1,m=n.length,M=An(e),w=An(i),b=e===r?function(){return h}:An(r),_=i===o?function(){return x}:An(o);++v<m;)u.call(this,y=n[v],v)?(g.push([h=+M.call(this,y,v),x=+w.call(this,y,v)]),d.push([+b.call(this,y,v),+_.call(this,y,v)])):g.length&&(s(),g=[],d=[]);return g.length&&s(),p.length?p.join(""):null}var e=Cr,r=Cr,i=0,o=Lr,u=Ce,a=fu,s=a.key,c=a,l="L",f=.7;return n.x=function(t){return arguments.length?(e=r=t,n):r},n.x0=function(t){return arguments.length?(e=t,n):e},n.x1=function(t){return arguments.length?(r=t,n):r},n.y=function(t){return arguments.length?(i=o=t,n):o},n.y0=function(t){return arguments.length?(i=t,n):i},n.y1=function(t){return arguments.length?(o=t,n):o},n.defined=function(t){return arguments.length?(u=t,n):u},n.interpolate=function(t){return arguments.length?(s="function"==typeof t?a=t:(a=Sc.get(t)||fu).key,c=a.reverse||a,l=a.closed?"M":"L",n):s},n.tension=function(t){return arguments.length?(f=t,n):f},n}function qu(t){return t.radius}function Ru(t){return[t.x,t.y]}function Iu(t){return function(){var n=t.apply(this,arguments),e=n[0],r=n[1]+_c;return[e*Math.cos(r),e*Math.sin(r)]}}function Tu(){return 64}function Du(){return"circle"}function Uu(t){var n=Math.sqrt(t/Aa);return"M0,"+n+"A"+n+","+n+" 0 1,1 0,"+-n+"A"+n+","+n+" 0 1,1 0,"+n+"Z"}function ju(t,n){return pa(t,Rc),t.id=n,t}function Ou(t,n,e,r){var i=t.id;return F(t,"function"==typeof e?function(t,o,u){t.__transition__[i].tween.set(n,r(e.call(t,t.__data__,o,u)))}:(e=r(e),function(t){t.__transition__[i].tween.set(n,e)}))}function Fu(t){return null==t&&(t=""),function(){this.textContent=t}}function Hu(t,n,e,r){var i=t.__transition__||(t.__transition__={active:0,count:0}),o=i[e];if(!o){var u=r.time;o=i[e]={tween:new f,time:u,ease:r.ease,delay:r.delay,duration:r.duration},++i.count,Ju.timer(function(r){function a(r){return i.active>e?c():(i.active=e,o.event&&o.event.start.call(t,l,n),o.tween.forEach(function(e,r){(r=r.call(t,l,n))&&p.push(r)}),void Ju.timer(function(){return x.c=s(r||1)?Ce:s,1},0,u))}function s(r){if(i.active!==e)return c();for(var u=r/h,a=f(u),s=p.length;s>0;)p[--s].call(t,a);return u>=1?(o.event&&o.event.end.call(t,l,n),c()):void 0}function c(){return--i.count?delete i[e]:delete t.__transition__,1}var l=t.__data__,f=o.ease,y=o.delay,h=o.duration,x=ts,p=[];return x.t=y+u,r>=y?a(r-y):void(x.c=a)},0,u)}}function Bu(t,n){t.attr("transform",function(t){return"translate("+n(t)+",0)"})}function Yu(t,n){t.attr("transform",function(t){return"translate(0,"+n(t)+")"})}function Vu(t){return t.toISOString()}function Zu(t,n,e){function r(n){return t(n)}function i(t,e){var r=t[1]-t[0],i=r/e,o=Ju.bisect(Bc,i);return o==Bc.length?[n.year,Xo(t.map(function(t){return t/31536e6}),e)[2]]:o?n[i/Bc[o-1]<Bc[o]/i?o-1:o]:[Zc,Xo(t,e)[2]]}return r.invert=function(n){return Xu(t.invert(n))},r.domain=function(n){return arguments.length?(t.domain(n),r):t.domain().map(Xu)},r.nice=function(t,n){function e(e){return!isNaN(e)&&!t.range(e,Xu(+e+1),n).length}var o=r.domain(),u=Uo(o),a=null==t?i(u,10):"number"==typeof t&&i(u,t);return a&&(t=a[0],n=a[1]),r.domain(Fo(o,n>1?{floor:function(n){for(;e(n=t.floor(n));)n=Xu(n-1);return n},ceil:function(n){for(;e(n=t.ceil(n));)n=Xu(+n+1);return n}}:t))},r.ticks=function(t,n){var e=Uo(r.domain()),o=null==t?i(e,10):"number"==typeof t?i(e,t):!t.range&&[{range:t},n];return o&&(t=o[0],n=o[1]),t.range(e[0],Xu(+e[1]+1),1>n?1:n)},r.tickFormat=function(){return e},r.copy=function(){return Zu(t.copy(),n,e)},Vo(r,t)}function Xu(t){return new Date(t)}function $u(t){return JSON.parse(t.responseText)}function Qu(t){var n=Ku.createRange();return n.selectNode(Ku.body),n.createContextualFragment(t.responseText)}var Ju={version:"3.4.11"};Date.now||(Date.now=function(){return+new Date});var Wu=[].slice,Gu=function(t){return Wu.call(t)},Ku=document,ta=Ku.documentElement,na=window;try{Gu(ta.childNodes)[0].nodeType}catch(ea){Gu=function(t){for(var n=t.length,e=new Array(n);n--;)e[n]=t[n];return e}}try{Ku.createElement("div").style.setProperty("opacity",0,"")}catch(ra){var ia=na.Element.prototype,oa=ia.setAttribute,ua=ia.setAttributeNS,aa=na.CSSStyleDeclaration.prototype,sa=aa.setProperty;ia.setAttribute=function(t,n){oa.call(this,t,n+"")},ia.setAttributeNS=function(t,n,e){ua.call(this,t,n,e+"")},aa.setProperty=function(t,n,e){sa.call(this,t,n+"",e)}}Ju.ascending=o,Ju.descending=function(t,n){return t>n?-1:n>t?1:n>=t?0:0/0},Ju.min=function(t,n){var e,r,i=-1,o=t.length;if(1===arguments.length){for(;++i<o&&!(null!=(e=t[i])&&e>=e);)e=void 0;for(;++i<o;)null!=(r=t[i])&&e>r&&(e=r)}else{for(;++i<o&&!(null!=(e=n.call(t,t[i],i))&&e>=e);)e=void 0;for(;++i<o;)null!=(r=n.call(t,t[i],i))&&e>r&&(e=r)}return e},Ju.max=function(t,n){var e,r,i=-1,o=t.length;if(1===arguments.length){for(;++i<o&&!(null!=(e=t[i])&&e>=e);)e=void 0;for(;++i<o;)null!=(r=t[i])&&r>e&&(e=r)}else{for(;++i<o&&!(null!=(e=n.call(t,t[i],i))&&e>=e);)e=void 0;for(;++i<o;)null!=(r=n.call(t,t[i],i))&&r>e&&(e=r)}return e},Ju.extent=function(t,n){var e,r,i,o=-1,u=t.length;if(1===arguments.length){for(;++o<u&&!(null!=(e=i=t[o])&&e>=e);)e=i=void 0;for(;++o<u;)null!=(r=t[o])&&(e>r&&(e=r),r>i&&(i=r))}else{for(;++o<u&&!(null!=(e=i=n.call(t,t[o],o))&&e>=e);)e=void 0;for(;++o<u;)null!=(r=n.call(t,t[o],o))&&(e>r&&(e=r),r>i&&(i=r))}return[e,i]},Ju.sum=function(t,n){var e,r=0,i=t.length,o=-1;if(1===arguments.length)for(;++o<i;)isNaN(e=+t[o])||(r+=e);else for(;++o<i;)isNaN(e=+n.call(t,t[o],o))||(r+=e);return r},Ju.mean=function(t,n){var e,r=0,i=t.length,o=-1,a=i;if(1===arguments.length)for(;++o<i;)u(e=t[o])?r+=e:--a;else for(;++o<i;)u(e=n.call(t,t[o],o))?r+=e:--a;return a?r/a:void 0},Ju.quantile=function(t,n){var e=(t.length-1)*n+1,r=Math.floor(e),i=+t[r-1],o=e-r;return o?i+o*(t[r]-i):i},Ju.median=function(t,n){return arguments.length>1&&(t=t.map(n)),t=t.filter(u),t.length?Ju.quantile(t.sort(o),.5):void 0};var ca=a(o);Ju.bisectLeft=ca.left,Ju.bisect=Ju.bisectRight=ca.right,Ju.bisector=function(t){return a(1===t.length?function(n,e){return o(t(n),e)}:t)},Ju.shuffle=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t},Ju.permute=function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r},Ju.pairs=function(t){for(var n,e=0,r=t.length-1,i=t[0],o=new Array(0>r?0:r);r>e;)o[e]=[n=i,i=t[++e]];return o},Ju.zip=function(){if(!(r=arguments.length))return[];for(var t=-1,n=Ju.min(arguments,s),e=new Array(n);++t<n;)for(var r,i=-1,o=e[t]=new Array(r);++i<r;)o[i]=arguments[i][t];return e},Ju.transpose=function(t){return Ju.zip.apply(Ju,t)},Ju.keys=function(t){var n=[];for(var e in t)n.push(e);return n},Ju.values=function(t){var n=[];for(var e in t)n.push(t[e]);return n},Ju.entries=function(t){var n=[];for(var e in t)n.push({key:e,value:t[e]});return n},Ju.merge=function(t){for(var n,e,r,i=t.length,o=-1,u=0;++o<i;)u+=t[o].length;for(e=new Array(u);--i>=0;)for(r=t[i],n=r.length;--n>=0;)e[--u]=r[n];return e};var la=Math.abs;Ju.range=function(t,n,e){if(arguments.length<3&&(e=1,arguments.length<2&&(n=t,t=0)),(n-t)/e===1/0)throw new Error("infinite range");var r,i=[],o=c(la(e)),u=-1;if(t*=o,n*=o,e*=o,0>e)for(;(r=t+e*++u)>n;)i.push(r/o);else for(;(r=t+e*++u)<n;)i.push(r/o);return i},Ju.map=function(t){var n=new f;if(t instanceof f)t.forEach(function(t,e){n.set(t,e)});else for(var e in t)n.set(e,t[e]);return n},l(f,{has:y,get:function(t){return this[fa+t]},set:function(t,n){return this[fa+t]=n},remove:h,keys:x,values:function(){var t=[];return this.forEach(function(n,e){t.push(e)}),t},entries:function(){var t=[];return this.forEach(function(n,e){t.push({key:n,value:e})}),t},size:p,empty:g,forEach:function(t){for(var n in this)n.charCodeAt(0)===ya&&t.call(this,n.substring(1),this[n])}});var fa="\x00",ya=fa.charCodeAt(0);Ju.nest=function(){function t(n,u,a){if(a>=o.length)return r?r.call(i,u):e?u.sort(e):u;for(var s,c,l,y,h=-1,x=u.length,p=o[a++],g=new f;++h<x;)(y=g.get(s=p(c=u[h])))?y.push(c):g.set(s,[c]);return n?(c=n(),l=function(e,r){c.set(e,t(n,r,a))}):(c={},l=function(e,r){c[e]=t(n,r,a)}),g.forEach(l),c}function n(t,e){if(e>=o.length)return t;var r=[],i=u[e++];return t.forEach(function(t,i){r.push({key:t,values:n(i,e)})}),i?r.sort(function(t,n){return i(t.key,n.key)}):r}var e,r,i={},o=[],u=[];return i.map=function(n,e){return t(e,n,0)},i.entries=function(e){return n(t(Ju.map,e,0),0)},i.key=function(t){return o.push(t),i},i.sortKeys=function(t){return u[o.length-1]=t,i},i.sortValues=function(t){return e=t,i},i.rollup=function(t){return r=t,i},i},Ju.set=function(t){var n=new d;if(t)for(var e=0,r=t.length;r>e;++e)n.add(t[e]);return n},l(d,{has:y,add:function(t){return this[fa+t]=!0,t},remove:function(t){return t=fa+t,t in this&&delete this[t]},values:x,size:p,empty:g,forEach:function(t){for(var n in this)n.charCodeAt(0)===ya&&t.call(this,n.substring(1))}}),Ju.behavior={},Ju.rebind=function(t,n){for(var e,r=1,i=arguments.length;++r<i;)t[e=arguments[r]]=v(t,n,n[e]);return t};var ha=["webkit","ms","moz","Moz","o","O"];Ju.dispatch=function(){for(var t=new w,n=-1,e=arguments.length;++n<e;)t[arguments[n]]=b(t);return t},w.prototype.on=function(t,n){var e=t.indexOf("."),r="";if(e>=0&&(r=t.substring(e+1),t=t.substring(0,e)),t)return arguments.length<2?this[t].on(r):this[t].on(r,n);if(2===arguments.length){if(null==n)for(t in this)this.hasOwnProperty(t)&&this[t].on(r,null);return this}},Ju.event=null,Ju.requote=function(t){return t.replace(xa,"\\$&")};var xa=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,pa={}.__proto__?function(t,n){t.__proto__=n}:function(t,n){for(var e in n)t[e]=n[e]},ga=function(t,n){return n.querySelector(t)},da=function(t,n){return n.querySelectorAll(t)},va=ta.matches||ta[m(ta,"matchesSelector")],ma=function(t,n){return va.call(t,n)};"function"==typeof Sizzle&&(ga=function(t,n){return Sizzle(t,n)[0]||null},da=Sizzle,ma=Sizzle.matchesSelector),Ju.selection=function(){return _a};var Ma=Ju.selection.prototype=[];Ma.select=function(t){var n,e,r,i,o=[];t=k(t);for(var u=-1,a=this.length;++u<a;){o.push(n=[]),n.parentNode=(r=this[u]).parentNode;for(var s=-1,c=r.length;++s<c;)(i=r[s])?(n.push(e=t.call(i,i.__data__,s,u)),e&&"__data__"in i&&(e.__data__=i.__data__)):n.push(null)}return N(o)},Ma.selectAll=function(t){var n,e,r=[];t=A(t);for(var i=-1,o=this.length;++i<o;)for(var u=this[i],a=-1,s=u.length;++a<s;)(e=u[a])&&(r.push(n=Gu(t.call(e,e.__data__,a,i))),n.parentNode=e);return N(r)};var wa={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/"};Ju.ns={prefix:wa,qualify:function(t){var n=t.indexOf(":"),e=t;return n>=0&&(e=t.substring(0,n),t=t.substring(n+1)),wa.hasOwnProperty(e)?{space:wa[e],local:t}:t}},Ma.attr=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node();return t=Ju.ns.qualify(t),t.local?e.getAttributeNS(t.space,t.local):e.getAttribute(t)}for(n in t)this.each(C(n,t[n]));return this}return this.each(C(t,n))},Ma.classed=function(t,n){if(arguments.length<2){if("string"==typeof t){var e=this.node(),r=(t=z(t)).length,i=-1;if(n=e.classList){for(;++i<r;)if(!n.contains(t[i]))return!1}else for(n=e.getAttribute("class");++i<r;)if(!P(t[i]).test(n))return!1;return!0}for(n in t)this.each(q(n,t[n]));return this}return this.each(q(t,n))},Ma.style=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n="");for(e in t)this.each(I(e,t[e],n));return this}if(2>r)return na.getComputedStyle(this.node(),null).getPropertyValue(t);e=""}return this.each(I(t,n,e))},Ma.property=function(t,n){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(n in t)this.each(T(n,t[n]));return this}return this.each(T(t,n))},Ma.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.textContent=null==n?"":n}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Ma.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var n=t.apply(this,arguments);this.innerHTML=null==n?"":n}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Ma.append=function(t){return t=D(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Ma.insert=function(t,n){return t=D(t),n=k(n),this.select(function(){return this.insertBefore(t.apply(this,arguments),n.apply(this,arguments)||null)})},Ma.remove=function(){return this.each(function(){var t=this.parentNode;t&&t.removeChild(this)})},Ma.data=function(t,n){function e(t,e){var r,i,o,u=t.length,l=e.length,y=Math.min(u,l),h=new Array(l),x=new Array(l),p=new Array(u);if(n){var g,d=new f,v=new f,m=[];for(r=-1;++r<u;)g=n.call(i=t[r],i.__data__,r),d.has(g)?p[r]=i:d.set(g,i),m.push(g);for(r=-1;++r<l;)g=n.call(e,o=e[r],r),(i=d.get(g))?(h[r]=i,i.__data__=o):v.has(g)||(x[r]=U(o)),v.set(g,o),d.remove(g);for(r=-1;++r<u;)d.has(m[r])&&(p[r]=t[r])}else{for(r=-1;++r<y;)i=t[r],o=e[r],i?(i.__data__=o,h[r]=i):x[r]=U(o);for(;l>r;++r)x[r]=U(e[r]);for(;u>r;++r)p[r]=t[r]}x.update=h,x.parentNode=h.parentNode=p.parentNode=t.parentNode,a.push(x),s.push(h),c.push(p)}var r,i,o=-1,u=this.length;if(!arguments.length){for(t=new Array(u=(r=this[0]).length);++o<u;)(i=r[o])&&(t[o]=i.__data__);return t}var a=H([]),s=N([]),c=N([]);if("function"==typeof t)for(;++o<u;)e(r=this[o],t.call(r,r.parentNode.__data__,o));else for(;++o<u;)e(r=this[o],t);return s.enter=function(){return a},s.exit=function(){return c},s},Ma.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Ma.filter=function(t){var n,e,r,i=[];"function"!=typeof t&&(t=j(t));for(var o=0,u=this.length;u>o;o++){i.push(n=[]),n.parentNode=(e=this[o]).parentNode;for(var a=0,s=e.length;s>a;a++)(r=e[a])&&t.call(r,r.__data__,a,o)&&n.push(r)}return N(i)},Ma.order=function(){for(var t=-1,n=this.length;++t<n;)for(var e,r=this[t],i=r.length-1,o=r[i];--i>=0;)(e=r[i])&&(o&&o!==e.nextSibling&&o.parentNode.insertBefore(e,o),o=e);return this},Ma.sort=function(t){t=O.apply(this,arguments);for(var n=-1,e=this.length;++n<e;)this[n].sort(t);return this.order()},Ma.each=function(t){return F(this,function(n,e,r){t.call(n,n.__data__,e,r)})},Ma.call=function(t){var n=Gu(arguments);return t.apply(n[0]=this,n),this},Ma.empty=function(){return!this.node()},Ma.node=function(){for(var t=0,n=this.length;n>t;t++)for(var e=this[t],r=0,i=e.length;i>r;r++){var o=e[r];if(o)return o}return null},Ma.size=function(){var t=0;return this.each(function(){++t}),t};var ba=[];Ju.selection.enter=H,Ju.selection.enter.prototype=ba,ba.append=Ma.append,ba.empty=Ma.empty,ba.node=Ma.node,ba.call=Ma.call,ba.size=Ma.size,ba.select=function(t){for(var n,e,r,i,o,u=[],a=-1,s=this.length;++a<s;){r=(i=this[a]).update,u.push(n=[]),n.parentNode=i.parentNode;for(var c=-1,l=i.length;++c<l;)(o=i[c])?(n.push(r[c]=e=t.call(i.parentNode,o.__data__,c,a)),e.__data__=o.__data__):n.push(null)}return N(u)},ba.insert=function(t,n){return arguments.length<2&&(n=B(this)),Ma.insert.call(this,t,n)},Ma.transition=function(){for(var t,n,e=Lc||++Ic,r=[],i=Pc||{time:Date.now(),ease:Si,delay:0,duration:250},o=-1,u=this.length;++o<u;){r.push(t=[]);for(var a=this[o],s=-1,c=a.length;++s<c;)(n=a[s])&&Hu(n,s,e,i),t.push(n)}return ju(r,e)},Ma.interrupt=function(){return this.each(Y)},Ju.select=function(t){var n=["string"==typeof t?ga(t,Ku):t];return n.parentNode=ta,N([n])},Ju.selectAll=function(t){var n=Gu("string"==typeof t?da(t,Ku):t);return n.parentNode=ta,N([n])};var _a=Ju.select(ta);Ma.on=function(t,n,e){var r=arguments.length;if(3>r){if("string"!=typeof t){2>r&&(n=!1);for(e in t)this.each(V(e,t[e],n));return this}if(2>r)return(r=this.node()["__on"+t])&&r._;e=!1}return this.each(V(t,n,e))};var Ea=Ju.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ea.forEach(function(t){"on"+t in Ku&&Ea.remove(t)});var Sa="onselectstart"in Ku?null:m(ta.style,"userSelect"),Na=0;Ju.mouse=function(t){return Q(t,E())};var ka=/WebKit/.test(na.navigator.userAgent)?-1:0;Ju.touches=function(t,n){return arguments.length<2&&(n=E().touches),n?Gu(n).map(function(n){var e=Q(t,n);return e.identifier=n.identifier,e}):[]},Ju.behavior.drag=function(){function t(){this.on("mousedown.drag",i).on("touchstart.drag",o)}function n(t,n,i,o,u){return function(){function a(){var t,e,r=n(y,p);r&&(t=r[0]-m[0],e=r[1]-m[1],x|=t|e,m=r,h({type:"drag",x:r[0]+c[0],y:r[1]+c[1],dx:t,dy:e}))}function s(){n(y,p)&&(d.on(o+g,null).on(u+g,null),v(x&&Ju.event.target===f),h({type:"dragend"}))}var c,l=this,f=Ju.event.target,y=l.parentNode,h=e.of(l,arguments),x=0,p=t(),g=".drag"+(null==p?"":"-"+p),d=Ju.select(i()).on(o+g,a).on(u+g,s),v=$(),m=n(y,p);r?(c=r.apply(l,arguments),c=[c.x-m[0],c.y-m[1]]):c=[0,0],h({type:"dragstart"})}}var e=S(t,"drag","dragstart","dragend"),r=null,i=n(M,Ju.mouse,G,"mousemove","mouseup"),o=n(J,Ju.touch,W,"touchmove","touchend");return t.origin=function(n){return arguments.length?(r=n,t):r},Ju.rebind(t,e,"on")};var Aa=Math.PI,Ca=2*Aa,La=Aa/2,Pa=1e-6,za=Pa*Pa,qa=Aa/180,Ra=180/Aa,Ia=Math.SQRT2,Ta=2,Da=4;Ju.interpolateZoom=function(t,n){function e(t){var n=t*v;if(d){var e=on(p),u=o/(Ta*y)*(e*un(Ia*n+p)-rn(p));return[r+u*c,i+u*l,o*e/on(Ia*n+p)]}return[r+t*c,i+t*l,o*Math.exp(Ia*n)]}var r=t[0],i=t[1],o=t[2],u=n[0],a=n[1],s=n[2],c=u-r,l=a-i,f=c*c+l*l,y=Math.sqrt(f),h=(s*s-o*o+Da*f)/(2*o*Ta*y),x=(s*s-o*o-Da*f)/(2*s*Ta*y),p=Math.log(Math.sqrt(h*h+1)-h),g=Math.log(Math.sqrt(x*x+1)-x),d=g-p,v=(d||Math.log(s/o))/Ia;return e.duration=1e3*v,e},Ju.behavior.zoom=function(){function t(t){t.on(k,c).on(Oa+".zoom",f).on("dblclick.zoom",y).on(L,l)}function n(t){return[(t[0]-b.x)/b.k,(t[1]-b.y)/b.k]}function e(t){return[t[0]*b.k+b.x,t[1]*b.k+b.y]}function r(t){b.k=Math.max(N[0],Math.min(N[1],t))}function i(t,n){n=e(n),b.x+=t[0]-n[0],b.y+=t[1]-n[1]}function o(){m&&m.domain(v.range().map(function(t){return(t-b.x)/b.k}).map(v.invert)),w&&w.domain(M.range().map(function(t){return(t-b.y)/b.k}).map(M.invert))}function u(t){t({type:"zoomstart"})}function a(t){o(),t({type:"zoom",scale:b.k,translate:[b.x,b.y]})}function s(t){t({type:"zoomend"})}function c(){function t(){l=1,i(Ju.mouse(r),y),a(c)}function e(){f.on(A,null).on(C,null),h(l&&Ju.event.target===o),s(c)}var r=this,o=Ju.event.target,c=P.of(r,arguments),l=0,f=Ju.select(na).on(A,t).on(C,e),y=n(Ju.mouse(r)),h=$();Y.call(r),u(c)}function l(){function t(){var t=Ju.touches(h);return y=b.k,t.forEach(function(t){t.identifier in p&&(p[t.identifier]=n(t))}),t}function e(){var n=Ju.event.target;Ju.select(n).on(m,o).on(M,f),w.push(n);for(var e=Ju.event.changedTouches,u=0,s=e.length;s>u;++u)p[e[u].identifier]=null;var c=t(),l=Date.now();if(1===c.length){if(500>l-d){var y=c[0],h=p[y.identifier];r(2*b.k),i(y,h),_(),a(x)}d=l}else if(c.length>1){var y=c[0],v=c[1],E=y[0]-v[0],S=y[1]-v[1];g=E*E+S*S}}function o(){for(var t,n,e,o,u=Ju.touches(h),s=0,c=u.length;c>s;++s,o=null)if(e=u[s],o=p[e.identifier]){if(n)break;t=e,n=o}if(o){var l=(l=e[0]-t[0])*l+(l=e[1]-t[1])*l,f=g&&Math.sqrt(l/g);t=[(t[0]+e[0])/2,(t[1]+e[1])/2],n=[(n[0]+o[0])/2,(n[1]+o[1])/2],r(f*y)}d=null,i(t,n),a(x)}function f(){if(Ju.event.touches.length){for(var n=Ju.event.changedTouches,e=0,r=n.length;r>e;++e)delete p[n[e].identifier];for(var i in p)return void t()}Ju.selectAll(w).on(v,null),E.on(k,c).on(L,l),S(),s(x)}var y,h=this,x=P.of(h,arguments),p={},g=0,v=".zoom-"+Ju.event.changedTouches[0].identifier,m="touchmove"+v,M="touchend"+v,w=[],E=Ju.select(h).on(k,null).on(L,e),S=$();Y.call(h),e(),u(x)}function f(){var t=P.of(this,arguments);g?clearTimeout(g):(h=n(x=p||Ju.mouse(this)),Y.call(this),u(t)),g=setTimeout(function(){g=null,s(t)},50),_(),r(Math.pow(2,.002*Ua())*b.k),i(x,h),a(t)}function y(){var t=P.of(this,arguments),e=Ju.mouse(this),o=n(e),c=Math.log(b.k)/Math.LN2;u(t),r(Math.pow(2,Ju.event.shiftKey?Math.ceil(c)-1:Math.floor(c)+1)),i(e,o),a(t),s(t)}var h,x,p,g,d,v,m,M,w,b={x:0,y:0,k:1},E=[960,500],N=ja,k="mousedown.zoom",A="mousemove.zoom",C="mouseup.zoom",L="touchstart.zoom",P=S(t,"zoomstart","zoom","zoomend");return t.event=function(t){t.each(function(){var t=P.of(this,arguments),n=b;Lc?Ju.select(this).transition().each("start.zoom",function(){b=this.__chart__||{x:0,y:0,k:1},u(t)}).tween("zoom:zoom",function(){var e=E[0],r=E[1],i=e/2,o=r/2,u=Ju.interpolateZoom([(i-b.x)/b.k,(o-b.y)/b.k,e/b.k],[(i-n.x)/n.k,(o-n.y)/n.k,e/n.k]);return function(n){var r=u(n),s=e/r[2];this.__chart__=b={x:i-r[0]*s,y:o-r[1]*s,k:s},a(t)}}).each("end.zoom",function(){s(t)}):(this.__chart__=b,u(t),a(t),s(t))})},t.translate=function(n){return arguments.length?(b={x:+n[0],y:+n[1],k:b.k},o(),t):[b.x,b.y]},t.scale=function(n){return arguments.length?(b={x:b.x,y:b.y,k:+n},o(),t):b.k},t.scaleExtent=function(n){return arguments.length?(N=null==n?ja:[+n[0],+n[1]],t):N},t.center=function(n){return arguments.length?(p=n&&[+n[0],+n[1]],t):p},t.size=function(n){return arguments.length?(E=n&&[+n[0],+n[1]],t):E},t.x=function(n){return arguments.length?(m=n,v=n.copy(),b={x:0,y:0,k:1},t):m},t.y=function(n){return arguments.length?(w=n,M=n.copy(),b={x:0,y:0,k:1},t):w},Ju.rebind(t,P,"on")};var Ua,ja=[0,1/0],Oa="onwheel"in Ku?(Ua=function(){return-Ju.event.deltaY*(Ju.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Ku?(Ua=function(){return Ju.event.wheelDelta},"mousewheel"):(Ua=function(){return-Ju.event.detail},"MozMousePixelScroll");Ju.color=sn,sn.prototype.toString=function(){return this.rgb()+""},Ju.hsl=cn;var Fa=cn.prototype=new sn;Fa.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new cn(this.h,this.s,this.l/t)},Fa.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new cn(this.h,this.s,t*this.l)},Fa.rgb=function(){return ln(this.h,this.s,this.l)},Ju.hcl=fn;var Ha=fn.prototype=new sn;Ha.brighter=function(t){return new fn(this.h,this.c,Math.min(100,this.l+Ba*(arguments.length?t:1)))},Ha.darker=function(t){return new fn(this.h,this.c,Math.max(0,this.l-Ba*(arguments.length?t:1)))},Ha.rgb=function(){return yn(this.h,this.c,this.l).rgb()},Ju.lab=hn;var Ba=18,Ya=.95047,Va=1,Za=1.08883,Xa=hn.prototype=new sn;Xa.brighter=function(t){return new hn(Math.min(100,this.l+Ba*(arguments.length?t:1)),this.a,this.b)},Xa.darker=function(t){return new hn(Math.max(0,this.l-Ba*(arguments.length?t:1)),this.a,this.b)},Xa.rgb=function(){return xn(this.l,this.a,this.b)},Ju.rgb=mn;var $a=mn.prototype=new sn;$a.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var n=this.r,e=this.g,r=this.b,i=30;return n||e||r?(n&&i>n&&(n=i),e&&i>e&&(e=i),r&&i>r&&(r=i),new mn(Math.min(255,n/t),Math.min(255,e/t),Math.min(255,r/t))):new mn(i,i,i)},$a.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new mn(t*this.r,t*this.g,t*this.b)},$a.hsl=function(){return En(this.r,this.g,this.b)},$a.toString=function(){return"#"+bn(this.r)+bn(this.g)+bn(this.b)};var Qa=Ju.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});Qa.forEach(function(t,n){Qa.set(t,Mn(n))}),Ju.functor=An,Ju.xhr=Ln(Cn),Ju.dsv=function(t,n){function e(t,e,o){arguments.length<3&&(o=e,e=null);var u=Pn(t,n,null==e?r:i(e),o);return u.row=function(t){return arguments.length?u.response(null==(e=t)?r:i(t)):e},u}function r(t){return e.parse(t.responseText)}function i(t){return function(n){return e.parse(n.responseText,t)}}function o(n){return n.map(u).join(t)}function u(t){return a.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var a=new RegExp('["'+t+"\n]"),s=t.charCodeAt(0);return e.parse=function(t,n){var r;return e.parseRows(t,function(t,e){if(r)return r(t,e-1);var i=new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}");r=n?function(t,e){return n(i(t),e)}:i})},e.parseRows=function(t,n){function e(){if(l>=c)return u;if(i)return i=!1,o;var n=l;if(34===t.charCodeAt(n)){for(var e=n;e++<c;)if(34===t.charCodeAt(e)){if(34!==t.charCodeAt(e+1))break;++e}l=e+2;var r=t.charCodeAt(e+1);return 13===r?(i=!0,10===t.charCodeAt(e+2)&&++l):10===r&&(i=!0),t.substring(n+1,e).replace(/""/g,'"')}for(;c>l;){var r=t.charCodeAt(l++),a=1;if(10===r)i=!0;else if(13===r)i=!0,10===t.charCodeAt(l)&&(++l,++a);else if(r!==s)continue;return t.substring(n,l-a)}return t.substring(n)}for(var r,i,o={},u={},a=[],c=t.length,l=0,f=0;(r=e())!==u;){for(var y=[];r!==o&&r!==u;)y.push(r),r=e();(!n||(y=n(y,f++)))&&a.push(y)}return a},e.format=function(n){if(Array.isArray(n[0]))return e.formatRows(n);var r=new d,i=[];return n.forEach(function(t){for(var n in t)r.has(n)||i.push(r.add(n))}),[i.map(u).join(t)].concat(n.map(function(n){return i.map(function(t){return u(n[t])}).join(t)})).join("\n")},e.formatRows=function(t){return t.map(o).join("\n")},e},Ju.csv=Ju.dsv(",","text/csv"),Ju.tsv=Ju.dsv(" ","text/tab-separated-values"),Ju.touch=function(t,n,e){if(arguments.length<3&&(e=n,n=E().changedTouches),n)for(var r,i=0,o=n.length;o>i;++i)if((r=n[i]).identifier===e)return Q(t,r)};var Ja,Wa,Ga,Ka,ts,ns=na[m(na,"requestAnimationFrame")]||function(t){setTimeout(t,17)};Ju.timer=function(t,n,e){var r=arguments.length;2>r&&(n=0),3>r&&(e=Date.now());var i=e+n,o={c:t,t:i,f:!1,n:null};Wa?Wa.n=o:Ja=o,Wa=o,Ga||(Ka=clearTimeout(Ka),Ga=1,ns(qn))},Ju.timer.flush=function(){Rn(),In()},Ju.round=function(t,n){return n?Math.round(t*(n=Math.pow(10,n)))/n:Math.round(t)};var es=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(Dn);Ju.formatPrefix=function(t,n){var e=0;return t&&(0>t&&(t*=-1),n&&(t=Ju.round(t,Tn(t,n))),e=1+Math.floor(1e-12+Math.log(t)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((e-1)/3)))),es[8+e/3]};var rs=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,is=Ju.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,n){return t.toPrecision(n)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},r:function(t,n){return(t=Ju.round(t,Tn(t,n))).toFixed(Math.max(0,Math.min(20,Tn(t*(1+1e-15),n))))}}),os=Ju.time={},us=Date;On.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(){as.setUTCDate.apply(this._,arguments)},setDay:function(){as.setUTCDay.apply(this._,arguments)},setFullYear:function(){as.setUTCFullYear.apply(this._,arguments)},setHours:function(){as.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){as.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){as.setUTCMinutes.apply(this._,arguments)},setMonth:function(){as.setUTCMonth.apply(this._,arguments)},setSeconds:function(){as.setUTCSeconds.apply(this._,arguments)},setTime:function(){as.setTime.apply(this._,arguments)}};var as=Date.prototype;os.year=Fn(function(t){return t=os.day(t),t.setMonth(0,1),t},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t){return t.getFullYear()}),os.years=os.year.range,os.years.utc=os.year.utc.range,os.day=Fn(function(t){var n=new us(2e3,0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n},function(t,n){t.setDate(t.getDate()+n)},function(t){return t.getDate()-1}),os.days=os.day.range,os.days.utc=os.day.utc.range,os.dayOfYear=function(t){var n=os.year(t);return Math.floor((t-n-6e4*(t.getTimezoneOffset()-n.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,n){n=7-n;var e=os[t]=Fn(function(t){return(t=os.day(t)).setDate(t.getDate()-(t.getDay()+n)%7),t},function(t,n){t.setDate(t.getDate()+7*Math.floor(n))},function(t){var e=os.year(t).getDay();return Math.floor((os.dayOfYear(t)+(e+n)%7)/7)-(e!==n)});os[t+"s"]=e.range,os[t+"s"].utc=e.utc.range,os[t+"OfYear"]=function(t){var e=os.year(t).getDay();return Math.floor((os.dayOfYear(t)+(e+n)%7)/7)}}),os.week=os.sunday,os.weeks=os.sunday.range,os.weeks.utc=os.sunday.utc.range,os.weekOfYear=os.sundayOfYear;var ss={"-":"",_:" ",0:"0"},cs=/^\s*\d+/,ls=/^%/;
Ju.locale=function(t){return{numberFormat:Un(t),timeFormat:Bn(t)}};var fs=Ju.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"]});Ju.format=fs.numberFormat,Ju.geo={},le.prototype={s:0,t:0,add:function(t){fe(t,this.t,ys),fe(ys.s,this.s,this),this.s?this.t+=ys.t:this.s=ys.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ys=new le;Ju.geo.stream=function(t,n){t&&hs.hasOwnProperty(t.type)?hs[t.type](t,n):ye(t,n)};var hs={Feature:function(t,n){ye(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)ye(e[r].geometry,n)}},xs={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){he(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)he(e[r],n,0)},Polygon:function(t,n){xe(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)xe(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)ye(e[r],n)}};Ju.geo.area=function(t){return ps=0,Ju.geo.stream(t,ds),ps};var ps,gs=new le,ds={sphere:function(){ps+=4*Aa},point:M,lineStart:M,lineEnd:M,polygonStart:function(){gs.reset(),ds.lineStart=pe},polygonEnd:function(){var t=2*gs;ps+=0>t?4*Aa+t:t,ds.lineStart=ds.lineEnd=ds.point=M}};Ju.geo.bounds=function(){function t(t,n){m.push(M=[l=t,y=t]),f>n&&(f=n),n>h&&(h=n)}function n(n,e){var r=ge([n*qa,e*qa]);if(d){var i=ve(d,r),o=[i[1],-i[0],0],u=ve(o,i);we(u),u=be(u);var s=n-x,c=s>0?1:-1,p=u[0]*Ra*c,g=la(s)>180;if(g^(p>c*x&&c*n>p)){var v=u[1]*Ra;v>h&&(h=v)}else if(p=(p+360)%360-180,g^(p>c*x&&c*n>p)){var v=-u[1]*Ra;f>v&&(f=v)}else f>e&&(f=e),e>h&&(h=e);g?x>n?a(l,n)>a(l,y)&&(y=n):a(n,y)>a(l,y)&&(l=n):y>=l?(l>n&&(l=n),n>y&&(y=n)):n>x?a(l,n)>a(l,y)&&(y=n):a(n,y)>a(l,y)&&(l=n)}else t(n,e);d=r,x=n}function e(){w.point=n}function r(){M[0]=l,M[1]=y,w.point=t,d=null}function i(t,e){if(d){var r=t-x;v+=la(r)>180?r+(r>0?360:-360):r}else p=t,g=e;ds.point(t,e),n(t,e)}function o(){ds.lineStart()}function u(){i(p,g),ds.lineEnd(),la(v)>Pa&&(l=-(y=180)),M[0]=l,M[1]=y,d=null}function a(t,n){return(n-=t)<0?n+360:n}function s(t,n){return t[0]-n[0]}function c(t,n){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}var l,f,y,h,x,p,g,d,v,m,M,w={point:t,lineStart:e,lineEnd:r,polygonStart:function(){w.point=i,w.lineStart=o,w.lineEnd=u,v=0,ds.polygonStart()},polygonEnd:function(){ds.polygonEnd(),w.point=t,w.lineStart=e,w.lineEnd=r,0>gs?(l=-(y=180),f=-(h=90)):v>Pa?h=90:-Pa>v&&(f=-90),M[0]=l,M[1]=y}};return function(t){h=y=-(l=f=1/0),m=[],Ju.geo.stream(t,w);var n=m.length;if(n){m.sort(s);for(var e,r=1,i=m[0],o=[i];n>r;++r)e=m[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])):o.push(i=e);for(var u,e,x=-1/0,n=o.length-1,r=0,i=o[n];n>=r;i=e,++r)e=o[r],(u=a(i[1],e[0]))>x&&(x=u,l=e[0],y=i[1])}return m=M=null,1/0===l||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[l,f],[y,h]]}}(),Ju.geo.centroid=function(t){vs=ms=Ms=ws=bs=_s=Es=Ss=Ns=ks=As=0,Ju.geo.stream(t,Cs);var n=Ns,e=ks,r=As,i=n*n+e*e+r*r;return za>i&&(n=_s,e=Es,r=Ss,Pa>ms&&(n=Ms,e=ws,r=bs),i=n*n+e*e+r*r,za>i)?[0/0,0/0]:[Math.atan2(e,n)*Ra,en(r/Math.sqrt(i))*Ra]};var vs,ms,Ms,ws,bs,_s,Es,Ss,Ns,ks,As,Cs={sphere:M,point:Ee,lineStart:Ne,lineEnd:ke,polygonStart:function(){Cs.lineStart=Ae},polygonEnd:function(){Cs.lineStart=Ne}},Ls=qe(Ce,Ue,Oe,[-Aa,-Aa/2]),Ps=1e9;Ju.geo.clipExtent=function(){var t,n,e,r,i,o,u={stream:function(t){return i&&(i.valid=!1),i=o(t),i.valid=!0,i},extent:function(a){return arguments.length?(o=Be(t=+a[0][0],n=+a[0][1],e=+a[1][0],r=+a[1][1]),i&&(i.valid=!1,i=null),u):[[t,n],[e,r]]}};return u.extent([[0,0],[960,500]])},(Ju.geo.conicEqualArea=function(){return Ve(Ze)}).raw=Ze,Ju.geo.albers=function(){return Ju.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Ju.geo.albersUsa=function(){function t(t){var o=t[0],u=t[1];return n=null,e(o,u),n||(r(o,u),n)||i(o,u),n}var n,e,r,i,o=Ju.geo.albers(),u=Ju.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=Ju.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),s={point:function(t,e){n=[t,e]}};return t.invert=function(t){var n=o.scale(),e=o.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?u:i>=.166&&.234>i&&r>=-.214&&-.115>r?a:o).invert(t)},t.stream=function(t){var n=o.stream(t),e=u.stream(t),r=a.stream(t);return{point:function(t,i){n.point(t,i),e.point(t,i),r.point(t,i)},sphere:function(){n.sphere(),e.sphere(),r.sphere()},lineStart:function(){n.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){n.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){n.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){n.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},t.precision=function(n){return arguments.length?(o.precision(n),u.precision(n),a.precision(n),t):o.precision()},t.scale=function(n){return arguments.length?(o.scale(n),u.scale(.35*n),a.scale(n),t.translate(o.translate())):o.scale()},t.translate=function(n){if(!arguments.length)return o.translate();var c=o.scale(),l=+n[0],f=+n[1];return e=o.translate(n).clipExtent([[l-.455*c,f-.238*c],[l+.455*c,f+.238*c]]).stream(s).point,r=u.translate([l-.307*c,f+.201*c]).clipExtent([[l-.425*c+Pa,f+.12*c+Pa],[l-.214*c-Pa,f+.234*c-Pa]]).stream(s).point,i=a.translate([l-.205*c,f+.212*c]).clipExtent([[l-.214*c+Pa,f+.166*c+Pa],[l-.115*c-Pa,f+.234*c-Pa]]).stream(s).point,t},t.scale(1070)};var zs,qs,Rs,Is,Ts,Ds,Us={point:M,lineStart:M,lineEnd:M,polygonStart:function(){qs=0,Us.lineStart=Xe},polygonEnd:function(){Us.lineStart=Us.lineEnd=Us.point=M,zs+=la(qs/2)}},js={point:$e,lineStart:M,lineEnd:M,polygonStart:M,polygonEnd:M},Os={point:We,lineStart:Ge,lineEnd:Ke,polygonStart:function(){Os.lineStart=tr},polygonEnd:function(){Os.point=We,Os.lineStart=Ge,Os.lineEnd=Ke}};Ju.geo.path=function(){function t(t){return t&&("function"==typeof a&&o.pointRadius(+a.apply(this,arguments)),u&&u.valid||(u=i(o)),Ju.geo.stream(t,u)),o.result()}function n(){return u=null,t}var e,r,i,o,u,a=4.5;return t.area=function(t){return zs=0,Ju.geo.stream(t,i(Us)),zs},t.centroid=function(t){return Ms=ws=bs=_s=Es=Ss=Ns=ks=As=0,Ju.geo.stream(t,i(Os)),As?[Ns/As,ks/As]:Ss?[_s/Ss,Es/Ss]:bs?[Ms/bs,ws/bs]:[0/0,0/0]},t.bounds=function(t){return Ts=Ds=-(Rs=Is=1/0),Ju.geo.stream(t,i(js)),[[Rs,Is],[Ts,Ds]]},t.projection=function(t){return arguments.length?(i=(e=t)?t.stream||rr(t):Cn,n()):e},t.context=function(t){return arguments.length?(o=null==(r=t)?new Qe:new nr(t),"function"!=typeof a&&o.pointRadius(a),n()):r},t.pointRadius=function(n){return arguments.length?(a="function"==typeof n?n:(o.pointRadius(+n),+n),t):a},t.projection(Ju.geo.albersUsa()).context(null)},Ju.geo.transform=function(t){return{stream:function(n){var e=new ir(n);for(var r in t)e[r]=t[r];return e}}},ir.prototype={point:function(t,n){this.stream.point(t,n)},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()}},Ju.geo.projection=ur,Ju.geo.projectionMutator=ar,(Ju.geo.equirectangular=function(){return ur(cr)}).raw=cr.invert=cr,Ju.geo.rotation=function(t){function n(n){return n=t(n[0]*qa,n[1]*qa),n[0]*=Ra,n[1]*=Ra,n}return t=fr(t[0]%360*qa,t[1]*qa,t.length>2?t[2]*qa:0),n.invert=function(n){return n=t.invert(n[0]*qa,n[1]*qa),n[0]*=Ra,n[1]*=Ra,n},n},lr.invert=cr,Ju.geo.circle=function(){function t(){var t="function"==typeof r?r.apply(this,arguments):r,n=fr(-t[0]*qa,-t[1]*qa,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Ra,t[1]*=Ra}}),{type:"Polygon",coordinates:[i]}}var n,e,r=[0,0],i=6;return t.origin=function(n){return arguments.length?(r=n,t):r},t.angle=function(r){return arguments.length?(e=pr((n=+r)*qa,i*qa),t):n},t.precision=function(r){return arguments.length?(e=pr(n*qa,(i=+r)*qa),t):i},t.angle(90)},Ju.geo.distance=function(t,n){var e,r=(n[0]-t[0])*qa,i=t[1]*qa,o=n[1]*qa,u=Math.sin(r),a=Math.cos(r),s=Math.sin(i),c=Math.cos(i),l=Math.sin(o),f=Math.cos(o);return Math.atan2(Math.sqrt((e=f*u)*e+(e=c*l-s*f*a)*e),s*l+c*f*a)},Ju.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:n()}}function n(){return Ju.range(Math.ceil(o/g)*g,i,g).map(y).concat(Ju.range(Math.ceil(c/d)*d,s,d).map(h)).concat(Ju.range(Math.ceil(r/x)*x,e,x).filter(function(t){return la(t%g)>Pa}).map(l)).concat(Ju.range(Math.ceil(a/p)*p,u,p).filter(function(t){return la(t%d)>Pa}).map(f))}var e,r,i,o,u,a,s,c,l,f,y,h,x=10,p=x,g=90,d=360,v=2.5;return t.lines=function(){return n().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[y(o).concat(h(s).slice(1),y(i).reverse().slice(1),h(c).reverse().slice(1))]}},t.extent=function(n){return arguments.length?t.majorExtent(n).minorExtent(n):t.minorExtent()},t.majorExtent=function(n){return arguments.length?(o=+n[0][0],i=+n[1][0],c=+n[0][1],s=+n[1][1],o>i&&(n=o,o=i,i=n),c>s&&(n=c,c=s,s=n),t.precision(v)):[[o,c],[i,s]]},t.minorExtent=function(n){return arguments.length?(r=+n[0][0],e=+n[1][0],a=+n[0][1],u=+n[1][1],r>e&&(n=r,r=e,e=n),a>u&&(n=a,a=u,u=n),t.precision(v)):[[r,a],[e,u]]},t.step=function(n){return arguments.length?t.majorStep(n).minorStep(n):t.minorStep()},t.majorStep=function(n){return arguments.length?(g=+n[0],d=+n[1],t):[g,d]},t.minorStep=function(n){return arguments.length?(x=+n[0],p=+n[1],t):[x,p]},t.precision=function(n){return arguments.length?(v=+n,l=dr(a,u,90),f=vr(r,e,v),y=dr(c,s,90),h=vr(o,i,v),t):v},t.majorExtent([[-180,-90+Pa],[180,90-Pa]]).minorExtent([[-180,-80-Pa],[180,80+Pa]])},Ju.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[n||r.apply(this,arguments),e||i.apply(this,arguments)]}}var n,e,r=mr,i=Mr;return t.distance=function(){return Ju.geo.distance(n||r.apply(this,arguments),e||i.apply(this,arguments))},t.source=function(e){return arguments.length?(r=e,n="function"==typeof e?null:e,t):r},t.target=function(n){return arguments.length?(i=n,e="function"==typeof n?null:n,t):i},t.precision=function(){return arguments.length?t:0},t},Ju.geo.interpolate=function(t,n){return wr(t[0]*qa,t[1]*qa,n[0]*qa,n[1]*qa)},Ju.geo.length=function(t){return Fs=0,Ju.geo.stream(t,Hs),Fs};var Fs,Hs={sphere:M,point:M,lineStart:br,lineEnd:M,polygonStart:M,polygonEnd:M},Bs=_r(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Ju.geo.azimuthalEqualArea=function(){return ur(Bs)}).raw=Bs;var Ys=_r(function(t){var n=Math.acos(t);return n&&n/Math.sin(n)},Cn);(Ju.geo.azimuthalEquidistant=function(){return ur(Ys)}).raw=Ys,(Ju.geo.conicConformal=function(){return Ve(Er)}).raw=Er,(Ju.geo.conicEquidistant=function(){return Ve(Sr)}).raw=Sr;var Vs=_r(function(t){return 1/t},Math.atan);(Ju.geo.gnomonic=function(){return ur(Vs)}).raw=Vs,Nr.invert=function(t,n){return[t,2*Math.atan(Math.exp(n))-La]},(Ju.geo.mercator=function(){return kr(Nr)}).raw=Nr;var Zs=_r(function(){return 1},Math.asin);(Ju.geo.orthographic=function(){return ur(Zs)}).raw=Zs;var Xs=_r(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Ju.geo.stereographic=function(){return ur(Xs)}).raw=Xs,Ar.invert=function(t,n){return[-n,2*Math.atan(Math.exp(t))-La]},(Ju.geo.transverseMercator=function(){var t=kr(Ar),n=t.center,e=t.rotate;return t.center=function(t){return t?n([-t[1],t[0]]):(t=n(),[t[1],-t[0]])},t.rotate=function(t){return t?e([t[0],t[1],t.length>2?t[2]+90:90]):(t=e(),[t[0],t[1],t[2]-90])},e([0,0,90])}).raw=Ar,Ju.geom={},Ju.geom.hull=function(t){function n(t){if(t.length<3)return[];var n,i=An(e),o=An(r),u=t.length,a=[],s=[];for(n=0;u>n;n++)a.push([+i.call(this,t[n],n),+o.call(this,t[n],n),n]);for(a.sort(zr),n=0;u>n;n++)s.push([a[n][0],-a[n][1]]);var c=Pr(a),l=Pr(s),f=l[0]===c[0],y=l[l.length-1]===c[c.length-1],h=[];for(n=c.length-1;n>=0;--n)h.push(t[a[c[n]][2]]);for(n=+f;n<l.length-y;++n)h.push(t[a[l[n]][2]]);return h}var e=Cr,r=Lr;return arguments.length?n(t):(n.x=function(t){return arguments.length?(e=t,n):e},n.y=function(t){return arguments.length?(r=t,n):r},n)},Ju.geom.polygon=function(t){return pa(t,$s),t};var $s=Ju.geom.polygon.prototype=[];$s.area=function(){for(var t,n=-1,e=this.length,r=this[e-1],i=0;++n<e;)t=r,r=this[n],i+=t[1]*r[0]-t[0]*r[1];return.5*i},$s.centroid=function(t){var n,e,r=-1,i=this.length,o=0,u=0,a=this[i-1];for(arguments.length||(t=-1/(6*this.area()));++r<i;)n=a,a=this[r],e=n[0]*a[1]-a[0]*n[1],o+=(n[0]+a[0])*e,u+=(n[1]+a[1])*e;return[o*t,u*t]},$s.clip=function(t){for(var n,e,r,i,o,u,a=Ir(t),s=-1,c=this.length-Ir(this),l=this[c-1];++s<c;){for(n=t.slice(),t.length=0,i=this[s],o=n[(r=n.length-a)-1],e=-1;++e<r;)u=n[e],qr(u,l,i)?(qr(o,l,i)||t.push(Rr(o,u,l,i)),t.push(u)):qr(o,l,i)&&t.push(Rr(o,u,l,i)),o=u;a&&t.push(t[0]),l=i}return t};var Qs,Js,Ws,Gs,Ks,tc=[],nc=[];Br.prototype.prepare=function(){for(var t,n=this.edges,e=n.length;e--;)t=n[e].edge,t.b&&t.a||n.splice(e,1);return n.sort(Vr),n.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}},ei.prototype={insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=ui(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)r=e.U,e===r.L?(i=r.R,i&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(ii(this,e),t=e,e=t.U),e.C=!1,r.C=!0,oi(this,r))):(i=r.L,i&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&(oi(this,e),t=e,e=t.U),e.C=!1,r.C=!0,ii(this,r))),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,o=t.L,u=t.R;if(e=o?u?ui(u):o:u,i?i.L===t?i.L=e:i.R=e:this._=e,o&&u?(r=e.C,e.C=t.C,e.L=o,o.U=e,e!==u?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=u,u.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r){if(t&&t.C)return void(t.C=!1);do{if(t===this._)break;if(t===i.L){if(n=i.R,n.C&&(n.C=!1,i.C=!0,ii(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,oi(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,ii(this,i),t=this._;break}}else if(n=i.L,n.C&&(n.C=!1,i.C=!0,oi(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,ii(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,oi(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},Ju.geom.voronoi=function(t){function n(t){var n=new Array(t.length),r=a[0][0],i=a[0][1],o=a[1][0],u=a[1][1];return ai(e(t),a).cells.forEach(function(e,a){var s=e.edges,c=e.site,l=n[a]=s.length?s.map(function(t){var n=t.start();return[n.x,n.y]}):c.x>=r&&c.x<=o&&c.y>=i&&c.y<=u?[[r,u],[o,u],[o,i],[r,i]]:[];l.point=t[a]}),n}function e(t){return t.map(function(t,n){return{x:Math.round(o(t,n)/Pa)*Pa,y:Math.round(u(t,n)/Pa)*Pa,i:n}})}var r=Cr,i=Lr,o=r,u=i,a=ec;return t?n(t):(n.links=function(t){return ai(e(t)).edges.filter(function(t){return t.l&&t.r}).map(function(n){return{source:t[n.l.i],target:t[n.r.i]}})},n.triangles=function(t){var n=[];return ai(e(t)).cells.forEach(function(e,r){for(var i,o,u=e.site,a=e.edges.sort(Vr),s=-1,c=a.length,l=a[c-1].edge,f=l.l===u?l.r:l.l;++s<c;)i=l,o=f,l=a[s].edge,f=l.l===u?l.r:l.l,r<o.i&&r<f.i&&ci(u,o,f)<0&&n.push([t[r],t[o.i],t[f.i]])}),n},n.x=function(t){return arguments.length?(o=An(r=t),n):r},n.y=function(t){return arguments.length?(u=An(i=t),n):i},n.clipExtent=function(t){return arguments.length?(a=null==t?ec:t,n):a===ec?null:a},n.size=function(t){return arguments.length?n.clipExtent(t&&[[0,0],t]):a===ec?null:a&&a[1]},n)};var ec=[[-1e6,-1e6],[1e6,1e6]];Ju.geom.delaunay=function(t){return Ju.geom.voronoi().triangles(t)},Ju.geom.quadtree=function(t,n,e,r,i){function o(t){function o(t,n,e,r,i,o,u,a){if(!isNaN(e)&&!isNaN(r))if(t.leaf){var s=t.x,l=t.y;if(null!=s)if(la(s-e)+la(l-r)<.01)c(t,n,e,r,i,o,u,a);else{var f=t.point;t.x=t.y=t.point=null,c(t,f,s,l,i,o,u,a),c(t,n,e,r,i,o,u,a)}else t.x=e,t.y=r,t.point=n}else c(t,n,e,r,i,o,u,a)}function c(t,n,e,r,i,u,a,s){var c=.5*(i+a),l=.5*(u+s),f=e>=c,y=r>=l,h=(y<<1)+f;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]=yi()),f?i=c:a=c,y?u=l:s=l,o(t,n,e,r,i,u,a,s)}var l,f,y,h,x,p,g,d,v,m=An(a),M=An(s);if(null!=n)p=n,g=e,d=r,v=i;else if(d=v=-(p=g=1/0),f=[],y=[],x=t.length,u)for(h=0;x>h;++h)l=t[h],l.x<p&&(p=l.x),l.y<g&&(g=l.y),l.x>d&&(d=l.x),l.y>v&&(v=l.y),f.push(l.x),y.push(l.y);else for(h=0;x>h;++h){var w=+m(l=t[h],h),b=+M(l,h);p>w&&(p=w),g>b&&(g=b),w>d&&(d=w),b>v&&(v=b),f.push(w),y.push(b)}var _=d-p,E=v-g;_>E?v=g+_:d=p+E;var S=yi();if(S.add=function(t){o(S,t,+m(t,++h),+M(t,h),p,g,d,v)},S.visit=function(t){hi(t,S,p,g,d,v)},h=-1,null==n){for(;++h<x;)o(S,t[h],f[h],y[h],p,g,d,v);--h}else t.forEach(S.add);return f=y=t=l=null,S}var u,a=Cr,s=Lr;return(u=arguments.length)?(a=li,s=fi,3===u&&(i=e,r=n,e=n=0),o(t)):(o.x=function(t){return arguments.length?(a=t,o):a},o.y=function(t){return arguments.length?(s=t,o):s},o.extent=function(t){return arguments.length?(null==t?n=e=r=i=null:(n=+t[0][0],e=+t[0][1],r=+t[1][0],i=+t[1][1]),o):null==n?null:[[n,e],[r,i]]},o.size=function(t){return arguments.length?(null==t?n=e=r=i=null:(n=e=0,r=+t[0],i=+t[1]),o):null==n?null:[r-n,i-e]},o)},Ju.interpolateRgb=xi,Ju.interpolateObject=pi,Ju.interpolateNumber=gi,Ju.interpolateString=di;var rc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ic=new RegExp(rc.source,"g");Ju.interpolate=vi,Ju.interpolators=[function(t,n){var e=typeof n;return("string"===e?Qa.has(n)||/^(#|rgb\(|hsl\()/.test(n)?xi:di:n instanceof sn?xi:Array.isArray(n)?mi:"object"===e&&isNaN(n)?pi:gi)(t,n)}],Ju.interpolateArray=mi;var oc=function(){return Cn},uc=Ju.map({linear:oc,poly:Ni,quad:function(){return _i},cubic:function(){return Ei},sin:function(){return ki},exp:function(){return Ai},circle:function(){return Ci},elastic:Li,back:Pi,bounce:function(){return zi}}),ac=Ju.map({"in":Cn,out:wi,"in-out":bi,"out-in":function(t){return bi(wi(t))}});Ju.ease=function(t){var n=t.indexOf("-"),e=n>=0?t.substring(0,n):t,r=n>=0?t.substring(n+1):"in";return e=uc.get(e)||oc,r=ac.get(r)||Cn,Mi(r(e.apply(null,Wu.call(arguments,1))))},Ju.interpolateHcl=qi,Ju.interpolateHsl=Ri,Ju.interpolateLab=Ii,Ju.interpolateRound=Ti,Ju.transform=function(t){var n=Ku.createElementNS(Ju.ns.prefix.svg,"g");return(Ju.transform=function(t){if(null!=t){n.setAttribute("transform",t);var e=n.transform.baseVal.consolidate()}return new Di(e?e.matrix:sc)})(t)},Di.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var sc={a:1,b:0,c:0,d:1,e:0,f:0};Ju.interpolateTransform=Fi,Ju.layout={},Ju.layout.bundle=function(){return function(t){for(var n=[],e=-1,r=t.length;++e<r;)n.push(Yi(t[e]));return n}},Ju.layout.chord=function(){function t(){var t,c,f,y,h,x={},p=[],g=Ju.range(o),d=[];for(e=[],r=[],t=0,y=-1;++y<o;){for(c=0,h=-1;++h<o;)c+=i[y][h];p.push(c),d.push(Ju.range(o)),t+=c}for(u&&g.sort(function(t,n){return u(p[t],p[n])}),a&&d.forEach(function(t,n){t.sort(function(t,e){return a(i[n][t],i[n][e])})}),t=(Ca-l*o)/t,c=0,y=-1;++y<o;){for(f=c,h=-1;++h<o;){var v=g[y],m=d[v][h],M=i[v][m],w=c,b=c+=M*t;x[v+"-"+m]={index:v,subindex:m,startAngle:w,endAngle:b,value:M}}r[v]={index:v,startAngle:f,endAngle:c,value:(c-f)/t},c+=l}for(y=-1;++y<o;)for(h=y-1;++h<o;){var _=x[y+"-"+h],E=x[h+"-"+y];(_.value||E.value)&&e.push(_.value<E.value?{source:E,target:_}:{source:_,target:E})}s&&n()}function n(){e.sort(function(t,n){return s((t.source.value+t.target.value)/2,(n.source.value+n.target.value)/2)})}var e,r,i,o,u,a,s,c={},l=0;return c.matrix=function(t){return arguments.length?(o=(i=t)&&i.length,e=r=null,c):i},c.padding=function(t){return arguments.length?(l=t,e=r=null,c):l},c.sortGroups=function(t){return arguments.length?(u=t,e=r=null,c):u},c.sortSubgroups=function(t){return arguments.length?(a=t,e=null,c):a},c.sortChords=function(t){return arguments.length?(s=t,e&&n(),c):s},c.chords=function(){return e||t(),e},c.groups=function(){return r||t(),r},c},Ju.layout.force=function(){function t(t){return function(n,e,r,i){if(n.point!==t){var o=n.cx-t.x,u=n.cy-t.y,a=i-e,s=o*o+u*u;if(s>a*a/g){if(x>s){var c=n.charge/s;t.px-=o*c,t.py-=u*c}return!0}if(n.point&&s&&x>s){var c=n.pointCharge/s;t.px-=o*c,t.py-=u*c}}return!n.charge}}function n(t){t.px=Ju.event.x,t.py=Ju.event.y,a.resume()}var e,r,i,o,u,a={},s=Ju.dispatch("start","tick","end"),c=[1,1],l=.9,f=cc,y=lc,h=-30,x=fc,p=.1,g=.64,d=[],v=[];return a.tick=function(){if((r*=.99)<.005)return s.end({type:"end",alpha:r=0}),!0;var n,e,a,f,y,x,g,m,M,w=d.length,b=v.length;for(e=0;b>e;++e)a=v[e],f=a.source,y=a.target,m=y.x-f.x,M=y.y-f.y,(x=m*m+M*M)&&(x=r*o[e]*((x=Math.sqrt(x))-i[e])/x,m*=x,M*=x,y.x-=m*(g=f.weight/(y.weight+f.weight)),y.y-=M*g,f.x+=m*(g=1-g),f.y+=M*g);if((g=r*p)&&(m=c[0]/2,M=c[1]/2,e=-1,g))for(;++e<w;)a=d[e],a.x+=(m-a.x)*g,a.y+=(M-a.y)*g;if(h)for(Wi(n=Ju.geom.quadtree(d),r,u),e=-1;++e<w;)(a=d[e]).fixed||n.visit(t(a));for(e=-1;++e<w;)a=d[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(t){return arguments.length?(d=t,a):d},a.links=function(t){return arguments.length?(v=t,a):v},a.size=function(t){return arguments.length?(c=t,a):c},a.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,a):f},a.distance=a.linkDistance,a.linkStrength=function(t){return arguments.length?(y="function"==typeof t?t:+t,a):y},a.friction=function(t){return arguments.length?(l=+t,a):l},a.charge=function(t){return arguments.length?(h="function"==typeof t?t:+t,a):h},a.chargeDistance=function(t){return arguments.length?(x=t*t,a):Math.sqrt(x)},a.gravity=function(t){return arguments.length?(p=+t,a):p},a.theta=function(t){return arguments.length?(g=t*t,a):Math.sqrt(g)},a.alpha=function(t){return arguments.length?(t=+t,r?r=t>0?t:0:t>0&&(s.start({type:"start",alpha:r=t}),Ju.timer(a.tick)),a):r},a.start=function(){function t(t,r){if(!e){for(e=new Array(s),a=0;s>a;++a)e[a]=[];for(a=0;c>a;++a){var i=v[a];e[i.source.index].push(i.target),e[i.target.index].push(i.source)}}for(var o,u=e[n],a=-1,c=u.length;++a<c;)if(!isNaN(o=u[a][t]))return o;return Math.random()*r}var n,e,r,s=d.length,l=v.length,x=c[0],p=c[1];for(n=0;s>n;++n)(r=d[n]).index=n,r.weight=0;for(n=0;l>n;++n)r=v[n],"number"==typeof r.source&&(r.source=d[r.source]),"number"==typeof r.target&&(r.target=d[r.target]),++r.source.weight,++r.target.weight;for(n=0;s>n;++n)r=d[n],isNaN(r.x)&&(r.x=t("x",x)),isNaN(r.y)&&(r.y=t("y",p)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(i=[],"function"==typeof f)for(n=0;l>n;++n)i[n]=+f.call(this,v[n],n);else for(n=0;l>n;++n)i[n]=f;if(o=[],"function"==typeof y)for(n=0;l>n;++n)o[n]=+y.call(this,v[n],n);else for(n=0;l>n;++n)o[n]=y;if(u=[],"function"==typeof h)for(n=0;s>n;++n)u[n]=+h.call(this,d[n],n);else for(n=0;s>n;++n)u[n]=h;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=Ju.behavior.drag().origin(Cn).on("dragstart.force",Xi).on("drag.force",n).on("dragend.force",$i)),arguments.length?void this.on("mouseover.force",Qi).on("mouseout.force",Ji).call(e):e},Ju.rebind(a,s,"on")};var cc=20,lc=1,fc=1/0;Ju.layout.hierarchy=function(){function t(i){var o,u=[i],a=[];for(i.depth=0;null!=(o=u.pop());)if(a.push(o),(c=e.call(t,o,o.depth))&&(s=c.length)){for(var s,c,l;--s>=0;)u.push(l=c[s]),l.parent=o,l.depth=o.depth+1;r&&(o.value=0),o.children=c}else r&&(o.value=+r.call(t,o,o.depth)||0),delete o.children;return to(i,function(t){var e,i;n&&(e=t.children)&&e.sort(n),r&&(i=t.parent)&&(i.value+=t.value)}),a}var n=ro,e=no,r=eo;return t.sort=function(e){return arguments.length?(n=e,t):n},t.children=function(n){return arguments.length?(e=n,t):e},t.value=function(n){return arguments.length?(r=n,t):r},t.revalue=function(n){return r&&(Ki(n,function(t){t.children&&(t.value=0)}),to(n,function(n){var e;n.children||(n.value=+r.call(t,n,n.depth)||0),(e=n.parent)&&(e.value+=n.value)})),n},t},Ju.layout.partition=function(){function t(n,e,r,i){var o=n.children;if(n.x=e,n.y=n.depth*i,n.dx=r,n.dy=i,o&&(u=o.length)){var u,a,s,c=-1;for(r=n.value?r/n.value:0;++c<u;)t(a=o[c],e,s=a.value*r,i),e+=s}}function n(t){var e=t.children,r=0;if(e&&(i=e.length))for(var i,o=-1;++o<i;)r=Math.max(r,n(e[o]));return 1+r}function e(e,o){var u=r.call(this,e,o);return t(u[0],0,i[0],i[1]/n(u[0])),u}var r=Ju.layout.hierarchy(),i=[1,1];return e.size=function(t){return arguments.length?(i=t,e):i},Gi(e,r)},Ju.layout.pie=function(){function t(o){var u=o.map(function(e,r){return+n.call(t,e,r)}),a=+("function"==typeof r?r.apply(this,arguments):r),s=(("function"==typeof i?i.apply(this,arguments):i)-a)/Ju.sum(u),c=Ju.range(o.length);null!=e&&c.sort(e===yc?function(t,n){return u[n]-u[t]}:function(t,n){return e(o[t],o[n])});var l=[];return c.forEach(function(t){var n;l[t]={data:o[t],value:n=u[t],startAngle:a,endAngle:a+=n*s}}),l}var n=Number,e=yc,r=0,i=Ca;return t.value=function(e){return arguments.length?(n=e,t):n},t.sort=function(n){return arguments.length?(e=n,t):e},t.startAngle=function(n){return arguments.length?(r=n,t):r},t.endAngle=function(n){return arguments.length?(i=n,t):i},t};var yc={};Ju.layout.stack=function(){function t(a,s){var c=a.map(function(e,r){return n.call(t,e,r)}),l=c.map(function(n){return n.map(function(n,e){return[o.call(t,n,e),u.call(t,n,e)]})}),f=e.call(t,l,s);c=Ju.permute(c,f),l=Ju.permute(l,f);var y,h,x,p=r.call(t,l,s),g=c.length,d=c[0].length;for(h=0;d>h;++h)for(i.call(t,c[0][h],x=p[h],l[0][h][1]),y=1;g>y;++y)i.call(t,c[y][h],x+=l[y-1][h][1],l[y][h][1]);return a}var n=Cn,e=so,r=co,i=ao,o=oo,u=uo;return t.values=function(e){return arguments.length?(n=e,t):n},t.order=function(n){return arguments.length?(e="function"==typeof n?n:hc.get(n)||so,t):e},t.offset=function(n){return arguments.length?(r="function"==typeof n?n:xc.get(n)||co,t):r},t.x=function(n){return arguments.length?(o=n,t):o},t.y=function(n){return arguments.length?(u=n,t):u},t.out=function(n){return arguments.length?(i=n,t):i},t};var hc=Ju.map({"inside-out":function(t){var n,e,r=t.length,i=t.map(lo),o=t.map(fo),u=Ju.range(r).sort(function(t,n){return i[t]-i[n]}),a=0,s=0,c=[],l=[];for(n=0;r>n;++n)e=u[n],s>a?(a+=o[e],c.push(e)):(s+=o[e],l.push(e));return l.reverse().concat(c)},reverse:function(t){return Ju.range(t.length).reverse()},"default":so}),xc=Ju.map({silhouette:function(t){var n,e,r,i=t.length,o=t[0].length,u=[],a=0,s=[];for(e=0;o>e;++e){for(n=0,r=0;i>n;n++)r+=t[n][e][1];r>a&&(a=r),u.push(r)}for(e=0;o>e;++e)s[e]=(a-u[e])/2;return s},wiggle:function(t){var n,e,r,i,o,u,a,s,c,l=t.length,f=t[0],y=f.length,h=[];for(h[0]=s=c=0,e=1;y>e;++e){for(n=0,i=0;l>n;++n)i+=t[n][e][1];for(n=0,o=0,a=f[e][0]-f[e-1][0];l>n;++n){for(r=0,u=(t[n][e][1]-t[n][e-1][1])/(2*a);n>r;++r)u+=(t[r][e][1]-t[r][e-1][1])/a;o+=u*t[n][e][1]}h[e]=s-=i?o/i*a:0,c>s&&(c=s)}for(e=0;y>e;++e)h[e]-=c;return h},expand:function(t){var n,e,r,i=t.length,o=t[0].length,u=1/i,a=[];for(e=0;o>e;++e){for(n=0,r=0;i>n;n++)r+=t[n][e][1];if(r)for(n=0;i>n;n++)t[n][e][1]/=r;else for(n=0;i>n;n++)t[n][e][1]=u}for(e=0;o>e;++e)a[e]=0;return a},zero:co});Ju.layout.histogram=function(){function t(t,o){for(var u,a,s=[],c=t.map(e,this),l=r.call(this,c,o),f=i.call(this,l,c,o),o=-1,y=c.length,h=f.length-1,x=n?1:1/y;++o<h;)u=s[o]=[],u.dx=f[o+1]-(u.x=f[o]),u.y=0;if(h>0)for(o=-1;++o<y;)a=c[o],a>=l[0]&&a<=l[1]&&(u=s[Ju.bisect(f,a,1,h)-1],u.y+=x,u.push(t[o]));return s}var n=!0,e=Number,r=po,i=ho;return t.value=function(n){return arguments.length?(e=n,t):e},t.range=function(n){return arguments.length?(r=An(n),t):r},t.bins=function(n){return arguments.length?(i="number"==typeof n?function(t){return xo(t,n)}:An(n),t):i},t.frequency=function(e){return arguments.length?(n=!!e,t):n},t},Ju.layout.pack=function(){function t(t,o){var u=e.call(this,t,o),a=u[0],s=i[0],c=i[1],l=null==n?Math.sqrt:"function"==typeof n?n:function(){return n};if(a.x=a.y=0,to(a,function(t){t.r=+l(t.value)}),to(a,wo),r){var f=r*(n?1:Math.max(2*a.r/s,2*a.r/c))/2;to(a,function(t){t.r+=f}),to(a,wo),to(a,function(t){t.r-=f})}return Eo(a,s/2,c/2,n?1:1/Math.max(2*a.r/s,2*a.r/c)),u}var n,e=Ju.layout.hierarchy().sort(go),r=0,i=[1,1];return t.size=function(n){return arguments.length?(i=n,t):i},t.radius=function(e){return arguments.length?(n=null==e||"function"==typeof e?e:+e,t):n},t.padding=function(n){return arguments.length?(r=+n,t):r},Gi(t,e)},Ju.layout.tree=function(){function t(t,i){var l=u.call(this,t,i),f=l[0],y=n(f);if(to(y,e),y.parent.m=-y.z,Ki(y,r),c)Ki(f,o);else{var h=f,x=f,p=f;Ki(f,function(t){t.x<h.x&&(h=t),t.x>x.x&&(x=t),t.depth>p.depth&&(p=t)});var g=a(h,x)/2-h.x,d=s[0]/(x.x+a(x,h)/2+g),v=s[1]/(p.depth||1);Ki(f,function(t){t.x=(t.x+g)*d,t.y=t.depth*v})}return l}function n(t){for(var n,e={A:null,children:[t]},r=[e];null!=(n=r.pop());)for(var i,o=n.children,u=0,a=o.length;a>u;++u)r.push((o[u]=i={_:o[u],parent:n,children:(i=o[u].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:u}).a=i);return e.children[0]}function e(t){var n=t.children,e=t.parent.children,r=t.i?e[t.i-1]:null;if(n.length){Lo(t);var o=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+a(t._,r._),t.m=t.z-o):t.z=o}else r&&(t.z=r.z+a(t._,r._));t.parent.A=i(t,r,t.parent.A||e[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function i(t,n,e){if(n){for(var r,i=t,o=t,u=n,s=i.parent.children[0],c=i.m,l=o.m,f=u.m,y=s.m;u=Ao(u),i=ko(i),u&&i;)s=ko(s),o=Ao(o),o.a=t,r=u.z+f-i.z-c+a(u._,i._),r>0&&(Co(Po(u,t,e),t,r),c+=r,l+=r),f+=u.m,c+=i.m,y+=s.m,l+=o.m;u&&!Ao(o)&&(o.t=u,o.m+=f-l),i&&!ko(s)&&(s.t=i,s.m+=c-y,e=t)}return e}function o(t){t.x*=s[0],t.y=t.depth*s[1]}var u=Ju.layout.hierarchy().sort(null).value(null),a=No,s=[1,1],c=null;return t.separation=function(n){return arguments.length?(a=n,t):a},t.size=function(n){return arguments.length?(c=null==(s=n)?o:null,t):c?null:s},t.nodeSize=function(n){return arguments.length?(c=null==(s=n)?null:o,t):c?s:null},Gi(t,u)},Ju.layout.cluster=function(){function t(t,o){var u,a=n.call(this,t,o),s=a[0],c=0;to(s,function(t){var n=t.children;n&&n.length?(t.x=qo(n),t.y=zo(n)):(t.x=u?c+=e(t,u):0,t.y=0,u=t)});var l=Ro(s),f=Io(s),y=l.x-e(l,f)/2,h=f.x+e(f,l)/2;return to(s,i?function(t){t.x=(t.x-s.x)*r[0],t.y=(s.y-t.y)*r[1]}:function(t){t.x=(t.x-y)/(h-y)*r[0],t.y=(1-(s.y?t.y/s.y:1))*r[1]}),a}var n=Ju.layout.hierarchy().sort(null).value(null),e=No,r=[1,1],i=!1;return t.separation=function(n){return arguments.length?(e=n,t):e},t.size=function(n){return arguments.length?(i=null==(r=n),t):i?null:r},t.nodeSize=function(n){return arguments.length?(i=null!=(r=n),t):i?r:null},Gi(t,n)},Ju.layout.treemap=function(){function t(t,n){for(var e,r,i=-1,o=t.length;++i<o;)r=(e=t[i]).value*(0>n?0:n),e.area=isNaN(r)||0>=r?0:r}function n(e){var o=e.children;if(o&&o.length){var u,a,s,c=f(e),l=[],y=o.slice(),x=1/0,p="slice"===h?c.dx:"dice"===h?c.dy:"slice-dice"===h?1&e.depth?c.dy:c.dx:Math.min(c.dx,c.dy);for(t(y,c.dx*c.dy/e.value),l.area=0;(s=y.length)>0;)l.push(u=y[s-1]),l.area+=u.area,"squarify"!==h||(a=r(l,p))<=x?(y.pop(),x=a):(l.area-=l.pop().area,i(l,p,c,!1),p=Math.min(c.dx,c.dy),l.length=l.area=0,x=1/0);l.length&&(i(l,p,c,!0),l.length=l.area=0),o.forEach(n)}}function e(n){var r=n.children;if(r&&r.length){var o,u=f(n),a=r.slice(),s=[];for(t(a,u.dx*u.dy/n.value),s.area=0;o=a.pop();)s.push(o),s.area+=o.area,null!=o.z&&(i(s,o.z?u.dx:u.dy,u,!a.length),s.length=s.area=0);r.forEach(e)}}function r(t,n){for(var e,r=t.area,i=0,o=1/0,u=-1,a=t.length;++u<a;)(e=t[u].area)&&(o>e&&(o=e),e>i&&(i=e));return r*=r,n*=n,r?Math.max(n*i*x/r,r/(n*o*x)):1/0}function i(t,n,e,r){var i,o=-1,u=t.length,a=e.x,c=e.y,l=n?s(t.area/n):0;
if(n==e.dx){for((r||l>e.dy)&&(l=e.dy);++o<u;)i=t[o],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);++o<u;)i=t[o],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 o(r){var i=u||a(r),o=i[0];return o.x=0,o.y=0,o.dx=c[0],o.dy=c[1],u&&a.revalue(o),t([o],o.dx*o.dy/o.value),(u?e:n)(o),y&&(u=i),i}var u,a=Ju.layout.hierarchy(),s=Math.round,c=[1,1],l=null,f=To,y=!1,h="squarify",x=.5*(1+Math.sqrt(5));return o.size=function(t){return arguments.length?(c=t,o):c},o.padding=function(t){function n(n){var e=t.call(o,n,n.depth);return null==e?To(n):Do(n,"number"==typeof e?[e,e,e,e]:e)}function e(n){return Do(n,t)}if(!arguments.length)return l;var r;return f=null==(l=t)?To:"function"==(r=typeof t)?n:"number"===r?(t=[t,t,t,t],e):e,o},o.round=function(t){return arguments.length?(s=t?Math.round:Number,o):s!=Number},o.sticky=function(t){return arguments.length?(y=t,u=null,o):y},o.ratio=function(t){return arguments.length?(x=t,o):x},o.mode=function(t){return arguments.length?(h=t+"",o):h},Gi(o,a)},Ju.random={normal:function(t,n){var e=arguments.length;return 2>e&&(n=1),1>e&&(t=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return t+n*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=Ju.random.normal.apply(Ju,arguments);return function(){return Math.exp(t())}},bates:function(t){var n=Ju.random.irwinHall(t);return function(){return n()/t}},irwinHall:function(t){return function(){for(var n=0,e=0;t>e;e++)n+=Math.random();return n}}},Ju.scale={};var pc={floor:Cn,ceil:Cn};Ju.scale.linear=function(){return Yo([0,1],[0,1],vi,!1)};var gc={s:1,g:1,p:1,r:1,e:1};Ju.scale.log=function(){return Go(Ju.scale.linear().domain([0,1]),10,!0,[1,10])};var dc=Ju.format(".0e"),vc={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};Ju.scale.pow=function(){return Ko(Ju.scale.linear(),1,[0,1])},Ju.scale.sqrt=function(){return Ju.scale.pow().exponent(.5)},Ju.scale.ordinal=function(){return nu([],{t:"range",a:[[]]})},Ju.scale.category10=function(){return Ju.scale.ordinal().range(mc)},Ju.scale.category20=function(){return Ju.scale.ordinal().range(Mc)},Ju.scale.category20b=function(){return Ju.scale.ordinal().range(wc)},Ju.scale.category20c=function(){return Ju.scale.ordinal().range(bc)};var mc=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(wn),Mc=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(wn),wc=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(wn),bc=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(wn);Ju.scale.quantile=function(){return eu([],[])},Ju.scale.quantize=function(){return ru(0,1,[0,1])},Ju.scale.threshold=function(){return iu([.5],[0,1])},Ju.scale.identity=function(){return ou([0,1])},Ju.svg={},Ju.svg.arc=function(){function t(){var t=n.apply(this,arguments),o=e.apply(this,arguments),u=r.apply(this,arguments)+_c,a=i.apply(this,arguments)+_c,s=(u>a&&(s=u,u=a,a=s),a-u),c=Aa>s?"0":"1",l=Math.cos(u),f=Math.sin(u),y=Math.cos(a),h=Math.sin(a);return s>=Ec?t?"M0,"+o+"A"+o+","+o+" 0 1,1 0,"+-o+"A"+o+","+o+" 0 1,1 0,"+o+"M0,"+t+"A"+t+","+t+" 0 1,0 0,"+-t+"A"+t+","+t+" 0 1,0 0,"+t+"Z":"M0,"+o+"A"+o+","+o+" 0 1,1 0,"+-o+"A"+o+","+o+" 0 1,1 0,"+o+"Z":t?"M"+o*l+","+o*f+"A"+o+","+o+" 0 "+c+",1 "+o*y+","+o*h+"L"+t*y+","+t*h+"A"+t+","+t+" 0 "+c+",0 "+t*l+","+t*f+"Z":"M"+o*l+","+o*f+"A"+o+","+o+" 0 "+c+",1 "+o*y+","+o*h+"L0,0Z"}var n=uu,e=au,r=su,i=cu;return t.innerRadius=function(e){return arguments.length?(n=An(e),t):n},t.outerRadius=function(n){return arguments.length?(e=An(n),t):e},t.startAngle=function(n){return arguments.length?(r=An(n),t):r},t.endAngle=function(n){return arguments.length?(i=An(n),t):i},t.centroid=function(){var t=(n.apply(this,arguments)+e.apply(this,arguments))/2,o=(r.apply(this,arguments)+i.apply(this,arguments))/2+_c;return[Math.cos(o)*t,Math.sin(o)*t]},t};var _c=-La,Ec=Ca-Pa;Ju.svg.line=function(){return lu(Cn)};var Sc=Ju.map({linear:fu,"linear-closed":yu,step:hu,"step-before":xu,"step-after":pu,basis:wu,"basis-open":bu,"basis-closed":_u,bundle:Eu,cardinal:vu,"cardinal-open":gu,"cardinal-closed":du,monotone:Lu});Sc.forEach(function(t,n){n.key=t,n.closed=/-closed$/.test(t)});var Nc=[0,2/3,1/3,0],kc=[0,1/3,2/3,0],Ac=[0,1/6,2/3,1/6];Ju.svg.line.radial=function(){var t=lu(Pu);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},xu.reverse=pu,pu.reverse=xu,Ju.svg.area=function(){return zu(Cn)},Ju.svg.area.radial=function(){var t=zu(Pu);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},Ju.svg.chord=function(){function t(t,a){var s=n(this,o,t,a),c=n(this,u,t,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 n(t,n,e,r){var i=n.call(t,e,r),o=a.call(t,i,r),u=s.call(t,i,r)+_c,l=c.call(t,i,r)+_c;return{r:o,a0:u,a1:l,p0:[o*Math.cos(u),o*Math.sin(u)],p1:[o*Math.cos(l),o*Math.sin(l)]}}function e(t,n){return t.a0==n.a0&&t.a1==n.a1}function r(t,n,e){return"A"+t+","+t+" 0 "+ +(e>Aa)+",1 "+n}function i(t,n,e,r){return"Q 0,0 "+r}var o=mr,u=Mr,a=qu,s=su,c=cu;return t.radius=function(n){return arguments.length?(a=An(n),t):a},t.source=function(n){return arguments.length?(o=An(n),t):o},t.target=function(n){return arguments.length?(u=An(n),t):u},t.startAngle=function(n){return arguments.length?(s=An(n),t):s},t.endAngle=function(n){return arguments.length?(c=An(n),t):c},t},Ju.svg.diagonal=function(){function t(t,i){var o=n.call(this,t,i),u=e.call(this,t,i),a=(o.y+u.y)/2,s=[o,{x:o.x,y:a},{x:u.x,y:a},u];return s=s.map(r),"M"+s[0]+"C"+s[1]+" "+s[2]+" "+s[3]}var n=mr,e=Mr,r=Ru;return t.source=function(e){return arguments.length?(n=An(e),t):n},t.target=function(n){return arguments.length?(e=An(n),t):e},t.projection=function(n){return arguments.length?(r=n,t):r},t},Ju.svg.diagonal.radial=function(){var t=Ju.svg.diagonal(),n=Ru,e=t.projection;return t.projection=function(t){return arguments.length?e(Iu(n=t)):n},t},Ju.svg.symbol=function(){function t(t,r){return(Cc.get(n.call(this,t,r))||Uu)(e.call(this,t,r))}var n=Du,e=Tu;return t.type=function(e){return arguments.length?(n=An(e),t):n},t.size=function(n){return arguments.length?(e=An(n),t):e},t};var Cc=Ju.map({circle:Uu,cross:function(t){var n=Math.sqrt(t/5)/2;return"M"+-3*n+","+-n+"H"+-n+"V"+-3*n+"H"+n+"V"+-n+"H"+3*n+"V"+n+"H"+n+"V"+3*n+"H"+-n+"V"+n+"H"+-3*n+"Z"},diamond:function(t){var n=Math.sqrt(t/(2*qc)),e=n*qc;return"M0,"+-n+"L"+e+",0 0,"+n+" "+-e+",0Z"},square:function(t){var n=Math.sqrt(t)/2;return"M"+-n+","+-n+"L"+n+","+-n+" "+n+","+n+" "+-n+","+n+"Z"},"triangle-down":function(t){var n=Math.sqrt(t/zc),e=n*zc/2;return"M0,"+e+"L"+n+","+-e+" "+-n+","+-e+"Z"},"triangle-up":function(t){var n=Math.sqrt(t/zc),e=n*zc/2;return"M0,"+-e+"L"+n+","+e+" "+-n+","+e+"Z"}});Ju.svg.symbolTypes=Cc.keys();var Lc,Pc,zc=Math.sqrt(3),qc=Math.tan(30*qa),Rc=[],Ic=0;Rc.call=Ma.call,Rc.empty=Ma.empty,Rc.node=Ma.node,Rc.size=Ma.size,Ju.transition=function(t){return arguments.length?Lc?t.transition():t:_a.transition()},Ju.transition.prototype=Rc,Rc.select=function(t){var n,e,r,i=this.id,o=[];t=k(t);for(var u=-1,a=this.length;++u<a;){o.push(n=[]);for(var s=this[u],c=-1,l=s.length;++c<l;)(r=s[c])&&(e=t.call(r,r.__data__,c,u))?("__data__"in r&&(e.__data__=r.__data__),Hu(e,c,i,r.__transition__[i]),n.push(e)):n.push(null)}return ju(o,i)},Rc.selectAll=function(t){var n,e,r,i,o,u=this.id,a=[];t=A(t);for(var s=-1,c=this.length;++s<c;)for(var l=this[s],f=-1,y=l.length;++f<y;)if(r=l[f]){o=r.__transition__[u],e=t.call(r,r.__data__,f,s),a.push(n=[]);for(var h=-1,x=e.length;++h<x;)(i=e[h])&&Hu(i,h,u,o),n.push(i)}return ju(a,u)},Rc.filter=function(t){var n,e,r,i=[];"function"!=typeof t&&(t=j(t));for(var o=0,u=this.length;u>o;o++){i.push(n=[]);for(var e=this[o],a=0,s=e.length;s>a;a++)(r=e[a])&&t.call(r,r.__data__,a,o)&&n.push(r)}return ju(i,this.id)},Rc.tween=function(t,n){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(t):F(this,null==n?function(n){n.__transition__[e].tween.remove(t)}:function(r){r.__transition__[e].tween.set(t,n)})},Rc.attr=function(t,n){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function i(t){return null==t?e:(t+="",function(){var n,e=this.getAttribute(a);return e!==t&&(n=u(e,t),function(t){this.setAttribute(a,n(t))})})}function o(t){return null==t?r:(t+="",function(){var n,e=this.getAttributeNS(a.space,a.local);return e!==t&&(n=u(e,t),function(t){this.setAttributeNS(a.space,a.local,n(t))})})}if(arguments.length<2){for(n in t)this.attr(n,t[n]);return this}var u="transform"==t?Fi:vi,a=Ju.ns.qualify(t);return Ou(this,"attr."+t,n,a.local?o:i)},Rc.attrTween=function(t,n){function e(t,e){var r=n.call(this,t,e,this.getAttribute(i));return r&&function(t){this.setAttribute(i,r(t))}}function r(t,e){var r=n.call(this,t,e,this.getAttributeNS(i.space,i.local));return r&&function(t){this.setAttributeNS(i.space,i.local,r(t))}}var i=Ju.ns.qualify(t);return this.tween("attr."+t,i.local?r:e)},Rc.style=function(t,n,e){function r(){this.style.removeProperty(t)}function i(n){return null==n?r:(n+="",function(){var r,i=na.getComputedStyle(this,null).getPropertyValue(t);return i!==n&&(r=vi(i,n),function(n){this.style.setProperty(t,r(n),e)})})}var o=arguments.length;if(3>o){if("string"!=typeof t){2>o&&(n="");for(e in t)this.style(e,t[e],n);return this}e=""}return Ou(this,"style."+t,n,i)},Rc.styleTween=function(t,n,e){function r(r,i){var o=n.call(this,r,i,na.getComputedStyle(this,null).getPropertyValue(t));return o&&function(n){this.style.setProperty(t,o(n),e)}}return arguments.length<3&&(e=""),this.tween("style."+t,r)},Rc.text=function(t){return Ou(this,"text",t,Fu)},Rc.remove=function(){return this.each("end.transition",function(){var t;this.__transition__.count<2&&(t=this.parentNode)&&t.removeChild(this)})},Rc.ease=function(t){var n=this.id;return arguments.length<1?this.node().__transition__[n].ease:("function"!=typeof t&&(t=Ju.ease.apply(Ju,arguments)),F(this,function(e){e.__transition__[n].ease=t}))},Rc.delay=function(t){var n=this.id;return arguments.length<1?this.node().__transition__[n].delay:F(this,"function"==typeof t?function(e,r,i){e.__transition__[n].delay=+t.call(e,e.__data__,r,i)}:(t=+t,function(e){e.__transition__[n].delay=t}))},Rc.duration=function(t){var n=this.id;return arguments.length<1?this.node().__transition__[n].duration:F(this,"function"==typeof t?function(e,r,i){e.__transition__[n].duration=Math.max(1,t.call(e,e.__data__,r,i))}:(t=Math.max(1,t),function(e){e.__transition__[n].duration=t}))},Rc.each=function(t,n){var e=this.id;if(arguments.length<2){var r=Pc,i=Lc;Lc=e,F(this,function(n,r,i){Pc=n.__transition__[e],t.call(n,n.__data__,r,i)}),Pc=r,Lc=i}else F(this,function(r){var i=r.__transition__[e];(i.event||(i.event=Ju.dispatch("start","end"))).on(t,n)});return this},Rc.transition=function(){for(var t,n,e,r,i=this.id,o=++Ic,u=[],a=0,s=this.length;s>a;a++){u.push(t=[]);for(var n=this[a],c=0,l=n.length;l>c;c++)(e=n[c])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Hu(e,c,o,r)),t.push(e)}return ju(u,o)},Ju.svg.axis=function(){function t(t){t.each(function(){var t,c=Ju.select(this),l=this.__chart__||e,f=this.__chart__=e.copy(),y=null==s?f.ticks?f.ticks.apply(f,a):f.domain():s,h=null==n?f.tickFormat?f.tickFormat.apply(f,a):Cn:n,x=c.selectAll(".tick").data(y,f),p=x.enter().insert("g",".domain").attr("class","tick").style("opacity",Pa),g=Ju.transition(x.exit()).style("opacity",Pa).remove(),d=Ju.transition(x.order()).style("opacity",1),v=jo(f),m=c.selectAll(".domain").data([0]),M=(m.enter().append("path").attr("class","domain"),Ju.transition(m));p.append("line"),p.append("text");var w=p.select("line"),b=d.select("line"),_=x.select("text").text(h),E=p.select("text"),S=d.select("text");switch(r){case"bottom":t=Bu,w.attr("y2",i),E.attr("y",Math.max(i,0)+u),b.attr("x2",0).attr("y2",i),S.attr("x",0).attr("y",Math.max(i,0)+u),_.attr("dy",".71em").style("text-anchor","middle"),M.attr("d","M"+v[0]+","+o+"V0H"+v[1]+"V"+o);break;case"top":t=Bu,w.attr("y2",-i),E.attr("y",-(Math.max(i,0)+u)),b.attr("x2",0).attr("y2",-i),S.attr("x",0).attr("y",-(Math.max(i,0)+u)),_.attr("dy","0em").style("text-anchor","middle"),M.attr("d","M"+v[0]+","+-o+"V0H"+v[1]+"V"+-o);break;case"left":t=Yu,w.attr("x2",-i),E.attr("x",-(Math.max(i,0)+u)),b.attr("x2",-i).attr("y2",0),S.attr("x",-(Math.max(i,0)+u)).attr("y",0),_.attr("dy",".32em").style("text-anchor","end"),M.attr("d","M"+-o+","+v[0]+"H0V"+v[1]+"H"+-o);break;case"right":t=Yu,w.attr("x2",i),E.attr("x",Math.max(i,0)+u),b.attr("x2",i).attr("y2",0),S.attr("x",Math.max(i,0)+u).attr("y",0),_.attr("dy",".32em").style("text-anchor","start"),M.attr("d","M"+o+","+v[0]+"H0V"+v[1]+"H"+o)}if(f.rangeBand){var N=f,k=N.rangeBand()/2;l=f=function(t){return N(t)+k}}else l.rangeBand?l=f:g.call(t,f);p.call(t,l),d.call(t,f)})}var n,e=Ju.scale.linear(),r=Tc,i=6,o=6,u=3,a=[10],s=null;return t.scale=function(n){return arguments.length?(e=n,t):e},t.orient=function(n){return arguments.length?(r=n in Dc?n+"":Tc,t):r},t.ticks=function(){return arguments.length?(a=arguments,t):a},t.tickValues=function(n){return arguments.length?(s=n,t):s},t.tickFormat=function(e){return arguments.length?(n=e,t):n},t.tickSize=function(n){var e=arguments.length;return e?(i=+n,o=+arguments[e-1],t):i},t.innerTickSize=function(n){return arguments.length?(i=+n,t):i},t.outerTickSize=function(n){return arguments.length?(o=+n,t):o},t.tickPadding=function(n){return arguments.length?(u=+n,t):u},t.tickSubdivide=function(){return arguments.length&&t},t};var Tc="bottom",Dc={top:1,right:1,bottom:1,left:1};Ju.svg.brush=function(){function t(o){o.each(function(){var o=Ju.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",i).on("touchstart.brush",i),u=o.selectAll(".background").data([0]);u.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),o.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=o.selectAll(".resize").data(x,Cn);a.exit().remove(),a.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Uc[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",t.empty()?"none":null);var l,f=Ju.transition(o),y=Ju.transition(u);s&&(l=jo(s),y.attr("x",l[0]).attr("width",l[1]-l[0]),e(f)),c&&(l=jo(c),y.attr("y",l[0]).attr("height",l[1]-l[0]),r(f)),n(f)})}function n(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+l[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function e(t){t.select(".extent").attr("x",l[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",l[1]-l[0])}function r(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function i(){function i(){32==Ju.event.keyCode&&(A||(v=null,L[0]-=l[1],L[1]-=f[1],A=2),_())}function x(){32==Ju.event.keyCode&&2==A&&(L[0]+=l[1],L[1]+=f[1],A=0,_())}function p(){var t=Ju.mouse(M),i=!1;m&&(t[0]+=m[0],t[1]+=m[1]),A||(Ju.event.altKey?(v||(v=[(l[0]+l[1])/2,(f[0]+f[1])/2]),L[0]=l[+(t[0]<v[0])],L[1]=f[+(t[1]<v[1])]):v=null),N&&g(t,s,0)&&(e(E),i=!0),k&&g(t,c,1)&&(r(E),i=!0),i&&(n(E),b({type:"brush",mode:A?"move":"resize"}))}function g(t,n,e){var r,i,a=jo(n),s=a[0],c=a[1],x=L[e],p=e?f:l,g=p[1]-p[0];return A&&(s-=x,c-=g+x),r=(e?h:y)?Math.max(s,Math.min(c,t[e])):t[e],A?i=(r+=x)+g:(v&&(x=Math.max(s,Math.min(c,2*v[e]-r))),r>x?(i=r,r=x):i=x),p[0]!=r||p[1]!=i?(e?u=null:o=null,p[0]=r,p[1]=i,!0):void 0}function d(){p(),E.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),Ju.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),C(),b({type:"brushend"})}var v,m,M=this,w=Ju.select(Ju.event.target),b=a.of(M,arguments),E=Ju.select(M),S=w.datum(),N=!/^(n|s)$/.test(S)&&s,k=!/^(e|w)$/.test(S)&&c,A=w.classed("extent"),C=$(),L=Ju.mouse(M),P=Ju.select(na).on("keydown.brush",i).on("keyup.brush",x);if(Ju.event.changedTouches?P.on("touchmove.brush",p).on("touchend.brush",d):P.on("mousemove.brush",p).on("mouseup.brush",d),E.interrupt().selectAll("*").interrupt(),A)L[0]=l[0]-L[0],L[1]=f[0]-L[1];else if(S){var z=+/w$/.test(S),q=+/^n/.test(S);m=[l[1-z]-L[0],f[1-q]-L[1]],L[0]=l[z],L[1]=f[q]}else Ju.event.altKey&&(v=L.slice());E.style("pointer-events","none").selectAll(".resize").style("display",null),Ju.select("body").style("cursor",w.style("cursor")),b({type:"brushstart"}),p()}var o,u,a=S(t,"brushstart","brush","brushend"),s=null,c=null,l=[0,0],f=[0,0],y=!0,h=!0,x=jc[0];return t.event=function(t){t.each(function(){var t=a.of(this,arguments),n={x:l,y:f,i:o,j:u},e=this.__chart__||n;this.__chart__=n,Lc?Ju.select(this).transition().each("start.brush",function(){o=e.i,u=e.j,l=e.x,f=e.y,t({type:"brushstart"})}).tween("brush:brush",function(){var e=mi(l,n.x),r=mi(f,n.y);return o=u=null,function(i){l=n.x=e(i),f=n.y=r(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=n.i,u=n.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(n){return arguments.length?(s=n,x=jc[!s<<1|!c],t):s},t.y=function(n){return arguments.length?(c=n,x=jc[!s<<1|!c],t):c},t.clamp=function(n){return arguments.length?(s&&c?(y=!!n[0],h=!!n[1]):s?y=!!n:c&&(h=!!n),t):s&&c?[y,h]:s?y:c?h:null},t.extent=function(n){var e,r,i,a,y;return arguments.length?(s&&(e=n[0],r=n[1],c&&(e=e[0],r=r[0]),o=[e,r],s.invert&&(e=s(e),r=s(r)),e>r&&(y=e,e=r,r=y),(e!=l[0]||r!=l[1])&&(l=[e,r])),c&&(i=n[0],a=n[1],s&&(i=i[1],a=a[1]),u=[i,a],c.invert&&(i=c(i),a=c(a)),i>a&&(y=i,i=a,a=y),(i!=f[0]||a!=f[1])&&(f=[i,a])),t):(s&&(o?(e=o[0],r=o[1]):(e=l[0],r=l[1],s.invert&&(e=s.invert(e),r=s.invert(r)),e>r&&(y=e,e=r,r=y))),c&&(u?(i=u[0],a=u[1]):(i=f[0],a=f[1],c.invert&&(i=c.invert(i),a=c.invert(a)),i>a&&(y=i,i=a,a=y))),s&&c?[[e,i],[r,a]]:s?[e,r]:c&&[i,a])},t.clear=function(){return t.empty()||(l=[0,0],f=[0,0],o=u=null),t},t.empty=function(){return!!s&&l[0]==l[1]||!!c&&f[0]==f[1]},Ju.rebind(t,a,"on")};var Uc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},jc=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Oc=os.format=fs.timeFormat,Fc=Oc.utc,Hc=Fc("%Y-%m-%dT%H:%M:%S.%LZ");Oc.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Vu:Hc,Vu.parse=function(t){var n=new Date(t);return isNaN(n)?null:n},Vu.toString=Hc.toString,os.second=Fn(function(t){return new us(1e3*Math.floor(t/1e3))},function(t,n){t.setTime(t.getTime()+1e3*Math.floor(n))},function(t){return t.getSeconds()}),os.seconds=os.second.range,os.seconds.utc=os.second.utc.range,os.minute=Fn(function(t){return new us(6e4*Math.floor(t/6e4))},function(t,n){t.setTime(t.getTime()+6e4*Math.floor(n))},function(t){return t.getMinutes()}),os.minutes=os.minute.range,os.minutes.utc=os.minute.utc.range,os.hour=Fn(function(t){var n=t.getTimezoneOffset()/60;return new us(36e5*(Math.floor(t/36e5-n)+n))},function(t,n){t.setTime(t.getTime()+36e5*Math.floor(n))},function(t){return t.getHours()}),os.hours=os.hour.range,os.hours.utc=os.hour.utc.range,os.month=Fn(function(t){return t=os.day(t),t.setDate(1),t},function(t,n){t.setMonth(t.getMonth()+n)},function(t){return t.getMonth()}),os.months=os.month.range,os.months.utc=os.month.utc.range;var Bc=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Yc=[[os.second,1],[os.second,5],[os.second,15],[os.second,30],[os.minute,1],[os.minute,5],[os.minute,15],[os.minute,30],[os.hour,1],[os.hour,3],[os.hour,6],[os.hour,12],[os.day,1],[os.day,2],[os.week,1],[os.month,1],[os.month,3],[os.year,1]],Vc=Oc.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Ce]]),Zc={range:function(t,n,e){return Ju.range(Math.ceil(t/e)*e,+n,e).map(Xu)},floor:Cn,ceil:Cn};Yc.year=os.year,os.scale=function(){return Zu(Ju.scale.linear(),Yc,Vc)};var Xc=Yc.map(function(t){return[t[0].utc,t[1]]}),$c=Fc.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Ce]]);Xc.year=os.year.utc,os.scale.utc=function(){return Zu(Ju.scale.linear(),Xc,$c)},Ju.text=Ln(function(t){return t.responseText}),Ju.json=function(t,n){return Pn(t,"application/json",$u,n)},Ju.html=function(t,n){return Pn(t,"text/html",Qu,n)},Ju.xml=Ln(function(t){return t.responseXML}),r=Ju,!("function"==typeof r?(i=r.call(n,e,n,t),void 0!==i&&(t.exports=i)):t.exports=r),this.d3=Ju}()},function(t){t.exports=function(t){var n=document.createElement("style");n.type="text/css";var e=document.getElementsByTagName("head")[0];return e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t)),function(){e.removeChild(n)}}},function(t,n,e){function r(t){this.init(t)}var i=e(8).Point2D,o=e(8).Vector2D,u=e(9).Polynomial;r.prototype.init=function(t){this.status=t,this.points=new Array},r.prototype.appendPoint=function(t){this.points.push(t)},r.prototype.appendPoints=function(t){this.points=this.points.concat(t)},r.intersectShapes=function(t,n){var e,i=t.getIntersectionParams(),o=n.getIntersectionParams();if(null!=i&&null!=o)if("Path"==i.name)e=r.intersectPathShape(t,n);else if("Path"==o.name)e=r.intersectPathShape(n,t);else{var u,a;if(i.name<o.name?(u="intersect"+i.name+o.name,a=i.params.concat(o.params)):(u="intersect"+o.name+i.name,a=o.params.concat(i.params)),!(u in r))throw new Error("Intersection not available: "+u);e=r[u].apply(null,a)}else e=new r("No Intersection");return e},r.intersectPathShape=function(t,n){return t.intersectShape(n)},r.intersectBezier2Bezier2=function(t,n,e,o,a,s){var c,l,f,y,h,x,p,g,d,v=new r("No Intersection");if(c=n.multiply(-2),f=t.add(c.add(e)),c=t.multiply(-2),l=n.multiply(2),y=c.add(l),h=new i(t.x,t.y),c=a.multiply(-2),x=o.add(c.add(s)),c=o.multiply(-2),l=a.multiply(2),p=c.add(l),g=new i(o.x,o.y),0==f.y){var m=f.x*(h.y-g.y),M=m-y.x*y.y,w=m+M,b=y.y*y.y;d=new u(f.x*x.y*x.y,2*f.x*p.y*x.y,f.x*p.y*p.y-x.x*b-x.y*m-x.y*M,-p.x*b-p.y*m-p.y*M,(h.x-g.x)*b+(h.y-g.y)*M)}else{var m=f.x*x.y-f.y*x.x,M=f.x*p.y-p.x*f.y,w=y.x*f.y-y.y*f.x,b=h.y-g.y,_=f.y*(h.x-g.x)-f.x*b,E=-y.y*w+f.y*_,S=w*w;d=new u(m*m,2*m*M,(-x.y*S+f.y*M*M+f.y*m*_+m*E)/f.y,(-p.y*S+f.y*M*_+M*E)/f.y,(b*S+_*E)/f.y)}for(var N=d.getRoots(),k=0;k<N.length;k++){var A=N[k];if(A>=0&&1>=A){var C=new u(f.x,y.x,h.x-g.x-A*p.x-A*A*x.x).getRoots(),L=new u(f.y,y.y,h.y-g.y-A*p.y-A*A*x.y).getRoots();if(C.length>0&&L.length>0){var P=1e-4;t:for(var z=0;z<C.length;z++){var q=C[z];if(q>=0&&1>=q)for(var R=0;R<L.length;R++)if(Math.abs(q-L[R])<P){v.points.push(x.multiply(A*A).add(p.multiply(A).add(g)));break t}}}}}return v.points.length>0&&(v.status="Intersection"),v},r.intersectBezier2Bezier3=function(t,n,e,a,s,c,l){var f,y,h,x,p,g,d,v,m,M,w,b=new r("No Intersection");f=n.multiply(-2),p=t.add(f.add(e)),f=t.multiply(-2),y=n.multiply(2),g=f.add(y),d=new i(t.x,t.y),f=a.multiply(-1),y=s.multiply(3),h=c.multiply(-3),x=f.add(y.add(h.add(l))),v=new o(x.x,x.y),f=a.multiply(3),y=s.multiply(-6),h=c.multiply(3),x=f.add(y.add(h)),m=new o(x.x,x.y),f=a.multiply(-3),y=s.multiply(3),h=f.add(y),M=new o(h.x,h.y),w=new o(a.x,a.y);for(var _=d.x*d.x,E=d.y*d.y,S=g.x*g.x,N=g.y*g.y,k=p.x*p.x,A=p.y*p.y,C=w.x*w.x,L=w.y*w.y,P=M.x*M.x,z=M.y*M.y,q=m.x*m.x,R=m.y*m.y,I=v.x*v.x,T=v.y*v.y,D=new u(-2*p.x*p.y*v.x*v.y+k*T+A*I,-2*p.x*p.y*m.x*v.y-2*p.x*p.y*m.y*v.x+2*A*m.x*v.x+2*k*m.y*v.y,-2*p.x*M.x*p.y*v.y-2*p.x*p.y*M.y*v.x-2*p.x*p.y*m.x*m.y+2*M.x*A*v.x+A*q+k*(2*M.y*v.y+R),2*d.x*p.x*p.y*v.y+2*d.y*p.x*p.y*v.x+g.x*g.y*p.x*v.y+g.x*g.y*p.y*v.x-2*w.x*p.x*p.y*v.y-2*p.x*w.y*p.y*v.x-2*p.x*M.x*p.y*m.y-2*p.x*p.y*M.y*m.x-2*d.x*A*v.x-2*d.y*k*v.y+2*w.x*A*v.x+2*M.x*A*m.x-N*p.x*v.x-S*p.y*v.y+k*(2*w.y*v.y+2*M.y*m.y),2*d.x*p.x*p.y*m.y+2*d.y*p.x*p.y*m.x+g.x*g.y*p.x*m.y+g.x*g.y*p.y*m.x-2*w.x*p.x*p.y*m.y-2*p.x*w.y*p.y*m.x-2*p.x*M.x*p.y*M.y-2*d.x*A*m.x-2*d.y*k*m.y+2*w.x*A*m.x-N*p.x*m.x-S*p.y*m.y+P*A+k*(2*w.y*m.y+z),2*d.x*p.x*p.y*M.y+2*d.y*p.x*M.x*p.y+g.x*g.y*p.x*M.y+g.x*g.y*M.x*p.y-2*w.x*p.x*p.y*M.y-2*p.x*w.y*M.x*p.y-2*d.x*M.x*A-2*d.y*k*M.y+2*w.x*M.x*A-N*p.x*M.x-S*p.y*M.y+2*k*w.y*M.y,-2*d.x*d.y*p.x*p.y-d.x*g.x*g.y*p.y-d.y*g.x*g.y*p.x+2*d.x*p.x*w.y*p.y+2*d.y*w.x*p.x*p.y+g.x*w.x*g.y*p.y+g.x*g.y*p.x*w.y-2*w.x*p.x*w.y*p.y-2*d.x*w.x*A+d.x*N*p.x+d.y*S*p.y-2*d.y*k*w.y-w.x*N*p.x-S*w.y*p.y+_*A+E*k+C*A+k*L),U=D.getRootsInInterval(0,1),j=0;j<U.length;j++){var O=U[j],F=new u(p.x,g.x,d.x-w.x-O*M.x-O*O*m.x-O*O*O*v.x).getRoots(),H=new u(p.y,g.y,d.y-w.y-O*M.y-O*O*m.y-O*O*O*v.y).getRoots();if(F.length>0&&H.length>0){var B=1e-4;t:for(var Y=0;Y<F.length;Y++){var V=F[Y];if(V>=0&&1>=V)for(var Z=0;Z<H.length;Z++)if(Math.abs(V-H[Z])<B){b.points.push(v.multiply(O*O*O).add(m.multiply(O*O).add(M.multiply(O).add(w))));break t}}}}return b.points.length>0&&(b.status="Intersection"),b},r.intersectBezier2Circle=function(t,n,e,i,o){return r.intersectBezier2Ellipse(t,n,e,i,o,o)},r.intersectBezier2Ellipse=function(t,n,e,o,a,s){var c,l,f,y,h,x=new r("No Intersection");c=n.multiply(-2),f=t.add(c.add(e)),c=t.multiply(-2),l=n.multiply(2),y=c.add(l),h=new i(t.x,t.y);for(var p=a*a,g=s*s,d=new u(g*f.x*f.x+p*f.y*f.y,2*(g*f.x*y.x+p*f.y*y.y),g*(2*f.x*h.x+y.x*y.x)+p*(2*f.y*h.y+y.y*y.y)-2*(g*o.x*f.x+p*o.y*f.y),2*(g*y.x*(h.x-o.x)+p*y.y*(h.y-o.y)),g*(h.x*h.x+o.x*o.x)+p*(h.y*h.y+o.y*o.y)-2*(g*o.x*h.x+p*o.y*h.y)-p*g).getRoots(),v=0;v<d.length;v++){var m=d[v];m>=0&&1>=m&&x.points.push(f.multiply(m*m).add(y.multiply(m).add(h)))}return x.points.length>0&&(x.status="Intersection"),x},r.intersectBezier2Line=function(t,n,e,a,s){var c,l,f,y,h,x,p,g=a.min(s),d=a.max(s),v=new r("No Intersection");c=n.multiply(-2),f=t.add(c.add(e)),c=t.multiply(-2),l=n.multiply(2),y=c.add(l),h=new i(t.x,t.y),p=new o(a.y-s.y,s.x-a.x),x=a.x*s.y-s.x*a.y,roots=new u(p.dot(f),p.dot(y),p.dot(h)+x).getRoots();for(var m=0;m<roots.length;m++){var M=roots[m];if(M>=0&&1>=M){var w=t.lerp(n,M),b=n.lerp(e,M),_=w.lerp(b,M);a.x==s.x?g.y<=_.y&&_.y<=d.y&&(v.status="Intersection",v.appendPoint(_)):a.y==s.y?g.x<=_.x&&_.x<=d.x&&(v.status="Intersection",v.appendPoint(_)):_.gte(g)&&_.lte(d)&&(v.status="Intersection",v.appendPoint(_))}}return v},r.intersectBezier2Polygon=function(t,n,e,i){for(var o=new r("No Intersection"),u=i.length,a=0;u>a;a++){var s=i[a],c=i[(a+1)%u],l=r.intersectBezier2Line(t,n,e,s,c);o.appendPoints(l.points)}return o.points.length>0&&(o.status="Intersection"),o},r.intersectBezier2Rectangle=function(t,n,e,o,u){var a=o.min(u),s=o.max(u),c=new i(s.x,a.y),l=new i(a.x,s.y),f=r.intersectBezier2Line(t,n,e,a,c),y=r.intersectBezier2Line(t,n,e,c,s),h=r.intersectBezier2Line(t,n,e,s,l),x=r.intersectBezier2Line(t,n,e,l,a),p=new r("No Intersection");return p.appendPoints(f.points),p.appendPoints(y.points),p.appendPoints(h.points),p.appendPoints(x.points),p.points.length>0&&(p.status="Intersection"),p},r.intersectBezier3Bezier3=function(t,n,e,i,a,s,c,l){var f,y,h,x,p,g,d,v,m,M,w,b,_=new r("No Intersection");f=t.multiply(-1),y=n.multiply(3),h=e.multiply(-3),x=f.add(y.add(h.add(i))),p=new o(x.x,x.y),f=t.multiply(3),y=n.multiply(-6),h=e.multiply(3),x=f.add(y.add(h)),g=new o(x.x,x.y),f=t.multiply(-3),y=n.multiply(3),h=f.add(y),d=new o(h.x,h.y),v=new o(t.x,t.y),f=a.multiply(-1),y=s.multiply(3),h=c.multiply(-3),x=f.add(y.add(h.add(l))),m=new o(x.x,x.y),f=a.multiply(3),y=s.multiply(-6),h=c.multiply(3),x=f.add(y.add(h)),M=new o(x.x,x.y),f=a.multiply(-3),y=s.multiply(3),h=f.add(y),w=new o(h.x,h.y),b=new o(a.x,a.y);for(var E=v.x*v.x,S=v.x*v.x*v.x,N=v.y*v.y,k=v.y*v.y*v.y,A=d.x*d.x,C=d.x*d.x*d.x,L=d.y*d.y,P=d.y*d.y*d.y,z=g.x*g.x,q=g.x*g.x*g.x,R=g.y*g.y,I=g.y*g.y*g.y,T=p.x*p.x,D=p.x*p.x*p.x,U=p.y*p.y,j=p.y*p.y*p.y,O=b.x*b.x,F=b.x*b.x*b.x,H=b.y*b.y,B=b.y*b.y*b.y,Y=w.x*w.x,V=w.x*w.x*w.x,Z=w.y*w.y,X=M.x*M.x,$=M.x*M.x*M.x,Q=M.y*M.y,J=m.x*m.x,W=m.x*m.x*m.x,G=m.y*m.y,K=m.y*m.y*m.y,tn=new u(-D*K+j*W-3*p.x*U*J*m.y+3*T*p.y*m.x*G,-6*p.x*M.x*U*m.x*m.y+6*T*p.y*M.y*m.x*m.y+3*M.x*j*J-3*D*M.y*G-3*p.x*U*M.y*J+3*T*M.x*p.y*G,-6*w.x*p.x*U*m.x*m.y-6*p.x*M.x*U*M.y*m.x+6*T*M.x*p.y*M.y*m.y+3*w.x*j*J+3*X*j*m.x+3*w.x*T*p.y*G-3*p.x*w.y*U*J-3*p.x*X*U*m.y+T*p.y*m.x*(6*w.y*m.y+3*Q)+D*(-w.y*G-2*Q*m.y-m.y*(2*w.y*m.y+Q)),d.x*g.y*p.x*p.y*m.x*m.y-d.y*g.x*p.x*p.y*m.x*m.y+6*w.x*M.x*j*m.x+3*d.x*g.x*p.x*p.y*G+6*v.x*p.x*U*m.x*m.y-3*d.x*g.x*U*m.x*m.y-3*d.y*g.y*p.x*p.y*J-6*v.y*T*p.y*m.x*m.y-6*b.x*p.x*U*m.x*m.y+3*d.y*g.y*T*m.x*m.y-2*g.x*R*p.x*m.x*m.y-6*w.x*p.x*M.x*U*m.y-6*w.x*p.x*U*M.y*m.x-6*p.x*w.y*M.x*U*m.x+6*w.x*T*p.y*M.y*m.y+2*z*g.y*p.y*m.x*m.y+$*j-3*v.x*j*J+3*v.y*D*G+3*b.x*j*J+I*p.x*J-q*p.y*G-3*v.x*T*p.y*G+3*v.y*p.x*U*J-2*d.x*g.y*T*G+d.x*g.y*U*J-d.y*g.x*T*G+2*d.y*g.x*U*J+3*b.x*T*p.y*G-g.x*R*p.y*J-3*b.y*p.x*U*J+z*g.y*p.x*G-3*p.x*X*U*M.y+T*p.y*m.x*(6*b.y*m.y+6*w.y*M.y)+T*M.x*p.y*(6*w.y*m.y+3*Q)+D*(-2*w.y*M.y*m.y-b.y*G-M.y*(2*w.y*m.y+Q)-m.y*(2*b.y*m.y+2*w.y*M.y)),6*d.x*g.x*p.x*p.y*M.y*m.y+d.x*g.y*p.x*M.x*p.y*m.y+d.x*g.y*p.x*p.y*M.y*m.x-d.y*g.x*p.x*M.x*p.y*m.y-d.y*g.x*p.x*p.y*M.y*m.x-6*d.y*g.y*p.x*M.x*p.y*m.x-6*v.x*M.x*j*m.x+6*b.x*M.x*j*m.x+6*v.y*D*M.y*m.y+2*I*p.x*M.x*m.x-2*q*p.y*M.y*m.y+6*v.x*p.x*M.x*U*m.y+6*v.x*p.x*U*M.y*m.x+6*v.y*p.x*M.x*U*m.x-3*d.x*g.x*M.x*U*m.y-3*d.x*g.x*U*M.y*m.x+2*d.x*g.y*M.x*U*m.x+4*d.y*g.x*M.x*U*m.x-6*v.x*T*p.y*M.y*m.y-6*v.y*T*M.x*p.y*m.y-6*v.y*T*p.y*M.y*m.x-4*d.x*g.y*T*M.y*m.y-6*b.x*p.x*M.x*U*m.y-6*b.x*p.x*U*M.y*m.x-2*d.y*g.x*T*M.y*m.y+3*d.y*g.y*T*M.x*m.y+3*d.y*g.y*T*M.y*m.x-2*g.x*R*p.x*M.x*m.y-2*g.x*R*p.x*M.y*m.x-2*g.x*R*M.x*p.y*m.x-6*b.y*p.x*M.x*U*m.x-6*w.x*p.x*w.y*U*m.x-6*w.x*p.x*M.x*U*M.y+6*b.x*T*p.y*M.y*m.y+2*z*g.y*p.x*M.y*m.y+2*z*g.y*M.x*p.y*m.y+2*z*g.y*p.y*M.y*m.x+3*w.x*X*j+3*Y*j*m.x-3*p.x*w.y*X*U-3*Y*p.x*U*m.y+T*M.x*p.y*(6*b.y*m.y+6*w.y*M.y)+T*p.y*m.x*(6*b.y*M.y+3*Z)+w.x*T*p.y*(6*w.y*m.y+3*Q)+D*(-2*b.y*M.y*m.y-m.y*(2*b.y*M.y+Z)-w.y*(2*w.y*m.y+Q)-M.y*(2*b.y*m.y+2*w.y*M.y)),d.x*w.x*g.y*p.x*p.y*m.y+d.x*g.y*p.x*w.y*p.y*m.x+d.x*g.y*p.x*M.x*p.y*M.y-d.y*g.x*w.x*p.x*p.y*m.y-d.y*g.x*p.x*w.y*p.y*m.x-d.y*g.x*p.x*M.x*p.y*M.y-6*d.y*w.x*g.y*p.x*p.y*m.x-6*v.x*w.x*j*m.x+6*b.x*w.x*j*m.x+2*w.x*I*p.x*m.x+6*v.x*w.x*p.x*U*m.y+6*v.x*p.x*w.y*U*m.x+6*v.x*p.x*M.x*U*M.y+6*v.y*w.x*p.x*U*m.x-3*d.x*g.x*w.x*U*m.y-3*d.x*g.x*w.y*U*m.x-3*d.x*g.x*M.x*U*M.y+2*d.x*w.x*g.y*U*m.x+4*d.y*g.x*w.x*U*m.x-6*v.y*w.x*T*p.y*m.y-6*v.y*T*w.y*p.y*m.x-6*v.y*T*M.x*p.y*M.y-6*b.x*w.x*p.x*U*m.y-6*b.x*p.x*w.y*U*m.x-6*b.x*p.x*M.x*U*M.y+3*d.y*w.x*g.y*T*m.y-3*d.y*g.y*p.x*X*p.y+3*d.y*g.y*T*w.y*m.x+3*d.y*g.y*T*M.x*M.y-2*g.x*w.x*R*p.x*m.y-2*g.x*w.x*R*p.y*m.x-2*g.x*R*p.x*w.y*m.x-2*g.x*R*p.x*M.x*M.y-6*b.y*w.x*p.x*U*m.x-6*w.x*p.x*w.y*M.x*U+6*b.y*T*w.y*p.y*m.x+2*z*w.x*g.y*p.y*m.y+2*z*g.y*w.y*p.y*m.x+2*z*g.y*M.x*p.y*M.y-3*v.x*X*j+3*b.x*X*j+3*Y*M.x*j+I*p.x*X+3*v.y*p.x*X*U+d.x*g.y*X*U+2*d.y*g.x*X*U-g.x*R*X*p.y-3*b.y*p.x*X*U-3*Y*p.x*U*M.y+z*g.y*p.x*(2*w.y*m.y+Q)+d.x*g.x*p.x*p.y*(6*w.y*m.y+3*Q)+w.x*T*p.y*(6*b.y*m.y+6*w.y*M.y)+q*p.y*(-2*w.y*m.y-Q)+v.y*D*(6*w.y*m.y+3*Q)+d.y*g.x*T*(-2*w.y*m.y-Q)+d.x*g.y*T*(-4*w.y*m.y-2*Q)+v.x*T*p.y*(-6*w.y*m.y-3*Q)+T*M.x*p.y*(6*b.y*M.y+3*Z)+b.x*T*p.y*(6*w.y*m.y+3*Q)+D*(-2*b.y*w.y*m.y-M.y*(2*b.y*M.y+Z)-b.y*(2*w.y*m.y+Q)-w.y*(2*b.y*m.y+2*w.y*M.y)),-v.x*d.x*g.y*p.x*p.y*m.y+v.x*d.y*g.x*p.x*p.y*m.y+6*v.x*d.y*g.y*p.x*p.y*m.x-6*v.y*d.x*g.x*p.x*p.y*m.y-v.y*d.x*g.y*p.x*p.y*m.x+v.y*d.y*g.x*p.x*p.y*m.x+d.x*d.y*g.x*g.y*p.x*m.y-d.x*d.y*g.x*g.y*p.y*m.x+d.x*b.x*g.y*p.x*p.y*m.y+d.x*b.y*g.y*p.x*p.y*m.x+d.x*w.x*g.y*p.x*p.y*M.y+d.x*g.y*p.x*w.y*M.x*p.y-b.x*d.y*g.x*p.x*p.y*m.y-6*b.x*d.y*g.y*p.x*p.y*m.x-d.y*g.x*b.y*p.x*p.y*m.x-d.y*g.x*w.x*p.x*p.y*M.y-d.y*g.x*p.x*w.y*M.x*p.y-6*d.y*w.x*g.y*p.x*M.x*p.y-6*v.x*b.x*j*m.x-6*v.x*w.x*M.x*j-2*v.x*I*p.x*m.x+6*b.x*w.x*M.x*j+2*b.x*I*p.x*m.x+2*w.x*I*p.x*M.x+2*v.y*q*p.y*m.y-6*v.x*v.y*p.x*U*m.x+3*v.x*d.x*g.x*U*m.y-2*v.x*d.x*g.y*U*m.x-4*v.x*d.y*g.x*U*m.x+3*v.y*d.x*g.x*U*m.x+6*v.x*v.y*T*p.y*m.y+6*v.x*b.x*p.x*U*m.y-3*v.x*d.y*g.y*T*m.y+2*v.x*g.x*R*p.x*m.y+2*v.x*g.x*R*p.y*m.x+6*v.x*b.y*p.x*U*m.x+6*v.x*w.x*p.x*U*M.y+6*v.x*p.x*w.y*M.x*U+4*v.y*d.x*g.y*T*m.y+6*v.y*b.x*p.x*U*m.x+2*v.y*d.y*g.x*T*m.y-3*v.y*d.y*g.y*T*m.x+2*v.y*g.x*R*p.x*m.x+6*v.y*w.x*p.x*M.x*U-3*d.x*b.x*g.x*U*m.y+2*d.x*b.x*g.y*U*m.x+d.x*d.y*R*p.x*m.x-3*d.x*g.x*b.y*U*m.x-3*d.x*g.x*w.x*U*M.y-3*d.x*g.x*w.y*M.x*U+2*d.x*w.x*g.y*M.x*U+4*b.x*d.y*g.x*U*m.x+4*d.y*g.x*w.x*M.x*U-2*v.x*z*g.y*p.y*m.y-6*v.y*b.x*T*p.y*m.y-6*v.y*b.y*T*p.y*m.x-6*v.y*w.x*T*p.y*M.y-2*v.y*z*g.y*p.x*m.y-2*v.y*z*g.y*p.y*m.x-6*v.y*T*w.y*M.x*p.y-d.x*d.y*z*p.y*m.y-2*d.x*L*p.x*p.y*m.x+3*b.x*d.y*g.y*T*m.y-2*b.x*g.x*R*p.x*m.y-2*b.x*g.x*R*p.y*m.x-6*b.x*b.y*p.x*U*m.x-6*b.x*w.x*p.x*U*M.y-6*b.x*p.x*w.y*M.x*U+3*d.y*b.y*g.y*T*m.x+3*d.y*w.x*g.y*T*M.y+3*d.y*g.y*T*w.y*M.x-2*g.x*b.y*R*p.x*m.x-2*g.x*w.x*R*p.x*M.y-2*g.x*w.x*R*M.x*p.y-2*g.x*R*p.x*w.y*M.x-6*b.y*w.x*p.x*M.x*U-L*g.x*g.y*p.x*m.x+2*b.x*z*g.y*p.y*m.y+6*b.y*T*w.y*M.x*p.y+2*A*d.y*p.x*p.y*m.y+A*g.x*g.y*p.y*m.y+2*z*b.y*g.y*p.y*m.x+2*z*w.x*g.y*p.y*M.y+2*z*g.y*w.y*M.x*p.y+V*j+3*E*j*m.x-3*N*D*m.y+3*O*j*m.x+P*T*m.x-C*U*m.y-d.x*L*T*m.y+A*d.y*U*m.x-3*E*p.x*U*m.y+3*N*T*p.y*m.x-A*R*p.x*m.y+L*z*p.y*m.x-3*Y*p.x*w.y*U-3*O*p.x*U*m.y+3*H*T*p.y*m.x+d.x*g.x*p.x*p.y*(6*b.y*m.y+6*w.y*M.y)+q*p.y*(-2*b.y*m.y-2*w.y*M.y)+v.y*D*(6*b.y*m.y+6*w.y*M.y)+d.y*g.x*T*(-2*b.y*m.y-2*w.y*M.y)+z*g.y*p.x*(2*b.y*m.y+2*w.y*M.y)+d.x*g.y*T*(-4*b.y*m.y-4*w.y*M.y)+v.x*T*p.y*(-6*b.y*m.y-6*w.y*M.y)+b.x*T*p.y*(6*b.y*m.y+6*w.y*M.y)+w.x*T*p.y*(6*b.y*M.y+3*Z)+D*(-2*b.y*w.y*M.y-H*m.y-w.y*(2*b.y*M.y+Z)-b.y*(2*b.y*m.y+2*w.y*M.y)),-v.x*d.x*g.y*p.x*p.y*M.y+v.x*d.y*g.x*p.x*p.y*M.y+6*v.x*d.y*g.y*p.x*M.x*p.y-6*v.y*d.x*g.x*p.x*p.y*M.y-v.y*d.x*g.y*p.x*M.x*p.y+v.y*d.y*g.x*p.x*M.x*p.y+d.x*d.y*g.x*g.y*p.x*M.y-d.x*d.y*g.x*g.y*M.x*p.y+d.x*b.x*g.y*p.x*p.y*M.y+d.x*b.y*g.y*p.x*M.x*p.y+d.x*w.x*g.y*p.x*w.y*p.y-b.x*d.y*g.x*p.x*p.y*M.y-6*b.x*d.y*g.y*p.x*M.x*p.y-d.y*g.x*b.y*p.x*M.x*p.y-d.y*g.x*w.x*p.x*w.y*p.y-6*v.x*b.x*M.x*j-2*v.x*I*p.x*M.x+2*b.x*I*p.x*M.x+2*v.y*q*p.y*M.y-6*v.x*v.y*p.x*M.x*U+3*v.x*d.x*g.x*U*M.y-2*v.x*d.x*g.y*M.x*U-4*v.x*d.y*g.x*M.x*U+3*v.y*d.x*g.x*M.x*U+6*v.x*v.y*T*p.y*M.y+6*v.x*b.x*p.x*U*M.y-3*v.x*d.y*g.y*T*M.y+2*v.x*g.x*R*p.x*M.y+2*v.x*g.x*R*M.x*p.y+6*v.x*b.y*p.x*M.x*U+6*v.x*w.x*p.x*w.y*U+4*v.y*d.x*g.y*T*M.y+6*v.y*b.x*p.x*M.x*U+2*v.y*d.y*g.x*T*M.y-3*v.y*d.y*g.y*T*M.x+2*v.y*g.x*R*p.x*M.x-3*d.x*b.x*g.x*U*M.y+2*d.x*b.x*g.y*M.x*U+d.x*d.y*R*p.x*M.x-3*d.x*g.x*b.y*M.x*U-3*d.x*g.x*w.x*w.y*U+4*b.x*d.y*g.x*M.x*U-2*v.x*z*g.y*p.y*M.y-6*v.y*b.x*T*p.y*M.y-6*v.y*b.y*T*M.x*p.y-6*v.y*w.x*T*w.y*p.y-2*v.y*z*g.y*p.x*M.y-2*v.y*z*g.y*M.x*p.y-d.x*d.y*z*p.y*M.y-2*d.x*L*p.x*M.x*p.y+3*b.x*d.y*g.y*T*M.y-2*b.x*g.x*R*p.x*M.y-2*b.x*g.x*R*M.x*p.y-6*b.x*b.y*p.x*M.x*U-6*b.x*w.x*p.x*w.y*U+3*d.y*b.y*g.y*T*M.x+3*d.y*w.x*g.y*T*w.y-2*g.x*b.y*R*p.x*M.x-2*g.x*w.x*R*p.x*w.y-L*g.x*g.y*p.x*M.x+2*b.x*z*g.y*p.y*M.y-3*d.y*Y*g.y*p.x*p.y+6*b.y*w.x*T*w.y*p.y+2*A*d.y*p.x*p.y*M.y+A*g.x*g.y*p.y*M.y+2*z*b.y*g.y*M.x*p.y+2*z*w.x*g.y*w.y*p.y-3*v.x*Y*j+3*b.x*Y*j+3*E*M.x*j-3*N*D*M.y+3*O*M.x*j+Y*I*p.x+P*T*M.x-C*U*M.y+3*v.y*Y*p.x*U-d.x*L*T*M.y+d.x*Y*g.y*U+2*d.y*g.x*Y*U+A*d.y*M.x*U-g.x*Y*R*p.y-3*b.y*Y*p.x*U-3*E*p.x*U*M.y+3*N*T*M.x*p.y-A*R*p.x*M.y+L*z*M.x*p.y-3*O*p.x*U*M.y+3*H*T*M.x*p.y+z*g.y*p.x*(2*b.y*M.y+Z)+d.x*g.x*p.x*p.y*(6*b.y*M.y+3*Z)+q*p.y*(-2*b.y*M.y-Z)+v.y*D*(6*b.y*M.y+3*Z)+d.y*g.x*T*(-2*b.y*M.y-Z)+d.x*g.y*T*(-4*b.y*M.y-2*Z)+v.x*T*p.y*(-6*b.y*M.y-3*Z)+b.x*T*p.y*(6*b.y*M.y+3*Z)+D*(-2*b.y*Z-H*M.y-b.y*(2*b.y*M.y+Z)),-v.x*d.x*g.y*p.x*w.y*p.y+v.x*d.y*g.x*p.x*w.y*p.y+6*v.x*d.y*w.x*g.y*p.x*p.y-6*v.y*d.x*g.x*p.x*w.y*p.y-v.y*d.x*w.x*g.y*p.x*p.y+v.y*d.y*g.x*w.x*p.x*p.y-d.x*d.y*g.x*w.x*g.y*p.y+d.x*d.y*g.x*g.y*p.x*w.y+d.x*b.x*g.y*p.x*w.y*p.y+6*d.x*g.x*b.y*p.x*w.y*p.y+d.x*b.y*w.x*g.y*p.x*p.y-b.x*d.y*g.x*p.x*w.y*p.y-6*b.x*d.y*w.x*g.y*p.x*p.y-d.y*g.x*b.y*w.x*p.x*p.y-6*v.x*b.x*w.x*j-2*v.x*w.x*I*p.x+6*v.y*b.y*D*w.y+2*b.x*w.x*I*p.x+2*v.y*q*w.y*p.y-2*q*b.y*w.y*p.y-6*v.x*v.y*w.x*p.x*U+3*v.x*d.x*g.x*w.y*U-2*v.x*d.x*w.x*g.y*U-4*v.x*d.y*g.x*w.x*U+3*v.y*d.x*g.x*w.x*U+6*v.x*v.y*T*w.y*p.y+6*v.x*b.x*p.x*w.y*U-3*v.x*d.y*g.y*T*w.y+2*v.x*g.x*w.x*R*p.y+2*v.x*g.x*R*p.x*w.y+6*v.x*b.y*w.x*p.x*U+4*v.y*d.x*g.y*T*w.y+6*v.y*b.x*w.x*p.x*U+2*v.y*d.y*g.x*T*w.y-3*v.y*d.y*w.x*g.y*T+2*v.y*g.x*w.x*R*p.x-3*d.x*b.x*g.x*w.y*U+2*d.x*b.x*w.x*g.y*U+d.x*d.y*w.x*R*p.x-3*d.x*g.x*b.y*w.x*U+4*b.x*d.y*g.x*w.x*U-6*v.x*b.y*T*w.y*p.y-2*v.x*z*g.y*w.y*p.y-6*v.y*b.x*T*w.y*p.y-6*v.y*b.y*w.x*T*p.y-2*v.y*z*w.x*g.y*p.y-2*v.y*z*g.y*p.x*w.y-d.x*d.y*z*w.y*p.y-4*d.x*b.y*g.y*T*w.y-2*d.x*L*w.x*p.x*p.y+3*b.x*d.y*g.y*T*w.y-2*b.x*g.x*w.x*R*p.y-2*b.x*g.x*R*p.x*w.y-6*b.x*b.y*w.x*p.x*U-2*d.y*g.x*b.y*T*w.y+3*d.y*b.y*w.x*g.y*T-2*g.x*b.y*w.x*R*p.x-L*g.x*w.x*g.y*p.x+6*b.x*b.y*T*w.y*p.y+2*b.x*z*g.y*w.y*p.y+2*A*d.y*p.x*w.y*p.y+A*g.x*g.y*w.y*p.y+2*z*b.y*w.x*g.y*p.y+2*z*b.y*g.y*p.x*w.y+3*E*w.x*j-3*N*D*w.y+3*O*w.x*j+P*w.x*T-C*w.y*U-3*H*D*w.y-d.x*L*T*w.y+A*d.y*w.x*U-3*E*p.x*w.y*U+3*N*w.x*T*p.y-A*R*p.x*w.y+L*z*w.x*p.y-3*O*p.x*w.y*U+3*H*w.x*T*p.y,v.x*v.y*d.x*g.y*p.x*p.y-v.x*v.y*d.y*g.x*p.x*p.y+v.x*d.x*d.y*g.x*g.y*p.y-v.y*d.x*d.y*g.x*g.y*p.x-v.x*d.x*b.y*g.y*p.x*p.y+6*v.x*b.x*d.y*g.y*p.x*p.y+v.x*d.y*g.x*b.y*p.x*p.y-v.y*d.x*b.x*g.y*p.x*p.y-6*v.y*d.x*g.x*b.y*p.x*p.y+v.y*b.x*d.y*g.x*p.x*p.y-d.x*b.x*d.y*g.x*g.y*p.y+d.x*d.y*g.x*b.y*g.y*p.x+d.x*b.x*b.y*g.y*p.x*p.y-b.x*d.y*g.x*b.y*p.x*p.y-2*v.x*b.x*I*p.x+2*v.y*q*b.y*p.y-3*v.x*v.y*d.x*g.x*U-6*v.x*v.y*b.x*p.x*U+3*v.x*v.y*d.y*g.y*T-2*v.x*v.y*g.x*R*p.x-2*v.x*d.x*b.x*g.y*U-v.x*d.x*d.y*R*p.x+3*v.x*d.x*g.x*b.y*U-4*v.x*b.x*d.y*g.x*U+3*v.y*d.x*b.x*g.x*U+6*v.x*v.y*b.y*T*p.y+2*v.x*v.y*z*g.y*p.y+2*v.x*d.x*L*p.x*p.y+2*v.x*b.x*g.x*R*p.y+6*v.x*b.x*b.y*p.x*U-3*v.x*d.y*b.y*g.y*T+2*v.x*g.x*b.y*R*p.x+v.x*L*g.x*g.y*p.x+v.y*d.x*d.y*z*p.y+4*v.y*d.x*b.y*g.y*T-3*v.y*b.x*d.y*g.y*T+2*v.y*b.x*g.x*R*p.x+2*v.y*d.y*g.x*b.y*T+d.x*b.x*d.y*R*p.x-3*d.x*b.x*g.x*b.y*U-2*v.x*z*b.y*g.y*p.y-6*v.y*b.x*b.y*T*p.y-2*v.y*b.x*z*g.y*p.y-2*v.y*A*d.y*p.x*p.y-v.y*A*g.x*g.y*p.y-2*v.y*z*b.y*g.y*p.x-2*d.x*b.x*L*p.x*p.y-d.x*d.y*z*b.y*p.y+3*b.x*d.y*b.y*g.y*T-2*b.x*g.x*b.y*R*p.x-b.x*L*g.x*g.y*p.x+3*N*d.x*g.x*p.x*p.y+3*d.x*g.x*H*p.x*p.y+2*b.x*z*b.y*g.y*p.y-3*E*d.y*g.y*p.x*p.y+2*A*d.y*b.y*p.x*p.y+A*g.x*b.y*g.y*p.y-3*O*d.y*g.y*p.x*p.y-S*j+k*D+F*j-B*D-3*v.x*O*j-v.x*P*T+3*E*b.x*j+v.y*C*U+3*v.y*H*D+b.x*P*T+E*I*p.x-3*N*b.y*D-N*q*p.y+O*I*p.x-C*b.y*U-q*H*p.y-v.x*A*d.y*U+v.y*d.x*L*T-3*v.x*N*T*p.y-v.x*L*z*p.y+v.y*A*R*p.x-d.x*L*b.y*T+3*E*v.y*p.x*U+E*d.x*g.y*U+2*E*d.y*g.x*U-2*N*d.x*g.y*T-N*d.y*g.x*T+A*b.x*d.y*U-3*v.x*H*T*p.y+3*v.y*O*p.x*U+d.x*O*g.y*U-2*d.x*H*g.y*T+b.x*L*z*p.y-d.y*g.x*H*T-E*g.x*R*p.y-3*E*b.y*p.x*U+3*N*b.x*T*p.y+N*z*g.y*p.x-A*b.y*R*p.x+2*O*d.y*g.x*U+3*b.x*H*T*p.y-O*g.x*R*p.y-3*O*b.y*p.x*U+z*H*g.y*p.x),nn=tn.getRootsInInterval(0,1),en=0;en<nn.length;en++){var rn=nn[en],on=new u(p.x,g.x,d.x,v.x-b.x-rn*w.x-rn*rn*M.x-rn*rn*rn*m.x).getRoots(),un=new u(p.y,g.y,d.y,v.y-b.y-rn*w.y-rn*rn*M.y-rn*rn*rn*m.y).getRoots();
if(on.length>0&&un.length>0){var an=1e-4;t:for(var sn=0;sn<on.length;sn++){var cn=on[sn];if(cn>=0&&1>=cn)for(var ln=0;ln<un.length;ln++)if(Math.abs(cn-un[ln])<an){_.points.push(m.multiply(rn*rn*rn).add(M.multiply(rn*rn).add(w.multiply(rn).add(b))));break t}}}}return _.points.length>0&&(_.status="Intersection"),_},r.intersectBezier3Circle=function(t,n,e,i,o,u){return r.intersectBezier3Ellipse(t,n,e,i,o,u,u)},r.intersectBezier3Ellipse=function(t,n,e,i,a,s,c){var l,f,y,h,x,p,g,d,v=new r("No Intersection");l=t.multiply(-1),f=n.multiply(3),y=e.multiply(-3),h=l.add(f.add(y.add(i))),x=new o(h.x,h.y),l=t.multiply(3),f=n.multiply(-6),y=e.multiply(3),h=l.add(f.add(y)),p=new o(h.x,h.y),l=t.multiply(-3),f=n.multiply(3),y=l.add(f),g=new o(y.x,y.y),d=new o(t.x,t.y);for(var m=s*s,M=c*c,w=new u(x.x*x.x*M+x.y*x.y*m,2*(x.x*p.x*M+x.y*p.y*m),2*(x.x*g.x*M+x.y*g.y*m)+p.x*p.x*M+p.y*p.y*m,2*x.x*M*(d.x-a.x)+2*x.y*m*(d.y-a.y)+2*(p.x*g.x*M+p.y*g.y*m),2*p.x*M*(d.x-a.x)+2*p.y*m*(d.y-a.y)+g.x*g.x*M+g.y*g.y*m,2*g.x*M*(d.x-a.x)+2*g.y*m*(d.y-a.y),d.x*d.x*M-2*d.y*a.y*m-2*d.x*a.x*M+d.y*d.y*m+a.x*a.x*M+a.y*a.y*m-m*M),b=w.getRootsInInterval(0,1),_=0;_<b.length;_++){var E=b[_];v.points.push(x.multiply(E*E*E).add(p.multiply(E*E).add(g.multiply(E).add(d))))}return v.points.length>0&&(v.status="Intersection"),v},r.intersectBezier3Line=function(t,n,e,i,a,s){var c,l,f,y,h,x,p,g,d,v,m=a.min(s),M=a.max(s),w=new r("No Intersection");c=t.multiply(-1),l=n.multiply(3),f=e.multiply(-3),y=c.add(l.add(f.add(i))),h=new o(y.x,y.y),c=t.multiply(3),l=n.multiply(-6),f=e.multiply(3),y=c.add(l.add(f)),x=new o(y.x,y.y),c=t.multiply(-3),l=n.multiply(3),f=c.add(l),p=new o(f.x,f.y),g=new o(t.x,t.y),v=new o(a.y-s.y,s.x-a.x),d=a.x*s.y-s.x*a.y,roots=new u(v.dot(h),v.dot(x),v.dot(p),v.dot(g)+d).getRoots();for(var b=0;b<roots.length;b++){var _=roots[b];if(_>=0&&1>=_){var E=t.lerp(n,_),S=n.lerp(e,_),N=e.lerp(i,_),k=E.lerp(S,_),A=S.lerp(N,_),C=k.lerp(A,_);a.x==s.x?m.y<=C.y&&C.y<=M.y&&(w.status="Intersection",w.appendPoint(C)):a.y==s.y?m.x<=C.x&&C.x<=M.x&&(w.status="Intersection",w.appendPoint(C)):C.gte(m)&&C.lte(M)&&(w.status="Intersection",w.appendPoint(C))}}return w},r.intersectBezier3Polygon=function(t,n,e,i,o){for(var u=new r("No Intersection"),a=o.length,s=0;a>s;s++){var c=o[s],l=o[(s+1)%a],f=r.intersectBezier3Line(t,n,e,i,c,l);u.appendPoints(f.points)}return u.points.length>0&&(u.status="Intersection"),u},r.intersectBezier3Rectangle=function(t,n,e,o,u,a){var s=u.min(a),c=u.max(a),l=new i(c.x,s.y),f=new i(s.x,c.y),y=r.intersectBezier3Line(t,n,e,o,s,l),h=r.intersectBezier3Line(t,n,e,o,l,c),x=r.intersectBezier3Line(t,n,e,o,c,f),p=r.intersectBezier3Line(t,n,e,o,f,s),g=new r("No Intersection");return g.appendPoints(y.points),g.appendPoints(h.points),g.appendPoints(x.points),g.appendPoints(p.points),g.points.length>0&&(g.status="Intersection"),g},r.intersectCircleCircle=function(t,n,e,o){var u,a=n+o,s=Math.abs(n-o),c=t.distanceFrom(e);if(c>a)u=new r("Outside");else if(s>c)u=new r("Inside");else{u=new r("Intersection");var l=(n*n-o*o+c*c)/(2*c),f=Math.sqrt(n*n-l*l),y=t.lerp(e,l/c),h=f/c;u.points.push(new i(y.x-h*(e.y-t.y),y.y+h*(e.x-t.x))),u.points.push(new i(y.x+h*(e.y-t.y),y.y-h*(e.x-t.x)))}return u},r.intersectCircleEllipse=function(t,n,e,i,o){return r.intersectEllipseEllipse(t,n,n,e,i,o)},r.intersectCircleLine=function(t,n,e,i){var o,u=(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y),a=2*((i.x-e.x)*(e.x-t.x)+(i.y-e.y)*(e.y-t.y)),s=t.x*t.x+t.y*t.y+e.x*e.x+e.y*e.y-2*(t.x*e.x+t.y*e.y)-n*n,c=a*a-4*u*s;if(0>c)o=new r("Outside");else if(0==c)o=new r("Tangent");else{var l=Math.sqrt(c),f=(-a+l)/(2*u),y=(-a-l)/(2*u);(0>f||f>1)&&(0>y||y>1)?o=new r(0>f&&0>y||f>1&&y>1?"Outside":"Inside"):(o=new r("Intersection"),f>=0&&1>=f&&o.points.push(e.lerp(i,f)),y>=0&&1>=y&&o.points.push(e.lerp(i,y)))}return o},r.intersectCirclePolygon=function(t,n,e){for(var i,o=new r("No Intersection"),u=e.length,a=0;u>a;a++){var s=e[a],c=e[(a+1)%u];i=r.intersectCircleLine(t,n,s,c),o.appendPoints(i.points)}return o.status=o.points.length>0?"Intersection":i.status,o},r.intersectCircleRectangle=function(t,n,e,o){var u=e.min(o),a=e.max(o),s=new i(a.x,u.y),c=new i(u.x,a.y),l=r.intersectCircleLine(t,n,u,s),f=r.intersectCircleLine(t,n,s,a),y=r.intersectCircleLine(t,n,a,c),h=r.intersectCircleLine(t,n,c,u),x=new r("No Intersection");return x.appendPoints(l.points),x.appendPoints(f.points),x.appendPoints(y.points),x.appendPoints(h.points),x.status=x.points.length>0?"Intersection":l.status,x},r.intersectEllipseEllipse=function(t,n,e,o,a,s){for(var c=[e*e,0,n*n,-2*e*e*t.x,-2*n*n*t.y,e*e*t.x*t.x+n*n*t.y*t.y-n*n*e*e],l=[s*s,0,a*a,-2*s*s*o.x,-2*a*a*o.y,s*s*o.x*o.x+a*a*o.y*o.y-a*a*s*s],f=r.bezout(c,l),y=f.getRoots(),h=.001,x=(c[0]*c[0]+2*c[1]*c[1]+c[2]*c[2])*h,p=(l[0]*l[0]+2*l[1]*l[1]+l[2]*l[2])*h,g=new r("No Intersection"),d=0;d<y.length;d++)for(var v=new u(c[0],c[3]+y[d]*c[1],c[5]+y[d]*(c[4]+y[d]*c[2])),m=v.getRoots(),M=0;M<m.length;M++){var w=(c[0]*m[M]+c[1]*y[d]+c[3])*m[M]+(c[2]*y[d]+c[4])*y[d]+c[5];Math.abs(w)<x&&(w=(l[0]*m[M]+l[1]*y[d]+l[3])*m[M]+(l[2]*y[d]+l[4])*y[d]+l[5],Math.abs(w)<p&&g.appendPoint(new i(m[M],y[d])))}return g.points.length>0&&(g.status="Intersection"),g},r.intersectEllipseLine=function(t,n,e,i,u){var a,s=new o(i.x,i.y),c=o.fromPoints(i,u),l=new o(t.x,t.y),f=s.subtract(l),y=new o(c.x/(n*n),c.y/(e*e)),h=new o(f.x/(n*n),f.y/(e*e)),x=c.dot(y),p=c.dot(h),t=f.dot(h)-1,g=p*p-x*t;if(0>g)a=new r("Outside");else if(g>0){var d=Math.sqrt(g),v=(-p-d)/x,m=(-p+d)/x;(0>v||v>1)&&(0>m||m>1)?a=new r(0>v&&0>m||v>1&&m>1?"Outside":"Inside"):(a=new r("Intersection"),v>=0&&1>=v&&a.appendPoint(i.lerp(u,v)),m>=0&&1>=m&&a.appendPoint(i.lerp(u,m)))}else{var M=-p/x;M>=0&&1>=M?(a=new r("Intersection"),a.appendPoint(i.lerp(u,M))):a=new r("Outside")}return a},r.intersectEllipsePolygon=function(t,n,e,i){for(var o=new r("No Intersection"),u=i.length,a=0;u>a;a++){var s=i[a],c=i[(a+1)%u],l=r.intersectEllipseLine(t,n,e,s,c);o.appendPoints(l.points)}return o.points.length>0&&(o.status="Intersection"),o},r.intersectEllipseRectangle=function(t,n,e,o,u){var a=o.min(u),s=o.max(u),c=new i(s.x,a.y),l=new i(a.x,s.y),f=r.intersectEllipseLine(t,n,e,a,c),y=r.intersectEllipseLine(t,n,e,c,s),h=r.intersectEllipseLine(t,n,e,s,l),x=r.intersectEllipseLine(t,n,e,l,a),p=new r("No Intersection");return p.appendPoints(f.points),p.appendPoints(y.points),p.appendPoints(h.points),p.appendPoints(x.points),p.points.length>0&&(p.status="Intersection"),p},r.intersectLineLine=function(t,n,e,o){var u,a=(o.x-e.x)*(t.y-e.y)-(o.y-e.y)*(t.x-e.x),s=(n.x-t.x)*(t.y-e.y)-(n.y-t.y)*(t.x-e.x),c=(o.y-e.y)*(n.x-t.x)-(o.x-e.x)*(n.y-t.y);if(0!=c){var l=a/c,f=s/c;l>=0&&1>=l&&f>=0&&1>=f?(u=new r("Intersection"),u.points.push(new i(t.x+l*(n.x-t.x),t.y+l*(n.y-t.y)))):u=new r("No Intersection")}else u=new r(0==a||0==s?"Coincident":"Parallel");return u},r.intersectLinePolygon=function(t,n,e){for(var i=new r("No Intersection"),o=e.length,u=0;o>u;u++){var a=e[u],s=e[(u+1)%o],c=r.intersectLineLine(t,n,a,s);i.appendPoints(c.points)}return i.points.length>0&&(i.status="Intersection"),i},r.intersectLineRectangle=function(t,n,e,o){var u=e.min(o),a=e.max(o),s=new i(a.x,u.y),c=new i(u.x,a.y),l=r.intersectLineLine(u,s,t,n),f=r.intersectLineLine(s,a,t,n),y=r.intersectLineLine(a,c,t,n),h=r.intersectLineLine(c,u,t,n),x=new r("No Intersection");return x.appendPoints(l.points),x.appendPoints(f.points),x.appendPoints(y.points),x.appendPoints(h.points),x.points.length>0&&(x.status="Intersection"),x},r.intersectPolygonPolygon=function(t,n){for(var e=new r("No Intersection"),i=t.length,o=0;i>o;o++){var u=t[o],a=t[(o+1)%i],s=r.intersectLinePolygon(u,a,n);e.appendPoints(s.points)}return e.points.length>0&&(e.status="Intersection"),e},r.intersectPolygonRectangle=function(t,n,e){var o=n.min(e),u=n.max(e),a=new i(u.x,o.y),s=new i(o.x,u.y),c=r.intersectLinePolygon(o,a,t),l=r.intersectLinePolygon(a,u,t),f=r.intersectLinePolygon(u,s,t),y=r.intersectLinePolygon(s,o,t),h=new r("No Intersection");return h.appendPoints(c.points),h.appendPoints(l.points),h.appendPoints(f.points),h.appendPoints(y.points),h.points.length>0&&(h.status="Intersection"),h},r.intersectRayRay=function(t,n,e,o){var u,a=(o.x-e.x)*(t.y-e.y)-(o.y-e.y)*(t.x-e.x),s=(n.x-t.x)*(t.y-e.y)-(n.y-t.y)*(t.x-e.x),c=(o.y-e.y)*(n.x-t.x)-(o.x-e.x)*(n.y-t.y);if(0!=c){var l=a/c;u=new r("Intersection"),u.points.push(new i(t.x+l*(n.x-t.x),t.y+l*(n.y-t.y)))}else u=new r(0==a||0==s?"Coincident":"Parallel");return u},r.intersectRectangleRectangle=function(t,n,e,o){var u=t.min(n),a=t.max(n),s=new i(a.x,u.y),c=new i(u.x,a.y),l=r.intersectLineRectangle(u,s,e,o),f=r.intersectLineRectangle(s,a,e,o),y=r.intersectLineRectangle(a,c,e,o),h=r.intersectLineRectangle(c,u,e,o),x=new r("No Intersection");return x.appendPoints(l.points),x.appendPoints(f.points),x.appendPoints(y.points),x.appendPoints(h.points),x.points.length>0&&(x.status="Intersection"),x},r.bezout=function(t,n){var e=t[0]*n[1]-n[0]*t[1],r=t[0]*n[2]-n[0]*t[2],i=t[0]*n[3]-n[0]*t[3],o=t[0]*n[4]-n[0]*t[4],a=t[0]*n[5]-n[0]*t[5],s=t[1]*n[2]-n[1]*t[2],c=t[1]*n[4]-n[1]*t[4],l=t[1]*n[5]-n[1]*t[5],f=t[2]*n[3]-n[2]*t[3],y=t[3]*n[4]-n[3]*t[4],h=t[3]*n[5]-n[3]*t[5],x=l+y,p=c-f;return new u(e*s-r*r,e*p+i*s-2*r*o,e*x+i*p-o*o-2*r*a,e*h+i*x-2*o*a,i*h-a*a)},t.exports=r},function(t){function n(t,n){this.init(t,n)}n.prototype.init=function(t,n){this.name=t,this.params=n},t.exports=n},function(t,n,e){n.Point2D=e(10),n.Vector2D=e(11),n.Matrix2D=e(12)},function(t,n,e){n.Polynomial=e(13),n.SqrtPolynomial=e(14)},function(t){function n(t,n){this.x=t,this.y=n}n.prototype.clone=function(){return new n(this.x,this.y)},n.prototype.add=function(t){return new n(this.x+t.x,this.y+t.y)},n.prototype.addEquals=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.rmoveto=function(t,n){this.x+=t,this.y+=n},n.prototype.scalarAdd=function(t){return new n(this.x+t,this.y+t)},n.prototype.scalarAddEquals=function(t){return this.x+=t,this.y+=t,this},n.prototype.subtract=function(t){return new n(this.x-t.x,this.y-t.y)},n.prototype.subtractEquals=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.scalarSubtract=function(t){return new n(this.x-t,this.y-t)},n.prototype.scalarSubtractEquals=function(t){return this.x-=t,this.y-=t,this},n.prototype.multiply=function(t){return new n(this.x*t,this.y*t)},n.prototype.multiplyEquals=function(t){return this.x*=t,this.y*=t,this},n.prototype.divide=function(t){return new n(this.x/t,this.y/t)},n.prototype.divideEquals=function(t){return this.x/=t,this.y/=t,this},n.prototype.compare=function(t){return this.x-t.x||this.y-t.y},n.prototype.equals=function(t){return this.x==t.x&&this.y==t.y},n.prototype.lerp=function(t,e){var r=1-e;return new n(this.x*r+t.x*e,this.y*r+t.y*e)},n.prototype.distanceFrom=function(t){var n=this.x-t.x,e=this.y-t.y;return Math.sqrt(n*n+e*e)},n.prototype.min=function(t){return new n(Math.min(this.x,t.x),Math.min(this.y,t.y))},n.prototype.max=function(t){return new n(Math.max(this.x,t.x),Math.max(this.y,t.y))},n.prototype.transform=function(t){return new n(t.a*this.x+t.c*this.y+t.e,t.b*this.x+t.d*this.y+t.f)},n.prototype.toString=function(){return"point("+this.x+","+this.y+")"},n.prototype.setXY=function(t,n){this.x=t,this.y=n},n.prototype.setFromPoint=function(t){this.x=t.x,this.y=t.y},n.prototype.swap=function(t){var n=this.x,e=this.y;this.x=t.x,this.y=t.y,t.x=n,t.y=e},t.exports=n},function(t){function n(t,n){this.x=t,this.y=n}n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},n.prototype.dot=function(t){return this.x*t.x+this.y*t.y},n.prototype.cross=function(t){return this.x*t.y-this.y*t.x},n.prototype.unit=function(){return this.divide(this.length())},n.prototype.unitEquals=function(){return this.divideEquals(this.length()),this},n.prototype.add=function(t){return new n(this.x+t.x,this.y+t.y)},n.prototype.addEquals=function(t){return this.x+=t.x,this.y+=t.y,this},n.prototype.subtract=function(t){return new n(this.x-t.x,this.y-t.y)},n.prototype.subtractEquals=function(t){return this.x-=t.x,this.y-=t.y,this},n.prototype.multiply=function(t){return new n(this.x*t,this.y*t)},n.prototype.multiplyEquals=function(t){return this.x*=t,this.y*=t,this},n.prototype.divide=function(t){return new n(this.x/t,this.y/t)},n.prototype.divideEquals=function(t){return this.x/=t,this.y/=t,this},n.prototype.perp=function(){return new n(-this.y,this.x)},n.prototype.perpendicular=function(t){return this.subtract(this.project(t))},n.prototype.project=function(t){var n=this.dot(t)/t.dot(t);return t.multiply(n)},n.prototype.transform=function(t){return new n(t.a*this.x+t.c*this.y,t.b*this.x+t.d*this.y)},n.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},n.prototype.toString=function(){return this.x+","+this.y},n.fromPoints=function(t,e){return new n(e.x-t.x,e.y-t.y)},t.exports=n},function(t){function n(t,n,e,r,i,o){this.a=void 0!==t?t:1,this.b=void 0!==n?n:0,this.c=void 0!==e?e:0,this.d=void 0!==r?r:1,this.e=void 0!==i?i:0,this.f=void 0!==o?o:0}n.IDENTITY=new n(1,0,0,1,0,0),n.prototype.multiply=function(t){return new n(this.a*t.a+this.c*t.b,this.b*t.a+this.d*t.b,this.a*t.c+this.c*t.d,this.b*t.c+this.d*t.d,this.a*t.e+this.c*t.f+this.e,this.b*t.e+this.d*t.f+this.f)},n.prototype.inverse=function(){var t=this.a*this.d-this.b*this.c;if(0==t)throw"Matrix is not invertible";var e=1/t,r=this.f*this.c-this.e*this.d,i=this.e*this.b-this.f*this.a;return new n(this.d*e,-this.b*e,-this.c*e,this.a*e,r*e,i*e)},n.prototype.translate=function(t,e){return new n(this.a,this.b,this.c,this.d,this.a*t+this.c*e+this.e,this.b*t+this.d*e+this.f)},n.prototype.scale=function(t){return new n(this.a*t,this.b*t,this.c*t,this.d*t,this.e,this.f)},n.prototype.scaleAt=function(t,e){var r=e.x-t*e.x,i=e.y-t*e.y;return new n(this.a*t,this.b*t,this.c*t,this.d*t,this.a*r+this.c*i+this.e,this.b*r+this.d*i+this.f)},n.prototype.scaleNonUniform=function(t,e){return new n(this.a*t,this.b*t,this.c*e,this.d*e,this.e,this.f)},n.prototype.scaleNonUniformAt=function(t,e,r){var i=r.x-t*r.x,o=r.y-e*r.y;return new n(this.a*t,this.b*t,this.c*e,this.d*e,this.a*i+this.c*o+this.e,this.b*i+this.d*o+this.f)},n.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t);return new n(this.a*e+this.c*r,this.b*e+this.d*r,this.a*-r+this.c*e,this.b*-r+this.d*e,this.e,this.f)},n.prototype.rotateAt=function(t,e){var r=Math.cos(t),i=Math.sin(t),o=-e.x+e.x*r-e.y*i,u=-e.y+e.y*r+e.x*i;return new n(this.a*r+this.c*i,this.b*r+this.d*i,this.a*-i+this.c*r,this.b*-i+this.d*r,this.a*o+this.c*u+this.e,this.b*o+this.d*u+this.f)},n.prototype.rotateFromVector=function(t){var e=t.unit(),r=e.x,i=e.y;return new n(this.a*r+this.c*i,this.b*r+this.d*i,this.a*-i+this.c*r,this.b*-i+this.d*r,this.e,this.f)},n.prototype.flipX=function(){return new n(-this.a,-this.b,this.c,this.d,this.e,this.f)},n.prototype.flipY=function(){return new n(this.a,this.b,-this.c,-this.d,this.e,this.f)},n.prototype.skewX=function(t){var e=Math.tan(t);return new n(this.a,this.b,this.a*e+this.c,this.b*e+this.d,this.e,this.f)},n.prototype.skewY=function(){var t=Math.tan(angle);return matrix_new(this.a+this.c*t,this.b+this.d*t,this.c,this.d,this.e,this.f)},n.prototype.isIdentity=function(){return 1===this.a&&0===this.b&&0===this.c&&1===this.d&&0===this.e&&0===this.f},n.prototype.isInvertible=function(){this.a*this.d-this.b*this.c!==0},n.prototype.equals=function(t){return this.a===t.a&&this.b===t.b&&this.c===t.c&&this.d===t.d&&this.e===t.e&&this.f===t.f},n.prototype.getScale=function(){return{scaleX:Math.sqrt(this.a*this.a+this.c*this.c),scaleY:Math.sqrt(this.b*this.b+this.d*this.d)}},n.prototype.toString=function(){return"matrix("+this.a+","+this.b+","+this.c+","+this.d+","+this.e+","+this.f+")"},t.exports=n},function(t){function n(){this.init(arguments)}n.TOLERANCE=1e-6,n.ACCURACY=15,n.interpolate=function(t,n,e,r,i){if(t.constructor!==Array||n.constructor!==Array)throw new Error("Polynomial.interpolate: xs and ys must be arrays");if(isNaN(e)||isNaN(r)||isNaN(i))throw new Error("Polynomial.interpolate: n, offset, and x must be numbers");for(var o,u=0,a=0,s=new Array(e),c=new Array(e),l=0,f=Math.abs(i-t[r]),y=0;e>y;y++){var h=Math.abs(i-t[r+y]);f>h&&(l=y,f=h),s[y]=c[y]=n[r+y]}u=n[r+l],l--;for(var x=1;e>x;x++){for(var y=0;e-x>y;y++){var p=t[r+y]-i,g=t[r+y+x]-i,d=s[y+1]-c[y],v=p-g;if(0==v){o={y:0,dy:0};break}v=d/v,c[y]=g*v,s[y]=p*v}a=e-x>2*(l+1)?s[l+1]:c[l--],u+=a}return{y:u,dy:a}},n.prototype.init=function(t){this.coefs=new Array;for(var n=t.length-1;n>=0;n--)this.coefs.push(t[n]);this._variable="t",this._s=0},n.prototype.eval=function(t){if(isNaN(t))throw new Error("Polynomial.eval: parameter must be a number");for(var n=0,e=this.coefs.length-1;e>=0;e--)n=n*t+this.coefs[e];return n},n.prototype.add=function(t){for(var e=new n,r=this.getDegree(),i=t.getDegree(),o=Math.max(r,i),u=0;o>=u;u++){var a=r>=u?this.coefs[u]:0,s=i>=u?t.coefs[u]:0;e.coefs[u]=a+s}return e},n.prototype.multiply=function(t){for(var e=new n,r=0;r<=this.getDegree()+t.getDegree();r++)e.coefs.push(0);for(var r=0;r<=this.getDegree();r++)for(var i=0;i<=t.getDegree();i++)e.coefs[r+i]+=this.coefs[r]*t.coefs[i];return e},n.prototype.divide_scalar=function(t){for(var n=0;n<this.coefs.length;n++)this.coefs[n]/=t},n.prototype.simplify=function(){for(var t=this.getDegree();t>=0&&Math.abs(this.coefs[t])<=n.TOLERANCE;t--)this.coefs.pop()},n.prototype.bisection=function(t,e){var r,i=this.eval(t),o=this.eval(e);if(Math.abs(i)<=n.TOLERANCE)r=t;else if(Math.abs(o)<=n.TOLERANCE)r=e;else if(0>=i*o)for(var u=Math.log(e-t),a=Math.LN10*n.ACCURACY,s=Math.ceil((u+a)/Math.LN2),c=0;s>c;c++){r=.5*(t+e);var l=this.eval(r);if(Math.abs(l)<=n.TOLERANCE)break;0>l*i?(e=r,o=l):(t=r,i=l)}return r},n.prototype.toString=function(){for(var t=new Array,n=new Array,e=this.coefs.length-1;e>=0;e--){var r=Math.round(1e3*this.coefs[e])/1e3;if(0!=r){var i=0>r?" - ":" + ";r=Math.abs(r),e>0&&(1==r?r=this._variable:r+=this._variable),e>1&&(r+="^"+e),n.push(i),t.push(r)}}n[0]=" + "==n[0]?"":"-";for(var o="",e=0;e<t.length;e++)o+=n[e]+t[e];return o},n.prototype.trapezoid=function(t,n,e){if(isNaN(t)||isNaN(n)||isNaN(e))throw new Error("Polynomial.trapezoid: parameters must be numbers");var r=n-t;if(1==e){var i=this.eval(t),o=this.eval(n);this._s=.5*r*(i+o)}else{for(var u=1<<e-2,a=r/u,s=t+.5*a,c=0,l=0;u>l;l++)c+=this.eval(s),s+=a;this._s=.5*(this._s+r*c/u)}if(isNaN(this._s))throw new Error("Polynomial.trapezoid: this._s is NaN");return this._s},n.prototype.simpson=function(t,n){if(isNaN(t)||isNaN(n))throw new Error("Polynomial.simpson: parameters must be numbers");for(var e=n-t,r=.5*e*(this.eval(t)+this.eval(n)),i=r,o=4*r/3,u=o,a=r,s=1e-7,c=1,l=2;20>=l;l++){for(var f=e/c,y=t+.5*f,h=0,x=1;c>=x;x++)h+=this.eval(y),y+=f;if(i=.5*(i+e*h/c),r=i,o=(4*r-a)/3,Math.abs(o-u)<s*Math.abs(u))break;u=o,a=r,c<<=1}return o},n.prototype.romberg=function(t,e){if(isNaN(t)||isNaN(e))throw new Error("Polynomial.romberg: parameters must be numbers");var r=20,i=3,o=1e-6,u=new Array(r+1),a=new Array(r+1),s={y:0,dy:0};a[0]=1;for(var c=1;r>=c&&(u[c-1]=this.trapezoid(t,e,c),!(c>=i&&(s=n.interpolate(a,u,i,c-i,0),Math.abs(s.dy)<=o*s.y)));c++)u[c]=u[c-1],a[c]=.25*a[c-1];return s.y},n.prototype.getDegree=function(){return this.coefs.length-1},n.prototype.getDerivative=function(){for(var t=new n,e=1;e<this.coefs.length;e++)t.coefs.push(e*this.coefs[e]);return t},n.prototype.getRoots=function(){var t;switch(this.simplify(),this.getDegree()){case 0:t=new Array;break;case 1:t=this.getLinearRoot();break;case 2:t=this.getQuadraticRoots();break;case 3:t=this.getCubicRoots();break;case 4:t=this.getQuarticRoots();break;default:t=new Array}return t},n.prototype.getRootsInInterval=function(t,n){var e,r=new Array;if(1==this.getDegree())e=this.bisection(t,n),null!=e&&r.push(e);else{var o=this.getDerivative(),u=o.getRootsInInterval(t,n);if(u.length>0){for(e=this.bisection(t,u[0]),null!=e&&r.push(e),i=0;i<=u.length-2;i++)e=this.bisection(u[i],u[i+1]),null!=e&&r.push(e);e=this.bisection(u[u.length-1],n),null!=e&&r.push(e)}else e=this.bisection(t,n),null!=e&&r.push(e)}return r},n.prototype.getLinearRoot=function(){var t=new Array,n=this.coefs[1];return 0!=n&&t.push(-this.coefs[0]/n),t},n.prototype.getQuadraticRoots=function(){var t=new Array;if(2==this.getDegree()){var n=this.coefs[2],e=this.coefs[1]/n,r=this.coefs[0]/n,i=e*e-4*r;if(i>0){var o=Math.sqrt(i);t.push(.5*(-e+o)),t.push(.5*(-e-o))}else 0==i&&t.push(.5*-e)}return t},n.prototype.getCubicRoots=function(){var t=new Array;if(3==this.getDegree()){var e=this.coefs[3],r=this.coefs[2]/e,i=this.coefs[1]/e,o=this.coefs[0]/e,u=(3*i-r*r)/3,a=(2*r*r*r-9*i*r+27*o)/27,s=r/3,c=a*a/4+u*u*u/27,l=a/2;if(Math.abs(c)<=n.TOLERANCE&&(c=0),c>0){var f,y,h=Math.sqrt(c);f=-l+h,y=f>=0?Math.pow(f,1/3):-Math.pow(-f,1/3),f=-l-h,f>=0?y+=Math.pow(f,1/3):y-=Math.pow(-f,1/3),t.push(y-s)}else if(0>c){var x=Math.sqrt(-u/3),p=Math.atan2(Math.sqrt(-c),-l)/3,g=Math.cos(p),d=Math.sin(p),v=Math.sqrt(3);t.push(2*x*g-s),t.push(-x*(g+v*d)-s),t.push(-x*(g-v*d)-s)}else{var f;f=l>=0?-Math.pow(l,1/3):Math.pow(-l,1/3),t.push(2*f-s),t.push(-f-s)}}return t},n.prototype.getQuarticRoots=function(){var t=new Array;if(4==this.getDegree()){var e=this.coefs[4],r=this.coefs[3]/e,i=this.coefs[2]/e,o=this.coefs[1]/e,u=this.coefs[0]/e,a=new n(1,-i,r*o-4*u,-r*r*u+4*i*u-o*o).getCubicRoots(),s=a[0],c=r*r/4-i+s;if(Math.abs(c)<=n.TOLERANCE&&(c=0),c>0){var l=Math.sqrt(c),f=3*r*r/4-l*l-2*i,y=(4*r*i-8*o-r*r*r)/(4*l),h=f+y,x=f-y;if(Math.abs(h)<=n.TOLERANCE&&(h=0),Math.abs(x)<=n.TOLERANCE&&(x=0),h>=0){var p=Math.sqrt(h);t.push(-r/4+(l+p)/2),t.push(-r/4+(l-p)/2)}if(x>=0){var p=Math.sqrt(x);t.push(-r/4+(p-l)/2),t.push(-r/4-(p+l)/2)}}else if(0>c);else{var y=s*s-4*u;if(y>=-n.TOLERANCE){if(0>y&&(y=0),y=2*Math.sqrt(y),f=3*r*r/4-2*i,f+y>=n.TOLERANCE){var g=Math.sqrt(f+y);t.push(-r/4+g/2),t.push(-r/4-g/2)}if(f-y>=n.TOLERANCE){var g=Math.sqrt(f-y);t.push(-r/4+g/2),t.push(-r/4-g/2)}}}}return t},t.exports=n},function(t,n,e){function r(){this.init(arguments)}var i=e(13);r.VERSION=1,r.prototype=new i,r.prototype.constructor=r,r.superclass=i.prototype,r.prototype.eval=function(t){var n=1e-7,e=r.superclass.eval.call(this,t);if(Math.abs(e)<n&&(e=0),0>e)throw new Error("SqrtPolynomial.eval: cannot take square root of negative number");return Math.sqrt(e)},r.prototype.toString=function(){var t=r.superclass.toString.call(this);return"sqrt("+t+")"},t.exports=r}]);
<!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