// https://d3js.org v5.16.0 Copyright 2022 Mike Bostock !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).d3=t.d3||{})}(this,(function(t){"use strict";function n(t,n){return tn?1:t>=n?0:NaN}var e,r,i=(1===(e=n).length&&(r=e,e=function(t,e){return n(r(t),e)}),{left:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)<0?r=o+1:i=o}return r},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)>0?i=o:r=o+1}return r}}).right;function o(t){return null===t?NaN:+t}function u(t,n){var e,r,i,o=t.length,u=-1;if(null==n){for(;++u=e)for(r=i=e;++ue&&(r=e),i=e)for(r=i=e;++ue&&(r=e),i=0?(o>=h?10:o>=f?5:o>=p?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=h?10:o>=f?5:o>=p?2:1)}function y(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=h?i*=10:o>=f?i*=5:o>=p&&(i*=2),n=e)for(r=e;++oe&&(r=e)}else for(;++o=e)for(r=e;++oe&&(r=e);return r}function m(t){return t.length}var _=Array.prototype.slice;function w(t){return t}function x(t){return"translate("+(t+.5)+",0)"}function M(t){return"translate(0,"+(t+.5)+")"}function b(t){return function(n){return+t(n)}}function T(t){var n=Math.max(0,t.bandwidth()-1)/2;return t.round()&&(n=Math.round(n)),function(e){return+t(e)+n}}function k(){return!this.__axis}function N(t,n){var e=[],r=null,i=null,o=6,u=6,a=3,s=1===t||4===t?-1:1,c=4===t||2===t?"x":"y",l=1===t||3===t?x:M;function h(h){var f=null==r?n.ticks?n.ticks.apply(n,e):n.domain():r,p=null==i?n.tickFormat?n.tickFormat.apply(n,e):w:i,v=Math.max(o,0)+a,y=n.range(),g=+y[0]+.5,d=+y[y.length-1]+.5,m=(n.bandwidth?T:b)(n.copy()),_=h.selection?h.selection():h,x=_.selectAll(".domain").data([null]),M=_.selectAll(".tick").data(f,n).order(),N=M.exit(),A=M.enter().append("g").attr("class","tick"),C=M.select("line"),z=M.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(A),C=C.merge(A.append("line").attr("stroke","currentColor").attr(c+"2",s*o)),z=z.merge(A.append("text").attr("fill","currentColor").attr(c,s*v).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),h!==_&&(x=x.transition(h),M=M.transition(h),C=C.transition(h),z=z.transition(h),N=N.transition(h).attr("opacity",1e-6).attr("transform",(function(t){return isFinite(t=m(t))?l(t):this.getAttribute("transform")})),A.attr("opacity",1e-6).attr("transform",(function(t){var n=this.parentNode.__axis;return l(n&&isFinite(n=n(t))?n:m(t))}))),N.remove(),x.attr("d",4===t||2==t?u?"M"+s*u+","+g+"H0.5V"+d+"H"+s*u:"M0.5,"+g+"V"+d:u?"M"+g+","+s*u+"V0.5H"+d+"V"+s*u:"M"+g+",0.5H"+d),M.attr("opacity",1).attr("transform",(function(t){return l(m(t))})),C.attr(c+"2",s*o),z.attr(c,s*v).text(p),_.filter(k).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),_.each((function(){this.__axis=m}))}return h.scale=function(t){return arguments.length?(n=t,h):n},h.ticks=function(){return e=_.call(arguments),h},h.tickArguments=function(t){return arguments.length?(e=null==t?[]:_.call(t),h):e.slice()},h.tickValues=function(t){return arguments.length?(r=null==t?null:_.call(t),h):r&&r.slice()},h.tickFormat=function(t){return arguments.length?(i=t,h):i},h.tickSize=function(t){return arguments.length?(o=u=+t,h):o},h.tickSizeInner=function(t){return arguments.length?(o=+t,h):o},h.tickSizeOuter=function(t){return arguments.length?(u=+t,h):u},h.tickPadding=function(t){return arguments.length?(a=+t,h):a},h}var A={value:function(){}};function C(){for(var t,n=0,e=arguments.length,r={};n=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function D(t,n){for(var e,r=0,i=t.length;r0)for(var e,r,i=new Array(e),o=0;o=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),Y.hasOwnProperty(n)?{space:Y[n],local:t}:t}function P(t){return function(){var n=this.ownerDocument,e=this.namespaceURI;return e===E&&n.documentElement.namespaceURI===E?n.createElement(t):n.createElementNS(e,t)}}function F(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function H(t){var n=q(t);return(n.local?F:P)(n)}function L(){}function V(t){return null==t?L:function(){return this.querySelector(t)}}function X(){return[]}function I(t){return null==t?X:function(){return this.querySelectorAll(t)}}function j(t){return function(){return this.matches(t)}}function O(t){return new Array(t.length)}function $(t,n){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=n}$.prototype={constructor:$,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,n){return this._parent.insertBefore(t,n)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function R(t,n,e,r,i,o){for(var u,a=0,s=n.length,c=o.length;an?1:t>=n?0:NaN}function W(t){return function(){this.removeAttribute(t)}}function G(t){return function(){this.removeAttributeNS(t.space,t.local)}}function K(t,n){return function(){this.setAttribute(t,n)}}function Q(t,n){return function(){this.setAttributeNS(t.space,t.local,n)}}function J(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttribute(t):this.setAttribute(t,e)}}function tt(t,n){return function(){var e=n.apply(this,arguments);null==e?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,e)}}function nt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function et(t){return function(){this.style.removeProperty(t)}}function rt(t,n,e){return function(){this.style.setProperty(t,n,e)}}function it(t,n,e){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,e)}}function ot(t,n){return t.style.getPropertyValue(n)||nt(t).getComputedStyle(t,null).getPropertyValue(n)}function ut(t){return function(){delete this[t]}}function at(t,n){return function(){this[t]=n}}function st(t,n){return function(){var e=n.apply(this,arguments);null==e?delete this[t]:this[t]=e}}function ct(t){return t.trim().split(/^|\s+/)}function lt(t){return t.classList||new ht(t)}function ht(t){this._node=t,this._names=ct(t.getAttribute("class")||"")}function ft(t,n){for(var e=lt(t),r=-1,i=n.length;++r=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var zt={};(t.event=null,"undefined"!=typeof document)&&("onmouseenter"in document.documentElement||(zt={mouseenter:"mouseover",mouseleave:"mouseout"}));function St(t,n,e){return t=Dt(t,n,e),function(n){var e=n.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||t.call(this,n)}}function Dt(n,e,r){return function(i){var o=t.event;t.event=i;try{n.call(this,this.__data__,e,r)}finally{t.event=o}}}function Ut(t){return t.trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");return e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),{type:t,name:n}}))}function Et(t){return function(){var n=this.__on;if(n){for(var e,r=0,i=-1,o=n.length;r=w&&(w=_+1);!(m=g[w])&&++w=0;)(r=i[o])&&(u&&4^r.compareDocumentPosition(u)&&u.parentNode.insertBefore(r,u),u=r);return this},sort:function(t){function n(n,e){return n&&e?t(n.__data__,e.__data__):!n-!e}t||(t=Z);for(var e=this._groups,r=e.length,i=new Array(r),o=0;o1?this.each((null==n?et:"function"==typeof n?it:rt)(t,n,null==e?"":e)):ot(this.node(),t)},property:function(t,n){return arguments.length>1?this.each((null==n?ut:"function"==typeof n?st:at)(t,n)):this.node()[t]},classed:function(t,n){var e=ct(t+"");if(arguments.length<2){for(var r=lt(this.node()),i=-1,o=e.length;++i>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Mn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Mn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=hn.exec(t))?new kn(n[1],n[2],n[3],1):(n=fn.exec(t))?new kn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=pn.exec(t))?Mn(n[1],n[2],n[3],n[4]):(n=vn.exec(t))?Mn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=yn.exec(t))?zn(n[1],n[2]/100,n[3]/100,1):(n=gn.exec(t))?zn(n[1],n[2]/100,n[3]/100,n[4]):dn.hasOwnProperty(t)?xn(dn[t]):"transparent"===t?new kn(NaN,NaN,NaN,0):null}function xn(t){return new kn(t>>16&255,t>>8&255,255&t,1)}function Mn(t,n,e,r){return r<=0&&(t=n=e=NaN),new kn(t,n,e,r)}function bn(t){return t instanceof un||(t=wn(t)),t?new kn((t=t.rgb()).r,t.g,t.b,t.opacity):new kn}function Tn(t,n,e,r){return 1===arguments.length?bn(t):new kn(t,n,e,null==r?1:r)}function kn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Nn(){return"#"+Cn(this.r)+Cn(this.g)+Cn(this.b)}function An(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Cn(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function zn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Un(t,n,e,r)}function Sn(t){if(t instanceof Un)return new Un(t.h,t.s,t.l,t.opacity);if(t instanceof un||(t=wn(t)),!t)return new Un;if(t instanceof Un)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),u=NaN,a=o-i,s=(o+i)/2;return a?(u=n===o?(e-r)/a+6*(e0&&s<1?0:u,new Un(u,a,s,t.opacity)}function Dn(t,n,e,r){return 1===arguments.length?Sn(t):new Un(t,n,e,null==r?1:r)}function Un(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function En(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}rn(un,wn,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:mn,formatHex:mn,formatHsl:function(){return Sn(this).formatHsl()},formatRgb:_n,toString:_n}),rn(kn,Tn,on(un,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new kn(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new kn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Nn,formatHex:Nn,formatRgb:An,toString:An})),rn(Un,Dn,on(un,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Un(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Un(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new kn(En(t>=240?t-240:t+120,i,r),En(t,i,r),En(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var Yn=Math.PI/180,qn=180/Math.PI,Pn=6/29,Fn=3*Pn*Pn;function Hn(t){if(t instanceof Ln)return new Ln(t.l,t.a,t.b,t.opacity);if(t instanceof $n)return Rn(t);t instanceof kn||(t=bn(t));var n,e,r=jn(t.r),i=jn(t.g),o=jn(t.b),u=Vn((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=u:(n=Vn((.4360747*r+.3850649*i+.1430804*o)/.96422),e=Vn((.0139322*r+.0971045*i+.7141733*o)/.82521)),new Ln(116*u-16,500*(n-u),200*(u-e),t.opacity)}function Ln(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function Vn(t){return t>.008856451679035631?Math.pow(t,1/3):t/Fn+4/29}function Xn(t){return t>Pn?t*t*t:Fn*(t-4/29)}function In(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function jn(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function On(t){if(t instanceof $n)return new $n(t.h,t.c,t.l,t.opacity);if(t instanceof Ln||(t=Hn(t)),0===t.a&&0===t.b)return new $n(NaN,0o&&(i=n.slice(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:le(e,r)})),o=pe.lastIndex;return o180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:le(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,u.rotate,a,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:le(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,u.skewX,a,s),function(t,n,e,r,o,u){if(t!==e||n!==r){var a=o.push(i(o)+"scale(",null,",",null,")");u.push({i:a-4,x:le(t,e)},{i:a-2,x:le(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,u.scaleX,u.scaleY,a,s),o=u=null,function(t){for(var n,e=-1,r=s.length;++e=0&&n._call.call(null,t),n=n._next;--Ue}()}finally{Ue=0,function(){var t,n,e=Se,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Se=n);De=t,Re(r)}(),Pe=0}}function $e(){var t=He.now(),n=t-qe;n>1e3&&(Fe-=n,qe=t)}function Re(t){Ue||(Ee&&(Ee=clearTimeout(Ee)),t-Pe>24?(t<1/0&&(Ee=setTimeout(Oe,t-He.now()-Fe)),Ye&&(Ye=clearInterval(Ye))):(Ye||(qe=He.now(),Ye=setInterval($e,1e3)),Ue=1,Le(Oe)))}function Be(t,n,e){var r=new Ie;return n=null==n?0:+n,r.restart((function(e){r.stop(),t(e+n)}),n,e),r}Ie.prototype=je.prototype={constructor:Ie,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Ve():+e)+(null==n?0:+n),this._next||De===this||(De?De._next=this:Se=this,De=this),this._call=t,this._time=e,Re()},stop:function(){this._call&&(this._call=null,this._time=1/0,Re())}};var Ze=C("start","end","cancel","interrupt"),We=[];function Ge(t,n,e,r,i,o){var u=t.__transition;if(u){if(e in u)return}else t.__transition={};!function(t,n,e){var r,i=t.__transition;function o(s){var c,l,h,f;if(1!==e.state)return a();for(c in i)if((f=i[c]).name===e.name){if(3===f.state)return Be(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c0)throw new Error("too late; already scheduled");return e}function Qe(t,n){var e=Je(t,n);if(e.state>3)throw new Error("too late; already running");return e}function Je(t,n){var e=t.__transition;if(!e||!(e=e[n]))throw new Error("transition not found");return e}function tr(t,n){var e,r,i,o=t.__transition,u=!0;if(o){for(i in n=null==n?null:n+"",o)(e=o[i]).name===n?(r=e.state>2&&e.state<5,e.state=6,e.timer.stop(),e.on.call(r?"interrupt":"cancel",t,t.__data__,e.index,e.group),delete o[i]):u=!1;u&&delete t.__transition}}function nr(t,n){var e,r;return function(){var i=Qe(this,t),o=i.tween;if(o!==e)for(var u=0,a=(r=e=o).length;u=0&&(t=t.slice(0,n)),!t||"start"===t}))}(n)?Ke:Qe;return function(){var u=o(this,t),a=u.on;a!==r&&(i=(r=a).copy()).on(n,e),u.on=i}}var xr=Xt.prototype.constructor;function Mr(t){return function(){this.style.removeProperty(t)}}function br(t,n,e){return function(r){this.style.setProperty(t,n.call(this,r),e)}}function Tr(t,n,e){var r,i;function o(){var o=n.apply(this,arguments);return o!==i&&(r=(i=o)&&br(t,o,e)),r}return o._value=n,o}function kr(t){return function(n){this.textContent=t.call(this,n)}}function Nr(t){var n,e;function r(){var r=t.apply(this,arguments);return r!==e&&(n=(e=r)&&kr(r)),n}return r._value=t,r}var Ar=0;function Cr(t,n,e,r){this._groups=t,this._parents=n,this._name=e,this._id=r}function zr(){return++Ar}var Sr=Xt.prototype;Cr.prototype=function(t){return Xt().transition(t)}.prototype={constructor:Cr,select:function(t){var n=this._name,e=this._id;"function"!=typeof t&&(t=V(t));for(var r=this._groups,i=r.length,o=new Array(i),u=0;uMath.abs(t[1]-q[1])?d=!0:g=!0),q=t,y=!0,Pr(),X()}function X(){var t;switch(S=q[0]-Y[0],D=q[1]-Y[1],w){case Hr:case Fr:x&&(S=Math.max(N-r,Math.min(C-c,S)),o=r+S,f=c+S),M&&(D=Math.max(A-a,Math.min(z-p,D)),s=a+D,v=p+D);break;case Lr:x<0?(S=Math.max(N-r,Math.min(C-r,S)),o=r+S,f=c):x>0&&(S=Math.max(N-c,Math.min(C-c,S)),o=r,f=c+S),M<0?(D=Math.max(A-a,Math.min(z-a,D)),s=a+D,v=p):M>0&&(D=Math.max(A-p,Math.min(z-p,D)),s=a,v=p+D);break;case Vr:x&&(o=Math.max(N,Math.min(C,r-S*x)),f=Math.max(N,Math.min(C,c+S*x))),M&&(s=Math.max(A,Math.min(z,a-D*M)),v=Math.max(A,Math.min(z,p+D*M)))}f0&&(r=o-S),M<0?p=v-D:M>0&&(a=s-D),w=Hr,H.attr("cursor",Br.selection),X());break;default:return}Pr()}function O(){switch(t.event.keyCode){case 16:U&&(g=d=U=!1,X());break;case 18:w===Vr&&(x<0?c=f:x>0&&(r=o),M<0?p=v:M>0&&(a=s),w=Lr,X());break;case 32:w===Hr&&(t.event.altKey?(x&&(c=f-S*x,r=o+S*x),M&&(p=v-D*M,a=s+D*M),w=Vr):(x<0?c=f:x>0&&(r=o),M<0?p=v:M>0&&(a=s),w=Lr),H.attr("cursor",Br[_]),X());break;default:return}Pr()}}function v(){h(this,arguments).moved()}function y(){h(this,arguments).ended()}function g(){var t=this.__brush||{selection:null};return t.extent=Ir(r.apply(this,arguments)),t.dim=n,t}return c.move=function(t,e){t.selection?t.on("start.brush",(function(){h(this,arguments).beforestart().start()})).on("interrupt.brush end.brush",(function(){h(this,arguments).end()})).tween("brush",(function(){var t=this,r=t.__brush,i=h(t,arguments),o=r.selection,u=n.input("function"==typeof e?e.apply(this,arguments):e,r.extent),a=ye(o,u);function s(n){r.selection=1===n&&null===u?null:a(n),l.call(t),i.brush()}return null!==o&&null!==u?s:s(1)})):t.each((function(){var t=this,r=arguments,i=t.__brush,o=n.input("function"==typeof e?e.apply(t,r):e,i.extent),u=h(t,r).beforestart();tr(t),i.selection=null===o?null:o,l.call(t),u.start().brush().end()}))},c.clear=function(t){c.move(t,null)},f.prototype={beforestart:function(){return 1==++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(){return this.starting?(this.starting=!1,this.emit("start")):this.emit("brush"),this},brush:function(){return this.emit("brush"),this},end:function(){return 0==--this.active&&(delete this.state.emitter,this.emit("end")),this},emit:function(t){qt(new Yr(c,t,n.output(this.state.selection)),a.apply,a,[t,this.that,this.args])}},c.extent=function(t){return arguments.length?(r="function"==typeof t?t:Er(Ir(t)),c):r},c.filter=function(t){return arguments.length?(i="function"==typeof t?t:Er(!!t),c):i},c.touchable=function(t){return arguments.length?(o="function"==typeof t?t:Er(!!t),c):o},c.handleSize=function(t){return arguments.length?(s=+t,c):s},c.keyModifiers=function(t){return arguments.length?(u=!!t,c):u},c.on=function(){var t=a.on.apply(a,arguments);return t===a?c:t},c}function oi(){}function ui(t,n){var e=new oi;if(t instanceof oi)t.each((function(t,n){e.set(n,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==n)for(;++i=(o=(y+d)/2))?y=o:d=o,(l=e>=(u=(g+m)/2))?g=u:m=u,i=p,!(p=p[h=l<<1|c]))return i[h]=v,t;if(a=+t._x.call(null,p.data),s=+t._y.call(null,p.data),n===a&&e===s)return v.next=p,i?i[h]=v:t._root=v,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=n>=(o=(y+d)/2))?y=o:d=o,(l=e>=(u=(g+m)/2))?g=u:m=u}while((h=l<<1|c)==(f=(s>=u)<<1|a>=o));return i[f]=p,i[h]=v,t}function pi(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function vi(t){return t[0]}function yi(t){return t[1]}function gi(t,n,e){var r=new di(null==n?vi:n,null==e?yi:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function di(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function mi(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}ai.prototype=ci.prototype={constructor:ai,has:si.has,add:function(t){return this["$"+(t+="")]=t,this},remove:si.remove,clear:si.clear,values:si.keys,size:si.size,empty:si.empty,each:si.each};var _i=gi.prototype=di.prototype;function wi(t){return t.index}function xi(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}function Mi(t){return t.x}function bi(t){return t.y}_i.copy=function(){var t,n,e=new di(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=mi(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=mi(n));return e},_i.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return fi(this.cover(n,e),n,e,t)},_i.addAll=function(t){var n,e,r,i,o=t.length,u=new Array(o),a=new Array(o),s=1/0,c=1/0,l=-1/0,h=-1/0;for(e=0;el&&(l=r),ih&&(h=i));if(s>l||c>h)return this;for(this.cover(s,c).cover(l,h),e=0;et||t>=i||r>n||n>=o;)switch(a=(nf||(o=s.y0)>p||(u=s.x1)=d)<<1|t>=g)&&(s=v[v.length-1],v[v.length-1]=v[v.length-1-c],v[v.length-1-c]=s)}else{var m=t-+this._x.call(null,y.data),_=n-+this._y.call(null,y.data),w=m*m+_*_;if(w=(a=(v+g)/2))?v=a:g=a,(l=u>=(s=(y+d)/2))?y=s:d=s,n=p,!(p=p[h=l<<1|c]))return this;if(!p.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(e=n,f=h)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):n?(i?n[h]=i:delete n[h],(p=n[0]||n[1]||n[2]||n[3])&&p===(n[3]||n[2]||n[1]||n[0])&&!p.length&&(e?e[f]=p:this._root=p),this):(this._root=i,this)},_i.removeAll=function(t){for(var n=0,e=t.length;nr&&(n=e,e=r,r=n),function(t){return Math.max(e,Math.min(r,t))}}function Pi(t,n,e){var r=t[0],i=t[1],o=n[0],u=n[1];return i2?Fi:Pi,i=o=null,h}function h(n){return isNaN(n=+n)?e:(i||(i=r(u.map(t),a,s)))(t(c(n)))}return h.invert=function(e){return c(n((o||(o=r(a,u.map(t),le)))(e)))},h.domain=function(t){return arguments.length?(u=Ai.call(t,Di),c===Ei||(c=qi(u)),l()):u.slice()},h.range=function(t){return arguments.length?(a=Ci.call(t),l()):a.slice()},h.rangeRound=function(t){return a=Ci.call(t),s=ge,l()},h.clamp=function(t){return arguments.length?(c=t?qi(u):Ei,h):c!==Ei},h.interpolate=function(t){return arguments.length?(s=t,l()):s},h.unknown=function(t){return arguments.length?(e=t,h):e},function(e,r){return t=e,n=r,l()}}()(t,n)}function Vi(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Xi(t){return(t=Vi(Math.abs(t)))?t[1]:NaN}var Ii,ji=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Oi(t){if(!(n=ji.exec(t)))throw new Error("invalid format: "+t);var n;return new $i({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function $i(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function Ri(t,n){var e=Vi(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Oi.prototype=$i.prototype,$i.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Bi={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return Ri(100*t,n)},r:Ri,s:function(t,n){var e=Vi(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Ii=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return o===u?r:o>u?r+new Array(o-u+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Vi(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Zi(t){return t}var Wi,Gi,Ki,Qi=Array.prototype.map,Ji=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"];function to(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Zi:(n=Qi.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],u=0,a=n[0],s=0;i>0&&a>0&&(s+a+1>r&&(a=Math.max(1,r-s)),o.push(t.substring(i-=a,i+a)),!((s+=a+1)>r));)a=n[u=(u+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",u=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Zi:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Qi.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"-":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function h(t){var n=(t=Oi(t)).fill,e=t.align,h=t.sign,f=t.symbol,p=t.zero,v=t.width,y=t.comma,g=t.precision,d=t.trim,m=t.type;"n"===m?(y=!0,m="g"):Bi[m]||(void 0===g&&(g=12),d=!0,m="g"),(p||"0"===n&&"="===e)&&(p=!0,n="0",e="=");var _="$"===f?i:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",w="$"===f?o:/[%p]/.test(m)?s:"",x=Bi[m],M=/[defgprs%]/.test(m);function b(t){var i,o,s,f=_,b=w;if("c"===m)b=x(t)+b,t="";else{var T=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),g),d&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),T&&0==+t&&"+"!==h&&(T=!1),f=(T?"("===h?h:c:"-"===h||"("===h?"":h)+f,b=("s"===m?Ji[8+Ii/3]:"")+b+(T&&"("===h?")":""),M)for(i=-1,o=t.length;++i(s=t.charCodeAt(i))||s>57){b=(46===s?u+t.slice(i+1):t.slice(i))+b,t=t.slice(0,i);break}}y&&!p&&(t=r(t,1/0));var k=f.length+t.length+b.length,N=k>1)+f+t+b+N.slice(k);break;default:t=N+f+t+b}return a(t)}return g=void 0===g?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),b.toString=function(){return t+""},b}return{format:h,formatPrefix:function(t,n){var e=h(((t=Oi(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Xi(n)/3))),i=Math.pow(10,-r),o=Ji[8+r/3];return function(t){return e(i*t)+o}}}}function no(t,n,e,r){var i,o=y(t,n,e);switch((r=Oi(null==r?",f":r)).type){case"s":var u=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Xi(n)/3)))-Xi(Math.abs(t)))}(o,u))||(r.precision=i),Ki(r,u);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Xi(n)-Xi(t))+1}(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Xi(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return Gi(r)}function eo(t){var n=t.domain;return t.ticks=function(t){var e=n();return function(t,n,e){var r,i,o,u,a=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n0)for(t=Math.ceil(t/u),n=Math.floor(n/u),o=new Array(i=Math.ceil(n-t+1));++a0?r=v(a=Math.floor(a/r)*r,s=Math.ceil(s/r)*r,e):r<0&&(r=v(a=Math.ceil(a*r)/r,s=Math.floor(s*r)/r,e)),r>0?(i[o]=Math.floor(a/r)*r,i[u]=Math.ceil(s/r)*r,n(i)):r<0&&(i[o]=Math.ceil(a*r)/r,i[u]=Math.floor(s*r)/r,n(i)),t},t}Wi=to({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),Gi=Wi.format,Ki=Wi.formatPrefix;var ro=new Date,io=new Date;function oo(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=function(n){return t(n=new Date(+n)),n},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n0))return a;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(i.count=function(n,r){return ro.setTime(+n),io.setTime(+r),t(ro),t(io),Math.floor(e(ro,io))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var uo=oo((function(){}),(function(t,n){t.setTime(+t+n)}),(function(t,n){return n-t}));uo.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?oo((function(n){n.setTime(Math.floor(n/t)*t)}),(function(n,e){n.setTime(+n+e*t)}),(function(n,e){return(e-n)/t})):uo:null};oo((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,n){t.setTime(+t+1e3*n)}),(function(t,n){return(n-t)/1e3}),(function(t){return t.getUTCSeconds()})),oo((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,n){t.setTime(+t+6e4*n)}),(function(t,n){return(n-t)/6e4}),(function(t){return t.getMinutes()})),oo((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-6e4*t.getMinutes())}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getHours()}));var ao=oo((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5}),(function(t){return t.getDate()-1}));function so(t){return oo((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/6048e5}))}var co=so(0),lo=so(1),ho=(so(2),so(3),so(4)),fo=(so(5),so(6),oo((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()})),oo((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()})));fo.every=function(t){return isFinite(t=Math.floor(t))&&t>0?oo((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};oo((function(t){t.setUTCSeconds(0,0)}),(function(t,n){t.setTime(+t+6e4*n)}),(function(t,n){return(n-t)/6e4}),(function(t){return t.getUTCMinutes()})),oo((function(t){t.setUTCMinutes(0,0,0)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getUTCHours()}));var po=oo((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/864e5}),(function(t){return t.getUTCDate()-1}));function vo(t){return oo((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/6048e5}))}var yo=vo(0),go=vo(1),mo=(vo(2),vo(3),vo(4)),_o=(vo(5),vo(6),oo((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCMonth(t.getUTCMonth()+n)}),(function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()})),oo((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()})));function wo(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function xo(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Mo(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}_o.every=function(t){return isFinite(t=Math.floor(t))&&t>0?oo((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var bo,To,ko,No={"-":"",_:" ",0:"0"},Ao=/^\s*\d+/,Co=/^%/,zo=/[\\^$*+?|[\]().{}]/g;function So(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o68?1900:2e3),e+r[0].length):-1}function Xo(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Io(t,n,e){var r=Ao.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function jo(t,n,e){var r=Ao.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function Oo(t,n,e){var r=Ao.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function $o(t,n,e){var r=Ao.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Ro(t,n,e){var r=Ao.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function Bo(t,n,e){var r=Ao.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Zo(t,n,e){var r=Ao.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Wo(t,n,e){var r=Ao.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Go(t,n,e){var r=Ao.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Ko(t,n,e){var r=Co.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Qo(t,n,e){var r=Ao.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Jo(t,n,e){var r=Ao.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function tu(t,n){return So(t.getDate(),n,2)}function nu(t,n){return So(t.getHours(),n,2)}function eu(t,n){return So(t.getHours()%12||12,n,2)}function ru(t,n){return So(1+ao.count(fo(t),t),n,3)}function iu(t,n){return So(t.getMilliseconds(),n,3)}function ou(t,n){return iu(t,n)+"000"}function uu(t,n){return So(t.getMonth()+1,n,2)}function au(t,n){return So(t.getMinutes(),n,2)}function su(t,n){return So(t.getSeconds(),n,2)}function cu(t){var n=t.getDay();return 0===n?7:n}function lu(t,n){return So(co.count(fo(t)-1,t),n,2)}function hu(t){var n=t.getDay();return n>=4||0===n?ho(t):ho.ceil(t)}function fu(t,n){return t=hu(t),So(ho.count(fo(t),t)+(4===fo(t).getDay()),n,2)}function pu(t){return t.getDay()}function vu(t,n){return So(lo.count(fo(t)-1,t),n,2)}function yu(t,n){return So(t.getFullYear()%100,n,2)}function gu(t,n){return So((t=hu(t)).getFullYear()%100,n,2)}function du(t,n){return So(t.getFullYear()%1e4,n,4)}function mu(t,n){var e=t.getDay();return So((t=e>=4||0===e?ho(t):ho.ceil(t)).getFullYear()%1e4,n,4)}function _u(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+So(n/60|0,"0",2)+So(n%60,"0",2)}function wu(t,n){return So(t.getUTCDate(),n,2)}function xu(t,n){return So(t.getUTCHours(),n,2)}function Mu(t,n){return So(t.getUTCHours()%12||12,n,2)}function bu(t,n){return So(1+po.count(_o(t),t),n,3)}function Tu(t,n){return So(t.getUTCMilliseconds(),n,3)}function ku(t,n){return Tu(t,n)+"000"}function Nu(t,n){return So(t.getUTCMonth()+1,n,2)}function Au(t,n){return So(t.getUTCMinutes(),n,2)}function Cu(t,n){return So(t.getUTCSeconds(),n,2)}function zu(t){var n=t.getUTCDay();return 0===n?7:n}function Su(t,n){return So(yo.count(_o(t)-1,t),n,2)}function Du(t){var n=t.getUTCDay();return n>=4||0===n?mo(t):mo.ceil(t)}function Uu(t,n){return t=Du(t),So(mo.count(_o(t),t)+(4===_o(t).getUTCDay()),n,2)}function Eu(t){return t.getUTCDay()}function Yu(t,n){return So(go.count(_o(t)-1,t),n,2)}function qu(t,n){return So(t.getUTCFullYear()%100,n,2)}function Pu(t,n){return So((t=Du(t)).getUTCFullYear()%100,n,2)}function Fu(t,n){return So(t.getUTCFullYear()%1e4,n,4)}function Hu(t,n){var e=t.getUTCDay();return So((t=e>=4||0===e?mo(t):mo.ceil(t)).getUTCFullYear()%1e4,n,4)}function Lu(){return"+0000"}function Vu(){return"%"}function Xu(t){return+t}function Iu(t){return Math.floor(+t/1e3)}!function(t){bo=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,u=t.shortDays,a=t.months,s=t.shortMonths,c=Uo(i),l=Eo(i),h=Uo(o),f=Eo(o),p=Uo(u),v=Eo(u),y=Uo(a),g=Eo(a),d=Uo(s),m=Eo(s),_={a:function(t){return u[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:tu,e:tu,f:ou,g:gu,G:mu,H:nu,I:eu,j:ru,L:iu,m:uu,M:au,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Xu,s:Iu,S:su,u:cu,U:lu,V:fu,w:pu,W:vu,x:null,X:null,y:yu,Y:du,Z:_u,"%":Vu},w={a:function(t){return u[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:wu,e:wu,f:ku,g:Pu,G:Hu,H:xu,I:Mu,j:bu,L:Tu,m:Nu,M:Au,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Xu,s:Iu,S:Cu,u:zu,U:Su,V:Uu,w:Eu,W:Yu,x:null,X:null,y:qu,Y:Fu,Z:Lu,"%":Vu},x={a:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.w=v[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.w=f[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.m=m[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=y.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return T(t,n,e,r)},d:Oo,e:Oo,f:Go,g:Vo,G:Lo,H:Ro,I:Ro,j:$o,L:Wo,m:jo,M:Bo,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=l[r[0].toLowerCase()],e+r[0].length):-1},q:Io,Q:Qo,s:Jo,S:Zo,u:qo,U:Po,V:Fo,w:Yo,W:Ho,x:function(t,n,r){return T(t,e,n,r)},X:function(t,n,e){return T(t,r,n,e)},y:Vo,Y:Lo,Z:Xo,"%":Ko};function M(t,n){return function(e){var r,i,o,u=[],a=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++a53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=xo(Mo(o.y,0,1))).getUTCDay(),r=i>4||0===i?go.ceil(r):go(r),r=po.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=wo(Mo(o.y,0,1))).getDay(),r=i>4||0===i?lo.ceil(r):lo(r),r=ao.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?xo(Mo(o.y,0,1)).getUTCDay():wo(Mo(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,xo(o)):wo(o)}}function T(t,n,e,r){for(var i,o,u=0,a=n.length,s=e.length;u=s)return-1;if(37===(i=n.charCodeAt(u++))){if(i=n.charAt(u++),!(o=x[i in No?n.charAt(u++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return _.x=M(e,_),_.X=M(r,_),_.c=M(n,_),w.x=M(e,w),w.X=M(r,w),w.c=M(n,w),{format:function(t){var n=M(t+="",_);return n.toString=function(){return t},n},parse:function(t){var n=b(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=M(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=b(t+="",!0);return n.toString=function(){return t},n}}}(t),bo.format,bo.parse,To=bo.utcFormat,ko=bo.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Date.prototype.toISOString||To("%Y-%m-%dT%H:%M:%S.%LZ");+new Date("2000-01-01T00:00:00.000Z")||ko("%Y-%m-%dT%H:%M:%S.%LZ");var ju=Math.PI,Ou=2*ju,$u=Ou-1e-6;function Ru(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Bu(){return new Ru}function Zu(t){return function(){return t}}Ru.prototype=Bu.prototype={constructor:Ru,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,o){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+o)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var o=this._x1,u=this._y1,a=e-t,s=r-n,c=o-t,l=u-n,h=c*c+l*l;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(h>1e-6)if(Math.abs(l*a-s*c)>1e-6&&i){var f=e-o,p=r-u,v=a*a+s*s,y=f*f+p*p,g=Math.sqrt(v),d=Math.sqrt(h),m=i*Math.tan((ju-Math.acos((v+h-y)/(2*g*d)))/2),_=m/d,w=m/g;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*c)+","+(n+_*l)),this._+="A"+i+","+i+",0,0,"+ +(l*f>c*p)+","+(this._x1=t+w*a)+","+(this._y1=n+w*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,o){t=+t,n=+n,o=!!o;var u=(e=+e)*Math.cos(r),a=e*Math.sin(r),s=t+u,c=n+a,l=1^o,h=o?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+c:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-c)>1e-6)&&(this._+="L"+s+","+c),e&&(h<0&&(h=h%Ou+Ou),h>$u?this._+="A"+e+","+e+",0,1,"+l+","+(t-u)+","+(n-a)+"A"+e+","+e+",0,1,"+l+","+(this._x1=s)+","+(this._y1=c):h>1e-6&&(this._+="A"+e+","+e+",0,"+ +(h>=ju)+","+l+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Wu=Math.abs,Gu=Math.atan2,Ku=Math.cos,Qu=Math.max,Ju=Math.min,ta=Math.sin,na=Math.sqrt,ea=Math.PI,ra=ea/2,ia=2*ea;function oa(t){return t>1?0:t<-1?ea:Math.acos(t)}function ua(t){return t>=1?ra:t<=-1?-ra:Math.asin(t)}function aa(t){return t.innerRadius}function sa(t){return t.outerRadius}function ca(t){return t.startAngle}function la(t){return t.endAngle}function ha(t){return t&&t.padAngle}function fa(t,n,e,r,i,o,u,a){var s=e-t,c=r-n,l=u-i,h=a-o,f=h*s-l*c;if(!(f*f<1e-12))return[t+(f=(l*(n-o)-h*(t-i))/f)*s,n+f*c]}function pa(t,n,e,r,i,o,u){var a=t-e,s=n-r,c=(u?o:-o)/na(a*a+s*s),l=c*s,h=-c*a,f=t+l,p=n+h,v=e+l,y=r+h,g=(f+v)/2,d=(p+y)/2,m=v-f,_=y-p,w=m*m+_*_,x=i-o,M=f*y-v*p,b=(_<0?-1:1)*na(Qu(0,x*x*w-M*M)),T=(M*_-m*b)/w,k=(-M*m-_*b)/w,N=(M*_+m*b)/w,A=(-M*m+_*b)/w,C=T-g,z=k-d,S=N-g,D=A-d;return C*C+z*z>S*S+D*D&&(T=N,k=A),{cx:T,cy:k,x01:-l,y01:-h,x11:T*(i/x-1),y11:k*(i/x-1)}}function va(t,n){return nt?1:n>=t?0:NaN}function ya(t){return t}var ga={draw:function(t,n){var e=Math.sqrt(n/ea);t.moveTo(e,0),t.arc(0,0,e,0,ia)}},da={draw:function(t,n){var e=Math.sqrt(n/5)/2;t.moveTo(-3*e,-e),t.lineTo(-e,-e),t.lineTo(-e,-3*e),t.lineTo(e,-3*e),t.lineTo(e,-e),t.lineTo(3*e,-e),t.lineTo(3*e,e),t.lineTo(e,e),t.lineTo(e,3*e),t.lineTo(-e,3*e),t.lineTo(-e,e),t.lineTo(-3*e,e),t.closePath()}},ma=Math.sqrt(1/3),_a=2*ma,wa={draw:function(t,n){var e=Math.sqrt(n/_a),r=e*ma;t.moveTo(0,-e),t.lineTo(r,0),t.lineTo(0,e),t.lineTo(-r,0),t.closePath()}},xa=Math.sin(ea/10)/Math.sin(7*ea/10),Ma=Math.sin(ia/10)*xa,ba=-Math.cos(ia/10)*xa,Ta={draw:function(t,n){var e=Math.sqrt(.8908130915292852*n),r=Ma*e,i=ba*e;t.moveTo(0,-e),t.lineTo(r,i);for(var o=1;o<5;++o){var u=ia*o/5,a=Math.cos(u),s=Math.sin(u);t.lineTo(s*e,-a*e),t.lineTo(a*r-s*i,s*r+a*i)}t.closePath()}},ka={draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},Na=Math.sqrt(3),Aa={draw:function(t,n){var e=-Math.sqrt(n/(3*Na));t.moveTo(0,2*e),t.lineTo(-Na*e,-e),t.lineTo(Na*e,-e),t.closePath()}},Ca=-.5,za=Math.sqrt(3)/2,Sa=1/Math.sqrt(12),Da=3*(Sa/2+1),Ua={draw:function(t,n){var e=Math.sqrt(n/Da),r=e/2,i=e*Sa,o=r,u=e*Sa+e,a=-o,s=u;t.moveTo(r,i),t.lineTo(o,u),t.lineTo(a,s),t.lineTo(Ca*r-za*i,za*r+Ca*i),t.lineTo(Ca*o-za*u,za*o+Ca*u),t.lineTo(Ca*a-za*s,za*a+Ca*s),t.lineTo(Ca*r+za*i,Ca*i-za*r),t.lineTo(Ca*o+za*u,Ca*u-za*o),t.lineTo(Ca*a+za*s,Ca*s-za*a),t.closePath()}};function Ea(t){return t<0?-1:1}function Ya(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),a=(o*i+u*r)/(r+i);return(Ea(o)+Ea(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(a))||0}function qa(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Pa(t,n,e){var r=t._x0,i=t._y0,o=t._x1,u=t._y1,a=(o-r)/3;t._context.bezierCurveTo(r+a,i+a*n,o-a,u-a*e,o,u)}function Fa(t){this._context=t}function Ha(t){this._context=t}function La(t){return function(){return t}}function Va(t,n,e){this.target=t,this.type=n,this.transform=e}function Xa(t,n,e){this.k=t,this.x=n,this.y=e}Fa.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Pa(this,this._t0,qa(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Pa(this,qa(this,e=Ya(this,t,n)),e);break;default:Pa(this,this._t0,e=Ya(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(function(t){this._context=new Ha(t)}.prototype=Object.create(Fa.prototype)).point=function(t,n){Fa.prototype.point.call(this,n,t)},Ha.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},Xa.prototype={constructor:Xa,scale:function(t){return 1===t?this:new Xa(this.k*t,this.x,this.y)},translate:function(t,n){return 0===t&0===n?this:new Xa(this.k,this.x+this.k*t,this.y+this.k*n)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ia=new Xa(1,0,0);function ja(){t.event.stopImmediatePropagation()}function Oa(){t.event.preventDefault(),t.event.stopImmediatePropagation()}function $a(){return!t.event.ctrlKey&&!t.event.button}function Ra(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Ba(){return this.__zoom||Ia}function Za(){return-t.event.deltaY*(1===t.event.deltaMode?.05:t.event.deltaMode?1:.002)}function Wa(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ga(t,n,e){var r=t.invertX(n[0][0])-e[0][0],i=t.invertX(n[1][0])-e[1][0],o=t.invertY(n[0][1])-e[0][1],u=t.invertY(n[1][1])-e[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),u>o?(o+u)/2:Math.min(0,o)||Math.max(0,u))}t.arc=function(){var t=aa,n=sa,e=Zu(0),r=null,i=ca,o=la,u=ha,a=null;function s(){var s,c,l=+t.apply(this,arguments),h=+n.apply(this,arguments),f=i.apply(this,arguments)-ra,p=o.apply(this,arguments)-ra,v=Wu(p-f),y=p>f;if(a||(a=s=Bu()),h1e-12)if(v>ia-1e-12)a.moveTo(h*Ku(f),h*ta(f)),a.arc(0,0,h,f,p,!y),l>1e-12&&(a.moveTo(l*Ku(p),l*ta(p)),a.arc(0,0,l,p,f,y));else{var g,d,m=f,_=p,w=f,x=p,M=v,b=v,T=u.apply(this,arguments)/2,k=T>1e-12&&(r?+r.apply(this,arguments):na(l*l+h*h)),N=Ju(Wu(h-l)/2,+e.apply(this,arguments)),A=N,C=N;if(k>1e-12){var z=ua(k/l*ta(T)),S=ua(k/h*ta(T));(M-=2*z)>1e-12?(w+=z*=y?1:-1,x-=z):(M=0,w=x=(f+p)/2),(b-=2*S)>1e-12?(m+=S*=y?1:-1,_-=S):(b=0,m=_=(f+p)/2)}var D=h*Ku(m),U=h*ta(m),E=l*Ku(x),Y=l*ta(x);if(N>1e-12){var q,P=h*Ku(_),F=h*ta(_),H=l*Ku(w),L=l*ta(w);if(v1e-12?C>1e-12?(g=pa(H,L,D,U,h,C,y),d=pa(P,F,E,Y,h,C,y),a.moveTo(g.cx+g.x01,g.cy+g.y01),C1e-12&&M>1e-12?A>1e-12?(g=pa(E,Y,P,F,l,-A,y),d=pa(D,U,H,L,l,-A,y),a.lineTo(g.cx+g.x01,g.cy+g.y01),Af}c.mouse("drag")}function g(){It(t.event.view).on("mousemove.drag mouseup.drag",null),Gt(t.event.view,r),Zt(),c.mouse("end")}function d(){if(o.apply(this,arguments)){var n,e,r=t.event.changedTouches,i=u.apply(this,arguments),a=r.length;for(n=0;n=u)){(t.data!==n||t.next)&&(0===l&&(p+=(l=hi())*l),0===h&&(p+=(h=hi())*h),p1?(null==e?a.remove(t):a.set(t,p(e)),n):a.get(t)},find:function(n,e,r){var i,o,u,a,s,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c1?(c.on(t,e),n):c.on(t)}}},t.forceX=function(t){var n,e,r,i=li(.1);function o(t){for(var i,o=0,u=n.length;of;)p.pop(),--v;var g,d=new Array(v+1);for(o=0;o<=v;++o)(g=d[o]=[]).x0=o>0?p[o-1]:h,g.x1=o=e)for(r=e;++or&&(r=e)}else for(;++o=e)for(r=e;++or&&(r=e);return r},t.mean=function(t,n){var e,r=t.length,i=r,u=-1,a=0;if(null==n)for(;++u=0;)for(n=(r=t[i]).length;--n>=0;)e[--u]=r[n];return e},t.min=d,t.mouse=$t,t.pie=function(){var t=ya,n=va,e=null,r=Zu(0),i=Zu(ia),o=Zu(0);function u(u){var a,s,c,l,h,f=u.length,p=0,v=new Array(f),y=new Array(f),g=+r.apply(this,arguments),d=Math.min(ia,Math.max(-ia,i.apply(this,arguments)-g)),m=Math.min(Math.abs(d)/f,o.apply(this,arguments)),_=m*(d<0?-1:1);for(a=0;a0&&(p+=h);for(null!=n?v.sort((function(t,e){return n(y[t],y[e])})):null!=e&&v.sort((function(t,n){return e(u[t],u[n])})),a=0,c=p?(d-f*_)/p:0;a0?h*c:0)+_,y[s]={data:u[s],index:a,value:h,startAngle:g,endAngle:l,padAngle:m};return y}return u.value=function(n){return arguments.length?(t="function"==typeof n?n:Zu(+n),u):t},u.sortValues=function(t){return arguments.length?(n=t,e=null,u):n},u.sort=function(t){return arguments.length?(e=t,n=null,u):e},u.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:Zu(+t),u):r},u.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:Zu(+t),u):i},u.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:Zu(+t),u):o},u},t.range=l,t.rgb=Tn,t.scaleBand=function t(){var n,e,r=Si().unknown(void 0),i=r.domain,o=r.range,u=[0,1],a=!1,s=0,c=0,h=.5;function f(){var t=i().length,r=u[1]p}n.zoom("mouse",o(g(n.that.__zoom,n.mouse[0]=$t(n.that),n.mouse[1]),n.extent,c))}function h(){i.on("mousemove.zoom mouseup.zoom",null),Gt(t.event.view,n.moved),Oa(),n.end()}}function b(){if(r.apply(this,arguments)){var n=this.__zoom,e=$t(this),u=n.invert(e),a=n.k*(t.event.shiftKey?.5:2),s=o(g(y(n,a),e,u),i.apply(this,arguments),c);Oa(),l>0?It(this).transition().duration(l).call(m,s,e):It(this).call(v.transform,s)}}function T(){if(r.apply(this,arguments)){var e,i,o,u,a=t.event.touches,s=a.length,c=_(this,arguments,t.event.changedTouches.length===s);for(ja(),i=0;i