otsdaq_utilities  v2_05_02_indev
d3.js
1 (function() {
2  function d3_class(ctor, properties) {
3  try {
4  for (var key in properties) {
5  Object.defineProperty(ctor.prototype, key, {
6  value: properties[key],
7  enumerable: false
8  });
9  }
10  } catch (e) {
11  ctor.prototype = properties;
12  }
13  }
14  function d3_arrayCopy(pseudoarray) {
15  var i = -1, n = pseudoarray.length, array = [];
16  while (++i < n) array.push(pseudoarray[i]);
17  return array;
18  }
19  function d3_arraySlice(pseudoarray) {
20  return Array.prototype.slice.call(pseudoarray);
21  }
22  function d3_Map() {}
23  function d3_identity(d) {
24  return d;
25  }
26  function d3_this() {
27  return this;
28  }
29  function d3_true() {
30  return true;
31  }
32  function d3_functor(v) {
33  return typeof v === "function" ? v : function() {
34  return v;
35  };
36  }
37  function d3_rebind(target, source, method) {
38  return function() {
39  var value = method.apply(source, arguments);
40  return arguments.length ? target : value;
41  };
42  }
43  function d3_number(x) {
44  return x != null && !isNaN(x);
45  }
46  function d3_zipLength(d) {
47  return d.length;
48  }
49  function d3_splitter(d) {
50  return d == null;
51  }
52  function d3_collapse(s) {
53  return s.trim().replace(/\s+/g, " ");
54  }
55  function d3_range_integerScale(x) {
56  var k = 1;
57  while (x * k % 1) k *= 10;
58  return k;
59  }
60  function d3_dispatch() {}
61  function d3_dispatch_event(dispatch) {
62  function event() {
63  var z = listeners, i = -1, n = z.length, l;
64  while (++i < n) if (l = z[i].on) l.apply(this, arguments);
65  return dispatch;
66  }
67  var listeners = [], listenerByName = new d3_Map;
68  event.on = function(name, listener) {
69  var l = listenerByName.get(name), i;
70  if (arguments.length < 2) return l && l.on;
71  if (l) {
72  l.on = null;
73  listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
74  listenerByName.remove(name);
75  }
76  if (listener) listeners.push(listenerByName.set(name, {
77  on: listener
78  }));
79  return dispatch;
80  };
81  return event;
82  }
83  function d3_format_precision(x, p) {
84  return p - (x ? 1 + Math.floor(Math.log(x + Math.pow(10, 1 + Math.floor(Math.log(x) / Math.LN10) - p)) / Math.LN10) : 1);
85  }
86  function d3_format_typeDefault(x) {
87  return x + "";
88  }
89  function d3_format_group(value) {
90  var i = value.lastIndexOf("."), f = i >= 0 ? value.substring(i) : (i = value.length, ""), t = [];
91  while (i > 0) t.push(value.substring(i -= 3, i + 3));
92  return t.reverse().join(",") + f;
93  }
94  function d3_formatPrefix(d, i) {
95  var k = Math.pow(10, Math.abs(8 - i) * 3);
96  return {
97  scale: i > 8 ? function(d) {
98  return d / k;
99  } : function(d) {
100  return d * k;
101  },
102  symbol: d
103  };
104  }
105  function d3_ease_clamp(f) {
106  return function(t) {
107  return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
108  };
109  }
110  function d3_ease_reverse(f) {
111  return function(t) {
112  return 1 - f(1 - t);
113  };
114  }
115  function d3_ease_reflect(f) {
116  return function(t) {
117  return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
118  };
119  }
120  function d3_ease_identity(t) {
121  return t;
122  }
123  function d3_ease_poly(e) {
124  return function(t) {
125  return Math.pow(t, e);
126  };
127  }
128  function d3_ease_sin(t) {
129  return 1 - Math.cos(t * Math.PI / 2);
130  }
131  function d3_ease_exp(t) {
132  return Math.pow(2, 10 * (t - 1));
133  }
134  function d3_ease_circle(t) {
135  return 1 - Math.sqrt(1 - t * t);
136  }
137  function d3_ease_elastic(a, p) {
138  var s;
139  if (arguments.length < 2) p = .45;
140  if (arguments.length < 1) {
141  a = 1;
142  s = p / 4;
143  } else s = p / (2 * Math.PI) * Math.asin(1 / a);
144  return function(t) {
145  return 1 + a * Math.pow(2, 10 * -t) * Math.sin((t - s) * 2 * Math.PI / p);
146  };
147  }
148  function d3_ease_back(s) {
149  if (!s) s = 1.70158;
150  return function(t) {
151  return t * t * ((s + 1) * t - s);
152  };
153  }
154  function d3_ease_bounce(t) {
155  return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
156  }
157  function d3_eventCancel() {
158  d3.event.stopPropagation();
159  d3.event.preventDefault();
160  }
161  function d3_eventSource() {
162  var e = d3.event, s;
163  while (s = e.sourceEvent) e = s;
164  return e;
165  }
166  function d3_eventDispatch(target) {
167  var dispatch = new d3_dispatch, i = 0, n = arguments.length;
168  while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
169  dispatch.of = function(thiz, argumentz) {
170  return function(e1) {
171  try {
172  var e0 = e1.sourceEvent = d3.event;
173  e1.target = target;
174  d3.event = e1;
175  dispatch[e1.type].apply(thiz, argumentz);
176  } finally {
177  d3.event = e0;
178  }
179  };
180  };
181  return dispatch;
182  }
183  function d3_transform(m) {
184  var r0 = [ m.a, m.b ], r1 = [ m.c, m.d ], kx = d3_transformNormalize(r0), kz = d3_transformDot(r0, r1), ky = d3_transformNormalize(d3_transformCombine(r1, r0, -kz)) || 0;
185  if (r0[0] * r1[1] < r1[0] * r0[1]) {
186  r0[0] *= -1;
187  r0[1] *= -1;
188  kx *= -1;
189  kz *= -1;
190  }
191  this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_transformDegrees;
192  this.translate = [ m.e, m.f ];
193  this.scale = [ kx, ky ];
194  this.skew = ky ? Math.atan2(kz, ky) * d3_transformDegrees : 0;
195  }
196  function d3_transformDot(a, b) {
197  return a[0] * b[0] + a[1] * b[1];
198  }
199  function d3_transformNormalize(a) {
200  var k = Math.sqrt(d3_transformDot(a, a));
201  if (k) {
202  a[0] /= k;
203  a[1] /= k;
204  }
205  return k;
206  }
207  function d3_transformCombine(a, b, k) {
208  a[0] += k * b[0];
209  a[1] += k * b[1];
210  return a;
211  }
212  function d3_interpolateByName(name) {
213  return name == "transform" ? d3.interpolateTransform : d3.interpolate;
214  }
215  function d3_uninterpolateNumber(a, b) {
216  b = b - (a = +a) ? 1 / (b - a) : 0;
217  return function(x) {
218  return (x - a) * b;
219  };
220  }
221  function d3_uninterpolateClamp(a, b) {
222  b = b - (a = +a) ? 1 / (b - a) : 0;
223  return function(x) {
224  return Math.max(0, Math.min(1, (x - a) * b));
225  };
226  }
227  function d3_Color() {}
228  function d3_rgb(r, g, b) {
229  return new d3_Rgb(r, g, b);
230  }
231  function d3_Rgb(r, g, b) {
232  this.r = r;
233  this.g = g;
234  this.b = b;
235  }
236  function d3_rgb_hex(v) {
237  return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
238  }
239  function d3_rgb_parse(format, rgb, hsl) {
240  var r = 0, g = 0, b = 0, m1, m2, name;
241  m1 = /([a-z]+)\((.*)\)/i.exec(format);
242  if (m1) {
243  m2 = m1[2].split(",");
244  switch (m1[1]) {
245  case "hsl":
246  {
247  return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
248  }
249  case "rgb":
250  {
251  return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
252  }
253  }
254  }
255  if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
256  if (format != null && format.charAt(0) === "#") {
257  if (format.length === 4) {
258  r = format.charAt(1);
259  r += r;
260  g = format.charAt(2);
261  g += g;
262  b = format.charAt(3);
263  b += b;
264  } else if (format.length === 7) {
265  r = format.substring(1, 3);
266  g = format.substring(3, 5);
267  b = format.substring(5, 7);
268  }
269  r = parseInt(r, 16);
270  g = parseInt(g, 16);
271  b = parseInt(b, 16);
272  }
273  return rgb(r, g, b);
274  }
275  function d3_rgb_hsl(r, g, b) {
276  var min = Math.min(r /= 255, g /= 255, b /= 255), max = Math.max(r, g, b), d = max - min, h, s, l = (max + min) / 2;
277  if (d) {
278  s = l < .5 ? d / (max + min) : d / (2 - max - min);
279  if (r == max) h = (g - b) / d + (g < b ? 6 : 0); else if (g == max) h = (b - r) / d + 2; else h = (r - g) / d + 4;
280  h *= 60;
281  } else {
282  s = h = 0;
283  }
284  return d3_hsl(h, s, l);
285  }
286  function d3_rgb_lab(r, g, b) {
287  r = d3_rgb_xyz(r);
288  g = d3_rgb_xyz(g);
289  b = d3_rgb_xyz(b);
290  var x = d3_xyz_lab((.4124564 * r + .3575761 * g + .1804375 * b) / d3_lab_X), y = d3_xyz_lab((.2126729 * r + .7151522 * g + .072175 * b) / d3_lab_Y), z = d3_xyz_lab((.0193339 * r + .119192 * g + .9503041 * b) / d3_lab_Z);
291  return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
292  }
293  function d3_rgb_xyz(r) {
294  return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
295  }
296  function d3_rgb_parseNumber(c) {
297  var f = parseFloat(c);
298  return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
299  }
300  function d3_hsl(h, s, l) {
301  return new d3_Hsl(h, s, l);
302  }
303  function d3_Hsl(h, s, l) {
304  this.h = h;
305  this.s = s;
306  this.l = l;
307  }
308  function d3_hsl_rgb(h, s, l) {
309  function v(h) {
310  if (h > 360) h -= 360; else if (h < 0) h += 360;
311  if (h < 60) return m1 + (m2 - m1) * h / 60;
312  if (h < 180) return m2;
313  if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
314  return m1;
315  }
316  function vv(h) {
317  return Math.round(v(h) * 255);
318  }
319  var m1, m2;
320  h = h % 360;
321  if (h < 0) h += 360;
322  s = s < 0 ? 0 : s > 1 ? 1 : s;
323  l = l < 0 ? 0 : l > 1 ? 1 : l;
324  m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
325  m1 = 2 * l - m2;
326  return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
327  }
328  function d3_hcl(h, c, l) {
329  return new d3_Hcl(h, c, l);
330  }
331  function d3_Hcl(h, c, l) {
332  this.h = h;
333  this.c = c;
334  this.l = l;
335  }
336  function d3_hcl_lab(h, c, l) {
337  return d3_lab(l, Math.cos(h *= Math.PI / 180) * c, Math.sin(h) * c);
338  }
339  function d3_lab(l, a, b) {
340  return new d3_Lab(l, a, b);
341  }
342  function d3_Lab(l, a, b) {
343  this.l = l;
344  this.a = a;
345  this.b = b;
346  }
347  function d3_lab_rgb(l, a, b) {
348  var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
349  x = d3_lab_xyz(x) * d3_lab_X;
350  y = d3_lab_xyz(y) * d3_lab_Y;
351  z = d3_lab_xyz(z) * d3_lab_Z;
352  return d3_rgb(d3_xyz_rgb(3.2404542 * x - 1.5371385 * y - .4985314 * z), d3_xyz_rgb(-.969266 * x + 1.8760108 * y + .041556 * z), d3_xyz_rgb(.0556434 * x - .2040259 * y + 1.0572252 * z));
353  }
354  function d3_lab_hcl(l, a, b) {
355  return d3_hcl(Math.atan2(b, a) / Math.PI * 180, Math.sqrt(a * a + b * b), l);
356  }
357  function d3_lab_xyz(x) {
358  return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
359  }
360  function d3_xyz_lab(x) {
361  return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
362  }
363  function d3_xyz_rgb(r) {
364  return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
365  }
366  function d3_selection(groups) {
367  d3_arraySubclass(groups, d3_selectionPrototype);
368  return groups;
369  }
370  function d3_selection_selector(selector) {
371  return function() {
372  return d3_select(selector, this);
373  };
374  }
375  function d3_selection_selectorAll(selector) {
376  return function() {
377  return d3_selectAll(selector, this);
378  };
379  }
380  function d3_selection_attr(name, value) {
381  function attrNull() {
382  this.removeAttribute(name);
383  }
384  function attrNullNS() {
385  this.removeAttributeNS(name.space, name.local);
386  }
387  function attrConstant() {
388  this.setAttribute(name, value);
389  }
390  function attrConstantNS() {
391  this.setAttributeNS(name.space, name.local, value);
392  }
393  function attrFunction() {
394  var x = value.apply(this, arguments);
395  if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
396  }
397  function attrFunctionNS() {
398  var x = value.apply(this, arguments);
399  if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
400  }
401  name = d3.ns.qualify(name);
402  return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
403  }
404  function d3_selection_classedRe(name) {
405  return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
406  }
407  function d3_selection_classed(name, value) {
408  function classedConstant() {
409  var i = -1;
410  while (++i < n) name[i](this, value);
411  }
412  function classedFunction() {
413  var i = -1, x = value.apply(this, arguments);
414  while (++i < n) name[i](this, x);
415  }
416  name = name.trim().split(/\s+/).map(d3_selection_classedName);
417  var n = name.length;
418  return typeof value === "function" ? classedFunction : classedConstant;
419  }
420  function d3_selection_classedName(name) {
421  var re = d3_selection_classedRe(name);
422  return function(node, value) {
423  if (c = node.classList) return value ? c.add(name) : c.remove(name);
424  var c = node.className, cb = c.baseVal != null, cv = cb ? c.baseVal : c;
425  if (value) {
426  re.lastIndex = 0;
427  if (!re.test(cv)) {
428  cv = d3_collapse(cv + " " + name);
429  if (cb) c.baseVal = cv; else node.className = cv;
430  }
431  } else if (cv) {
432  cv = d3_collapse(cv.replace(re, " "));
433  if (cb) c.baseVal = cv; else node.className = cv;
434  }
435  };
436  }
437  function d3_selection_style(name, value, priority) {
438  function styleNull() {
439  this.style.removeProperty(name);
440  }
441  function styleConstant() {
442  this.style.setProperty(name, value, priority);
443  }
444  function styleFunction() {
445  var x = value.apply(this, arguments);
446  if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
447  }
448  return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
449  }
450  function d3_selection_property(name, value) {
451  function propertyNull() {
452  delete this[name];
453  }
454  function propertyConstant() {
455  this[name] = value;
456  }
457  function propertyFunction() {
458  var x = value.apply(this, arguments);
459  if (x == null) delete this[name]; else this[name] = x;
460  }
461  return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
462  }
463  function d3_selection_dataNode(data) {
464  return {
465  __data__: data
466  };
467  }
468  function d3_selection_filter(selector) {
469  return function() {
470  return d3_selectMatches(this, selector);
471  };
472  }
473  function d3_selection_sortComparator(comparator) {
474  if (!arguments.length) comparator = d3.ascending;
475  return function(a, b) {
476  return comparator(a && a.__data__, b && b.__data__);
477  };
478  }
479  function d3_selection_on(type, listener, capture) {
480  function onRemove() {
481  var wrapper = this[name];
482  if (wrapper) {
483  this.removeEventListener(type, wrapper, wrapper.$);
484  delete this[name];
485  }
486  }
487  function onAdd() {
488  function wrapper(e) {
489  var o = d3.event;
490  d3.event = e;
491  args[0] = node.__data__;
492  try {
493  listener.apply(node, args);
494  } finally {
495  d3.event = o;
496  }
497  }
498  var node = this, args = arguments;
499  onRemove.call(this);
500  this.addEventListener(type, this[name] = wrapper, wrapper.$ = capture);
501  wrapper._ = listener;
502  }
503  var name = "__on" + type, i = type.indexOf(".");
504  if (i > 0) type = type.substring(0, i);
505  return listener ? onAdd : onRemove;
506  }
507  function d3_selection_each(groups, callback) {
508  for (var j = 0, m = groups.length; j < m; j++) {
509  for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
510  if (node = group[i]) callback(node, i, j);
511  }
512  }
513  return groups;
514  }
515  function d3_selection_enter(selection) {
516  d3_arraySubclass(selection, d3_selection_enterPrototype);
517  return selection;
518  }
519  function d3_transition(groups, id, time) {
520  d3_arraySubclass(groups, d3_transitionPrototype);
521  var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase;
522  groups.id = id;
523  groups.time = time;
524  groups.tween = function(name, tween) {
525  if (arguments.length < 2) return tweens.get(name);
526  if (tween == null) tweens.remove(name); else tweens.set(name, tween);
527  return groups;
528  };
529  groups.ease = function(value) {
530  if (!arguments.length) return ease;
531  ease = typeof value === "function" ? value : d3.ease.apply(d3, arguments);
532  return groups;
533  };
534  groups.each = function(type, listener) {
535  if (arguments.length < 2) return d3_transition_each.call(groups, type);
536  event.on(type, listener);
537  return groups;
538  };
539  d3.timer(function(elapsed) {
540  return d3_selection_each(groups, function(node, i, j) {
541  function start(elapsed) {
542  if (lock.active > id) return stop();
543  lock.active = id;
544  tweens.forEach(function(key, value) {
545  if (value = value.call(node, d, i)) {
546  tweened.push(value);
547  }
548  });
549  event.start.call(node, d, i);
550  if (!tick(elapsed)) d3.timer(tick, 0, time);
551  return 1;
552  }
553  function tick(elapsed) {
554  if (lock.active !== id) return stop();
555  var t = (elapsed - delay) / duration, e = ease(t), n = tweened.length;
556  while (n > 0) {
557  tweened[--n].call(node, e);
558  }
559  if (t >= 1) {
560  stop();
561  d3_transitionId = id;
562  event.end.call(node, d, i);
563  d3_transitionId = 0;
564  return 1;
565  }
566  }
567  function stop() {
568  if (!--lock.count) delete node.__transition__;
569  return 1;
570  }
571  var tweened = [], delay = node.delay, duration = node.duration, lock = (node = node.node).__transition__ || (node.__transition__ = {
572  active: 0,
573  count: 0
574  }), d = node.__data__;
575  ++lock.count;
576  delay <= elapsed ? start(elapsed) : d3.timer(start, delay, time);
577  });
578  }, 0, time);
579  return groups;
580  }
581  function d3_transition_each(callback) {
582  var id = d3_transitionId, ease = d3_transitionEase, delay = d3_transitionDelay, duration = d3_transitionDuration;
583  d3_transitionId = this.id;
584  d3_transitionEase = this.ease();
585  d3_selection_each(this, function(node, i, j) {
586  d3_transitionDelay = node.delay;
587  d3_transitionDuration = node.duration;
588  callback.call(node = node.node, node.__data__, i, j);
589  });
590  d3_transitionId = id;
591  d3_transitionEase = ease;
592  d3_transitionDelay = delay;
593  d3_transitionDuration = duration;
594  return this;
595  }
596  function d3_tweenNull(d, i, a) {
597  return a != "" && d3_tweenRemove;
598  }
599  function d3_tweenByName(b, name) {
600  return d3.tween(b, d3_interpolateByName(name));
601  }
602  function d3_timer_step() {
603  var elapsed, now = Date.now(), t1 = d3_timer_queue;
604  while (t1) {
605  elapsed = now - t1.then;
606  if (elapsed >= t1.delay) t1.flush = t1.callback(elapsed);
607  t1 = t1.next;
608  }
609  var delay = d3_timer_flush() - now;
610  if (delay > 24) {
611  if (isFinite(delay)) {
612  clearTimeout(d3_timer_timeout);
613  d3_timer_timeout = setTimeout(d3_timer_step, delay);
614  }
615  d3_timer_interval = 0;
616  } else {
617  d3_timer_interval = 1;
618  d3_timer_frame(d3_timer_step);
619  }
620  }
621  function d3_timer_flush() {
622  var t0 = null, t1 = d3_timer_queue, then = Infinity;
623  while (t1) {
624  if (t1.flush) {
625  delete d3_timer_byId[t1.callback.id];
626  t1 = t0 ? t0.next = t1.next : d3_timer_queue = t1.next;
627  } else {
628  then = Math.min(then, t1.then + t1.delay);
629  t1 = (t0 = t1).next;
630  }
631  }
632  return then;
633  }
634  function d3_mousePoint(container, e) {
635  var svg = container.ownerSVGElement || container;
636  if (svg.createSVGPoint) {
637  var point = svg.createSVGPoint();
638  if (d3_mouse_bug44083 < 0 && (window.scrollX || window.scrollY)) {
639  svg = d3.select(document.body).append("svg").style("position", "absolute").style("top", 0).style("left", 0);
640  var ctm = svg[0][0].getScreenCTM();
641  d3_mouse_bug44083 = !(ctm.f || ctm.e);
642  svg.remove();
643  }
644  if (d3_mouse_bug44083) {
645  point.x = e.pageX;
646  point.y = e.pageY;
647  } else {
648  point.x = e.clientX;
649  point.y = e.clientY;
650  }
651  point = point.matrixTransform(container.getScreenCTM().inverse());
652  return [ point.x, point.y ];
653  }
654  var rect = container.getBoundingClientRect();
655  return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
656  }
657  function d3_noop() {}
658  function d3_scaleExtent(domain) {
659  var start = domain[0], stop = domain[domain.length - 1];
660  return start < stop ? [ start, stop ] : [ stop, start ];
661  }
662  function d3_scaleRange(scale) {
663  return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
664  }
665  function d3_scale_nice(domain, nice) {
666  var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
667  if (x1 < x0) {
668  dx = i0, i0 = i1, i1 = dx;
669  dx = x0, x0 = x1, x1 = dx;
670  }
671  if (nice = nice(x1 - x0)) {
672  domain[i0] = nice.floor(x0);
673  domain[i1] = nice.ceil(x1);
674  }
675  return domain;
676  }
677  function d3_scale_niceDefault() {
678  return Math;
679  }
680  function d3_scale_linear(domain, range, interpolate, clamp) {
681  function rescale() {
682  var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
683  output = linear(domain, range, uninterpolate, interpolate);
684  input = linear(range, domain, uninterpolate, d3.interpolate);
685  return scale;
686  }
687  function scale(x) {
688  return output(x);
689  }
690  var output, input;
691  scale.invert = function(y) {
692  return input(y);
693  };
694  scale.domain = function(x) {
695  if (!arguments.length) return domain;
696  domain = x.map(Number);
697  return rescale();
698  };
699  scale.range = function(x) {
700  if (!arguments.length) return range;
701  range = x;
702  return rescale();
703  };
704  scale.rangeRound = function(x) {
705  return scale.range(x).interpolate(d3.interpolateRound);
706  };
707  scale.clamp = function(x) {
708  if (!arguments.length) return clamp;
709  clamp = x;
710  return rescale();
711  };
712  scale.interpolate = function(x) {
713  if (!arguments.length) return interpolate;
714  interpolate = x;
715  return rescale();
716  };
717  scale.ticks = function(m) {
718  return d3_scale_linearTicks(domain, m);
719  };
720  scale.tickFormat = function(m) {
721  return d3_scale_linearTickFormat(domain, m);
722  };
723  scale.nice = function() {
724  d3_scale_nice(domain, d3_scale_linearNice);
725  return rescale();
726  };
727  scale.copy = function() {
728  return d3_scale_linear(domain, range, interpolate, clamp);
729  };
730  return rescale();
731  }
732  function d3_scale_linearRebind(scale, linear) {
733  return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
734  }
735  function d3_scale_linearNice(dx) {
736  dx = Math.pow(10, Math.round(Math.log(dx) / Math.LN10) - 1);
737  return dx && {
738  floor: function(x) {
739  return Math.floor(x / dx) * dx;
740  },
741  ceil: function(x) {
742  return Math.ceil(x / dx) * dx;
743  }
744  };
745  }
746  function d3_scale_linearTickRange(domain, m) {
747  var extent = d3_scaleExtent(domain), span = extent[1] - extent[0], step = Math.pow(10, Math.floor(Math.log(span / m) / Math.LN10)), err = m / span * step;
748  if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
749  extent[0] = Math.ceil(extent[0] / step) * step;
750  extent[1] = Math.floor(extent[1] / step) * step + step * .5;
751  extent[2] = step;
752  return extent;
753  }
754  function d3_scale_linearTicks(domain, m) {
755  return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
756  }
757  function d3_scale_linearTickFormat(domain, m) {
758  return d3.format(",." + Math.max(0, -Math.floor(Math.log(d3_scale_linearTickRange(domain, m)[2]) / Math.LN10 + .01)) + "f");
759  }
760  function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
761  var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
762  return function(x) {
763  return i(u(x));
764  };
765  }
766  function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
767  var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
768  if (domain[k] < domain[0]) {
769  domain = domain.slice().reverse();
770  range = range.slice().reverse();
771  }
772  while (++j <= k) {
773  u.push(uninterpolate(domain[j - 1], domain[j]));
774  i.push(interpolate(range[j - 1], range[j]));
775  }
776  return function(x) {
777  var j = d3.bisect(domain, x, 1, k) - 1;
778  return i[j](u[j](x));
779  };
780  }
781  function d3_scale_log(linear, log) {
782  function scale(x) {
783  return linear(log(x));
784  }
785  var pow = log.pow;
786  scale.invert = function(x) {
787  return pow(linear.invert(x));
788  };
789  scale.domain = function(x) {
790  if (!arguments.length) return linear.domain().map(pow);
791  log = x[0] < 0 ? d3_scale_logn : d3_scale_logp;
792  pow = log.pow;
793  linear.domain(x.map(log));
794  return scale;
795  };
796  scale.nice = function() {
797  linear.domain(d3_scale_nice(linear.domain(), d3_scale_niceDefault));
798  return scale;
799  };
800  scale.ticks = function() {
801  var extent = d3_scaleExtent(linear.domain()), ticks = [];
802  if (extent.every(isFinite)) {
803  var i = Math.floor(extent[0]), j = Math.ceil(extent[1]), u = pow(extent[0]), v = pow(extent[1]);
804  if (log === d3_scale_logn) {
805  ticks.push(pow(i));
806  for (; i++ < j; ) for (var k = 9; k > 0; k--) ticks.push(pow(i) * k);
807  } else {
808  for (; i < j; i++) for (var k = 1; k < 10; k++) ticks.push(pow(i) * k);
809  ticks.push(pow(i));
810  }
811  for (i = 0; ticks[i] < u; i++) {}
812  for (j = ticks.length; ticks[j - 1] > v; j--) {}
813  ticks = ticks.slice(i, j);
814  }
815  return ticks;
816  };
817  scale.tickFormat = function(n, format) {
818  if (arguments.length < 2) format = d3_scale_logFormat;
819  if (arguments.length < 1) return format;
820  var k = Math.max(.1, n / scale.ticks().length), f = log === d3_scale_logn ? (e = -1e-12, Math.floor) : (e = 1e-12, Math.ceil), e;
821  return function(d) {
822  return d / pow(f(log(d) + e)) <= k ? format(d) : "";
823  };
824  };
825  scale.copy = function() {
826  return d3_scale_log(linear.copy(), log);
827  };
828  return d3_scale_linearRebind(scale, linear);
829  }
830  function d3_scale_logp(x) {
831  return Math.log(x < 0 ? 0 : x) / Math.LN10;
832  }
833  function d3_scale_logn(x) {
834  return -Math.log(x > 0 ? 0 : -x) / Math.LN10;
835  }
836  function d3_scale_pow(linear, exponent) {
837  function scale(x) {
838  return linear(powp(x));
839  }
840  var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
841  scale.invert = function(x) {
842  return powb(linear.invert(x));
843  };
844  scale.domain = function(x) {
845  if (!arguments.length) return linear.domain().map(powb);
846  linear.domain(x.map(powp));
847  return scale;
848  };
849  scale.ticks = function(m) {
850  return d3_scale_linearTicks(scale.domain(), m);
851  };
852  scale.tickFormat = function(m) {
853  return d3_scale_linearTickFormat(scale.domain(), m);
854  };
855  scale.nice = function() {
856  return scale.domain(d3_scale_nice(scale.domain(), d3_scale_linearNice));
857  };
858  scale.exponent = function(x) {
859  if (!arguments.length) return exponent;
860  var domain = scale.domain();
861  powp = d3_scale_powPow(exponent = x);
862  powb = d3_scale_powPow(1 / exponent);
863  return scale.domain(domain);
864  };
865  scale.copy = function() {
866  return d3_scale_pow(linear.copy(), exponent);
867  };
868  return d3_scale_linearRebind(scale, linear);
869  }
870  function d3_scale_powPow(e) {
871  return function(x) {
872  return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
873  };
874  }
875  function d3_scale_ordinal(domain, ranger) {
876  function scale(x) {
877  return range[((index.get(x) || index.set(x, domain.push(x))) - 1) % range.length];
878  }
879  function steps(start, step) {
880  return d3.range(domain.length).map(function(i) {
881  return start + step * i;
882  });
883  }
884  var index, range, rangeBand;
885  scale.domain = function(x) {
886  if (!arguments.length) return domain;
887  domain = [];
888  index = new d3_Map;
889  var i = -1, n = x.length, xi;
890  while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
891  return scale[ranger.t].apply(scale, ranger.a);
892  };
893  scale.range = function(x) {
894  if (!arguments.length) return range;
895  range = x;
896  rangeBand = 0;
897  ranger = {
898  t: "range",
899  a: arguments
900  };
901  return scale;
902  };
903  scale.rangePoints = function(x, padding) {
904  if (arguments.length < 2) padding = 0;
905  var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
906  range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
907  rangeBand = 0;
908  ranger = {
909  t: "rangePoints",
910  a: arguments
911  };
912  return scale;
913  };
914  scale.rangeBands = function(x, padding, outerPadding) {
915  if (arguments.length < 2) padding = 0;
916  if (arguments.length < 3) outerPadding = padding;
917  var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
918  range = steps(start + step * outerPadding, step);
919  if (reverse) range.reverse();
920  rangeBand = step * (1 - padding);
921  ranger = {
922  t: "rangeBands",
923  a: arguments
924  };
925  return scale;
926  };
927  scale.rangeRoundBands = function(x, padding, outerPadding) {
928  if (arguments.length < 2) padding = 0;
929  if (arguments.length < 3) outerPadding = padding;
930  var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = Math.floor((stop - start) / (domain.length - padding + 2 * outerPadding)), error = stop - start - (domain.length - padding) * step;
931  range = steps(start + Math.round(error / 2), step);
932  if (reverse) range.reverse();
933  rangeBand = Math.round(step * (1 - padding));
934  ranger = {
935  t: "rangeRoundBands",
936  a: arguments
937  };
938  return scale;
939  };
940  scale.rangeBand = function() {
941  return rangeBand;
942  };
943  scale.rangeExtent = function() {
944  return d3_scaleExtent(ranger.a[0]);
945  };
946  scale.copy = function() {
947  return d3_scale_ordinal(domain, ranger);
948  };
949  return scale.domain(domain);
950  }
951  function d3_scale_quantile(domain, range) {
952  function rescale() {
953  var k = 0, n = domain.length, q = range.length;
954  thresholds = [];
955  while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
956  return scale;
957  }
958  function scale(x) {
959  if (isNaN(x = +x)) return NaN;
960  return range[d3.bisect(thresholds, x)];
961  }
962  var thresholds;
963  scale.domain = function(x) {
964  if (!arguments.length) return domain;
965  domain = x.filter(function(d) {
966  return !isNaN(d);
967  }).sort(d3.ascending);
968  return rescale();
969  };
970  scale.range = function(x) {
971  if (!arguments.length) return range;
972  range = x;
973  return rescale();
974  };
975  scale.quantiles = function() {
976  return thresholds;
977  };
978  scale.copy = function() {
979  return d3_scale_quantile(domain, range);
980  };
981  return rescale();
982  }
983  function d3_scale_quantize(x0, x1, range) {
984  function scale(x) {
985  return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
986  }
987  function rescale() {
988  kx = range.length / (x1 - x0);
989  i = range.length - 1;
990  return scale;
991  }
992  var kx, i;
993  scale.domain = function(x) {
994  if (!arguments.length) return [ x0, x1 ];
995  x0 = +x[0];
996  x1 = +x[x.length - 1];
997  return rescale();
998  };
999  scale.range = function(x) {
1000  if (!arguments.length) return range;
1001  range = x;
1002  return rescale();
1003  };
1004  scale.copy = function() {
1005  return d3_scale_quantize(x0, x1, range);
1006  };
1007  return rescale();
1008  }
1009  function d3_scale_threshold(domain, range) {
1010  function scale(x) {
1011  return range[d3.bisect(domain, x)];
1012  }
1013  scale.domain = function(_) {
1014  if (!arguments.length) return domain;
1015  domain = _;
1016  return scale;
1017  };
1018  scale.range = function(_) {
1019  if (!arguments.length) return range;
1020  range = _;
1021  return scale;
1022  };
1023  scale.copy = function() {
1024  return d3_scale_threshold(domain, range);
1025  };
1026  return scale;
1027  }
1028  function d3_scale_identity(domain) {
1029  function identity(x) {
1030  return +x;
1031  }
1032  identity.invert = identity;
1033  identity.domain = identity.range = function(x) {
1034  if (!arguments.length) return domain;
1035  domain = x.map(identity);
1036  return identity;
1037  };
1038  identity.ticks = function(m) {
1039  return d3_scale_linearTicks(domain, m);
1040  };
1041  identity.tickFormat = function(m) {
1042  return d3_scale_linearTickFormat(domain, m);
1043  };
1044  identity.copy = function() {
1045  return d3_scale_identity(domain);
1046  };
1047  return identity;
1048  }
1049  function d3_svg_arcInnerRadius(d) {
1050  return d.innerRadius;
1051  }
1052  function d3_svg_arcOuterRadius(d) {
1053  return d.outerRadius;
1054  }
1055  function d3_svg_arcStartAngle(d) {
1056  return d.startAngle;
1057  }
1058  function d3_svg_arcEndAngle(d) {
1059  return d.endAngle;
1060  }
1061  function d3_svg_line(projection) {
1062  function line(data) {
1063  function segment() {
1064  segments.push("M", interpolate(projection(points), tension));
1065  }
1066  var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
1067  while (++i < n) {
1068  if (defined.call(this, d = data[i], i)) {
1069  points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
1070  } else if (points.length) {
1071  segment();
1072  points = [];
1073  }
1074  }
1075  if (points.length) segment();
1076  return segments.length ? segments.join("") : null;
1077  }
1078  var x = d3_svg_lineX, y = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
1079  line.x = function(_) {
1080  if (!arguments.length) return x;
1081  x = _;
1082  return line;
1083  };
1084  line.y = function(_) {
1085  if (!arguments.length) return y;
1086  y = _;
1087  return line;
1088  };
1089  line.defined = function(_) {
1090  if (!arguments.length) return defined;
1091  defined = _;
1092  return line;
1093  };
1094  line.interpolate = function(_) {
1095  if (!arguments.length) return interpolateKey;
1096  if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
1097  return line;
1098  };
1099  line.tension = function(_) {
1100  if (!arguments.length) return tension;
1101  tension = _;
1102  return line;
1103  };
1104  return line;
1105  }
1106  function d3_svg_lineX(d) {
1107  return d[0];
1108  }
1109  function d3_svg_lineY(d) {
1110  return d[1];
1111  }
1112  function d3_svg_lineLinear(points) {
1113  return points.join("L");
1114  }
1115  function d3_svg_lineLinearClosed(points) {
1116  return d3_svg_lineLinear(points) + "Z";
1117  }
1118  function d3_svg_lineStepBefore(points) {
1119  var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
1120  while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
1121  return path.join("");
1122  }
1123  function d3_svg_lineStepAfter(points) {
1124  var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
1125  while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
1126  return path.join("");
1127  }
1128  function d3_svg_lineCardinalOpen(points, tension) {
1129  return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
1130  }
1131  function d3_svg_lineCardinalClosed(points, tension) {
1132  return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
1133  }
1134  function d3_svg_lineCardinal(points, tension, closed) {
1135  return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
1136  }
1137  function d3_svg_lineHermite(points, tangents) {
1138  if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
1139  return d3_svg_lineLinear(points);
1140  }
1141  var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
1142  if (quad) {
1143  path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
1144  p0 = points[1];
1145  pi = 2;
1146  }
1147  if (tangents.length > 1) {
1148  t = tangents[1];
1149  p = points[pi];
1150  pi++;
1151  path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
1152  for (var i = 2; i < tangents.length; i++, pi++) {
1153  p = points[pi];
1154  t = tangents[i];
1155  path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
1156  }
1157  }
1158  if (quad) {
1159  var lp = points[pi];
1160  path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
1161  }
1162  return path;
1163  }
1164  function d3_svg_lineCardinalTangents(points, tension) {
1165  var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
1166  while (++i < n) {
1167  p0 = p1;
1168  p1 = p2;
1169  p2 = points[i];
1170  tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
1171  }
1172  return tangents;
1173  }
1174  function d3_svg_lineBasis(points) {
1175  if (points.length < 3) return d3_svg_lineLinear(points);
1176  var i = 1, n = points.length, pi = points[0], x0 = pi[0], y0 = pi[1], px = [ x0, x0, x0, (pi = points[1])[0] ], py = [ y0, y0, y0, pi[1] ], path = [ x0, ",", y0 ];
1177  d3_svg_lineBasisBezier(path, px, py);
1178  while (++i < n) {
1179  pi = points[i];
1180  px.shift();
1181  px.push(pi[0]);
1182  py.shift();
1183  py.push(pi[1]);
1184  d3_svg_lineBasisBezier(path, px, py);
1185  }
1186  i = -1;
1187  while (++i < 2) {
1188  px.shift();
1189  px.push(pi[0]);
1190  py.shift();
1191  py.push(pi[1]);
1192  d3_svg_lineBasisBezier(path, px, py);
1193  }
1194  return path.join("");
1195  }
1196  function d3_svg_lineBasisOpen(points) {
1197  if (points.length < 4) return d3_svg_lineLinear(points);
1198  var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
1199  while (++i < 3) {
1200  pi = points[i];
1201  px.push(pi[0]);
1202  py.push(pi[1]);
1203  }
1204  path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
1205  --i;
1206  while (++i < n) {
1207  pi = points[i];
1208  px.shift();
1209  px.push(pi[0]);
1210  py.shift();
1211  py.push(pi[1]);
1212  d3_svg_lineBasisBezier(path, px, py);
1213  }
1214  return path.join("");
1215  }
1216  function d3_svg_lineBasisClosed(points) {
1217  var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
1218  while (++i < 4) {
1219  pi = points[i % n];
1220  px.push(pi[0]);
1221  py.push(pi[1]);
1222  }
1223  path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
1224  --i;
1225  while (++i < m) {
1226  pi = points[i % n];
1227  px.shift();
1228  px.push(pi[0]);
1229  py.shift();
1230  py.push(pi[1]);
1231  d3_svg_lineBasisBezier(path, px, py);
1232  }
1233  return path.join("");
1234  }
1235  function d3_svg_lineBundle(points, tension) {
1236  var n = points.length - 1;
1237  if (n) {
1238  var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
1239  while (++i <= n) {
1240  p = points[i];
1241  t = i / n;
1242  p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
1243  p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
1244  }
1245  }
1246  return d3_svg_lineBasis(points);
1247  }
1248  function d3_svg_lineDot4(a, b) {
1249  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
1250  }
1251  function d3_svg_lineBasisBezier(path, x, y) {
1252  path.push("C", d3_svg_lineDot4(d3_svg_lineBasisBezier1, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier1, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier2, y), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, x), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, y));
1253  }
1254  function d3_svg_lineSlope(p0, p1) {
1255  return (p1[1] - p0[1]) / (p1[0] - p0[0]);
1256  }
1257  function d3_svg_lineFiniteDifferences(points) {
1258  var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
1259  while (++i < j) {
1260  m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
1261  }
1262  m[i] = d;
1263  return m;
1264  }
1265  function d3_svg_lineMonotoneTangents(points) {
1266  var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
1267  while (++i < j) {
1268  d = d3_svg_lineSlope(points[i], points[i + 1]);
1269  if (Math.abs(d) < 1e-6) {
1270  m[i] = m[i + 1] = 0;
1271  } else {
1272  a = m[i] / d;
1273  b = m[i + 1] / d;
1274  s = a * a + b * b;
1275  if (s > 9) {
1276  s = d * 3 / Math.sqrt(s);
1277  m[i] = s * a;
1278  m[i + 1] = s * b;
1279  }
1280  }
1281  }
1282  i = -1;
1283  while (++i <= j) {
1284  s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
1285  tangents.push([ s || 0, m[i] * s || 0 ]);
1286  }
1287  return tangents;
1288  }
1289  function d3_svg_lineMonotone(points) {
1290  return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
1291  }
1292  function d3_svg_lineRadial(points) {
1293  var point, i = -1, n = points.length, r, a;
1294  while (++i < n) {
1295  point = points[i];
1296  r = point[0];
1297  a = point[1] + d3_svg_arcOffset;
1298  point[0] = r * Math.cos(a);
1299  point[1] = r * Math.sin(a);
1300  }
1301  return points;
1302  }
1303  function d3_svg_area(projection) {
1304  function area(data) {
1305  function segment() {
1306  segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
1307  }
1308  var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
1309  return x;
1310  } : d3_functor(x1), fy1 = y0 === y1 ? function() {
1311  return y;
1312  } : d3_functor(y1), x, y;
1313  while (++i < n) {
1314  if (defined.call(this, d = data[i], i)) {
1315  points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
1316  points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
1317  } else if (points0.length) {
1318  segment();
1319  points0 = [];
1320  points1 = [];
1321  }
1322  }
1323  if (points0.length) segment();
1324  return segments.length ? segments.join("") : null;
1325  }
1326  var x0 = d3_svg_lineX, x1 = d3_svg_lineX, y0 = 0, y1 = d3_svg_lineY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
1327  area.x = function(_) {
1328  if (!arguments.length) return x1;
1329  x0 = x1 = _;
1330  return area;
1331  };
1332  area.x0 = function(_) {
1333  if (!arguments.length) return x0;
1334  x0 = _;
1335  return area;
1336  };
1337  area.x1 = function(_) {
1338  if (!arguments.length) return x1;
1339  x1 = _;
1340  return area;
1341  };
1342  area.y = function(_) {
1343  if (!arguments.length) return y1;
1344  y0 = y1 = _;
1345  return area;
1346  };
1347  area.y0 = function(_) {
1348  if (!arguments.length) return y0;
1349  y0 = _;
1350  return area;
1351  };
1352  area.y1 = function(_) {
1353  if (!arguments.length) return y1;
1354  y1 = _;
1355  return area;
1356  };
1357  area.defined = function(_) {
1358  if (!arguments.length) return defined;
1359  defined = _;
1360  return area;
1361  };
1362  area.interpolate = function(_) {
1363  if (!arguments.length) return interpolateKey;
1364  if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
1365  interpolateReverse = interpolate.reverse || interpolate;
1366  L = interpolate.closed ? "M" : "L";
1367  return area;
1368  };
1369  area.tension = function(_) {
1370  if (!arguments.length) return tension;
1371  tension = _;
1372  return area;
1373  };
1374  return area;
1375  }
1376  function d3_svg_chordSource(d) {
1377  return d.source;
1378  }
1379  function d3_svg_chordTarget(d) {
1380  return d.target;
1381  }
1382  function d3_svg_chordRadius(d) {
1383  return d.radius;
1384  }
1385  function d3_svg_chordStartAngle(d) {
1386  return d.startAngle;
1387  }
1388  function d3_svg_chordEndAngle(d) {
1389  return d.endAngle;
1390  }
1391  function d3_svg_diagonalProjection(d) {
1392  return [ d.x, d.y ];
1393  }
1394  function d3_svg_diagonalRadialProjection(projection) {
1395  return function() {
1396  var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
1397  return [ r * Math.cos(a), r * Math.sin(a) ];
1398  };
1399  }
1400  function d3_svg_symbolSize() {
1401  return 64;
1402  }
1403  function d3_svg_symbolType() {
1404  return "circle";
1405  }
1406  function d3_svg_symbolCircle(size) {
1407  var r = Math.sqrt(size / Math.PI);
1408  return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
1409  }
1410  function d3_svg_axisX(selection, x) {
1411  selection.attr("transform", function(d) {
1412  return "translate(" + x(d) + ",0)";
1413  });
1414  }
1415  function d3_svg_axisY(selection, y) {
1416  selection.attr("transform", function(d) {
1417  return "translate(0," + y(d) + ")";
1418  });
1419  }
1420  function d3_svg_axisSubdivide(scale, ticks, m) {
1421  subticks = [];
1422  if (m && ticks.length > 1) {
1423  var extent = d3_scaleExtent(scale.domain()), subticks, i = -1, n = ticks.length, d = (ticks[1] - ticks[0]) / ++m, j, v;
1424  while (++i < n) {
1425  for (j = m; --j > 0; ) {
1426  if ((v = +ticks[i] - j * d) >= extent[0]) {
1427  subticks.push(v);
1428  }
1429  }
1430  }
1431  for (--i, j = 0; ++j < m && (v = +ticks[i] + j * d) < extent[1]; ) {
1432  subticks.push(v);
1433  }
1434  }
1435  return subticks;
1436  }
1437  function d3_behavior_zoomDelta() {
1438  if (!d3_behavior_zoomDiv) {
1439  d3_behavior_zoomDiv = d3.select("body").append("div").style("visibility", "hidden").style("top", 0).style("height", 0).style("width", 0).style("overflow-y", "scroll").append("div").style("height", "2000px").node().parentNode;
1440  }
1441  var e = d3.event, delta;
1442  try {
1443  d3_behavior_zoomDiv.scrollTop = 1e3;
1444  d3_behavior_zoomDiv.dispatchEvent(e);
1445  delta = 1e3 - d3_behavior_zoomDiv.scrollTop;
1446  } catch (error) {
1447  delta = e.wheelDelta || -e.detail * 5;
1448  }
1449  return delta;
1450  }
1451  function d3_layout_bundlePath(link) {
1452  var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
1453  while (start !== lca) {
1454  start = start.parent;
1455  points.push(start);
1456  }
1457  var k = points.length;
1458  while (end !== lca) {
1459  points.splice(k, 0, end);
1460  end = end.parent;
1461  }
1462  return points;
1463  }
1464  function d3_layout_bundleAncestors(node) {
1465  var ancestors = [], parent = node.parent;
1466  while (parent != null) {
1467  ancestors.push(node);
1468  node = parent;
1469  parent = parent.parent;
1470  }
1471  ancestors.push(node);
1472  return ancestors;
1473  }
1474  function d3_layout_bundleLeastCommonAncestor(a, b) {
1475  if (a === b) return a;
1476  var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
1477  while (aNode === bNode) {
1478  sharedNode = aNode;
1479  aNode = aNodes.pop();
1480  bNode = bNodes.pop();
1481  }
1482  return sharedNode;
1483  }
1484  function d3_layout_forceDragstart(d) {
1485  d.fixed |= 2;
1486  }
1487  function d3_layout_forceDragend(d) {
1488  d.fixed &= 1;
1489  }
1490  function d3_layout_forceMouseover(d) {
1491  d.fixed |= 4;
1492  }
1493  function d3_layout_forceMouseout(d) {
1494  d.fixed &= 3;
1495  }
1496  function d3_layout_forceAccumulate(quad, alpha, charges) {
1497  var cx = 0, cy = 0;
1498  quad.charge = 0;
1499  if (!quad.leaf) {
1500  var nodes = quad.nodes, n = nodes.length, i = -1, c;
1501  while (++i < n) {
1502  c = nodes[i];
1503  if (c == null) continue;
1504  d3_layout_forceAccumulate(c, alpha, charges);
1505  quad.charge += c.charge;
1506  cx += c.charge * c.cx;
1507  cy += c.charge * c.cy;
1508  }
1509  }
1510  if (quad.point) {
1511  if (!quad.leaf) {
1512  quad.point.x += Math.random() - .5;
1513  quad.point.y += Math.random() - .5;
1514  }
1515  var k = alpha * charges[quad.point.index];
1516  quad.charge += quad.pointCharge = k;
1517  cx += k * quad.point.x;
1518  cy += k * quad.point.y;
1519  }
1520  quad.cx = cx / quad.charge;
1521  quad.cy = cy / quad.charge;
1522  }
1523  function d3_layout_forceLinkDistance(link) {
1524  return 20;
1525  }
1526  function d3_layout_forceLinkStrength(link) {
1527  return 1;
1528  }
1529  function d3_layout_stackX(d) {
1530  return d.x;
1531  }
1532  function d3_layout_stackY(d) {
1533  return d.y;
1534  }
1535  function d3_layout_stackOut(d, y0, y) {
1536  d.y0 = y0;
1537  d.y = y;
1538  }
1539  function d3_layout_stackOrderDefault(data) {
1540  return d3.range(data.length);
1541  }
1542  function d3_layout_stackOffsetZero(data) {
1543  var j = -1, m = data[0].length, y0 = [];
1544  while (++j < m) y0[j] = 0;
1545  return y0;
1546  }
1547  function d3_layout_stackMaxIndex(array) {
1548  var i = 1, j = 0, v = array[0][1], k, n = array.length;
1549  for (; i < n; ++i) {
1550  if ((k = array[i][1]) > v) {
1551  j = i;
1552  v = k;
1553  }
1554  }
1555  return j;
1556  }
1557  function d3_layout_stackReduceSum(d) {
1558  return d.reduce(d3_layout_stackSum, 0);
1559  }
1560  function d3_layout_stackSum(p, d) {
1561  return p + d[1];
1562  }
1563  function d3_layout_histogramBinSturges(range, values) {
1564  return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
1565  }
1566  function d3_layout_histogramBinFixed(range, n) {
1567  var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
1568  while (++x <= n) f[x] = m * x + b;
1569  return f;
1570  }
1571  function d3_layout_histogramRange(values) {
1572  return [ d3.min(values), d3.max(values) ];
1573  }
1574  function d3_layout_hierarchyRebind(object, hierarchy) {
1575  d3.rebind(object, hierarchy, "sort", "children", "value");
1576  object.links = d3_layout_hierarchyLinks;
1577  object.nodes = function(d) {
1578  d3_layout_hierarchyInline = true;
1579  return (object.nodes = object)(d);
1580  };
1581  return object;
1582  }
1583  function d3_layout_hierarchyChildren(d) {
1584  return d.children;
1585  }
1586  function d3_layout_hierarchyValue(d) {
1587  return d.value;
1588  }
1589  function d3_layout_hierarchySort(a, b) {
1590  return b.value - a.value;
1591  }
1592  function d3_layout_hierarchyLinks(nodes) {
1593  return d3.merge(nodes.map(function(parent) {
1594  return (parent.children || []).map(function(child) {
1595  return {
1596  source: parent,
1597  target: child
1598  };
1599  });
1600  }));
1601  }
1602  function d3_layout_packSort(a, b) {
1603  return a.value - b.value;
1604  }
1605  function d3_layout_packInsert(a, b) {
1606  var c = a._pack_next;
1607  a._pack_next = b;
1608  b._pack_prev = a;
1609  b._pack_next = c;
1610  c._pack_prev = b;
1611  }
1612  function d3_layout_packSplice(a, b) {
1613  a._pack_next = b;
1614  b._pack_prev = a;
1615  }
1616  function d3_layout_packIntersects(a, b) {
1617  var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
1618  return dr * dr - dx * dx - dy * dy > .001;
1619  }
1620  function d3_layout_packSiblings(node) {
1621  function bound(node) {
1622  xMin = Math.min(node.x - node.r, xMin);
1623  xMax = Math.max(node.x + node.r, xMax);
1624  yMin = Math.min(node.y - node.r, yMin);
1625  yMax = Math.max(node.y + node.r, yMax);
1626  }
1627  if (!(nodes = node.children) || !(n = nodes.length)) return;
1628  var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
1629  nodes.forEach(d3_layout_packLink);
1630  a = nodes[0];
1631  a.x = -a.r;
1632  a.y = 0;
1633  bound(a);
1634  if (n > 1) {
1635  b = nodes[1];
1636  b.x = b.r;
1637  b.y = 0;
1638  bound(b);
1639  if (n > 2) {
1640  c = nodes[2];
1641  d3_layout_packPlace(a, b, c);
1642  bound(c);
1643  d3_layout_packInsert(a, c);
1644  a._pack_prev = c;
1645  d3_layout_packInsert(c, b);
1646  b = a._pack_next;
1647  for (i = 3; i < n; i++) {
1648  d3_layout_packPlace(a, b, c = nodes[i]);
1649  var isect = 0, s1 = 1, s2 = 1;
1650  for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
1651  if (d3_layout_packIntersects(j, c)) {
1652  isect = 1;
1653  break;
1654  }
1655  }
1656  if (isect == 1) {
1657  for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
1658  if (d3_layout_packIntersects(k, c)) {
1659  break;
1660  }
1661  }
1662  }
1663  if (isect) {
1664  if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
1665  i--;
1666  } else {
1667  d3_layout_packInsert(a, c);
1668  b = c;
1669  bound(c);
1670  }
1671  }
1672  }
1673  }
1674  var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
1675  for (i = 0; i < n; i++) {
1676  c = nodes[i];
1677  c.x -= cx;
1678  c.y -= cy;
1679  cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
1680  }
1681  node.r = cr;
1682  nodes.forEach(d3_layout_packUnlink);
1683  }
1684  function d3_layout_packLink(node) {
1685  node._pack_next = node._pack_prev = node;
1686  }
1687  function d3_layout_packUnlink(node) {
1688  delete node._pack_next;
1689  delete node._pack_prev;
1690  }
1691  function d3_layout_packTransform(node, x, y, k) {
1692  var children = node.children;
1693  node.x = x += k * node.x;
1694  node.y = y += k * node.y;
1695  node.r *= k;
1696  if (children) {
1697  var i = -1, n = children.length;
1698  while (++i < n) d3_layout_packTransform(children[i], x, y, k);
1699  }
1700  }
1701  function d3_layout_packPlace(a, b, c) {
1702  var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
1703  if (db && (dx || dy)) {
1704  var da = b.r + c.r, dc = dx * dx + dy * dy;
1705  da *= da;
1706  db *= db;
1707  var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
1708  c.x = a.x + x * dx + y * dy;
1709  c.y = a.y + x * dy - y * dx;
1710  } else {
1711  c.x = a.x + db;
1712  c.y = a.y;
1713  }
1714  }
1715  function d3_layout_clusterY(children) {
1716  return 1 + d3.max(children, function(child) {
1717  return child.y;
1718  });
1719  }
1720  function d3_layout_clusterX(children) {
1721  return children.reduce(function(x, child) {
1722  return x + child.x;
1723  }, 0) / children.length;
1724  }
1725  function d3_layout_clusterLeft(node) {
1726  var children = node.children;
1727  return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
1728  }
1729  function d3_layout_clusterRight(node) {
1730  var children = node.children, n;
1731  return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
1732  }
1733  function d3_layout_treeSeparation(a, b) {
1734  return a.parent == b.parent ? 1 : 2;
1735  }
1736  function d3_layout_treeLeft(node) {
1737  var children = node.children;
1738  return children && children.length ? children[0] : node._tree.thread;
1739  }
1740  function d3_layout_treeRight(node) {
1741  var children = node.children, n;
1742  return children && (n = children.length) ? children[n - 1] : node._tree.thread;
1743  }
1744  function d3_layout_treeSearch(node, compare) {
1745  var children = node.children;
1746  if (children && (n = children.length)) {
1747  var child, n, i = -1;
1748  while (++i < n) {
1749  if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
1750  node = child;
1751  }
1752  }
1753  }
1754  return node;
1755  }
1756  function d3_layout_treeRightmost(a, b) {
1757  return a.x - b.x;
1758  }
1759  function d3_layout_treeLeftmost(a, b) {
1760  return b.x - a.x;
1761  }
1762  function d3_layout_treeDeepest(a, b) {
1763  return a.depth - b.depth;
1764  }
1765  function d3_layout_treeVisitAfter(node, callback) {
1766  function visit(node, previousSibling) {
1767  var children = node.children;
1768  if (children && (n = children.length)) {
1769  var child, previousChild = null, i = -1, n;
1770  while (++i < n) {
1771  child = children[i];
1772  visit(child, previousChild);
1773  previousChild = child;
1774  }
1775  }
1776  callback(node, previousSibling);
1777  }
1778  visit(node, null);
1779  }
1780  function d3_layout_treeShift(node) {
1781  var shift = 0, change = 0, children = node.children, i = children.length, child;
1782  while (--i >= 0) {
1783  child = children[i]._tree;
1784  child.prelim += shift;
1785  child.mod += shift;
1786  shift += child.shift + (change += child.change);
1787  }
1788  }
1789  function d3_layout_treeMove(ancestor, node, shift) {
1790  ancestor = ancestor._tree;
1791  node = node._tree;
1792  var change = shift / (node.number - ancestor.number);
1793  ancestor.change += change;
1794  node.change -= change;
1795  node.shift += shift;
1796  node.prelim += shift;
1797  node.mod += shift;
1798  }
1799  function d3_layout_treeAncestor(vim, node, ancestor) {
1800  return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
1801  }
1802  function d3_layout_treemapPadNull(node) {
1803  return {
1804  x: node.x,
1805  y: node.y,
1806  dx: node.dx,
1807  dy: node.dy
1808  };
1809  }
1810  function d3_layout_treemapPad(node, padding) {
1811  var x = node.x + padding[3], y = node.y + padding[0], dx = node.dx - padding[1] - padding[3], dy = node.dy - padding[0] - padding[2];
1812  if (dx < 0) {
1813  x += dx / 2;
1814  dx = 0;
1815  }
1816  if (dy < 0) {
1817  y += dy / 2;
1818  dy = 0;
1819  }
1820  return {
1821  x: x,
1822  y: y,
1823  dx: dx,
1824  dy: dy
1825  };
1826  }
1827  function d3_dsv(delimiter, mimeType) {
1828  function dsv(url, callback) {
1829  d3.text(url, mimeType, function(text) {
1830  callback(text && dsv.parse(text));
1831  });
1832  }
1833  function formatRow(row) {
1834  return row.map(formatValue).join(delimiter);
1835  }
1836  function formatValue(text) {
1837  return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
1838  }
1839  var reParse = new RegExp("\r\n|[" + delimiter + "\r\n]", "g"), reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
1840  dsv.parse = function(text) {
1841  var header;
1842  return dsv.parseRows(text, function(row, i) {
1843  if (i) {
1844  var o = {}, j = -1, m = header.length;
1845  while (++j < m) o[header[j]] = row[j];
1846  return o;
1847  } else {
1848  header = row;
1849  return null;
1850  }
1851  });
1852  };
1853  dsv.parseRows = function(text, f) {
1854  function token() {
1855  if (reParse.lastIndex >= text.length) return EOF;
1856  if (eol) {
1857  eol = false;
1858  return EOL;
1859  }
1860  var j = reParse.lastIndex;
1861  if (text.charCodeAt(j) === 34) {
1862  var i = j;
1863  while (i++ < text.length) {
1864  if (text.charCodeAt(i) === 34) {
1865  if (text.charCodeAt(i + 1) !== 34) break;
1866  i++;
1867  }
1868  }
1869  reParse.lastIndex = i + 2;
1870  var c = text.charCodeAt(i + 1);
1871  if (c === 13) {
1872  eol = true;
1873  if (text.charCodeAt(i + 2) === 10) reParse.lastIndex++;
1874  } else if (c === 10) {
1875  eol = true;
1876  }
1877  return text.substring(j + 1, i).replace(/""/g, '"');
1878  }
1879  var m = reParse.exec(text);
1880  if (m) {
1881  eol = m[0].charCodeAt(0) !== delimiterCode;
1882  return text.substring(j, m.index);
1883  }
1884  reParse.lastIndex = text.length;
1885  return text.substring(j);
1886  }
1887  var EOL = {}, EOF = {}, rows = [], n = 0, t, eol;
1888  reParse.lastIndex = 0;
1889  while ((t = token()) !== EOF) {
1890  var a = [];
1891  while (t !== EOL && t !== EOF) {
1892  a.push(t);
1893  t = token();
1894  }
1895  if (f && !(a = f(a, n++))) continue;
1896  rows.push(a);
1897  }
1898  return rows;
1899  };
1900  dsv.format = function(rows) {
1901  return rows.map(formatRow).join("\n");
1902  };
1903  return dsv;
1904  }
1905  function d3_geo_type(types, defaultValue) {
1906  return function(object) {
1907  return object && types.hasOwnProperty(object.type) ? types[object.type](object) : defaultValue;
1908  };
1909  }
1910  function d3_path_circle(radius) {
1911  return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + +2 * radius + "z";
1912  }
1913  function d3_geo_bounds(o, f) {
1914  if (d3_geo_boundsTypes.hasOwnProperty(o.type)) d3_geo_boundsTypes[o.type](o, f);
1915  }
1916  function d3_geo_boundsFeature(o, f) {
1917  d3_geo_bounds(o.geometry, f);
1918  }
1919  function d3_geo_boundsFeatureCollection(o, f) {
1920  for (var a = o.features, i = 0, n = a.length; i < n; i++) {
1921  d3_geo_bounds(a[i].geometry, f);
1922  }
1923  }
1924  function d3_geo_boundsGeometryCollection(o, f) {
1925  for (var a = o.geometries, i = 0, n = a.length; i < n; i++) {
1926  d3_geo_bounds(a[i], f);
1927  }
1928  }
1929  function d3_geo_boundsLineString(o, f) {
1930  for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
1931  f.apply(null, a[i]);
1932  }
1933  }
1934  function d3_geo_boundsMultiLineString(o, f) {
1935  for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
1936  for (var b = a[i], j = 0, m = b.length; j < m; j++) {
1937  f.apply(null, b[j]);
1938  }
1939  }
1940  }
1941  function d3_geo_boundsMultiPolygon(o, f) {
1942  for (var a = o.coordinates, i = 0, n = a.length; i < n; i++) {
1943  for (var b = a[i][0], j = 0, m = b.length; j < m; j++) {
1944  f.apply(null, b[j]);
1945  }
1946  }
1947  }
1948  function d3_geo_boundsPoint(o, f) {
1949  f.apply(null, o.coordinates);
1950  }
1951  function d3_geo_boundsPolygon(o, f) {
1952  for (var a = o.coordinates[0], i = 0, n = a.length; i < n; i++) {
1953  f.apply(null, a[i]);
1954  }
1955  }
1956  function d3_geo_greatArcSource(d) {
1957  return d.source;
1958  }
1959  function d3_geo_greatArcTarget(d) {
1960  return d.target;
1961  }
1962  function d3_geo_greatArcInterpolator() {
1963  function interpolate(t) {
1964  var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
1965  return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ];
1966  }
1967  var x0, y0, cy0, sy0, kx0, ky0, x1, y1, cy1, sy1, kx1, ky1, d, k;
1968  interpolate.distance = function() {
1969  if (d == null) k = 1 / Math.sin(d = Math.acos(Math.max(-1, Math.min(1, sy0 * sy1 + cy0 * cy1 * Math.cos(x1 - x0)))));
1970  return d;
1971  };
1972  interpolate.source = function(_) {
1973  var cx0 = Math.cos(x0 = _[0] * d3_geo_radians), sx0 = Math.sin(x0);
1974  cy0 = Math.cos(y0 = _[1] * d3_geo_radians);
1975  sy0 = Math.sin(y0);
1976  kx0 = cy0 * cx0;
1977  ky0 = cy0 * sx0;
1978  d = null;
1979  return interpolate;
1980  };
1981  interpolate.target = function(_) {
1982  var cx1 = Math.cos(x1 = _[0] * d3_geo_radians), sx1 = Math.sin(x1);
1983  cy1 = Math.cos(y1 = _[1] * d3_geo_radians);
1984  sy1 = Math.sin(y1);
1985  kx1 = cy1 * cx1;
1986  ky1 = cy1 * sx1;
1987  d = null;
1988  return interpolate;
1989  };
1990  return interpolate;
1991  }
1992  function d3_geo_greatArcInterpolate(a, b) {
1993  var i = d3_geo_greatArcInterpolator().source(a).target(b);
1994  i.distance();
1995  return i;
1996  }
1997  function d3_geom_contourStart(grid) {
1998  var x = 0, y = 0;
1999  while (true) {
2000  if (grid(x, y)) {
2001  return [ x, y ];
2002  }
2003  if (x === 0) {
2004  x = y + 1;
2005  y = 0;
2006  } else {
2007  x = x - 1;
2008  y = y + 1;
2009  }
2010  }
2011  }
2012  function d3_geom_hullCCW(i1, i2, i3, v) {
2013  var t, a, b, c, d, e, f;
2014  t = v[i1];
2015  a = t[0];
2016  b = t[1];
2017  t = v[i2];
2018  c = t[0];
2019  d = t[1];
2020  t = v[i3];
2021  e = t[0];
2022  f = t[1];
2023  return (f - b) * (c - a) - (d - b) * (e - a) > 0;
2024  }
2025  function d3_geom_polygonInside(p, a, b) {
2026  return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
2027  }
2028  function d3_geom_polygonIntersect(c, d, a, b) {
2029  var x1 = c[0], x2 = d[0], x3 = a[0], x4 = b[0], y1 = c[1], y2 = d[1], y3 = a[1], y4 = b[1], x13 = x1 - x3, x21 = x2 - x1, x43 = x4 - x3, y13 = y1 - y3, y21 = y2 - y1, y43 = y4 - y3, ua = (x43 * y13 - y43 * x13) / (y43 * x21 - x43 * y21);
2030  return [ x1 + ua * x21, y1 + ua * y21 ];
2031  }
2032  function d3_voronoi_tessellate(vertices, callback) {
2033  var Sites = {
2034  list: vertices.map(function(v, i) {
2035  return {
2036  index: i,
2037  x: v[0],
2038  y: v[1]
2039  };
2040  }).sort(function(a, b) {
2041  return a.y < b.y ? -1 : a.y > b.y ? 1 : a.x < b.x ? -1 : a.x > b.x ? 1 : 0;
2042  }),
2043  bottomSite: null
2044  };
2045  var EdgeList = {
2046  list: [],
2047  leftEnd: null,
2048  rightEnd: null,
2049  init: function() {
2050  EdgeList.leftEnd = EdgeList.createHalfEdge(null, "l");
2051  EdgeList.rightEnd = EdgeList.createHalfEdge(null, "l");
2052  EdgeList.leftEnd.r = EdgeList.rightEnd;
2053  EdgeList.rightEnd.l = EdgeList.leftEnd;
2054  EdgeList.list.unshift(EdgeList.leftEnd, EdgeList.rightEnd);
2055  },
2056  createHalfEdge: function(edge, side) {
2057  return {
2058  edge: edge,
2059  side: side,
2060  vertex: null,
2061  l: null,
2062  r: null
2063  };
2064  },
2065  insert: function(lb, he) {
2066  he.l = lb;
2067  he.r = lb.r;
2068  lb.r.l = he;
2069  lb.r = he;
2070  },
2071  leftBound: function(p) {
2072  var he = EdgeList.leftEnd;
2073  do {
2074  he = he.r;
2075  } while (he != EdgeList.rightEnd && Geom.rightOf(he, p));
2076  he = he.l;
2077  return he;
2078  },
2079  del: function(he) {
2080  he.l.r = he.r;
2081  he.r.l = he.l;
2082  he.edge = null;
2083  },
2084  right: function(he) {
2085  return he.r;
2086  },
2087  left: function(he) {
2088  return he.l;
2089  },
2090  leftRegion: function(he) {
2091  return he.edge == null ? Sites.bottomSite : he.edge.region[he.side];
2092  },
2093  rightRegion: function(he) {
2094  return he.edge == null ? Sites.bottomSite : he.edge.region[d3_voronoi_opposite[he.side]];
2095  }
2096  };
2097  var Geom = {
2098  bisect: function(s1, s2) {
2099  var newEdge = {
2100  region: {
2101  l: s1,
2102  r: s2
2103  },
2104  ep: {
2105  l: null,
2106  r: null
2107  }
2108  };
2109  var dx = s2.x - s1.x, dy = s2.y - s1.y, adx = dx > 0 ? dx : -dx, ady = dy > 0 ? dy : -dy;
2110  newEdge.c = s1.x * dx + s1.y * dy + (dx * dx + dy * dy) * .5;
2111  if (adx > ady) {
2112  newEdge.a = 1;
2113  newEdge.b = dy / dx;
2114  newEdge.c /= dx;
2115  } else {
2116  newEdge.b = 1;
2117  newEdge.a = dx / dy;
2118  newEdge.c /= dy;
2119  }
2120  return newEdge;
2121  },
2122  intersect: function(el1, el2) {
2123  var e1 = el1.edge, e2 = el2.edge;
2124  if (!e1 || !e2 || e1.region.r == e2.region.r) {
2125  return null;
2126  }
2127  var d = e1.a * e2.b - e1.b * e2.a;
2128  if (Math.abs(d) < 1e-10) {
2129  return null;
2130  }
2131  var xint = (e1.c * e2.b - e2.c * e1.b) / d, yint = (e2.c * e1.a - e1.c * e2.a) / d, e1r = e1.region.r, e2r = e2.region.r, el, e;
2132  if (e1r.y < e2r.y || e1r.y == e2r.y && e1r.x < e2r.x) {
2133  el = el1;
2134  e = e1;
2135  } else {
2136  el = el2;
2137  e = e2;
2138  }
2139  var rightOfSite = xint >= e.region.r.x;
2140  if (rightOfSite && el.side === "l" || !rightOfSite && el.side === "r") {
2141  return null;
2142  }
2143  return {
2144  x: xint,
2145  y: yint
2146  };
2147  },
2148  rightOf: function(he, p) {
2149  var e = he.edge, topsite = e.region.r, rightOfSite = p.x > topsite.x;
2150  if (rightOfSite && he.side === "l") {
2151  return 1;
2152  }
2153  if (!rightOfSite && he.side === "r") {
2154  return 0;
2155  }
2156  if (e.a === 1) {
2157  var dyp = p.y - topsite.y, dxp = p.x - topsite.x, fast = 0, above = 0;
2158  if (!rightOfSite && e.b < 0 || rightOfSite && e.b >= 0) {
2159  above = fast = dyp >= e.b * dxp;
2160  } else {
2161  above = p.x + p.y * e.b > e.c;
2162  if (e.b < 0) {
2163  above = !above;
2164  }
2165  if (!above) {
2166  fast = 1;
2167  }
2168  }
2169  if (!fast) {
2170  var dxs = topsite.x - e.region.l.x;
2171  above = e.b * (dxp * dxp - dyp * dyp) < dxs * dyp * (1 + 2 * dxp / dxs + e.b * e.b);
2172  if (e.b < 0) {
2173  above = !above;
2174  }
2175  }
2176  } else {
2177  var yl = e.c - e.a * p.x, t1 = p.y - yl, t2 = p.x - topsite.x, t3 = yl - topsite.y;
2178  above = t1 * t1 > t2 * t2 + t3 * t3;
2179  }
2180  return he.side === "l" ? above : !above;
2181  },
2182  endPoint: function(edge, side, site) {
2183  edge.ep[side] = site;
2184  if (!edge.ep[d3_voronoi_opposite[side]]) return;
2185  callback(edge);
2186  },
2187  distance: function(s, t) {
2188  var dx = s.x - t.x, dy = s.y - t.y;
2189  return Math.sqrt(dx * dx + dy * dy);
2190  }
2191  };
2192  var EventQueue = {
2193  list: [],
2194  insert: function(he, site, offset) {
2195  he.vertex = site;
2196  he.ystar = site.y + offset;
2197  for (var i = 0, list = EventQueue.list, l = list.length; i < l; i++) {
2198  var next = list[i];
2199  if (he.ystar > next.ystar || he.ystar == next.ystar && site.x > next.vertex.x) {
2200  continue;
2201  } else {
2202  break;
2203  }
2204  }
2205  list.splice(i, 0, he);
2206  },
2207  del: function(he) {
2208  for (var i = 0, ls = EventQueue.list, l = ls.length; i < l && ls[i] != he; ++i) {}
2209  ls.splice(i, 1);
2210  },
2211  empty: function() {
2212  return EventQueue.list.length === 0;
2213  },
2214  nextEvent: function(he) {
2215  for (var i = 0, ls = EventQueue.list, l = ls.length; i < l; ++i) {
2216  if (ls[i] == he) return ls[i + 1];
2217  }
2218  return null;
2219  },
2220  min: function() {
2221  var elem = EventQueue.list[0];
2222  return {
2223  x: elem.vertex.x,
2224  y: elem.ystar
2225  };
2226  },
2227  extractMin: function() {
2228  return EventQueue.list.shift();
2229  }
2230  };
2231  EdgeList.init();
2232  Sites.bottomSite = Sites.list.shift();
2233  var newSite = Sites.list.shift(), newIntStar;
2234  var lbnd, rbnd, llbnd, rrbnd, bisector;
2235  var bot, top, temp, p, v;
2236  var e, pm;
2237  while (true) {
2238  if (!EventQueue.empty()) {
2239  newIntStar = EventQueue.min();
2240  }
2241  if (newSite && (EventQueue.empty() || newSite.y < newIntStar.y || newSite.y == newIntStar.y && newSite.x < newIntStar.x)) {
2242  lbnd = EdgeList.leftBound(newSite);
2243  rbnd = EdgeList.right(lbnd);
2244  bot = EdgeList.rightRegion(lbnd);
2245  e = Geom.bisect(bot, newSite);
2246  bisector = EdgeList.createHalfEdge(e, "l");
2247  EdgeList.insert(lbnd, bisector);
2248  p = Geom.intersect(lbnd, bisector);
2249  if (p) {
2250  EventQueue.del(lbnd);
2251  EventQueue.insert(lbnd, p, Geom.distance(p, newSite));
2252  }
2253  lbnd = bisector;
2254  bisector = EdgeList.createHalfEdge(e, "r");
2255  EdgeList.insert(lbnd, bisector);
2256  p = Geom.intersect(bisector, rbnd);
2257  if (p) {
2258  EventQueue.insert(bisector, p, Geom.distance(p, newSite));
2259  }
2260  newSite = Sites.list.shift();
2261  } else if (!EventQueue.empty()) {
2262  lbnd = EventQueue.extractMin();
2263  llbnd = EdgeList.left(lbnd);
2264  rbnd = EdgeList.right(lbnd);
2265  rrbnd = EdgeList.right(rbnd);
2266  bot = EdgeList.leftRegion(lbnd);
2267  top = EdgeList.rightRegion(rbnd);
2268  v = lbnd.vertex;
2269  Geom.endPoint(lbnd.edge, lbnd.side, v);
2270  Geom.endPoint(rbnd.edge, rbnd.side, v);
2271  EdgeList.del(lbnd);
2272  EventQueue.del(rbnd);
2273  EdgeList.del(rbnd);
2274  pm = "l";
2275  if (bot.y > top.y) {
2276  temp = bot;
2277  bot = top;
2278  top = temp;
2279  pm = "r";
2280  }
2281  e = Geom.bisect(bot, top);
2282  bisector = EdgeList.createHalfEdge(e, pm);
2283  EdgeList.insert(llbnd, bisector);
2284  Geom.endPoint(e, d3_voronoi_opposite[pm], v);
2285  p = Geom.intersect(llbnd, bisector);
2286  if (p) {
2287  EventQueue.del(llbnd);
2288  EventQueue.insert(llbnd, p, Geom.distance(p, bot));
2289  }
2290  p = Geom.intersect(bisector, rrbnd);
2291  if (p) {
2292  EventQueue.insert(bisector, p, Geom.distance(p, bot));
2293  }
2294  } else {
2295  break;
2296  }
2297  }
2298  for (lbnd = EdgeList.right(EdgeList.leftEnd); lbnd != EdgeList.rightEnd; lbnd = EdgeList.right(lbnd)) {
2299  callback(lbnd.edge);
2300  }
2301  }
2302  function d3_geom_quadtreeNode() {
2303  return {
2304  leaf: true,
2305  nodes: [],
2306  point: null
2307  };
2308  }
2309  function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
2310  if (!f(node, x1, y1, x2, y2)) {
2311  var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
2312  if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
2313  if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
2314  if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
2315  if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
2316  }
2317  }
2318  function d3_geom_quadtreePoint(p) {
2319  return {
2320  x: p[0],
2321  y: p[1]
2322  };
2323  }
2324  function d3_time_utc() {
2325  this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
2326  }
2327  function d3_time_formatAbbreviate(name) {
2328  return name.substring(0, 3);
2329  }
2330  function d3_time_parse(date, template, string, j) {
2331  var c, p, i = 0, n = template.length, m = string.length;
2332  while (i < n) {
2333  if (j >= m) return -1;
2334  c = template.charCodeAt(i++);
2335  if (c == 37) {
2336  p = d3_time_parsers[template.charAt(i++)];
2337  if (!p || (j = p(date, string, j)) < 0) return -1;
2338  } else if (c != string.charCodeAt(j++)) {
2339  return -1;
2340  }
2341  }
2342  return j;
2343  }
2344  function d3_time_formatRe(names) {
2345  return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
2346  }
2347  function d3_time_formatLookup(names) {
2348  var map = new d3_Map, i = -1, n = names.length;
2349  while (++i < n) map.set(names[i].toLowerCase(), i);
2350  return map;
2351  }
2352  function d3_time_parseWeekdayAbbrev(date, string, i) {
2353  d3_time_dayAbbrevRe.lastIndex = 0;
2354  var n = d3_time_dayAbbrevRe.exec(string.substring(i));
2355  return n ? i += n[0].length : -1;
2356  }
2357  function d3_time_parseWeekday(date, string, i) {
2358  d3_time_dayRe.lastIndex = 0;
2359  var n = d3_time_dayRe.exec(string.substring(i));
2360  return n ? i += n[0].length : -1;
2361  }
2362  function d3_time_parseMonthAbbrev(date, string, i) {
2363  d3_time_monthAbbrevRe.lastIndex = 0;
2364  var n = d3_time_monthAbbrevRe.exec(string.substring(i));
2365  return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
2366  }
2367  function d3_time_parseMonth(date, string, i) {
2368  d3_time_monthRe.lastIndex = 0;
2369  var n = d3_time_monthRe.exec(string.substring(i));
2370  return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
2371  }
2372  function d3_time_parseLocaleFull(date, string, i) {
2373  return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
2374  }
2375  function d3_time_parseLocaleDate(date, string, i) {
2376  return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
2377  }
2378  function d3_time_parseLocaleTime(date, string, i) {
2379  return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
2380  }
2381  function d3_time_parseFullYear(date, string, i) {
2382  d3_time_numberRe.lastIndex = 0;
2383  var n = d3_time_numberRe.exec(string.substring(i, i + 4));
2384  return n ? (date.y = +n[0], i += n[0].length) : -1;
2385  }
2386  function d3_time_parseYear(date, string, i) {
2387  d3_time_numberRe.lastIndex = 0;
2388  var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2389  return n ? (date.y = d3_time_expandYear(+n[0]), i += n[0].length) : -1;
2390  }
2391  function d3_time_expandYear(d) {
2392  return d + (d > 68 ? 1900 : 2e3);
2393  }
2394  function d3_time_parseMonthNumber(date, string, i) {
2395  d3_time_numberRe.lastIndex = 0;
2396  var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2397  return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
2398  }
2399  function d3_time_parseDay(date, string, i) {
2400  d3_time_numberRe.lastIndex = 0;
2401  var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2402  return n ? (date.d = +n[0], i += n[0].length) : -1;
2403  }
2404  function d3_time_parseHour24(date, string, i) {
2405  d3_time_numberRe.lastIndex = 0;
2406  var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2407  return n ? (date.H = +n[0], i += n[0].length) : -1;
2408  }
2409  function d3_time_parseMinutes(date, string, i) {
2410  d3_time_numberRe.lastIndex = 0;
2411  var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2412  return n ? (date.M = +n[0], i += n[0].length) : -1;
2413  }
2414  function d3_time_parseSeconds(date, string, i) {
2415  d3_time_numberRe.lastIndex = 0;
2416  var n = d3_time_numberRe.exec(string.substring(i, i + 2));
2417  return n ? (date.S = +n[0], i += n[0].length) : -1;
2418  }
2419  function d3_time_parseMilliseconds(date, string, i) {
2420  d3_time_numberRe.lastIndex = 0;
2421  var n = d3_time_numberRe.exec(string.substring(i, i + 3));
2422  return n ? (date.L = +n[0], i += n[0].length) : -1;
2423  }
2424  function d3_time_parseAmPm(date, string, i) {
2425  var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
2426  return n == null ? -1 : (date.p = n, i);
2427  }
2428  function d3_time_zone(d) {
2429  var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(Math.abs(z) / 60), zm = Math.abs(z) % 60;
2430  return zs + d3_time_zfill2(zh) + d3_time_zfill2(zm);
2431  }
2432  function d3_time_formatIsoNative(date) {
2433  return date.toISOString();
2434  }
2435  function d3_time_interval(local, step, number) {
2436  function round(date) {
2437  var d0 = local(date), d1 = offset(d0, 1);
2438  return date - d0 < d1 - date ? d0 : d1;
2439  }
2440  function ceil(date) {
2441  step(date = local(new d3_time(date - 1)), 1);
2442  return date;
2443  }
2444  function offset(date, k) {
2445  step(date = new d3_time(+date), k);
2446  return date;
2447  }
2448  function range(t0, t1, dt) {
2449  var time = ceil(t0), times = [];
2450  if (dt > 1) {
2451  while (time < t1) {
2452  if (!(number(time) % dt)) times.push(new Date(+time));
2453  step(time, 1);
2454  }
2455  } else {
2456  while (time < t1) times.push(new Date(+time)), step(time, 1);
2457  }
2458  return times;
2459  }
2460  function range_utc(t0, t1, dt) {
2461  try {
2462  d3_time = d3_time_utc;
2463  var utc = new d3_time_utc;
2464  utc._ = t0;
2465  return range(utc, t1, dt);
2466  } finally {
2467  d3_time = Date;
2468  }
2469  }
2470  local.floor = local;
2471  local.round = round;
2472  local.ceil = ceil;
2473  local.offset = offset;
2474  local.range = range;
2475  var utc = local.utc = d3_time_interval_utc(local);
2476  utc.floor = utc;
2477  utc.round = d3_time_interval_utc(round);
2478  utc.ceil = d3_time_interval_utc(ceil);
2479  utc.offset = d3_time_interval_utc(offset);
2480  utc.range = range_utc;
2481  return local;
2482  }
2483  function d3_time_interval_utc(method) {
2484  return function(date, k) {
2485  try {
2486  d3_time = d3_time_utc;
2487  var utc = new d3_time_utc;
2488  utc._ = date;
2489  return method(utc, k)._;
2490  } finally {
2491  d3_time = Date;
2492  }
2493  };
2494  }
2495  function d3_time_scale(linear, methods, format) {
2496  function scale(x) {
2497  return linear(x);
2498  }
2499  scale.invert = function(x) {
2500  return d3_time_scaleDate(linear.invert(x));
2501  };
2502  scale.domain = function(x) {
2503  if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
2504  linear.domain(x);
2505  return scale;
2506  };
2507  scale.nice = function(m) {
2508  return scale.domain(d3_scale_nice(scale.domain(), function() {
2509  return m;
2510  }));
2511  };
2512  scale.ticks = function(m, k) {
2513  var extent = d3_time_scaleExtent(scale.domain());
2514  if (typeof m !== "function") {
2515  var span = extent[1] - extent[0], target = span / m, i = d3.bisect(d3_time_scaleSteps, target);
2516  if (i == d3_time_scaleSteps.length) return methods.year(extent, m);
2517  if (!i) return linear.ticks(m).map(d3_time_scaleDate);
2518  if (Math.log(target / d3_time_scaleSteps[i - 1]) < Math.log(d3_time_scaleSteps[i] / target)) --i;
2519  m = methods[i];
2520  k = m[1];
2521  m = m[0].range;
2522  }
2523  return m(extent[0], new Date(+extent[1] + 1), k);
2524  };
2525  scale.tickFormat = function() {
2526  return format;
2527  };
2528  scale.copy = function() {
2529  return d3_time_scale(linear.copy(), methods, format);
2530  };
2531  return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
2532  }
2533  function d3_time_scaleExtent(domain) {
2534  var start = domain[0], stop = domain[domain.length - 1];
2535  return start < stop ? [ start, stop ] : [ stop, start ];
2536  }
2537  function d3_time_scaleDate(t) {
2538  return new Date(t);
2539  }
2540  function d3_time_scaleFormat(formats) {
2541  return function(date) {
2542  var i = formats.length - 1, f = formats[i];
2543  while (!f[1](date)) f = formats[--i];
2544  return f[0](date);
2545  };
2546  }
2547  function d3_time_scaleSetYear(y) {
2548  var d = new Date(y, 0, 1);
2549  d.setFullYear(y);
2550  return d;
2551  }
2552  function d3_time_scaleGetYear(d) {
2553  var y = d.getFullYear(), d0 = d3_time_scaleSetYear(y), d1 = d3_time_scaleSetYear(y + 1);
2554  return y + (d - d0) / (d1 - d0);
2555  }
2556  function d3_time_scaleUTCSetYear(y) {
2557  var d = new Date(Date.UTC(y, 0, 1));
2558  d.setUTCFullYear(y);
2559  return d;
2560  }
2561  function d3_time_scaleUTCGetYear(d) {
2562  var y = d.getUTCFullYear(), d0 = d3_time_scaleUTCSetYear(y), d1 = d3_time_scaleUTCSetYear(y + 1);
2563  return y + (d - d0) / (d1 - d0);
2564  }
2565  if (!Date.now) Date.now = function() {
2566  return +(new Date);
2567  };
2568  try {
2569  document.createElement("div").style.setProperty("opacity", 0, "");
2570  } catch (error) {
2571  var d3_style_prototype = CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
2572  d3_style_prototype.setProperty = function(name, value, priority) {
2573  d3_style_setProperty.call(this, name, value + "", priority);
2574  };
2575  }
2576  d3 = {
2577  version: "2.10.3"
2578  };
2579  var d3_array = d3_arraySlice;
2580  try {
2581  d3_array(document.documentElement.childNodes)[0].nodeType;
2582  } catch (e) {
2583  d3_array = d3_arrayCopy;
2584  }
2585  var d3_arraySubclass = [].__proto__ ? function(array, prototype) {
2586  array.__proto__ = prototype;
2587  } : function(array, prototype) {
2588  for (var property in prototype) array[property] = prototype[property];
2589  };
2590  d3.map = function(object) {
2591  var map = new d3_Map;
2592  for (var key in object) map.set(key, object[key]);
2593  return map;
2594  };
2595  d3_class(d3_Map, {
2596  has: function(key) {
2597  return d3_map_prefix + key in this;
2598  },
2599  get: function(key) {
2600  return this[d3_map_prefix + key];
2601  },
2602  set: function(key, value) {
2603  return this[d3_map_prefix + key] = value;
2604  },
2605  remove: function(key) {
2606  key = d3_map_prefix + key;
2607  return key in this && delete this[key];
2608  },
2609  keys: function() {
2610  var keys = [];
2611  this.forEach(function(key) {
2612  keys.push(key);
2613  });
2614  return keys;
2615  },
2616  values: function() {
2617  var values = [];
2618  this.forEach(function(key, value) {
2619  values.push(value);
2620  });
2621  return values;
2622  },
2623  entries: function() {
2624  var entries = [];
2625  this.forEach(function(key, value) {
2626  entries.push({
2627  key: key,
2628  value: value
2629  });
2630  });
2631  return entries;
2632  },
2633  forEach: function(f) {
2634  for (var key in this) {
2635  if (key.charCodeAt(0) === d3_map_prefixCode) {
2636  f.call(this, key.substring(1), this[key]);
2637  }
2638  }
2639  }
2640  });
2641  var d3_map_prefix = "\0", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
2642  d3.functor = d3_functor;
2643  d3.rebind = function(target, source) {
2644  var i = 1, n = arguments.length, method;
2645  while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
2646  return target;
2647  };
2648  d3.ascending = function(a, b) {
2649  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
2650  };
2651  d3.descending = function(a, b) {
2652  return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
2653  };
2654  d3.mean = function(array, f) {
2655  var n = array.length, a, m = 0, i = -1, j = 0;
2656  if (arguments.length === 1) {
2657  while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
2658  } else {
2659  while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
2660  }
2661  return j ? m : undefined;
2662  };
2663  d3.median = function(array, f) {
2664  if (arguments.length > 1) array = array.map(f);
2665  array = array.filter(d3_number);
2666  return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
2667  };
2668  d3.min = function(array, f) {
2669  var i = -1, n = array.length, a, b;
2670  if (arguments.length === 1) {
2671  while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
2672  while (++i < n) if ((b = array[i]) != null && a > b) a = b;
2673  } else {
2674  while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
2675  while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
2676  }
2677  return a;
2678  };
2679  d3.max = function(array, f) {
2680  var i = -1, n = array.length, a, b;
2681  if (arguments.length === 1) {
2682  while (++i < n && ((a = array[i]) == null || a != a)) a = undefined;
2683  while (++i < n) if ((b = array[i]) != null && b > a) a = b;
2684  } else {
2685  while (++i < n && ((a = f.call(array, array[i], i)) == null || a != a)) a = undefined;
2686  while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
2687  }
2688  return a;
2689  };
2690  d3.extent = function(array, f) {
2691  var i = -1, n = array.length, a, b, c;
2692  if (arguments.length === 1) {
2693  while (++i < n && ((a = c = array[i]) == null || a != a)) a = c = undefined;
2694  while (++i < n) if ((b = array[i]) != null) {
2695  if (a > b) a = b;
2696  if (c < b) c = b;
2697  }
2698  } else {
2699  while (++i < n && ((a = c = f.call(array, array[i], i)) == null || a != a)) a = undefined;
2700  while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
2701  if (a > b) a = b;
2702  if (c < b) c = b;
2703  }
2704  }
2705  return [ a, c ];
2706  };
2707  d3.random = {
2708  normal: function(µ, σ) {
2709  var n = arguments.length;
2710  if (n < 2) σ = 1;
2711  if (n < 1) µ = 0;
2712  return function() {
2713  var x, y, r;
2714  do {
2715  x = Math.random() * 2 - 1;
2716  y = Math.random() * 2 - 1;
2717  r = x * x + y * y;
2718  } while (!r || r > 1);
2719  return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
2720  };
2721  },
2722  logNormal: function(µ, σ) {
2723  var n = arguments.length;
2724  if (n < 2) σ = 1;
2725  if (n < 1) µ = 0;
2726  var random = d3.random.normal();
2727  return function() {
2728  return Math.exp(µ + σ * random());
2729  };
2730  },
2731  irwinHall: function(m) {
2732  return function() {
2733  for (var s = 0, j = 0; j < m; j++) s += Math.random();
2734  return s / m;
2735  };
2736  }
2737  };
2738  d3.sum = function(array, f) {
2739  var s = 0, n = array.length, a, i = -1;
2740  if (arguments.length === 1) {
2741  while (++i < n) if (!isNaN(a = +array[i])) s += a;
2742  } else {
2743  while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
2744  }
2745  return s;
2746  };
2747  d3.quantile = function(values, p) {
2748  var H = (values.length - 1) * p + 1, h = Math.floor(H), v = values[h - 1], e = H - h;
2749  return e ? v + e * (values[h] - v) : v;
2750  };
2751  d3.transpose = function(matrix) {
2752  return d3.zip.apply(d3, matrix);
2753  };
2754  d3.zip = function() {
2755  if (!(n = arguments.length)) return [];
2756  for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
2757  for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
2758  zip[j] = arguments[j][i];
2759  }
2760  }
2761  return zips;
2762  };
2763  d3.bisector = function(f) {
2764  return {
2765  left: function(a, x, lo, hi) {
2766  if (arguments.length < 3) lo = 0;
2767  if (arguments.length < 4) hi = a.length;
2768  while (lo < hi) {
2769  var mid = lo + hi >>> 1;
2770  if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
2771  }
2772  return lo;
2773  },
2774  right: function(a, x, lo, hi) {
2775  if (arguments.length < 3) lo = 0;
2776  if (arguments.length < 4) hi = a.length;
2777  while (lo < hi) {
2778  var mid = lo + hi >>> 1;
2779  if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
2780  }
2781  return lo;
2782  }
2783  };
2784  };
2785  var d3_bisector = d3.bisector(function(d) {
2786  return d;
2787  });
2788  d3.bisectLeft = d3_bisector.left;
2789  d3.bisect = d3.bisectRight = d3_bisector.right;
2790  d3.first = function(array, f) {
2791  var i = 0, n = array.length, a = array[0], b;
2792  if (arguments.length === 1) f = d3.ascending;
2793  while (++i < n) {
2794  if (f.call(array, a, b = array[i]) > 0) {
2795  a = b;
2796  }
2797  }
2798  return a;
2799  };
2800  d3.last = function(array, f) {
2801  var i = 0, n = array.length, a = array[0], b;
2802  if (arguments.length === 1) f = d3.ascending;
2803  while (++i < n) {
2804  if (f.call(array, a, b = array[i]) <= 0) {
2805  a = b;
2806  }
2807  }
2808  return a;
2809  };
2810  d3.nest = function() {
2811  function map(array, depth) {
2812  if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
2813  var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {};
2814  while (++i < n) {
2815  if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
2816  values.push(object);
2817  } else {
2818  valuesByKey.set(keyValue, [ object ]);
2819  }
2820  }
2821  valuesByKey.forEach(function(keyValue, values) {
2822  o[keyValue] = map(values, depth);
2823  });
2824  return o;
2825  }
2826  function entries(map, depth) {
2827  if (depth >= keys.length) return map;
2828  var a = [], sortKey = sortKeys[depth++], key;
2829  for (key in map) {
2830  a.push({
2831  key: key,
2832  values: entries(map[key], depth)
2833  });
2834  }
2835  if (sortKey) a.sort(function(a, b) {
2836  return sortKey(a.key, b.key);
2837  });
2838  return a;
2839  }
2840  var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
2841  nest.map = function(array) {
2842  return map(array, 0);
2843  };
2844  nest.entries = function(array) {
2845  return entries(map(array, 0), 0);
2846  };
2847  nest.key = function(d) {
2848  keys.push(d);
2849  return nest;
2850  };
2851  nest.sortKeys = function(order) {
2852  sortKeys[keys.length - 1] = order;
2853  return nest;
2854  };
2855  nest.sortValues = function(order) {
2856  sortValues = order;
2857  return nest;
2858  };
2859  nest.rollup = function(f) {
2860  rollup = f;
2861  return nest;
2862  };
2863  return nest;
2864  };
2865  d3.keys = function(map) {
2866  var keys = [];
2867  for (var key in map) keys.push(key);
2868  return keys;
2869  };
2870  d3.values = function(map) {
2871  var values = [];
2872  for (var key in map) values.push(map[key]);
2873  return values;
2874  };
2875  d3.entries = function(map) {
2876  var entries = [];
2877  for (var key in map) entries.push({
2878  key: key,
2879  value: map[key]
2880  });
2881  return entries;
2882  };
2883  d3.permute = function(array, indexes) {
2884  var permutes = [], i = -1, n = indexes.length;
2885  while (++i < n) permutes[i] = array[indexes[i]];
2886  return permutes;
2887  };
2888  d3.merge = function(arrays) {
2889  return Array.prototype.concat.apply([], arrays);
2890  };
2891  d3.split = function(array, f) {
2892  var arrays = [], values = [], value, i = -1, n = array.length;
2893  if (arguments.length < 2) f = d3_splitter;
2894  while (++i < n) {
2895  if (f.call(values, value = array[i], i)) {
2896  values = [];
2897  } else {
2898  if (!values.length) arrays.push(values);
2899  values.push(value);
2900  }
2901  }
2902  return arrays;
2903  };
2904  d3.range = function(start, stop, step) {
2905  if (arguments.length < 3) {
2906  step = 1;
2907  if (arguments.length < 2) {
2908  stop = start;
2909  start = 0;
2910  }
2911  }
2912  if ((stop - start) / step === Infinity) throw new Error("infinite range");
2913  var range = [], k = d3_range_integerScale(Math.abs(step)), i = -1, j;
2914  start *= k, stop *= k, step *= k;
2915  if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
2916  return range;
2917  };
2918  d3.requote = function(s) {
2919  return s.replace(d3_requote_re, "\\$&");
2920  };
2921  var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
2922  d3.round = function(x, n) {
2923  return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
2924  };
2925  d3.xhr = function(url, mime, callback) {
2926  var req = new XMLHttpRequest;
2927  if (arguments.length < 3) callback = mime, mime = null; else if (mime && req.overrideMimeType) req.overrideMimeType(mime);
2928  req.open("GET", url, true);
2929  if (mime) req.setRequestHeader("Accept", mime);
2930  req.onreadystatechange = function() {
2931  if (req.readyState === 4) {
2932  var s = req.status;
2933  callback(!s && req.response || s >= 200 && s < 300 || s === 304 ? req : null);
2934  }
2935  };
2936  req.send(null);
2937  };
2938  d3.text = function(url, mime, callback) {
2939  function ready(req) {
2940  callback(req && req.responseText);
2941  }
2942  if (arguments.length < 3) {
2943  callback = mime;
2944  mime = null;
2945  }
2946  d3.xhr(url, mime, ready);
2947  };
2948  d3.json = function(url, callback) {
2949  d3.text(url, "application/json", function(text) {
2950  callback(text ? JSON.parse(text) : null);
2951  });
2952  };
2953  d3.html = function(url, callback) {
2954  d3.text(url, "text/html", function(text) {
2955  if (text != null) {
2956  var range = document.createRange();
2957  range.selectNode(document.body);
2958  text = range.createContextualFragment(text);
2959  }
2960  callback(text);
2961  });
2962  };
2963  d3.xml = function(url, mime, callback) {
2964  function ready(req) {
2965  callback(req && req.responseXML);
2966  }
2967  if (arguments.length < 3) {
2968  callback = mime;
2969  mime = null;
2970  }
2971  d3.xhr(url, mime, ready);
2972  };
2973  var d3_nsPrefix = {
2974  svg: "http://www.w3.org/2000/svg",
2975  xhtml: "http://www.w3.org/1999/xhtml",
2976  xlink: "http://www.w3.org/1999/xlink",
2977  xml: "http://www.w3.org/XML/1998/namespace",
2978  xmlns: "http://www.w3.org/2000/xmlns/"
2979  };
2980  d3.ns = {
2981  prefix: d3_nsPrefix,
2982  qualify: function(name) {
2983  var i = name.indexOf(":"), prefix = name;
2984  if (i >= 0) {
2985  prefix = name.substring(0, i);
2986  name = name.substring(i + 1);
2987  }
2988  return d3_nsPrefix.hasOwnProperty(prefix) ? {
2989  space: d3_nsPrefix[prefix],
2990  local: name
2991  } : name;
2992  }
2993  };
2994  d3.dispatch = function() {
2995  var dispatch = new d3_dispatch, i = -1, n = arguments.length;
2996  while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
2997  return dispatch;
2998  };
2999  d3_dispatch.prototype.on = function(type, listener) {
3000  var i = type.indexOf("."), name = "";
3001  if (i > 0) {
3002  name = type.substring(i + 1);
3003  type = type.substring(0, i);
3004  }
3005  return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
3006  };
3007  d3.format = function(specifier) {
3008  var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
3009  if (precision) precision = +precision.substring(1);
3010  if (zfill) {
3011  fill = "0";
3012  if (comma) width -= Math.floor((width - 1) / 4);
3013  }
3014  switch (type) {
3015  case "n":
3016  comma = true;
3017  type = "g";
3018  break;
3019  case "%":
3020  scale = 100;
3021  suffix = "%";
3022  type = "f";
3023  break;
3024  case "p":
3025  scale = 100;
3026  suffix = "%";
3027  type = "r";
3028  break;
3029  case "d":
3030  integer = true;
3031  precision = 0;
3032  break;
3033  case "s":
3034  scale = -1;
3035  type = "r";
3036  break;
3037  }
3038  if (type == "r" && !precision) type = "g";
3039  type = d3_format_types.get(type) || d3_format_typeDefault;
3040  return function(value) {
3041  if (integer && value % 1) return "";
3042  var negative = value < 0 && (value = -value) ? "-" : sign;
3043  if (scale < 0) {
3044  var prefix = d3.formatPrefix(value, precision);
3045  value = prefix.scale(value);
3046  suffix = prefix.symbol;
3047  } else {
3048  value *= scale;
3049  }
3050  value = type(value, precision);
3051  if (zfill) {
3052  var length = value.length + negative.length;
3053  if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
3054  if (comma) value = d3_format_group(value);
3055  value = negative + value;
3056  } else {
3057  if (comma) value = d3_format_group(value);
3058  value = negative + value;
3059  var length = value.length;
3060  if (length < width) value = (new Array(width - length + 1)).join(fill) + value;
3061  }
3062  return value + suffix;
3063  };
3064  };
3065  var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?(#)?(0)?([0-9]+)?(,)?(\.[0-9]+)?([a-zA-Z%])?/;
3066  var d3_format_types = d3.map({
3067  g: function(x, p) {
3068  return x.toPrecision(p);
3069  },
3070  e: function(x, p) {
3071  return x.toExponential(p);
3072  },
3073  f: function(x, p) {
3074  return x.toFixed(p);
3075  },
3076  r: function(x, p) {
3077  return d3.round(x, p = d3_format_precision(x, p)).toFixed(Math.max(0, Math.min(20, p)));
3078  }
3079  });
3080  var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "μ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
3081  d3.formatPrefix = function(value, precision) {
3082  var i = 0;
3083  if (value) {
3084  if (value < 0) value *= -1;
3085  if (precision) value = d3.round(value, d3_format_precision(value, precision));
3086  i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
3087  i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
3088  }
3089  return d3_formatPrefixes[8 + i / 3];
3090  };
3091  var d3_ease_quad = d3_ease_poly(2), d3_ease_cubic = d3_ease_poly(3), d3_ease_default = function() {
3092  return d3_ease_identity;
3093  };
3094  var d3_ease = d3.map({
3095  linear: d3_ease_default,
3096  poly: d3_ease_poly,
3097  quad: function() {
3098  return d3_ease_quad;
3099  },
3100  cubic: function() {
3101  return d3_ease_cubic;
3102  },
3103  sin: function() {
3104  return d3_ease_sin;
3105  },
3106  exp: function() {
3107  return d3_ease_exp;
3108  },
3109  circle: function() {
3110  return d3_ease_circle;
3111  },
3112  elastic: d3_ease_elastic,
3113  back: d3_ease_back,
3114  bounce: function() {
3115  return d3_ease_bounce;
3116  }
3117  });
3118  var d3_ease_mode = d3.map({
3119  "in": d3_ease_identity,
3120  out: d3_ease_reverse,
3121  "in-out": d3_ease_reflect,
3122  "out-in": function(f) {
3123  return d3_ease_reflect(d3_ease_reverse(f));
3124  }
3125  });
3126  d3.ease = function(name) {
3127  var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
3128  t = d3_ease.get(t) || d3_ease_default;
3129  m = d3_ease_mode.get(m) || d3_ease_identity;
3130  return d3_ease_clamp(m(t.apply(null, Array.prototype.slice.call(arguments, 1))));
3131  };
3132  d3.event = null;
3133  d3.transform = function(string) {
3134  var g = document.createElementNS(d3.ns.prefix.svg, "g");
3135  return (d3.transform = function(string) {
3136  g.setAttribute("transform", string);
3137  var t = g.transform.baseVal.consolidate();
3138  return new d3_transform(t ? t.matrix : d3_transformIdentity);
3139  })(string);
3140  };
3141  d3_transform.prototype.toString = function() {
3142  return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
3143  };
3144  var d3_transformDegrees = 180 / Math.PI, d3_transformIdentity = {
3145  a: 1,
3146  b: 0,
3147  c: 0,
3148  d: 1,
3149  e: 0,
3150  f: 0
3151  };
3152  d3.interpolate = function(a, b) {
3153  var i = d3.interpolators.length, f;
3154  while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
3155  return f;
3156  };
3157  d3.interpolateNumber = function(a, b) {
3158  b -= a;
3159  return function(t) {
3160  return a + b * t;
3161  };
3162  };
3163  d3.interpolateRound = function(a, b) {
3164  b -= a;
3165  return function(t) {
3166  return Math.round(a + b * t);
3167  };
3168  };
3169  d3.interpolateString = function(a, b) {
3170  var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
3171  d3_interpolate_number.lastIndex = 0;
3172  for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
3173  if (m.index) s.push(b.substring(s0, s1 = m.index));
3174  q.push({
3175  i: s.length,
3176  x: m[0]
3177  });
3178  s.push(null);
3179  s0 = d3_interpolate_number.lastIndex;
3180  }
3181  if (s0 < b.length) s.push(b.substring(s0));
3182  for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
3183  o = q[i];
3184  if (o.x == m[0]) {
3185  if (o.i) {
3186  if (s[o.i + 1] == null) {
3187  s[o.i - 1] += o.x;
3188  s.splice(o.i, 1);
3189  for (j = i + 1; j < n; ++j) q[j].i--;
3190  } else {
3191  s[o.i - 1] += o.x + s[o.i + 1];
3192  s.splice(o.i, 2);
3193  for (j = i + 1; j < n; ++j) q[j].i -= 2;
3194  }
3195  } else {
3196  if (s[o.i + 1] == null) {
3197  s[o.i] = o.x;
3198  } else {
3199  s[o.i] = o.x + s[o.i + 1];
3200  s.splice(o.i + 1, 1);
3201  for (j = i + 1; j < n; ++j) q[j].i--;
3202  }
3203  }
3204  q.splice(i, 1);
3205  n--;
3206  i--;
3207  } else {
3208  o.x = d3.interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
3209  }
3210  }
3211  while (i < n) {
3212  o = q.pop();
3213  if (s[o.i + 1] == null) {
3214  s[o.i] = o.x;
3215  } else {
3216  s[o.i] = o.x + s[o.i + 1];
3217  s.splice(o.i + 1, 1);
3218  }
3219  n--;
3220  }
3221  if (s.length === 1) {
3222  return s[0] == null ? q[0].x : function() {
3223  return b;
3224  };
3225  }
3226  return function(t) {
3227  for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
3228  return s.join("");
3229  };
3230  };
3231  d3.interpolateTransform = function(a, b) {
3232  var s = [], q = [], n, A = d3.transform(a), B = d3.transform(b), ta = A.translate, tb = B.translate, ra = A.rotate, rb = B.rotate, wa = A.skew, wb = B.skew, ka = A.scale, kb = B.scale;
3233  if (ta[0] != tb[0] || ta[1] != tb[1]) {
3234  s.push("translate(", null, ",", null, ")");
3235  q.push({
3236  i: 1,
3237  x: d3.interpolateNumber(ta[0], tb[0])
3238  }, {
3239  i: 3,
3240  x: d3.interpolateNumber(ta[1], tb[1])
3241  });
3242  } else if (tb[0] || tb[1]) {
3243  s.push("translate(" + tb + ")");
3244  } else {
3245  s.push("");
3246  }
3247  if (ra != rb) {
3248  if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
3249  q.push({
3250  i: s.push(s.pop() + "rotate(", null, ")") - 2,
3251  x: d3.interpolateNumber(ra, rb)
3252  });
3253  } else if (rb) {
3254  s.push(s.pop() + "rotate(" + rb + ")");
3255  }
3256  if (wa != wb) {
3257  q.push({
3258  i: s.push(s.pop() + "skewX(", null, ")") - 2,
3259  x: d3.interpolateNumber(wa, wb)
3260  });
3261  } else if (wb) {
3262  s.push(s.pop() + "skewX(" + wb + ")");
3263  }
3264  if (ka[0] != kb[0] || ka[1] != kb[1]) {
3265  n = s.push(s.pop() + "scale(", null, ",", null, ")");
3266  q.push({
3267  i: n - 4,
3268  x: d3.interpolateNumber(ka[0], kb[0])
3269  }, {
3270  i: n - 2,
3271  x: d3.interpolateNumber(ka[1], kb[1])
3272  });
3273  } else if (kb[0] != 1 || kb[1] != 1) {
3274  s.push(s.pop() + "scale(" + kb + ")");
3275  }
3276  n = q.length;
3277  return function(t) {
3278  var i = -1, o;
3279  while (++i < n) s[(o = q[i]).i] = o.x(t);
3280  return s.join("");
3281  };
3282  };
3283  d3.interpolateRgb = function(a, b) {
3284  a = d3.rgb(a);
3285  b = d3.rgb(b);
3286  var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
3287  return function(t) {
3288  return "#" + d3_rgb_hex(Math.round(ar + br * t)) + d3_rgb_hex(Math.round(ag + bg * t)) + d3_rgb_hex(Math.round(ab + bb * t));
3289  };
3290  };
3291  d3.interpolateHsl = function(a, b) {
3292  a = d3.hsl(a);
3293  b = d3.hsl(b);
3294  var h0 = a.h, s0 = a.s, l0 = a.l, h1 = b.h - h0, s1 = b.s - s0, l1 = b.l - l0;
3295  if (h1 > 180) h1 -= 360; else if (h1 < -180) h1 += 360;
3296  return function(t) {
3297  return d3_hsl_rgb(h0 + h1 * t, s0 + s1 * t, l0 + l1 * t) + "";
3298  };
3299  };
3300  d3.interpolateLab = function(a, b) {
3301  a = d3.lab(a);
3302  b = d3.lab(b);
3303  var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
3304  return function(t) {
3305  return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
3306  };
3307  };
3308  d3.interpolateHcl = function(a, b) {
3309  a = d3.hcl(a);
3310  b = d3.hcl(b);
3311  var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
3312  if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
3313  return function(t) {
3314  return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
3315  };
3316  };
3317  d3.interpolateArray = function(a, b) {
3318  var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
3319  for (i = 0; i < n0; ++i) x.push(d3.interpolate(a[i], b[i]));
3320  for (; i < na; ++i) c[i] = a[i];
3321  for (; i < nb; ++i) c[i] = b[i];
3322  return function(t) {
3323  for (i = 0; i < n0; ++i) c[i] = x[i](t);
3324  return c;
3325  };
3326  };
3327  d3.interpolateObject = function(a, b) {
3328  var i = {}, c = {}, k;
3329  for (k in a) {
3330  if (k in b) {
3331  i[k] = d3_interpolateByName(k)(a[k], b[k]);
3332  } else {
3333  c[k] = a[k];
3334  }
3335  }
3336  for (k in b) {
3337  if (!(k in a)) {
3338  c[k] = b[k];
3339  }
3340  }
3341  return function(t) {
3342  for (k in i) c[k] = i[k](t);
3343  return c;
3344  };
3345  };
3346  var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
3347  d3.interpolators = [ d3.interpolateObject, function(a, b) {
3348  return b instanceof Array && d3.interpolateArray(a, b);
3349  }, function(a, b) {
3350  return (typeof a === "string" || typeof b === "string") && d3.interpolateString(a + "", b + "");
3351  }, function(a, b) {
3352  return (typeof b === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) : b instanceof d3_Color) && d3.interpolateRgb(a, b);
3353  }, function(a, b) {
3354  return !isNaN(a = +a) && !isNaN(b = +b) && d3.interpolateNumber(a, b);
3355  } ];
3356  d3_Color.prototype.toString = function() {
3357  return this.rgb() + "";
3358  };
3359  d3.rgb = function(r, g, b) {
3360  return arguments.length === 1 ? r instanceof d3_Rgb ? d3_rgb(r.r, r.g, r.b) : d3_rgb_parse("" + r, d3_rgb, d3_hsl_rgb) : d3_rgb(~~r, ~~g, ~~b);
3361  };
3362  var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color;
3363  d3_rgbPrototype.brighter = function(k) {
3364  k = Math.pow(.7, arguments.length ? k : 1);
3365  var r = this.r, g = this.g, b = this.b, i = 30;
3366  if (!r && !g && !b) return d3_rgb(i, i, i);
3367  if (r && r < i) r = i;
3368  if (g && g < i) g = i;
3369  if (b && b < i) b = i;
3370  return d3_rgb(Math.min(255, Math.floor(r / k)), Math.min(255, Math.floor(g / k)), Math.min(255, Math.floor(b / k)));
3371  };
3372  d3_rgbPrototype.darker = function(k) {
3373  k = Math.pow(.7, arguments.length ? k : 1);
3374  return d3_rgb(Math.floor(k * this.r), Math.floor(k * this.g), Math.floor(k * this.b));
3375  };
3376  d3_rgbPrototype.hsl = function() {
3377  return d3_rgb_hsl(this.r, this.g, this.b);
3378  };
3379  d3_rgbPrototype.toString = function() {
3380  return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
3381  };
3382  var d3_rgb_names = d3.map({
3383  aliceblue: "#f0f8ff",
3384  antiquewhite: "#faebd7",
3385  aqua: "#00ffff",
3386  aquamarine: "#7fffd4",
3387  azure: "#f0ffff",
3388  beige: "#f5f5dc",
3389  bisque: "#ffe4c4",
3390  black: "#000000",
3391  blanchedalmond: "#ffebcd",
3392  blue: "#0000ff",
3393  blueviolet: "#8a2be2",
3394  brown: "#a52a2a",
3395  burlywood: "#deb887",
3396  cadetblue: "#5f9ea0",
3397  chartreuse: "#7fff00",
3398  chocolate: "#d2691e",
3399  coral: "#ff7f50",
3400  cornflowerblue: "#6495ed",
3401  cornsilk: "#fff8dc",
3402  crimson: "#dc143c",
3403  cyan: "#00ffff",
3404  darkblue: "#00008b",
3405  darkcyan: "#008b8b",
3406  darkgoldenrod: "#b8860b",
3407  darkgray: "#a9a9a9",
3408  darkgreen: "#006400",
3409  darkgrey: "#a9a9a9",
3410  darkkhaki: "#bdb76b",
3411  darkmagenta: "#8b008b",
3412  darkolivegreen: "#556b2f",
3413  darkorange: "#ff8c00",
3414  darkorchid: "#9932cc",
3415  darkred: "#8b0000",
3416  darksalmon: "#e9967a",
3417  darkseagreen: "#8fbc8f",
3418  darkslateblue: "#483d8b",
3419  darkslategray: "#2f4f4f",
3420  darkslategrey: "#2f4f4f",
3421  darkturquoise: "#00ced1",
3422  darkviolet: "#9400d3",
3423  deeppink: "#ff1493",
3424  deepskyblue: "#00bfff",
3425  dimgray: "#696969",
3426  dimgrey: "#696969",
3427  dodgerblue: "#1e90ff",
3428  firebrick: "#b22222",
3429  floralwhite: "#fffaf0",
3430  forestgreen: "#228b22",
3431  fuchsia: "#ff00ff",
3432  gainsboro: "#dcdcdc",
3433  ghostwhite: "#f8f8ff",
3434  gold: "#ffd700",
3435  goldenrod: "#daa520",
3436  gray: "#808080",
3437  green: "#008000",
3438  greenyellow: "#adff2f",
3439  grey: "#808080",
3440  honeydew: "#f0fff0",
3441  hotpink: "#ff69b4",
3442  indianred: "#cd5c5c",
3443  indigo: "#4b0082",
3444  ivory: "#fffff0",
3445  khaki: "#f0e68c",
3446  lavender: "#e6e6fa",
3447  lavenderblush: "#fff0f5",
3448  lawngreen: "#7cfc00",
3449  lemonchiffon: "#fffacd",
3450  lightblue: "#add8e6",
3451  lightcoral: "#f08080",
3452  lightcyan: "#e0ffff",
3453  lightgoldenrodyellow: "#fafad2",
3454  lightgray: "#d3d3d3",
3455  lightgreen: "#90ee90",
3456  lightgrey: "#d3d3d3",
3457  lightpink: "#ffb6c1",
3458  lightsalmon: "#ffa07a",
3459  lightseagreen: "#20b2aa",
3460  lightskyblue: "#87cefa",
3461  lightslategray: "#778899",
3462  lightslategrey: "#778899",
3463  lightsteelblue: "#b0c4de",
3464  lightyellow: "#ffffe0",
3465  lime: "#00ff00",
3466  limegreen: "#32cd32",
3467  linen: "#faf0e6",
3468  magenta: "#ff00ff",
3469  maroon: "#800000",
3470  mediumaquamarine: "#66cdaa",
3471  mediumblue: "#0000cd",
3472  mediumorchid: "#ba55d3",
3473  mediumpurple: "#9370db",
3474  mediumseagreen: "#3cb371",
3475  mediumslateblue: "#7b68ee",
3476  mediumspringgreen: "#00fa9a",
3477  mediumturquoise: "#48d1cc",
3478  mediumvioletred: "#c71585",
3479  midnightblue: "#191970",
3480  mintcream: "#f5fffa",
3481  mistyrose: "#ffe4e1",
3482  moccasin: "#ffe4b5",
3483  navajowhite: "#ffdead",
3484  navy: "#000080",
3485  oldlace: "#fdf5e6",
3486  olive: "#808000",
3487  olivedrab: "#6b8e23",
3488  orange: "#ffa500",
3489  orangered: "#ff4500",
3490  orchid: "#da70d6",
3491  palegoldenrod: "#eee8aa",
3492  palegreen: "#98fb98",
3493  paleturquoise: "#afeeee",
3494  palevioletred: "#db7093",
3495  papayawhip: "#ffefd5",
3496  peachpuff: "#ffdab9",
3497  peru: "#cd853f",
3498  pink: "#ffc0cb",
3499  plum: "#dda0dd",
3500  powderblue: "#b0e0e6",
3501  purple: "#800080",
3502  red: "#ff0000",
3503  rosybrown: "#bc8f8f",
3504  royalblue: "#4169e1",
3505  saddlebrown: "#8b4513",
3506  salmon: "#fa8072",
3507  sandybrown: "#f4a460",
3508  seagreen: "#2e8b57",
3509  seashell: "#fff5ee",
3510  sienna: "#a0522d",
3511  silver: "#c0c0c0",
3512  skyblue: "#87ceeb",
3513  slateblue: "#6a5acd",
3514  slategray: "#708090",
3515  slategrey: "#708090",
3516  snow: "#fffafa",
3517  springgreen: "#00ff7f",
3518  steelblue: "#4682b4",
3519  tan: "#d2b48c",
3520  teal: "#008080",
3521  thistle: "#d8bfd8",
3522  tomato: "#ff6347",
3523  turquoise: "#40e0d0",
3524  violet: "#ee82ee",
3525  wheat: "#f5deb3",
3526  white: "#ffffff",
3527  whitesmoke: "#f5f5f5",
3528  yellow: "#ffff00",
3529  yellowgreen: "#9acd32"
3530  });
3531  d3_rgb_names.forEach(function(key, value) {
3532  d3_rgb_names.set(key, d3_rgb_parse(value, d3_rgb, d3_hsl_rgb));
3533  });
3534  d3.hsl = function(h, s, l) {
3535  return arguments.length === 1 ? h instanceof d3_Hsl ? d3_hsl(h.h, h.s, h.l) : d3_rgb_parse("" + h, d3_rgb_hsl, d3_hsl) : d3_hsl(+h, +s, +l);
3536  };
3537  var d3_hslPrototype = d3_Hsl.prototype = new d3_Color;
3538  d3_hslPrototype.brighter = function(k) {
3539  k = Math.pow(.7, arguments.length ? k : 1);
3540  return d3_hsl(this.h, this.s, this.l / k);
3541  };
3542  d3_hslPrototype.darker = function(k) {
3543  k = Math.pow(.7, arguments.length ? k : 1);
3544  return d3_hsl(this.h, this.s, k * this.l);
3545  };
3546  d3_hslPrototype.rgb = function() {
3547  return d3_hsl_rgb(this.h, this.s, this.l);
3548  };
3549  d3.hcl = function(h, c, l) {
3550  return arguments.length === 1 ? h instanceof d3_Hcl ? d3_hcl(h.h, h.c, h.l) : h instanceof d3_Lab ? d3_lab_hcl(h.l, h.a, h.b) : d3_lab_hcl((h = d3_rgb_lab((h = d3.rgb(h)).r, h.g, h.b)).l, h.a, h.b) : d3_hcl(+h, +c, +l);
3551  };
3552  var d3_hclPrototype = d3_Hcl.prototype = new d3_Color;
3553  d3_hclPrototype.brighter = function(k) {
3554  return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
3555  };
3556  d3_hclPrototype.darker = function(k) {
3557  return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
3558  };
3559  d3_hclPrototype.rgb = function() {
3560  return d3_hcl_lab(this.h, this.c, this.l).rgb();
3561  };
3562  d3.lab = function(l, a, b) {
3563  return arguments.length === 1 ? l instanceof d3_Lab ? d3_lab(l.l, l.a, l.b) : l instanceof d3_Hcl ? d3_hcl_lab(l.l, l.c, l.h) : d3_rgb_lab((l = d3.rgb(l)).r, l.g, l.b) : d3_lab(+l, +a, +b);
3564  };
3565  var d3_lab_K = 18;
3566  var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
3567  var d3_labPrototype = d3_Lab.prototype = new d3_Color;
3568  d3_labPrototype.brighter = function(k) {
3569  return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
3570  };
3571  d3_labPrototype.darker = function(k) {
3572  return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
3573  };
3574  d3_labPrototype.rgb = function() {
3575  return d3_lab_rgb(this.l, this.a, this.b);
3576  };
3577  var d3_select = function(s, n) {
3578  return n.querySelector(s);
3579  }, d3_selectAll = function(s, n) {
3580  return n.querySelectorAll(s);
3581  }, d3_selectRoot = document.documentElement, d3_selectMatcher = d3_selectRoot.matchesSelector || d3_selectRoot.webkitMatchesSelector || d3_selectRoot.mozMatchesSelector || d3_selectRoot.msMatchesSelector || d3_selectRoot.oMatchesSelector, d3_selectMatches = function(n, s) {
3582  return d3_selectMatcher.call(n, s);
3583  };
3584  if (typeof Sizzle === "function") {
3585  d3_select = function(s, n) {
3586  return Sizzle(s, n)[0] || null;
3587  };
3588  d3_selectAll = function(s, n) {
3589  return Sizzle.uniqueSort(Sizzle(s, n));
3590  };
3591  d3_selectMatches = Sizzle.matchesSelector;
3592  }
3593  var d3_selectionPrototype = [];
3594  d3.selection = function() {
3595  return d3_selectionRoot;
3596  };
3597  d3.selection.prototype = d3_selectionPrototype;
3598  d3_selectionPrototype.select = function(selector) {
3599  var subgroups = [], subgroup, subnode, group, node;
3600  if (typeof selector !== "function") selector = d3_selection_selector(selector);
3601  for (var j = -1, m = this.length; ++j < m; ) {
3602  subgroups.push(subgroup = []);
3603  subgroup.parentNode = (group = this[j]).parentNode;
3604  for (var i = -1, n = group.length; ++i < n; ) {
3605  if (node = group[i]) {
3606  subgroup.push(subnode = selector.call(node, node.__data__, i));
3607  if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
3608  } else {
3609  subgroup.push(null);
3610  }
3611  }
3612  }
3613  return d3_selection(subgroups);
3614  };
3615  d3_selectionPrototype.selectAll = function(selector) {
3616  var subgroups = [], subgroup, node;
3617  if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
3618  for (var j = -1, m = this.length; ++j < m; ) {
3619  for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3620  if (node = group[i]) {
3621  subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i)));
3622  subgroup.parentNode = node;
3623  }
3624  }
3625  }
3626  return d3_selection(subgroups);
3627  };
3628  d3_selectionPrototype.attr = function(name, value) {
3629  if (arguments.length < 2) {
3630  if (typeof name === "string") {
3631  var node = this.node();
3632  name = d3.ns.qualify(name);
3633  return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
3634  }
3635  for (value in name) this.each(d3_selection_attr(value, name[value]));
3636  return this;
3637  }
3638  return this.each(d3_selection_attr(name, value));
3639  };
3640  d3_selectionPrototype.classed = function(name, value) {
3641  if (arguments.length < 2) {
3642  if (typeof name === "string") {
3643  var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
3644  if (value = node.classList) {
3645  while (++i < n) if (!value.contains(name[i])) return false;
3646  } else {
3647  value = node.className;
3648  if (value.baseVal != null) value = value.baseVal;
3649  while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
3650  }
3651  return true;
3652  }
3653  for (value in name) this.each(d3_selection_classed(value, name[value]));
3654  return this;
3655  }
3656  return this.each(d3_selection_classed(name, value));
3657  };
3658  d3_selectionPrototype.style = function(name, value, priority) {
3659  var n = arguments.length;
3660  if (n < 3) {
3661  if (typeof name !== "string") {
3662  if (n < 2) value = "";
3663  for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
3664  return this;
3665  }
3666  if (n < 2) return window.getComputedStyle(this.node(), null).getPropertyValue(name);
3667  priority = "";
3668  }
3669  return this.each(d3_selection_style(name, value, priority));
3670  };
3671  d3_selectionPrototype.property = function(name, value) {
3672  if (arguments.length < 2) {
3673  if (typeof name === "string") return this.node()[name];
3674  for (value in name) this.each(d3_selection_property(value, name[value]));
3675  return this;
3676  }
3677  return this.each(d3_selection_property(name, value));
3678  };
3679  d3_selectionPrototype.text = function(value) {
3680  return arguments.length < 1 ? this.node().textContent : this.each(typeof value === "function" ? function() {
3681  var v = value.apply(this, arguments);
3682  this.textContent = v == null ? "" : v;
3683  } : value == null ? function() {
3684  this.textContent = "";
3685  } : function() {
3686  this.textContent = value;
3687  });
3688  };
3689  d3_selectionPrototype.html = function(value) {
3690  return arguments.length < 1 ? this.node().innerHTML : this.each(typeof value === "function" ? function() {
3691  var v = value.apply(this, arguments);
3692  this.innerHTML = v == null ? "" : v;
3693  } : value == null ? function() {
3694  this.innerHTML = "";
3695  } : function() {
3696  this.innerHTML = value;
3697  });
3698  };
3699  d3_selectionPrototype.append = function(name) {
3700  function append() {
3701  return this.appendChild(document.createElementNS(this.namespaceURI, name));
3702  }
3703  function appendNS() {
3704  return this.appendChild(document.createElementNS(name.space, name.local));
3705  }
3706  name = d3.ns.qualify(name);
3707  return this.select(name.local ? appendNS : append);
3708  };
3709  d3_selectionPrototype.insert = function(name, before) {
3710  function insert() {
3711  return this.insertBefore(document.createElementNS(this.namespaceURI, name), d3_select(before, this));
3712  }
3713  function insertNS() {
3714  return this.insertBefore(document.createElementNS(name.space, name.local), d3_select(before, this));
3715  }
3716  name = d3.ns.qualify(name);
3717  return this.select(name.local ? insertNS : insert);
3718  };
3719  d3_selectionPrototype.remove = function() {
3720  return this.each(function() {
3721  var parent = this.parentNode;
3722  if (parent) parent.removeChild(this);
3723  });
3724  };
3725  d3_selectionPrototype.data = function(value, key) {
3726  function bind(group, groupData) {
3727  var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData;
3728  if (key) {
3729  var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length;
3730  for (i = -1; ++i < n; ) {
3731  keyValue = key.call(node = group[i], node.__data__, i);
3732  if (nodeByKeyValue.has(keyValue)) {
3733  exitNodes[j++] = node;
3734  } else {
3735  nodeByKeyValue.set(keyValue, node);
3736  }
3737  keyValues.push(keyValue);
3738  }
3739  for (i = -1; ++i < m; ) {
3740  keyValue = key.call(groupData, nodeData = groupData[i], i);
3741  if (nodeByKeyValue.has(keyValue)) {
3742  updateNodes[i] = node = nodeByKeyValue.get(keyValue);
3743  node.__data__ = nodeData;
3744  enterNodes[i] = exitNodes[i] = null;
3745  } else {
3746  enterNodes[i] = d3_selection_dataNode(nodeData);
3747  updateNodes[i] = exitNodes[i] = null;
3748  }
3749  nodeByKeyValue.remove(keyValue);
3750  }
3751  for (i = -1; ++i < n; ) {
3752  if (nodeByKeyValue.has(keyValues[i])) {
3753  exitNodes[i] = group[i];
3754  }
3755  }
3756  } else {
3757  for (i = -1; ++i < n0; ) {
3758  node = group[i];
3759  nodeData = groupData[i];
3760  if (node) {
3761  node.__data__ = nodeData;
3762  updateNodes[i] = node;
3763  enterNodes[i] = exitNodes[i] = null;
3764  } else {
3765  enterNodes[i] = d3_selection_dataNode(nodeData);
3766  updateNodes[i] = exitNodes[i] = null;
3767  }
3768  }
3769  for (; i < m; ++i) {
3770  enterNodes[i] = d3_selection_dataNode(groupData[i]);
3771  updateNodes[i] = exitNodes[i] = null;
3772  }
3773  for (; i < n1; ++i) {
3774  exitNodes[i] = group[i];
3775  enterNodes[i] = updateNodes[i] = null;
3776  }
3777  }
3778  enterNodes.update = updateNodes;
3779  enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
3780  enter.push(enterNodes);
3781  update.push(updateNodes);
3782  exit.push(exitNodes);
3783  }
3784  var i = -1, n = this.length, group, node;
3785  if (!arguments.length) {
3786  value = new Array(n = (group = this[0]).length);
3787  while (++i < n) {
3788  if (node = group[i]) {
3789  value[i] = node.__data__;
3790  }
3791  }
3792  return value;
3793  }
3794  var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
3795  if (typeof value === "function") {
3796  while (++i < n) {
3797  bind(group = this[i], value.call(group, group.parentNode.__data__, i));
3798  }
3799  } else {
3800  while (++i < n) {
3801  bind(group = this[i], value);
3802  }
3803  }
3804  update.enter = function() {
3805  return enter;
3806  };
3807  update.exit = function() {
3808  return exit;
3809  };
3810  return update;
3811  };
3812  d3_selectionPrototype.datum = d3_selectionPrototype.map = function(value) {
3813  return arguments.length < 1 ? this.property("__data__") : this.property("__data__", value);
3814  };
3815  d3_selectionPrototype.filter = function(filter) {
3816  var subgroups = [], subgroup, group, node;
3817  if (typeof filter !== "function") filter = d3_selection_filter(filter);
3818  for (var j = 0, m = this.length; j < m; j++) {
3819  subgroups.push(subgroup = []);
3820  subgroup.parentNode = (group = this[j]).parentNode;
3821  for (var i = 0, n = group.length; i < n; i++) {
3822  if ((node = group[i]) && filter.call(node, node.__data__, i)) {
3823  subgroup.push(node);
3824  }
3825  }
3826  }
3827  return d3_selection(subgroups);
3828  };
3829  d3_selectionPrototype.order = function() {
3830  for (var j = -1, m = this.length; ++j < m; ) {
3831  for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
3832  if (node = group[i]) {
3833  if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
3834  next = node;
3835  }
3836  }
3837  }
3838  return this;
3839  };
3840  d3_selectionPrototype.sort = function(comparator) {
3841  comparator = d3_selection_sortComparator.apply(this, arguments);
3842  for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
3843  return this.order();
3844  };
3845  d3_selectionPrototype.on = function(type, listener, capture) {
3846  var n = arguments.length;
3847  if (n < 3) {
3848  if (typeof type !== "string") {
3849  if (n < 2) listener = false;
3850  for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
3851  return this;
3852  }
3853  if (n < 2) return (n = this.node()["__on" + type]) && n._;
3854  capture = false;
3855  }
3856  return this.each(d3_selection_on(type, listener, capture));
3857  };
3858  d3_selectionPrototype.each = function(callback) {
3859  return d3_selection_each(this, function(node, i, j) {
3860  callback.call(node, node.__data__, i, j);
3861  });
3862  };
3863  d3_selectionPrototype.call = function(callback) {
3864  callback.apply(this, (arguments[0] = this, arguments));
3865  return this;
3866  };
3867  d3_selectionPrototype.empty = function() {
3868  return !this.node();
3869  };
3870  d3_selectionPrototype.node = function(callback) {
3871  for (var j = 0, m = this.length; j < m; j++) {
3872  for (var group = this[j], i = 0, n = group.length; i < n; i++) {
3873  var node = group[i];
3874  if (node) return node;
3875  }
3876  }
3877  return null;
3878  };
3879  d3_selectionPrototype.transition = function() {
3880  var subgroups = [], subgroup, node;
3881  for (var j = -1, m = this.length; ++j < m; ) {
3882  subgroups.push(subgroup = []);
3883  for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3884  subgroup.push((node = group[i]) ? {
3885  node: node,
3886  delay: d3_transitionDelay,
3887  duration: d3_transitionDuration
3888  } : null);
3889  }
3890  }
3891  return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
3892  };
3893  var d3_selectionRoot = d3_selection([ [ document ] ]);
3894  d3_selectionRoot[0].parentNode = d3_selectRoot;
3895  d3.select = function(selector) {
3896  return typeof selector === "string" ? d3_selectionRoot.select(selector) : d3_selection([ [ selector ] ]);
3897  };
3898  d3.selectAll = function(selector) {
3899  return typeof selector === "string" ? d3_selectionRoot.selectAll(selector) : d3_selection([ d3_array(selector) ]);
3900  };
3901  var d3_selection_enterPrototype = [];
3902  d3.selection.enter = d3_selection_enter;
3903  d3.selection.enter.prototype = d3_selection_enterPrototype;
3904  d3_selection_enterPrototype.append = d3_selectionPrototype.append;
3905  d3_selection_enterPrototype.insert = d3_selectionPrototype.insert;
3906  d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
3907  d3_selection_enterPrototype.node = d3_selectionPrototype.node;
3908  d3_selection_enterPrototype.select = function(selector) {
3909  var subgroups = [], subgroup, subnode, upgroup, group, node;
3910  for (var j = -1, m = this.length; ++j < m; ) {
3911  upgroup = (group = this[j]).update;
3912  subgroups.push(subgroup = []);
3913  subgroup.parentNode = group.parentNode;
3914  for (var i = -1, n = group.length; ++i < n; ) {
3915  if (node = group[i]) {
3916  subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i));
3917  subnode.__data__ = node.__data__;
3918  } else {
3919  subgroup.push(null);
3920  }
3921  }
3922  }
3923  return d3_selection(subgroups);
3924  };
3925  var d3_transitionPrototype = [], d3_transitionNextId = 0, d3_transitionId = 0, d3_transitionDefaultDelay = 0, d3_transitionDefaultDuration = 250, d3_transitionDefaultEase = d3.ease("cubic-in-out"), d3_transitionDelay = d3_transitionDefaultDelay, d3_transitionDuration = d3_transitionDefaultDuration, d3_transitionEase = d3_transitionDefaultEase;
3926  d3_transitionPrototype.call = d3_selectionPrototype.call;
3927  d3.transition = function(selection) {
3928  return arguments.length ? d3_transitionId ? selection.transition() : selection : d3_selectionRoot.transition();
3929  };
3930  d3.transition.prototype = d3_transitionPrototype;
3931  d3_transitionPrototype.select = function(selector) {
3932  var subgroups = [], subgroup, subnode, node;
3933  if (typeof selector !== "function") selector = d3_selection_selector(selector);
3934  for (var j = -1, m = this.length; ++j < m; ) {
3935  subgroups.push(subgroup = []);
3936  for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3937  if ((node = group[i]) && (subnode = selector.call(node.node, node.node.__data__, i))) {
3938  if ("__data__" in node.node) subnode.__data__ = node.node.__data__;
3939  subgroup.push({
3940  node: subnode,
3941  delay: node.delay,
3942  duration: node.duration
3943  });
3944  } else {
3945  subgroup.push(null);
3946  }
3947  }
3948  }
3949  return d3_transition(subgroups, this.id, this.time).ease(this.ease());
3950  };
3951  d3_transitionPrototype.selectAll = function(selector) {
3952  var subgroups = [], subgroup, subnodes, node;
3953  if (typeof selector !== "function") selector = d3_selection_selectorAll(selector);
3954  for (var j = -1, m = this.length; ++j < m; ) {
3955  for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
3956  if (node = group[i]) {
3957  subnodes = selector.call(node.node, node.node.__data__, i);
3958  subgroups.push(subgroup = []);
3959  for (var k = -1, o = subnodes.length; ++k < o; ) {
3960  subgroup.push({
3961  node: subnodes[k],
3962  delay: node.delay,
3963  duration: node.duration
3964  });
3965  }
3966  }
3967  }
3968  }
3969  return d3_transition(subgroups, this.id, this.time).ease(this.ease());
3970  };
3971  d3_transitionPrototype.filter = function(filter) {
3972  var subgroups = [], subgroup, group, node;
3973  if (typeof filter !== "function") filter = d3_selection_filter(filter);
3974  for (var j = 0, m = this.length; j < m; j++) {
3975  subgroups.push(subgroup = []);
3976  for (var group = this[j], i = 0, n = group.length; i < n; i++) {
3977  if ((node = group[i]) && filter.call(node.node, node.node.__data__, i)) {
3978  subgroup.push(node);
3979  }
3980  }
3981  }
3982  return d3_transition(subgroups, this.id, this.time).ease(this.ease());
3983  };
3984  d3_transitionPrototype.attr = function(name, value) {
3985  if (arguments.length < 2) {
3986  for (value in name) this.attrTween(value, d3_tweenByName(name[value], value));
3987  return this;
3988  }
3989  return this.attrTween(name, d3_tweenByName(value, name));
3990  };
3991  d3_transitionPrototype.attrTween = function(nameNS, tween) {
3992  function attrTween(d, i) {
3993  var f = tween.call(this, d, i, this.getAttribute(name));
3994  return f === d3_tweenRemove ? (this.removeAttribute(name), null) : f && function(t) {
3995  this.setAttribute(name, f(t));
3996  };
3997  }
3998  function attrTweenNS(d, i) {
3999  var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
4000  return f === d3_tweenRemove ? (this.removeAttributeNS(name.space, name.local), null) : f && function(t) {
4001  this.setAttributeNS(name.space, name.local, f(t));
4002  };
4003  }
4004  var name = d3.ns.qualify(nameNS);
4005  return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
4006  };
4007  d3_transitionPrototype.style = function(name, value, priority) {
4008  var n = arguments.length;
4009  if (n < 3) {
4010  if (typeof name !== "string") {
4011  if (n < 2) value = "";
4012  for (priority in name) this.styleTween(priority, d3_tweenByName(name[priority], priority), value);
4013  return this;
4014  }
4015  priority = "";
4016  }
4017  return this.styleTween(name, d3_tweenByName(value, name), priority);
4018  };
4019  d3_transitionPrototype.styleTween = function(name, tween, priority) {
4020  if (arguments.length < 3) priority = "";
4021  return this.tween("style." + name, function(d, i) {
4022  var f = tween.call(this, d, i, window.getComputedStyle(this, null).getPropertyValue(name));
4023  return f === d3_tweenRemove ? (this.style.removeProperty(name), null) : f && function(t) {
4024  this.style.setProperty(name, f(t), priority);
4025  };
4026  });
4027  };
4028  d3_transitionPrototype.text = function(value) {
4029  return this.tween("text", function(d, i) {
4030  this.textContent = typeof value === "function" ? value.call(this, d, i) : value;
4031  });
4032  };
4033  d3_transitionPrototype.remove = function() {
4034  return this.each("end.transition", function() {
4035  var p;
4036  if (!this.__transition__ && (p = this.parentNode)) p.removeChild(this);
4037  });
4038  };
4039  d3_transitionPrototype.delay = function(value) {
4040  return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
4041  node.delay = value.call(node = node.node, node.__data__, i, j) | 0;
4042  } : (value = value | 0, function(node) {
4043  node.delay = value;
4044  }));
4045  };
4046  d3_transitionPrototype.duration = function(value) {
4047  return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
4048  node.duration = Math.max(1, value.call(node = node.node, node.__data__, i, j) | 0);
4049  } : (value = Math.max(1, value | 0), function(node) {
4050  node.duration = value;
4051  }));
4052  };
4053  d3_transitionPrototype.transition = function() {
4054  return this.select(d3_this);
4055  };
4056  d3.tween = function(b, interpolate) {
4057  function tweenFunction(d, i, a) {
4058  var v = b.call(this, d, i);
4059  return v == null ? a != "" && d3_tweenRemove : a != v && interpolate(a, v + "");
4060  }
4061  function tweenString(d, i, a) {
4062  return a != b && interpolate(a, b);
4063  }
4064  return typeof b === "function" ? tweenFunction : b == null ? d3_tweenNull : (b += "", tweenString);
4065  };
4066  var d3_tweenRemove = {};
4067  var d3_timer_id = 0, d3_timer_byId = {}, d3_timer_queue = null, d3_timer_interval, d3_timer_timeout;
4068  d3.timer = function(callback, delay, then) {
4069  if (arguments.length < 3) {
4070  if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
4071  then = Date.now();
4072  }
4073  var timer = d3_timer_byId[callback.id];
4074  if (timer && timer.callback === callback) {
4075  timer.then = then;
4076  timer.delay = delay;
4077  } else d3_timer_byId[callback.id = ++d3_timer_id] = d3_timer_queue = {
4078  callback: callback,
4079  then: then,
4080  delay: delay,
4081  next: d3_timer_queue
4082  };
4083  if (!d3_timer_interval) {
4084  d3_timer_timeout = clearTimeout(d3_timer_timeout);
4085  d3_timer_interval = 1;
4086  d3_timer_frame(d3_timer_step);
4087  }
4088  };
4089  d3.timer.flush = function() {
4090  var elapsed, now = Date.now(), t1 = d3_timer_queue;
4091  while (t1) {
4092  elapsed = now - t1.then;
4093  if (!t1.delay) t1.flush = t1.callback(elapsed);
4094  t1 = t1.next;
4095  }
4096  d3_timer_flush();
4097  };
4098  var d3_timer_frame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) {
4099  setTimeout(callback, 17);
4100  };
4101  d3.mouse = function(container) {
4102  return d3_mousePoint(container, d3_eventSource());
4103  };
4104  var d3_mouse_bug44083 = /WebKit/.test(navigator.userAgent) ? -1 : 0;
4105  d3.touches = function(container, touches) {
4106  if (arguments.length < 2) touches = d3_eventSource().touches;
4107  return touches ? d3_array(touches).map(function(touch) {
4108  var point = d3_mousePoint(container, touch);
4109  point.identifier = touch.identifier;
4110  return point;
4111  }) : [];
4112  };
4113  d3.scale = {};
4114  d3.scale.linear = function() {
4115  return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3.interpolate, false);
4116  };
4117  d3.scale.log = function() {
4118  return d3_scale_log(d3.scale.linear(), d3_scale_logp);
4119  };
4120  var d3_scale_logFormat = d3.format(".0e");
4121  d3_scale_logp.pow = function(x) {
4122  return Math.pow(10, x);
4123  };
4124  d3_scale_logn.pow = function(x) {
4125  return -Math.pow(10, -x);
4126  };
4127  d3.scale.pow = function() {
4128  return d3_scale_pow(d3.scale.linear(), 1);
4129  };
4130  d3.scale.sqrt = function() {
4131  return d3.scale.pow().exponent(.5);
4132  };
4133  d3.scale.ordinal = function() {
4134  return d3_scale_ordinal([], {
4135  t: "range",
4136  a: [ [] ]
4137  });
4138  };
4139  d3.scale.category10 = function() {
4140  return d3.scale.ordinal().range(d3_category10);
4141  };
4142  d3.scale.category20 = function() {
4143  return d3.scale.ordinal().range(d3_category20);
4144  };
4145  d3.scale.category20b = function() {
4146  return d3.scale.ordinal().range(d3_category20b);
4147  };
4148  d3.scale.category20c = function() {
4149  return d3.scale.ordinal().range(d3_category20c);
4150  };
4151  var d3_category10 = [ "#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf" ];
4152  var d3_category20 = [ "#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5" ];
4153  var d3_category20b = [ "#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6" ];
4154  var d3_category20c = [ "#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9" ];
4155  d3.scale.quantile = function() {
4156  return d3_scale_quantile([], []);
4157  };
4158  d3.scale.quantize = function() {
4159  return d3_scale_quantize(0, 1, [ 0, 1 ]);
4160  };
4161  d3.scale.threshold = function() {
4162  return d3_scale_threshold([ .5 ], [ 0, 1 ]);
4163  };
4164  d3.scale.identity = function() {
4165  return d3_scale_identity([ 0, 1 ]);
4166  };
4167  d3.svg = {};
4168  d3.svg.arc = function() {
4169  function arc() {
4170  var r0 = innerRadius.apply(this, arguments), r1 = outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) + d3_svg_arcOffset, a1 = endAngle.apply(this, arguments) + d3_svg_arcOffset, da = (a1 < a0 && (da = a0, a0 = a1, a1 = da), a1 - a0), df = da < Math.PI ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
4171  return da >= d3_svg_arcMax ? r0 ? "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "M0," + r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + -r0 + "A" + r0 + "," + r0 + " 0 1,0 0," + r0 + "Z" : "M0," + r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + -r1 + "A" + r1 + "," + r1 + " 0 1,1 0," + r1 + "Z" : r0 ? "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L" + r0 * c1 + "," + r0 * s1 + "A" + r0 + "," + r0 + " 0 " + df + ",0 " + r0 * c0 + "," + r0 * s0 + "Z" : "M" + r1 * c0 + "," + r1 * s0 + "A" + r1 + "," + r1 + " 0 " + df + ",1 " + r1 * c1 + "," + r1 * s1 + "L0,0" + "Z";
4172  }
4173  var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
4174  arc.innerRadius = function(v) {
4175  if (!arguments.length) return innerRadius;
4176  innerRadius = d3_functor(v);
4177  return arc;
4178  };
4179  arc.outerRadius = function(v) {
4180  if (!arguments.length) return outerRadius;
4181  outerRadius = d3_functor(v);
4182  return arc;
4183  };
4184  arc.startAngle = function(v) {
4185  if (!arguments.length) return startAngle;
4186  startAngle = d3_functor(v);
4187  return arc;
4188  };
4189  arc.endAngle = function(v) {
4190  if (!arguments.length) return endAngle;
4191  endAngle = d3_functor(v);
4192  return arc;
4193  };
4194  arc.centroid = function() {
4195  var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
4196  return [ Math.cos(a) * r, Math.sin(a) * r ];
4197  };
4198  return arc;
4199  };
4200  var d3_svg_arcOffset = -Math.PI / 2, d3_svg_arcMax = 2 * Math.PI - 1e-6;
4201  d3.svg.line = function() {
4202  return d3_svg_line(d3_identity);
4203  };
4204  var d3_svg_lineInterpolators = d3.map({
4205  linear: d3_svg_lineLinear,
4206  "linear-closed": d3_svg_lineLinearClosed,
4207  "step-before": d3_svg_lineStepBefore,
4208  "step-after": d3_svg_lineStepAfter,
4209  basis: d3_svg_lineBasis,
4210  "basis-open": d3_svg_lineBasisOpen,
4211  "basis-closed": d3_svg_lineBasisClosed,
4212  bundle: d3_svg_lineBundle,
4213  cardinal: d3_svg_lineCardinal,
4214  "cardinal-open": d3_svg_lineCardinalOpen,
4215  "cardinal-closed": d3_svg_lineCardinalClosed,
4216  monotone: d3_svg_lineMonotone
4217  });
4218  d3_svg_lineInterpolators.forEach(function(key, value) {
4219  value.key = key;
4220  value.closed = /-closed$/.test(key);
4221  });
4222  var d3_svg_lineBasisBezier1 = [ 0, 2 / 3, 1 / 3, 0 ], d3_svg_lineBasisBezier2 = [ 0, 1 / 3, 2 / 3, 0 ], d3_svg_lineBasisBezier3 = [ 0, 1 / 6, 2 / 3, 1 / 6 ];
4223  d3.svg.line.radial = function() {
4224  var line = d3_svg_line(d3_svg_lineRadial);
4225  line.radius = line.x, delete line.x;
4226  line.angle = line.y, delete line.y;
4227  return line;
4228  };
4229  d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
4230  d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
4231  d3.svg.area = function() {
4232  return d3_svg_area(d3_identity);
4233  };
4234  d3.svg.area.radial = function() {
4235  var area = d3_svg_area(d3_svg_lineRadial);
4236  area.radius = area.x, delete area.x;
4237  area.innerRadius = area.x0, delete area.x0;
4238  area.outerRadius = area.x1, delete area.x1;
4239  area.angle = area.y, delete area.y;
4240  area.startAngle = area.y0, delete area.y0;
4241  area.endAngle = area.y1, delete area.y1;
4242  return area;
4243  };
4244  d3.svg.chord = function() {
4245  function chord(d, i) {
4246  var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
4247  return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
4248  }
4249  function subgroup(self, f, d, i) {
4250  var subgroup = f.call(self, d, i), r = radius.call(self, subgroup, i), a0 = startAngle.call(self, subgroup, i) + d3_svg_arcOffset, a1 = endAngle.call(self, subgroup, i) + d3_svg_arcOffset;
4251  return {
4252  r: r,
4253  a0: a0,
4254  a1: a1,
4255  p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
4256  p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
4257  };
4258  }
4259  function equals(a, b) {
4260  return a.a0 == b.a0 && a.a1 == b.a1;
4261  }
4262  function arc(r, p, a) {
4263  return "A" + r + "," + r + " 0 " + +(a > Math.PI) + ",1 " + p;
4264  }
4265  function curve(r0, p0, r1, p1) {
4266  return "Q 0,0 " + p1;
4267  }
4268  var source = d3_svg_chordSource, target = d3_svg_chordTarget, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
4269  chord.radius = function(v) {
4270  if (!arguments.length) return radius;
4271  radius = d3_functor(v);
4272  return chord;
4273  };
4274  chord.source = function(v) {
4275  if (!arguments.length) return source;
4276  source = d3_functor(v);
4277  return chord;
4278  };
4279  chord.target = function(v) {
4280  if (!arguments.length) return target;
4281  target = d3_functor(v);
4282  return chord;
4283  };
4284  chord.startAngle = function(v) {
4285  if (!arguments.length) return startAngle;
4286  startAngle = d3_functor(v);
4287  return chord;
4288  };
4289  chord.endAngle = function(v) {
4290  if (!arguments.length) return endAngle;
4291  endAngle = d3_functor(v);
4292  return chord;
4293  };
4294  return chord;
4295  };
4296  d3.svg.diagonal = function() {
4297  function diagonal(d, i) {
4298  var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
4299  x: p0.x,
4300  y: m
4301  }, {
4302  x: p3.x,
4303  y: m
4304  }, p3 ];
4305  p = p.map(projection);
4306  return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
4307  }
4308  var source = d3_svg_chordSource, target = d3_svg_chordTarget, projection = d3_svg_diagonalProjection;
4309  diagonal.source = function(x) {
4310  if (!arguments.length) return source;
4311  source = d3_functor(x);
4312  return diagonal;
4313  };
4314  diagonal.target = function(x) {
4315  if (!arguments.length) return target;
4316  target = d3_functor(x);
4317  return diagonal;
4318  };
4319  diagonal.projection = function(x) {
4320  if (!arguments.length) return projection;
4321  projection = x;
4322  return diagonal;
4323  };
4324  return diagonal;
4325  };
4326  d3.svg.diagonal.radial = function() {
4327  var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
4328  diagonal.projection = function(x) {
4329  return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
4330  };
4331  return diagonal;
4332  };
4333  d3.svg.mouse = d3.mouse;
4334  d3.svg.touches = d3.touches;
4335  d3.svg.symbol = function() {
4336  function symbol(d, i) {
4337  return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
4338  }
4339  var type = d3_svg_symbolType, size = d3_svg_symbolSize;
4340  symbol.type = function(x) {
4341  if (!arguments.length) return type;
4342  type = d3_functor(x);
4343  return symbol;
4344  };
4345  symbol.size = function(x) {
4346  if (!arguments.length) return size;
4347  size = d3_functor(x);
4348  return symbol;
4349  };
4350  return symbol;
4351  };
4352  var d3_svg_symbols = d3.map({
4353  circle: d3_svg_symbolCircle,
4354  cross: function(size) {
4355  var r = Math.sqrt(size / 5) / 2;
4356  return "M" + -3 * r + "," + -r + "H" + -r + "V" + -3 * r + "H" + r + "V" + -r + "H" + 3 * r + "V" + r + "H" + r + "V" + 3 * r + "H" + -r + "V" + r + "H" + -3 * r + "Z";
4357  },
4358  diamond: function(size) {
4359  var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
4360  return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
4361  },
4362  square: function(size) {
4363  var r = Math.sqrt(size) / 2;
4364  return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
4365  },
4366  "triangle-down": function(size) {
4367  var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
4368  return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
4369  },
4370  "triangle-up": function(size) {
4371  var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
4372  return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
4373  }
4374  });
4375  d3.svg.symbolTypes = d3_svg_symbols.keys();
4376  var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * Math.PI / 180);
4377  d3.svg.axis = function() {
4378  function axis(g) {
4379  g.each(function() {
4380  var g = d3.select(this);
4381  var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
4382  var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
4383  var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
4384  var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathEnter = path.enter().append("path").attr("class", "domain"), pathUpdate = d3.transition(path);
4385  var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
4386  this.__chart__ = scale1;
4387  tickEnter.append("line").attr("class", "tick");
4388  tickEnter.append("text");
4389  var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
4390  switch (orient) {
4391  case "bottom":
4392  {
4393  tickTransform = d3_svg_axisX;
4394  subtickEnter.attr("y2", tickMinorSize);
4395  subtickUpdate.attr("x2", 0).attr("y2", tickMinorSize);
4396  lineEnter.attr("y2", tickMajorSize);
4397  textEnter.attr("y", Math.max(tickMajorSize, 0) + tickPadding);
4398  lineUpdate.attr("x2", 0).attr("y2", tickMajorSize);
4399  textUpdate.attr("x", 0).attr("y", Math.max(tickMajorSize, 0) + tickPadding);
4400  text.attr("dy", ".71em").attr("text-anchor", "middle");
4401  pathUpdate.attr("d", "M" + range[0] + "," + tickEndSize + "V0H" + range[1] + "V" + tickEndSize);
4402  break;
4403  }
4404  case "top":
4405  {
4406  tickTransform = d3_svg_axisX;
4407  subtickEnter.attr("y2", -tickMinorSize);
4408  subtickUpdate.attr("x2", 0).attr("y2", -tickMinorSize);
4409  lineEnter.attr("y2", -tickMajorSize);
4410  textEnter.attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
4411  lineUpdate.attr("x2", 0).attr("y2", -tickMajorSize);
4412  textUpdate.attr("x", 0).attr("y", -(Math.max(tickMajorSize, 0) + tickPadding));
4413  text.attr("dy", "0em").attr("text-anchor", "middle");
4414  pathUpdate.attr("d", "M" + range[0] + "," + -tickEndSize + "V0H" + range[1] + "V" + -tickEndSize);
4415  break;
4416  }
4417  case "left":
4418  {
4419  tickTransform = d3_svg_axisY;
4420  subtickEnter.attr("x2", -tickMinorSize);
4421  subtickUpdate.attr("x2", -tickMinorSize).attr("y2", 0);
4422  lineEnter.attr("x2", -tickMajorSize);
4423  textEnter.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding));
4424  lineUpdate.attr("x2", -tickMajorSize).attr("y2", 0);
4425  textUpdate.attr("x", -(Math.max(tickMajorSize, 0) + tickPadding)).attr("y", 0);
4426  text.attr("dy", ".32em").attr("text-anchor", "end");
4427  pathUpdate.attr("d", "M" + -tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + -tickEndSize);
4428  break;
4429  }
4430  case "right":
4431  {
4432  tickTransform = d3_svg_axisY;
4433  subtickEnter.attr("x2", tickMinorSize);
4434  subtickUpdate.attr("x2", tickMinorSize).attr("y2", 0);
4435  lineEnter.attr("x2", tickMajorSize);
4436  textEnter.attr("x", Math.max(tickMajorSize, 0) + tickPadding);
4437  lineUpdate.attr("x2", tickMajorSize).attr("y2", 0);
4438  textUpdate.attr("x", Math.max(tickMajorSize, 0) + tickPadding).attr("y", 0);
4439  text.attr("dy", ".32em").attr("text-anchor", "start");
4440  pathUpdate.attr("d", "M" + tickEndSize + "," + range[0] + "H0V" + range[1] + "H" + tickEndSize);
4441  break;
4442  }
4443  }
4444  if (scale.ticks) {
4445  tickEnter.call(tickTransform, scale0);
4446  tickUpdate.call(tickTransform, scale1);
4447  tickExit.call(tickTransform, scale1);
4448  subtickEnter.call(tickTransform, scale0);
4449  subtickUpdate.call(tickTransform, scale1);
4450  subtickExit.call(tickTransform, scale1);
4451  } else {
4452  var dx = scale1.rangeBand() / 2, x = function(d) {
4453  return scale1(d) + dx;
4454  };
4455  tickEnter.call(tickTransform, x);
4456  tickUpdate.call(tickTransform, x);
4457  }
4458  });
4459  }
4460  var scale = d3.scale.linear(), orient = "bottom", tickMajorSize = 6, tickMinorSize = 6, tickEndSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_, tickSubdivide = 0;
4461  axis.scale = function(x) {
4462  if (!arguments.length) return scale;
4463  scale = x;
4464  return axis;
4465  };
4466  axis.orient = function(x) {
4467  if (!arguments.length) return orient;
4468  orient = x;
4469  return axis;
4470  };
4471  axis.ticks = function() {
4472  if (!arguments.length) return tickArguments_;
4473  tickArguments_ = arguments;
4474  return axis;
4475  };
4476  axis.tickValues = function(x) {
4477  if (!arguments.length) return tickValues;
4478  tickValues = x;
4479  return axis;
4480  };
4481  axis.tickFormat = function(x) {
4482  if (!arguments.length) return tickFormat_;
4483  tickFormat_ = x;
4484  return axis;
4485  };
4486  axis.tickSize = function(x, y, z) {
4487  if (!arguments.length) return tickMajorSize;
4488  var n = arguments.length - 1;
4489  tickMajorSize = +x;
4490  tickMinorSize = n > 1 ? +y : tickMajorSize;
4491  tickEndSize = n > 0 ? +arguments[n] : tickMajorSize;
4492  return axis;
4493  };
4494  axis.tickPadding = function(x) {
4495  if (!arguments.length) return tickPadding;
4496  tickPadding = +x;
4497  return axis;
4498  };
4499  axis.tickSubdivide = function(x) {
4500  if (!arguments.length) return tickSubdivide;
4501  tickSubdivide = +x;
4502  return axis;
4503  };
4504  return axis;
4505  };
4506  d3.svg.brush = function() {
4507  function brush(g) {
4508  g.each(function() {
4509  var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
4510  g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
4511  bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
4512  fg.enter().append("rect").attr("class", "extent").style("cursor", "move");
4513  tz.enter().append("g").attr("class", function(d) {
4514  return "resize " + d;
4515  }).style("cursor", function(d) {
4516  return d3_svg_brushCursor[d];
4517  }).append("rect").attr("x", function(d) {
4518  return /[ew]$/.test(d) ? -3 : null;
4519  }).attr("y", function(d) {
4520  return /^[ns]/.test(d) ? -3 : null;
4521  }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
4522  tz.style("display", brush.empty() ? "none" : null);
4523  tz.exit().remove();
4524  if (x) {
4525  e = d3_scaleRange(x);
4526  bg.attr("x", e[0]).attr("width", e[1] - e[0]);
4527  redrawX(g);
4528  }
4529  if (y) {
4530  e = d3_scaleRange(y);
4531  bg.attr("y", e[0]).attr("height", e[1] - e[0]);
4532  redrawY(g);
4533  }
4534  redraw(g);
4535  });
4536  }
4537  function redraw(g) {
4538  g.selectAll(".resize").attr("transform", function(d) {
4539  return "translate(" + extent[+/e$/.test(d)][0] + "," + extent[+/^s/.test(d)][1] + ")";
4540  });
4541  }
4542  function redrawX(g) {
4543  g.select(".extent").attr("x", extent[0][0]);
4544  g.selectAll(".extent,.n>rect,.s>rect").attr("width", extent[1][0] - extent[0][0]);
4545  }
4546  function redrawY(g) {
4547  g.select(".extent").attr("y", extent[0][1]);
4548  g.selectAll(".extent,.e>rect,.w>rect").attr("height", extent[1][1] - extent[0][1]);
4549  }
4550  function brushstart() {
4551  function mouse() {
4552  var touches = d3.event.changedTouches;
4553  return touches ? d3.touches(target, touches)[0] : d3.mouse(target);
4554  }
4555  function keydown() {
4556  if (d3.event.keyCode == 32) {
4557  if (!dragging) {
4558  center = null;
4559  origin[0] -= extent[1][0];
4560  origin[1] -= extent[1][1];
4561  dragging = 2;
4562  }
4563  d3_eventCancel();
4564  }
4565  }
4566  function keyup() {
4567  if (d3.event.keyCode == 32 && dragging == 2) {
4568  origin[0] += extent[1][0];
4569  origin[1] += extent[1][1];
4570  dragging = 0;
4571  d3_eventCancel();
4572  }
4573  }
4574  function brushmove() {
4575  var point = mouse(), moved = false;
4576  if (offset) {
4577  point[0] += offset[0];
4578  point[1] += offset[1];
4579  }
4580  if (!dragging) {
4581  if (d3.event.altKey) {
4582  if (!center) center = [ (extent[0][0] + extent[1][0]) / 2, (extent[0][1] + extent[1][1]) / 2 ];
4583  origin[0] = extent[+(point[0] < center[0])][0];
4584  origin[1] = extent[+(point[1] < center[1])][1];
4585  } else center = null;
4586  }
4587  if (resizingX && move1(point, x, 0)) {
4588  redrawX(g);
4589  moved = true;
4590  }
4591  if (resizingY && move1(point, y, 1)) {
4592  redrawY(g);
4593  moved = true;
4594  }
4595  if (moved) {
4596  redraw(g);
4597  event_({
4598  type: "brush",
4599  mode: dragging ? "move" : "resize"
4600  });
4601  }
4602  }
4603  function move1(point, scale, i) {
4604  var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], size = extent[1][i] - extent[0][i], min, max;
4605  if (dragging) {
4606  r0 -= position;
4607  r1 -= size + position;
4608  }
4609  min = Math.max(r0, Math.min(r1, point[i]));
4610  if (dragging) {
4611  max = (min += position) + size;
4612  } else {
4613  if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
4614  if (position < min) {
4615  max = min;
4616  min = position;
4617  } else {
4618  max = position;
4619  }
4620  }
4621  if (extent[0][i] !== min || extent[1][i] !== max) {
4622  extentDomain = null;
4623  extent[0][i] = min;
4624  extent[1][i] = max;
4625  return true;
4626  }
4627  }
4628  function brushend() {
4629  brushmove();
4630  g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
4631  d3.select("body").style("cursor", null);
4632  w.on("mousemove.brush", null).on("mouseup.brush", null).on("touchmove.brush", null).on("touchend.brush", null).on("keydown.brush", null).on("keyup.brush", null);
4633  event_({
4634  type: "brushend"
4635  });
4636  d3_eventCancel();
4637  }
4638  var target = this, eventTarget = d3.select(d3.event.target), event_ = event.of(target, arguments), g = d3.select(target), resizing = eventTarget.datum(), resizingX = !/^(n|s)$/.test(resizing) && x, resizingY = !/^(e|w)$/.test(resizing) && y, dragging = eventTarget.classed("extent"), center, origin = mouse(), offset;
4639  var w = d3.select(window).on("mousemove.brush", brushmove).on("mouseup.brush", brushend).on("touchmove.brush", brushmove).on("touchend.brush", brushend).on("keydown.brush", keydown).on("keyup.brush", keyup);
4640  if (dragging) {
4641  origin[0] = extent[0][0] - origin[0];
4642  origin[1] = extent[0][1] - origin[1];
4643  } else if (resizing) {
4644  var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
4645  offset = [ extent[1 - ex][0] - origin[0], extent[1 - ey][1] - origin[1] ];
4646  origin[0] = extent[ex][0];
4647  origin[1] = extent[ey][1];
4648  } else if (d3.event.altKey) center = origin.slice();
4649  g.style("pointer-events", "none").selectAll(".resize").style("display", null);
4650  d3.select("body").style("cursor", eventTarget.style("cursor"));
4651  event_({
4652  type: "brushstart"
4653  });
4654  brushmove();
4655  d3_eventCancel();
4656  }
4657  var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
4658  brush.x = function(z) {
4659  if (!arguments.length) return x;
4660  x = z;
4661  resizes = d3_svg_brushResizes[!x << 1 | !y];
4662  return brush;
4663  };
4664  brush.y = function(z) {
4665  if (!arguments.length) return y;
4666  y = z;
4667  resizes = d3_svg_brushResizes[!x << 1 | !y];
4668  return brush;
4669  };
4670  brush.extent = function(z) {
4671  var x0, x1, y0, y1, t;
4672  if (!arguments.length) {
4673  z = extentDomain || extent;
4674  if (x) {
4675  x0 = z[0][0], x1 = z[1][0];
4676  if (!extentDomain) {
4677  x0 = extent[0][0], x1 = extent[1][0];
4678  if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
4679  if (x1 < x0) t = x0, x0 = x1, x1 = t;
4680  }
4681  }
4682  if (y) {
4683  y0 = z[0][1], y1 = z[1][1];
4684  if (!extentDomain) {
4685  y0 = extent[0][1], y1 = extent[1][1];
4686  if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
4687  if (y1 < y0) t = y0, y0 = y1, y1 = t;
4688  }
4689  }
4690  return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
4691  }
4692  extentDomain = [ [ 0, 0 ], [ 0, 0 ] ];
4693  if (x) {
4694  x0 = z[0], x1 = z[1];
4695  if (y) x0 = x0[0], x1 = x1[0];
4696  extentDomain[0][0] = x0, extentDomain[1][0] = x1;
4697  if (x.invert) x0 = x(x0), x1 = x(x1);
4698  if (x1 < x0) t = x0, x0 = x1, x1 = t;
4699  extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
4700  }
4701  if (y) {
4702  y0 = z[0], y1 = z[1];
4703  if (x) y0 = y0[1], y1 = y1[1];
4704  extentDomain[0][1] = y0, extentDomain[1][1] = y1;
4705  if (y.invert) y0 = y(y0), y1 = y(y1);
4706  if (y1 < y0) t = y0, y0 = y1, y1 = t;
4707  extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
4708  }
4709  return brush;
4710  };
4711  brush.clear = function() {
4712  extentDomain = null;
4713  extent[0][0] = extent[0][1] = extent[1][0] = extent[1][1] = 0;
4714  return brush;
4715  };
4716  brush.empty = function() {
4717  return x && extent[0][0] === extent[1][0] || y && extent[0][1] === extent[1][1];
4718  };
4719  return d3.rebind(brush, event, "on");
4720  };
4721  var d3_svg_brushCursor = {
4722  n: "ns-resize",
4723  e: "ew-resize",
4724  s: "ns-resize",
4725  w: "ew-resize",
4726  nw: "nwse-resize",
4727  ne: "nesw-resize",
4728  se: "nwse-resize",
4729  sw: "nesw-resize"
4730  };
4731  var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
4732  d3.behavior = {};
4733  d3.behavior.drag = function() {
4734  function drag() {
4735  this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
4736  }
4737  function mousedown() {
4738  function point() {
4739  var p = target.parentNode;
4740  return touchId ? d3.touches(p).filter(function(p) {
4741  return p.identifier === touchId;
4742  })[0] : d3.mouse(p);
4743  }
4744  function dragmove() {
4745  if (!target.parentNode) return dragend();
4746  var p = point(), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
4747  moved |= dx | dy;
4748  origin_ = p;
4749  d3_eventCancel();
4750  event_({
4751  type: "drag",
4752  x: p[0] + offset[0],
4753  y: p[1] + offset[1],
4754  dx: dx,
4755  dy: dy
4756  });
4757  }
4758  function dragend() {
4759  event_({
4760  type: "dragend"
4761  });
4762  if (moved) {
4763  d3_eventCancel();
4764  if (d3.event.target === eventTarget) w.on("click.drag", click, true);
4765  }
4766  w.on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", null).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", null);
4767  }
4768  function click() {
4769  d3_eventCancel();
4770  w.on("click.drag", null);
4771  }
4772  var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, touchId = d3.event.touches && d3.event.changedTouches[0].identifier, offset, origin_ = point(), moved = 0;
4773  var w = d3.select(window).on(touchId ? "touchmove.drag-" + touchId : "mousemove.drag", dragmove).on(touchId ? "touchend.drag-" + touchId : "mouseup.drag", dragend, true);
4774  if (origin) {
4775  offset = origin.apply(target, arguments);
4776  offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
4777  } else {
4778  offset = [ 0, 0 ];
4779  }
4780  if (!touchId) d3_eventCancel();
4781  event_({
4782  type: "dragstart"
4783  });
4784  }
4785  var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null;
4786  drag.origin = function(x) {
4787  if (!arguments.length) return origin;
4788  origin = x;
4789  return drag;
4790  };
4791  return d3.rebind(drag, event, "on");
4792  };
4793  d3.behavior.zoom = function() {
4794  function zoom() {
4795  this.on("mousedown.zoom", mousedown).on("mousewheel.zoom", mousewheel).on("mousemove.zoom", mousemove).on("DOMMouseScroll.zoom", mousewheel).on("dblclick.zoom", dblclick).on("touchstart.zoom", touchstart).on("touchmove.zoom", touchmove).on("touchend.zoom", touchstart);
4796  }
4797  function location(p) {
4798  return [ (p[0] - translate[0]) / scale, (p[1] - translate[1]) / scale ];
4799  }
4800  function point(l) {
4801  return [ l[0] * scale + translate[0], l[1] * scale + translate[1] ];
4802  }
4803  function scaleTo(s) {
4804  scale = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
4805  }
4806  function translateTo(p, l) {
4807  l = point(l);
4808  translate[0] += p[0] - l[0];
4809  translate[1] += p[1] - l[1];
4810  }
4811  function dispatch(event) {
4812  if (x1) x1.domain(x0.range().map(function(x) {
4813  return (x - translate[0]) / scale;
4814  }).map(x0.invert));
4815  if (y1) y1.domain(y0.range().map(function(y) {
4816  return (y - translate[1]) / scale;
4817  }).map(y0.invert));
4818  d3.event.preventDefault();
4819  event({
4820  type: "zoom",
4821  scale: scale,
4822  translate: translate
4823  });
4824  }
4825  function mousedown() {
4826  function mousemove() {
4827  moved = 1;
4828  translateTo(d3.mouse(target), l);
4829  dispatch(event_);
4830  }
4831  function mouseup() {
4832  if (moved) d3_eventCancel();
4833  w.on("mousemove.zoom", null).on("mouseup.zoom", null);
4834  if (moved && d3.event.target === eventTarget) w.on("click.zoom", click, true);
4835  }
4836  function click() {
4837  d3_eventCancel();
4838  w.on("click.zoom", null);
4839  }
4840  var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, moved = 0, w = d3.select(window).on("mousemove.zoom", mousemove).on("mouseup.zoom", mouseup), l = location(d3.mouse(target));
4841  window.focus();
4842  d3_eventCancel();
4843  }
4844  function mousewheel() {
4845  if (!translate0) translate0 = location(d3.mouse(this));
4846  scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * scale);
4847  translateTo(d3.mouse(this), translate0);
4848  dispatch(event.of(this, arguments));
4849  }
4850  function mousemove() {
4851  translate0 = null;
4852  }
4853  function dblclick() {
4854  var p = d3.mouse(this), l = location(p);
4855  scaleTo(d3.event.shiftKey ? scale / 2 : scale * 2);
4856  translateTo(p, l);
4857  dispatch(event.of(this, arguments));
4858  }
4859  function touchstart() {
4860  var touches = d3.touches(this), now = Date.now();
4861  scale0 = scale;
4862  translate0 = {};
4863  touches.forEach(function(t) {
4864  translate0[t.identifier] = location(t);
4865  });
4866  d3_eventCancel();
4867  if (touches.length === 1) {
4868  if (now - touchtime < 500) {
4869  var p = touches[0], l = location(touches[0]);
4870  scaleTo(scale * 2);
4871  translateTo(p, l);
4872  dispatch(event.of(this, arguments));
4873  }
4874  touchtime = now;
4875  }
4876  }
4877  function touchmove() {
4878  var touches = d3.touches(this), p0 = touches[0], l0 = translate0[p0.identifier];
4879  if (p1 = touches[1]) {
4880  var p1, l1 = translate0[p1.identifier];
4881  p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
4882  l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
4883  scaleTo(d3.event.scale * scale0);
4884  }
4885  translateTo(p0, l0);
4886  touchtime = null;
4887  dispatch(event.of(this, arguments));
4888  }
4889  var translate = [ 0, 0 ], translate0, scale = 1, scale0, scaleExtent = d3_behavior_zoomInfinity, event = d3_eventDispatch(zoom, "zoom"), x0, x1, y0, y1, touchtime;
4890  zoom.translate = function(x) {
4891  if (!arguments.length) return translate;
4892  translate = x.map(Number);
4893  return zoom;
4894  };
4895  zoom.scale = function(x) {
4896  if (!arguments.length) return scale;
4897  scale = +x;
4898  return zoom;
4899  };
4900  zoom.scaleExtent = function(x) {
4901  if (!arguments.length) return scaleExtent;
4902  scaleExtent = x == null ? d3_behavior_zoomInfinity : x.map(Number);
4903  return zoom;
4904  };
4905  zoom.x = function(z) {
4906  if (!arguments.length) return x1;
4907  x1 = z;
4908  x0 = z.copy();
4909  return zoom;
4910  };
4911  zoom.y = function(z) {
4912  if (!arguments.length) return y1;
4913  y1 = z;
4914  y0 = z.copy();
4915  return zoom;
4916  };
4917  return d3.rebind(zoom, event, "on");
4918  };
4919  var d3_behavior_zoomDiv, d3_behavior_zoomInfinity = [ 0, Infinity ];
4920  d3.layout = {};
4921  d3.layout.bundle = function() {
4922  return function(links) {
4923  var paths = [], i = -1, n = links.length;
4924  while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
4925  return paths;
4926  };
4927  };
4928  d3.layout.chord = function() {
4929  function relayout() {
4930  var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
4931  chords = [];
4932  groups = [];
4933  k = 0, i = -1;
4934  while (++i < n) {
4935  x = 0, j = -1;
4936  while (++j < n) {
4937  x += matrix[i][j];
4938  }
4939  groupSums.push(x);
4940  subgroupIndex.push(d3.range(n));
4941  k += x;
4942  }
4943  if (sortGroups) {
4944  groupIndex.sort(function(a, b) {
4945  return sortGroups(groupSums[a], groupSums[b]);
4946  });
4947  }
4948  if (sortSubgroups) {
4949  subgroupIndex.forEach(function(d, i) {
4950  d.sort(function(a, b) {
4951  return sortSubgroups(matrix[i][a], matrix[i][b]);
4952  });
4953  });
4954  }
4955  k = (2 * Math.PI - padding * n) / k;
4956  x = 0, i = -1;
4957  while (++i < n) {
4958  x0 = x, j = -1;
4959  while (++j < n) {
4960  var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
4961  subgroups[di + "-" + dj] = {
4962  index: di,
4963  subindex: dj,
4964  startAngle: a0,
4965  endAngle: a1,
4966  value: v
4967  };
4968  }
4969  groups[di] = {
4970  index: di,
4971  startAngle: x0,
4972  endAngle: x,
4973  value: (x - x0) / k
4974  };
4975  x += padding;
4976  }
4977  i = -1;
4978  while (++i < n) {
4979  j = i - 1;
4980  while (++j < n) {
4981  var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
4982  if (source.value || target.value) {
4983  chords.push(source.value < target.value ? {
4984  source: target,
4985  target: source
4986  } : {
4987  source: source,
4988  target: target
4989  });
4990  }
4991  }
4992  }
4993  if (sortChords) resort();
4994  }
4995  function resort() {
4996  chords.sort(function(a, b) {
4997  return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
4998  });
4999  }
5000  var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
5001  chord.matrix = function(x) {
5002  if (!arguments.length) return matrix;
5003  n = (matrix = x) && matrix.length;
5004  chords = groups = null;
5005  return chord;
5006  };
5007  chord.padding = function(x) {
5008  if (!arguments.length) return padding;
5009  padding = x;
5010  chords = groups = null;
5011  return chord;
5012  };
5013  chord.sortGroups = function(x) {
5014  if (!arguments.length) return sortGroups;
5015  sortGroups = x;
5016  chords = groups = null;
5017  return chord;
5018  };
5019  chord.sortSubgroups = function(x) {
5020  if (!arguments.length) return sortSubgroups;
5021  sortSubgroups = x;
5022  chords = null;
5023  return chord;
5024  };
5025  chord.sortChords = function(x) {
5026  if (!arguments.length) return sortChords;
5027  sortChords = x;
5028  if (chords) resort();
5029  return chord;
5030  };
5031  chord.chords = function() {
5032  if (!chords) relayout();
5033  return chords;
5034  };
5035  chord.groups = function() {
5036  if (!groups) relayout();
5037  return groups;
5038  };
5039  return chord;
5040  };
5041  d3.layout.force = function() {
5042  function repulse(node) {
5043  return function(quad, x1, y1, x2, y2) {
5044  if (quad.point !== node) {
5045  var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
5046  if ((x2 - x1) * dn < theta) {
5047  var k = quad.charge * dn * dn;
5048  node.px -= dx * k;
5049  node.py -= dy * k;
5050  return true;
5051  }
5052  if (quad.point && isFinite(dn)) {
5053  var k = quad.pointCharge * dn * dn;
5054  node.px -= dx * k;
5055  node.py -= dy * k;
5056  }
5057  }
5058  return !quad.charge;
5059  };
5060  }
5061  function dragmove(d) {
5062  d.px = d3.event.x;
5063  d.py = d3.event.y;
5064  force.resume();
5065  }
5066  var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, interval, nodes = [], links = [], distances, strengths, charges;
5067  force.tick = function() {
5068  if ((alpha *= .99) < .005) {
5069  event.end({
5070  type: "end",
5071  alpha: alpha = 0
5072  });
5073  return true;
5074  }
5075  var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
5076  for (i = 0; i < m; ++i) {
5077  o = links[i];
5078  s = o.source;
5079  t = o.target;
5080  x = t.x - s.x;
5081  y = t.y - s.y;
5082  if (l = x * x + y * y) {
5083  l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
5084  x *= l;
5085  y *= l;
5086  t.x -= x * (k = s.weight / (t.weight + s.weight));
5087  t.y -= y * k;
5088  s.x += x * (k = 1 - k);
5089  s.y += y * k;
5090  }
5091  }
5092  if (k = alpha * gravity) {
5093  x = size[0] / 2;
5094  y = size[1] / 2;
5095  i = -1;
5096  if (k) while (++i < n) {
5097  o = nodes[i];
5098  o.x += (x - o.x) * k;
5099  o.y += (y - o.y) * k;
5100  }
5101  }
5102  if (charge) {
5103  d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
5104  i = -1;
5105  while (++i < n) {
5106  if (!(o = nodes[i]).fixed) {
5107  q.visit(repulse(o));
5108  }
5109  }
5110  }
5111  i = -1;
5112  while (++i < n) {
5113  o = nodes[i];
5114  if (o.fixed) {
5115  o.x = o.px;
5116  o.y = o.py;
5117  } else {
5118  o.x -= (o.px - (o.px = o.x)) * friction;
5119  o.y -= (o.py - (o.py = o.y)) * friction;
5120  }
5121  }
5122  event.tick({
5123  type: "tick",
5124  alpha: alpha
5125  });
5126  };
5127  force.nodes = function(x) {
5128  if (!arguments.length) return nodes;
5129  nodes = x;
5130  return force;
5131  };
5132  force.links = function(x) {
5133  if (!arguments.length) return links;
5134  links = x;
5135  return force;
5136  };
5137  force.size = function(x) {
5138  if (!arguments.length) return size;
5139  size = x;
5140  return force;
5141  };
5142  force.linkDistance = function(x) {
5143  if (!arguments.length) return linkDistance;
5144  linkDistance = d3_functor(x);
5145  return force;
5146  };
5147  force.distance = force.linkDistance;
5148  force.linkStrength = function(x) {
5149  if (!arguments.length) return linkStrength;
5150  linkStrength = d3_functor(x);
5151  return force;
5152  };
5153  force.friction = function(x) {
5154  if (!arguments.length) return friction;
5155  friction = x;
5156  return force;
5157  };
5158  force.charge = function(x) {
5159  if (!arguments.length) return charge;
5160  charge = typeof x === "function" ? x : +x;
5161  return force;
5162  };
5163  force.gravity = function(x) {
5164  if (!arguments.length) return gravity;
5165  gravity = x;
5166  return force;
5167  };
5168  force.theta = function(x) {
5169  if (!arguments.length) return theta;
5170  theta = x;
5171  return force;
5172  };
5173  force.alpha = function(x) {
5174  if (!arguments.length) return alpha;
5175  if (alpha) {
5176  if (x > 0) alpha = x; else alpha = 0;
5177  } else if (x > 0) {
5178  event.start({
5179  type: "start",
5180  alpha: alpha = x
5181  });
5182  d3.timer(force.tick);
5183  }
5184  return force;
5185  };
5186  force.start = function() {
5187  function position(dimension, size) {
5188  var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
5189  while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
5190  return Math.random() * size;
5191  }
5192  function neighbor() {
5193  if (!neighbors) {
5194  neighbors = [];
5195  for (j = 0; j < n; ++j) {
5196  neighbors[j] = [];
5197  }
5198  for (j = 0; j < m; ++j) {
5199  var o = links[j];
5200  neighbors[o.source.index].push(o.target);
5201  neighbors[o.target.index].push(o.source);
5202  }
5203  }
5204  return neighbors[i];
5205  }
5206  var i, j, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
5207  for (i = 0; i < n; ++i) {
5208  (o = nodes[i]).index = i;
5209  o.weight = 0;
5210  }
5211  distances = [];
5212  strengths = [];
5213  for (i = 0; i < m; ++i) {
5214  o = links[i];
5215  if (typeof o.source == "number") o.source = nodes[o.source];
5216  if (typeof o.target == "number") o.target = nodes[o.target];
5217  distances[i] = linkDistance.call(this, o, i);
5218  strengths[i] = linkStrength.call(this, o, i);
5219  ++o.source.weight;
5220  ++o.target.weight;
5221  }
5222  for (i = 0; i < n; ++i) {
5223  o = nodes[i];
5224  if (isNaN(o.x)) o.x = position("x", w);
5225  if (isNaN(o.y)) o.y = position("y", h);
5226  if (isNaN(o.px)) o.px = o.x;
5227  if (isNaN(o.py)) o.py = o.y;
5228  }
5229  charges = [];
5230  if (typeof charge === "function") {
5231  for (i = 0; i < n; ++i) {
5232  charges[i] = +charge.call(this, nodes[i], i);
5233  }
5234  } else {
5235  for (i = 0; i < n; ++i) {
5236  charges[i] = charge;
5237  }
5238  }
5239  return force.resume();
5240  };
5241  force.resume = function() {
5242  return force.alpha(.1);
5243  };
5244  force.stop = function() {
5245  return force.alpha(0);
5246  };
5247  force.drag = function() {
5248  if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart", d3_layout_forceDragstart).on("drag", dragmove).on("dragend", d3_layout_forceDragend);
5249  this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
5250  };
5251  return d3.rebind(force, event, "on");
5252  };
5253  d3.layout.partition = function() {
5254  function position(node, x, dx, dy) {
5255  var children = node.children;
5256  node.x = x;
5257  node.y = node.depth * dy;
5258  node.dx = dx;
5259  node.dy = dy;
5260  if (children && (n = children.length)) {
5261  var i = -1, n, c, d;
5262  dx = node.value ? dx / node.value : 0;
5263  while (++i < n) {
5264  position(c = children[i], x, d = c.value * dx, dy);
5265  x += d;
5266  }
5267  }
5268  }
5269  function depth(node) {
5270  var children = node.children, d = 0;
5271  if (children && (n = children.length)) {
5272  var i = -1, n;
5273  while (++i < n) d = Math.max(d, depth(children[i]));
5274  }
5275  return 1 + d;
5276  }
5277  function partition(d, i) {
5278  var nodes = hierarchy.call(this, d, i);
5279  position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
5280  return nodes;
5281  }
5282  var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
5283  partition.size = function(x) {
5284  if (!arguments.length) return size;
5285  size = x;
5286  return partition;
5287  };
5288  return d3_layout_hierarchyRebind(partition, hierarchy);
5289  };
5290  d3.layout.pie = function() {
5291  function pie(data, i) {
5292  var values = data.map(function(d, i) {
5293  return +value.call(pie, d, i);
5294  });
5295  var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
5296  var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - startAngle) / d3.sum(values);
5297  var index = d3.range(data.length);
5298  if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
5299  return values[j] - values[i];
5300  } : function(i, j) {
5301  return sort(data[i], data[j]);
5302  });
5303  var arcs = [];
5304  index.forEach(function(i) {
5305  var d;
5306  arcs[i] = {
5307  data: data[i],
5308  value: d = values[i],
5309  startAngle: a,
5310  endAngle: a += d * k
5311  };
5312  });
5313  return arcs;
5314  }
5315  var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = 2 * Math.PI;
5316  pie.value = function(x) {
5317  if (!arguments.length) return value;
5318  value = x;
5319  return pie;
5320  };
5321  pie.sort = function(x) {
5322  if (!arguments.length) return sort;
5323  sort = x;
5324  return pie;
5325  };
5326  pie.startAngle = function(x) {
5327  if (!arguments.length) return startAngle;
5328  startAngle = x;
5329  return pie;
5330  };
5331  pie.endAngle = function(x) {
5332  if (!arguments.length) return endAngle;
5333  endAngle = x;
5334  return pie;
5335  };
5336  return pie;
5337  };
5338  var d3_layout_pieSortByValue = {};
5339  d3.layout.stack = function() {
5340  function stack(data, index) {
5341  var series = data.map(function(d, i) {
5342  return values.call(stack, d, i);
5343  });
5344  var points = series.map(function(d, i) {
5345  return d.map(function(v, i) {
5346  return [ x.call(stack, v, i), y.call(stack, v, i) ];
5347  });
5348  });
5349  var orders = order.call(stack, points, index);
5350  series = d3.permute(series, orders);
5351  points = d3.permute(points, orders);
5352  var offsets = offset.call(stack, points, index);
5353  var n = series.length, m = series[0].length, i, j, o;
5354  for (j = 0; j < m; ++j) {
5355  out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
5356  for (i = 1; i < n; ++i) {
5357  out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
5358  }
5359  }
5360  return data;
5361  }
5362  var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
5363  stack.values = function(x) {
5364  if (!arguments.length) return values;
5365  values = x;
5366  return stack;
5367  };
5368  stack.order = function(x) {
5369  if (!arguments.length) return order;
5370  order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
5371  return stack;
5372  };
5373  stack.offset = function(x) {
5374  if (!arguments.length) return offset;
5375  offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
5376  return stack;
5377  };
5378  stack.x = function(z) {
5379  if (!arguments.length) return x;
5380  x = z;
5381  return stack;
5382  };
5383  stack.y = function(z) {
5384  if (!arguments.length) return y;
5385  y = z;
5386  return stack;
5387  };
5388  stack.out = function(z) {
5389  if (!arguments.length) return out;
5390  out = z;
5391  return stack;
5392  };
5393  return stack;
5394  };
5395  var d3_layout_stackOrders = d3.map({
5396  "inside-out": function(data) {
5397  var n = data.length, i, j, max = data.map(d3_layout_stackMaxIndex), sums = data.map(d3_layout_stackReduceSum), index = d3.range(n).sort(function(a, b) {
5398  return max[a] - max[b];
5399  }), top = 0, bottom = 0, tops = [], bottoms = [];
5400  for (i = 0; i < n; ++i) {
5401  j = index[i];
5402  if (top < bottom) {
5403  top += sums[j];
5404  tops.push(j);
5405  } else {
5406  bottom += sums[j];
5407  bottoms.push(j);
5408  }
5409  }
5410  return bottoms.reverse().concat(tops);
5411  },
5412  reverse: function(data) {
5413  return d3.range(data.length).reverse();
5414  },
5415  "default": d3_layout_stackOrderDefault
5416  });
5417  var d3_layout_stackOffsets = d3.map({
5418  silhouette: function(data) {
5419  var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
5420  for (j = 0; j < m; ++j) {
5421  for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
5422  if (o > max) max = o;
5423  sums.push(o);
5424  }
5425  for (j = 0; j < m; ++j) {
5426  y0[j] = (max - sums[j]) / 2;
5427  }
5428  return y0;
5429  },
5430  wiggle: function(data) {
5431  var n = data.length, x = data[0], m = x.length, max = 0, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
5432  y0[0] = o = o0 = 0;
5433  for (j = 1; j < m; ++j) {
5434  for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
5435  for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
5436  for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
5437  s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
5438  }
5439  s2 += s3 * data[i][j][1];
5440  }
5441  y0[j] = o -= s1 ? s2 / s1 * dx : 0;
5442  if (o < o0) o0 = o;
5443  }
5444  for (j = 0; j < m; ++j) y0[j] -= o0;
5445  return y0;
5446  },
5447  expand: function(data) {
5448  var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
5449  for (j = 0; j < m; ++j) {
5450  for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
5451  if (o) for (i = 0; i < n; i++) data[i][j][1] /= o; else for (i = 0; i < n; i++) data[i][j][1] = k;
5452  }
5453  for (j = 0; j < m; ++j) y0[j] = 0;
5454  return y0;
5455  },
5456  zero: d3_layout_stackOffsetZero
5457  });
5458  d3.layout.histogram = function() {
5459  function histogram(data, i) {
5460  var bins = [], values = data.map(valuer, this), range = ranger.call(this, values, i), thresholds = binner.call(this, range, values, i), bin, i = -1, n = values.length, m = thresholds.length - 1, k = frequency ? 1 : 1 / n, x;
5461  while (++i < m) {
5462  bin = bins[i] = [];
5463  bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
5464  bin.y = 0;
5465  }
5466  if (m > 0) {
5467  i = -1;
5468  while (++i < n) {
5469  x = values[i];
5470  if (x >= range[0] && x <= range[1]) {
5471  bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
5472  bin.y += k;
5473  bin.push(data[i]);
5474  }
5475  }
5476  }
5477  return bins;
5478  }
5479  var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
5480  histogram.value = function(x) {
5481  if (!arguments.length) return valuer;
5482  valuer = x;
5483  return histogram;
5484  };
5485  histogram.range = function(x) {
5486  if (!arguments.length) return ranger;
5487  ranger = d3_functor(x);
5488  return histogram;
5489  };
5490  histogram.bins = function(x) {
5491  if (!arguments.length) return binner;
5492  binner = typeof x === "number" ? function(range) {
5493  return d3_layout_histogramBinFixed(range, x);
5494  } : d3_functor(x);
5495  return histogram;
5496  };
5497  histogram.frequency = function(x) {
5498  if (!arguments.length) return frequency;
5499  frequency = !!x;
5500  return histogram;
5501  };
5502  return histogram;
5503  };
5504  d3.layout.hierarchy = function() {
5505  function recurse(data, depth, nodes) {
5506  var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {
5507  data: data
5508  };
5509  node.depth = depth;
5510  nodes.push(node);
5511  if (childs && (n = childs.length)) {
5512  var i = -1, n, c = node.children = [], v = 0, j = depth + 1, d;
5513  while (++i < n) {
5514  d = recurse(childs[i], j, nodes);
5515  d.parent = node;
5516  c.push(d);
5517  v += d.value;
5518  }
5519  if (sort) c.sort(sort);
5520  if (value) node.value = v;
5521  } else if (value) {
5522  node.value = +value.call(hierarchy, data, depth) || 0;
5523  }
5524  return node;
5525  }
5526  function revalue(node, depth) {
5527  var children = node.children, v = 0;
5528  if (children && (n = children.length)) {
5529  var i = -1, n, j = depth + 1;
5530  while (++i < n) v += revalue(children[i], j);
5531  } else if (value) {
5532  v = +value.call(hierarchy, d3_layout_hierarchyInline ? node : node.data, depth) || 0;
5533  }
5534  if (value) node.value = v;
5535  return v;
5536  }
5537  function hierarchy(d) {
5538  var nodes = [];
5539  recurse(d, 0, nodes);
5540  return nodes;
5541  }
5542  var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
5543  hierarchy.sort = function(x) {
5544  if (!arguments.length) return sort;
5545  sort = x;
5546  return hierarchy;
5547  };
5548  hierarchy.children = function(x) {
5549  if (!arguments.length) return children;
5550  children = x;
5551  return hierarchy;
5552  };
5553  hierarchy.value = function(x) {
5554  if (!arguments.length) return value;
5555  value = x;
5556  return hierarchy;
5557  };
5558  hierarchy.revalue = function(root) {
5559  revalue(root, 0);
5560  return root;
5561  };
5562  return hierarchy;
5563  };
5564  var d3_layout_hierarchyInline = false;
5565  d3.layout.pack = function() {
5566  function pack(d, i) {
5567  var nodes = hierarchy.call(this, d, i), root = nodes[0];
5568  root.x = 0;
5569  root.y = 0;
5570  d3_layout_treeVisitAfter(root, function(d) {
5571  d.r = Math.sqrt(d.value);
5572  });
5573  d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
5574  var w = size[0], h = size[1], k = Math.max(2 * root.r / w, 2 * root.r / h);
5575  if (padding > 0) {
5576  var dr = padding * k / 2;
5577  d3_layout_treeVisitAfter(root, function(d) {
5578  d.r += dr;
5579  });
5580  d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
5581  d3_layout_treeVisitAfter(root, function(d) {
5582  d.r -= dr;
5583  });
5584  k = Math.max(2 * root.r / w, 2 * root.r / h);
5585  }
5586  d3_layout_packTransform(root, w / 2, h / 2, 1 / k);
5587  return nodes;
5588  }
5589  var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ];
5590  pack.size = function(x) {
5591  if (!arguments.length) return size;
5592  size = x;
5593  return pack;
5594  };
5595  pack.padding = function(_) {
5596  if (!arguments.length) return padding;
5597  padding = +_;
5598  return pack;
5599  };
5600  return d3_layout_hierarchyRebind(pack, hierarchy);
5601  };
5602  d3.layout.cluster = function() {
5603  function cluster(d, i) {
5604  var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0, kx, ky;
5605  d3_layout_treeVisitAfter(root, function(node) {
5606  var children = node.children;
5607  if (children && children.length) {
5608  node.x = d3_layout_clusterX(children);
5609  node.y = d3_layout_clusterY(children);
5610  } else {
5611  node.x = previousNode ? x += separation(node, previousNode) : 0;
5612  node.y = 0;
5613  previousNode = node;
5614  }
5615  });
5616  var left = d3_layout_clusterLeft(root), right = d3_layout_clusterRight(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
5617  d3_layout_treeVisitAfter(root, function(node) {
5618  node.x = (node.x - x0) / (x1 - x0) * size[0];
5619  node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
5620  });
5621  return nodes;
5622  }
5623  var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
5624  cluster.separation = function(x) {
5625  if (!arguments.length) return separation;
5626  separation = x;
5627  return cluster;
5628  };
5629  cluster.size = function(x) {
5630  if (!arguments.length) return size;
5631  size = x;
5632  return cluster;
5633  };
5634  return d3_layout_hierarchyRebind(cluster, hierarchy);
5635  };
5636  d3.layout.tree = function() {
5637  function tree(d, i) {
5638  function firstWalk(node, previousSibling) {
5639  var children = node.children, layout = node._tree;
5640  if (children && (n = children.length)) {
5641  var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
5642  while (++i < n) {
5643  child = children[i];
5644  firstWalk(child, previousChild);
5645  ancestor = apportion(child, previousChild, ancestor);
5646  previousChild = child;
5647  }
5648  d3_layout_treeShift(node);
5649  var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
5650  if (previousSibling) {
5651  layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5652  layout.mod = layout.prelim - midpoint;
5653  } else {
5654  layout.prelim = midpoint;
5655  }
5656  } else {
5657  if (previousSibling) {
5658  layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
5659  }
5660  }
5661  }
5662  function secondWalk(node, x) {
5663  node.x = node._tree.prelim + x;
5664  var children = node.children;
5665  if (children && (n = children.length)) {
5666  var i = -1, n;
5667  x += node._tree.mod;
5668  while (++i < n) {
5669  secondWalk(children[i], x);
5670  }
5671  }
5672  }
5673  function apportion(node, previousSibling, ancestor) {
5674  if (previousSibling) {
5675  var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
5676  while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
5677  vom = d3_layout_treeLeft(vom);
5678  vop = d3_layout_treeRight(vop);
5679  vop._tree.ancestor = node;
5680  shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
5681  if (shift > 0) {
5682  d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
5683  sip += shift;
5684  sop += shift;
5685  }
5686  sim += vim._tree.mod;
5687  sip += vip._tree.mod;
5688  som += vom._tree.mod;
5689  sop += vop._tree.mod;
5690  }
5691  if (vim && !d3_layout_treeRight(vop)) {
5692  vop._tree.thread = vim;
5693  vop._tree.mod += sim - sop;
5694  }
5695  if (vip && !d3_layout_treeLeft(vom)) {
5696  vom._tree.thread = vip;
5697  vom._tree.mod += sip - som;
5698  ancestor = node;
5699  }
5700  }
5701  return ancestor;
5702  }
5703  var nodes = hierarchy.call(this, d, i), root = nodes[0];
5704  d3_layout_treeVisitAfter(root, function(node, previousSibling) {
5705  node._tree = {
5706  ancestor: node,
5707  prelim: 0,
5708  mod: 0,
5709  change: 0,
5710  shift: 0,
5711  number: previousSibling ? previousSibling._tree.number + 1 : 0
5712  };
5713  });
5714  firstWalk(root);
5715  secondWalk(root, -root._tree.prelim);
5716  var left = d3_layout_treeSearch(root, d3_layout_treeLeftmost), right = d3_layout_treeSearch(root, d3_layout_treeRightmost), deep = d3_layout_treeSearch(root, d3_layout_treeDeepest), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2, y1 = deep.depth || 1;
5717  d3_layout_treeVisitAfter(root, function(node) {
5718  node.x = (node.x - x0) / (x1 - x0) * size[0];
5719  node.y = node.depth / y1 * size[1];
5720  delete node._tree;
5721  });
5722  return nodes;
5723  }
5724  var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ];
5725  tree.separation = function(x) {
5726  if (!arguments.length) return separation;
5727  separation = x;
5728  return tree;
5729  };
5730  tree.size = function(x) {
5731  if (!arguments.length) return size;
5732  size = x;
5733  return tree;
5734  };
5735  return d3_layout_hierarchyRebind(tree, hierarchy);
5736  };
5737  d3.layout.treemap = function() {
5738  function scale(children, k) {
5739  var i = -1, n = children.length, child, area;
5740  while (++i < n) {
5741  area = (child = children[i]).value * (k < 0 ? 0 : k);
5742  child.area = isNaN(area) || area <= 0 ? 0 : area;
5743  }
5744  }
5745  function squarify(node) {
5746  var children = node.children;
5747  if (children && children.length) {
5748  var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = Math.min(rect.dx, rect.dy), n;
5749  scale(remaining, rect.dx * rect.dy / node.value);
5750  row.area = 0;
5751  while ((n = remaining.length) > 0) {
5752  row.push(child = remaining[n - 1]);
5753  row.area += child.area;
5754  if ((score = worst(row, u)) <= best) {
5755  remaining.pop();
5756  best = score;
5757  } else {
5758  row.area -= row.pop().area;
5759  position(row, u, rect, false);
5760  u = Math.min(rect.dx, rect.dy);
5761  row.length = row.area = 0;
5762  best = Infinity;
5763  }
5764  }
5765  if (row.length) {
5766  position(row, u, rect, true);
5767  row.length = row.area = 0;
5768  }
5769  children.forEach(squarify);
5770  }
5771  }
5772  function stickify(node) {
5773  var children = node.children;
5774  if (children && children.length) {
5775  var rect = pad(node), remaining = children.slice(), child, row = [];
5776  scale(remaining, rect.dx * rect.dy / node.value);
5777  row.area = 0;
5778  while (child = remaining.pop()) {
5779  row.push(child);
5780  row.area += child.area;
5781  if (child.z != null) {
5782  position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
5783  row.length = row.area = 0;
5784  }
5785  }
5786  children.forEach(stickify);
5787  }
5788  }
5789  function worst(row, u) {
5790  var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
5791  while (++i < n) {
5792  if (!(r = row[i].area)) continue;
5793  if (r < rmin) rmin = r;
5794  if (r > rmax) rmax = r;
5795  }
5796  s *= s;
5797  u *= u;
5798  return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
5799  }
5800  function position(row, u, rect, flush) {
5801  var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
5802  if (u == rect.dx) {
5803  if (flush || v > rect.dy) v = rect.dy;
5804  while (++i < n) {
5805  o = row[i];
5806  o.x = x;
5807  o.y = y;
5808  o.dy = v;
5809  x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
5810  }
5811  o.z = true;
5812  o.dx += rect.x + rect.dx - x;
5813  rect.y += v;
5814  rect.dy -= v;
5815  } else {
5816  if (flush || v > rect.dx) v = rect.dx;
5817  while (++i < n) {
5818  o = row[i];
5819  o.x = x;
5820  o.y = y;
5821  o.dx = v;
5822  y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
5823  }
5824  o.z = false;
5825  o.dy += rect.y + rect.dy - y;
5826  rect.x += v;
5827  rect.dx -= v;
5828  }
5829  }
5830  function treemap(d) {
5831  var nodes = stickies || hierarchy(d), root = nodes[0];
5832  root.x = 0;
5833  root.y = 0;
5834  root.dx = size[0];
5835  root.dy = size[1];
5836  if (stickies) hierarchy.revalue(root);
5837  scale([ root ], root.dx * root.dy / root.value);
5838  (stickies ? stickify : squarify)(root);
5839  if (sticky) stickies = nodes;
5840  return nodes;
5841  }
5842  var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, ratio = .5 * (1 + Math.sqrt(5));
5843  treemap.size = function(x) {
5844  if (!arguments.length) return size;
5845  size = x;
5846  return treemap;
5847  };
5848  treemap.padding = function(x) {
5849  function padFunction(node) {
5850  var p = x.call(treemap, node, node.depth);
5851  return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
5852  }
5853  function padConstant(node) {
5854  return d3_layout_treemapPad(node, x);
5855  }
5856  if (!arguments.length) return padding;
5857  var type;
5858  pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], padConstant) : padConstant;
5859  return treemap;
5860  };
5861  treemap.round = function(x) {
5862  if (!arguments.length) return round != Number;
5863  round = x ? Math.round : Number;
5864  return treemap;
5865  };
5866  treemap.sticky = function(x) {
5867  if (!arguments.length) return sticky;
5868  sticky = x;
5869  stickies = null;
5870  return treemap;
5871  };
5872  treemap.ratio = function(x) {
5873  if (!arguments.length) return ratio;
5874  ratio = x;
5875  return treemap;
5876  };
5877  return d3_layout_hierarchyRebind(treemap, hierarchy);
5878  };
5879  d3.csv = d3_dsv(",", "text/csv");
5880  d3.tsv = d3_dsv(" ", "text/tab-separated-values");
5881  d3.geo = {};
5882  var d3_geo_radians = Math.PI / 180;
5883  d3.geo.azimuthal = function() {
5884  function azimuthal(coordinates) {
5885  var x1 = coordinates[0] * d3_geo_radians - x0, y1 = coordinates[1] * d3_geo_radians, cx1 = Math.cos(x1), sx1 = Math.sin(x1), cy1 = Math.cos(y1), sy1 = Math.sin(y1), cc = mode !== "orthographic" ? sy0 * sy1 + cy0 * cy1 * cx1 : null, c, k = mode === "stereographic" ? 1 / (1 + cc) : mode === "gnomonic" ? 1 / cc : mode === "equidistant" ? (c = Math.acos(cc), c ? c / Math.sin(c) : 0) : mode === "equalarea" ? Math.sqrt(2 / (1 + cc)) : 1, x = k * cy1 * sx1, y = k * (sy0 * cy1 * cx1 - cy0 * sy1);
5886  return [ scale * x + translate[0], scale * y + translate[1] ];
5887  }
5888  var mode = "orthographic", origin, scale = 200, translate = [ 480, 250 ], x0, y0, cy0, sy0;
5889  azimuthal.invert = function(coordinates) {
5890  var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p = Math.sqrt(x * x + y * y), c = mode === "stereographic" ? 2 * Math.atan(p) : mode === "gnomonic" ? Math.atan(p) : mode === "equidistant" ? p : mode === "equalarea" ? 2 * Math.asin(.5 * p) : Math.asin(p), sc = Math.sin(c), cc = Math.cos(c);
5891  return [ (x0 + Math.atan2(x * sc, p * cy0 * cc + y * sy0 * sc)) / d3_geo_radians, Math.asin(cc * sy0 - (p ? y * sc * cy0 / p : 0)) / d3_geo_radians ];
5892  };
5893  azimuthal.mode = function(x) {
5894  if (!arguments.length) return mode;
5895  mode = x + "";
5896  return azimuthal;
5897  };
5898  azimuthal.origin = function(x) {
5899  if (!arguments.length) return origin;
5900  origin = x;
5901  x0 = origin[0] * d3_geo_radians;
5902  y0 = origin[1] * d3_geo_radians;
5903  cy0 = Math.cos(y0);
5904  sy0 = Math.sin(y0);
5905  return azimuthal;
5906  };
5907  azimuthal.scale = function(x) {
5908  if (!arguments.length) return scale;
5909  scale = +x;
5910  return azimuthal;
5911  };
5912  azimuthal.translate = function(x) {
5913  if (!arguments.length) return translate;
5914  translate = [ +x[0], +x[1] ];
5915  return azimuthal;
5916  };
5917  return azimuthal.origin([ 0, 0 ]);
5918  };
5919  d3.geo.albers = function() {
5920  function albers(coordinates) {
5921  var t = n * (d3_geo_radians * coordinates[0] - lng0), p = Math.sqrt(C - 2 * n * Math.sin(d3_geo_radians * coordinates[1])) / n;
5922  return [ scale * p * Math.sin(t) + translate[0], scale * (p * Math.cos(t) - p0) + translate[1] ];
5923  }
5924  function reload() {
5925  var phi1 = d3_geo_radians * parallels[0], phi2 = d3_geo_radians * parallels[1], lat0 = d3_geo_radians * origin[1], s = Math.sin(phi1), c = Math.cos(phi1);
5926  lng0 = d3_geo_radians * origin[0];
5927  n = .5 * (s + Math.sin(phi2));
5928  C = c * c + 2 * n * s;
5929  p0 = Math.sqrt(C - 2 * n * Math.sin(lat0)) / n;
5930  return albers;
5931  }
5932  var origin = [ -98, 38 ], parallels = [ 29.5, 45.5 ], scale = 1e3, translate = [ 480, 250 ], lng0, n, C, p0;
5933  albers.invert = function(coordinates) {
5934  var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale, p0y = p0 + y, t = Math.atan2(x, p0y), p = Math.sqrt(x * x + p0y * p0y);
5935  return [ (lng0 + t / n) / d3_geo_radians, Math.asin((C - p * p * n * n) / (2 * n)) / d3_geo_radians ];
5936  };
5937  albers.origin = function(x) {
5938  if (!arguments.length) return origin;
5939  origin = [ +x[0], +x[1] ];
5940  return reload();
5941  };
5942  albers.parallels = function(x) {
5943  if (!arguments.length) return parallels;
5944  parallels = [ +x[0], +x[1] ];
5945  return reload();
5946  };
5947  albers.scale = function(x) {
5948  if (!arguments.length) return scale;
5949  scale = +x;
5950  return albers;
5951  };
5952  albers.translate = function(x) {
5953  if (!arguments.length) return translate;
5954  translate = [ +x[0], +x[1] ];
5955  return albers;
5956  };
5957  return reload();
5958  };
5959  d3.geo.albersUsa = function() {
5960  function albersUsa(coordinates) {
5961  var lon = coordinates[0], lat = coordinates[1];
5962  return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);
5963  }
5964  var lower48 = d3.geo.albers();
5965  var alaska = d3.geo.albers().origin([ -160, 60 ]).parallels([ 55, 65 ]);
5966  var hawaii = d3.geo.albers().origin([ -160, 20 ]).parallels([ 8, 18 ]);
5967  var puertoRico = d3.geo.albers().origin([ -60, 10 ]).parallels([ 8, 18 ]);
5968  albersUsa.scale = function(x) {
5969  if (!arguments.length) return lower48.scale();
5970  lower48.scale(x);
5971  alaska.scale(x * .6);
5972  hawaii.scale(x);
5973  puertoRico.scale(x * 1.5);
5974  return albersUsa.translate(lower48.translate());
5975  };
5976  albersUsa.translate = function(x) {
5977  if (!arguments.length) return lower48.translate();
5978  var dz = lower48.scale() / 1e3, dx = x[0], dy = x[1];
5979  lower48.translate(x);
5980  alaska.translate([ dx - 400 * dz, dy + 170 * dz ]);
5981  hawaii.translate([ dx - 190 * dz, dy + 200 * dz ]);
5982  puertoRico.translate([ dx + 580 * dz, dy + 430 * dz ]);
5983  return albersUsa;
5984  };
5985  return albersUsa.scale(lower48.scale());
5986  };
5987  d3.geo.bonne = function() {
5988  function bonne(coordinates) {
5989  var x = coordinates[0] * d3_geo_radians - x0, y = coordinates[1] * d3_geo_radians - y0;
5990  if (y1) {
5991  var p = c1 + y1 - y, E = x * Math.cos(y) / p;
5992  x = p * Math.sin(E);
5993  y = p * Math.cos(E) - c1;
5994  } else {
5995  x *= Math.cos(y);
5996  y *= -1;
5997  }
5998  return [ scale * x + translate[0], scale * y + translate[1] ];
5999  }
6000  var scale = 200, translate = [ 480, 250 ], x0, y0, y1, c1;
6001  bonne.invert = function(coordinates) {
6002  var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6003  if (y1) {
6004  var c = c1 + y, p = Math.sqrt(x * x + c * c);
6005  y = c1 + y1 - p;
6006  x = x0 + p * Math.atan2(x, c) / Math.cos(y);
6007  } else {
6008  y *= -1;
6009  x /= Math.cos(y);
6010  }
6011  return [ x / d3_geo_radians, y / d3_geo_radians ];
6012  };
6013  bonne.parallel = function(x) {
6014  if (!arguments.length) return y1 / d3_geo_radians;
6015  c1 = 1 / Math.tan(y1 = x * d3_geo_radians);
6016  return bonne;
6017  };
6018  bonne.origin = function(x) {
6019  if (!arguments.length) return [ x0 / d3_geo_radians, y0 / d3_geo_radians ];
6020  x0 = x[0] * d3_geo_radians;
6021  y0 = x[1] * d3_geo_radians;
6022  return bonne;
6023  };
6024  bonne.scale = function(x) {
6025  if (!arguments.length) return scale;
6026  scale = +x;
6027  return bonne;
6028  };
6029  bonne.translate = function(x) {
6030  if (!arguments.length) return translate;
6031  translate = [ +x[0], +x[1] ];
6032  return bonne;
6033  };
6034  return bonne.origin([ 0, 0 ]).parallel(45);
6035  };
6036  d3.geo.equirectangular = function() {
6037  function equirectangular(coordinates) {
6038  var x = coordinates[0] / 360, y = -coordinates[1] / 360;
6039  return [ scale * x + translate[0], scale * y + translate[1] ];
6040  }
6041  var scale = 500, translate = [ 480, 250 ];
6042  equirectangular.invert = function(coordinates) {
6043  var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6044  return [ 360 * x, -360 * y ];
6045  };
6046  equirectangular.scale = function(x) {
6047  if (!arguments.length) return scale;
6048  scale = +x;
6049  return equirectangular;
6050  };
6051  equirectangular.translate = function(x) {
6052  if (!arguments.length) return translate;
6053  translate = [ +x[0], +x[1] ];
6054  return equirectangular;
6055  };
6056  return equirectangular;
6057  };
6058  d3.geo.mercator = function() {
6059  function mercator(coordinates) {
6060  var x = coordinates[0] / 360, y = -(Math.log(Math.tan(Math.PI / 4 + coordinates[1] * d3_geo_radians / 2)) / d3_geo_radians) / 360;
6061  return [ scale * x + translate[0], scale * Math.max(-.5, Math.min(.5, y)) + translate[1] ];
6062  }
6063  var scale = 500, translate = [ 480, 250 ];
6064  mercator.invert = function(coordinates) {
6065  var x = (coordinates[0] - translate[0]) / scale, y = (coordinates[1] - translate[1]) / scale;
6066  return [ 360 * x, 2 * Math.atan(Math.exp(-360 * y * d3_geo_radians)) / d3_geo_radians - 90 ];
6067  };
6068  mercator.scale = function(x) {
6069  if (!arguments.length) return scale;
6070  scale = +x;
6071  return mercator;
6072  };
6073  mercator.translate = function(x) {
6074  if (!arguments.length) return translate;
6075  translate = [ +x[0], +x[1] ];
6076  return mercator;
6077  };
6078  return mercator;
6079  };
6080  d3.geo.path = function() {
6081  function path(d, i) {
6082  if (typeof pointRadius === "function") pointCircle = d3_path_circle(pointRadius.apply(this, arguments));
6083  pathType(d);
6084  var result = buffer.length ? buffer.join("") : null;
6085  buffer = [];
6086  return result;
6087  }
6088  function project(coordinates) {
6089  return projection(coordinates).join(",");
6090  }
6091  function polygonArea(coordinates) {
6092  var sum = area(coordinates[0]), i = 0, n = coordinates.length;
6093  while (++i < n) sum -= area(coordinates[i]);
6094  return sum;
6095  }
6096  function polygonCentroid(coordinates) {
6097  var polygon = d3.geom.polygon(coordinates[0].map(projection)), area = polygon.area(), centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1), x = centroid[0], y = centroid[1], z = area, i = 0, n = coordinates.length;
6098  while (++i < n) {
6099  polygon = d3.geom.polygon(coordinates[i].map(projection));
6100  area = polygon.area();
6101  centroid = polygon.centroid(area < 0 ? (area *= -1, 1) : -1);
6102  x -= centroid[0];
6103  y -= centroid[1];
6104  z -= area;
6105  }
6106  return [ x, y, 6 * z ];
6107  }
6108  function area(coordinates) {
6109  return Math.abs(d3.geom.polygon(coordinates.map(projection)).area());
6110  }
6111  var pointRadius = 4.5, pointCircle = d3_path_circle(pointRadius), projection = d3.geo.albersUsa(), buffer = [];
6112  var pathType = d3_geo_type({
6113  FeatureCollection: function(o) {
6114  var features = o.features, i = -1, n = features.length;
6115  while (++i < n) buffer.push(pathType(features[i].geometry));
6116  },
6117  Feature: function(o) {
6118  pathType(o.geometry);
6119  },
6120  Point: function(o) {
6121  buffer.push("M", project(o.coordinates), pointCircle);
6122  },
6123  MultiPoint: function(o) {
6124  var coordinates = o.coordinates, i = -1, n = coordinates.length;
6125  while (++i < n) buffer.push("M", project(coordinates[i]), pointCircle);
6126  },
6127  LineString: function(o) {
6128  var coordinates = o.coordinates, i = -1, n = coordinates.length;
6129  buffer.push("M");
6130  while (++i < n) buffer.push(project(coordinates[i]), "L");
6131  buffer.pop();
6132  },
6133  MultiLineString: function(o) {
6134  var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
6135  while (++i < n) {
6136  subcoordinates = coordinates[i];
6137  j = -1;
6138  m = subcoordinates.length;
6139  buffer.push("M");
6140  while (++j < m) buffer.push(project(subcoordinates[j]), "L");
6141  buffer.pop();
6142  }
6143  },
6144  Polygon: function(o) {
6145  var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m;
6146  while (++i < n) {
6147  subcoordinates = coordinates[i];
6148  j = -1;
6149  if ((m = subcoordinates.length - 1) > 0) {
6150  buffer.push("M");
6151  while (++j < m) buffer.push(project(subcoordinates[j]), "L");
6152  buffer[buffer.length - 1] = "Z";
6153  }
6154  }
6155  },
6156  MultiPolygon: function(o) {
6157  var coordinates = o.coordinates, i = -1, n = coordinates.length, subcoordinates, j, m, subsubcoordinates, k, p;
6158  while (++i < n) {
6159  subcoordinates = coordinates[i];
6160  j = -1;
6161  m = subcoordinates.length;
6162  while (++j < m) {
6163  subsubcoordinates = subcoordinates[j];
6164  k = -1;
6165  if ((p = subsubcoordinates.length - 1) > 0) {
6166  buffer.push("M");
6167  while (++k < p) buffer.push(project(subsubcoordinates[k]), "L");
6168  buffer[buffer.length - 1] = "Z";
6169  }
6170  }
6171  }
6172  },
6173  GeometryCollection: function(o) {
6174  var geometries = o.geometries, i = -1, n = geometries.length;
6175  while (++i < n) buffer.push(pathType(geometries[i]));
6176  }
6177  });
6178  var areaType = path.area = d3_geo_type({
6179  FeatureCollection: function(o) {
6180  var area = 0, features = o.features, i = -1, n = features.length;
6181  while (++i < n) area += areaType(features[i]);
6182  return area;
6183  },
6184  Feature: function(o) {
6185  return areaType(o.geometry);
6186  },
6187  Polygon: function(o) {
6188  return polygonArea(o.coordinates);
6189  },
6190  MultiPolygon: function(o) {
6191  var sum = 0, coordinates = o.coordinates, i = -1, n = coordinates.length;
6192  while (++i < n) sum += polygonArea(coordinates[i]);
6193  return sum;
6194  },
6195  GeometryCollection: function(o) {
6196  var sum = 0, geometries = o.geometries, i = -1, n = geometries.length;
6197  while (++i < n) sum += areaType(geometries[i]);
6198  return sum;
6199  }
6200  }, 0);
6201  var centroidType = path.centroid = d3_geo_type({
6202  Feature: function(o) {
6203  return centroidType(o.geometry);
6204  },
6205  Polygon: function(o) {
6206  var centroid = polygonCentroid(o.coordinates);
6207  return [ centroid[0] / centroid[2], centroid[1] / centroid[2] ];
6208  },
6209  MultiPolygon: function(o) {
6210  var area = 0, coordinates = o.coordinates, centroid, x = 0, y = 0, z = 0, i = -1, n = coordinates.length;
6211  while (++i < n) {
6212  centroid = polygonCentroid(coordinates[i]);
6213  x += centroid[0];
6214  y += centroid[1];
6215  z += centroid[2];
6216  }
6217  return [ x / z, y / z ];
6218  }
6219  });
6220  path.projection = function(x) {
6221  projection = x;
6222  return path;
6223  };
6224  path.pointRadius = function(x) {
6225  if (typeof x === "function") pointRadius = x; else {
6226  pointRadius = +x;
6227  pointCircle = d3_path_circle(pointRadius);
6228  }
6229  return path;
6230  };
6231  return path;
6232  };
6233  d3.geo.bounds = function(feature) {
6234  var left = Infinity, bottom = Infinity, right = -Infinity, top = -Infinity;
6235  d3_geo_bounds(feature, function(x, y) {
6236  if (x < left) left = x;
6237  if (x > right) right = x;
6238  if (y < bottom) bottom = y;
6239  if (y > top) top = y;
6240  });
6241  return [ [ left, bottom ], [ right, top ] ];
6242  };
6243  var d3_geo_boundsTypes = {
6244  Feature: d3_geo_boundsFeature,
6245  FeatureCollection: d3_geo_boundsFeatureCollection,
6246  GeometryCollection: d3_geo_boundsGeometryCollection,
6247  LineString: d3_geo_boundsLineString,
6248  MultiLineString: d3_geo_boundsMultiLineString,
6249  MultiPoint: d3_geo_boundsLineString,
6250  MultiPolygon: d3_geo_boundsMultiPolygon,
6251  Point: d3_geo_boundsPoint,
6252  Polygon: d3_geo_boundsPolygon
6253  };
6254  d3.geo.circle = function() {
6255  function circle() {}
6256  function visible(point) {
6257  return arc.distance(point) < radians;
6258  }
6259  function clip(coordinates) {
6260  var i = -1, n = coordinates.length, clipped = [], p0, p1, p2, d0, d1;
6261  while (++i < n) {
6262  d1 = arc.distance(p2 = coordinates[i]);
6263  if (d1 < radians) {
6264  if (p1) clipped.push(d3_geo_greatArcInterpolate(p1, p2)((d0 - radians) / (d0 - d1)));
6265  clipped.push(p2);
6266  p0 = p1 = null;
6267  } else {
6268  p1 = p2;
6269  if (!p0 && clipped.length) {
6270  clipped.push(d3_geo_greatArcInterpolate(clipped[clipped.length - 1], p1)((radians - d0) / (d1 - d0)));
6271  p0 = p1;
6272  }
6273  }
6274  d0 = d1;
6275  }
6276  p0 = coordinates[0];
6277  p1 = clipped[0];
6278  if (p1 && p2[0] === p0[0] && p2[1] === p0[1] && !(p2[0] === p1[0] && p2[1] === p1[1])) {
6279  clipped.push(p1);
6280  }
6281  return resample(clipped);
6282  }
6283  function resample(coordinates) {
6284  var i = 0, n = coordinates.length, j, m, resampled = n ? [ coordinates[0] ] : coordinates, resamples, origin = arc.source();
6285  while (++i < n) {
6286  resamples = arc.source(coordinates[i - 1])(coordinates[i]).coordinates;
6287  for (j = 0, m = resamples.length; ++j < m; ) resampled.push(resamples[j]);
6288  }
6289  arc.source(origin);
6290  return resampled;
6291  }
6292  var origin = [ 0, 0 ], degrees = 90 - .01, radians = degrees * d3_geo_radians, arc = d3.geo.greatArc().source(origin).target(d3_identity);
6293  circle.clip = function(d) {
6294  if (typeof origin === "function") arc.source(origin.apply(this, arguments));
6295  return clipType(d) || null;
6296  };
6297  var clipType = d3_geo_type({
6298  FeatureCollection: function(o) {
6299  var features = o.features.map(clipType).filter(d3_identity);
6300  return features && (o = Object.create(o), o.features = features, o);
6301  },
6302  Feature: function(o) {
6303  var geometry = clipType(o.geometry);
6304  return geometry && (o = Object.create(o), o.geometry = geometry, o);
6305  },
6306  Point: function(o) {
6307  return visible(o.coordinates) && o;
6308  },
6309  MultiPoint: function(o) {
6310  var coordinates = o.coordinates.filter(visible);
6311  return coordinates.length && {
6312  type: o.type,
6313  coordinates: coordinates
6314  };
6315  },
6316  LineString: function(o) {
6317  var coordinates = clip(o.coordinates);
6318  return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6319  },
6320  MultiLineString: function(o) {
6321  var coordinates = o.coordinates.map(clip).filter(function(d) {
6322  return d.length;
6323  });
6324  return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6325  },
6326  Polygon: function(o) {
6327  var coordinates = o.coordinates.map(clip);
6328  return coordinates[0].length && (o = Object.create(o), o.coordinates = coordinates, o);
6329  },
6330  MultiPolygon: function(o) {
6331  var coordinates = o.coordinates.map(function(d) {
6332  return d.map(clip);
6333  }).filter(function(d) {
6334  return d[0].length;
6335  });
6336  return coordinates.length && (o = Object.create(o), o.coordinates = coordinates, o);
6337  },
6338  GeometryCollection: function(o) {
6339  var geometries = o.geometries.map(clipType).filter(d3_identity);
6340  return geometries.length && (o = Object.create(o), o.geometries = geometries, o);
6341  }
6342  });
6343  circle.origin = function(x) {
6344  if (!arguments.length) return origin;
6345  origin = x;
6346  if (typeof origin !== "function") arc.source(origin);
6347  return circle;
6348  };
6349  circle.angle = function(x) {
6350  if (!arguments.length) return degrees;
6351  radians = (degrees = +x) * d3_geo_radians;
6352  return circle;
6353  };
6354  return d3.rebind(circle, arc, "precision");
6355  };
6356  d3.geo.greatArc = function() {
6357  function greatArc() {
6358  var d = greatArc.distance.apply(this, arguments), t = 0, dt = precision / d, coordinates = [ p0 ];
6359  while ((t += dt) < 1) coordinates.push(interpolate(t));
6360  coordinates.push(p1);
6361  return {
6362  type: "LineString",
6363  coordinates: coordinates
6364  };
6365  }
6366  var source = d3_geo_greatArcSource, p0, target = d3_geo_greatArcTarget, p1, precision = 6 * d3_geo_radians, interpolate = d3_geo_greatArcInterpolator();
6367  greatArc.distance = function() {
6368  if (typeof source === "function") interpolate.source(p0 = source.apply(this, arguments));
6369  if (typeof target === "function") interpolate.target(p1 = target.apply(this, arguments));
6370  return interpolate.distance();
6371  };
6372  greatArc.source = function(_) {
6373  if (!arguments.length) return source;
6374  source = _;
6375  if (typeof source !== "function") interpolate.source(p0 = source);
6376  return greatArc;
6377  };
6378  greatArc.target = function(_) {
6379  if (!arguments.length) return target;
6380  target = _;
6381  if (typeof target !== "function") interpolate.target(p1 = target);
6382  return greatArc;
6383  };
6384  greatArc.precision = function(_) {
6385  if (!arguments.length) return precision / d3_geo_radians;
6386  precision = _ * d3_geo_radians;
6387  return greatArc;
6388  };
6389  return greatArc;
6390  };
6391  d3.geo.greatCircle = d3.geo.circle;
6392  d3.geom = {};
6393  d3.geom.contour = function(grid, start) {
6394  var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;
6395  do {
6396  i = 0;
6397  if (grid(x - 1, y - 1)) i += 1;
6398  if (grid(x, y - 1)) i += 2;
6399  if (grid(x - 1, y)) i += 4;
6400  if (grid(x, y)) i += 8;
6401  if (i === 6) {
6402  dx = pdy === -1 ? -1 : 1;
6403  dy = 0;
6404  } else if (i === 9) {
6405  dx = 0;
6406  dy = pdx === 1 ? -1 : 1;
6407  } else {
6408  dx = d3_geom_contourDx[i];
6409  dy = d3_geom_contourDy[i];
6410  }
6411  if (dx != pdx && dy != pdy) {
6412  c.push([ x, y ]);
6413  pdx = dx;
6414  pdy = dy;
6415  }
6416  x += dx;
6417  y += dy;
6418  } while (s[0] != x || s[1] != y);
6419  return c;
6420  };
6421  var d3_geom_contourDx = [ 1, 0, 1, 1, -1, 0, -1, 1, 0, 0, 0, 0, -1, 0, -1, NaN ], d3_geom_contourDy = [ 0, -1, 0, 0, 0, -1, 0, 0, 1, -1, 1, 1, 0, -1, 0, NaN ];
6422  d3.geom.hull = function(vertices) {
6423  if (vertices.length < 3) return [];
6424  var len = vertices.length, plen = len - 1, points = [], stack = [], i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
6425  for (i = 1; i < len; ++i) {
6426  if (vertices[i][1] < vertices[h][1]) {
6427  h = i;
6428  } else if (vertices[i][1] == vertices[h][1]) {
6429  h = vertices[i][0] < vertices[h][0] ? i : h;
6430  }
6431  }
6432  for (i = 0; i < len; ++i) {
6433  if (i === h) continue;
6434  y1 = vertices[i][1] - vertices[h][1];
6435  x1 = vertices[i][0] - vertices[h][0];
6436  points.push({
6437  angle: Math.atan2(y1, x1),
6438  index: i
6439  });
6440  }
6441  points.sort(function(a, b) {
6442  return a.angle - b.angle;
6443  });
6444  a = points[0].angle;
6445  v = points[0].index;
6446  u = 0;
6447  for (i = 1; i < plen; ++i) {
6448  j = points[i].index;
6449  if (a == points[i].angle) {
6450  x1 = vertices[v][0] - vertices[h][0];
6451  y1 = vertices[v][1] - vertices[h][1];
6452  x2 = vertices[j][0] - vertices[h][0];
6453  y2 = vertices[j][1] - vertices[h][1];
6454  if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
6455  points[i].index = -1;
6456  } else {
6457  points[u].index = -1;
6458  a = points[i].angle;
6459  u = i;
6460  v = j;
6461  }
6462  } else {
6463  a = points[i].angle;
6464  u = i;
6465  v = j;
6466  }
6467  }
6468  stack.push(h);
6469  for (i = 0, j = 0; i < 2; ++j) {
6470  if (points[j].index !== -1) {
6471  stack.push(points[j].index);
6472  i++;
6473  }
6474  }
6475  sp = stack.length;
6476  for (; j < plen; ++j) {
6477  if (points[j].index === -1) continue;
6478  while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
6479  --sp;
6480  }
6481  stack[sp++] = points[j].index;
6482  }
6483  var poly = [];
6484  for (i = 0; i < sp; ++i) {
6485  poly.push(vertices[stack[i]]);
6486  }
6487  return poly;
6488  };
6489  d3.geom.polygon = function(coordinates) {
6490  coordinates.area = function() {
6491  var i = 0, n = coordinates.length, a = coordinates[n - 1][0] * coordinates[0][1], b = coordinates[n - 1][1] * coordinates[0][0];
6492  while (++i < n) {
6493  a += coordinates[i - 1][0] * coordinates[i][1];
6494  b += coordinates[i - 1][1] * coordinates[i][0];
6495  }
6496  return (b - a) * .5;
6497  };
6498  coordinates.centroid = function(k) {
6499  var i = -1, n = coordinates.length, x = 0, y = 0, a, b = coordinates[n - 1], c;
6500  if (!arguments.length) k = -1 / (6 * coordinates.area());
6501  while (++i < n) {
6502  a = b;
6503  b = coordinates[i];
6504  c = a[0] * b[1] - b[0] * a[1];
6505  x += (a[0] + b[0]) * c;
6506  y += (a[1] + b[1]) * c;
6507  }
6508  return [ x * k, y * k ];
6509  };
6510  coordinates.clip = function(subject) {
6511  var input, i = -1, n = coordinates.length, j, m, a = coordinates[n - 1], b, c, d;
6512  while (++i < n) {
6513  input = subject.slice();
6514  subject.length = 0;
6515  b = coordinates[i];
6516  c = input[(m = input.length) - 1];
6517  j = -1;
6518  while (++j < m) {
6519  d = input[j];
6520  if (d3_geom_polygonInside(d, a, b)) {
6521  if (!d3_geom_polygonInside(c, a, b)) {
6522  subject.push(d3_geom_polygonIntersect(c, d, a, b));
6523  }
6524  subject.push(d);
6525  } else if (d3_geom_polygonInside(c, a, b)) {
6526  subject.push(d3_geom_polygonIntersect(c, d, a, b));
6527  }
6528  c = d;
6529  }
6530  a = b;
6531  }
6532  return subject;
6533  };
6534  return coordinates;
6535  };
6536  d3.geom.voronoi = function(vertices) {
6537  var polygons = vertices.map(function() {
6538  return [];
6539  });
6540  d3_voronoi_tessellate(vertices, function(e) {
6541  var s1, s2, x1, x2, y1, y2;
6542  if (e.a === 1 && e.b >= 0) {
6543  s1 = e.ep.r;
6544  s2 = e.ep.l;
6545  } else {
6546  s1 = e.ep.l;
6547  s2 = e.ep.r;
6548  }
6549  if (e.a === 1) {
6550  y1 = s1 ? s1.y : -1e6;
6551  x1 = e.c - e.b * y1;
6552  y2 = s2 ? s2.y : 1e6;
6553  x2 = e.c - e.b * y2;
6554  } else {
6555  x1 = s1 ? s1.x : -1e6;
6556  y1 = e.c - e.a * x1;
6557  x2 = s2 ? s2.x : 1e6;
6558  y2 = e.c - e.a * x2;
6559  }
6560  var v1 = [ x1, y1 ], v2 = [ x2, y2 ];
6561  polygons[e.region.l.index].push(v1, v2);
6562  polygons[e.region.r.index].push(v1, v2);
6563  });
6564  return polygons.map(function(polygon, i) {
6565  var cx = vertices[i][0], cy = vertices[i][1];
6566  polygon.forEach(function(v) {
6567  v.angle = Math.atan2(v[0] - cx, v[1] - cy);
6568  });
6569  return polygon.sort(function(a, b) {
6570  return a.angle - b.angle;
6571  }).filter(function(d, i) {
6572  return !i || d.angle - polygon[i - 1].angle > 1e-10;
6573  });
6574  });
6575  };
6576  var d3_voronoi_opposite = {
6577  l: "r",
6578  r: "l"
6579  };
6580  d3.geom.delaunay = function(vertices) {
6581  var edges = vertices.map(function() {
6582  return [];
6583  }), triangles = [];
6584  d3_voronoi_tessellate(vertices, function(e) {
6585  edges[e.region.l.index].push(vertices[e.region.r.index]);
6586  });
6587  edges.forEach(function(edge, i) {
6588  var v = vertices[i], cx = v[0], cy = v[1];
6589  edge.forEach(function(v) {
6590  v.angle = Math.atan2(v[0] - cx, v[1] - cy);
6591  });
6592  edge.sort(function(a, b) {
6593  return a.angle - b.angle;
6594  });
6595  for (var j = 0, m = edge.length - 1; j < m; j++) {
6596  triangles.push([ v, edge[j], edge[j + 1] ]);
6597  }
6598  });
6599  return triangles;
6600  };
6601  d3.geom.quadtree = function(points, x1, y1, x2, y2) {
6602  function insert(n, p, x1, y1, x2, y2) {
6603  if (isNaN(p.x) || isNaN(p.y)) return;
6604  if (n.leaf) {
6605  var v = n.point;
6606  if (v) {
6607  if (Math.abs(v.x - p.x) + Math.abs(v.y - p.y) < .01) {
6608  insertChild(n, p, x1, y1, x2, y2);
6609  } else {
6610  n.point = null;
6611  insertChild(n, v, x1, y1, x2, y2);
6612  insertChild(n, p, x1, y1, x2, y2);
6613  }
6614  } else {
6615  n.point = p;
6616  }
6617  } else {
6618  insertChild(n, p, x1, y1, x2, y2);
6619  }
6620  }
6621  function insertChild(n, p, x1, y1, x2, y2) {
6622  var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = p.x >= sx, bottom = p.y >= sy, i = (bottom << 1) + right;
6623  n.leaf = false;
6624  n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
6625  if (right) x1 = sx; else x2 = sx;
6626  if (bottom) y1 = sy; else y2 = sy;
6627  insert(n, p, x1, y1, x2, y2);
6628  }
6629  var p, i = -1, n = points.length;
6630  if (n && isNaN(points[0].x)) points = points.map(d3_geom_quadtreePoint);
6631  if (arguments.length < 5) {
6632  if (arguments.length === 3) {
6633  y2 = x2 = y1;
6634  y1 = x1;
6635  } else {
6636  x1 = y1 = Infinity;
6637  x2 = y2 = -Infinity;
6638  while (++i < n) {
6639  p = points[i];
6640  if (p.x < x1) x1 = p.x;
6641  if (p.y < y1) y1 = p.y;
6642  if (p.x > x2) x2 = p.x;
6643  if (p.y > y2) y2 = p.y;
6644  }
6645  var dx = x2 - x1, dy = y2 - y1;
6646  if (dx > dy) y2 = y1 + dx; else x2 = x1 + dy;
6647  }
6648  }
6649  var root = d3_geom_quadtreeNode();
6650  root.add = function(p) {
6651  insert(root, p, x1, y1, x2, y2);
6652  };
6653  root.visit = function(f) {
6654  d3_geom_quadtreeVisit(f, root, x1, y1, x2, y2);
6655  };
6656  points.forEach(root.add);
6657  return root;
6658  };
6659  d3.time = {};
6660  var d3_time = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
6661  d3_time_utc.prototype = {
6662  getDate: function() {
6663  return this._.getUTCDate();
6664  },
6665  getDay: function() {
6666  return this._.getUTCDay();
6667  },
6668  getFullYear: function() {
6669  return this._.getUTCFullYear();
6670  },
6671  getHours: function() {
6672  return this._.getUTCHours();
6673  },
6674  getMilliseconds: function() {
6675  return this._.getUTCMilliseconds();
6676  },
6677  getMinutes: function() {
6678  return this._.getUTCMinutes();
6679  },
6680  getMonth: function() {
6681  return this._.getUTCMonth();
6682  },
6683  getSeconds: function() {
6684  return this._.getUTCSeconds();
6685  },
6686  getTime: function() {
6687  return this._.getTime();
6688  },
6689  getTimezoneOffset: function() {
6690  return 0;
6691  },
6692  valueOf: function() {
6693  return this._.valueOf();
6694  },
6695  setDate: function() {
6696  d3_time_prototype.setUTCDate.apply(this._, arguments);
6697  },
6698  setDay: function() {
6699  d3_time_prototype.setUTCDay.apply(this._, arguments);
6700  },
6701  setFullYear: function() {
6702  d3_time_prototype.setUTCFullYear.apply(this._, arguments);
6703  },
6704  setHours: function() {
6705  d3_time_prototype.setUTCHours.apply(this._, arguments);
6706  },
6707  setMilliseconds: function() {
6708  d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
6709  },
6710  setMinutes: function() {
6711  d3_time_prototype.setUTCMinutes.apply(this._, arguments);
6712  },
6713  setMonth: function() {
6714  d3_time_prototype.setUTCMonth.apply(this._, arguments);
6715  },
6716  setSeconds: function() {
6717  d3_time_prototype.setUTCSeconds.apply(this._, arguments);
6718  },
6719  setTime: function() {
6720  d3_time_prototype.setTime.apply(this._, arguments);
6721  }
6722  };
6723  var d3_time_prototype = Date.prototype;
6724  var d3_time_formatDateTime = "%a %b %e %H:%M:%S %Y", d3_time_formatDate = "%m/%d/%y", d3_time_formatTime = "%H:%M:%S";
6725  var d3_time_days = d3_time_daySymbols, d3_time_dayAbbreviations = d3_time_days.map(d3_time_formatAbbreviate), d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = d3_time_months.map(d3_time_formatAbbreviate);
6726  d3.time.format = function(template) {
6727  function format(date) {
6728  var string = [], i = -1, j = 0, c, f;
6729  while (++i < n) {
6730  if (template.charCodeAt(i) == 37) {
6731  string.push(template.substring(j, i), (f = d3_time_formats[c = template.charAt(++i)]) ? f(date) : c);
6732  j = i + 1;
6733  }
6734  }
6735  string.push(template.substring(j, i));
6736  return string.join("");
6737  }
6738  var n = template.length;
6739  format.parse = function(string) {
6740  var d = {
6741  y: 1900,
6742  m: 0,
6743  d: 1,
6744  H: 0,
6745  M: 0,
6746  S: 0,
6747  L: 0
6748  }, i = d3_time_parse(d, template, string, 0);
6749  if (i != string.length) return null;
6750  if ("p" in d) d.H = d.H % 12 + d.p * 12;
6751  var date = new d3_time;
6752  date.setFullYear(d.y, d.m, d.d);
6753  date.setHours(d.H, d.M, d.S, d.L);
6754  return date;
6755  };
6756  format.toString = function() {
6757  return template;
6758  };
6759  return format;
6760  };
6761  var d3_time_zfill2 = d3.format("02d"), d3_time_zfill3 = d3.format("03d"), d3_time_zfill4 = d3.format("04d"), d3_time_sfill2 = d3.format("2d");
6762  var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_monthRe = d3_time_formatRe(d3_time_months), d3_time_monthLookup = d3_time_formatLookup(d3_time_months), d3_time_monthAbbrevRe = d3_time_formatRe(d3_time_monthAbbreviations), d3_time_monthAbbrevLookup = d3_time_formatLookup(d3_time_monthAbbreviations);
6763  var d3_time_formats = {
6764  a: function(d) {
6765  return d3_time_dayAbbreviations[d.getDay()];
6766  },
6767  A: function(d) {
6768  return d3_time_days[d.getDay()];
6769  },
6770  b: function(d) {
6771  return d3_time_monthAbbreviations[d.getMonth()];
6772  },
6773  B: function(d) {
6774  return d3_time_months[d.getMonth()];
6775  },
6776  c: d3.time.format(d3_time_formatDateTime),
6777  d: function(d) {
6778  return d3_time_zfill2(d.getDate());
6779  },
6780  e: function(d) {
6781  return d3_time_sfill2(d.getDate());
6782  },
6783  H: function(d) {
6784  return d3_time_zfill2(d.getHours());
6785  },
6786  I: function(d) {
6787  return d3_time_zfill2(d.getHours() % 12 || 12);
6788  },
6789  j: function(d) {
6790  return d3_time_zfill3(1 + d3.time.dayOfYear(d));
6791  },
6792  L: function(d) {
6793  return d3_time_zfill3(d.getMilliseconds());
6794  },
6795  m: function(d) {
6796  return d3_time_zfill2(d.getMonth() + 1);
6797  },
6798  M: function(d) {
6799  return d3_time_zfill2(d.getMinutes());
6800  },
6801  p: function(d) {
6802  return d.getHours() >= 12 ? "PM" : "AM";
6803  },
6804  S: function(d) {
6805  return d3_time_zfill2(d.getSeconds());
6806  },
6807  U: function(d) {
6808  return d3_time_zfill2(d3.time.sundayOfYear(d));
6809  },
6810  w: function(d) {
6811  return d.getDay();
6812  },
6813  W: function(d) {
6814  return d3_time_zfill2(d3.time.mondayOfYear(d));
6815  },
6816  x: d3.time.format(d3_time_formatDate),
6817  X: d3.time.format(d3_time_formatTime),
6818  y: function(d) {
6819  return d3_time_zfill2(d.getFullYear() % 100);
6820  },
6821  Y: function(d) {
6822  return d3_time_zfill4(d.getFullYear() % 1e4);
6823  },
6824  Z: d3_time_zone,
6825  "%": function(d) {
6826  return "%";
6827  }
6828  };
6829  var d3_time_parsers = {
6830  a: d3_time_parseWeekdayAbbrev,
6831  A: d3_time_parseWeekday,
6832  b: d3_time_parseMonthAbbrev,
6833  B: d3_time_parseMonth,
6834  c: d3_time_parseLocaleFull,
6835  d: d3_time_parseDay,
6836  e: d3_time_parseDay,
6837  H: d3_time_parseHour24,
6838  I: d3_time_parseHour24,
6839  L: d3_time_parseMilliseconds,
6840  m: d3_time_parseMonthNumber,
6841  M: d3_time_parseMinutes,
6842  p: d3_time_parseAmPm,
6843  S: d3_time_parseSeconds,
6844  x: d3_time_parseLocaleDate,
6845  X: d3_time_parseLocaleTime,
6846  y: d3_time_parseYear,
6847  Y: d3_time_parseFullYear
6848  };
6849  var d3_time_numberRe = /^\s*\d+/;
6850  var d3_time_amPmLookup = d3.map({
6851  am: 0,
6852  pm: 1
6853  });
6854  d3.time.format.utc = function(template) {
6855  function format(date) {
6856  try {
6857  d3_time = d3_time_utc;
6858  var utc = new d3_time;
6859  utc._ = date;
6860  return local(utc);
6861  } finally {
6862  d3_time = Date;
6863  }
6864  }
6865  var local = d3.time.format(template);
6866  format.parse = function(string) {
6867  try {
6868  d3_time = d3_time_utc;
6869  var date = local.parse(string);
6870  return date && date._;
6871  } finally {
6872  d3_time = Date;
6873  }
6874  };
6875  format.toString = local.toString;
6876  return format;
6877  };
6878  var d3_time_formatIso = d3.time.format.utc("%Y-%m-%dT%H:%M:%S.%LZ");
6879  d3.time.format.iso = Date.prototype.toISOString ? d3_time_formatIsoNative : d3_time_formatIso;
6880  d3_time_formatIsoNative.parse = function(string) {
6881  var date = new Date(string);
6882  return isNaN(date) ? null : date;
6883  };
6884  d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
6885  d3.time.second = d3_time_interval(function(date) {
6886  return new d3_time(Math.floor(date / 1e3) * 1e3);
6887  }, function(date, offset) {
6888  date.setTime(date.getTime() + Math.floor(offset) * 1e3);
6889  }, function(date) {
6890  return date.getSeconds();
6891  });
6892  d3.time.seconds = d3.time.second.range;
6893  d3.time.seconds.utc = d3.time.second.utc.range;
6894  d3.time.minute = d3_time_interval(function(date) {
6895  return new d3_time(Math.floor(date / 6e4) * 6e4);
6896  }, function(date, offset) {
6897  date.setTime(date.getTime() + Math.floor(offset) * 6e4);
6898  }, function(date) {
6899  return date.getMinutes();
6900  });
6901  d3.time.minutes = d3.time.minute.range;
6902  d3.time.minutes.utc = d3.time.minute.utc.range;
6903  d3.time.hour = d3_time_interval(function(date) {
6904  var timezone = date.getTimezoneOffset() / 60;
6905  return new d3_time((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
6906  }, function(date, offset) {
6907  date.setTime(date.getTime() + Math.floor(offset) * 36e5);
6908  }, function(date) {
6909  return date.getHours();
6910  });
6911  d3.time.hours = d3.time.hour.range;
6912  d3.time.hours.utc = d3.time.hour.utc.range;
6913  d3.time.day = d3_time_interval(function(date) {
6914  var day = new d3_time(1970, 0);
6915  day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
6916  return day;
6917  }, function(date, offset) {
6918  date.setDate(date.getDate() + offset);
6919  }, function(date) {
6920  return date.getDate() - 1;
6921  });
6922  d3.time.days = d3.time.day.range;
6923  d3.time.days.utc = d3.time.day.utc.range;
6924  d3.time.dayOfYear = function(date) {
6925  var year = d3.time.year(date);
6926  return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
6927  };
6928  d3_time_daySymbols.forEach(function(day, i) {
6929  day = day.toLowerCase();
6930  i = 7 - i;
6931  var interval = d3.time[day] = d3_time_interval(function(date) {
6932  (date = d3.time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
6933  return date;
6934  }, function(date, offset) {
6935  date.setDate(date.getDate() + Math.floor(offset) * 7);
6936  }, function(date) {
6937  var day = d3.time.year(date).getDay();
6938  return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
6939  });
6940  d3.time[day + "s"] = interval.range;
6941  d3.time[day + "s"].utc = interval.utc.range;
6942  d3.time[day + "OfYear"] = function(date) {
6943  var day = d3.time.year(date).getDay();
6944  return Math.floor((d3.time.dayOfYear(date) + (day + i) % 7) / 7);
6945  };
6946  });
6947  d3.time.week = d3.time.sunday;
6948  d3.time.weeks = d3.time.sunday.range;
6949  d3.time.weeks.utc = d3.time.sunday.utc.range;
6950  d3.time.weekOfYear = d3.time.sundayOfYear;
6951  d3.time.month = d3_time_interval(function(date) {
6952  date = d3.time.day(date);
6953  date.setDate(1);
6954  return date;
6955  }, function(date, offset) {
6956  date.setMonth(date.getMonth() + offset);
6957  }, function(date) {
6958  return date.getMonth();
6959  });
6960  d3.time.months = d3.time.month.range;
6961  d3.time.months.utc = d3.time.month.utc.range;
6962  d3.time.year = d3_time_interval(function(date) {
6963  date = d3.time.day(date);
6964  date.setMonth(0, 1);
6965  return date;
6966  }, function(date, offset) {
6967  date.setFullYear(date.getFullYear() + offset);
6968  }, function(date) {
6969  return date.getFullYear();
6970  });
6971  d3.time.years = d3.time.year.range;
6972  d3.time.years.utc = d3.time.year.utc.range;
6973  var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
6974  var d3_time_scaleLocalMethods = [ [ d3.time.second, 1 ], [ d3.time.second, 5 ], [ d3.time.second, 15 ], [ d3.time.second, 30 ], [ d3.time.minute, 1 ], [ d3.time.minute, 5 ], [ d3.time.minute, 15 ], [ d3.time.minute, 30 ], [ d3.time.hour, 1 ], [ d3.time.hour, 3 ], [ d3.time.hour, 6 ], [ d3.time.hour, 12 ], [ d3.time.day, 1 ], [ d3.time.day, 2 ], [ d3.time.week, 1 ], [ d3.time.month, 1 ], [ d3.time.month, 3 ], [ d3.time.year, 1 ] ];
6975  var d3_time_scaleLocalFormats = [ [ d3.time.format("%Y"), function(d) {
6976  return true;
6977  } ], [ d3.time.format("%B"), function(d) {
6978  return d.getMonth();
6979  } ], [ d3.time.format("%b %d"), function(d) {
6980  return d.getDate() != 1;
6981  } ], [ d3.time.format("%a %d"), function(d) {
6982  return d.getDay() && d.getDate() != 1;
6983  } ], [ d3.time.format("%I %p"), function(d) {
6984  return d.getHours();
6985  } ], [ d3.time.format("%I:%M"), function(d) {
6986  return d.getMinutes();
6987  } ], [ d3.time.format(":%S"), function(d) {
6988  return d.getSeconds();
6989  } ], [ d3.time.format(".%L"), function(d) {
6990  return d.getMilliseconds();
6991  } ] ];
6992  var d3_time_scaleLinear = d3.scale.linear(), d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
6993  d3_time_scaleLocalMethods.year = function(extent, m) {
6994  return d3_time_scaleLinear.domain(extent.map(d3_time_scaleGetYear)).ticks(m).map(d3_time_scaleSetYear);
6995  };
6996  d3.time.scale = function() {
6997  return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
6998  };
6999  var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
7000  return [ m[0].utc, m[1] ];
7001  });
7002  var d3_time_scaleUTCFormats = [ [ d3.time.format.utc("%Y"), function(d) {
7003  return true;
7004  } ], [ d3.time.format.utc("%B"), function(d) {
7005  return d.getUTCMonth();
7006  } ], [ d3.time.format.utc("%b %d"), function(d) {
7007  return d.getUTCDate() != 1;
7008  } ], [ d3.time.format.utc("%a %d"), function(d) {
7009  return d.getUTCDay() && d.getUTCDate() != 1;
7010  } ], [ d3.time.format.utc("%I %p"), function(d) {
7011  return d.getUTCHours();
7012  } ], [ d3.time.format.utc("%I:%M"), function(d) {
7013  return d.getUTCMinutes();
7014  } ], [ d3.time.format.utc(":%S"), function(d) {
7015  return d.getUTCSeconds();
7016  } ], [ d3.time.format.utc(".%L"), function(d) {
7017  return d.getUTCMilliseconds();
7018  } ] ];
7019  var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
7020  d3_time_scaleUTCMethods.year = function(extent, m) {
7021  return d3_time_scaleLinear.domain(extent.map(d3_time_scaleUTCGetYear)).ticks(m).map(d3_time_scaleUTCSetYear);
7022  };
7023  d3.time.scale.utc = function() {
7024  return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
7025  };
7026 })();