Skip to content

Instantly share code, notes, and snippets.

@vicapow
Last active December 15, 2021 21:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save vicapow/6119338 to your computer and use it in GitHub Desktop.
Save vicapow/6119338 to your computer and use it in GitHub Desktop.
requirebin sketch
var d3 = require('d3')
, _ = require('underscore')
, w = window.innerWidth
, h = window.innerHeight - 100
, tempo = 500
// , data = {
// 'Derek Jeter' : {
// '1995' : [12, 48]
// , '1996' : [183, 582]
// }
// , 'David Justice' : {
// '1995' : [104, 411]
// , '1996' : [45, 140]
// }
// }
// , data = {
// 'Lisa' : {
// 'Week 1' : [0, 3]
// , 'Week 2' : [5, 7]
// }
// , 'Bart' : {
// 'Week 1' : [1, 7]
// , 'Week 2' : [3, 3]
// }
// }
, data = {
'Men' : {
'Dept A' : [51, 82]
, 'Dept B' : [35, 56]
, 'Dept C' : [12, 33]
, 'Dept D' : [14, 42]
, 'Dept E' : [5, 19]
, 'Dept F' : [2, 27]
}
, 'Women' : {
'Dept A' : [9, 11]
, 'Dept B' : [2, 3]
, 'Dept C' : [20, 59]
, 'Dept D' : [13, 38]
, 'Dept E' : [9, 39]
, 'Dept F' : [2, 34]
}
}
// return the combined ration for a row in the data
, combined = function(row){
return _.reduce(_.toArray(data)[row], function(m, n){
return _.zip(m, n).map(function(a){ return a[0] + a[1] })
}, [0, 0])
}
, rows = _.keys(data)
, cols = _.keys(_.first(_.toArray(data)))
// max for each column
, col_maxs = (function(){
var maxs = _.map(cols, function(col){
var max_row = 0
_.reduce(_.toArray(data), function(max, row, row_ind){
var t = row[col][0] / row[col][1]
if(t > max){
max_row = row_ind
max = t
}
return max
}, 0)
return max_row
})
var max_combined_index = -1
var max_combined = _.reduce(rows, function(max, row, i){
var t = combined(i)
t = t[0] / t[1]
if(t > max){
max_combined_index = i
max = t
}
return max
}, 0)
maxs.push(max_combined_index)
return maxs
})()
, num_nodes = _.chain(data).map(function(row){
return _.map(row, function(col){
return _.last(col)
}).reduce(function(m, n){ return m + n })
}).reduce(function(m, n){ return m + n}, 0).value()
, max_nodes_per_ratio = d3.max(_.map(data, function(row){
return d3.max( _.map(row, function(col){ return _.last(col) } ) )
}))
, fill = function(d){
if(d) return 'black'
else return 'steelblue'
}
, svg = d3.select('body').append('svg')
.attr('width', w)
.attr('height', h)
, createForce = function(){
return d3.layout.force()
.nodes([])
.links([])
.gravity(0)
.size([w, h])
.linkDistance(0)
.linkStrength(2)
.friction(0.2)
.charge(function(d, i){ return d.charge })
}
, forces = _.map(rows, createForce)
, linktoFoci = function(nodes, foci){
return nodes.map(function(node){
return { source : node, target : foci }
})
}
, createNodes = function(num, denom, name){
return d3.range(denom).map(function(d){
return {
id : d < num ? 0 : 1
, x : d < num ? 0 : w
, y : Math.random() * h
, charge : -1 * 10000 / max_nodes_per_ratio
, name : name
}
})
}
, createFoci = function(x, y, name){
return { x : x, y : y, charge : 0, fixed : true, name : name }
}
, focis = {}
, rowClass = function(row){
return 'row-' + row.replace(/ /g, '').toLowerCase()
}
, colClass = function(col){
return 'col-' + col.replace(/ /g, '').toLowerCase()
}
// create all the focal points for the different nodes
_.each(rows, function(row_val, row){
_.each(cols, function(col_val, col){
var row_class = rowClass(rows[row])
, col_class = colClass(cols[col])
, x = w / (cols.length + 2) * (col + 1)
, y = h / (rows.length + 1) * ( row + 1)
, foci1 = createFoci( x, y, row_class + ' ' + col_class + ' foci foci-0')
, foci2 = createFoci( x, y, row_class + ' ' + col_class + ' foci foci-1')
if(!focis[rows[row]]) focis[rows[row]] = {}
focis[rows[row]][cols[col]] = [foci1, foci2]
forces[row].nodes().push(foci1, foci2)
})
})
function setupNodeAndLinks(force, row){
cols.forEach(function(col){
var fociSet = focis[row][col]
, num = data[row][col][0]
, den = data[row][col][1]
, row_class = rowClass(row)
, col_class = colClass(col)
, nodes = createNodes(num, den, row_class + ' ' + col_class)
force.nodes().push.apply(force.nodes(), nodes)
force.links().push.apply(force.links(), linktoFoci(nodes.filter(function(d){
return d.id === 0
}), fociSet[0] ))
force.links().push.apply(force.links(), linktoFoci(nodes.filter(function(d){
return d.id === 1
}), fociSet[1] ))
})
}
_.each(forces, function(force, i){
setupNodeAndLinks(force, rows[i] )
force.on('tick', function(e){
svg.selectAll('circle.' + rowClass(rows[i]))
.attr('cx', function(d) { return d.x })
.attr('cy', function(d) { return d.y })
})
})
svg.selectAll('circle' + '.node')
.data(_.reduce(forces
, function(nodes, force) { return nodes.concat(force.nodes()); }, []))
.enter().append('circle')
.attr('class', function(d){ return 'node ' + d.name})
.attr('cx', function(d) { return d.x })
.attr('cy', function(d) { return d.y })
.attr('r', 2 + 100 / num_nodes )
.style('fill', function(d) { return fill(d.id) })
.style('stroke', function(d) { return d3.rgb(fill(d.id)).darker(2) })
.style('stroke-width', 1)
// ensure the focal points are hidden even in `requirebin`
svg.selectAll('circle.foci')
.style('display', 'none')
_.each(forces, function(force){ force.start() })
var cl = function(row, col, fociId){
fociId = (fociId !== undefined) ? '.foci-' + fociId : ''
return '.' + rowClass(rows[row]) + '.' + colClass(cols[col] + fociId)
}
, ratioLabelPos = function(row, col){
var maxr = 0
, cx = Number(d3.select(cl(row, col, 0)).attr('cx'))
, cy = Number(d3.select(cl(row, col, 0)).attr('cy'))
d3.selectAll('.node' + cl(row, col)).each(function(d){
var r = Math.sqrt( (d.x - cx) * (d.x - cx) + (d.y - cy) * (d.y - cy))
maxr = r > maxr ? r : maxr
})
return {
x : cx + Math.cos(45) * maxr
, y : cy - Math.sin(45) * maxr
}
}
, ratioLabelFormat = function(d){
return d3.format('.0%')(d[0] / d[1]) + ' accepted'
}
, timeline = [
tempo * 2
, function(){
// show labels
var labels = []
for(row in rows){
for(col in cols){
labels.push({
foci: cl(row, col)
, text : ratioLabelFormat(data[rows[row]][cols[col]])
, row : Number(row)
, col : Number(col)
})
}
}
var ratios = svg.selectAll('text.year-ratio')
ratios.remove()
ratios.data(labels)
.enter().append('text')
.attr({
class : 'year-ratio'
, x : function(d){
return ratioLabelPos(d.row, d.col).x
}
, y : function(d){
return ratioLabelPos(d.row, d.col).y
}
})
.text(function(d){ return d.text })
.style('opacity','0.0')
.transition()
.style('opacity','1.0')
.style('font-weight', function(d){
return col_maxs[d.col] === d.row ? 'bold' : 'normal'
})
}
, tempo * 10
, function(){
var dur = 250
var ratios = svg.selectAll('text.year-ratio')
.transition()
.duration(dur)
.style('opacity','0.0')
.remove()
return dur
}
, function(){
var dur = tempo * 2
for(var row in rows){
for(var col in cols){
animFoci( cl(row, col) + '.foci-0', { x : w / (cols.length + 2) * (cols.length + 1) - 500 }, dur)
// a hack to make the combined edges a bit smoother
animFoci( cl(row, col) + '.foci-1', { x : w / (cols.length + 2) * (cols.length + 1) }, dur)
}
}
return dur
}
, tempo * 1
, function(){
var dur = tempo * 2
for(var row in rows){
for(var col in cols){
animFoci( cl(row, col) + '.foci-0', { x : w / (cols.length + 2) * (cols.length + 1) }, dur)
animFoci( cl(row, col) + '.foci-1', { x : w / (cols.length + 2) * (cols.length + 1) }, dur)
}
}
return dur
}
, tempo * 1
// show the combined ratios
, function(){
var labels = rows.map(function(row, i){
return {
text : ratioLabelFormat(combined(i))
, row : i
, col : cols.length
, foci: cl(i, 0)
}
})
var ratios = svg.selectAll('text.combined-ratio')
ratios.remove()
ratios.data(labels)
.enter().append('text')
.attr({
class : 'combined-ratio'
, x : function(d){
return ratioLabelPos(d.row, 0).x
}
, y : function(d){
return ratioLabelPos(d.row, 0).y
}
})
.text(function(d){ return d.text })
.style('opacity','0.0')
.transition()
.style('opacity','1.0')
.style('font-weight', function(d){
return col_maxs[d.col] === d.row ? 'bold' : 'normal'
})
}
, tempo * 10
// hide the combined ration labels
, function(){
var dur = 250
var ratios = svg.selectAll('text.combined-ratio')
.transition()
.duration(dur)
.style('opacity','0.0')
.remove()
return dur
}
// back to the original configuration
, function(){
var dur = tempo
_.each(rows, function(row_val, row){
_.each(cols, function(col_val, col){
animFoci( cl(row, col) + '.foci-0', { x : w / (cols.length + 2) * (1 + col) - 30 }, dur)
animFoci( cl(row, col) + '.foci-1', { x : w / (cols.length + 2) * (1 + col) + 30 }, dur)
})
})
return dur
}
, function(){
var dur = tempo
_.each(rows, function(row_val, row){
_.each(cols, function(col_val, col){
animFoci( cl(row, col) + '.foci-0', { x : w / (cols.length + 2) * (col + 1) }, dur)
animFoci( cl(row, col) + '.foci-1', { x : w / (cols.length + 2) * (col + 1) }, dur)
})
})
return dur
}
]
// loop through the timeline
, t = -1
, forward = 1
, back_and_forth = false // change to play the animation `back-and-forth`
, loop = function(){
if(back_and_forth){
if(t >= timeline.length - 1) forward = -1
else if (t <= 0) forward = 1
}
var now = timeline[t = (t + forward) % timeline.length]
if(typeof now === 'function'){
var dur = now()
if(dur === undefined) dur = tempo
setTimeout(loop, dur)
}else setTimeout(loop, now)
}
loop()
function animFoci(foci, pos, duration){
if(duration === undefined) duration = 1000
d3.selectAll(foci + '.foci')
.transition()
.duration(duration)
.ease('cubic-in-out')
.tween('dataTweet', function(d){
if(!pos.x) pos.x = d.px
if(!pos.y) pos.y = d.py
var ix = d3.interpolate(d.x, pos.x)
var iy = d3.interpolate(d.y, pos.y)
return function(t){
d.x = d.px = ix(t)
d.y = d.py = iy(t)
}
})
_.each(forces, function(force){
force.start()
})
}
// Labels
// todo: change root `em` size depending on window size
d3.select('body').style('font-size', '1em')
// column headers
svg.selectAll('text.column-label')
.data(cols.concat(['combined']))
.enter().append('text')
.attr({
x : function(d, i){ return w / (cols.length + 2) * (i + 1) }
, y : 20
, anchor : 'middle'
, class : 'column-label'
}).text(function(d){ return d})
svg.selectAll('text.row-label')
.data(rows)
.enter().append('text')
.attr({
x : 70
, y : function(d, i){ return h / (rows.length + 1) * (i + 1) }
, anchor : 'right'
, class : 'row-label'
}).text(function(d){ return d})
svg.append('text')
.text('1 ball = 10 people. ')
.attr({
x : 10
, y : h - 10
, class : 'legend-item1'
})
function setupNodeAndLinks(n,t){cols.forEach(function(e){var r=focis[t][e],i=data[t][e][0],u=data[t][e][1],o=rowClass(t),a=colClass(e),c=createNodes(i,u,o+" "+a);n.nodes().push.apply(n.nodes(),c),n.links().push.apply(n.links(),linktoFoci(c.filter(function(n){return 0===n.id}),r[0])),n.links().push.apply(n.links(),linktoFoci(c.filter(function(n){return 1===n.id}),r[1]))})}function animFoci(n,t,e){void 0===e&&(e=1e3),d3.selectAll(n+".foci").transition().duration(e).ease("cubic-in-out").tween("dataTweet",function(n){t.x||(t.x=n.px),t.y||(t.y=n.py);var e=d3.interpolate(n.x,t.x),r=d3.interpolate(n.y,t.y);return function(t){n.x=n.px=e(t),n.y=n.py=r(t)}}),_.each(forces,function(n){n.start()})}require=function(n,t,e){function r(e,u){if(!t[e]){if(!n[e]){var o="function"==typeof require&&require;if(!u&&o)return o(e,!0);if(i)return i(e,!0);throw Error("Cannot find module '"+e+"'")}var a=t[e]={exports:{}};n[e][0].call(a.exports,function(t){var i=n[e][1][t];return r(i?i:t)},a,a.exports)}return t[e].exports}for(var i="function"==typeof require&&require,u=0;e.length>u;u++)r(e[u]);return r}({d3:[function(n,t){t.exports=n("0koDFN")},{}],"0koDFN":[function(n,t){(function(){n("./d3"),t.exports=d3,function(){delete this.d3}()})()},{"./d3":1}],1:[function(){d3=function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function i(){}function u(){}function o(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function a(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=jo.length;r>e;++e){var i=jo[e]+t;if(i in n)return i}}function c(n){for(var t=-1,e=n.length,r=[];e>++t;)r.push(n[t]);return r}function l(n){return Array.prototype.slice.call(n)}function s(){}function f(){}function h(n){function t(){for(var t,r=e,i=-1,u=r.length;u>++i;)(t=r[i].on)&&t.apply(this,arguments);return n}var e=[],r=new i;return t.on=function(t,i){var u,o=r.get(t);return 2>arguments.length?o&&o.on:(o&&(o.on=null,e=e.slice(0,u=e.indexOf(o)).concat(e.slice(u+1)),r.remove(t)),i&&e.push(r.set(t,{on:i})),n)},t}function g(){xo.event.preventDefault()}function p(){for(var n,t=xo.event;n=t.sourceEvent;)t=n;return t}function d(n){for(var t=new f,e=0,r=arguments.length;r>++e;)t[arguments[e]]=h(t);return t.of=function(e,r){return function(i){try{var u=i.sourceEvent=xo.event;i.target=n,xo.event=i,t[i.type].apply(e,r)}finally{xo.event=u}}},t}function m(n){return Lo(n,Io),n}function v(n){return"function"==typeof n?n:function(){return Oo(n,this)}}function y(n){return"function"==typeof n?n:function(){return Ho(n,this)}}function x(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function i(){this.setAttribute(n,t)}function u(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=xo.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?u:i}function M(n){return n.trim().replace(/\s+/g," ")}function b(n){return RegExp("(?:^|\\s+)"+xo.requote(n)+"(?:\\s+|$)","g")}function _(n,t){function e(){for(var e=-1;i>++e;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);i>++e;)n[e](this,r)}n=n.trim().split(/\s+/).map(w);var i=n.length;return"function"==typeof t?r:e}function w(n){var t=b(n);return function(e,r){if(i=e.classList)return r?i.add(n):i.remove(n);var i=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(i)||e.setAttribute("class",M(i+" "+n))):e.setAttribute("class",M(i.replace(t," ")))}}function E(n,t,e){function r(){this.style.removeProperty(n)}function i(){this.style.setProperty(n,t,e)}function u(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?u:i}function S(n,t){function e(){delete this[n]}function r(){this[n]=t}function i(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?i:r}function k(n){return"function"==typeof n?n:(n=xo.ns.qualify(n)).local?function(){return Mo.createElementNS(n.space,n.local)}:function(){return Mo.createElementNS(this.namespaceURI,n)}}function A(n){return{__data__:n}}function N(n){return function(){return Po(this,n)}}function q(n){return arguments.length||(n=xo.ascending),function(t,e){return!t-!e||n(t.__data__,e.__data__)}}function T(n,t){for(var e=0,r=n.length;r>e;e++)for(var i,u=n[e],o=0,a=u.length;a>o;o++)(i=u[o])&&t(i,o,e);return n}function C(n){return Lo(n,Uo),n}function j(n){var t,e;return function(r,i,u){var o,a=n[u].update,c=a.length;for(u!=e&&(e=u,t=0),i>=t&&(t=i+1);!(o=a[t])&&c>++t;);return o}}function D(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function i(){var i=c(t,Do(arguments));r.call(this),this.addEventListener(n,this[o]=i,i.$=e),i._=t}function u(){var t,e=RegExp("^__on([^.]+)"+xo.requote(n)+"$");for(var r in this)if(t=r.match(e)){var i=this[r];this.removeEventListener(t[1],i,i.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),c=F;a>0&&(n=n.substring(0,a));var l=Vo.get(n);return l&&(n=l,c=z),a?t?i:r:t?s:u}function F(n,t){return function(e){var r=xo.event;xo.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{xo.event=r}}}function z(n,t){var e=F(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function L(){var n=".dragsuppress-"+ ++Zo,t="touchmove"+n,e="selectstart"+n,r="dragstart"+n,i="click"+n,u=xo.select(_o).on(t,g).on(e,g).on(r,g),o=bo.style,a=o[Xo];return o[Xo]="none",function(t){function e(){u.on(i,null)}u.on(n,null),o[Xo]=a,t&&(u.on(i,function(){g(),e()},!0),setTimeout(e,0))}}function O(n,t){var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>$o&&(_o.scrollX||_o.scrollY)){e=xo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var i=e[0][0].getScreenCTM();$o=!(i.f||i.e),e.remove()}return $o?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var u=n.getBoundingClientRect();return[t.clientX-u.left-n.clientLeft,t.clientY-u.top-n.clientTop]}function H(){}function R(n,t,e){return new P(n,t,e)}function P(n,t,e){this.h=n,this.s=t,this.l=e}function I(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?u+(o-u)*n/60:180>n?o:240>n?u+(o-u)*(240-n)/60:u}function i(n){return Math.round(255*r(n))}var u,o;return n=isNaN(n)?0:0>(n%=360)?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,u=2*e-o,ot(i(n+120),i(n),i(n-120))}function Y(n){return n>0?1:0>n?-1:0}function U(n){return n>1?0:-1>n?Qo:Math.acos(n)}function B(n){return n>1?Qo/2:-1>n?-Qo/2:Math.asin(n)}function V(n){return(Math.exp(n)-Math.exp(-n))/2}function X(n){return(Math.exp(n)+Math.exp(-n))/2}function Z(n){return(n=Math.sin(n/2))*n}function $(n,t,e){return new W(n,t,e)}function W(n,t,e){this.h=n,this.c=t,this.l=e}function J(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),G(e,Math.cos(n*=ea)*t,Math.sin(n)*t)}function G(n,t,e){return new K(n,t,e)}function K(n,t,e){this.l=n,this.a=t,this.b=e}function Q(n,t,e){var r=(n+16)/116,i=r+t/500,u=r-e/200;return i=tt(i)*oa,r=tt(r)*aa,u=tt(u)*ca,ot(rt(3.2404542*i-1.5371385*r-.4985314*u),rt(-.969266*i+1.8760108*r+.041556*u),rt(.0556434*i-.2040259*r+1.0572252*u))}function nt(n,t,e){return n>0?$(Math.atan2(e,t)*ra,Math.sqrt(t*t+e*e),n):$(0/0,0/0,n)}function tt(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function et(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function rt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function it(n){return ot(n>>16,255&n>>8,255&n)}function ut(n){return it(n)+""}function ot(n,t,e){return new at(n,t,e)}function at(n,t,e){this.r=n,this.g=t,this.b=e}function ct(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function lt(n,t,e){var r,i,u,o=0,a=0,c=0;if(r=/([a-z]+)\((.*)\)/i.exec(n))switch(i=r[2].split(","),r[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(gt(i[0]),gt(i[1]),gt(i[2]))}return(u=fa.get(n))?t(u.r,u.g,u.b):(null!=n&&"#"===n.charAt(0)&&(4===n.length?(o=n.charAt(1),o+=o,a=n.charAt(2),a+=a,c=n.charAt(3),c+=c):7===n.length&&(o=n.substring(1,3),a=n.substring(3,5),c=n.substring(5,7)),o=parseInt(o,16),a=parseInt(a,16),c=parseInt(c,16)),t(o,a,c))}function st(n,t,e){var r,i,u=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-u,c=(o+u)/2;return a?(i=.5>c?a/(o+u):a/(2-o-u),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,i=c>0&&1>c?0:r),R(r,i,c)}function ft(n,t,e){n=ht(n),t=ht(t),e=ht(e);var r=et((.4124564*n+.3575761*t+.1804375*e)/oa),i=et((.2126729*n+.7151522*t+.072175*e)/aa),u=et((.0193339*n+.119192*t+.9503041*e)/ca);return G(116*i-16,500*(r-i),200*(i-u))}function ht(n){return.04045>=(n/=255)?n/12.92:Math.pow((n+.055)/1.055,2.4)}function gt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function pt(n){return"function"==typeof n?n:function(){return n}}function dt(n){return n}function mt(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),vt(t,e,n,r)}}function vt(n,t,e,r){function i(){var n,t=c.status;if(!t&&c.responseText||t>=200&&300>t||304===t){try{n=e.call(u,c)}catch(r){return o.error.call(u,r),void 0}o.load.call(u,n)}else o.error.call(u,c)}var u={},o=xo.dispatch("progress","load","error"),a={},c=new XMLHttpRequest,l=null;return!_o.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=i:c.onreadystatechange=function(){c.readyState>3&&i()},c.onprogress=function(n){var t=xo.event;xo.event=n;try{o.progress.call(u,c)}finally{xo.event=t}},u.header=function(n,t){return n=(n+"").toLowerCase(),2>arguments.length?a[n]:(null==t?delete a[n]:a[n]=t+"",u)},u.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",u):t},u.responseType=function(n){return arguments.length?(l=n,u):l},u.response=function(n){return e=n,u},["get","post"].forEach(function(n){u[n]=function(){return u.send.apply(u,[n].concat(Do(arguments)))}}),u.send=function(e,r,i){if(2===arguments.length&&"function"==typeof r&&(i=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var o in a)c.setRequestHeader(o,a[o]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=l&&(c.responseType=l),null!=i&&u.on("error",i).on("load",function(n){i(null,n)}),c.send(null==r?null:r),u},u.abort=function(){return c.abort(),u},xo.rebind(u,o,"on"),null==r?u:u.get(yt(r))}function yt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function xt(){var n=bt(),t=_t()-n;t>24?(isFinite(t)&&(clearTimeout(da),da=setTimeout(xt,t)),pa=0):(pa=1,va(xt))}function Mt(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now()),ma.callback=n,ma.time=e+t}function bt(){var n=Date.now();for(ma=ha;ma;)n>=ma.time&&(ma.flush=ma.callback(n-ma.time)),ma=ma.next;return n}function _t(){for(var n,t=ha,e=1/0;t;)t.flush?t=n?n.next=t.next:ha=t.next:(e>t.time&&(e=t.time),t=(n=t).next);return ga=n,e}function wt(n,t){var e=Math.pow(10,3*Math.abs(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Et(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function St(n){return n+""}function kt(){}function At(n,t,e){var r=e.s=n+t,i=r-n,u=r-i;e.t=n-u+(t-i)}function Nt(n,t){n&&qa.hasOwnProperty(n.type)&&qa[n.type](n,t)}function qt(n,t,e){var r,i=-1,u=n.length-e;for(t.lineStart();u>++i;)r=n[i],t.point(r[0],r[1]);t.lineEnd()}function Tt(n,t){var e=-1,r=n.length;for(t.polygonStart();r>++e;)qt(n[e],t,1);t.polygonEnd()}function Ct(){function n(n,t){n*=ea,t=t*ea/2+Qo/4;var e=n-r,o=Math.cos(t),a=Math.sin(t),c=u*a,l=i*o+c*Math.cos(e),s=c*Math.sin(e);Ca.add(Math.atan2(s,l)),r=n,i=o,u=a}var t,e,r,i,u;ja.point=function(o,a){ja.point=n,r=(t=o)*ea,i=Math.cos(a=(e=a)*ea/2+Qo/4),u=Math.sin(a)},ja.lineEnd=function(){n(t,e)}}function jt(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function Dt(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function Ft(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function zt(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function Lt(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function Ot(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function Ht(n){return[Math.atan2(n[1],n[0]),B(n[2])]}function Rt(n,t){return na>Math.abs(n[0]-t[0])&&na>Math.abs(n[1]-t[1])}function Pt(n,t){n*=ea;var e=Math.cos(t*=ea);It(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function It(n,t,e){++Da,za+=(n-za)/Da,La+=(t-La)/Da,Oa+=(e-Oa)/Da}function Yt(){function n(n,i){n*=ea;var u=Math.cos(i*=ea),o=u*Math.cos(n),a=u*Math.sin(n),c=Math.sin(i),l=Math.atan2(Math.sqrt((l=e*c-r*a)*l+(l=r*o-t*c)*l+(l=t*a-e*o)*l),t*o+e*a+r*c);Fa+=l,Ha+=l*(t+(t=o)),Ra+=l*(e+(e=a)),Pa+=l*(r+(r=c)),It(t,e,r)}var t,e,r;Ba.point=function(i,u){i*=ea;var o=Math.cos(u*=ea);t=o*Math.cos(i),e=o*Math.sin(i),r=Math.sin(u),Ba.point=n,It(t,e,r)}}function Ut(){Ba.point=Pt}function Bt(){function n(n,t){n*=ea;var e=Math.cos(t*=ea),o=e*Math.cos(n),a=e*Math.sin(n),c=Math.sin(t),l=i*c-u*a,s=u*o-r*c,f=r*a-i*o,h=Math.sqrt(l*l+s*s+f*f),g=r*o+i*a+u*c,p=h&&-U(g)/h,d=Math.atan2(h,g);Ia+=p*l,Ya+=p*s,Ua+=p*f,Fa+=d,Ha+=d*(r+(r=o)),Ra+=d*(i+(i=a)),Pa+=d*(u+(u=c)),It(r,i,u)}var t,e,r,i,u;Ba.point=function(o,a){t=o,e=a,Ba.point=n,o*=ea;var c=Math.cos(a*=ea);r=c*Math.cos(o),i=c*Math.sin(o),u=Math.sin(a),It(r,i,u)},Ba.lineEnd=function(){n(t,e),Ba.lineEnd=Ut,Ba.point=Pt}}function Vt(){return!0}function Xt(n,t,e,r,i){var u=[],o=[];if(n.forEach(function(n){if(!(0>=(t=n.length-1))){var t,e=n[0],r=n[t];if(Rt(e,r)){i.lineStart();for(var a=0;t>a;++a)i.point((e=n[a])[0],e[1]);return i.lineEnd(),void 0}var c={point:e,points:n,other:null,visited:!1,entry:!0,subject:!0},l={point:e,points:[e],other:c,visited:!1,entry:!1,subject:!1};c.other=l,u.push(c),o.push(l),c={point:r,points:[r],other:null,visited:!1,entry:!1,subject:!0},l={point:r,points:[r],other:c,visited:!1,entry:!0,subject:!1},c.other=l,u.push(c),o.push(l)}}),o.sort(t),Zt(u),Zt(o),u.length){if(e)for(var a=1,c=!e(o[0].point),l=o.length;l>a;++a)o[a].entry=c=!c;for(var s,f,h,g=u[0];;){for(s=g;s.visited;)if((s=s.next)===g)return;f=s.points,i.lineStart();do{if(s.visited=s.other.visited=!0,s.entry){if(s.subject)for(var a=0;f.length>a;a++)i.point((h=f[a])[0],h[1]);else r(s.point,s.next.point,1,i);s=s.next}else{if(s.subject){f=s.prev.points;for(var a=f.length;--a>=0;)i.point((h=f[a])[0],h[1])}else r(s.point,s.prev.point,-1,i);s=s.prev}s=s.other,f=s.points}while(!s.visited);i.lineEnd()}}}function Zt(n){if(t=n.length){for(var t,e,r=0,i=n[0];t>++r;)i.next=e=n[r],e.prev=i,i=e;i.next=e=n[0],e.prev=i}}function $t(n,t,e,r){return function(i){function u(t,e){n(t,e)&&i.point(t,e)}function o(n,t){d.point(n,t)}function a(){m.point=o,d.lineStart()}function c(){m.point=u,d.lineEnd()}function l(n,t){y.point(n,t),p.push([n,t])}function s(){y.lineStart(),p=[]}function f(){l(p[0][0],p[0][1]),y.lineEnd();var n,t=y.clean(),e=v.buffer(),r=e.length;if(p.pop(),g.push(p),p=null,r){if(1&t){n=e[0];var u,r=n.length-1,o=-1;for(i.lineStart();r>++o;)i.point((u=n[o])[0],u[1]);return i.lineEnd(),void 0}r>1&&2&t&&e.push(e.pop().concat(e.shift())),h.push(e.filter(Wt))}}var h,g,p,d=t(i),m={point:u,lineStart:a,lineEnd:c,polygonStart:function(){m.point=l,m.lineStart=s,m.lineEnd=f,h=[],g=[],i.polygonStart()},polygonEnd:function(){m.point=u,m.lineStart=a,m.lineEnd=c,h=xo.merge(h),h.length?Xt(h,Gt,null,e,i):r(g)&&(i.lineStart(),e(null,null,1,i),i.lineEnd()),i.polygonEnd(),h=g=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},v=Jt(),y=t(v);return m}}function Wt(n){return n.length>1}function Jt(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:s,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Gt(n,t){return(0>(n=n.point)[0]?n[1]-Qo/2-na:Qo/2-n[1])-(0>(t=t.point)[0]?t[1]-Qo/2-na:Qo/2-t[1])}function Kt(n,t){var e=n[0],r=n[1],i=[Math.sin(e),-Math.cos(e),0],u=0,o=!1,a=!1,c=0;Ca.reset();for(var l=0,s=t.length;s>l;++l){var f=t[l],h=f.length;if(h){for(var g=f[0],p=g[0],d=g[1]/2+Qo/4,m=Math.sin(d),v=Math.cos(d),y=1;;){y===h&&(y=0),n=f[y];var x=n[0],M=n[1]/2+Qo/4,b=Math.sin(M),_=Math.cos(M),w=x-p,E=Math.abs(w)>Qo,S=m*b;if(Ca.add(Math.atan2(S*Math.sin(w),v*_+S*Math.cos(w))),na>Math.abs(M)&&(a=!0),u+=E?w+(w>=0?2:-2)*Qo:w,E^p>=e^x>=e){var k=Ft(jt(g),jt(n));Ot(k);var A=Ft(i,k);Ot(A);var N=(E^w>=0?-1:1)*B(A[2]);r>N&&(c+=E^w>=0?1:-1)}if(!y++)break;p=x,m=b,v=_,g=n}Math.abs(u)>na&&(o=!0)}}return(!a&&!o&&0>Ca||-na>u)^1&c}function Qt(n){var t,e=0/0,r=0/0,i=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(u,o){var a=u>0?Qo:-Qo,c=Math.abs(u-e);na>Math.abs(c-Qo)?(n.point(e,r=(r+o)/2>0?Qo/2:-Qo/2),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(u,r),t=0):i!==a&&c>=Qo&&(na>Math.abs(e-i)&&(e-=i*na),na>Math.abs(u-a)&&(u-=a*na),r=ne(e,r,u,o),n.point(i,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=u,r=o),i=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function ne(n,t,e,r){var i,u,o=Math.sin(n-e);return Math.abs(o)>na?Math.atan((Math.sin(t)*(u=Math.cos(r))*Math.sin(e)-Math.sin(r)*(i=Math.cos(t))*Math.sin(n))/(i*u*o)):(t+r)/2}function te(n,t,e,r){var i;if(null==n)i=e*Qo/2,r.point(-Qo,i),r.point(0,i),r.point(Qo,i),r.point(Qo,0),r.point(Qo,-i),r.point(0,-i),r.point(-Qo,-i),r.point(-Qo,0),r.point(-Qo,i);else if(Math.abs(n[0]-t[0])>na){var u=(n[0]<t[0]?1:-1)*Qo;i=e*u/2,r.point(-u,i),r.point(0,i),r.point(u,i)}else r.point(t[0],t[1])}function ee(n){return Kt(Xa,n)}function re(n){function t(n,t){return Math.cos(n)*Math.cos(t)>o}function e(n){var e,u,o,c,s;return{lineStart:function(){c=o=!1,s=1},point:function(f,h){var g,p=[f,h],d=t(f,h),m=a?d?0:i(f,h):d?i(f+(0>f?Qo:-Qo),h):0;if(!e&&(c=o=d)&&n.lineStart(),d!==o&&(g=r(e,p),(Rt(e,g)||Rt(p,g))&&(p[0]+=na,p[1]+=na,d=t(p[0],p[1]))),d!==o)s=0,d?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(l&&e&&a^d){var v;m&u||!(v=r(p,e,!0))||(s=0,a?(n.lineStart(),n.point(v[0][0],v[0][1]),n.point(v[1][0],v[1][1]),n.lineEnd()):(n.point(v[1][0],v[1][1]),n.lineEnd(),n.lineStart(),n.point(v[0][0],v[0][1])))}!d||e&&Rt(e,p)||n.point(p[0],p[1]),e=p,o=d,u=m},lineEnd:function(){o&&n.lineEnd(),e=null},clean:function(){return s|(c&&o)<<1}}}function r(n,t,e){var r=jt(n),i=jt(t),u=[1,0,0],a=Ft(r,i),c=Dt(a,a),l=a[0],s=c-l*l;if(!s)return!e&&n;var f=o*c/s,h=-o*l/s,g=Ft(u,a),p=Lt(u,f),d=Lt(a,h);zt(p,d);var m=g,v=Dt(p,m),y=Dt(m,m),x=v*v-y*(Dt(p,p)-1);if(!(0>x)){var M=Math.sqrt(x),b=Lt(m,(-v-M)/y);if(zt(b,p),b=Ht(b),!e)return b;var _,w=n[0],E=t[0],S=n[1],k=t[1];w>E&&(_=w,w=E,E=_);var A=E-w,N=na>Math.abs(A-Qo),q=N||na>A;if(!N&&S>k&&(_=S,S=k,k=_),q?N?S+k>0^b[1]<(na>Math.abs(b[0]-w)?S:k):b[1]>=S&&k>=b[1]:A>Qo^(b[0]>=w&&E>=b[0])){var T=Lt(m,(-v+M)/y);return zt(T,p),[b,Ht(T)]}}}function i(t,e){var r=a?n:Qo-n,i=0;return-r>t?i|=1:t>r&&(i|=2),-r>e?i|=4:e>r&&(i|=8),i}function u(n){return Kt(c,n)}var o=Math.cos(n),a=o>0,c=[n,0],l=Math.abs(o)>na,s=Ne(n,6*ea);return $t(t,e,s,u)}function ie(n,t,e,r){function i(r,i){return na>Math.abs(r[0]-n)?i>0?0:3:na>Math.abs(r[0]-e)?i>0?2:1:na>Math.abs(r[1]-t)?i>0?1:0:i>0?3:2}function u(n,t){return o(n.point,t.point)}function o(n,t){var e=i(n,1),r=i(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}function a(i,u){var o=u[0]-i[0],a=u[1]-i[1],c=[0,1];return na>Math.abs(o)&&na>Math.abs(a)?i[0]>=n&&e>=i[0]&&i[1]>=t&&r>=i[1]:ue(n-i[0],o,c)&&ue(i[0]-e,-o,c)&&ue(t-i[1],a,c)&&ue(i[1]-r,-a,c)?(1>c[1]&&(u[0]=i[0]+c[1]*o,u[1]=i[1]+c[1]*a),c[0]>0&&(i[0]+=c[0]*o,i[1]+=c[0]*a),!0):!1}return function(c){function l(u){var o=i(u,-1),a=s([0===o||3===o?n:e,o>1?r:t]);return a}function s(n){for(var t=0,e=x.length,r=n[1],i=0;e>i;++i)for(var u,o=1,a=x[i],c=a.length,l=a[0];c>o;++o)u=a[o],r>=l[1]?u[1]>r&&f(l,u,n)>0&&++t:r>=u[1]&&0>f(l,u,n)&&--t,l=u;return 0!==t}function f(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(e[0]-n[0])*(t[1]-n[1])}function h(u,a,c,l){var s=0,f=0;if(null==u||(s=i(u,c))!==(f=i(a,c))||0>o(u,a)^c>0){do l.point(0===s||3===s?n:e,s>1?r:t);while((s=(s+c+4)%4)!==f)}else l.point(a[0],a[1])}function g(i,u){return i>=n&&e>=i&&u>=t&&r>=u}function p(n,t){g(n,t)&&c.point(n,t)}function d(){T.point=v,x&&x.push(M=[]),A=!0,k=!1,E=S=0/0}function m(){y&&(v(b,_),w&&k&&q.rejoin(),y.push(q.buffer())),T.point=p,k&&c.lineEnd()}function v(n,t){n=Math.max(-Za,Math.min(Za,n)),t=Math.max(-Za,Math.min(Za,t));var e=g(n,t);if(x&&M.push([n,t]),A)b=n,_=t,w=e,A=!1,e&&(c.lineStart(),c.point(n,t));else if(e&&k)c.point(n,t);else{var r=[E,S],i=[n,t];a(r,i)?(k||(c.lineStart(),c.point(r[0],r[1])),c.point(i[0],i[1]),e||c.lineEnd()):e&&(c.lineStart(),c.point(n,t))}E=n,S=t,k=e}var y,x,M,b,_,w,E,S,k,A,N=c,q=Jt(),T={point:p,lineStart:d,lineEnd:m,polygonStart:function(){c=q,y=[],x=[]},polygonEnd:function(){c=N,(y=xo.merge(y)).length?(c.polygonStart(),Xt(y,u,l,h,c),c.polygonEnd()):s([n,t])&&(c.polygonStart(),c.lineStart(),h(null,null,1,c),c.lineEnd(),c.polygonEnd()),y=x=M=null}};return T}}function ue(n,t,e){if(na>Math.abs(t))return 0>=n;var r=n/t;if(t>0){if(r>e[1])return!1;r>e[0]&&(e[0]=r)}else{if(e[0]>r)return!1;e[1]>r&&(e[1]=r)}return!0}function oe(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function ae(n){var t=0,e=Qo/3,r=be(n),i=r(t,e);return i.parallels=function(n){return arguments.length?r(t=n[0]*Qo/180,e=n[1]*Qo/180):[180*(t/Qo),180*(e/Qo)]},i}function ce(n,t){function e(n,t){var e=Math.sqrt(u-2*i*Math.sin(t))/i;return[e*Math.sin(n*=i),o-e*Math.cos(n)]}var r=Math.sin(n),i=(r+Math.sin(t))/2,u=1+r*(2*i-r),o=Math.sqrt(u)/i;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/i,B((u-(n*n+e*e)*i*i)/(2*i))]},e}function le(){function n(n,t){Wa+=i*n-r*t,r=n,i=t}var t,e,r,i;nc.point=function(u,o){nc.point=n,t=r=u,e=i=o},nc.lineEnd=function(){n(t,e)}}function se(n,t){Ja>n&&(Ja=n),n>Ka&&(Ka=n),Ga>t&&(Ga=t),t>Qa&&(Qa=t)}function fe(){function n(n,t){o.push("M",n,",",t,u)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function i(){o.push("Z")}var u=he(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return u=he(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function he(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function ge(n,t){za+=n,La+=t,++Oa}function pe(){function n(n,r){var i=n-t,u=r-e,o=Math.sqrt(i*i+u*u);Ha+=o*(t+n)/2,Ra+=o*(e+r)/2,Pa+=o,ge(t=n,e=r)}var t,e;ec.point=function(r,i){ec.point=n,ge(t=r,e=i)}}function de(){ec.point=ge}function me(){function n(n,t){var e=n-r,u=t-i,o=Math.sqrt(e*e+u*u);Ha+=o*(r+n)/2,Ra+=o*(i+t)/2,Pa+=o,o=i*n-r*t,Ia+=o*(r+n),Ya+=o*(i+t),Ua+=3*o,ge(r=n,i=t)}var t,e,r,i;ec.point=function(u,o){ec.point=n,ge(t=r=u,e=i=o)},ec.lineEnd=function(){n(t,e)}}function ve(n){function t(t,e){n.moveTo(t,e),n.arc(t,e,o,0,2*Qo)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function i(){a.point=t}function u(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:i,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=i,a.point=t},pointRadius:function(n){return o=n,a},result:s};return a}function ye(n){function t(t){function r(e,r){e=n(e,r),t.point(e[0],e[1])}function i(){x=0/0,E.point=o,t.lineStart()}function o(r,i){var o=jt([r,i]),a=n(r,i);e(x,M,y,b,_,w,x=a[0],M=a[1],y=r,b=o[0],_=o[1],w=o[2],u,t),t.point(x,M)}function a(){E.point=r,t.lineEnd()}function c(){i(),E.point=l,E.lineEnd=s}function l(n,t){o(f=n,h=t),g=x,p=M,d=b,m=_,v=w,E.point=o}function s(){e(x,M,y,b,_,w,g,p,f,d,m,v,u,t),E.lineEnd=a,a()}var f,h,g,p,d,m,v,y,x,M,b,_,w,E={point:r,lineStart:i,lineEnd:a,polygonStart:function(){t.polygonStart(),E.lineStart=c},polygonEnd:function(){t.polygonEnd(),E.lineStart=i}};return E}function e(t,u,o,a,c,l,s,f,h,g,p,d,m,v){var y=s-t,x=f-u,M=y*y+x*x;if(M>4*r&&m--){var b=a+g,_=c+p,w=l+d,E=Math.sqrt(b*b+_*_+w*w),S=Math.asin(w/=E),k=na>Math.abs(Math.abs(w)-1)?(o+h)/2:Math.atan2(_,b),A=n(k,S),N=A[0],q=A[1],T=N-t,C=q-u,j=x*T-y*C;(j*j/M>r||Math.abs((y*T+x*C)/M-.5)>.3||i>a*g+c*p+l*d)&&(e(t,u,o,a,c,l,N,q,k,b/=E,_/=E,w,m,v),v.point(N,q),e(N,q,k,b,_,w,s,f,h,g,p,d,m,v))}}var r=.5,i=Math.cos(30*ea),u=16;return t.precision=function(n){return arguments.length?(u=(r=n*n)>0&&16,t):Math.sqrt(r)},t}function xe(n){var t=ye(function(t,e){return n([t*ra,e*ra])});return function(n){return n=t(n),{point:function(t,e){n.point(t*ea,e*ea)},sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}}function Me(n){return be(function(){return n})()}function be(n){function t(n){return n=a(n[0]*ea,n[1]*ea),[n[0]*h+c,l-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(l-n[1])/h),n&&[n[0]*ra,n[1]*ra]}function r(){a=oe(o=Ee(v,y,x),u);var n=u(d,m);return c=g-n[0]*h,l=p+n[1]*h,i()}function i(){return s&&(s.valid=!1,s=null),t}var u,o,a,c,l,s,f=ye(function(n,t){return n=u(n,t),[n[0]*h+c,l-n[1]*h]}),h=150,g=480,p=250,d=0,m=0,v=0,y=0,x=0,M=Va,b=dt,_=null,w=null;return t.stream=function(n){return s&&(s.valid=!1),s=_e(o,M(f(b(n)))),s.valid=!0,s},t.clipAngle=function(n){return arguments.length?(M=null==n?(_=n,Va):re((_=+n)*ea),i()):_},t.clipExtent=function(n){return arguments.length?(w=n,b=null==n?dt:ie(n[0][0],n[0][1],n[1][0],n[1][1]),i()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(d=n[0]%360*ea,m=n[1]%360*ea,r()):[d*ra,m*ra]},t.rotate=function(n){return arguments.length?(v=n[0]%360*ea,y=n[1]%360*ea,x=n.length>2?n[2]%360*ea:0,r()):[v*ra,y*ra,x*ra]},xo.rebind(t,f,"precision"),function(){return u=n.apply(this,arguments),t.invert=u.invert&&e,r()}}function _e(n,t){return{point:function(e,r){r=n(e*ea,r*ea),e=r[0],t.point(e>Qo?e-2*Qo:-Qo>e?e+2*Qo:e,r[1])},sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function we(n,t){return[n,t]}function Ee(n,t,e){return n?t||e?oe(ke(n),Ae(t,e)):ke(n):t||e?Ae(t,e):we}function Se(n){return function(t,e){return t+=n,[t>Qo?t-2*Qo:-Qo>t?t+2*Qo:t,e]}}function ke(n){var t=Se(n);return t.invert=Se(-n),t}function Ae(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*r+a*i;return[Math.atan2(c*u-s*o,a*r-l*i),B(s*u+c*o)]}var r=Math.cos(n),i=Math.sin(n),u=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,l=Math.sin(t),s=l*u-c*o;return[Math.atan2(c*u+l*o,a*r+s*i),B(s*r-a*i)]},e}function Ne(n,t){var e=Math.cos(n),r=Math.sin(n);return function(i,u,o,a){null!=i?(i=qe(e,i),u=qe(e,u),(o>0?u>i:i>u)&&(i+=2*o*Qo)):(i=n+2*o*Qo,u=n);for(var c,l=o*t,s=i;o>0?s>u:u>s;s-=l)a.point((c=Ht([e,-r*Math.cos(s),-r*Math.sin(s)]))[0],c[1])}}function qe(n,t){var e=jt(t);e[0]-=n,Ot(e);var r=U(-e[1]);return((0>-e[2]?-r:r)+2*Math.PI-na)%(2*Math.PI)}function Te(n,t,e){var r=xo.range(n,t-na,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function Ce(n,t,e){var r=xo.range(n,t-na,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function je(n){return n.source}function De(n){return n.target}function Fe(n,t,e,r){var i=Math.cos(t),u=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=i*Math.cos(n),l=i*Math.sin(n),s=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(Z(r-t)+i*o*Z(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*s,i=e*l+t*f,o=e*u+t*a;return[Math.atan2(i,r)*ra,Math.atan2(o,Math.sqrt(r*r+i*i))*ra]}:function(){return[n*ra,t*ra]};return p.distance=h,p}function ze(){function n(n,i){var u=Math.sin(i*=ea),o=Math.cos(i),a=Math.abs((n*=ea)-t),c=Math.cos(a);rc+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*u-e*o*c)*a),e*u+r*o*c),t=n,e=u,r=o}var t,e,r;ic.point=function(i,u){t=i*ea,e=Math.sin(u*=ea),r=Math.cos(u),ic.point=n},ic.lineEnd=function(){ic.point=ic.lineEnd=s}}function Le(n,t){function e(t,e){var r=Math.cos(t),i=Math.cos(e),u=n(r*i);return[u*i*Math.sin(t),u*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),i=t(r),u=Math.sin(i),o=Math.cos(i);return[Math.atan2(n*u,r*o),Math.asin(r&&e*u/r)]},e}function Oe(n,t){function e(n,t){var e=na>Math.abs(Math.abs(t)-Qo/2)?0:o/Math.pow(i(t),u);return[e*Math.sin(u*n),o-e*Math.cos(u*n)]}var r=Math.cos(n),i=function(n){return Math.tan(Qo/4+n/2)},u=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(i(t)/i(n)),o=r*Math.pow(i(n),u)/u;return u?(e.invert=function(n,t){var e=o-t,r=Y(u)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/u,2*Math.atan(Math.pow(o/r,1/u))-Qo/2]},e):Re}function He(n,t){function e(n,t){var e=u-t;return[e*Math.sin(i*n),u-e*Math.cos(i*n)]}var r=Math.cos(n),i=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),u=r/i+n;return na>Math.abs(i)?we:(e.invert=function(n,t){var e=u-t;return[Math.atan2(n,e)/i,u-Y(i)*Math.sqrt(n*n+e*e)]},e)}function Re(n,t){return[n,Math.log(Math.tan(Qo/4+t/2))]}function Pe(n){var t,e=Me(n),r=e.scale,i=e.translate,u=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=i.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=u.apply(e,arguments);if(o===e){if(t=null==n){var a=Qo*r(),c=i();u([[c[0]-a,c[1]-a],[c[0]+a,c[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function Ie(n,t){var e=Math.cos(t)*Math.sin(n);return[Math.log((1+e)/(1-e))/2,Math.atan2(Math.tan(t),Math.cos(n))]}function Ye(n){function t(t){function o(){l.push("M",u(n(s),a))}for(var c,l=[],s=[],f=-1,h=t.length,g=pt(e),p=pt(r);h>++f;)i.call(this,c=t[f],f)?s.push([+g.call(this,c,f),+p.call(this,c,f)]):s.length&&(o(),s=[]);return s.length&&o(),l.length?l.join(""):null}var e=Ue,r=Be,i=Vt,u=Ve,o=u.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(i=n,t):i},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?u=n:(u=sc.get(n)||Ve).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function Ue(n){return n[0]}function Be(n){return n[1]}function Ve(n){return n.join("L")}function Xe(n){return Ve(n)+"Z"}function Ze(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];e>++t;)i.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&i.push("H",r[0]),i.join("")}function $e(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];e>++t;)i.push("V",(r=n[t])[1],"H",r[0]);return i.join("")}function We(n){for(var t=0,e=n.length,r=n[0],i=[r[0],",",r[1]];e>++t;)i.push("H",(r=n[t])[0],"V",r[1]);return i.join("")}function Je(n,t){return 4>n.length?Ve(n):n[1]+Qe(n.slice(1,n.length-1),nr(n,t))}function Ge(n,t){return 3>n.length?Ve(n):n[0]+Qe((n.push(n[0]),n),nr([n[n.length-2]].concat(n,[n[1]]),t))}function Ke(n,t){return 3>n.length?Ve(n):n[0]+Qe(n,nr(n,t))}function Qe(n,t){if(1>t.length||n.length!=t.length&&n.length!=t.length+2)return Ve(n);var e=n.length!=t.length,r="",i=n[0],u=n[1],o=t[0],a=o,c=1;if(e&&(r+="Q"+(u[0]-2*o[0]/3)+","+(u[1]-2*o[1]/3)+","+u[0]+","+u[1],i=n[1],c=2),t.length>1){a=t[1],u=n[c],c++,r+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1];for(var l=2;t.length>l;l++,c++)u=n[c],a=t[l],r+="S"+(u[0]-a[0])+","+(u[1]-a[1])+","+u[0]+","+u[1]
}if(e){var s=n[c];r+="Q"+(u[0]+2*a[0]/3)+","+(u[1]+2*a[1]/3)+","+s[0]+","+s[1]}return r}function nr(n,t){for(var e,r=[],i=(1-t)/2,u=n[0],o=n[1],a=1,c=n.length;c>++a;)e=u,u=o,o=n[a],r.push([i*(o[0]-e[0]),i*(o[1]-e[1])]);return r}function tr(n){if(3>n.length)return Ve(n);var t=1,e=n.length,r=n[0],i=r[0],u=r[1],o=[i,i,i,(r=n[1])[0]],a=[u,u,u,r[1]],c=[i,",",u,"L",ur(gc,o),",",ur(gc,a)];for(n.push(n[e-1]);e>=++t;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),or(c,o,a);return n.pop(),c.push("L",r),c.join("")}function er(n){if(4>n.length)return Ve(n);for(var t,e=[],r=-1,i=n.length,u=[0],o=[0];3>++r;)t=n[r],u.push(t[0]),o.push(t[1]);for(e.push(ur(gc,u)+","+ur(gc,o)),--r;i>++r;)t=n[r],u.shift(),u.push(t[0]),o.shift(),o.push(t[1]),or(e,u,o);return e.join("")}function rr(n){for(var t,e,r=-1,i=n.length,u=i+4,o=[],a=[];4>++r;)e=n[r%i],o.push(e[0]),a.push(e[1]);for(t=[ur(gc,o),",",ur(gc,a)],--r;u>++r;)e=n[r%i],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),or(t,o,a);return t.join("")}function ir(n,t){var e=n.length-1;if(e)for(var r,i,u=n[0][0],o=n[0][1],a=n[e][0]-u,c=n[e][1]-o,l=-1;e>=++l;)r=n[l],i=l/e,r[0]=t*r[0]+(1-t)*(u+i*a),r[1]=t*r[1]+(1-t)*(o+i*c);return tr(n)}function ur(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function or(n,t,e){n.push("C",ur(fc,t),",",ur(fc,e),",",ur(hc,t),",",ur(hc,e),",",ur(gc,t),",",ur(gc,e))}function ar(n,t){return(t[1]-n[1])/(t[0]-n[0])}function cr(n){for(var t=0,e=n.length-1,r=[],i=n[0],u=n[1],o=r[0]=ar(i,u);e>++t;)r[t]=(o+(o=ar(i=u,u=n[t+1])))/2;return r[t]=o,r}function lr(n){for(var t,e,r,i,u=[],o=cr(n),a=-1,c=n.length-1;c>++a;)t=ar(n[a],n[a+1]),1e-6>Math.abs(t)?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,i=e*e+r*r,i>9&&(i=3*t/Math.sqrt(i),o[a]=i*e,o[a+1]=i*r));for(a=-1;c>=++a;)i=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),u.push([i||0,o[a]*i||0]);return u}function sr(n){return 3>n.length?Ve(n):n[0]+Qe(n,lr(n))}function fr(n,t,e,r){var i,u,o,a,c,l,s;return i=r[n],u=i[0],o=i[1],i=r[t],a=i[0],c=i[1],i=r[e],l=i[0],s=i[1],(s-o)*(a-u)-(c-o)*(l-u)>0}function hr(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function gr(n,t,e,r){var i=n[0],u=e[0],o=t[0]-i,a=r[0]-u,c=n[1],l=e[1],s=t[1]-c,f=r[1]-l,h=(a*(c-l)-f*(i-u))/(f*o-a*s);return[i+h*o,c+h*s]}function pr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function dr(n,t){var e={list:n.map(function(n,t){return{index:t,x:n[0],y:n[1]}}).sort(function(n,t){return n.y<t.y?-1:n.y>t.y?1:n.x<t.x?-1:n.x>t.x?1:0}),bottomSite:null},r={list:[],leftEnd:null,rightEnd:null,init:function(){r.leftEnd=r.createHalfEdge(null,"l"),r.rightEnd=r.createHalfEdge(null,"l"),r.leftEnd.r=r.rightEnd,r.rightEnd.l=r.leftEnd,r.list.unshift(r.leftEnd,r.rightEnd)},createHalfEdge:function(n,t){return{edge:n,side:t,vertex:null,l:null,r:null}},insert:function(n,t){t.l=n,t.r=n.r,n.r.l=t,n.r=t},leftBound:function(n){var t=r.leftEnd;do t=t.r;while(t!=r.rightEnd&&i.rightOf(t,n));return t=t.l},del:function(n){n.l.r=n.r,n.r.l=n.l,n.edge=null},right:function(n){return n.r},left:function(n){return n.l},leftRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[n.side]},rightRegion:function(n){return null==n.edge?e.bottomSite:n.edge.region[dc[n.side]]}},i={bisect:function(n,t){var e={region:{l:n,r:t},ep:{l:null,r:null}},r=t.x-n.x,i=t.y-n.y,u=r>0?r:-r,o=i>0?i:-i;return e.c=n.x*r+n.y*i+.5*(r*r+i*i),u>o?(e.a=1,e.b=i/r,e.c/=r):(e.b=1,e.a=r/i,e.c/=i),e},intersect:function(n,t){var e=n.edge,r=t.edge;if(!e||!r||e.region.r==r.region.r)return null;var i=e.a*r.b-e.b*r.a;if(1e-10>Math.abs(i))return null;var u,o,a=(e.c*r.b-r.c*e.b)/i,c=(r.c*e.a-e.c*r.a)/i,l=e.region.r,s=r.region.r;l.y<s.y||l.y==s.y&&l.x<s.x?(u=n,o=e):(u=t,o=r);var f=a>=o.region.r.x;return f&&"l"===u.side||!f&&"r"===u.side?null:{x:a,y:c}},rightOf:function(n,t){var e=n.edge,r=e.region.r,i=t.x>r.x;if(i&&"l"===n.side)return 1;if(!i&&"r"===n.side)return 0;if(1===e.a){var u=t.y-r.y,o=t.x-r.x,a=0,c=0;if(!i&&0>e.b||i&&e.b>=0?c=a=u>=e.b*o:(c=t.x+t.y*e.b>e.c,0>e.b&&(c=!c),c||(a=1)),!a){var l=r.x-e.region.l.x;c=e.b*(o*o-u*u)<l*u*(1+2*o/l+e.b*e.b),0>e.b&&(c=!c)}}else{var s=e.c-e.a*t.x,f=t.y-s,h=t.x-r.x,g=s-r.y;c=f*f>h*h+g*g}return"l"===n.side?c:!c},endPoint:function(n,e,r){n.ep[e]=r,n.ep[dc[e]]&&t(n)},distance:function(n,t){var e=n.x-t.x,r=n.y-t.y;return Math.sqrt(e*e+r*r)}},u={list:[],insert:function(n,t,e){n.vertex=t,n.ystar=t.y+e;for(var r=0,i=u.list,o=i.length;o>r;r++){var a=i[r];if(!(n.ystar>a.ystar||n.ystar==a.ystar&&t.x>a.vertex.x))break}i.splice(r,0,n)},del:function(n){for(var t=0,e=u.list,r=e.length;r>t&&e[t]!=n;++t);e.splice(t,1)},empty:function(){return 0===u.list.length},nextEvent:function(n){for(var t=0,e=u.list,r=e.length;r>t;++t)if(e[t]==n)return e[t+1];return null},min:function(){var n=u.list[0];return{x:n.vertex.x,y:n.ystar}},extractMin:function(){return u.list.shift()}};r.init(),e.bottomSite=e.list.shift();for(var o,a,c,l,s,f,h,g,p,d,m,v,y,x=e.list.shift();;)if(u.empty()||(o=u.min()),x&&(u.empty()||x.y<o.y||x.y==o.y&&x.x<o.x))a=r.leftBound(x),c=r.right(a),h=r.rightRegion(a),v=i.bisect(h,x),f=r.createHalfEdge(v,"l"),r.insert(a,f),d=i.intersect(a,f),d&&(u.del(a),u.insert(a,d,i.distance(d,x))),a=f,f=r.createHalfEdge(v,"r"),r.insert(a,f),d=i.intersect(f,c),d&&u.insert(f,d,i.distance(d,x)),x=e.list.shift();else{if(u.empty())break;a=u.extractMin(),l=r.left(a),c=r.right(a),s=r.right(c),h=r.leftRegion(a),g=r.rightRegion(c),m=a.vertex,i.endPoint(a.edge,a.side,m),i.endPoint(c.edge,c.side,m),r.del(a),u.del(c),r.del(c),y="l",h.y>g.y&&(p=h,h=g,g=p,y="r"),v=i.bisect(h,g),f=r.createHalfEdge(v,y),r.insert(l,f),i.endPoint(v,dc[y],m),d=i.intersect(l,f),d&&(u.del(l),u.insert(l,d,i.distance(d,h))),d=i.intersect(f,s),d&&u.insert(f,d,i.distance(d,h))}for(a=r.right(r.leftEnd);a!=r.rightEnd;a=r.right(a))t(a.edge)}function mr(n){return n.x}function vr(n){return n.y}function yr(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function xr(n,t,e,r,i,u){if(!n(t,e,r,i,u)){var o=.5*(e+i),a=.5*(r+u),c=t.nodes;c[0]&&xr(n,c[0],e,r,o,a),c[1]&&xr(n,c[1],o,r,i,a),c[2]&&xr(n,c[2],e,a,o,u),c[3]&&xr(n,c[3],o,a,i,u)}}function Mr(n,t){n=xo.rgb(n),t=xo.rgb(t);var e=n.r,r=n.g,i=n.b,u=t.r-e,o=t.g-r,a=t.b-i;return function(n){return"#"+ct(Math.round(e+u*n))+ct(Math.round(r+o*n))+ct(Math.round(i+a*n))}}function br(n,t){var e,r={},i={};for(e in n)e in t?r[e]=Er(n[e],t[e]):i[e]=n[e];for(e in t)e in n||(i[e]=t[e]);return function(n){for(e in r)i[e]=r[e](n);return i}}function _r(n,t){return t-=n=+n,function(e){return n+t*e}}function wr(n,t){var e,r,i,u,o,a=0,c=0,l=[],s=[];for(n+="",t+="",mc.lastIndex=0,r=0;e=mc.exec(t);++r)e.index&&l.push(t.substring(a,c=e.index)),s.push({i:l.length,x:e[0]}),l.push(null),a=mc.lastIndex;for(t.length>a&&l.push(t.substring(a)),r=0,u=s.length;(e=mc.exec(n))&&u>r;++r)if(o=s[r],o.x==e[0]){if(o.i)if(null==l[o.i+1])for(l[o.i-1]+=o.x,l.splice(o.i,1),i=r+1;u>i;++i)s[i].i--;else for(l[o.i-1]+=o.x+l[o.i+1],l.splice(o.i,2),i=r+1;u>i;++i)s[i].i-=2;else if(null==l[o.i+1])l[o.i]=o.x;else for(l[o.i]=o.x+l[o.i+1],l.splice(o.i+1,1),i=r+1;u>i;++i)s[i].i--;s.splice(r,1),u--,r--}else o.x=_r(parseFloat(e[0]),parseFloat(o.x));for(;u>r;)o=s.pop(),null==l[o.i+1]?l[o.i]=o.x:(l[o.i]=o.x+l[o.i+1],l.splice(o.i+1,1)),u--;return 1===l.length?null==l[0]?(o=s[0].x,function(n){return o(n)+""}):function(){return t}:function(n){for(r=0;u>r;++r)l[(o=s[r]).i]=o.x(n);return l.join("")}}function Er(n,t){for(var e,r=xo.interpolators.length;--r>=0&&!(e=xo.interpolators[r](n,t)););return e}function Sr(n,t){var e,r=[],i=[],u=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(Er(n[e],t[e]));for(;u>e;++e)i[e]=n[e];for(;o>e;++e)i[e]=t[e];return function(n){for(e=0;a>e;++e)i[e]=r[e](n);return i}}function kr(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function Ar(n){return function(t){return 1-n(1-t)}}function Nr(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function qr(n){return n*n}function Tr(n){return n*n*n}function Cr(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function jr(n){return function(t){return Math.pow(t,n)}}function Dr(n){return 1-Math.cos(n*Qo/2)}function Fr(n){return Math.pow(2,10*(n-1))}function zr(n){return 1-Math.sqrt(1-n*n)}function Lr(n,t){var e;return 2>arguments.length&&(t=.45),arguments.length?e=t/(2*Qo)*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,10*-r)*Math.sin(2*(r-e)*Qo/t)}}function Or(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function Hr(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Rr(n,t){n=xo.hcl(n),t=xo.hcl(t);var e=n.h,r=n.c,i=n.l,u=t.h-e,o=t.c-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return J(e+u*n,r+o*n,i+a*n)+""}}function Pr(n,t){n=xo.hsl(n),t=xo.hsl(t);var e=n.h,r=n.s,i=n.l,u=t.h-e,o=t.s-r,a=t.l-i;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(u)?(u=0,e=isNaN(e)?t.h:e):u>180?u-=360:-180>u&&(u+=360),function(n){return I(e+u*n,r+o*n,i+a*n)+""}}function Ir(n,t){n=xo.lab(n),t=xo.lab(t);var e=n.l,r=n.a,i=n.b,u=t.l-e,o=t.a-r,a=t.b-i;return function(n){return Q(e+u*n,r+o*n,i+a*n)+""}}function Yr(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Ur(n){var t=[n.a,n.b],e=[n.c,n.d],r=Vr(t),i=Br(t,e),u=Vr(Xr(e,t,-i))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,i*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*ra,this.translate=[n.e,n.f],this.scale=[r,u],this.skew=u?Math.atan2(i,u)*ra:0}function Br(n,t){return n[0]*t[0]+n[1]*t[1]}function Vr(n){var t=Math.sqrt(Br(n,n));return t&&(n[0]/=t,n[1]/=t),t}function Xr(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Zr(n,t){var e,r=[],i=[],u=xo.transform(n),o=xo.transform(t),a=u.translate,c=o.translate,l=u.rotate,s=o.rotate,f=u.skew,h=o.skew,g=u.scale,p=o.scale;return a[0]!=c[0]||a[1]!=c[1]?(r.push("translate(",null,",",null,")"),i.push({i:1,x:_r(a[0],c[0])},{i:3,x:_r(a[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),l!=s?(l-s>180?s+=360:s-l>180&&(l+=360),i.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:_r(l,s)})):s&&r.push(r.pop()+"rotate("+s+")"),f!=h?i.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:_r(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),i.push({i:e-4,x:_r(g[0],p[0])},{i:e-2,x:_r(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=i.length,function(n){for(var t,u=-1;e>++u;)r[(t=i[u]).i]=t.x(n);return r.join("")}}function $r(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return(e-n)*t}}function Wr(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return Math.max(0,Math.min(1,(e-n)*t))}}function Jr(n){for(var t=n.source,e=n.target,r=Kr(t,e),i=[t];t!==r;)t=t.parent,i.push(t);for(var u=i.length;e!==r;)i.splice(u,0,e),e=e.parent;return i}function Gr(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Kr(n,t){if(n===t)return n;for(var e=Gr(n),r=Gr(t),i=e.pop(),u=r.pop(),o=null;i===u;)o=i,i=e.pop(),u=r.pop();return o}function Qr(n){n.fixed|=2}function ni(n){n.fixed&=-7}function ti(n){n.fixed|=4,n.px=n.x,n.py=n.y}function ei(n){n.fixed&=-5}function ri(n,t,e){var r=0,i=0;if(n.charge=0,!n.leaf)for(var u,o=n.nodes,a=o.length,c=-1;a>++c;)u=o[c],null!=u&&(ri(u,t,e),n.charge+=u.charge,r+=u.charge*u.cx,i+=u.charge*u.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var l=t*e[n.point.index];n.charge+=n.pointCharge=l,r+=l*n.point.x,i+=l*n.point.y}n.cx=r/n.charge,n.cy=i/n.charge}function ii(n,t){return xo.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=ci,n}function ui(n){return n.children}function oi(n){return n.value}function ai(n,t){return t.value-n.value}function ci(n){return xo.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function li(n){return n.x}function si(n){return n.y}function fi(n,t,e){n.y0=t,n.y=e}function hi(n){return xo.range(n.length)}function gi(n){for(var t=-1,e=n[0].length,r=[];e>++t;)r[t]=0;return r}function pi(n){for(var t,e=1,r=0,i=n[0][1],u=n.length;u>e;++e)(t=n[e][1])>i&&(r=e,i=t);return r}function di(n){return n.reduce(mi,0)}function mi(n,t){return n+t[1]}function vi(n,t){return yi(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function yi(n,t){for(var e=-1,r=+n[0],i=(n[1]-r)/t,u=[];t>=++e;)u[e]=i*e+r;return u}function xi(n){return[xo.min(n),xo.max(n)]}function Mi(n,t){return n.parent==t.parent?1:2}function bi(n){var t=n.children;return t&&t.length?t[0]:n._tree.thread}function _i(n){var t,e=n.children;return e&&(t=e.length)?e[t-1]:n._tree.thread}function wi(n,t){var e=n.children;if(e&&(i=e.length))for(var r,i,u=-1;i>++u;)t(r=wi(e[u],t),n)>0&&(n=r);return n}function Ei(n,t){return n.x-t.x}function Si(n,t){return t.x-n.x}function ki(n,t){return n.depth-t.depth}function Ai(n,t){function e(n,r){var i=n.children;if(i&&(o=i.length))for(var u,o,a=null,c=-1;o>++c;)u=i[c],e(u,a),a=u;t(n,r)}e(n,null)}function Ni(n){for(var t,e=0,r=0,i=n.children,u=i.length;--u>=0;)t=i[u]._tree,t.prelim+=e,t.mod+=e,e+=t.shift+(r+=t.change)}function qi(n,t,e){n=n._tree,t=t._tree;var r=e/(t.number-n.number);n.change+=r,t.change-=r,t.shift+=e,t.prelim+=e,t.mod+=e}function Ti(n,t,e){return n._tree.ancestor.parent==t.parent?n._tree.ancestor:e}function Ci(n,t){return n.value-t.value}function ji(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Di(n,t){n._pack_next=t,t._pack_prev=n}function Fi(n,t){var e=t.x-n.x,r=t.y-n.y,i=n.r+t.r;return.999*i*i>e*e+r*r}function zi(n){function t(n){s=Math.min(n.x-n.r,s),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(l=e.length)){var e,r,i,u,o,a,c,l,s=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(Li),r=e[0],r.x=-r.r,r.y=0,t(r),l>1&&(i=e[1],i.x=i.r,i.y=0,t(i),l>2))for(u=e[2],Ri(r,i,u),t(u),ji(r,u),r._pack_prev=u,ji(u,i),i=r._pack_next,o=3;l>o;o++){Ri(r,i,u=e[o]);var p=0,d=1,m=1;for(a=i._pack_next;a!==i;a=a._pack_next,d++)if(Fi(a,u)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!Fi(c,u);c=c._pack_prev,m++);p?(m>d||d==m&&i.r<r.r?Di(r,i=a):Di(r=c,i),o--):(ji(r,u),i=u,t(u))}var v=(s+f)/2,y=(h+g)/2,x=0;for(o=0;l>o;o++)u=e[o],u.x-=v,u.y-=y,x=Math.max(x,u.r+Math.sqrt(u.x*u.x+u.y*u.y));n.r=x,e.forEach(Oi)}}function Li(n){n._pack_next=n._pack_prev=n}function Oi(n){delete n._pack_next,delete n._pack_prev}function Hi(n,t,e,r){var i=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,i)for(var u=-1,o=i.length;o>++u;)Hi(i[u],t,e,r)}function Ri(n,t,e){var r=n.r+e.r,i=t.x-n.x,u=t.y-n.y;if(r&&(i||u)){var o=t.r+e.r,a=i*i+u*u;o*=o,r*=r;var c=.5+(r-o)/(2*a),l=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+c*i+l*u,e.y=n.y+c*u-l*i}else e.x=n.x+r,e.y=n.y}function Pi(n){return 1+xo.max(n,function(n){return n.y})}function Ii(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Yi(n){var t=n.children;return t&&t.length?Yi(t[0]):n}function Ui(n){var t,e=n.children;return e&&(t=e.length)?Ui(e[t-1]):n}function Bi(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function Vi(n,t){var e=n.x+t[3],r=n.y+t[0],i=n.dx-t[1]-t[3],u=n.dy-t[0]-t[2];return 0>i&&(e+=i/2,i=0),0>u&&(r+=u/2,u=0),{x:e,y:r,dx:i,dy:u}}function Xi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Zi(n){return n.rangeExtent?n.rangeExtent():Xi(n.range())}function $i(n,t,e,r){var i=e(n[0],n[1]),u=r(t[0],t[1]);return function(n){return u(i(n))}}function Wi(n,t){var e,r=0,i=n.length-1,u=n[r],o=n[i];return u>o&&(e=r,r=i,i=e,e=u,u=o,o=e),n[r]=t.floor(u),n[i]=t.ceil(o),n}function Ji(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:kc}function Gi(n,t,e,r){var i=[],u=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());a>=++o;)i.push(e(n[o-1],n[o])),u.push(r(t[o-1],t[o]));return function(t){var e=xo.bisect(n,t,1,a)-1;return u[e](i[e](t))}}function Ki(n,t,e,r){function i(){var i=Math.min(n.length,t.length)>2?Gi:$i,c=r?Wr:$r;return o=i(n,t,c,e),a=i(t,n,c,Er),u}function u(n){return o(n)}var o,a;return u.invert=function(n){return a(n)},u.domain=function(t){return arguments.length?(n=t.map(Number),i()):n},u.range=function(n){return arguments.length?(t=n,i()):t},u.rangeRound=function(n){return u.range(n).interpolate(Yr)},u.clamp=function(n){return arguments.length?(r=n,i()):r},u.interpolate=function(n){return arguments.length?(e=n,i()):e},u.ticks=function(t){return ru(n,t)},u.tickFormat=function(t,e){return iu(n,t,e)},u.nice=function(t){return nu(n,t),i()},u.copy=function(){return Ki(n,t,e,r)},i()}function Qi(n,t){return xo.rebind(n,t,"range","rangeRound","interpolate","clamp")}function nu(n,t){return Wi(n,Ji(t?eu(n,t)[2]:tu(n)))}function tu(n){var t=Xi(n),e=t[1]-t[0];return Math.pow(10,Math.round(Math.log(e)/Math.LN10)-1)}function eu(n,t){var e=Xi(n),r=e[1]-e[0],i=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),u=t/r*i;return.15>=u?i*=10:.35>=u?i*=5:.75>=u&&(i*=2),e[0]=Math.ceil(e[0]/i)*i,e[1]=Math.floor(e[1]/i)*i+.5*i,e[2]=i,e}function ru(n,t){return xo.range.apply(xo,eu(n,t))}function iu(n,t,e){var r=-Math.floor(Math.log(eu(n,t)[2])/Math.LN10+.01);return xo.format(e?e.replace(wa,function(n,t,e,i,u,o,a,c,l,s){return[t,e,i,u,o,a,c,l||"."+(r-2*("%"===s)),s].join("")}):",."+r+"f")}function uu(n,t,e,r){function i(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function u(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(i(t))}return o.invert=function(t){return u(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(i)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(i)),o):t},o.nice=function(){var t=Wi(r.map(i),e?Math:Nc);return n.domain(t),r=t.map(u),o},o.ticks=function(){var n=Xi(r),o=[];if(n.every(isFinite)){var a=n[0],c=n[1],l=Math.floor(i(a)),s=Math.ceil(i(c)),f=t%1?2:t;if(e){for(;s>l;l++)for(var h=1;f>h;h++)o.push(u(l)*h);o.push(u(l))}else for(o.push(u(l));s>l++;)for(var h=f-1;h>0;h--)o.push(u(l)*h);for(l=0;a>o[l];l++);for(s=o.length;o[s-1]>c;s--);o=o.slice(l,s)}return o},o.tickFormat=function(n,t){if(!arguments.length)return Ac;2>arguments.length?t=Ac:"function"!=typeof t&&(t=xo.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return a>=n/u(c(i(n)+r))?t(n):""}},o.copy=function(){return uu(n.copy(),t,e,r)},Qi(o,n)}function ou(n,t,e){function r(t){return n(i(t))}var i=au(t),u=au(1/t);return r.invert=function(t){return u(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(i)),r):e},r.ticks=function(n){return ru(e,n)},r.tickFormat=function(n,t){return iu(e,n,t)},r.nice=function(n){return r.domain(nu(e,n))},r.exponent=function(o){return arguments.length?(i=au(t=o),u=au(1/t),n.domain(e.map(i)),r):t},r.copy=function(){return ou(n.copy(),t,e)},Qi(r,n)}function au(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function cu(n,t){function e(t){return o[((u.get(t)||u.set(t,n.push(t)))-1)%o.length]}function r(t,e){return xo.range(n.length).map(function(n){return t+e*n})}var u,o,a;return e.domain=function(r){if(!arguments.length)return n;n=[],u=new i;for(var o,a=-1,c=r.length;c>++a;)u.has(o=r[a])||u.set(o,n.push(o));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(o=n,a=0,t={t:"range",a:arguments},e):o},e.rangePoints=function(i,u){2>arguments.length&&(u=0);var c=i[0],l=i[1],s=(l-c)/(Math.max(1,n.length-1)+u);return o=r(2>n.length?(c+l)/2:c+s*u/2,s),a=0,t={t:"rangePoints",a:arguments},e},e.rangeBands=function(i,u,c){2>arguments.length&&(u=0),3>arguments.length&&(c=u);var l=i[1]<i[0],s=i[l-0],f=i[1-l],h=(f-s)/(n.length-u+2*c);return o=r(s+h*c,h),l&&o.reverse(),a=h*(1-u),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(i,u,c){2>arguments.length&&(u=0),3>arguments.length&&(c=u);var l=i[1]<i[0],s=i[l-0],f=i[1-l],h=Math.floor((f-s)/(n.length-u+2*c)),g=f-s-(n.length-u)*h;return o=r(s+Math.round(g/2),h),l&&o.reverse(),a=Math.round(h*(1-u)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return a},e.rangeExtent=function(){return Xi(t.a[0])},e.copy=function(){return cu(n,t)},e.domain(n)}function lu(n,t){function e(){var e=0,u=t.length;for(i=[];u>++e;)i[e-1]=xo.quantile(n,e/u);return r}function r(n){return isNaN(n=+n)?void 0:t[xo.bisect(i,n)]}var i;return r.domain=function(t){return arguments.length?(n=t.filter(function(n){return!isNaN(n)}).sort(xo.ascending),e()):n},r.range=function(n){return arguments.length?(t=n,e()):t},r.quantiles=function(){return i},r.invertExtent=function(e){return e=t.indexOf(e),0>e?[0/0,0/0]:[e>0?i[e-1]:n[0],i.length>e?i[e]:n[n.length-1]]},r.copy=function(){return lu(n,t)},e()}function su(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(u*(t-n))))]}function i(){return u=e.length/(t-n),o=e.length-1,r}var u,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],i()):[n,t]},r.range=function(n){return arguments.length?(e=n,i()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/u+n,[t,t+1/u]},r.copy=function(){return su(n,t,e)},i()}function fu(n,t){function e(e){return e>=e?t[xo.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return fu(n,t)},e}function hu(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return ru(n,t)},t.tickFormat=function(t,e){return iu(n,t,e)},t.copy=function(){return hu(n)},t}function gu(n){return n.innerRadius}function pu(n){return n.outerRadius}function du(n){return n.startAngle}function mu(n){return n.endAngle}function vu(n){for(var t,e,r,i=-1,u=n.length;u>++i;)t=n[i],e=t[0],r=t[1]+Dc,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function yu(n){function t(t){function c(){d.push("M",a(n(v),f),s,l(n(m.reverse()),f),"Z")}for(var h,g,p,d=[],m=[],v=[],y=-1,x=t.length,M=pt(e),b=pt(i),_=e===r?function(){return g}:pt(r),w=i===u?function(){return p}:pt(u);x>++y;)o.call(this,h=t[y],y)?(m.push([g=+M.call(this,h,y),p=+b.call(this,h,y)]),v.push([+_.call(this,h,y),+w.call(this,h,y)])):m.length&&(c(),m=[],v=[]);return m.length&&c(),d.length?d.join(""):null}var e=Ue,r=Ue,i=0,u=Be,o=Vt,a=Ve,c=a.key,l=a,s="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(i=u=n,t):u},t.y0=function(n){return arguments.length?(i=n,t):i},t.y1=function(n){return arguments.length?(u=n,t):u},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?a=n:(a=sc.get(n)||Ve).key,l=a.reverse||a,s=a.closed?"M":"L",t):c},t.tension=function(n){return arguments.length?(f=n,t):f},t}function xu(n){return n.radius}function Mu(n){return[n.x,n.y]}function bu(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]+Dc;return[e*Math.cos(r),e*Math.sin(r)]}}function _u(){return 64}function wu(){return"circle"}function Eu(n){var t=Math.sqrt(n/Qo);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Su(n,t){return Lo(n,Pc),n.id=t,n}function ku(n,t,e,r){var i=n.id;return T(n,"function"==typeof e?function(n,u,o){n.__transition__[i].tween.set(t,r(e.call(n,n.__data__,u,o)))}:(e=r(e),function(n){n.__transition__[i].tween.set(t,e)}))}function Au(n){return null==n&&(n=""),function(){this.textContent=n}}function Nu(n,t,e,r){var u=n.__transition__||(n.__transition__={active:0,count:0}),o=u[e];if(!o){var a=r.time;o=u[e]={tween:new i,time:a,ease:r.ease,delay:r.delay,duration:r.duration},++u.count,xo.timer(function(r){function i(r){return u.active>e?l():(u.active=e,o.event&&o.event.start.call(n,s,t),o.tween.forEach(function(e,r){(r=r.call(n,s,t))&&p.push(r)}),c(r)?1:(Mt(c,0,a),void 0))}function c(r){if(u.active!==e)return l();for(var i=(r-h)/g,a=f(i),c=p.length;c>0;)p[--c].call(n,a);return i>=1?(l(),o.event&&o.event.end.call(n,s,t),1):void 0}function l(){return--u.count?delete u[e]:delete n.__transition__,1}var s=n.__data__,f=o.ease,h=o.delay,g=o.duration,p=[];return r>=h?i(r):(Mt(i,h,a),void 0)},0,a)}}function qu(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function Tu(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function Cu(n,t,e){if(r=[],e&&t.length>1){for(var r,i,u,o=Xi(n.domain()),a=-1,c=t.length,l=(t[1]-t[0])/++e;c>++a;)for(i=e;--i>0;)(u=+t[a]-i*l)>=o[0]&&r.push(u);for(--a,i=0;e>++i&&(u=+t[a]+i*l)<o[1];)r.push(u)}return r}function ju(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Du(n,t,e){function r(t){var e=n(t),r=u(e,1);return r-t>t-e?e:r}function i(e){return t(e=n(new Xc(e-1)),1),e}function u(n,e){return t(n=new Xc(+n),e),n}function o(n,r,u){var o=i(n),a=[];if(u>1)for(;r>o;)e(o)%u||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{Xc=ju;var r=new ju;return r._=n,o(r,t,e)}finally{Xc=Date}}n.floor=n,n.round=r,n.ceil=i,n.offset=u,n.range=o;var c=n.utc=Fu(n);return c.floor=c,c.round=Fu(r),c.ceil=Fu(i),c.offset=Fu(u),c.range=a,n}function Fu(n){return function(t,e){try{Xc=ju;var r=new ju;return r._=t,n(r,e)._}finally{Xc=Date}}}function zu(n,t,e,r){for(var i,u,o=0,a=t.length,c=e.length;a>o;){if(r>=c)return-1;if(i=t.charCodeAt(o++),37===i){if(u=gl[t.charAt(o++)],!u||0>(r=u(n,e,r)))return-1}else if(i!=e.charCodeAt(r++))return-1}return r}function Lu(n){return RegExp("^(?:"+n.map(xo.requote).join("|")+")","i")}function Ou(n){for(var t=new i,e=-1,r=n.length;r>++e;)t.set(n[e].toLowerCase(),e);return t}function Hu(n,t,e){var r=0>n?"-":"",i=(r?-n:n)+"",u=i.length;return r+(e>u?Array(e-u+1).join(t)+i:i)}function Ru(n,t,e){il.lastIndex=0;var r=il.exec(t.substring(e));return r?(n.w=ul.get(r[0].toLowerCase()),e+r[0].length):-1}function Pu(n,t,e){el.lastIndex=0;var r=el.exec(t.substring(e));return r?(n.w=rl.get(r[0].toLowerCase()),e+r[0].length):-1}function Iu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Yu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e));return r?(n.U=+r[0],e+r[0].length):-1}function Uu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e));return r?(n.W=+r[0],e+r[0].length):-1}function Bu(n,t,e){cl.lastIndex=0;var r=cl.exec(t.substring(e));return r?(n.m=ll.get(r[0].toLowerCase()),e+r[0].length):-1}function Vu(n,t,e){ol.lastIndex=0;var r=ol.exec(t.substring(e));return r?(n.m=al.get(r[0].toLowerCase()),e+r[0].length):-1}function Xu(n,t,e){return zu(n,""+hl.c,t,e)}function Zu(n,t,e){return zu(n,""+hl.x,t,e)}function $u(n,t,e){return zu(n,""+hl.X,t,e)}function Wu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Ju(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.y=Gu(+r[0]),e+r[0].length):-1}function Gu(n){return n+(n>68?1900:2e3)}function Ku(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Qu(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function no(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function to(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function eo(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function ro(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function io(n,t,e){pl.lastIndex=0;var r=pl.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function uo(n,t,e){var r=dl.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}function oo(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=~~(Math.abs(t)/60),i=Math.abs(t)%60;return e+Hu(r,"0",2)+Hu(i,"0",2)}function ao(n,t,e){sl.lastIndex=0;var r=sl.exec(t.substring(e,e+1));return r?e+r[0].length:-1}function co(n){return n.toISOString()}function lo(n,t,e){function r(t){return n(t)}return r.invert=function(t){return so(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(so)},r.nice=function(n){return r.domain(Wi(r.domain(),n))},r.ticks=function(e,i){var u=Xi(r.domain());if("function"!=typeof e){var o=u[1]-u[0],a=o/e,c=xo.bisect(vl,a);if(c==vl.length)return t.year(u,e);if(!c)return n.ticks(e).map(so);a/vl[c-1]<vl[c]/a&&--c,e=t[c],i=e[1],e=e[0].range}return e(u[0],new Date(+u[1]+1),i)},r.tickFormat=function(){return e},r.copy=function(){return lo(n.copy(),t,e)},Qi(r,n)}function so(n){return new Date(n)}function fo(n){return function(t){for(var e=n.length-1,r=n[e];!r[1](t);)r=n[--e];return r[0](t)}}function ho(n){var t=new Date(n,0,1);return t.setFullYear(n),t}function go(n){var t=n.getFullYear(),e=ho(t),r=ho(t+1);return t+(n-e)/(r-e)}function po(n){var t=new Date(Date.UTC(n,0,1));return t.setUTCFullYear(n),t}function mo(n){var t=n.getUTCFullYear(),e=po(t),r=po(t+1);return t+(n-e)/(r-e)}function vo(n){return JSON.parse(n.responseText)}function yo(n){var t=Mo.createRange();return t.selectNode(Mo.body),t.createContextualFragment(n.responseText)}var xo={version:"3.2.7"};Date.now||(Date.now=function(){return+new Date});var Mo=document,bo=Mo.documentElement,_o=window;try{Mo.createElement("div").style.setProperty("opacity",0,"")}catch(wo){var Eo=_o.Element.prototype,So=Eo.setAttribute,ko=Eo.setAttributeNS,Ao=_o.CSSStyleDeclaration.prototype,No=Ao.setProperty;Eo.setAttribute=function(n,t){So.call(this,n,t+"")},Eo.setAttributeNS=function(n,t,e){ko.call(this,n,t,e+"")},Ao.setProperty=function(n,t,e){No.call(this,n,t+"",e)}}xo.ascending=function(n,t){return t>n?-1:n>t?1:n>=t?0:0/0},xo.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},xo.min=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;u>++i&&!(null!=(e=n[i])&&e>=e);)e=void 0;for(;u>++i;)null!=(r=n[i])&&e>r&&(e=r)}else{for(;u>++i&&!(null!=(e=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;u>++i;)null!=(r=t.call(n,n[i],i))&&e>r&&(e=r)}return e},xo.max=function(n,t){var e,r,i=-1,u=n.length;if(1===arguments.length){for(;u>++i&&!(null!=(e=n[i])&&e>=e);)e=void 0;for(;u>++i;)null!=(r=n[i])&&r>e&&(e=r)}else{for(;u>++i&&!(null!=(e=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;u>++i;)null!=(r=t.call(n,n[i],i))&&r>e&&(e=r)}return e},xo.extent=function(n,t){var e,r,i,u=-1,o=n.length;if(1===arguments.length){for(;o>++u&&!(null!=(e=i=n[u])&&e>=e);)e=i=void 0;for(;o>++u;)null!=(r=n[u])&&(e>r&&(e=r),r>i&&(i=r))}else{for(;o>++u&&!(null!=(e=i=t.call(n,n[u],u))&&e>=e);)e=void 0;for(;o>++u;)null!=(r=t.call(n,n[u],u))&&(e>r&&(e=r),r>i&&(i=r))}return[e,i]},xo.sum=function(n,t){var e,r=0,i=n.length,u=-1;if(1===arguments.length)for(;i>++u;)isNaN(e=+n[u])||(r+=e);else for(;i>++u;)isNaN(e=+t.call(n,n[u],u))||(r+=e);return r},xo.mean=function(t,e){var r,i=t.length,u=0,o=-1,a=0;if(1===arguments.length)for(;i>++o;)n(r=t[o])&&(u+=(r-u)/++a);else for(;i>++o;)n(r=e.call(t,t[o],o))&&(u+=(r-u)/++a);return a?u:void 0},xo.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),i=+n[r-1],u=e-r;return u?i+u*(n[r]-i):i},xo.median=function(t,e){return arguments.length>1&&(t=t.map(e)),t=t.filter(n),t.length?xo.quantile(t.sort(xo.ascending),.5):void 0},xo.bisector=function(n){return{left:function(t,e,r,i){for(3>arguments.length&&(r=0),4>arguments.length&&(i=t.length);i>r;){var u=r+i>>>1;e>n.call(t,t[u],u)?r=u+1:i=u}return r},right:function(t,e,r,i){for(3>arguments.length&&(r=0),4>arguments.length&&(i=t.length);i>r;){var u=r+i>>>1;n.call(t,t[u],u)>e?i=u:r=u+1}return r}}};var qo=xo.bisector(function(n){return n});xo.bisectLeft=qo.left,xo.bisect=xo.bisectRight=qo.right,xo.shuffle=function(n){for(var t,e,r=n.length;r;)e=0|Math.random()*r--,t=n[r],n[r]=n[e],n[e]=t;return n},xo.permute=function(n,t){for(var e=[],r=-1,i=t.length;i>++r;)e[r]=n[t[r]];return e},xo.zip=function(){if(!(i=arguments.length))return[];
for(var n=-1,e=xo.min(arguments,t),r=Array(e);e>++n;)for(var i,u=-1,o=r[n]=Array(i);i>++u;)o[u]=arguments[u][n];return r},xo.transpose=function(n){return xo.zip.apply(xo,n)},xo.keys=function(n){var t=[];for(var e in n)t.push(e);return t},xo.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},xo.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},xo.merge=function(n){return Array.prototype.concat.apply([],n)},xo.range=function(n,t,r){if(3>arguments.length&&(r=1,2>arguments.length&&(t=n,n=0)),1/0===(t-n)/r)throw Error("infinite range");var i,u=[],o=e(Math.abs(r)),a=-1;if(n*=o,t*=o,r*=o,0>r)for(;(i=n+r*++a)>t;)u.push(i/o);else for(;t>(i=n+r*++a);)u.push(i/o);return u},xo.map=function(n){var t=new i;for(var e in n)t.set(e,n[e]);return t},r(i,{has:function(n){return To+n in this},get:function(n){return this[To+n]},set:function(n,t){return this[To+n]=t},remove:function(n){return n=To+n,n in this&&delete this[n]},keys:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},values:function(){var n=[];return this.forEach(function(t,e){n.push(e)}),n},entries:function(){var n=[];return this.forEach(function(t,e){n.push({key:t,value:e})}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===Co&&n.call(this,t.substring(1),this[t])}});var To="\0",Co=To.charCodeAt(0);xo.nest=function(){function n(t,a,c){if(c>=o.length)return r?r.call(u,a):e?a.sort(e):a;for(var l,s,f,h,g=-1,p=a.length,d=o[c++],m=new i;p>++g;)(h=m.get(l=d(s=a[g])))?h.push(s):m.set(l,[s]);return t?(s=t(),f=function(e,r){s.set(e,n(t,r,c))}):(s={},f=function(e,r){s[e]=n(t,r,c)}),m.forEach(f),s}function t(n,e){if(e>=o.length)return n;var r=[],i=a[e++];return n.forEach(function(n,i){r.push({key:n,values:t(i,e)})}),i?r.sort(function(n,t){return i(n.key,t.key)}):r}var e,r,u={},o=[],a=[];return u.map=function(t,e){return n(e,t,0)},u.entries=function(e){return t(n(xo.map,e,0),0)},u.key=function(n){return o.push(n),u},u.sortKeys=function(n){return a[o.length-1]=n,u},u.sortValues=function(n){return e=n,u},u.rollup=function(n){return r=n,u},u},xo.set=function(n){var t=new u;if(n)for(var e=0;n.length>e;e++)t.add(n[e]);return t},r(u,{has:function(n){return To+n in this},add:function(n){return this[To+n]=!0,n},remove:function(n){return n=To+n,n in this&&delete this[n]},values:function(){var n=[];return this.forEach(function(t){n.push(t)}),n},forEach:function(n){for(var t in this)t.charCodeAt(0)===Co&&n.call(this,t.substring(1))}}),xo.behavior={},xo.rebind=function(n,t){for(var e,r=1,i=arguments.length;i>++r;)n[e=arguments[r]]=o(n,t,t[e]);return n};var jo=["webkit","ms","moz","Moz","o","O"],Do=l;try{Do(bo.childNodes)[0].nodeType}catch(Fo){Do=c}xo.dispatch=function(){for(var n=new f,t=-1,e=arguments.length;e>++t;)n[arguments[t]]=h(n);return n},f.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return 2>arguments.length?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},xo.event=null,xo.requote=function(n){return n.replace(zo,"\\$&")};var zo=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,Lo={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},Oo=function(n,t){return t.querySelector(n)},Ho=function(n,t){return t.querySelectorAll(n)},Ro=bo[a(bo,"matchesSelector")],Po=function(n,t){return Ro.call(n,t)};"function"==typeof Sizzle&&(Oo=function(n,t){return Sizzle(n,t)[0]||null},Ho=function(n,t){return Sizzle.uniqueSort(Sizzle(n,t))},Po=Sizzle.matchesSelector),xo.selection=function(){return Bo};var Io=xo.selection.prototype=[];Io.select=function(n){var t,e,r,i,u=[];n=v(n);for(var o=-1,a=this.length;a>++o;){u.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var c=-1,l=r.length;l>++c;)(i=r[c])?(t.push(e=n.call(i,i.__data__,c,o)),e&&"__data__"in i&&(e.__data__=i.__data__)):t.push(null)}return m(u)},Io.selectAll=function(n){var t,e,r=[];n=y(n);for(var i=-1,u=this.length;u>++i;)for(var o=this[i],a=-1,c=o.length;c>++a;)(e=o[a])&&(r.push(t=Do(n.call(e,e.__data__,a,i))),t.parentNode=e);return m(r)};var Yo={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/"};xo.ns={prefix:Yo,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.substring(0,t),n=n.substring(t+1)),Yo.hasOwnProperty(e)?{space:Yo[e],local:n}:n}},Io.attr=function(n,t){if(2>arguments.length){if("string"==typeof n){var e=this.node();return n=xo.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(x(t,n[t]));return this}return this.each(x(n,t))},Io.classed=function(n,t){if(2>arguments.length){if("string"==typeof n){var e=this.node(),r=(n=n.trim().split(/^|\s+/g)).length,i=-1;if(t=e.classList){for(;r>++i;)if(!t.contains(n[i]))return!1}else for(t=e.getAttribute("class");r>++i;)if(!b(n[i]).test(t))return!1;return!0}for(t in n)this.each(_(t,n[t]));return this}return this.each(_(n,t))},Io.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(E(e,n[e],t));return this}if(2>r)return _o.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(E(n,t,e))},Io.property=function(n,t){if(2>arguments.length){if("string"==typeof n)return this.node()[n];for(t in n)this.each(S(t,n[t]));return this}return this.each(S(n,t))},Io.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},Io.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},Io.append=function(n){return n=k(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},Io.insert=function(n,t){return n=k(n),t=v(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments))})},Io.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},Io.data=function(n,t){function e(n,e){var r,u,o,a=n.length,f=e.length,h=Math.min(a,f),g=Array(f),p=Array(f),d=Array(a);if(t){var m,v=new i,y=new i,x=[];for(r=-1;a>++r;)m=t.call(u=n[r],u.__data__,r),v.has(m)?d[r]=u:v.set(m,u),x.push(m);for(r=-1;f>++r;)m=t.call(e,o=e[r],r),(u=v.get(m))?(g[r]=u,u.__data__=o):y.has(m)||(p[r]=A(o)),y.set(m,o),v.remove(m);for(r=-1;a>++r;)v.has(x[r])&&(d[r]=n[r])}else{for(r=-1;h>++r;)u=n[r],o=e[r],u?(u.__data__=o,g[r]=u):p[r]=A(o);for(;f>r;++r)p[r]=A(e[r]);for(;a>r;++r)d[r]=n[r]}p.update=g,p.parentNode=g.parentNode=d.parentNode=n.parentNode,c.push(p),l.push(g),s.push(d)}var r,u,o=-1,a=this.length;if(!arguments.length){for(n=Array(a=(r=this[0]).length);a>++o;)(u=r[o])&&(n[o]=u.__data__);return n}var c=C([]),l=m([]),s=m([]);if("function"==typeof n)for(;a>++o;)e(r=this[o],n.call(r,r.parentNode.__data__,o));else for(;a>++o;)e(r=this[o],n);return l.enter=function(){return c},l.exit=function(){return s},l},Io.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},Io.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=N(n));for(var u=0,o=this.length;o>u;u++){i.push(t=[]),t.parentNode=(e=this[u]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a)&&t.push(r)}return m(i)},Io.order=function(){for(var n=-1,t=this.length;t>++n;)for(var e,r=this[n],i=r.length-1,u=r[i];--i>=0;)(e=r[i])&&(u&&u!==e.nextSibling&&u.parentNode.insertBefore(e,u),u=e);return this},Io.sort=function(n){n=q.apply(this,arguments);for(var t=-1,e=this.length;e>++t;)this[t].sort(n);return this.order()},Io.each=function(n){return T(this,function(t,e,r){n.call(t,t.__data__,e,r)})},Io.call=function(n){var t=Do(arguments);return n.apply(t[0]=this,t),this},Io.empty=function(){return!this.node()},Io.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,i=e.length;i>r;r++){var u=e[r];if(u)return u}return null},Io.size=function(){var n=0;return this.each(function(){++n}),n};var Uo=[];xo.selection.enter=C,xo.selection.enter.prototype=Uo,Uo.append=Io.append,Uo.empty=Io.empty,Uo.node=Io.node,Uo.call=Io.call,Uo.size=Io.size,Uo.select=function(n){for(var t,e,r,i,u,o=[],a=-1,c=this.length;c>++a;){r=(i=this[a]).update,o.push(t=[]),t.parentNode=i.parentNode;for(var l=-1,s=i.length;s>++l;)(u=i[l])?(t.push(r[l]=e=n.call(i.parentNode,u.__data__,l,a)),e.__data__=u.__data__):t.push(null)}return m(o)},Uo.insert=function(n,t){return 2>arguments.length&&(t=j(this)),Io.insert.call(this,n,t)},Io.transition=function(){for(var n,t,e=Lc||++Ic,r=[],i=Oc||{time:Date.now(),ease:Cr,delay:0,duration:250},u=-1,o=this.length;o>++u;){r.push(n=[]);for(var a=this[u],c=-1,l=a.length;l>++c;)(t=a[c])&&Nu(t,c,e,i),n.push(t)}return Su(r,e)},xo.select=function(n){var t=["string"==typeof n?Oo(n,Mo):n];return t.parentNode=bo,m([t])},xo.selectAll=function(n){var t=Do("string"==typeof n?Ho(n,Mo):n);return t.parentNode=bo,m([t])};var Bo=xo.select(bo);Io.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(D(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(D(n,t,e))};var Vo=xo.map({mouseenter:"mouseover",mouseleave:"mouseout"});Vo.forEach(function(n){"on"+n in Mo&&Vo.remove(n)});var Xo=a(bo.style,"userSelect"),Zo=0;xo.mouse=function(n){return O(n,p())};var $o=/WebKit/.test(_o.navigator.userAgent)?-1:0;xo.touches=function(n,t){return 2>arguments.length&&(t=p().touches),t?Do(t).map(function(t){var e=O(n,t);return e.identifier=t.identifier,e}):[]},xo.behavior.drag=function(){function n(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function t(){return xo.event.changedTouches[0].identifier}function e(n,t){return xo.touches(n).filter(function(n){return n.identifier===t})[0]}function r(n,t,e,r){return function(){function o(){if(!s)return a();var n=t(s,g),e=n[0]-d[0],r=n[1]-d[1];m|=e|r,d=n,f({type:"drag",x:n[0]+c[0],y:n[1]+c[1],dx:e,dy:r})}function a(){v.on(e+"."+p,null).on(r+"."+p,null),y(m&&xo.event.target===h),f({type:"dragend"})}var c,l=this,s=l.parentNode,f=i.of(l,arguments),h=xo.event.target,g=n(),p=null==g?"drag":"drag-"+g,d=t(s,g),m=0,v=xo.select(_o).on(e+"."+p,o).on(r+"."+p,a),y=L();u?(c=u.apply(l,arguments),c=[c.x-d[0],c.y-d[1]]):c=[0,0],f({type:"dragstart"})}}var i=d(n,"drag","dragstart","dragend"),u=null,o=r(s,xo.mouse,"mousemove","mouseup"),a=r(t,e,"touchmove","touchend");return n.origin=function(t){return arguments.length?(u=t,n):u},xo.rebind(n,i,"on")},xo.behavior.zoom=function(){function n(){this.on(w,a).on(Go+".zoom",l).on(E,s).on("dblclick.zoom",f).on("touchstart.zoom",c)}function t(n){return[(n[0]-M[0])/b,(n[1]-M[1])/b]}function e(n){return[n[0]*b+M[0],n[1]*b+M[1]]}function r(n){b=Math.max(_[0],Math.min(_[1],n))}function i(n,t){t=e(t),M[0]+=n[0]-t[0],M[1]+=n[1]-t[1]}function u(){m&&m.domain(p.range().map(function(n){return(n-M[0])/b}).map(p.invert)),y&&y.domain(v.range().map(function(n){return(n-M[1])/b}).map(v.invert))}function o(n){u(),n({type:"zoom",scale:b,translate:M})}function a(){function n(){c=1,i(xo.mouse(r),f),o(u)}function e(){l.on(E,_o===r?s:null).on(S,null),h(c&&xo.event.target===a)}var r=this,u=k.of(r,arguments),a=xo.event.target,c=0,l=xo.select(_o).on(E,n).on(S,e),f=t(xo.mouse(r)),h=L()}function c(){function n(){var n=xo.touches(u),t=n[0],e=s[t.identifier];if(a=n[1]){var a,l=s[a.identifier],g=xo.event.scale;if(null==g){var p=(p=a[0]-t[0])*p+(p=a[1]-t[1])*p;g=f&&Math.sqrt(p/f)}t=[(t[0]+a[0])/2,(t[1]+a[1])/2],e=[(e[0]+l[0])/2,(e[1]+l[1])/2],r(g*h)}x=null,i(t,e),o(c)}function e(){y.on(m,null).on(v,null),M.on(w,a),_()}var u=this,c=k.of(u,arguments),l=xo.touches(u),s={},f=0,h=b,p=Date.now(),d="zoom-"+xo.event.changedTouches[0].identifier,m="touchmove."+d,v="touchend."+d,y=xo.select(_o).on(m,n).on(v,e),M=xo.select(u).on(w,null),_=L();if(l.forEach(function(n){s[n.identifier]=t(n)}),1===l.length){if(500>p-x){var E=l[0],S=t(l[0]);r(2*b),i(E,S),g(),o(c)}x=p}else if(l.length>1){var E=l[0],A=l[1],N=E[0]-A[0],q=E[1]-A[1];f=N*N+q*q}}function l(){g(),h||(h=t(xo.mouse(this))),r(Math.pow(2,.002*Wo())*b),i(xo.mouse(this),h),o(k.of(this,arguments))}function s(){h=null}function f(){var n=xo.mouse(this),e=t(n),u=Math.log(b)/Math.LN2;r(Math.pow(2,xo.event.shiftKey?Math.ceil(u)-1:Math.floor(u)+1)),i(n,e),o(k.of(this,arguments))}var h,p,m,v,y,x,M=[0,0],b=1,_=Jo,w="mousedown.zoom",E="mousemove.zoom",S="mouseup.zoom",k=d(n,"zoom");return n.translate=function(t){return arguments.length?(M=t.map(Number),u(),n):M},n.scale=function(t){return arguments.length?(b=+t,u(),n):b},n.scaleExtent=function(t){return arguments.length?(_=null==t?Jo:t.map(Number),n):_},n.x=function(t){return arguments.length?(m=t,p=t.copy(),M=[0,0],b=1,n):m},n.y=function(t){return arguments.length?(y=t,v=t.copy(),M=[0,0],b=1,n):y},xo.rebind(n,k,"on")};var Wo,Jo=[0,1/0],Go="onwheel"in Mo?(Wo=function(){return-xo.event.deltaY*(xo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Mo?(Wo=function(){return xo.event.wheelDelta},"mousewheel"):(Wo=function(){return-xo.event.detail},"MozMousePixelScroll");H.prototype.toString=function(){return this.rgb()+""},xo.hsl=function(n,t,e){return 1===arguments.length?n instanceof P?R(n.h,n.s,n.l):lt(""+n,st,R):R(+n,+t,+e)};var Ko=P.prototype=new H;Ko.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),R(this.h,this.s,this.l/n)},Ko.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),R(this.h,this.s,n*this.l)},Ko.rgb=function(){return I(this.h,this.s,this.l)};var Qo=Math.PI,na=1e-6,ta=na*na,ea=Qo/180,ra=180/Qo;xo.hcl=function(n,t,e){return 1===arguments.length?n instanceof W?$(n.h,n.c,n.l):n instanceof K?nt(n.l,n.a,n.b):nt((n=ft((n=xo.rgb(n)).r,n.g,n.b)).l,n.a,n.b):$(+n,+t,+e)};var ia=W.prototype=new H;ia.brighter=function(n){return $(this.h,this.c,Math.min(100,this.l+ua*(arguments.length?n:1)))},ia.darker=function(n){return $(this.h,this.c,Math.max(0,this.l-ua*(arguments.length?n:1)))},ia.rgb=function(){return J(this.h,this.c,this.l).rgb()},xo.lab=function(n,t,e){return 1===arguments.length?n instanceof K?G(n.l,n.a,n.b):n instanceof W?J(n.l,n.c,n.h):ft((n=xo.rgb(n)).r,n.g,n.b):G(+n,+t,+e)};var ua=18,oa=.95047,aa=1,ca=1.08883,la=K.prototype=new H;la.brighter=function(n){return G(Math.min(100,this.l+ua*(arguments.length?n:1)),this.a,this.b)},la.darker=function(n){return G(Math.max(0,this.l-ua*(arguments.length?n:1)),this.a,this.b)},la.rgb=function(){return Q(this.l,this.a,this.b)},xo.rgb=function(n,t,e){return 1===arguments.length?n instanceof at?ot(n.r,n.g,n.b):lt(""+n,ot,I):ot(~~n,~~t,~~e)};var sa=at.prototype=new H;sa.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,i=30;return t||e||r?(t&&i>t&&(t=i),e&&i>e&&(e=i),r&&i>r&&(r=i),ot(Math.min(255,~~(t/n)),Math.min(255,~~(e/n)),Math.min(255,~~(r/n)))):ot(i,i,i)},sa.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),ot(~~(n*this.r),~~(n*this.g),~~(n*this.b))},sa.hsl=function(){return st(this.r,this.g,this.b)},sa.toString=function(){return"#"+ct(this.r)+ct(this.g)+ct(this.b)};var fa=xo.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});fa.forEach(function(n,t){fa.set(n,it(t))}),xo.functor=pt,xo.xhr=mt(dt),xo.dsv=function(n,t){function e(n,e,u){3>arguments.length&&(u=e,e=null);var o=xo.xhr(n,t,u);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:i(n)):e},o.row(e)}function r(n){return e.parse(n.responseText)}function i(n){return function(t){return e.parse(t.responseText,n)}}function o(t){return t.map(a).join(n)}function a(n){return c.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var c=RegExp('["'+n+"\n]"),l=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var i=Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(i(n),e)}:i})},e.parseRows=function(n,t){function e(){if(s>=c)return o;if(i)return i=!1,u;var t=s;if(34===n.charCodeAt(t)){for(var e=t;c>e++;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}s=e+2;var r=n.charCodeAt(e+1);return 13===r?(i=!0,10===n.charCodeAt(e+2)&&++s):10===r&&(i=!0),n.substring(t+1,e).replace(/""/g,'"')}for(;c>s;){var r=n.charCodeAt(s++),a=1;if(10===r)i=!0;else if(13===r)i=!0,10===n.charCodeAt(s)&&(++s,++a);else if(r!==l)continue;return n.substring(t,s-a)}return n.substring(t)}for(var r,i,u={},o={},a=[],c=n.length,s=0,f=0;(r=e())!==o;){for(var h=[];r!==u&&r!==o;)h.push(r),r=e();(!t||(h=t(h,f++)))&&a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new u,i=[];return t.forEach(function(n){for(var t in n)r.has(t)||i.push(r.add(t))}),[i.map(a).join(n)].concat(t.map(function(t){return i.map(function(n){return a(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(o).join("\n")},e},xo.csv=xo.dsv(",","text/csv"),xo.tsv=xo.dsv(" ","text/tab-separated-values");var ha,ga,pa,da,ma,va=_o[a(_o,"requestAnimationFrame")]||function(n){setTimeout(n,17)};xo.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var i=e+t,u={callback:n,time:i,next:null};ga?ga.next=u:ha=u,ga=u,pa||(da=clearTimeout(da),pa=1,va(xt))},xo.timer.flush=function(){bt(),_t()};var ya=".",xa=",",Ma=[3,3],ba="$",_a=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(wt);xo.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=xo.round(n,Et(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),_a[8+e/3]},xo.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)},xo.format=function(n){var t=wa.exec(n),e=t[1]||" ",r=t[2]||">",i=t[3]||"",u=t[4]||"",o=t[5],a=+t[6],c=t[7],l=t[8],s=t[9],f=1,h="",g=!1;switch(l&&(l=+l.substring(1)),(o||"0"===e&&"="===r)&&(o=e="0",r="=",c&&(a-=Math.floor((a-1)/4))),s){case"n":c=!0,s="g";break;case"%":f=100,h="%",s="f";break;case"p":f=100,h="%",s="r";break;case"b":case"o":case"x":case"X":"#"===u&&(u="0"+s.toLowerCase());case"c":case"d":g=!0,l=0;break;case"s":f=-1,s="r"}"#"===u?u="":"$"===u&&(u=ba),"r"!=s||l||(s="g"),null!=l&&("g"==s?l=Math.max(1,Math.min(21,l)):("e"==s||"f"==s)&&(l=Math.max(0,Math.min(20,l)))),s=Ea.get(s)||St;var p=o&&c;return function(n){if(g&&n%1)return"";var t=0>n||0===n&&0>1/n?(n=-n,"-"):i;if(0>f){var d=xo.formatPrefix(n,l);n=d.scale(n),h=d.symbol}else n*=f;n=s(n,l);var m=n.lastIndexOf("."),v=0>m?n:n.substring(0,m),y=0>m?"":ya+n.substring(m+1);!o&&c&&(v=Sa(v));var x=u.length+v.length+y.length+(p?0:t.length),M=a>x?Array(x=a-x+1).join(e):"";return p&&(v=Sa(M+v)),t+=u,n=v+y,("<"===r?t+n+M:">"===r?M+t+n:"^"===r?M.substring(0,x>>=1)+t+n+M.substring(x):t+(p?n:M+n))+h}};var wa=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ea=xo.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=xo.round(n,Et(n,t))).toFixed(Math.max(0,Math.min(20,Et(n*(1+1e-15),t))))}}),Sa=dt;if(Ma){var ka=Ma.length;Sa=function(n){for(var t=n.length,e=[],r=0,i=Ma[0];t>0&&i>0;)e.push(n.substring(t-=i,t+i)),i=Ma[r=(r+1)%ka];return e.reverse().join(xa)}}xo.geo={},kt.prototype={s:0,t:0,add:function(n){At(n,this.t,Aa),At(Aa.s,this.s,this),this.s?this.t+=Aa.t:this.s=Aa.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var Aa=new kt;xo.geo.stream=function(n,t){n&&Na.hasOwnProperty(n.type)?Na[n.type](n,t):Nt(n,t)};var Na={Feature:function(n,t){Nt(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,i=e.length;i>++r;)Nt(e[r].geometry,t)}},qa={Sphere:function(n,t){t.sphere()},Point:function(n,t){var e=n.coordinates;t.point(e[0],e[1])},MultiPoint:function(n,t){for(var e,r=n.coordinates,i=-1,u=r.length;u>++i;)e=r[i],t.point(e[0],e[1])},LineString:function(n,t){qt(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;i>++r;)qt(e[r],t,0)},Polygon:function(n,t){Tt(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,i=e.length;i>++r;)Tt(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,i=e.length;i>++r;)Nt(e[r],t)}};xo.geo.area=function(n){return Ta=0,xo.geo.stream(n,ja),Ta};var Ta,Ca=new kt,ja={sphere:function(){Ta+=4*Qo},point:s,lineStart:s,lineEnd:s,polygonStart:function(){Ca.reset(),ja.lineStart=Ct},polygonEnd:function(){var n=2*Ca;Ta+=0>n?4*Qo+n:n,ja.lineStart=ja.lineEnd=ja.point=s}};xo.geo.bounds=function(){function n(n,t){x.push(M=[s=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=jt([t*ea,e*ea]);if(v){var i=Ft(v,r),u=[i[1],-i[0],0],o=Ft(u,i);Ot(o),o=Ht(o);var c=t-p,l=c>0?1:-1,d=o[0]*ra*l,m=Math.abs(c)>180;if(m^(d>l*p&&l*t>d)){var y=o[1]*ra;y>g&&(g=y)}else if(d=(d+360)%360-180,m^(d>l*p&&l*t>d)){var y=-o[1]*ra;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);m?p>t?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t):h>=s?(s>t&&(s=t),t>h&&(h=t)):t>p?a(s,t)>a(s,h)&&(h=t):a(t,h)>a(s,h)&&(s=t)}else n(t,e);v=r,p=t}function e(){b.point=t}function r(){M[0]=s,M[1]=h,b.point=n,v=null}function i(n,e){if(v){var r=n-p;y+=Math.abs(r)>180?r+(r>0?360:-360):r}else d=n,m=e;ja.point(n,e),t(n,e)}function u(){ja.lineStart()}function o(){i(d,m),ja.lineEnd(),Math.abs(y)>na&&(s=-(h=180)),M[0]=s,M[1]=h,v=null}function a(n,t){return 0>(t-=n)?t+360:t}function c(n,t){return n[0]-t[0]}function l(n,t){return t[0]<=t[1]?n>=t[0]&&t[1]>=n:t[0]>n||n>t[1]}var s,f,h,g,p,d,m,v,y,x,M,b={point:n,lineStart:e,lineEnd:r,polygonStart:function(){b.point=i,b.lineStart=u,b.lineEnd=o,y=0,ja.polygonStart()},polygonEnd:function(){ja.polygonEnd(),b.point=n,b.lineStart=e,b.lineEnd=r,0>Ca?(s=-(h=180),f=-(g=90)):y>na?g=90:-na>y&&(f=-90),M[0]=s,M[1]=h}};return function(n){g=h=-(s=f=1/0),x=[],xo.geo.stream(n,b);var t=x.length;if(t){x.sort(c);for(var e,r=1,i=x[0],u=[i];t>r;++r)e=x[r],l(e[0],i)||l(e[1],i)?(a(i[0],e[1])>a(i[0],i[1])&&(i[1]=e[1]),a(e[0],i[1])>a(i[0],i[1])&&(i[0]=e[0])):u.push(i=e);for(var o,e,p=-1/0,t=u.length-1,r=0,i=u[t];t>=r;i=e,++r)e=u[r],(o=a(i[1],e[0]))>p&&(p=o,s=e[0],h=i[1])}return x=M=null,1/0===s||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[s,f],[h,g]]}}(),xo.geo.centroid=function(n){Da=Fa=za=La=Oa=Ha=Ra=Pa=Ia=Ya=Ua=0,xo.geo.stream(n,Ba);var t=Ia,e=Ya,r=Ua,i=t*t+e*e+r*r;return ta>i&&(t=Ha,e=Ra,r=Pa,na>Fa&&(t=za,e=La,r=Oa),i=t*t+e*e+r*r,ta>i)?[0/0,0/0]:[Math.atan2(e,t)*ra,B(r/Math.sqrt(i))*ra]};var Da,Fa,za,La,Oa,Ha,Ra,Pa,Ia,Ya,Ua,Ba={sphere:s,point:Pt,lineStart:Yt,lineEnd:Ut,polygonStart:function(){Ba.lineStart=Bt},polygonEnd:function(){Ba.lineStart=Yt}},Va=$t(Vt,Qt,te,ee),Xa=[-Qo,0],Za=1e9;(xo.geo.conicEqualArea=function(){return ae(ce)}).raw=ce,xo.geo.albers=function(){return xo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},xo.geo.albersUsa=function(){function n(n){var u=n[0],o=n[1];return t=null,e(u,o),t||(r(u,o),t)||i(u,o),t}var t,e,r,i,u=xo.geo.albers(),o=xo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=xo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=u.scale(),e=u.translate(),r=(n[0]-e[0])/t,i=(n[1]-e[1])/t;return(i>=.12&&.234>i&&r>=-.425&&-.214>r?o:i>=.166&&.234>i&&r>=-.214&&-.115>r?a:u).invert(n)},n.stream=function(n){var t=u.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,i){t.point(n,i),e.point(n,i),r.point(n,i)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),a.precision(t),n):u.precision()},n.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),a.scale(t),n.translate(u.translate())):u.scale()},n.translate=function(t){if(!arguments.length)return u.translate();var l=u.scale(),s=+t[0],f=+t[1];return e=u.translate(t).clipExtent([[s-.455*l,f-.238*l],[s+.455*l,f+.238*l]]).stream(c).point,r=o.translate([s-.307*l,f+.201*l]).clipExtent([[s-.425*l+na,f+.12*l+na],[s-.214*l-na,f+.234*l-na]]).stream(c).point,i=a.translate([s-.205*l,f+.212*l]).clipExtent([[s-.214*l+na,f+.166*l+na],[s-.115*l-na,f+.234*l-na]]).stream(c).point,n},n.scale(1070)};var $a,Wa,Ja,Ga,Ka,Qa,nc={point:s,lineStart:s,lineEnd:s,polygonStart:function(){Wa=0,nc.lineStart=le},polygonEnd:function(){nc.lineStart=nc.lineEnd=nc.point=s,$a+=Math.abs(Wa/2)}},tc={point:se,lineStart:s,lineEnd:s,polygonStart:s,polygonEnd:s},ec={point:ge,lineStart:pe,lineEnd:de,polygonStart:function(){ec.lineStart=me},polygonEnd:function(){ec.point=ge,ec.lineStart=pe,ec.lineEnd=de}};xo.geo.path=function(){function n(n){return n&&("function"==typeof a&&u.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=i(u)),xo.geo.stream(n,o)),u.result()}function t(){return o=null,n}var e,r,i,u,o,a=4.5;return n.area=function(n){return $a=0,xo.geo.stream(n,i(nc)),$a},n.centroid=function(n){return za=La=Oa=Ha=Ra=Pa=Ia=Ya=Ua=0,xo.geo.stream(n,i(ec)),Ua?[Ia/Ua,Ya/Ua]:Pa?[Ha/Pa,Ra/Pa]:Oa?[za/Oa,La/Oa]:[0/0,0/0]},n.bounds=function(n){return Ka=Qa=-(Ja=Ga=1/0),xo.geo.stream(n,i(tc)),[[Ja,Ga],[Ka,Qa]]},n.projection=function(n){return arguments.length?(i=(e=n)?n.stream||xe(n):dt,t()):e},n.context=function(n){return arguments.length?(u=null==(r=n)?new fe:new ve(n),"function"!=typeof a&&u.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(u.pointRadius(+t),+t),n):a},n.projection(xo.geo.albersUsa()).context(null)},xo.geo.projection=Me,xo.geo.projectionMutator=be,(xo.geo.equirectangular=function(){return Me(we)}).raw=we.invert=we,xo.geo.rotation=function(n){function t(t){return t=n(t[0]*ea,t[1]*ea),t[0]*=ra,t[1]*=ra,t}return n=Ee(n[0]%360*ea,n[1]*ea,n.length>2?n[2]*ea:0),t.invert=function(t){return t=n.invert(t[0]*ea,t[1]*ea),t[0]*=ra,t[1]*=ra,t},t},xo.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=Ee(-n[0]*ea,-n[1]*ea,0).invert,i=[];return e(null,null,1,{point:function(n,e){i.push(n=t(n,e)),n[0]*=ra,n[1]*=ra}}),{type:"Polygon",coordinates:[i]}}var t,e,r=[0,0],i=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=Ne((t=+r)*ea,i*ea),n):t},n.precision=function(r){return arguments.length?(e=Ne(t*ea,(i=+r)*ea),n):i},n.angle(90)},xo.geo.distance=function(n,t){var e,r=(t[0]-n[0])*ea,i=n[1]*ea,u=t[1]*ea,o=Math.sin(r),a=Math.cos(r),c=Math.sin(i),l=Math.cos(i),s=Math.sin(u),f=Math.cos(u);return Math.atan2(Math.sqrt((e=f*o)*e+(e=l*s-c*f*a)*e),c*s+l*f*a)},xo.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return xo.range(Math.ceil(u/m)*m,i,m).map(h).concat(xo.range(Math.ceil(l/v)*v,c,v).map(g)).concat(xo.range(Math.ceil(r/p)*p,e,p).filter(function(n){return Math.abs(n%m)>na}).map(s)).concat(xo.range(Math.ceil(a/d)*d,o,d).filter(function(n){return Math.abs(n%v)>na}).map(f))}var e,r,i,u,o,a,c,l,s,f,h,g,p=10,d=p,m=90,v=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(u).concat(g(c).slice(1),h(i).reverse().slice(1),g(l).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(u=+t[0][0],i=+t[1][0],l=+t[0][1],c=+t[1][1],u>i&&(t=u,u=i,i=t),l>c&&(t=l,l=c,c=t),n.precision(y)):[[u,l],[i,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(m=+t[0],v=+t[1],n):[m,v]},n.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],n):[p,d]},n.precision=function(t){return arguments.length?(y=+t,s=Te(a,o,90),f=Ce(r,e,y),h=Te(l,c,90),g=Ce(u,i,y),n):y},n.majorExtent([[-180,-90+na],[180,90-na]]).minorExtent([[-180,-80-na],[180,80+na]])},xo.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||i.apply(this,arguments)]}}var t,e,r=je,i=De;return n.distance=function(){return xo.geo.distance(t||r.apply(this,arguments),e||i.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,n):i},n.precision=function(){return arguments.length?n:0},n},xo.geo.interpolate=function(n,t){return Fe(n[0]*ea,n[1]*ea,t[0]*ea,t[1]*ea)},xo.geo.length=function(n){return rc=0,xo.geo.stream(n,ic),rc};var rc,ic={sphere:s,point:s,lineStart:ze,lineEnd:s,polygonStart:s,polygonEnd:s},uc=Le(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(xo.geo.azimuthalEqualArea=function(){return Me(uc)
}).raw=uc;var oc=Le(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},dt);(xo.geo.azimuthalEquidistant=function(){return Me(oc)}).raw=oc,(xo.geo.conicConformal=function(){return ae(Oe)}).raw=Oe,(xo.geo.conicEquidistant=function(){return ae(He)}).raw=He;var ac=Le(function(n){return 1/n},Math.atan);(xo.geo.gnomonic=function(){return Me(ac)}).raw=ac,Re.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Qo/2]},(xo.geo.mercator=function(){return Pe(Re)}).raw=Re;var cc=Le(function(){return 1},Math.asin);(xo.geo.orthographic=function(){return Me(cc)}).raw=cc;var lc=Le(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(xo.geo.stereographic=function(){return Me(lc)}).raw=lc,Ie.invert=function(n,t){return[Math.atan2(V(n),Math.cos(t)),B(Math.sin(t)/X(n))]},(xo.geo.transverseMercator=function(){return Pe(Ie)}).raw=Ie,xo.geom={},xo.svg={},xo.svg.line=function(){return Ye(dt)};var sc=xo.map({linear:Ve,"linear-closed":Xe,step:Ze,"step-before":$e,"step-after":We,basis:tr,"basis-open":er,"basis-closed":rr,bundle:ir,cardinal:Ke,"cardinal-open":Je,"cardinal-closed":Ge,monotone:sr});sc.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var fc=[0,2/3,1/3,0],hc=[0,1/3,2/3,0],gc=[0,1/6,2/3,1/6];xo.geom.hull=function(n){function t(n){if(3>n.length)return[];var t,i,u,o,a,c,l,s,f,h,g,p,d=pt(e),m=pt(r),v=n.length,y=v-1,x=[],M=[],b=0;if(d===Ue&&r===Be)t=n;else for(u=0,t=[];v>u;++u)t.push([+d.call(this,i=n[u],u),+m.call(this,i,u)]);for(u=1;v>u;++u)(t[u][1]<t[b][1]||t[u][1]==t[b][1]&&t[u][0]<t[b][0])&&(b=u);for(u=0;v>u;++u)u!==b&&(c=t[u][1]-t[b][1],a=t[u][0]-t[b][0],x.push({angle:Math.atan2(c,a),index:u}));for(x.sort(function(n,t){return n.angle-t.angle}),g=x[0].angle,h=x[0].index,f=0,u=1;y>u;++u){if(o=x[u].index,g==x[u].angle){if(a=t[h][0]-t[b][0],c=t[h][1]-t[b][1],l=t[o][0]-t[b][0],s=t[o][1]-t[b][1],a*a+c*c>=l*l+s*s){x[u].index=-1;continue}x[f].index=-1}g=x[u].angle,f=u,h=o}for(M.push(b),u=0,o=0;2>u;++o)x[o].index>-1&&(M.push(x[o].index),u++);for(p=M.length;y>o;++o)if(!(0>x[o].index)){for(;!fr(M[p-2],M[p-1],x[o].index,t);)--p;M[p++]=x[o].index}var _=[];for(u=p-1;u>=0;--u)_.push(n[M[u]]);return _}var e=Ue,r=Be;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},xo.geom.polygon=function(n){return Lo(n,pc),n};var pc=xo.geom.polygon.prototype=[];pc.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],i=0;e>++t;)n=r,r=this[t],i+=n[1]*r[0]-n[0]*r[1];return.5*i},pc.centroid=function(n){var t,e,r=-1,i=this.length,u=0,o=0,a=this[i-1];for(arguments.length||(n=-1/(6*this.area()));i>++r;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],u+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[u*n,o*n]},pc.clip=function(n){for(var t,e,r,i,u,o,a=pr(n),c=-1,l=this.length-pr(this),s=this[l-1];l>++c;){for(t=n.slice(),n.length=0,i=this[c],u=t[(r=t.length-a)-1],e=-1;r>++e;)o=t[e],hr(o,s,i)?(hr(u,s,i)||n.push(gr(u,o,s,i)),n.push(o)):hr(u,s,i)&&n.push(gr(u,o,s,i)),u=o;a&&n.push(n[0]),s=i}return n},xo.geom.delaunay=function(n){var t=n.map(function(){return[]}),e=[];return dr(n,function(e){t[e.region.l.index].push(n[e.region.r.index])}),t.forEach(function(t,r){var i=n[r],u=i[0],o=i[1];t.forEach(function(n){n.angle=Math.atan2(n[0]-u,n[1]-o)}),t.sort(function(n,t){return n.angle-t.angle});for(var a=0,c=t.length-1;c>a;a++)e.push([i,t[a],t[a+1]])}),e},xo.geom.voronoi=function(n){function t(n){var t,u,o,a=n.map(function(){return[]}),c=pt(e),l=pt(r),s=n.length,f=1e6;if(c===Ue&&l===Be)t=n;else for(t=Array(s),o=0;s>o;++o)t[o]=[+c.call(this,u=n[o],o),+l.call(this,u,o)];if(dr(t,function(n){var t,e,r,i,u,o;1===n.a&&n.b>=0?(t=n.ep.r,e=n.ep.l):(t=n.ep.l,e=n.ep.r),1===n.a?(u=t?t.y:-f,r=n.c-n.b*u,o=e?e.y:f,i=n.c-n.b*o):(r=t?t.x:-f,u=n.c-n.a*r,i=e?e.x:f,o=n.c-n.a*i);var c=[r,u],l=[i,o];a[n.region.l.index].push(c,l),a[n.region.r.index].push(c,l)}),a=a.map(function(n,e){var r=t[e][0],i=t[e][1],u=n.map(function(n){return Math.atan2(n[0]-r,n[1]-i)}),o=xo.range(n.length).sort(function(n,t){return u[n]-u[t]});return o.filter(function(n,t){return!t||u[n]-u[o[t-1]]>na}).map(function(t){return n[t]})}),a.forEach(function(n,e){var r=n.length;if(!r)return n.push([-f,-f],[-f,f],[f,f],[f,-f]);if(!(r>2)){var i=t[e],u=n[0],o=n[1],a=i[0],c=i[1],l=u[0],s=u[1],h=o[0],g=o[1],p=Math.abs(h-l),d=g-s;if(na>Math.abs(d)){var m=s>c?-f:f;n.push([-f,m],[f,m])}else if(na>p){var v=l>a?-f:f;n.push([v,-f],[v,f])}else{var m=(l-a)*(g-s)>(h-l)*(s-c)?f:-f,y=Math.abs(d)-p;na>Math.abs(y)?n.push([0>d?m:-m,m]):(y>0&&(m*=-1),n.push([-f,m],[f,m]))}}}),i)for(o=0;s>o;++o)i.clip(a[o]);for(o=0;s>o;++o)a[o].point=n[o];return a}var e=Ue,r=Be,i=null;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.clipExtent=function(n){if(!arguments.length)return i&&[i[0],i[2]];if(null==n)i=null;else{var e=+n[0][0],r=+n[0][1],u=+n[1][0],o=+n[1][1];i=xo.geom.polygon([[e,r],[e,o],[u,o],[u,r]])}return t},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):i&&i[2]},t.links=function(n){var t,i,u,o=n.map(function(){return[]}),a=[],c=pt(e),l=pt(r),s=n.length;if(c===Ue&&l===Be)t=n;else for(t=Array(s),u=0;s>u;++u)t[u]=[+c.call(this,i=n[u],u),+l.call(this,i,u)];return dr(t,function(t){var e=t.region.l.index,r=t.region.r.index;o[e][r]||(o[e][r]=o[r][e]=!0,a.push({source:n[e],target:n[r]}))}),a},t.triangles=function(n){if(e===Ue&&r===Be)return xo.geom.delaunay(n);for(var t,i=Array(c),u=pt(e),o=pt(r),a=-1,c=n.length;c>++a;)(i[a]=[+u.call(this,t=n[a],a),+o.call(this,t,a)]).data=t;return xo.geom.delaunay(i).map(function(n){return n.map(function(n){return n.data})})},t)};var dc={l:"r",r:"l"};xo.geom.quadtree=function(n,t,e,r,i){function u(n){function u(n,t,e,r,i,u,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,s=n.y;if(null!=c)if(.01>Math.abs(c-e)+Math.abs(s-r))l(n,t,e,r,i,u,o,a);else{var f=n.point;n.x=n.y=n.point=null,l(n,f,c,s,i,u,o,a),l(n,t,e,r,i,u,o,a)}else n.x=e,n.y=r,n.point=t}else l(n,t,e,r,i,u,o,a)}function l(n,t,e,r,i,o,a,c){var l=.5*(i+a),s=.5*(o+c),f=e>=l,h=r>=s,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=yr()),f?i=l:a=l,h?o=s:c=s,u(n,t,e,r,i,o,a,c)}var s,f,h,g,p,d,m,v,y,x=pt(a),M=pt(c);if(null!=t)d=t,m=e,v=r,y=i;else if(v=y=-(d=m=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)s=n[g],d>s.x&&(d=s.x),m>s.y&&(m=s.y),s.x>v&&(v=s.x),s.y>y&&(y=s.y),f.push(s.x),h.push(s.y);else for(g=0;p>g;++g){var b=+x(s=n[g],g),_=+M(s,g);d>b&&(d=b),m>_&&(m=_),b>v&&(v=b),_>y&&(y=_),f.push(b),h.push(_)}var w=v-d,E=y-m;w>E?y=m+w:v=d+E;var S=yr();if(S.add=function(n){u(S,n,+x(n,++g),+M(n,g),d,m,v,y)},S.visit=function(n){xr(n,S,d,m,v,y)},g=-1,null==t){for(;p>++g;)u(S,n[g],f[g],h[g],d,m,v,y);--g}else n.forEach(S.add);return f=h=n=s=null,S}var o,a=Ue,c=Be;return(o=arguments.length)?(a=mr,c=vr,3===o&&(i=e,r=t,e=t=0),u(n)):(u.x=function(n){return arguments.length?(a=n,u):a},u.y=function(n){return arguments.length?(c=n,u):c},u.extent=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],i=+n[1][1]),u):null==t?null:[[t,e],[r,i]]},u.size=function(n){return arguments.length?(null==n?t=e=r=i=null:(t=e=0,r=+n[0],i=+n[1]),u):null==t?null:[r-t,i-e]},u)},xo.interpolateRgb=Mr,xo.interpolateObject=br,xo.interpolateNumber=_r,xo.interpolateString=wr;var mc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;xo.interpolate=Er,xo.interpolators=[function(n,t){var e=typeof t;return("string"===e?fa.has(t)||/^(#|rgb\(|hsl\()/.test(t)?Mr:wr:t instanceof H?Mr:"object"===e?Array.isArray(t)?Sr:br:_r)(n,t)}],xo.interpolateArray=Sr;var vc=function(){return dt},yc=xo.map({linear:vc,poly:jr,quad:function(){return qr},cubic:function(){return Tr},sin:function(){return Dr},exp:function(){return Fr},circle:function(){return zr},elastic:Lr,back:Or,bounce:function(){return Hr}}),xc=xo.map({"in":dt,out:Ar,"in-out":Nr,"out-in":function(n){return Nr(Ar(n))}});xo.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):"in";return e=yc.get(e)||vc,r=xc.get(r)||dt,kr(r(e.apply(null,Array.prototype.slice.call(arguments,1))))},xo.interpolateHcl=Rr,xo.interpolateHsl=Pr,xo.interpolateLab=Ir,xo.interpolateRound=Yr,xo.transform=function(n){var t=Mo.createElementNS(xo.ns.prefix.svg,"g");return(xo.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Ur(e?e.matrix:Mc)})(n)},Ur.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var Mc={a:1,b:0,c:0,d:1,e:0,f:0};xo.interpolateTransform=Zr,xo.layout={},xo.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;r>++e;)t.push(Jr(n[e]));return t}},xo.layout.chord=function(){function n(){var n,l,f,h,g,p={},d=[],m=xo.range(u),v=[];for(e=[],r=[],n=0,h=-1;u>++h;){for(l=0,g=-1;u>++g;)l+=i[h][g];d.push(l),v.push(xo.range(u)),n+=l}for(o&&m.sort(function(n,t){return o(d[n],d[t])}),a&&v.forEach(function(n,t){n.sort(function(n,e){return a(i[t][n],i[t][e])})}),n=(2*Qo-s*u)/n,l=0,h=-1;u>++h;){for(f=l,g=-1;u>++g;){var y=m[h],x=v[y][g],M=i[y][x],b=l,_=l+=M*n;p[y+"-"+x]={index:y,subindex:x,startAngle:b,endAngle:_,value:M}}r[y]={index:y,startAngle:f,endAngle:l,value:(l-f)/n},l+=s}for(h=-1;u>++h;)for(g=h-1;u>++g;){var w=p[h+"-"+g],E=p[g+"-"+h];(w.value||E.value)&&e.push(w.value<E.value?{source:E,target:w}:{source:w,target:E})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,i,u,o,a,c,l={},s=0;return l.matrix=function(n){return arguments.length?(u=(i=n)&&i.length,e=r=null,l):i},l.padding=function(n){return arguments.length?(s=n,e=r=null,l):s},l.sortGroups=function(n){return arguments.length?(o=n,e=r=null,l):o},l.sortSubgroups=function(n){return arguments.length?(a=n,e=null,l):a},l.sortChords=function(n){return arguments.length?(c=n,e&&t(),l):c},l.chords=function(){return e||n(),e},l.groups=function(){return r||n(),r},l},xo.layout.force=function(){function n(n){return function(t,e,r,i){if(t.point!==n){var u=t.cx-n.x,o=t.cy-n.y,a=1/Math.sqrt(u*u+o*o);if(d>(i-e)*a){var c=t.charge*a*a;return n.px-=u*c,n.py-=o*c,!0}if(t.point&&isFinite(a)){var c=t.pointCharge*a*a;n.px-=u*c,n.py-=o*c}}return!t.charge}}function t(n){n.px=xo.event.x,n.py=xo.event.y,a.resume()}var e,r,i,u,o,a={},c=xo.dispatch("start","tick","end"),l=[1,1],s=.9,f=bc,h=_c,g=-30,p=.1,d=.8,m=[],v=[];return a.tick=function(){if(.005>(r*=.99))return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,d,y,x,M,b=m.length,_=v.length;for(e=0;_>e;++e)a=v[e],f=a.source,h=a.target,x=h.x-f.x,M=h.y-f.y,(d=x*x+M*M)&&(d=r*u[e]*((d=Math.sqrt(d))-i[e])/d,x*=d,M*=d,h.x-=x*(y=f.weight/(h.weight+f.weight)),h.y-=M*y,f.x+=x*(y=1-y),f.y+=M*y);if((y=r*p)&&(x=l[0]/2,M=l[1]/2,e=-1,y))for(;b>++e;)a=m[e],a.x+=(x-a.x)*y,a.y+=(M-a.y)*y;if(g)for(ri(t=xo.geom.quadtree(m),r,o),e=-1;b>++e;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;b>++e;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*s,a.y-=(a.py-(a.py=a.y))*s);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(v=n,a):v},a.size=function(n){return arguments.length?(l=n,a):l},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(s=+n,a):s},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.gravity=function(n){return arguments.length?(p=+n,a):p},a.theta=function(n){return arguments.length?(d=+n,a):d},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),xo.timer(a.tick)),a):r},a.start=function(){function n(n,r){for(var i,u=t(e),o=-1,a=u.length;a>++o;)if(!isNaN(i=u[o][n]))return i;return Math.random()*r}function t(){if(!c){for(c=[],r=0;p>r;++r)c[r]=[];for(r=0;d>r;++r){var n=v[r];c[n.source.index].push(n.target),c[n.target.index].push(n.source)}}return c[e]}var e,r,c,s,p=m.length,d=v.length,y=l[0],x=l[1];for(e=0;p>e;++e)(s=m[e]).index=e,s.weight=0;for(e=0;d>e;++e)s=v[e],"number"==typeof s.source&&(s.source=m[s.source]),"number"==typeof s.target&&(s.target=m[s.target]),++s.source.weight,++s.target.weight;for(e=0;p>e;++e)s=m[e],isNaN(s.x)&&(s.x=n("x",y)),isNaN(s.y)&&(s.y=n("y",x)),isNaN(s.px)&&(s.px=s.x),isNaN(s.py)&&(s.py=s.y);if(i=[],"function"==typeof f)for(e=0;d>e;++e)i[e]=+f.call(this,v[e],e);else for(e=0;d>e;++e)i[e]=f;if(u=[],"function"==typeof h)for(e=0;d>e;++e)u[e]=+h.call(this,v[e],e);else for(e=0;d>e;++e)u[e]=h;if(o=[],"function"==typeof g)for(e=0;p>e;++e)o[e]=+g.call(this,m[e],e);else for(e=0;p>e;++e)o[e]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=xo.behavior.drag().origin(dt).on("dragstart.force",Qr).on("drag.force",t).on("dragend.force",ni)),arguments.length?(this.on("mouseover.force",ti).on("mouseout.force",ei).call(e),void 0):e},xo.rebind(a,c,"on")};var bc=20,_c=1;xo.layout.hierarchy=function(){function n(t,o,a){var c=i.call(e,t,o);if(t.depth=o,a.push(t),c&&(l=c.length)){for(var l,s,f=-1,h=t.children=[],g=0,p=o+1;l>++f;)s=n(c[f],p,a),s.parent=t,h.push(s),g+=s.value;r&&h.sort(r),u&&(t.value=g)}else u&&(t.value=+u.call(e,t,o)||0);return t}function t(n,r){var i=n.children,o=0;if(i&&(a=i.length))for(var a,c=-1,l=r+1;a>++c;)o+=t(i[c],l);else u&&(o=+u.call(e,n,r)||0);return u&&(n.value=o),o}function e(t){var e=[];return n(t,0,e),e}var r=ai,i=ui,u=oi;return e.sort=function(n){return arguments.length?(r=n,e):r},e.children=function(n){return arguments.length?(i=n,e):i},e.value=function(n){return arguments.length?(u=n,e):u},e.revalue=function(n){return t(n,0),n},e},xo.layout.partition=function(){function n(t,e,r,i){var u=t.children;if(t.x=e,t.y=t.depth*i,t.dx=r,t.dy=i,u&&(o=u.length)){var o,a,c,l=-1;for(r=t.value?r/t.value:0;o>++l;)n(a=u[l],e,c=a.value*r,i),e+=c}}function t(n){var e=n.children,r=0;if(e&&(i=e.length))for(var i,u=-1;i>++u;)r=Math.max(r,t(e[u]));return 1+r}function e(e,u){var o=r.call(this,e,u);return n(o[0],0,i[0],i[1]/t(o[0])),o}var r=xo.layout.hierarchy(),i=[1,1];return e.size=function(n){return arguments.length?(i=n,e):i},ii(e,r)},xo.layout.pie=function(){function n(u){var o=u.map(function(e,r){return+t.call(n,e,r)}),a=+("function"==typeof r?r.apply(this,arguments):r),c=(("function"==typeof i?i.apply(this,arguments):i)-a)/xo.sum(o),l=xo.range(u.length);null!=e&&l.sort(e===wc?function(n,t){return o[t]-o[n]}:function(n,t){return e(u[n],u[t])});var s=[];return l.forEach(function(n){var t;s[n]={data:u[n],value:t=o[n],startAngle:a,endAngle:a+=t*c}}),s}var t=Number,e=wc,r=0,i=2*Qo;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(i=t,n):i},n};var wc={};xo.layout.stack=function(){function n(a,c){var l=a.map(function(e,r){return t.call(n,e,r)}),s=l.map(function(t){return t.map(function(t,e){return[u.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,s,c);l=xo.permute(l,f),s=xo.permute(s,f);var h,g,p,d=r.call(n,s,c),m=l.length,v=l[0].length;for(g=0;v>g;++g)for(i.call(n,l[0][g],p=d[g],s[0][g][1]),h=1;m>h;++h)i.call(n,l[h][g],p+=s[h-1][g][1],s[h][g][1]);return a}var t=dt,e=hi,r=gi,i=fi,u=li,o=si;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:Ec.get(t)||hi,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:Sc.get(t)||gi,n):r},n.x=function(t){return arguments.length?(u=t,n):u},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(i=t,n):i},n};var Ec=xo.map({"inside-out":function(n){var t,e,r=n.length,i=n.map(pi),u=n.map(di),o=xo.range(r).sort(function(n,t){return i[n]-i[t]}),a=0,c=0,l=[],s=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=u[e],l.push(e)):(c+=u[e],s.push(e));return s.reverse().concat(l)},reverse:function(n){return xo.range(n.length).reverse()},"default":hi}),Sc=xo.map({silhouette:function(n){var t,e,r,i=n.length,u=n[0].length,o=[],a=0,c=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;u>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,i,u,o,a,c,l,s=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=l=0,e=1;h>e;++e){for(t=0,i=0;s>t;++t)i+=n[t][e][1];for(t=0,u=0,a=f[e][0]-f[e-1][0];s>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;u+=o*n[t][e][1]}g[e]=c-=i?u/i*a:0,l>c&&(l=c)}for(e=0;h>e;++e)g[e]-=l;return g},expand:function(n){var t,e,r,i=n.length,u=n[0].length,o=1/i,a=[];for(e=0;u>e;++e){for(t=0,r=0;i>t;t++)r+=n[t][e][1];if(r)for(t=0;i>t;t++)n[t][e][1]/=r;else for(t=0;i>t;t++)n[t][e][1]=o}for(e=0;u>e;++e)a[e]=0;return a},zero:gi});xo.layout.histogram=function(){function n(n,u){for(var o,a,c=[],l=n.map(e,this),s=r.call(this,l,u),f=i.call(this,s,l,u),u=-1,h=l.length,g=f.length-1,p=t?1:1/h;g>++u;)o=c[u]=[],o.dx=f[u+1]-(o.x=f[u]),o.y=0;if(g>0)for(u=-1;h>++u;)a=l[u],a>=s[0]&&s[1]>=a&&(o=c[xo.bisect(f,a,1,g)-1],o.y+=p,o.push(n[u]));return c}var t=!0,e=Number,r=xi,i=vi;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=pt(t),n):r},n.bins=function(t){return arguments.length?(i="number"==typeof t?function(n){return yi(n,t)}:pt(t),n):i},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},xo.layout.tree=function(){function n(n,u){function o(n,t){var r=n.children,i=n._tree;if(r&&(u=r.length)){for(var u,a,l,s=r[0],f=s,h=-1;u>++h;)l=r[h],o(l,a),f=c(l,a,f),a=l;Ni(n);var g=.5*(s._tree.prelim+l._tree.prelim);t?(i.prelim=t._tree.prelim+e(n,t),i.mod=i.prelim-g):i.prelim=g}else t&&(i.prelim=t._tree.prelim+e(n,t))}function a(n,t){n.x=n._tree.prelim+t;var e=n.children;if(e&&(r=e.length)){var r,i=-1;for(t+=n._tree.mod;r>++i;)a(e[i],t)}}function c(n,t,r){if(t){for(var i,u=n,o=n,a=t,c=n.parent.children[0],l=u._tree.mod,s=o._tree.mod,f=a._tree.mod,h=c._tree.mod;a=_i(a),u=bi(u),a&&u;)c=bi(c),o=_i(o),o._tree.ancestor=n,i=a._tree.prelim+f-u._tree.prelim-l+e(a,u),i>0&&(qi(Ti(a,n,r),n,i),l+=i,s+=i),f+=a._tree.mod,l+=u._tree.mod,h+=c._tree.mod,s+=o._tree.mod;a&&!_i(o)&&(o._tree.thread=a,o._tree.mod+=f-s),u&&!bi(c)&&(c._tree.thread=u,c._tree.mod+=l-h,r=n)}return r}var l=t.call(this,n,u),s=l[0];Ai(s,function(n,t){n._tree={ancestor:n,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),o(s),a(s,-s._tree.prelim);var f=wi(s,Si),h=wi(s,Ei),g=wi(s,ki),p=f.x-e(f,h)/2,d=h.x+e(h,f)/2,m=g.depth||1;return Ai(s,i?function(n){n.x*=r[0],n.y=n.depth*r[1],delete n._tree}:function(n){n.x=(n.x-p)/(d-p)*r[0],n.y=n.depth/m*r[1],delete n._tree}),l}var t=xo.layout.hierarchy().sort(null).value(null),e=Mi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ii(n,t)},xo.layout.pack=function(){function n(n,u){var o=e.call(this,n,u),a=o[0],c=i[0],l=i[1],s=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,Ai(a,function(n){n.r=+s(n.value)}),Ai(a,zi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/l))/2;Ai(a,function(n){n.r+=f}),Ai(a,zi),Ai(a,function(n){n.r-=f})}return Hi(a,c/2,l/2,t?1:1/Math.max(2*a.r/c,2*a.r/l)),o}var t,e=xo.layout.hierarchy().sort(Ci),r=0,i=[1,1];return n.size=function(t){return arguments.length?(i=t,n):i},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},ii(n,e)},xo.layout.cluster=function(){function n(n,u){var o,a=t.call(this,n,u),c=a[0],l=0;Ai(c,function(n){var t=n.children;t&&t.length?(n.x=Ii(t),n.y=Pi(t)):(n.x=o?l+=e(n,o):0,n.y=0,o=n)});var s=Yi(c),f=Ui(c),h=s.x-e(s,f)/2,g=f.x+e(f,s)/2;return Ai(c,i?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=xo.layout.hierarchy().sort(null).value(null),e=Mi,r=[1,1],i=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(i=null==(r=t),n):i?null:r},n.nodeSize=function(t){return arguments.length?(i=null!=(r=t),n):i?r:null},ii(n,t)},xo.layout.treemap=function(){function n(n,t){for(var e,r,i=-1,u=n.length;u>++i;)r=(e=n[i]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var u=e.children;if(u&&u.length){var o,a,c,l=f(e),s=[],h=u.slice(),p=1/0,d="slice"===g?l.dx:"dice"===g?l.dy:"slice-dice"===g?1&e.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(n(h,l.dx*l.dy/e.value),s.area=0;(c=h.length)>0;)s.push(o=h[c-1]),s.area+=o.area,"squarify"!==g||p>=(a=r(s,d))?(h.pop(),p=a):(s.area-=s.pop().area,i(s,d,l,!1),d=Math.min(l.dx,l.dy),s.length=s.area=0,p=1/0);s.length&&(i(s,d,l,!0),s.length=s.area=0),u.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var u,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;u=a.pop();)c.push(u),c.area+=u.area,null!=u.z&&(i(c,u.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,i=0,u=1/0,o=-1,a=n.length;a>++o;)(e=n[o].area)&&(u>e&&(u=e),e>i&&(i=e));return r*=r,t*=t,r?Math.max(t*i*p/r,r/(t*u*p)):1/0}function i(n,t,e,r){var i,u=-1,o=n.length,a=e.x,l=e.y,s=t?c(n.area/t):0;if(t==e.dx){for((r||s>e.dy)&&(s=e.dy);o>++u;)i=n[u],i.x=a,i.y=l,i.dy=s,a+=i.dx=Math.min(e.x+e.dx-a,s?c(i.area/s):0);i.z=!0,i.dx+=e.x+e.dx-a,e.y+=s,e.dy-=s}else{for((r||s>e.dx)&&(s=e.dx);o>++u;)i=n[u],i.x=a,i.y=l,i.dx=s,l+=i.dy=Math.min(e.y+e.dy-l,s?c(i.area/s):0);i.z=!1,i.dy+=e.y+e.dy-l,e.x+=s,e.dx-=s}}function u(r){var i=o||a(r),u=i[0];return u.x=0,u.y=0,u.dx=l[0],u.dy=l[1],o&&a.revalue(u),n([u],u.dx*u.dy/u.value),(o?e:t)(u),h&&(o=i),i}var o,a=xo.layout.hierarchy(),c=Math.round,l=[1,1],s=null,f=Bi,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return u.size=function(n){return arguments.length?(l=n,u):l},u.padding=function(n){function t(t){var e=n.call(u,t,t.depth);return null==e?Bi(t):Vi(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return Vi(t,n)}if(!arguments.length)return s;var r;return f=null==(s=n)?Bi:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,u},u.round=function(n){return arguments.length?(c=n?Math.round:Number,u):c!=Number},u.sticky=function(n){return arguments.length?(h=n,o=null,u):h},u.ratio=function(n){return arguments.length?(p=n,u):p},u.mode=function(n){return arguments.length?(g=n+"",u):g},ii(u,a)},xo.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,i;do e=2*Math.random()-1,r=2*Math.random()-1,i=e*e+r*r;while(!i||i>1);return n+t*e*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var n=xo.random.normal.apply(xo,arguments);return function(){return Math.exp(n())}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t/n}}},xo.scale={};var kc={floor:dt,ceil:dt};xo.scale.linear=function(){return Ki([0,1],[0,1],Er,!1)},xo.scale.log=function(){return uu(xo.scale.linear().domain([0,1]),10,!0,[1,10])};var Ac=xo.format(".0e"),Nc={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};xo.scale.pow=function(){return ou(xo.scale.linear(),1,[0,1])},xo.scale.sqrt=function(){return xo.scale.pow().exponent(.5)},xo.scale.ordinal=function(){return cu([],{t:"range",a:[[]]})},xo.scale.category10=function(){return xo.scale.ordinal().range(qc)},xo.scale.category20=function(){return xo.scale.ordinal().range(Tc)},xo.scale.category20b=function(){return xo.scale.ordinal().range(Cc)},xo.scale.category20c=function(){return xo.scale.ordinal().range(jc)};var qc=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ut),Tc=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ut),Cc=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ut),jc=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ut);xo.scale.quantile=function(){return lu([],[])},xo.scale.quantize=function(){return su(0,1,[0,1])},xo.scale.threshold=function(){return fu([.5],[0,1])},xo.scale.identity=function(){return hu([0,1])},xo.svg.arc=function(){function n(){var n=t.apply(this,arguments),u=e.apply(this,arguments),o=r.apply(this,arguments)+Dc,a=i.apply(this,arguments)+Dc,c=(o>a&&(c=o,o=a,a=c),a-o),l=Qo>c?"0":"1",s=Math.cos(o),f=Math.sin(o),h=Math.cos(a),g=Math.sin(a);return c>=Fc?n?"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+u+"A"+u+","+u+" 0 1,1 0,"+-u+"A"+u+","+u+" 0 1,1 0,"+u+"Z":n?"M"+u*s+","+u*f+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+l+",0 "+n*s+","+n*f+"Z":"M"+u*s+","+u*f+"A"+u+","+u+" 0 "+l+",1 "+u*h+","+u*g+"L0,0"+"Z"}var t=gu,e=pu,r=du,i=mu;return n.innerRadius=function(e){return arguments.length?(t=pt(e),n):t},n.outerRadius=function(t){return arguments.length?(e=pt(t),n):e},n.startAngle=function(t){return arguments.length?(r=pt(t),n):r},n.endAngle=function(t){return arguments.length?(i=pt(t),n):i},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,u=(r.apply(this,arguments)+i.apply(this,arguments))/2+Dc;return[Math.cos(u)*n,Math.sin(u)*n]},n};var Dc=-Qo/2,Fc=2*Qo-1e-6;xo.svg.line.radial=function(){var n=Ye(vu);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},$e.reverse=We,We.reverse=$e,xo.svg.area=function(){return yu(dt)},xo.svg.area.radial=function(){var n=yu(vu);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},xo.svg.chord=function(){function n(n,a){var c=t(this,u,n,a),l=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,l)?i(c.r,c.p1,c.r,c.p0):i(c.r,c.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+i(l.r,l.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var i=t.call(n,e,r),u=a.call(n,i,r),o=c.call(n,i,r)+Dc,s=l.call(n,i,r)+Dc;return{r:u,a0:o,a1:s,p0:[u*Math.cos(o),u*Math.sin(o)],p1:[u*Math.cos(s),u*Math.sin(s)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Qo)+",1 "+t}function i(n,t,e,r){return"Q 0,0 "+r}var u=je,o=De,a=xu,c=du,l=mu;return n.radius=function(t){return arguments.length?(a=pt(t),n):a},n.source=function(t){return arguments.length?(u=pt(t),n):u},n.target=function(t){return arguments.length?(o=pt(t),n):o},n.startAngle=function(t){return arguments.length?(c=pt(t),n):c},n.endAngle=function(t){return arguments.length?(l=pt(t),n):l},n},xo.svg.diagonal=function(){function n(n,i){var u=t.call(this,n,i),o=e.call(this,n,i),a=(u.y+o.y)/2,c=[u,{x:u.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=je,e=De,r=Mu;return n.source=function(e){return arguments.length?(t=pt(e),n):t},n.target=function(t){return arguments.length?(e=pt(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},xo.svg.diagonal.radial=function(){var n=xo.svg.diagonal(),t=Mu,e=n.projection;return n.projection=function(n){return arguments.length?e(bu(t=n)):t},n},xo.svg.symbol=function(){function n(n,r){return(zc.get(t.call(this,n,r))||Eu)(e.call(this,n,r))}var t=wu,e=_u;return n.type=function(e){return arguments.length?(t=pt(e),n):t},n.size=function(t){return arguments.length?(e=pt(t),n):e},n};var zc=xo.map({circle:Eu,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Rc)),e=t*Rc;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/Hc),e=t*Hc/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/Hc),e=t*Hc/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});xo.svg.symbolTypes=zc.keys();var Lc,Oc,Hc=Math.sqrt(3),Rc=Math.tan(30*ea),Pc=[],Ic=0;Pc.call=Io.call,Pc.empty=Io.empty,Pc.node=Io.node,Pc.size=Io.size,xo.transition=function(n){return arguments.length?Lc?n.transition():n:Bo.transition()},xo.transition.prototype=Pc,Pc.select=function(n){var t,e,r,i=this.id,u=[];n=v(n);for(var o=-1,a=this.length;a>++o;){u.push(t=[]);for(var c=this[o],l=-1,s=c.length;s>++l;)(r=c[l])&&(e=n.call(r,r.__data__,l,o))?("__data__"in r&&(e.__data__=r.__data__),Nu(e,l,i,r.__transition__[i]),t.push(e)):t.push(null)}return Su(u,i)},Pc.selectAll=function(n){var t,e,r,i,u,o=this.id,a=[];n=y(n);for(var c=-1,l=this.length;l>++c;)for(var s=this[c],f=-1,h=s.length;h>++f;)if(r=s[f]){u=r.__transition__[o],e=n.call(r,r.__data__,f,c),a.push(t=[]);for(var g=-1,p=e.length;p>++g;)(i=e[g])&&Nu(i,g,o,u),t.push(i)}return Su(a,o)},Pc.filter=function(n){var t,e,r,i=[];"function"!=typeof n&&(n=N(n));for(var u=0,o=this.length;o>u;u++){i.push(t=[]);for(var e=this[u],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a)&&t.push(r)}return Su(i,this.id)},Pc.tween=function(n,t){var e=this.id;return 2>arguments.length?this.node().__transition__[e].tween.get(n):T(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},Pc.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function i(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function u(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(2>arguments.length){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Zr:Er,a=xo.ns.qualify(n);return ku(this,"attr."+n,t,a.local?u:i)},Pc.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(i));return r&&function(n){this.setAttribute(i,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(i.space,i.local));return r&&function(n){this.setAttributeNS(i.space,i.local,r(n))}}var i=xo.ns.qualify(n);return this.tween("attr."+n,i.local?r:e)},Pc.style=function(n,t,e){function r(){this.style.removeProperty(n)}function i(t){return null==t?r:(t+="",function(){var r,i=_o.getComputedStyle(this,null).getPropertyValue(n);return i!==t&&(r=Er(i,t),function(t){this.style.setProperty(n,r(t),e)})})}var u=arguments.length;if(3>u){if("string"!=typeof n){2>u&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return ku(this,"style."+n,t,i)},Pc.styleTween=function(n,t,e){function r(r,i){var u=t.call(this,r,i,_o.getComputedStyle(this,null).getPropertyValue(n));return u&&function(t){this.style.setProperty(n,u(t),e)}}return 3>arguments.length&&(e=""),this.tween("style."+n,r)},Pc.text=function(n){return ku(this,"text",n,Au)},Pc.remove=function(){return this.each("end.transition",function(){var n;!this.__transition__&&(n=this.parentNode)&&n.removeChild(this)})},Pc.ease=function(n){var t=this.id;return 1>arguments.length?this.node().__transition__[t].ease:("function"!=typeof n&&(n=xo.ease.apply(xo,arguments)),T(this,function(e){e.__transition__[t].ease=n}))},Pc.delay=function(n){var t=this.id;return T(this,"function"==typeof n?function(e,r,i){e.__transition__[t].delay=0|n.call(e,e.__data__,r,i)}:(n|=0,function(e){e.__transition__[t].delay=n}))},Pc.duration=function(n){var t=this.id;return T(this,"function"==typeof n?function(e,r,i){e.__transition__[t].duration=Math.max(1,0|n.call(e,e.__data__,r,i))}:(n=Math.max(1,0|n),function(e){e.__transition__[t].duration=n}))},Pc.each=function(n,t){var e=this.id;if(2>arguments.length){var r=Oc,i=Lc;Lc=e,T(this,function(t,r,i){Oc=t.__transition__[e],n.call(t,t.__data__,r,i)
}),Oc=r,Lc=i}else T(this,function(r){var i=r.__transition__[e];(i.event||(i.event=xo.dispatch("start","end"))).on(n,t)});return this},Pc.transition=function(){for(var n,t,e,r,i=this.id,u=++Ic,o=[],a=0,c=this.length;c>a;a++){o.push(n=[]);for(var t=this[a],l=0,s=t.length;s>l;l++)(e=t[l])&&(r=Object.create(e.__transition__[i]),r.delay+=r.duration,Nu(e,l,u,r)),n.push(e)}return Su(o,u)},xo.svg.axis=function(){function n(n){n.each(function(){var n,f=xo.select(this),h=null==l?e.ticks?e.ticks.apply(e,c):e.domain():l,g=null==t?e.tickFormat?e.tickFormat.apply(e,c):String:t,p=Cu(e,h,s),d=f.selectAll(".tick.minor").data(p,String),m=d.enter().insert("line",".tick").attr("class","tick minor").style("opacity",1e-6),v=xo.transition(d.exit()).style("opacity",1e-6).remove(),y=xo.transition(d).style("opacity",1),x=f.selectAll(".tick.major").data(h,String),M=x.enter().insert("g",".domain").attr("class","tick major").style("opacity",1e-6),b=xo.transition(x.exit()).style("opacity",1e-6).remove(),_=xo.transition(x).style("opacity",1),w=Zi(e),E=f.selectAll(".domain").data([0]),S=(E.enter().append("path").attr("class","domain"),xo.transition(E)),k=e.copy(),A=this.__chart__||k;this.__chart__=k,M.append("line"),M.append("text");var N=M.select("line"),q=_.select("line"),T=x.select("text").text(g),C=M.select("text"),j=_.select("text");switch(r){case"bottom":n=qu,m.attr("y2",u),y.attr("x2",0).attr("y2",u),N.attr("y2",i),C.attr("y",Math.max(i,0)+a),q.attr("x2",0).attr("y2",i),j.attr("x",0).attr("y",Math.max(i,0)+a),T.attr("dy",".71em").style("text-anchor","middle"),S.attr("d","M"+w[0]+","+o+"V0H"+w[1]+"V"+o);break;case"top":n=qu,m.attr("y2",-u),y.attr("x2",0).attr("y2",-u),N.attr("y2",-i),C.attr("y",-(Math.max(i,0)+a)),q.attr("x2",0).attr("y2",-i),j.attr("x",0).attr("y",-(Math.max(i,0)+a)),T.attr("dy","0em").style("text-anchor","middle"),S.attr("d","M"+w[0]+","+-o+"V0H"+w[1]+"V"+-o);break;case"left":n=Tu,m.attr("x2",-u),y.attr("x2",-u).attr("y2",0),N.attr("x2",-i),C.attr("x",-(Math.max(i,0)+a)),q.attr("x2",-i).attr("y2",0),j.attr("x",-(Math.max(i,0)+a)).attr("y",0),T.attr("dy",".32em").style("text-anchor","end"),S.attr("d","M"+-o+","+w[0]+"H0V"+w[1]+"H"+-o);break;case"right":n=Tu,m.attr("x2",u),y.attr("x2",u).attr("y2",0),N.attr("x2",i),C.attr("x",Math.max(i,0)+a),q.attr("x2",i).attr("y2",0),j.attr("x",Math.max(i,0)+a).attr("y",0),T.attr("dy",".32em").style("text-anchor","start"),S.attr("d","M"+o+","+w[0]+"H0V"+w[1]+"H"+o)}if(e.rangeBand){var D=k.rangeBand()/2,F=function(n){return k(n)+D};M.call(n,F),_.call(n,F)}else M.call(n,A),_.call(n,k),b.call(n,k),m.call(n,A),y.call(n,k),v.call(n,k)})}var t,e=xo.scale.linear(),r=Yc,i=6,u=6,o=6,a=3,c=[10],l=null,s=0;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in Uc?t+"":Yc,n):r},n.ticks=function(){return arguments.length?(c=arguments,n):c},n.tickValues=function(t){return arguments.length?(l=t,n):l},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t,e){if(!arguments.length)return i;var r=arguments.length-1;return i=+t,u=r>1?+e:i,o=r>0?+arguments[r]:i,n},n.tickPadding=function(t){return arguments.length?(a=+t,n):a},n.tickSubdivide=function(t){return arguments.length?(s=+t,n):s},n};var Yc="bottom",Uc={top:1,right:1,bottom:1,left:1};xo.svg.brush=function(){function n(u){u.each(function(){var u,o=xo.select(this),s=o.selectAll(".background").data([0]),f=o.selectAll(".extent").data([0]),h=o.selectAll(".resize").data(l,String);o.style("pointer-events","all").on("mousedown.brush",i).on("touchstart.brush",i),s.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),f.enter().append("rect").attr("class","extent").style("cursor","move"),h.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return Bc[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),h.style("display",n.empty()?"none":null),h.exit().remove(),a&&(u=Zi(a),s.attr("x",u[0]).attr("width",u[1]-u[0]),e(o)),c&&(u=Zi(c),s.attr("y",u[0]).attr("height",u[1]-u[0]),r(o)),t(o)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+s[+/e$/.test(n)][0]+","+s[+/^s/.test(n)][1]+")"})}function e(n){n.select(".extent").attr("x",s[0][0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",s[1][0]-s[0][0])}function r(n){n.select(".extent").attr("y",s[0][1]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1][1]-s[0][1])}function i(){function i(){var n=xo.event.changedTouches;return n?xo.touches(x,n)[0]:xo.mouse(x)}function l(){32==xo.event.keyCode&&(k||(v=null,N[0]-=s[1][0],N[1]-=s[1][1],k=2),g())}function h(){32==xo.event.keyCode&&2==k&&(N[0]+=s[1][0],N[1]+=s[1][1],k=0,g())}function p(){var n=i(),u=!1;y&&(n[0]+=y[0],n[1]+=y[1]),k||(xo.event.altKey?(v||(v=[(s[0][0]+s[1][0])/2,(s[0][1]+s[1][1])/2]),N[0]=s[+(n[0]<v[0])][0],N[1]=s[+(n[1]<v[1])][1]):v=null),E&&d(n,a,0)&&(e(_),u=!0),S&&d(n,c,1)&&(r(_),u=!0),u&&(t(_),b({type:"brush",mode:k?"move":"resize"}))}function d(n,t,e){var r,i,o=Zi(t),a=o[0],c=o[1],l=N[e],h=s[1][e]-s[0][e];return k&&(a-=l,c-=h+l),r=f[e]?Math.max(a,Math.min(c,n[e])):n[e],k?i=(r+=l)+h:(v&&(l=Math.max(a,Math.min(c,2*v[e]-r))),r>l?(i=r,r=l):i=l),s[0][e]!==r||s[1][e]!==i?(u=null,s[0][e]=r,s[1][e]=i,!0):void 0}function m(){p(),_.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),xo.select("body").style("cursor",null),q.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),A(),b({type:"brushend"})}var v,y,x=this,M=xo.select(xo.event.target),b=o.of(x,arguments),_=xo.select(x),w=M.datum(),E=!/^(n|s)$/.test(w)&&a,S=!/^(e|w)$/.test(w)&&c,k=M.classed("extent"),A=L(),N=i(),q=xo.select(_o).on("keydown.brush",l).on("keyup.brush",h);if(xo.event.changedTouches?q.on("touchmove.brush",p).on("touchend.brush",m):q.on("mousemove.brush",p).on("mouseup.brush",m),k)N[0]=s[0][0]-N[0],N[1]=s[0][1]-N[1];else if(w){var T=+/w$/.test(w),C=+/^n/.test(w);y=[s[1-T][0]-N[0],s[1-C][1]-N[1]],N[0]=s[T][0],N[1]=s[C][1]}else xo.event.altKey&&(v=N.slice());_.style("pointer-events","none").selectAll(".resize").style("display",null),xo.select("body").style("cursor",M.style("cursor")),b({type:"brushstart"}),p()}var u,o=d(n,"brushstart","brush","brushend"),a=null,c=null,l=Vc[0],s=[[0,0],[0,0]],f=[!0,!0];return n.x=function(t){return arguments.length?(a=t,l=Vc[!a<<1|!c],n):a},n.y=function(t){return arguments.length?(c=t,l=Vc[!a<<1|!c],n):c},n.clamp=function(t){return arguments.length?(a&&c?f=[!!t[0],!!t[1]]:(a||c)&&(f[+!a]=!!t),n):a&&c?f:a||c?f[+!a]:null},n.extent=function(t){var e,r,i,o,l;return arguments.length?(u=[[0,0],[0,0]],a&&(e=t[0],r=t[1],c&&(e=e[0],r=r[0]),u[0][0]=e,u[1][0]=r,a.invert&&(e=a(e),r=a(r)),e>r&&(l=e,e=r,r=l),s[0][0]=0|e,s[1][0]=0|r),c&&(i=t[0],o=t[1],a&&(i=i[1],o=o[1]),u[0][1]=i,u[1][1]=o,c.invert&&(i=c(i),o=c(o)),i>o&&(l=i,i=o,o=l),s[0][1]=0|i,s[1][1]=0|o),n):(t=u||s,a&&(e=t[0][0],r=t[1][0],u||(e=s[0][0],r=s[1][0],a.invert&&(e=a.invert(e),r=a.invert(r)),e>r&&(l=e,e=r,r=l))),c&&(i=t[0][1],o=t[1][1],u||(i=s[0][1],o=s[1][1],c.invert&&(i=c.invert(i),o=c.invert(o)),i>o&&(l=i,i=o,o=l))),a&&c?[[e,i],[r,o]]:a?[e,r]:c&&[i,o])},n.clear=function(){return u=null,s[0][0]=s[0][1]=s[1][0]=s[1][1]=0,n},n.empty=function(){return a&&s[0][0]===s[1][0]||c&&s[0][1]===s[1][1]},xo.rebind(n,o,"on")};var Bc={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Vc=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]];xo.time={};var Xc=Date,Zc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];ju.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(){$c.setUTCDate.apply(this._,arguments)},setDay:function(){$c.setUTCDay.apply(this._,arguments)},setFullYear:function(){$c.setUTCFullYear.apply(this._,arguments)},setHours:function(){$c.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){$c.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){$c.setUTCMinutes.apply(this._,arguments)},setMonth:function(){$c.setUTCMonth.apply(this._,arguments)},setSeconds:function(){$c.setUTCSeconds.apply(this._,arguments)},setTime:function(){$c.setTime.apply(this._,arguments)}};var $c=Date.prototype,Wc="%a %b %e %X %Y",Jc="%m/%d/%Y",Gc="%H:%M:%S",Kc=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Qc=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],nl=["January","February","March","April","May","June","July","August","September","October","November","December"],tl=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];xo.time.year=Du(function(n){return n=xo.time.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),xo.time.years=xo.time.year.range,xo.time.years.utc=xo.time.year.utc.range,xo.time.day=Du(function(n){var t=new Xc(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),xo.time.days=xo.time.day.range,xo.time.days.utc=xo.time.day.utc.range,xo.time.dayOfYear=function(n){var t=xo.time.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},Zc.forEach(function(n,t){n=n.toLowerCase(),t=7-t;var e=xo.time[n]=Du(function(n){return(n=xo.time.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=xo.time.year(n).getDay();return Math.floor((xo.time.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});xo.time[n+"s"]=e.range,xo.time[n+"s"].utc=e.utc.range,xo.time[n+"OfYear"]=function(n){var e=xo.time.year(n).getDay();return Math.floor((xo.time.dayOfYear(n)+(e+t)%7)/7)}}),xo.time.week=xo.time.sunday,xo.time.weeks=xo.time.sunday.range,xo.time.weeks.utc=xo.time.sunday.utc.range,xo.time.weekOfYear=xo.time.sundayOfYear,xo.time.format=function(n){function t(t){for(var r,i,u,o=[],a=-1,c=0;e>++a;)37===n.charCodeAt(a)&&(o.push(n.substring(c,a)),null!=(i=fl[r=n.charAt(++a)])&&(r=n.charAt(++a)),(u=hl[r])&&(r=u(t,null==i?"e"===r?" ":"0":i)),o.push(r),c=a+1);return o.push(n.substring(c,a)),o.join("")}var e=n.length;return t.parse=function(t){var e={y:1900,m:0,d:1,H:0,M:0,S:0,L:0},r=zu(e,n,t,0);if(r!=t.length)return null;"p"in e&&(e.H=e.H%12+12*e.p);var i=new Xc;return"j"in e?i.setFullYear(e.y,0,e.j):"w"in e&&("W"in e||"U"in e)?(i.setFullYear(e.y,0,1),i.setFullYear(e.y,0,"W"in e?(e.w+6)%7+7*e.W-(i.getDay()+5)%7:e.w+7*e.U-(i.getDay()+6)%7)):i.setFullYear(e.y,e.m,e.d),i.setHours(e.H,e.M,e.S,e.L),i},t.toString=function(){return n},t};var el=Lu(Kc),rl=Ou(Kc),il=Lu(Qc),ul=Ou(Qc),ol=Lu(nl),al=Ou(nl),cl=Lu(tl),ll=Ou(tl),sl=/^%/,fl={"-":"",_:" ",0:"0"},hl={a:function(n){return Qc[n.getDay()]},A:function(n){return Kc[n.getDay()]},b:function(n){return tl[n.getMonth()]},B:function(n){return nl[n.getMonth()]},c:xo.time.format(Wc),d:function(n,t){return Hu(n.getDate(),t,2)},e:function(n,t){return Hu(n.getDate(),t,2)},H:function(n,t){return Hu(n.getHours(),t,2)},I:function(n,t){return Hu(n.getHours()%12||12,t,2)},j:function(n,t){return Hu(1+xo.time.dayOfYear(n),t,3)},L:function(n,t){return Hu(n.getMilliseconds(),t,3)},m:function(n,t){return Hu(n.getMonth()+1,t,2)},M:function(n,t){return Hu(n.getMinutes(),t,2)},p:function(n){return n.getHours()>=12?"PM":"AM"},S:function(n,t){return Hu(n.getSeconds(),t,2)},U:function(n,t){return Hu(xo.time.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Hu(xo.time.mondayOfYear(n),t,2)},x:xo.time.format(Jc),X:xo.time.format(Gc),y:function(n,t){return Hu(n.getFullYear()%100,t,2)},Y:function(n,t){return Hu(n.getFullYear()%1e4,t,4)},Z:oo,"%":function(){return"%"}},gl={a:Ru,A:Pu,b:Bu,B:Vu,c:Xu,d:Qu,e:Qu,H:to,I:to,j:no,L:io,m:Ku,M:eo,p:uo,S:ro,U:Yu,w:Iu,W:Uu,x:Zu,X:$u,y:Ju,Y:Wu,"%":ao},pl=/^\s*\d+/,dl=xo.map({am:0,pm:1});xo.time.format.utc=function(n){function t(n){try{Xc=ju;var t=new Xc;return t._=n,e(t)}finally{Xc=Date}}var e=xo.time.format(n);return t.parse=function(n){try{Xc=ju;var t=e.parse(n);return t&&t._}finally{Xc=Date}},t.toString=e.toString,t};var ml=xo.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");xo.time.format.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?co:ml,co.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},co.toString=ml.toString,xo.time.second=Du(function(n){return new Xc(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),xo.time.seconds=xo.time.second.range,xo.time.seconds.utc=xo.time.second.utc.range,xo.time.minute=Du(function(n){return new Xc(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),xo.time.minutes=xo.time.minute.range,xo.time.minutes.utc=xo.time.minute.utc.range,xo.time.hour=Du(function(n){var t=n.getTimezoneOffset()/60;return new Xc(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),xo.time.hours=xo.time.hour.range,xo.time.hours.utc=xo.time.hour.utc.range,xo.time.month=Du(function(n){return n=xo.time.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),xo.time.months=xo.time.month.range,xo.time.months.utc=xo.time.month.utc.range;var vl=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],yl=[[xo.time.second,1],[xo.time.second,5],[xo.time.second,15],[xo.time.second,30],[xo.time.minute,1],[xo.time.minute,5],[xo.time.minute,15],[xo.time.minute,30],[xo.time.hour,1],[xo.time.hour,3],[xo.time.hour,6],[xo.time.hour,12],[xo.time.day,1],[xo.time.day,2],[xo.time.week,1],[xo.time.month,1],[xo.time.month,3],[xo.time.year,1]],xl=[[xo.time.format("%Y"),Vt],[xo.time.format("%B"),function(n){return n.getMonth()}],[xo.time.format("%b %d"),function(n){return 1!=n.getDate()}],[xo.time.format("%a %d"),function(n){return n.getDay()&&1!=n.getDate()}],[xo.time.format("%I %p"),function(n){return n.getHours()}],[xo.time.format("%I:%M"),function(n){return n.getMinutes()}],[xo.time.format(":%S"),function(n){return n.getSeconds()}],[xo.time.format(".%L"),function(n){return n.getMilliseconds()}]],Ml=xo.scale.linear(),bl=fo(xl);yl.year=function(n,t){return Ml.domain(n.map(go)).ticks(t).map(ho)},xo.time.scale=function(){return lo(xo.scale.linear(),yl,bl)};var _l=yl.map(function(n){return[n[0].utc,n[1]]}),wl=[[xo.time.format.utc("%Y"),Vt],[xo.time.format.utc("%B"),function(n){return n.getUTCMonth()}],[xo.time.format.utc("%b %d"),function(n){return 1!=n.getUTCDate()}],[xo.time.format.utc("%a %d"),function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],[xo.time.format.utc("%I %p"),function(n){return n.getUTCHours()}],[xo.time.format.utc("%I:%M"),function(n){return n.getUTCMinutes()}],[xo.time.format.utc(":%S"),function(n){return n.getUTCSeconds()}],[xo.time.format.utc(".%L"),function(n){return n.getUTCMilliseconds()}]],El=fo(wl);return _l.year=function(n,t){return Ml.domain(n.map(mo)).ticks(t).map(po)},xo.time.scale.utc=function(){return lo(xo.scale.linear(),_l,El)},xo.text=mt(function(n){return n.responseText}),xo.json=function(n,t){return vt(n,"application/json",vo,t)},xo.html=function(n,t){return vt(n,"text/html",yo,t)},xo.xml=mt(function(n){return n.responseXML}),xo}()},{}]},{},[]),require=function(n,t,e){function r(e,u){if(!t[e]){if(!n[e]){var o="function"==typeof require&&require;if(!u&&o)return o(e,!0);if(i)return i(e,!0);throw Error("Cannot find module '"+e+"'")}var a=t[e]={exports:{}};n[e][0].call(a.exports,function(t){var i=n[e][1][t];return r(i?i:t)},a,a.exports)}return t[e].exports}for(var i="function"==typeof require&&require,u=0;e.length>u;u++)r(e[u]);return r}({underscore:[function(n,t){t.exports=n("tN5ju0")},{}],tN5ju0:[function(n,t,e){(function(){(function(){var n=this,r=n._,i={},u=Array.prototype,o=Object.prototype,a=Function.prototype,c=u.push,l=u.slice,s=u.concat,f=o.toString,h=o.hasOwnProperty,g=u.forEach,p=u.map,d=u.reduce,m=u.reduceRight,v=u.filter,y=u.every,x=u.some,M=u.indexOf,b=u.lastIndexOf,_=Array.isArray,w=Object.keys,E=a.bind,S=function(n){return n instanceof S?n:this instanceof S?(this._wrapped=n,void 0):new S(n)};e!==void 0?(t!==void 0&&t.exports&&(e=t.exports=S),e._=S):n._=S,S.VERSION="1.5.1";var k=S.each=S.forEach=function(n,t,e){if(null!=n)if(g&&n.forEach===g)n.forEach(t,e);else if(n.length===+n.length){for(var r=0,u=n.length;u>r;r++)if(t.call(e,n[r],r,n)===i)return}else for(var o in n)if(S.has(n,o)&&t.call(e,n[o],o,n)===i)return};S.map=S.collect=function(n,t,e){var r=[];return null==n?r:p&&n.map===p?n.map(t,e):(k(n,function(n,i,u){r.push(t.call(e,n,i,u))}),r)};var A="Reduce of empty array with no initial value";S.reduce=S.foldl=S.inject=function(n,t,e,r){var i=arguments.length>2;if(null==n&&(n=[]),d&&n.reduce===d)return r&&(t=S.bind(t,r)),i?n.reduce(t,e):n.reduce(t);if(k(n,function(n,u,o){i?e=t.call(r,e,n,u,o):(e=n,i=!0)}),!i)throw new TypeError(A);return e},S.reduceRight=S.foldr=function(n,t,e,r){var i=arguments.length>2;if(null==n&&(n=[]),m&&n.reduceRight===m)return r&&(t=S.bind(t,r)),i?n.reduceRight(t,e):n.reduceRight(t);var u=n.length;if(u!==+u){var o=S.keys(n);u=o.length}if(k(n,function(a,c,l){c=o?o[--u]:--u,i?e=t.call(r,e,n[c],c,l):(e=n[c],i=!0)}),!i)throw new TypeError(A);return e},S.find=S.detect=function(n,t,e){var r;return N(n,function(n,i,u){return t.call(e,n,i,u)?(r=n,!0):void 0}),r},S.filter=S.select=function(n,t,e){var r=[];return null==n?r:v&&n.filter===v?n.filter(t,e):(k(n,function(n,i,u){t.call(e,n,i,u)&&r.push(n)}),r)},S.reject=function(n,t,e){return S.filter(n,function(n,r,i){return!t.call(e,n,r,i)},e)},S.every=S.all=function(n,t,e){t||(t=S.identity);var r=!0;return null==n?r:y&&n.every===y?n.every(t,e):(k(n,function(n,u,o){return(r=r&&t.call(e,n,u,o))?void 0:i}),!!r)};var N=S.some=S.any=function(n,t,e){t||(t=S.identity);var r=!1;return null==n?r:x&&n.some===x?n.some(t,e):(k(n,function(n,u,o){return r||(r=t.call(e,n,u,o))?i:void 0}),!!r)};S.contains=S.include=function(n,t){return null==n?!1:M&&n.indexOf===M?-1!=n.indexOf(t):N(n,function(n){return n===t})},S.invoke=function(n,t){var e=l.call(arguments,2),r=S.isFunction(t);return S.map(n,function(n){return(r?t:n[t]).apply(n,e)})},S.pluck=function(n,t){return S.map(n,function(n){return n[t]})},S.where=function(n,t,e){return S.isEmpty(t)?e?void 0:[]:S[e?"find":"filter"](n,function(n){for(var e in t)if(t[e]!==n[e])return!1;return!0})},S.findWhere=function(n,t){return S.where(n,t,!0)},S.max=function(n,t,e){if(!t&&S.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&S.isEmpty(n))return-1/0;var r={computed:-1/0,value:-1/0};return k(n,function(n,i,u){var o=t?t.call(e,n,i,u):n;o>r.computed&&(r={value:n,computed:o})}),r.value},S.min=function(n,t,e){if(!t&&S.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&S.isEmpty(n))return 1/0;var r={computed:1/0,value:1/0};return k(n,function(n,i,u){var o=t?t.call(e,n,i,u):n;r.computed>o&&(r={value:n,computed:o})}),r.value},S.shuffle=function(n){var t,e=0,r=[];return k(n,function(n){t=S.random(e++),r[e-1]=r[t],r[t]=n}),r};var q=function(n){return S.isFunction(n)?n:function(t){return t[n]}};S.sortBy=function(n,t,e){var r=q(t);return S.pluck(S.map(n,function(n,t,i){return{value:n,index:t,criteria:r.call(e,n,t,i)}}).sort(function(n,t){var e=n.criteria,r=t.criteria;if(e!==r){if(e>r||void 0===e)return 1;if(r>e||void 0===r)return-1}return n.index<t.index?-1:1}),"value")};var T=function(n,t,e,r){var i={},u=q(null==t?S.identity:t);return k(n,function(t,o){var a=u.call(e,t,o,n);r(i,a,t)}),i};S.groupBy=function(n,t,e){return T(n,t,e,function(n,t,e){(S.has(n,t)?n[t]:n[t]=[]).push(e)})},S.countBy=function(n,t,e){return T(n,t,e,function(n,t){S.has(n,t)||(n[t]=0),n[t]++})},S.sortedIndex=function(n,t,e,r){e=null==e?S.identity:q(e);for(var i=e.call(r,t),u=0,o=n.length;o>u;){var a=u+o>>>1;i>e.call(r,n[a])?u=a+1:o=a}return u},S.toArray=function(n){return n?S.isArray(n)?l.call(n):n.length===+n.length?S.map(n,S.identity):S.values(n):[]},S.size=function(n){return null==n?0:n.length===+n.length?n.length:S.keys(n).length},S.first=S.head=S.take=function(n,t,e){return null==n?void 0:null==t||e?n[0]:l.call(n,0,t)},S.initial=function(n,t,e){return l.call(n,0,n.length-(null==t||e?1:t))},S.last=function(n,t,e){return null==n?void 0:null==t||e?n[n.length-1]:l.call(n,Math.max(n.length-t,0))},S.rest=S.tail=S.drop=function(n,t,e){return l.call(n,null==t||e?1:t)},S.compact=function(n){return S.filter(n,S.identity)};var C=function(n,t,e){return t&&S.every(n,S.isArray)?s.apply(e,n):(k(n,function(n){S.isArray(n)||S.isArguments(n)?t?c.apply(e,n):C(n,t,e):e.push(n)}),e)};S.flatten=function(n,t){return C(n,t,[])},S.without=function(n){return S.difference(n,l.call(arguments,1))},S.uniq=S.unique=function(n,t,e,r){S.isFunction(t)&&(r=e,e=t,t=!1);var i=e?S.map(n,e,r):n,u=[],o=[];return k(i,function(e,r){(t?r&&o[o.length-1]===e:S.contains(o,e))||(o.push(e),u.push(n[r]))}),u},S.union=function(){return S.uniq(S.flatten(arguments,!0))},S.intersection=function(n){var t=l.call(arguments,1);return S.filter(S.uniq(n),function(n){return S.every(t,function(t){return S.indexOf(t,n)>=0})})},S.difference=function(n){var t=s.apply(u,l.call(arguments,1));return S.filter(n,function(n){return!S.contains(t,n)})},S.zip=function(){for(var n=S.max(S.pluck(arguments,"length").concat(0)),t=Array(n),e=0;n>e;e++)t[e]=S.pluck(arguments,""+e);return t},S.object=function(n,t){if(null==n)return{};for(var e={},r=0,i=n.length;i>r;r++)t?e[n[r]]=t[r]:e[n[r][0]]=n[r][1];return e},S.indexOf=function(n,t,e){if(null==n)return-1;var r=0,i=n.length;if(e){if("number"!=typeof e)return r=S.sortedIndex(n,t),n[r]===t?r:-1;r=0>e?Math.max(0,i+e):e}if(M&&n.indexOf===M)return n.indexOf(t,e);for(;i>r;r++)if(n[r]===t)return r;return-1},S.lastIndexOf=function(n,t,e){if(null==n)return-1;var r=null!=e;if(b&&n.lastIndexOf===b)return r?n.lastIndexOf(t,e):n.lastIndexOf(t);for(var i=r?e:n.length;i--;)if(n[i]===t)return i;return-1},S.range=function(n,t,e){1>=arguments.length&&(t=n||0,n=0),e=arguments[2]||1;for(var r=Math.max(Math.ceil((t-n)/e),0),i=0,u=Array(r);r>i;)u[i++]=n,n+=e;return u};var j=function(){};S.bind=function(n,t){var e,r;if(E&&n.bind===E)return E.apply(n,l.call(arguments,1));if(!S.isFunction(n))throw new TypeError;return e=l.call(arguments,2),r=function(){if(!(this instanceof r))return n.apply(t,e.concat(l.call(arguments)));j.prototype=n.prototype;var i=new j;j.prototype=null;var u=n.apply(i,e.concat(l.call(arguments)));return Object(u)===u?u:i}},S.partial=function(n){var t=l.call(arguments,1);return function(){return n.apply(this,t.concat(l.call(arguments)))}},S.bindAll=function(n){var t=l.call(arguments,1);if(0===t.length)throw Error("bindAll must be passed function names");return k(t,function(t){n[t]=S.bind(n[t],n)}),n},S.memoize=function(n,t){var e={};return t||(t=S.identity),function(){var r=t.apply(this,arguments);return S.has(e,r)?e[r]:e[r]=n.apply(this,arguments)}},S.delay=function(n,t){var e=l.call(arguments,2);return setTimeout(function(){return n.apply(null,e)},t)},S.defer=function(n){return S.delay.apply(S,[n,1].concat(l.call(arguments,1)))},S.throttle=function(n,t,e){var r,i,u,o=null,a=0;e||(e={});var c=function(){a=e.leading===!1?0:new Date,o=null,u=n.apply(r,i)};return function(){var l=new Date;a||e.leading!==!1||(a=l);var s=t-(l-a);return r=this,i=arguments,0>=s?(clearTimeout(o),o=null,a=l,u=n.apply(r,i)):o||e.trailing===!1||(o=setTimeout(c,s)),u}},S.debounce=function(n,t,e){var r,i=null;return function(){var u=this,o=arguments,a=function(){i=null,e||(r=n.apply(u,o))},c=e&&!i;return clearTimeout(i),i=setTimeout(a,t),c&&(r=n.apply(u,o)),r}},S.once=function(n){var t,e=!1;return function(){return e?t:(e=!0,t=n.apply(this,arguments),n=null,t)}},S.wrap=function(n,t){return function(){var e=[n];return c.apply(e,arguments),t.apply(this,e)}},S.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length-1;e>=0;e--)t=[n[e].apply(this,t)];return t[0]}},S.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},S.keys=w||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var e in n)S.has(n,e)&&t.push(e);return t},S.values=function(n){var t=[];for(var e in n)S.has(n,e)&&t.push(n[e]);return t},S.pairs=function(n){var t=[];for(var e in n)S.has(n,e)&&t.push([e,n[e]]);return t},S.invert=function(n){var t={};for(var e in n)S.has(n,e)&&(t[n[e]]=e);return t},S.functions=S.methods=function(n){var t=[];for(var e in n)S.isFunction(n[e])&&t.push(e);return t.sort()},S.extend=function(n){return k(l.call(arguments,1),function(t){if(t)for(var e in t)n[e]=t[e]}),n},S.pick=function(n){var t={},e=s.apply(u,l.call(arguments,1));return k(e,function(e){e in n&&(t[e]=n[e])}),t},S.omit=function(n){var t={},e=s.apply(u,l.call(arguments,1));for(var r in n)S.contains(e,r)||(t[r]=n[r]);return t},S.defaults=function(n){return k(l.call(arguments,1),function(t){if(t)for(var e in t)void 0===n[e]&&(n[e]=t[e])}),n},S.clone=function(n){return S.isObject(n)?S.isArray(n)?n.slice():S.extend({},n):n},S.tap=function(n,t){return t(n),n};var D=function(n,t,e,r){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof S&&(n=n._wrapped),t instanceof S&&(t=t._wrapped);var i=f.call(n);if(i!=f.call(t))return!1;switch(i){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var u=e.length;u--;)if(e[u]==n)return r[u]==t;var o=n.constructor,a=t.constructor;if(o!==a&&!(S.isFunction(o)&&o instanceof o&&S.isFunction(a)&&a instanceof a))return!1;e.push(n),r.push(t);var c=0,l=!0;if("[object Array]"==i){if(c=n.length,l=c==t.length)for(;c--&&(l=D(n[c],t[c],e,r)););}else{for(var s in n)if(S.has(n,s)&&(c++,!(l=S.has(t,s)&&D(n[s],t[s],e,r))))break;if(l){for(s in t)if(S.has(t,s)&&!c--)break;l=!c}}return e.pop(),r.pop(),l};S.isEqual=function(n,t){return D(n,t,[],[])},S.isEmpty=function(n){if(null==n)return!0;if(S.isArray(n)||S.isString(n))return 0===n.length;for(var t in n)if(S.has(n,t))return!1;return!0},S.isElement=function(n){return!(!n||1!==n.nodeType)},S.isArray=_||function(n){return"[object Array]"==f.call(n)},S.isObject=function(n){return n===Object(n)},k(["Arguments","Function","String","Number","Date","RegExp"],function(n){S["is"+n]=function(t){return f.call(t)=="[object "+n+"]"}}),S.isArguments(arguments)||(S.isArguments=function(n){return!(!n||!S.has(n,"callee"))}),S.isFunction=function(n){return"function"==typeof n},S.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},S.isNaN=function(n){return S.isNumber(n)&&n!=+n},S.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==f.call(n)},S.isNull=function(n){return null===n},S.isUndefined=function(n){return void 0===n},S.has=function(n,t){return h.call(n,t)},S.noConflict=function(){return n._=r,this},S.identity=function(n){return n},S.times=function(n,t,e){for(var r=Array(Math.max(0,n)),i=0;n>i;i++)r[i]=t.call(e,i);return r},S.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var F={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};F.unescape=S.invert(F.escape);var z={escape:RegExp("["+S.keys(F.escape).join("")+"]","g"),unescape:RegExp("("+S.keys(F.unescape).join("|")+")","g")};S.each(["escape","unescape"],function(n){S[n]=function(t){return null==t?"":(""+t).replace(z[n],function(t){return F[n][t]})}}),S.result=function(n,t){if(null==n)return void 0;var e=n[t];return S.isFunction(e)?e.call(n):e},S.mixin=function(n){k(S.functions(n),function(t){var e=S[t]=n[t];S.prototype[t]=function(){var n=[this._wrapped];return c.apply(n,arguments),P.call(this,e.apply(S,n))}})};var L=0;S.uniqueId=function(n){var t=++L+"";return n?n+t:t},S.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,H={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;S.template=function(n,t,e){var r;e=S.defaults({},e,S.templateSettings);var i=RegExp([(e.escape||O).source,(e.interpolate||O).source,(e.evaluate||O).source].join("|")+"|$","g"),u=0,o="__p+='";n.replace(i,function(t,e,r,i,a){return o+=n.slice(u,a).replace(R,function(n){return"\\"+H[n]}),e&&(o+="'+\n((__t=("+e+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),u=a+t.length,t}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=Function(e.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(t)return r(t,S);var c=function(n){return r.call(this,n,S)};return c.source="function("+(e.variable||"obj")+"){\n"+o+"}",c},S.chain=function(n){return S(n).chain()};var P=function(n){return this._chain?S(n).chain():n};S.mixin(S),k(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=u[n];S.prototype[n]=function(){var e=this._wrapped;return t.apply(e,arguments),"shift"!=n&&"splice"!=n||0!==e.length||delete e[0],P.call(this,e)}}),k(["concat","join","slice"],function(n){var t=u[n];S.prototype[n]=function(){return P.call(this,t.apply(this._wrapped,arguments))}}),S.extend(S.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)})()},{}]},{},[]);var d3=require("d3"),_=require("underscore"),w=window.innerWidth,h=window.innerHeight-100,tempo=500,data={Men:{"Dept A":[51,82],"Dept B":[35,56],"Dept C":[12,33],"Dept D":[14,42],"Dept E":[5,19],"Dept F":[2,27]},Women:{"Dept A":[9,11],"Dept B":[2,3],"Dept C":[20,59],"Dept D":[13,38],"Dept E":[9,39],"Dept F":[2,34]}},combined=function(n){return _.reduce(_.toArray(data)[n],function(n,t){return _.zip(n,t).map(function(n){return n[0]+n[1]})},[0,0])},rows=_.keys(data),cols=_.keys(_.first(_.toArray(data))),col_maxs=function(){var n=_.map(cols,function(n){var t=0;return _.reduce(_.toArray(data),function(e,r,i){var u=r[n][0]/r[n][1];return u>e&&(t=i,e=u),e},0),t}),t=-1;return _.reduce(rows,function(n,e,r){var i=combined(r);return i=i[0]/i[1],i>n&&(t=r,n=i),n},0),n.push(t),n}(),num_nodes=_.chain(data).map(function(n){return _.map(n,function(n){return _.last(n)}).reduce(function(n,t){return n+t})}).reduce(function(n,t){return n+t},0).value(),max_nodes_per_ratio=d3.max(_.map(data,function(n){return d3.max(_.map(n,function(n){return _.last(n)}))})),fill=function(n){return n?"black":"steelblue"},svg=d3.select("body").append("svg").attr("width",w).attr("height",h),createForce=function(){return d3.layout.force().nodes([]).links([]).gravity(0).size([w,h]).linkDistance(0).linkStrength(2).friction(.2).charge(function(n){return n.charge})},forces=_.map(rows,createForce),linktoFoci=function(n,t){return n.map(function(n){return{source:n,target:t}})},createNodes=function(n,t,e){return d3.range(t).map(function(t){return{id:n>t?0:1,x:n>t?0:w,y:Math.random()*h,charge:-1e4/max_nodes_per_ratio,name:e}})},createFoci=function(n,t,e){return{x:n,y:t,charge:0,fixed:!0,name:e}},focis={},rowClass=function(n){return"row-"+n.replace(/ /g,"").toLowerCase()
},colClass=function(n){return"col-"+n.replace(/ /g,"").toLowerCase()};_.each(rows,function(n,t){_.each(cols,function(n,e){var r=rowClass(rows[t]),i=colClass(cols[e]),u=w/(cols.length+2)*(e+1),o=h/(rows.length+1)*(t+1),a=createFoci(u,o,r+" "+i+" foci foci-0"),c=createFoci(u,o,r+" "+i+" foci foci-1");focis[rows[t]]||(focis[rows[t]]={}),focis[rows[t]][cols[e]]=[a,c],forces[t].nodes().push(a,c)})}),_.each(forces,function(n,t){setupNodeAndLinks(n,rows[t]),n.on("tick",function(){svg.selectAll("circle."+rowClass(rows[t])).attr("cx",function(n){return n.x}).attr("cy",function(n){return n.y})})}),svg.selectAll("circle.node").data(_.reduce(forces,function(n,t){return n.concat(t.nodes())},[])).enter().append("circle").attr("class",function(n){return"node "+n.name}).attr("cx",function(n){return n.x}).attr("cy",function(n){return n.y}).attr("r",2+100/num_nodes).style("fill",function(n){return fill(n.id)}).style("stroke",function(n){return d3.rgb(fill(n.id)).darker(2)}).style("stroke-width",1),svg.selectAll("circle.foci").style("display","none"),_.each(forces,function(n){n.start()});var cl=function(n,t,e){return e=void 0!==e?".foci-"+e:"","."+rowClass(rows[n])+"."+colClass(cols[t]+e)},ratioLabelPos=function(n,t){var e=0,r=Number(d3.select(cl(n,t,0)).attr("cx")),i=Number(d3.select(cl(n,t,0)).attr("cy"));return d3.selectAll(".node"+cl(n,t)).each(function(n){var t=Math.sqrt((n.x-r)*(n.x-r)+(n.y-i)*(n.y-i));e=t>e?t:e}),{x:r+Math.cos(45)*e,y:i-Math.sin(45)*e}},ratioLabelFormat=function(n){return d3.format(".0%")(n[0]/n[1])+" accepted"},timeline=[2*tempo,function(){var n=[];for(row in rows)for(col in cols)n.push({foci:cl(row,col),text:ratioLabelFormat(data[rows[row]][cols[col]]),row:Number(row),col:Number(col)});var t=svg.selectAll("text.year-ratio");t.remove(),t.data(n).enter().append("text").attr({"class":"year-ratio",x:function(n){return ratioLabelPos(n.row,n.col).x},y:function(n){return ratioLabelPos(n.row,n.col).y}}).text(function(n){return n.text}).style("opacity","0.0").transition().style("opacity","1.0").style("font-weight",function(n){return col_maxs[n.col]===n.row?"bold":"normal"})},10*tempo,function(){var n=250;return svg.selectAll("text.year-ratio").transition().duration(n).style("opacity","0.0").remove(),n},function(){var n=2*tempo;for(var t in rows)for(var e in cols)animFoci(cl(t,e)+".foci-0",{x:w/(cols.length+2)*(cols.length+1)-500},n),animFoci(cl(t,e)+".foci-1",{x:w/(cols.length+2)*(cols.length+1)},n);return n},1*tempo,function(){var n=2*tempo;for(var t in rows)for(var e in cols)animFoci(cl(t,e)+".foci-0",{x:w/(cols.length+2)*(cols.length+1)},n),animFoci(cl(t,e)+".foci-1",{x:w/(cols.length+2)*(cols.length+1)},n);return n},1*tempo,function(){var n=rows.map(function(n,t){return{text:ratioLabelFormat(combined(t)),row:t,col:cols.length,foci:cl(t,0)}}),t=svg.selectAll("text.combined-ratio");t.remove(),t.data(n).enter().append("text").attr({"class":"combined-ratio",x:function(n){return ratioLabelPos(n.row,0).x},y:function(n){return ratioLabelPos(n.row,0).y}}).text(function(n){return n.text}).style("opacity","0.0").transition().style("opacity","1.0").style("font-weight",function(n){return col_maxs[n.col]===n.row?"bold":"normal"})},10*tempo,function(){var n=250;return svg.selectAll("text.combined-ratio").transition().duration(n).style("opacity","0.0").remove(),n},function(){var n=tempo;return _.each(rows,function(t,e){_.each(cols,function(t,r){animFoci(cl(e,r)+".foci-0",{x:w/(cols.length+2)*(1+r)-30},n),animFoci(cl(e,r)+".foci-1",{x:w/(cols.length+2)*(1+r)+30},n)})}),n},function(){var n=tempo;return _.each(rows,function(t,e){_.each(cols,function(t,r){animFoci(cl(e,r)+".foci-0",{x:w/(cols.length+2)*(r+1)},n),animFoci(cl(e,r)+".foci-1",{x:w/(cols.length+2)*(r+1)},n)})}),n}],t=-1,forward=1,back_and_forth=!1,loop=function(){back_and_forth&&(t>=timeline.length-1?forward=-1:0>=t&&(forward=1));var n=timeline[t=(t+forward)%timeline.length];if("function"==typeof n){var e=n();void 0===e&&(e=tempo),setTimeout(loop,e)}else setTimeout(loop,n)};loop(),d3.select("body").style("font-size","1em"),svg.selectAll("text.column-label").data(cols.concat(["combined"])).enter().append("text").attr({x:function(n,t){return w/(cols.length+2)*(t+1)},y:20,anchor:"middle","class":"column-label"}).text(function(n){return n}),svg.selectAll("text.row-label").data(rows).enter().append("text").attr({x:70,y:function(n,t){return h/(rows.length+1)*(t+1)},anchor:"right","class":"row-label"}).text(function(n){return n}),svg.append("text").text("1 ball = 10 people. ").attr({x:10,y:h-10,"class":"legend-item1"});
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }
.requirebin-badge{
opacity: 0.5;
}
.requirebin-badge:hover{
opacity: 1.0;
}
body, html{
margin: 0;
padding: 0;
font-family: 'Droid Sans', helvetica, arial, sans-serif;
font-size: 1em;
}
.column-label {
text-anchor: middle;
fill: black;
font-size: 1em;
}
.row-label {
text-anchor: middle;
fill: black;
font-size: 1em;
}
.node{
display: block;
}
.foci{
/* uncomment out to show foci for debugging */
display: none;
}
h1{
text-align: center;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment