Passed
Push — master ( 1713a6...bcb549 )
by Peter
02:05
created

FuzzEd/static/lib/d3/d3-3.3.11.js   F

Complexity

Total Complexity 3315
Complexity/F 2.22

Size

Lines of Code 9275
Function Count 1491

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
dl 0
loc 9275
rs 2.4
c 0
b 0
f 0
wmc 3315
nc 0
mnd 8
bc 2128
fnc 1491
bpm 1.4272
cpm 2.2233
noi 352

How to fix   Complexity   

Complexity

Complex classes like FuzzEd/static/lib/d3/d3-3.3.11.js often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

1
d3 = function() {
2
  var d3 = {
3
    version: "3.3.11"
4
  };
5
  if (!Date.now) Date.now = function() {
6
    return +new Date();
7
  };
8
  var d3_arraySlice = [].slice, d3_array = function(list) {
9
    return d3_arraySlice.call(list);
10
  };
11
  var d3_document = document, d3_documentElement = d3_document.documentElement, d3_window = window;
12
  try {
13
    d3_array(d3_documentElement.childNodes)[0].nodeType;
14
  } catch (e) {
15
    d3_array = function(list) {
16
      var i = list.length, array = new Array(i);
17
      while (i--) array[i] = list[i];
18
      return array;
19
    };
20
  }
21
  try {
22
    d3_document.createElement("div").style.setProperty("opacity", 0, "");
23
  } catch (error) {
24
    var d3_element_prototype = d3_window.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = d3_window.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
25
    d3_element_prototype.setAttribute = function(name, value) {
26
      d3_element_setAttribute.call(this, name, value + "");
27
    };
28
    d3_element_prototype.setAttributeNS = function(space, local, value) {
29
      d3_element_setAttributeNS.call(this, space, local, value + "");
30
    };
31
    d3_style_prototype.setProperty = function(name, value, priority) {
32
      d3_style_setProperty.call(this, name, value + "", priority);
33
    };
34
  }
35
  d3.ascending = function(a, b) {
36
    return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
37
  };
38
  d3.descending = function(a, b) {
39
    return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
40
  };
41
  d3.min = function(array, f) {
42
    var i = -1, n = array.length, a, b;
43
    if (arguments.length === 1) {
44
      while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
45
      while (++i < n) if ((b = array[i]) != null && a > b) a = b;
46
    } else {
47
      while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
48
      while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
49
    }
50
    return a;
51
  };
52
  d3.max = function(array, f) {
53
    var i = -1, n = array.length, a, b;
54
    if (arguments.length === 1) {
55
      while (++i < n && !((a = array[i]) != null && a <= a)) a = undefined;
56
      while (++i < n) if ((b = array[i]) != null && b > a) a = b;
57
    } else {
58
      while (++i < n && !((a = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
59
      while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
60
    }
61
    return a;
62
  };
63
  d3.extent = function(array, f) {
64
    var i = -1, n = array.length, a, b, c;
65
    if (arguments.length === 1) {
66
      while (++i < n && !((a = c = array[i]) != null && a <= a)) a = c = undefined;
67
      while (++i < n) if ((b = array[i]) != null) {
68
        if (a > b) a = b;
69
        if (c < b) c = b;
70
      }
71
    } else {
72
      while (++i < n && !((a = c = f.call(array, array[i], i)) != null && a <= a)) a = undefined;
73
      while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
74
        if (a > b) a = b;
75
        if (c < b) c = b;
76
      }
77
    }
78
    return [ a, c ];
79
  };
80
  d3.sum = function(array, f) {
81
    var s = 0, n = array.length, a, i = -1;
82
    if (arguments.length === 1) {
83
      while (++i < n) if (!isNaN(a = +array[i])) s += a;
84
    } else {
85
      while (++i < n) if (!isNaN(a = +f.call(array, array[i], i))) s += a;
86
    }
87
    return s;
88
  };
89
  function d3_number(x) {
90
    return x != null && !isNaN(x);
91
  }
92
  d3.mean = function(array, f) {
93
    var n = array.length, a, m = 0, i = -1, j = 0;
94
    if (arguments.length === 1) {
95
      while (++i < n) if (d3_number(a = array[i])) m += (a - m) / ++j;
96
    } else {
97
      while (++i < n) if (d3_number(a = f.call(array, array[i], i))) m += (a - m) / ++j;
98
    }
99
    return j ? m : undefined;
100
  };
101
  d3.quantile = function(values, p) {
102
    var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
103
    return e ? v + e * (values[h] - v) : v;
104
  };
105
  d3.median = function(array, f) {
106
    if (arguments.length > 1) array = array.map(f);
107
    array = array.filter(d3_number);
108
    return array.length ? d3.quantile(array.sort(d3.ascending), .5) : undefined;
109
  };
110
  d3.bisector = function(f) {
111
    return {
112
      left: function(a, x, lo, hi) {
113
        if (arguments.length < 3) lo = 0;
114
        if (arguments.length < 4) hi = a.length;
115
        while (lo < hi) {
116
          var mid = lo + hi >>> 1;
117
          if (f.call(a, a[mid], mid) < x) lo = mid + 1; else hi = mid;
118
        }
119
        return lo;
120
      },
121
      right: function(a, x, lo, hi) {
122
        if (arguments.length < 3) lo = 0;
123
        if (arguments.length < 4) hi = a.length;
124
        while (lo < hi) {
125
          var mid = lo + hi >>> 1;
126
          if (x < f.call(a, a[mid], mid)) hi = mid; else lo = mid + 1;
127
        }
128
        return lo;
129
      }
130
    };
131
  };
132
  var d3_bisector = d3.bisector(function(d) {
133
    return d;
134
  });
135
  d3.bisectLeft = d3_bisector.left;
136
  d3.bisect = d3.bisectRight = d3_bisector.right;
137
  d3.shuffle = function(array) {
138
    var m = array.length, t, i;
139
    while (m) {
140
      i = Math.random() * m-- | 0;
141
      t = array[m], array[m] = array[i], array[i] = t;
142
    }
143
    return array;
144
  };
145
  d3.permute = function(array, indexes) {
146
    var i = indexes.length, permutes = new Array(i);
147
    while (i--) permutes[i] = array[indexes[i]];
148
    return permutes;
149
  };
150
  d3.pairs = function(array) {
151
    var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
152
    while (i < n) pairs[i] = [ p0 = p1, p1 = array[++i] ];
153
    return pairs;
154
  };
155
  d3.zip = function() {
156
    if (!(n = arguments.length)) return [];
157
    for (var i = -1, m = d3.min(arguments, d3_zipLength), zips = new Array(m); ++i < m; ) {
158
      for (var j = -1, n, zip = zips[i] = new Array(n); ++j < n; ) {
159
        zip[j] = arguments[j][i];
160
      }
161
    }
162
    return zips;
163
  };
164
  function d3_zipLength(d) {
165
    return d.length;
166
  }
167
  d3.transpose = function(matrix) {
168
    return d3.zip.apply(d3, matrix);
169
  };
170
  d3.keys = function(map) {
171
    var keys = [];
172
    for (var key in map) keys.push(key);
173
    return keys;
174
  };
175
  d3.values = function(map) {
176
    var values = [];
177
    for (var key in map) values.push(map[key]);
178
    return values;
179
  };
180
  d3.entries = function(map) {
181
    var entries = [];
182
    for (var key in map) entries.push({
183
      key: key,
184
      value: map[key]
185
    });
186
    return entries;
187
  };
188
  d3.merge = function(arrays) {
189
    var n = arrays.length, m, i = -1, j = 0, merged, array;
190
    while (++i < n) j += arrays[i].length;
191
    merged = new Array(j);
192
    while (--n >= 0) {
193
      array = arrays[n];
194
      m = array.length;
195
      while (--m >= 0) {
196
        merged[--j] = array[m];
197
      }
198
    }
199
    return merged;
200
  };
201
  var abs = Math.abs;
202
  d3.range = function(start, stop, step) {
203
    if (arguments.length < 3) {
204
      step = 1;
205
      if (arguments.length < 2) {
206
        stop = start;
207
        start = 0;
208
      }
209
    }
210
    if ((stop - start) / step === Infinity) throw new Error("infinite range");
211
    var range = [], k = d3_range_integerScale(abs(step)), i = -1, j;
212
    start *= k, stop *= k, step *= k;
213
    if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k); else while ((j = start + step * ++i) < stop) range.push(j / k);
214
    return range;
215
  };
216
  function d3_range_integerScale(x) {
217
    var k = 1;
218
    while (x * k % 1) k *= 10;
219
    return k;
220
  }
221
  function d3_class(ctor, properties) {
222
    try {
223
      for (var key in properties) {
224
        Object.defineProperty(ctor.prototype, key, {
225
          value: properties[key],
226
          enumerable: false
227
        });
228
      }
229
    } catch (e) {
230
      ctor.prototype = properties;
231
    }
232
  }
233
  d3.map = function(object) {
234
    var map = new d3_Map();
235
    if (object instanceof d3_Map) object.forEach(function(key, value) {
236
      map.set(key, value);
237
    }); else for (var key in object) map.set(key, object[key]);
238
    return map;
239
  };
240
  function d3_Map() {}
241
  d3_class(d3_Map, {
242
    has: function(key) {
243
      return d3_map_prefix + key in this;
244
    },
245
    get: function(key) {
246
      return this[d3_map_prefix + key];
247
    },
248
    set: function(key, value) {
249
      return this[d3_map_prefix + key] = value;
250
    },
251
    remove: function(key) {
252
      key = d3_map_prefix + key;
253
      return key in this && delete this[key];
254
    },
255
    keys: function() {
256
      var keys = [];
257
      this.forEach(function(key) {
258
        keys.push(key);
259
      });
260
      return keys;
261
    },
262
    values: function() {
263
      var values = [];
264
      this.forEach(function(key, value) {
265
        values.push(value);
266
      });
267
      return values;
268
    },
269
    entries: function() {
270
      var entries = [];
271
      this.forEach(function(key, value) {
272
        entries.push({
273
          key: key,
274
          value: value
275
        });
276
      });
277
      return entries;
278
    },
279
    forEach: function(f) {
280
      for (var key in this) {
281
        if (key.charCodeAt(0) === d3_map_prefixCode) {
282
          f.call(this, key.substring(1), this[key]);
283
        }
284
      }
285
    }
286
  });
287
  var d3_map_prefix = "\x00", d3_map_prefixCode = d3_map_prefix.charCodeAt(0);
288
  d3.nest = function() {
289
    var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
290
    function map(mapType, array, depth) {
291
      if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
292
      var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;
293
      while (++i < n) {
294
        if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
295
          values.push(object);
296
        } else {
297
          valuesByKey.set(keyValue, [ object ]);
298
        }
299
      }
300
      if (mapType) {
301
        object = mapType();
302
        setter = function(keyValue, values) {
303
          object.set(keyValue, map(mapType, values, depth));
304
        };
305
      } else {
306
        object = {};
307
        setter = function(keyValue, values) {
308
          object[keyValue] = map(mapType, values, depth);
309
        };
310
      }
311
      valuesByKey.forEach(setter);
312
      return object;
313
    }
314
    function entries(map, depth) {
315
      if (depth >= keys.length) return map;
316
      var array = [], sortKey = sortKeys[depth++];
317
      map.forEach(function(key, keyMap) {
318
        array.push({
319
          key: key,
320
          values: entries(keyMap, depth)
321
        });
322
      });
323
      return sortKey ? array.sort(function(a, b) {
324
        return sortKey(a.key, b.key);
325
      }) : array;
326
    }
327
    nest.map = function(array, mapType) {
328
      return map(mapType, array, 0);
329
    };
330
    nest.entries = function(array) {
331
      return entries(map(d3.map, array, 0), 0);
332
    };
333
    nest.key = function(d) {
334
      keys.push(d);
335
      return nest;
336
    };
337
    nest.sortKeys = function(order) {
338
      sortKeys[keys.length - 1] = order;
339
      return nest;
340
    };
341
    nest.sortValues = function(order) {
342
      sortValues = order;
343
      return nest;
344
    };
345
    nest.rollup = function(f) {
346
      rollup = f;
347
      return nest;
348
    };
349
    return nest;
350
  };
351
  d3.set = function(array) {
352
    var set = new d3_Set();
353
    if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
354
    return set;
355
  };
356
  function d3_Set() {}
357
  d3_class(d3_Set, {
358
    has: function(value) {
359
      return d3_map_prefix + value in this;
360
    },
361
    add: function(value) {
362
      this[d3_map_prefix + value] = true;
363
      return value;
364
    },
365
    remove: function(value) {
366
      value = d3_map_prefix + value;
367
      return value in this && delete this[value];
368
    },
369
    values: function() {
370
      var values = [];
371
      this.forEach(function(value) {
372
        values.push(value);
373
      });
374
      return values;
375
    },
376
    forEach: function(f) {
377
      for (var value in this) {
378
        if (value.charCodeAt(0) === d3_map_prefixCode) {
379
          f.call(this, value.substring(1));
380
        }
381
      }
382
    }
383
  });
384
  d3.behavior = {};
385
  d3.rebind = function(target, source) {
386
    var i = 1, n = arguments.length, method;
387
    while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
388
    return target;
389
  };
390
  function d3_rebind(target, source, method) {
391
    return function() {
392
      var value = method.apply(source, arguments);
393
      return value === source ? target : value;
394
    };
395
  }
396
  function d3_vendorSymbol(object, name) {
397
    if (name in object) return name;
398
    name = name.charAt(0).toUpperCase() + name.substring(1);
399
    for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
400
      var prefixName = d3_vendorPrefixes[i] + name;
401
      if (prefixName in object) return prefixName;
402
    }
403
  }
404
  var d3_vendorPrefixes = [ "webkit", "ms", "moz", "Moz", "o", "O" ];
405
  function d3_noop() {}
406
  d3.dispatch = function() {
407
    var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
408
    while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
409
    return dispatch;
410
  };
411
  function d3_dispatch() {}
412
  d3_dispatch.prototype.on = function(type, listener) {
413
    var i = type.indexOf("."), name = "";
414
    if (i >= 0) {
415
      name = type.substring(i + 1);
416
      type = type.substring(0, i);
417
    }
418
    if (type) return arguments.length < 2 ? this[type].on(name) : this[type].on(name, listener);
419
    if (arguments.length === 2) {
420
      if (listener == null) for (type in this) {
421
        if (this.hasOwnProperty(type)) this[type].on(name, null);
422
      }
423
      return this;
424
    }
425
  };
426
  function d3_dispatch_event(dispatch) {
427
    var listeners = [], listenerByName = new d3_Map();
428
    function event() {
429
      var z = listeners, i = -1, n = z.length, l;
430
      while (++i < n) if (l = z[i].on) l.apply(this, arguments);
431
      return dispatch;
432
    }
433
    event.on = function(name, listener) {
434
      var l = listenerByName.get(name), i;
435
      if (arguments.length < 2) return l && l.on;
436
      if (l) {
437
        l.on = null;
438
        listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
439
        listenerByName.remove(name);
440
      }
441
      if (listener) listeners.push(listenerByName.set(name, {
442
        on: listener
443
      }));
444
      return dispatch;
445
    };
446
    return event;
447
  }
448
  d3.event = null;
449
  function d3_eventPreventDefault() {
450
    d3.event.preventDefault();
451
  }
452
  function d3_eventSource() {
453
    var e = d3.event, s;
454
    while (s = e.sourceEvent) e = s;
455
    return e;
456
  }
457
  function d3_eventDispatch(target) {
458
    var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
459
    while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
460
    dispatch.of = function(thiz, argumentz) {
461
      return function(e1) {
462
        try {
463
          var e0 = e1.sourceEvent = d3.event;
464
          e1.target = target;
465
          d3.event = e1;
466
          dispatch[e1.type].apply(thiz, argumentz);
467
        } finally {
468
          d3.event = e0;
469
        }
470
      };
471
    };
472
    return dispatch;
473
  }
474
  d3.requote = function(s) {
475
    return s.replace(d3_requote_re, "\\$&");
476
  };
477
  var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
478
  var d3_subclass = {}.__proto__ ? function(object, prototype) {
479
    object.__proto__ = prototype;
480
  } : function(object, prototype) {
481
    for (var property in prototype) object[property] = prototype[property];
482
  };
483
  function d3_selection(groups) {
484
    d3_subclass(groups, d3_selectionPrototype);
485
    return groups;
486
  }
487
  var d3_select = function(s, n) {
488
    return n.querySelector(s);
489
  }, d3_selectAll = function(s, n) {
490
    return n.querySelectorAll(s);
491
  }, d3_selectMatcher = d3_documentElement[d3_vendorSymbol(d3_documentElement, "matchesSelector")], d3_selectMatches = function(n, s) {
492
    return d3_selectMatcher.call(n, s);
493
  };
494
  if (typeof Sizzle === "function") {
495
    d3_select = function(s, n) {
496
      return Sizzle(s, n)[0] || null;
497
    };
498
    d3_selectAll = function(s, n) {
499
      return Sizzle.uniqueSort(Sizzle(s, n));
500
    };
501
    d3_selectMatches = Sizzle.matchesSelector;
502
  }
503
  d3.selection = function() {
504
    return d3_selectionRoot;
505
  };
506
  var d3_selectionPrototype = d3.selection.prototype = [];
507
  d3_selectionPrototype.select = function(selector) {
508
    var subgroups = [], subgroup, subnode, group, node;
509
    selector = d3_selection_selector(selector);
510
    for (var j = -1, m = this.length; ++j < m; ) {
511
      subgroups.push(subgroup = []);
512
      subgroup.parentNode = (group = this[j]).parentNode;
513
      for (var i = -1, n = group.length; ++i < n; ) {
514
        if (node = group[i]) {
515
          subgroup.push(subnode = selector.call(node, node.__data__, i, j));
516
          if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
517
        } else {
518
          subgroup.push(null);
519
        }
520
      }
521
    }
522
    return d3_selection(subgroups);
523
  };
524
  function d3_selection_selector(selector) {
525
    return typeof selector === "function" ? selector : function() {
526
      return d3_select(selector, this);
527
    };
528
  }
529
  d3_selectionPrototype.selectAll = function(selector) {
530
    var subgroups = [], subgroup, node;
531
    selector = d3_selection_selectorAll(selector);
532
    for (var j = -1, m = this.length; ++j < m; ) {
533
      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
534
        if (node = group[i]) {
535
          subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j)));
536
          subgroup.parentNode = node;
537
        }
538
      }
539
    }
540
    return d3_selection(subgroups);
541
  };
542
  function d3_selection_selectorAll(selector) {
543
    return typeof selector === "function" ? selector : function() {
544
      return d3_selectAll(selector, this);
545
    };
546
  }
547
  var d3_nsPrefix = {
548
    svg: "http://www.w3.org/2000/svg",
549
    xhtml: "http://www.w3.org/1999/xhtml",
550
    xlink: "http://www.w3.org/1999/xlink",
551
    xml: "http://www.w3.org/XML/1998/namespace",
552
    xmlns: "http://www.w3.org/2000/xmlns/"
553
  };
554
  d3.ns = {
555
    prefix: d3_nsPrefix,
556
    qualify: function(name) {
557
      var i = name.indexOf(":"), prefix = name;
558
      if (i >= 0) {
559
        prefix = name.substring(0, i);
560
        name = name.substring(i + 1);
561
      }
562
      return d3_nsPrefix.hasOwnProperty(prefix) ? {
563
        space: d3_nsPrefix[prefix],
564
        local: name
565
      } : name;
566
    }
567
  };
568
  d3_selectionPrototype.attr = function(name, value) {
569
    if (arguments.length < 2) {
570
      if (typeof name === "string") {
571
        var node = this.node();
572
        name = d3.ns.qualify(name);
573
        return name.local ? node.getAttributeNS(name.space, name.local) : node.getAttribute(name);
574
      }
575
      for (value in name) this.each(d3_selection_attr(value, name[value]));
576
      return this;
577
    }
578
    return this.each(d3_selection_attr(name, value));
579
  };
580
  function d3_selection_attr(name, value) {
581
    name = d3.ns.qualify(name);
582
    function attrNull() {
583
      this.removeAttribute(name);
584
    }
585
    function attrNullNS() {
586
      this.removeAttributeNS(name.space, name.local);
587
    }
588
    function attrConstant() {
589
      this.setAttribute(name, value);
590
    }
591
    function attrConstantNS() {
592
      this.setAttributeNS(name.space, name.local, value);
593
    }
594
    function attrFunction() {
595
      var x = value.apply(this, arguments);
596
      if (x == null) this.removeAttribute(name); else this.setAttribute(name, x);
597
    }
598
    function attrFunctionNS() {
599
      var x = value.apply(this, arguments);
600
      if (x == null) this.removeAttributeNS(name.space, name.local); else this.setAttributeNS(name.space, name.local, x);
601
    }
602
    return value == null ? name.local ? attrNullNS : attrNull : typeof value === "function" ? name.local ? attrFunctionNS : attrFunction : name.local ? attrConstantNS : attrConstant;
603
  }
604
  function d3_collapse(s) {
605
    return s.trim().replace(/\s+/g, " ");
606
  }
607
  d3_selectionPrototype.classed = function(name, value) {
608
    if (arguments.length < 2) {
609
      if (typeof name === "string") {
610
        var node = this.node(), n = (name = name.trim().split(/^|\s+/g)).length, i = -1;
611
        if (value = node.classList) {
612
          while (++i < n) if (!value.contains(name[i])) return false;
613
        } else {
614
          value = node.getAttribute("class");
615
          while (++i < n) if (!d3_selection_classedRe(name[i]).test(value)) return false;
616
        }
617
        return true;
618
      }
619
      for (value in name) this.each(d3_selection_classed(value, name[value]));
620
      return this;
621
    }
622
    return this.each(d3_selection_classed(name, value));
623
  };
624
  function d3_selection_classedRe(name) {
625
    return new RegExp("(?:^|\\s+)" + d3.requote(name) + "(?:\\s+|$)", "g");
626
  }
627
  function d3_selection_classed(name, value) {
628
    name = name.trim().split(/\s+/).map(d3_selection_classedName);
629
    var n = name.length;
630
    function classedConstant() {
631
      var i = -1;
632
      while (++i < n) name[i](this, value);
633
    }
634
    function classedFunction() {
635
      var i = -1, x = value.apply(this, arguments);
636
      while (++i < n) name[i](this, x);
637
    }
638
    return typeof value === "function" ? classedFunction : classedConstant;
639
  }
640
  function d3_selection_classedName(name) {
641
    var re = d3_selection_classedRe(name);
642
    return function(node, value) {
643
      if (c = node.classList) return value ? c.add(name) : c.remove(name);
644
      var c = node.getAttribute("class") || "";
645
      if (value) {
646
        re.lastIndex = 0;
647
        if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name));
648
      } else {
649
        node.setAttribute("class", d3_collapse(c.replace(re, " ")));
650
      }
651
    };
652
  }
653
  d3_selectionPrototype.style = function(name, value, priority) {
654
    var n = arguments.length;
655
    if (n < 3) {
656
      if (typeof name !== "string") {
657
        if (n < 2) value = "";
658
        for (priority in name) this.each(d3_selection_style(priority, name[priority], value));
659
        return this;
660
      }
661
      if (n < 2) return d3_window.getComputedStyle(this.node(), null).getPropertyValue(name);
662
      priority = "";
663
    }
664
    return this.each(d3_selection_style(name, value, priority));
665
  };
666
  function d3_selection_style(name, value, priority) {
667
    function styleNull() {
668
      this.style.removeProperty(name);
669
    }
670
    function styleConstant() {
671
      this.style.setProperty(name, value, priority);
672
    }
673
    function styleFunction() {
674
      var x = value.apply(this, arguments);
675
      if (x == null) this.style.removeProperty(name); else this.style.setProperty(name, x, priority);
676
    }
677
    return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
678
  }
679
  d3_selectionPrototype.property = function(name, value) {
680
    if (arguments.length < 2) {
681
      if (typeof name === "string") return this.node()[name];
682
      for (value in name) this.each(d3_selection_property(value, name[value]));
683
      return this;
684
    }
685
    return this.each(d3_selection_property(name, value));
686
  };
687
  function d3_selection_property(name, value) {
688
    function propertyNull() {
689
      delete this[name];
690
    }
691
    function propertyConstant() {
692
      this[name] = value;
693
    }
694
    function propertyFunction() {
695
      var x = value.apply(this, arguments);
696
      if (x == null) delete this[name]; else this[name] = x;
697
    }
698
    return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
699
  }
700
  d3_selectionPrototype.text = function(value) {
701
    return arguments.length ? this.each(typeof value === "function" ? function() {
702
      var v = value.apply(this, arguments);
703
      this.textContent = v == null ? "" : v;
704
    } : value == null ? function() {
705
      this.textContent = "";
706
    } : function() {
707
      this.textContent = value;
708
    }) : this.node().textContent;
709
  };
710
  d3_selectionPrototype.html = function(value) {
711
    return arguments.length ? this.each(typeof value === "function" ? function() {
712
      var v = value.apply(this, arguments);
713
      this.innerHTML = v == null ? "" : v;
714
    } : value == null ? function() {
715
      this.innerHTML = "";
716
    } : function() {
717
      this.innerHTML = value;
718
    }) : this.node().innerHTML;
719
  };
720
  d3_selectionPrototype.append = function(name) {
721
    name = d3_selection_creator(name);
722
    return this.select(function() {
723
      return this.appendChild(name.apply(this, arguments));
724
    });
725
  };
726
  function d3_selection_creator(name) {
727
    return typeof name === "function" ? name : (name = d3.ns.qualify(name)).local ? function() {
728
      return this.ownerDocument.createElementNS(name.space, name.local);
729
    } : function() {
730
      return this.ownerDocument.createElementNS(this.namespaceURI, name);
731
    };
732
  }
733
  d3_selectionPrototype.insert = function(name, before) {
734
    name = d3_selection_creator(name);
735
    before = d3_selection_selector(before);
736
    return this.select(function() {
737
      return this.insertBefore(name.apply(this, arguments), before.apply(this, arguments) || null);
738
    });
739
  };
740
  d3_selectionPrototype.remove = function() {
741
    return this.each(function() {
742
      var parent = this.parentNode;
743
      if (parent) parent.removeChild(this);
744
    });
745
  };
746
  d3_selectionPrototype.data = function(value, key) {
747
    var i = -1, n = this.length, group, node;
748
    if (!arguments.length) {
749
      value = new Array(n = (group = this[0]).length);
750
      while (++i < n) {
751
        if (node = group[i]) {
752
          value[i] = node.__data__;
753
        }
754
      }
755
      return value;
756
    }
757
    function bind(group, groupData) {
758
      var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n), node, nodeData;
759
      if (key) {
760
        var nodeByKeyValue = new d3_Map(), dataByKeyValue = new d3_Map(), keyValues = [], keyValue;
761
        for (i = -1; ++i < n; ) {
762
          keyValue = key.call(node = group[i], node.__data__, i);
763
          if (nodeByKeyValue.has(keyValue)) {
764
            exitNodes[i] = node;
765
          } else {
766
            nodeByKeyValue.set(keyValue, node);
767
          }
768
          keyValues.push(keyValue);
769
        }
770
        for (i = -1; ++i < m; ) {
771
          keyValue = key.call(groupData, nodeData = groupData[i], i);
772
          if (node = nodeByKeyValue.get(keyValue)) {
773
            updateNodes[i] = node;
774
            node.__data__ = nodeData;
775
          } else if (!dataByKeyValue.has(keyValue)) {
776
            enterNodes[i] = d3_selection_dataNode(nodeData);
777
          }
778
          dataByKeyValue.set(keyValue, nodeData);
779
          nodeByKeyValue.remove(keyValue);
780
        }
781
        for (i = -1; ++i < n; ) {
782
          if (nodeByKeyValue.has(keyValues[i])) {
783
            exitNodes[i] = group[i];
784
          }
785
        }
786
      } else {
787
        for (i = -1; ++i < n0; ) {
788
          node = group[i];
789
          nodeData = groupData[i];
790
          if (node) {
791
            node.__data__ = nodeData;
792
            updateNodes[i] = node;
793
          } else {
794
            enterNodes[i] = d3_selection_dataNode(nodeData);
795
          }
796
        }
797
        for (;i < m; ++i) {
798
          enterNodes[i] = d3_selection_dataNode(groupData[i]);
799
        }
800
        for (;i < n; ++i) {
801
          exitNodes[i] = group[i];
802
        }
803
      }
804
      enterNodes.update = updateNodes;
805
      enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group.parentNode;
806
      enter.push(enterNodes);
807
      update.push(updateNodes);
808
      exit.push(exitNodes);
809
    }
810
    var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
811
    if (typeof value === "function") {
812
      while (++i < n) {
813
        bind(group = this[i], value.call(group, group.parentNode.__data__, i));
814
      }
815
    } else {
816
      while (++i < n) {
817
        bind(group = this[i], value);
818
      }
819
    }
820
    update.enter = function() {
821
      return enter;
822
    };
823
    update.exit = function() {
824
      return exit;
825
    };
826
    return update;
827
  };
828
  function d3_selection_dataNode(data) {
829
    return {
830
      __data__: data
831
    };
832
  }
833
  d3_selectionPrototype.datum = function(value) {
834
    return arguments.length ? this.property("__data__", value) : this.property("__data__");
835
  };
836
  d3_selectionPrototype.filter = function(filter) {
837
    var subgroups = [], subgroup, group, node;
838
    if (typeof filter !== "function") filter = d3_selection_filter(filter);
839
    for (var j = 0, m = this.length; j < m; j++) {
840
      subgroups.push(subgroup = []);
841
      subgroup.parentNode = (group = this[j]).parentNode;
842
      for (var i = 0, n = group.length; i < n; i++) {
843
        if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
844
          subgroup.push(node);
845
        }
846
      }
847
    }
848
    return d3_selection(subgroups);
849
  };
850
  function d3_selection_filter(selector) {
851
    return function() {
852
      return d3_selectMatches(this, selector);
853
    };
854
  }
855
  d3_selectionPrototype.order = function() {
856
    for (var j = -1, m = this.length; ++j < m; ) {
857
      for (var group = this[j], i = group.length - 1, next = group[i], node; --i >= 0; ) {
858
        if (node = group[i]) {
859
          if (next && next !== node.nextSibling) next.parentNode.insertBefore(node, next);
860
          next = node;
861
        }
862
      }
863
    }
864
    return this;
865
  };
866
  d3_selectionPrototype.sort = function(comparator) {
867
    comparator = d3_selection_sortComparator.apply(this, arguments);
868
    for (var j = -1, m = this.length; ++j < m; ) this[j].sort(comparator);
869
    return this.order();
870
  };
871
  function d3_selection_sortComparator(comparator) {
872
    if (!arguments.length) comparator = d3.ascending;
873
    return function(a, b) {
874
      return a && b ? comparator(a.__data__, b.__data__) : !a - !b;
875
    };
876
  }
877
  d3_selectionPrototype.each = function(callback) {
878
    return d3_selection_each(this, function(node, i, j) {
879
      callback.call(node, node.__data__, i, j);
880
    });
881
  };
882
  function d3_selection_each(groups, callback) {
883
    for (var j = 0, m = groups.length; j < m; j++) {
884
      for (var group = groups[j], i = 0, n = group.length, node; i < n; i++) {
885
        if (node = group[i]) callback(node, i, j);
886
      }
887
    }
888
    return groups;
889
  }
890
  d3_selectionPrototype.call = function(callback) {
891
    var args = d3_array(arguments);
892
    callback.apply(args[0] = this, args);
893
    return this;
894
  };
895
  d3_selectionPrototype.empty = function() {
896
    return !this.node();
897
  };
898
  d3_selectionPrototype.node = function() {
899
    for (var j = 0, m = this.length; j < m; j++) {
900
      for (var group = this[j], i = 0, n = group.length; i < n; i++) {
901
        var node = group[i];
902
        if (node) return node;
903
      }
904
    }
905
    return null;
906
  };
907
  d3_selectionPrototype.size = function() {
908
    var n = 0;
909
    this.each(function() {
910
      ++n;
911
    });
912
    return n;
913
  };
914
  function d3_selection_enter(selection) {
915
    d3_subclass(selection, d3_selection_enterPrototype);
916
    return selection;
917
  }
918
  var d3_selection_enterPrototype = [];
919
  d3.selection.enter = d3_selection_enter;
920
  d3.selection.enter.prototype = d3_selection_enterPrototype;
921
  d3_selection_enterPrototype.append = d3_selectionPrototype.append;
922
  d3_selection_enterPrototype.empty = d3_selectionPrototype.empty;
923
  d3_selection_enterPrototype.node = d3_selectionPrototype.node;
924
  d3_selection_enterPrototype.call = d3_selectionPrototype.call;
925
  d3_selection_enterPrototype.size = d3_selectionPrototype.size;
926
  d3_selection_enterPrototype.select = function(selector) {
927
    var subgroups = [], subgroup, subnode, upgroup, group, node;
928
    for (var j = -1, m = this.length; ++j < m; ) {
929
      upgroup = (group = this[j]).update;
930
      subgroups.push(subgroup = []);
931
      subgroup.parentNode = group.parentNode;
932
      for (var i = -1, n = group.length; ++i < n; ) {
933
        if (node = group[i]) {
934
          subgroup.push(upgroup[i] = subnode = selector.call(group.parentNode, node.__data__, i, j));
935
          subnode.__data__ = node.__data__;
936
        } else {
937
          subgroup.push(null);
938
        }
939
      }
940
    }
941
    return d3_selection(subgroups);
942
  };
943
  d3_selection_enterPrototype.insert = function(name, before) {
944
    if (arguments.length < 2) before = d3_selection_enterInsertBefore(this);
945
    return d3_selectionPrototype.insert.call(this, name, before);
946
  };
947
  function d3_selection_enterInsertBefore(enter) {
948
    var i0, j0;
949
    return function(d, i, j) {
950
      var group = enter[j].update, n = group.length, node;
951
      if (j != j0) j0 = j, i0 = 0;
952
      if (i >= i0) i0 = i + 1;
953
      while (!(node = group[i0]) && ++i0 < n) ;
954
      return node;
955
    };
956
  }
957
  d3_selectionPrototype.transition = function() {
958
    var id = d3_transitionInheritId || ++d3_transitionId, subgroups = [], subgroup, node, transition = d3_transitionInherit || {
959
      time: Date.now(),
960
      ease: d3_ease_cubicInOut,
961
      delay: 0,
962
      duration: 250
963
    };
964
    for (var j = -1, m = this.length; ++j < m; ) {
965
      subgroups.push(subgroup = []);
966
      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
967
        if (node = group[i]) d3_transitionNode(node, i, id, transition);
968
        subgroup.push(node);
969
      }
970
    }
971
    return d3_transition(subgroups, id);
972
  };
973
  d3_selectionPrototype.interrupt = function() {
974
    return this.each(d3_selection_interrupt);
975
  };
976
  function d3_selection_interrupt() {
977
    var lock = this.__transition__;
978
    if (lock) ++lock.active;
979
  }
980
  d3.select = function(node) {
981
    var group = [ typeof node === "string" ? d3_select(node, d3_document) : node ];
982
    group.parentNode = d3_documentElement;
983
    return d3_selection([ group ]);
984
  };
985
  d3.selectAll = function(nodes) {
986
    var group = d3_array(typeof nodes === "string" ? d3_selectAll(nodes, d3_document) : nodes);
987
    group.parentNode = d3_documentElement;
988
    return d3_selection([ group ]);
989
  };
990
  var d3_selectionRoot = d3.select(d3_documentElement);
991
  d3_selectionPrototype.on = function(type, listener, capture) {
992
    var n = arguments.length;
993
    if (n < 3) {
994
      if (typeof type !== "string") {
995
        if (n < 2) listener = false;
996
        for (capture in type) this.each(d3_selection_on(capture, type[capture], listener));
997
        return this;
998
      }
999
      if (n < 2) return (n = this.node()["__on" + type]) && n._;
1000
      capture = false;
1001
    }
1002
    return this.each(d3_selection_on(type, listener, capture));
1003
  };
1004
  function d3_selection_on(type, listener, capture) {
1005
    var name = "__on" + type, i = type.indexOf("."), wrap = d3_selection_onListener;
1006
    if (i > 0) type = type.substring(0, i);
1007
    var filter = d3_selection_onFilters.get(type);
1008
    if (filter) type = filter, wrap = d3_selection_onFilter;
1009
    function onRemove() {
1010
      var l = this[name];
1011
      if (l) {
1012
        this.removeEventListener(type, l, l.$);
1013
        delete this[name];
1014
      }
1015
    }
1016
    function onAdd() {
1017
      var l = wrap(listener, d3_array(arguments));
1018
      onRemove.call(this);
1019
      this.addEventListener(type, this[name] = l, l.$ = capture);
1020
      l._ = listener;
1021
    }
1022
    function removeAll() {
1023
      var re = new RegExp("^__on([^.]+)" + d3.requote(type) + "$"), match;
1024
      for (var name in this) {
1025
        if (match = name.match(re)) {
1026
          var l = this[name];
1027
          this.removeEventListener(match[1], l, l.$);
1028
          delete this[name];
1029
        }
1030
      }
1031
    }
1032
    return i ? listener ? onAdd : onRemove : listener ? d3_noop : removeAll;
1033
  }
1034
  var d3_selection_onFilters = d3.map({
1035
    mouseenter: "mouseover",
1036
    mouseleave: "mouseout"
1037
  });
1038
  d3_selection_onFilters.forEach(function(k) {
1039
    if ("on" + k in d3_document) d3_selection_onFilters.remove(k);
1040
  });
1041
  function d3_selection_onListener(listener, argumentz) {
1042
    return function(e) {
1043
      var o = d3.event;
1044
      d3.event = e;
1045
      argumentz[0] = this.__data__;
1046
      try {
1047
        listener.apply(this, argumentz);
1048
      } finally {
1049
        d3.event = o;
1050
      }
1051
    };
1052
  }
1053
  function d3_selection_onFilter(listener, argumentz) {
1054
    var l = d3_selection_onListener(listener, argumentz);
1055
    return function(e) {
1056
      var target = this, related = e.relatedTarget;
1057
      if (!related || related !== target && !(related.compareDocumentPosition(target) & 8)) {
1058
        l.call(target, e);
1059
      }
1060
    };
1061
  }
1062
  var d3_event_dragSelect = "onselectstart" in d3_document ? null : d3_vendorSymbol(d3_documentElement.style, "userSelect"), d3_event_dragId = 0;
1063
  function d3_event_dragSuppress() {
1064
    var name = ".dragsuppress-" + ++d3_event_dragId, click = "click" + name, w = d3.select(d3_window).on("touchmove" + name, d3_eventPreventDefault).on("dragstart" + name, d3_eventPreventDefault).on("selectstart" + name, d3_eventPreventDefault);
1065
    if (d3_event_dragSelect) {
1066
      var style = d3_documentElement.style, select = style[d3_event_dragSelect];
1067
      style[d3_event_dragSelect] = "none";
1068
    }
1069
    return function(suppressClick) {
1070
      w.on(name, null);
1071
      if (d3_event_dragSelect) style[d3_event_dragSelect] = select;
1072
      if (suppressClick) {
1073
        function off() {
1074
          w.on(click, null);
1075
        }
1076
        w.on(click, function() {
1077
          d3_eventPreventDefault();
1078
          off();
1079
        }, true);
1080
        setTimeout(off, 0);
1081
      }
1082
    };
1083
  }
1084
  d3.mouse = function(container) {
1085
    return d3_mousePoint(container, d3_eventSource());
1086
  };
1087
  var d3_mouse_bug44083 = /WebKit/.test(d3_window.navigator.userAgent) ? -1 : 0;
1088
  function d3_mousePoint(container, e) {
1089
    if (e.changedTouches) e = e.changedTouches[0];
1090
    var svg = container.ownerSVGElement || container;
1091
    if (svg.createSVGPoint) {
1092
      var point = svg.createSVGPoint();
1093
      if (d3_mouse_bug44083 < 0 && (d3_window.scrollX || d3_window.scrollY)) {
1094
        svg = d3.select("body").append("svg").style({
1095
          position: "absolute",
1096
          top: 0,
1097
          left: 0,
1098
          margin: 0,
1099
          padding: 0,
1100
          border: "none"
1101
        }, "important");
1102
        var ctm = svg[0][0].getScreenCTM();
1103
        d3_mouse_bug44083 = !(ctm.f || ctm.e);
1104
        svg.remove();
1105
      }
1106
      if (d3_mouse_bug44083) point.x = e.pageX, point.y = e.pageY; else point.x = e.clientX, 
1107
      point.y = e.clientY;
1108
      point = point.matrixTransform(container.getScreenCTM().inverse());
1109
      return [ point.x, point.y ];
1110
    }
1111
    var rect = container.getBoundingClientRect();
1112
    return [ e.clientX - rect.left - container.clientLeft, e.clientY - rect.top - container.clientTop ];
1113
  }
1114
  d3.touches = function(container, touches) {
1115
    if (arguments.length < 2) touches = d3_eventSource().touches;
1116
    return touches ? d3_array(touches).map(function(touch) {
1117
      var point = d3_mousePoint(container, touch);
1118
      point.identifier = touch.identifier;
1119
      return point;
1120
    }) : [];
1121
  };
1122
  d3.behavior.drag = function() {
1123
    var event = d3_eventDispatch(drag, "drag", "dragstart", "dragend"), origin = null, mousedown = dragstart(d3_noop, d3.mouse, "mousemove", "mouseup"), touchstart = dragstart(touchid, touchposition, "touchmove", "touchend");
1124
    function drag() {
1125
      this.on("mousedown.drag", mousedown).on("touchstart.drag", touchstart);
1126
    }
1127
    function touchid() {
1128
      return d3.event.changedTouches[0].identifier;
1129
    }
1130
    function touchposition(parent, id) {
1131
      return d3.touches(parent).filter(function(p) {
1132
        return p.identifier === id;
1133
      })[0];
1134
    }
1135
    function dragstart(id, position, move, end) {
1136
      return function() {
1137
        var target = this, parent = target.parentNode, event_ = event.of(target, arguments), eventTarget = d3.event.target, eventId = id(), drag = eventId == null ? "drag" : "drag-" + eventId, origin_ = position(parent, eventId), dragged = 0, offset, w = d3.select(d3_window).on(move + "." + drag, moved).on(end + "." + drag, ended), dragRestore = d3_event_dragSuppress();
1138
        if (origin) {
1139
          offset = origin.apply(target, arguments);
1140
          offset = [ offset.x - origin_[0], offset.y - origin_[1] ];
1141
        } else {
1142
          offset = [ 0, 0 ];
1143
        }
1144
        event_({
1145
          type: "dragstart"
1146
        });
1147
        function moved() {
1148
          var p = position(parent, eventId), dx = p[0] - origin_[0], dy = p[1] - origin_[1];
1149
          dragged |= dx | dy;
1150
          origin_ = p;
1151
          event_({
1152
            type: "drag",
1153
            x: p[0] + offset[0],
1154
            y: p[1] + offset[1],
1155
            dx: dx,
1156
            dy: dy
1157
          });
1158
        }
1159
        function ended() {
1160
          w.on(move + "." + drag, null).on(end + "." + drag, null);
1161
          dragRestore(dragged && d3.event.target === eventTarget);
1162
          event_({
1163
            type: "dragend"
1164
          });
1165
        }
1166
      };
1167
    }
1168
    drag.origin = function(x) {
1169
      if (!arguments.length) return origin;
1170
      origin = x;
1171
      return drag;
1172
    };
1173
    return d3.rebind(drag, event, "on");
1174
  };
1175
  var π = Math.PI, τ = 2 * π, halfπ = π / 2, ε = 1e-6, ε2 = ε * ε, d3_radians = π / 180, d3_degrees = 180 / π;
1176
  function d3_sgn(x) {
1177
    return x > 0 ? 1 : x < 0 ? -1 : 0;
1178
  }
1179
  function d3_acos(x) {
1180
    return x > 1 ? 0 : x < -1 ? π : Math.acos(x);
1181
  }
1182
  function d3_asin(x) {
1183
    return x > 1 ? halfπ : x < -1 ? -halfπ : Math.asin(x);
1184
  }
1185
  function d3_sinh(x) {
1186
    return ((x = Math.exp(x)) - 1 / x) / 2;
1187
  }
1188
  function d3_cosh(x) {
1189
    return ((x = Math.exp(x)) + 1 / x) / 2;
1190
  }
1191
  function d3_tanh(x) {
1192
    return ((x = Math.exp(2 * x)) - 1) / (x + 1);
1193
  }
1194
  function d3_haversin(x) {
1195
    return (x = Math.sin(x / 2)) * x;
1196
  }
1197
  var ρ = Math.SQRT2, ρ2 = 2, ρ4 = 4;
1198
  d3.interpolateZoom = function(p0, p1) {
1199
    var ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2];
1200
    var dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + ρ4 * d2) / (2 * w0 * ρ2 * d1), b1 = (w1 * w1 - w0 * w0 - ρ4 * d2) / (2 * w1 * ρ2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1), dr = r1 - r0, S = (dr || Math.log(w1 / w0)) / ρ;
1201
    function interpolate(t) {
1202
      var s = t * S;
1203
      if (dr) {
1204
        var coshr0 = d3_cosh(r0), u = w0 / (ρ2 * d1) * (coshr0 * d3_tanh(ρ * s + r0) - d3_sinh(r0));
1205
        return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / d3_cosh(ρ * s + r0) ];
1206
      }
1207
      return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(ρ * s) ];
1208
    }
1209
    interpolate.duration = S * 1e3;
1210
    return interpolate;
1211
  };
1212
  d3.behavior.zoom = function() {
1213
    var view = {
1214
      x: 0,
1215
      y: 0,
1216
      k: 1
1217
    }, translate0, center, size = [ 960, 500 ], scaleExtent = d3_behavior_zoomInfinity, mousedown = "mousedown.zoom", mousemove = "mousemove.zoom", mouseup = "mouseup.zoom", mousewheelTimer, touchstart = "touchstart.zoom", touchtime, event = d3_eventDispatch(zoom, "zoomstart", "zoom", "zoomend"), x0, x1, y0, y1;
1218
    function zoom(g) {
1219
      g.on(mousedown, mousedowned).on(d3_behavior_zoomWheel + ".zoom", mousewheeled).on(mousemove, mousewheelreset).on("dblclick.zoom", dblclicked).on(touchstart, touchstarted);
1220
    }
1221
    zoom.event = function(g) {
1222
      g.each(function() {
1223
        var event_ = event.of(this, arguments), view1 = view;
1224
        if (d3_transitionInheritId) {
1225
          d3.select(this).transition().each("start.zoom", function() {
1226
            view = this.__chart__ || {
1227
              x: 0,
1228
              y: 0,
1229
              k: 1
1230
            };
1231
            zoomstarted(event_);
1232
          }).tween("zoom:zoom", function() {
1233
            var dx = size[0], dy = size[1], cx = dx / 2, cy = dy / 2, i = d3.interpolateZoom([ (cx - view.x) / view.k, (cy - view.y) / view.k, dx / view.k ], [ (cx - view1.x) / view1.k, (cy - view1.y) / view1.k, dx / view1.k ]);
1234
            return function(t) {
1235
              var l = i(t), k = dx / l[2];
1236
              this.__chart__ = view = {
1237
                x: cx - l[0] * k,
1238
                y: cy - l[1] * k,
1239
                k: k
1240
              };
1241
              zoomed(event_);
1242
            };
1243
          }).each("end.zoom", function() {
1244
            zoomended(event_);
1245
          });
1246
        } else {
1247
          this.__chart__ = view;
1248
          zoomstarted(event_);
1249
          zoomed(event_);
1250
          zoomended(event_);
1251
        }
1252
      });
1253
    };
1254
    zoom.translate = function(_) {
1255
      if (!arguments.length) return [ view.x, view.y ];
1256
      view = {
1257
        x: +_[0],
1258
        y: +_[1],
1259
        k: view.k
1260
      };
1261
      rescale();
1262
      return zoom;
1263
    };
1264
    zoom.scale = function(_) {
1265
      if (!arguments.length) return view.k;
1266
      view = {
1267
        x: view.x,
1268
        y: view.y,
1269
        k: +_
1270
      };
1271
      rescale();
1272
      return zoom;
1273
    };
1274
    zoom.scaleExtent = function(_) {
1275
      if (!arguments.length) return scaleExtent;
1276
      scaleExtent = _ == null ? d3_behavior_zoomInfinity : [ +_[0], +_[1] ];
1277
      return zoom;
1278
    };
1279
    zoom.center = function(_) {
1280
      if (!arguments.length) return center;
1281
      center = _ && [ +_[0], +_[1] ];
1282
      return zoom;
1283
    };
1284
    zoom.size = function(_) {
1285
      if (!arguments.length) return size;
1286
      size = _ && [ +_[0], +_[1] ];
1287
      return zoom;
1288
    };
1289
    zoom.x = function(z) {
1290
      if (!arguments.length) return x1;
1291
      x1 = z;
1292
      x0 = z.copy();
1293
      view = {
1294
        x: 0,
1295
        y: 0,
1296
        k: 1
1297
      };
1298
      return zoom;
1299
    };
1300
    zoom.y = function(z) {
1301
      if (!arguments.length) return y1;
1302
      y1 = z;
1303
      y0 = z.copy();
1304
      view = {
1305
        x: 0,
1306
        y: 0,
1307
        k: 1
1308
      };
1309
      return zoom;
1310
    };
1311
    function location(p) {
1312
      return [ (p[0] - view.x) / view.k, (p[1] - view.y) / view.k ];
1313
    }
1314
    function point(l) {
1315
      return [ l[0] * view.k + view.x, l[1] * view.k + view.y ];
1316
    }
1317
    function scaleTo(s) {
1318
      view.k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], s));
1319
    }
1320
    function translateTo(p, l) {
1321
      l = point(l);
1322
      view.x += p[0] - l[0];
1323
      view.y += p[1] - l[1];
1324
    }
1325
    function rescale() {
1326
      if (x1) x1.domain(x0.range().map(function(x) {
1327
        return (x - view.x) / view.k;
1328
      }).map(x0.invert));
1329
      if (y1) y1.domain(y0.range().map(function(y) {
1330
        return (y - view.y) / view.k;
1331
      }).map(y0.invert));
1332
    }
1333
    function zoomstarted(event) {
1334
      event({
1335
        type: "zoomstart"
1336
      });
1337
    }
1338
    function zoomed(event) {
1339
      rescale();
1340
      event({
1341
        type: "zoom",
1342
        scale: view.k,
1343
        translate: [ view.x, view.y ]
1344
      });
1345
    }
1346
    function zoomended(event) {
1347
      event({
1348
        type: "zoomend"
1349
      });
1350
    }
1351
    function mousedowned() {
1352
      var target = this, event_ = event.of(target, arguments), eventTarget = d3.event.target, dragged = 0, w = d3.select(d3_window).on(mousemove, moved).on(mouseup, ended), l = location(d3.mouse(target)), dragRestore = d3_event_dragSuppress();
1353
      d3_selection_interrupt.call(target);
1354
      zoomstarted(event_);
1355
      function moved() {
1356
        dragged = 1;
1357
        translateTo(d3.mouse(target), l);
1358
        zoomed(event_);
1359
      }
1360
      function ended() {
1361
        w.on(mousemove, d3_window === target ? mousewheelreset : null).on(mouseup, null);
1362
        dragRestore(dragged && d3.event.target === eventTarget);
1363
        zoomended(event_);
1364
      }
1365
    }
1366
    function touchstarted() {
1367
      var target = this, event_ = event.of(target, arguments), locations0 = {}, distance0 = 0, scale0, eventId = d3.event.changedTouches[0].identifier, touchmove = "touchmove.zoom-" + eventId, touchend = "touchend.zoom-" + eventId, w = d3.select(d3_window).on(touchmove, moved).on(touchend, ended), t = d3.select(target).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress();
1368
      d3_selection_interrupt.call(target);
1369
      started();
1370
      zoomstarted(event_);
1371
      function relocate() {
1372
        var touches = d3.touches(target);
1373
        scale0 = view.k;
1374
        touches.forEach(function(t) {
1375
          if (t.identifier in locations0) locations0[t.identifier] = location(t);
1376
        });
1377
        return touches;
1378
      }
1379
      function started() {
1380
        var changed = d3.event.changedTouches;
1381
        for (var i = 0, n = changed.length; i < n; ++i) {
1382
          locations0[changed[i].identifier] = null;
1383
        }
1384
        var touches = relocate(), now = Date.now();
1385
        if (touches.length === 1) {
1386
          if (now - touchtime < 500) {
1387
            var p = touches[0], l = locations0[p.identifier];
1388
            scaleTo(view.k * 2);
1389
            translateTo(p, l);
1390
            d3_eventPreventDefault();
1391
            zoomed(event_);
1392
          }
1393
          touchtime = now;
1394
        } else if (touches.length > 1) {
1395
          var p = touches[0], q = touches[1], dx = p[0] - q[0], dy = p[1] - q[1];
1396
          distance0 = dx * dx + dy * dy;
1397
        }
1398
      }
1399
      function moved() {
1400
        var touches = d3.touches(target), p0, l0, p1, l1;
1401
        for (var i = 0, n = touches.length; i < n; ++i, l1 = null) {
1402
          p1 = touches[i];
1403
          if (l1 = locations0[p1.identifier]) {
1404
            if (l0) break;
1405
            p0 = p1, l0 = l1;
1406
          }
1407
        }
1408
        if (l1) {
1409
          var distance1 = (distance1 = p1[0] - p0[0]) * distance1 + (distance1 = p1[1] - p0[1]) * distance1, scale1 = distance0 && Math.sqrt(distance1 / distance0);
1410
          p0 = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ];
1411
          l0 = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
1412
          scaleTo(scale1 * scale0);
1413
        }
1414
        touchtime = null;
1415
        translateTo(p0, l0);
1416
        zoomed(event_);
1417
      }
1418
      function ended() {
1419
        if (d3.event.touches.length) {
1420
          var changed = d3.event.changedTouches;
1421
          for (var i = 0, n = changed.length; i < n; ++i) {
1422
            delete locations0[changed[i].identifier];
1423
          }
1424
          for (var identifier in locations0) {
1425
            return void relocate();
1426
          }
1427
        }
1428
        w.on(touchmove, null).on(touchend, null);
1429
        t.on(mousedown, mousedowned).on(touchstart, touchstarted);
1430
        dragRestore();
1431
        zoomended(event_);
1432
      }
1433
    }
1434
    function mousewheeled() {
1435
      var event_ = event.of(this, arguments);
1436
      if (mousewheelTimer) clearTimeout(mousewheelTimer); else d3_selection_interrupt.call(this), 
1437
      zoomstarted(event_);
1438
      mousewheelTimer = setTimeout(function() {
1439
        mousewheelTimer = null;
1440
        zoomended(event_);
1441
      }, 50);
1442
      d3_eventPreventDefault();
1443
      var point = center || d3.mouse(this);
1444
      if (!translate0) translate0 = location(point);
1445
      scaleTo(Math.pow(2, d3_behavior_zoomDelta() * .002) * view.k);
1446
      translateTo(point, translate0);
1447
      zoomed(event_);
1448
    }
1449
    function mousewheelreset() {
1450
      translate0 = null;
1451
    }
1452
    function dblclicked() {
1453
      var event_ = event.of(this, arguments), p = d3.mouse(this), l = location(p), k = Math.log(view.k) / Math.LN2;
1454
      zoomstarted(event_);
1455
      scaleTo(Math.pow(2, d3.event.shiftKey ? Math.ceil(k) - 1 : Math.floor(k) + 1));
1456
      translateTo(p, l);
1457
      zoomed(event_);
1458
      zoomended(event_);
1459
    }
1460
    return d3.rebind(zoom, event, "on");
1461
  };
1462
  var d3_behavior_zoomInfinity = [ 0, Infinity ];
1463
  var d3_behavior_zoomDelta, d3_behavior_zoomWheel = "onwheel" in d3_document ? (d3_behavior_zoomDelta = function() {
1464
    return -d3.event.deltaY * (d3.event.deltaMode ? 120 : 1);
1465
  }, "wheel") : "onmousewheel" in d3_document ? (d3_behavior_zoomDelta = function() {
1466
    return d3.event.wheelDelta;
1467
  }, "mousewheel") : (d3_behavior_zoomDelta = function() {
1468
    return -d3.event.detail;
1469
  }, "MozMousePixelScroll");
1470
  function d3_Color() {}
1471
  d3_Color.prototype.toString = function() {
1472
    return this.rgb() + "";
1473
  };
1474
  d3.hsl = function(h, s, l) {
1475
    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);
1476
  };
1477
  function d3_hsl(h, s, l) {
1478
    return new d3_Hsl(h, s, l);
1479
  }
1480
  function d3_Hsl(h, s, l) {
1481
    this.h = h;
1482
    this.s = s;
1483
    this.l = l;
1484
  }
1485
  var d3_hslPrototype = d3_Hsl.prototype = new d3_Color();
1486
  d3_hslPrototype.brighter = function(k) {
1487
    k = Math.pow(.7, arguments.length ? k : 1);
1488
    return d3_hsl(this.h, this.s, this.l / k);
1489
  };
1490
  d3_hslPrototype.darker = function(k) {
1491
    k = Math.pow(.7, arguments.length ? k : 1);
1492
    return d3_hsl(this.h, this.s, k * this.l);
1493
  };
1494
  d3_hslPrototype.rgb = function() {
1495
    return d3_hsl_rgb(this.h, this.s, this.l);
1496
  };
1497
  function d3_hsl_rgb(h, s, l) {
1498
    var m1, m2;
1499
    h = isNaN(h) ? 0 : (h %= 360) < 0 ? h + 360 : h;
1500
    s = isNaN(s) ? 0 : s < 0 ? 0 : s > 1 ? 1 : s;
1501
    l = l < 0 ? 0 : l > 1 ? 1 : l;
1502
    m2 = l <= .5 ? l * (1 + s) : l + s - l * s;
1503
    m1 = 2 * l - m2;
1504
    function v(h) {
1505
      if (h > 360) h -= 360; else if (h < 0) h += 360;
1506
      if (h < 60) return m1 + (m2 - m1) * h / 60;
1507
      if (h < 180) return m2;
1508
      if (h < 240) return m1 + (m2 - m1) * (240 - h) / 60;
1509
      return m1;
1510
    }
1511
    function vv(h) {
1512
      return Math.round(v(h) * 255);
1513
    }
1514
    return d3_rgb(vv(h + 120), vv(h), vv(h - 120));
1515
  }
1516
  d3.hcl = function(h, c, l) {
1517
    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);
1518
  };
1519
  function d3_hcl(h, c, l) {
1520
    return new d3_Hcl(h, c, l);
1521
  }
1522
  function d3_Hcl(h, c, l) {
1523
    this.h = h;
1524
    this.c = c;
1525
    this.l = l;
1526
  }
1527
  var d3_hclPrototype = d3_Hcl.prototype = new d3_Color();
1528
  d3_hclPrototype.brighter = function(k) {
1529
    return d3_hcl(this.h, this.c, Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)));
1530
  };
1531
  d3_hclPrototype.darker = function(k) {
1532
    return d3_hcl(this.h, this.c, Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)));
1533
  };
1534
  d3_hclPrototype.rgb = function() {
1535
    return d3_hcl_lab(this.h, this.c, this.l).rgb();
1536
  };
1537
  function d3_hcl_lab(h, c, l) {
1538
    if (isNaN(h)) h = 0;
1539
    if (isNaN(c)) c = 0;
1540
    return d3_lab(l, Math.cos(h *= d3_radians) * c, Math.sin(h) * c);
1541
  }
1542
  d3.lab = function(l, a, b) {
1543
    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);
1544
  };
1545
  function d3_lab(l, a, b) {
1546
    return new d3_Lab(l, a, b);
1547
  }
1548
  function d3_Lab(l, a, b) {
1549
    this.l = l;
1550
    this.a = a;
1551
    this.b = b;
1552
  }
1553
  var d3_lab_K = 18;
1554
  var d3_lab_X = .95047, d3_lab_Y = 1, d3_lab_Z = 1.08883;
1555
  var d3_labPrototype = d3_Lab.prototype = new d3_Color();
1556
  d3_labPrototype.brighter = function(k) {
1557
    return d3_lab(Math.min(100, this.l + d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
1558
  };
1559
  d3_labPrototype.darker = function(k) {
1560
    return d3_lab(Math.max(0, this.l - d3_lab_K * (arguments.length ? k : 1)), this.a, this.b);
1561
  };
1562
  d3_labPrototype.rgb = function() {
1563
    return d3_lab_rgb(this.l, this.a, this.b);
1564
  };
1565
  function d3_lab_rgb(l, a, b) {
1566
    var y = (l + 16) / 116, x = y + a / 500, z = y - b / 200;
1567
    x = d3_lab_xyz(x) * d3_lab_X;
1568
    y = d3_lab_xyz(y) * d3_lab_Y;
1569
    z = d3_lab_xyz(z) * d3_lab_Z;
1570
    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));
1571
  }
1572
  function d3_lab_hcl(l, a, b) {
1573
    return l > 0 ? d3_hcl(Math.atan2(b, a) * d3_degrees, Math.sqrt(a * a + b * b), l) : d3_hcl(NaN, NaN, l);
1574
  }
1575
  function d3_lab_xyz(x) {
1576
    return x > .206893034 ? x * x * x : (x - 4 / 29) / 7.787037;
1577
  }
1578
  function d3_xyz_lab(x) {
1579
    return x > .008856 ? Math.pow(x, 1 / 3) : 7.787037 * x + 4 / 29;
1580
  }
1581
  function d3_xyz_rgb(r) {
1582
    return Math.round(255 * (r <= .00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - .055));
1583
  }
1584
  d3.rgb = function(r, g, b) {
1585
    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);
1586
  };
1587
  function d3_rgbNumber(value) {
1588
    return d3_rgb(value >> 16, value >> 8 & 255, value & 255);
1589
  }
1590
  function d3_rgbString(value) {
1591
    return d3_rgbNumber(value) + "";
1592
  }
1593
  function d3_rgb(r, g, b) {
1594
    return new d3_Rgb(r, g, b);
1595
  }
1596
  function d3_Rgb(r, g, b) {
1597
    this.r = r;
1598
    this.g = g;
1599
    this.b = b;
1600
  }
1601
  var d3_rgbPrototype = d3_Rgb.prototype = new d3_Color();
1602
  d3_rgbPrototype.brighter = function(k) {
1603
    k = Math.pow(.7, arguments.length ? k : 1);
1604
    var r = this.r, g = this.g, b = this.b, i = 30;
1605
    if (!r && !g && !b) return d3_rgb(i, i, i);
1606
    if (r && r < i) r = i;
1607
    if (g && g < i) g = i;
1608
    if (b && b < i) b = i;
1609
    return d3_rgb(Math.min(255, ~~(r / k)), Math.min(255, ~~(g / k)), Math.min(255, ~~(b / k)));
1610
  };
1611
  d3_rgbPrototype.darker = function(k) {
1612
    k = Math.pow(.7, arguments.length ? k : 1);
1613
    return d3_rgb(~~(k * this.r), ~~(k * this.g), ~~(k * this.b));
1614
  };
1615
  d3_rgbPrototype.hsl = function() {
1616
    return d3_rgb_hsl(this.r, this.g, this.b);
1617
  };
1618
  d3_rgbPrototype.toString = function() {
1619
    return "#" + d3_rgb_hex(this.r) + d3_rgb_hex(this.g) + d3_rgb_hex(this.b);
1620
  };
1621
  function d3_rgb_hex(v) {
1622
    return v < 16 ? "0" + Math.max(0, v).toString(16) : Math.min(255, v).toString(16);
1623
  }
1624
  function d3_rgb_parse(format, rgb, hsl) {
1625
    var r = 0, g = 0, b = 0, m1, m2, name;
1626
    m1 = /([a-z]+)\((.*)\)/i.exec(format);
1627
    if (m1) {
1628
      m2 = m1[2].split(",");
1629
      switch (m1[1]) {
1630
       case "hsl":
1631
        {
1632
          return hsl(parseFloat(m2[0]), parseFloat(m2[1]) / 100, parseFloat(m2[2]) / 100);
1633
        }
1634
1635
       case "rgb":
1636
        {
1637
          return rgb(d3_rgb_parseNumber(m2[0]), d3_rgb_parseNumber(m2[1]), d3_rgb_parseNumber(m2[2]));
1638
        }
1639
      }
1640
    }
1641
    if (name = d3_rgb_names.get(format)) return rgb(name.r, name.g, name.b);
1642
    if (format != null && format.charAt(0) === "#") {
1643
      if (format.length === 4) {
1644
        r = format.charAt(1);
1645
        r += r;
1646
        g = format.charAt(2);
1647
        g += g;
1648
        b = format.charAt(3);
1649
        b += b;
1650
      } else if (format.length === 7) {
1651
        r = format.substring(1, 3);
1652
        g = format.substring(3, 5);
1653
        b = format.substring(5, 7);
1654
      }
1655
      r = parseInt(r, 16);
1656
      g = parseInt(g, 16);
1657
      b = parseInt(b, 16);
1658
    }
1659
    return rgb(r, g, b);
1660
  }
1661
  function d3_rgb_hsl(r, g, b) {
1662
    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;
1663
    if (d) {
1664
      s = l < .5 ? d / (max + min) : d / (2 - max - min);
1665
      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;
1666
      h *= 60;
1667
    } else {
1668
      h = NaN;
1669
      s = l > 0 && l < 1 ? 0 : h;
1670
    }
1671
    return d3_hsl(h, s, l);
1672
  }
1673
  function d3_rgb_lab(r, g, b) {
1674
    r = d3_rgb_xyz(r);
1675
    g = d3_rgb_xyz(g);
1676
    b = d3_rgb_xyz(b);
1677
    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);
1678
    return d3_lab(116 * y - 16, 500 * (x - y), 200 * (y - z));
1679
  }
1680
  function d3_rgb_xyz(r) {
1681
    return (r /= 255) <= .04045 ? r / 12.92 : Math.pow((r + .055) / 1.055, 2.4);
1682
  }
1683
  function d3_rgb_parseNumber(c) {
1684
    var f = parseFloat(c);
1685
    return c.charAt(c.length - 1) === "%" ? Math.round(f * 2.55) : f;
1686
  }
1687
  var d3_rgb_names = d3.map({
1688
    aliceblue: 15792383,
1689
    antiquewhite: 16444375,
1690
    aqua: 65535,
1691
    aquamarine: 8388564,
1692
    azure: 15794175,
1693
    beige: 16119260,
1694
    bisque: 16770244,
1695
    black: 0,
1696
    blanchedalmond: 16772045,
1697
    blue: 255,
1698
    blueviolet: 9055202,
1699
    brown: 10824234,
1700
    burlywood: 14596231,
1701
    cadetblue: 6266528,
1702
    chartreuse: 8388352,
1703
    chocolate: 13789470,
1704
    coral: 16744272,
1705
    cornflowerblue: 6591981,
1706
    cornsilk: 16775388,
1707
    crimson: 14423100,
1708
    cyan: 65535,
1709
    darkblue: 139,
1710
    darkcyan: 35723,
1711
    darkgoldenrod: 12092939,
1712
    darkgray: 11119017,
1713
    darkgreen: 25600,
1714
    darkgrey: 11119017,
1715
    darkkhaki: 12433259,
1716
    darkmagenta: 9109643,
1717
    darkolivegreen: 5597999,
1718
    darkorange: 16747520,
1719
    darkorchid: 10040012,
1720
    darkred: 9109504,
1721
    darksalmon: 15308410,
1722
    darkseagreen: 9419919,
1723
    darkslateblue: 4734347,
1724
    darkslategray: 3100495,
1725
    darkslategrey: 3100495,
1726
    darkturquoise: 52945,
1727
    darkviolet: 9699539,
1728
    deeppink: 16716947,
1729
    deepskyblue: 49151,
1730
    dimgray: 6908265,
1731
    dimgrey: 6908265,
1732
    dodgerblue: 2003199,
1733
    firebrick: 11674146,
1734
    floralwhite: 16775920,
1735
    forestgreen: 2263842,
1736
    fuchsia: 16711935,
1737
    gainsboro: 14474460,
1738
    ghostwhite: 16316671,
1739
    gold: 16766720,
1740
    goldenrod: 14329120,
1741
    gray: 8421504,
1742
    green: 32768,
1743
    greenyellow: 11403055,
1744
    grey: 8421504,
1745
    honeydew: 15794160,
1746
    hotpink: 16738740,
1747
    indianred: 13458524,
1748
    indigo: 4915330,
1749
    ivory: 16777200,
1750
    khaki: 15787660,
1751
    lavender: 15132410,
1752
    lavenderblush: 16773365,
1753
    lawngreen: 8190976,
1754
    lemonchiffon: 16775885,
1755
    lightblue: 11393254,
1756
    lightcoral: 15761536,
1757
    lightcyan: 14745599,
1758
    lightgoldenrodyellow: 16448210,
1759
    lightgray: 13882323,
1760
    lightgreen: 9498256,
1761
    lightgrey: 13882323,
1762
    lightpink: 16758465,
1763
    lightsalmon: 16752762,
1764
    lightseagreen: 2142890,
1765
    lightskyblue: 8900346,
1766
    lightslategray: 7833753,
1767
    lightslategrey: 7833753,
1768
    lightsteelblue: 11584734,
1769
    lightyellow: 16777184,
1770
    lime: 65280,
1771
    limegreen: 3329330,
1772
    linen: 16445670,
1773
    magenta: 16711935,
1774
    maroon: 8388608,
1775
    mediumaquamarine: 6737322,
1776
    mediumblue: 205,
1777
    mediumorchid: 12211667,
1778
    mediumpurple: 9662683,
1779
    mediumseagreen: 3978097,
1780
    mediumslateblue: 8087790,
1781
    mediumspringgreen: 64154,
1782
    mediumturquoise: 4772300,
1783
    mediumvioletred: 13047173,
1784
    midnightblue: 1644912,
1785
    mintcream: 16121850,
1786
    mistyrose: 16770273,
1787
    moccasin: 16770229,
1788
    navajowhite: 16768685,
1789
    navy: 128,
1790
    oldlace: 16643558,
1791
    olive: 8421376,
1792
    olivedrab: 7048739,
1793
    orange: 16753920,
1794
    orangered: 16729344,
1795
    orchid: 14315734,
1796
    palegoldenrod: 15657130,
1797
    palegreen: 10025880,
1798
    paleturquoise: 11529966,
1799
    palevioletred: 14381203,
1800
    papayawhip: 16773077,
1801
    peachpuff: 16767673,
1802
    peru: 13468991,
1803
    pink: 16761035,
1804
    plum: 14524637,
1805
    powderblue: 11591910,
1806
    purple: 8388736,
1807
    red: 16711680,
1808
    rosybrown: 12357519,
1809
    royalblue: 4286945,
1810
    saddlebrown: 9127187,
1811
    salmon: 16416882,
1812
    sandybrown: 16032864,
1813
    seagreen: 3050327,
1814
    seashell: 16774638,
1815
    sienna: 10506797,
1816
    silver: 12632256,
1817
    skyblue: 8900331,
1818
    slateblue: 6970061,
1819
    slategray: 7372944,
1820
    slategrey: 7372944,
1821
    snow: 16775930,
1822
    springgreen: 65407,
1823
    steelblue: 4620980,
1824
    tan: 13808780,
1825
    teal: 32896,
1826
    thistle: 14204888,
1827
    tomato: 16737095,
1828
    turquoise: 4251856,
1829
    violet: 15631086,
1830
    wheat: 16113331,
1831
    white: 16777215,
1832
    whitesmoke: 16119285,
1833
    yellow: 16776960,
1834
    yellowgreen: 10145074
1835
  });
1836
  d3_rgb_names.forEach(function(key, value) {
1837
    d3_rgb_names.set(key, d3_rgbNumber(value));
1838
  });
1839
  function d3_functor(v) {
1840
    return typeof v === "function" ? v : function() {
1841
      return v;
1842
    };
1843
  }
1844
  d3.functor = d3_functor;
1845
  function d3_identity(d) {
1846
    return d;
1847
  }
1848
  d3.xhr = d3_xhrType(d3_identity);
1849
  function d3_xhrType(response) {
1850
    return function(url, mimeType, callback) {
1851
      if (arguments.length === 2 && typeof mimeType === "function") callback = mimeType, 
1852
      mimeType = null;
1853
      return d3_xhr(url, mimeType, response, callback);
1854
    };
1855
  }
1856
  function d3_xhr(url, mimeType, response, callback) {
1857
    var xhr = {}, dispatch = d3.dispatch("beforesend", "progress", "load", "error"), headers = {}, request = new XMLHttpRequest(), responseType = null;
1858
    if (d3_window.XDomainRequest && !("withCredentials" in request) && /^(http(s)?:)?\/\//.test(url)) request = new XDomainRequest();
1859
    "onload" in request ? request.onload = request.onerror = respond : request.onreadystatechange = function() {
1860
      request.readyState > 3 && respond();
1861
    };
1862
    function respond() {
1863
      var status = request.status, result;
1864
      if (!status && request.responseText || status >= 200 && status < 300 || status === 304) {
1865
        try {
1866
          result = response.call(xhr, request);
1867
        } catch (e) {
1868
          dispatch.error.call(xhr, e);
1869
          return;
1870
        }
1871
        dispatch.load.call(xhr, result);
1872
      } else {
1873
        dispatch.error.call(xhr, request);
1874
      }
1875
    }
1876
    request.onprogress = function(event) {
1877
      var o = d3.event;
1878
      d3.event = event;
1879
      try {
1880
        dispatch.progress.call(xhr, request);
1881
      } finally {
1882
        d3.event = o;
1883
      }
1884
    };
1885
    xhr.header = function(name, value) {
1886
      name = (name + "").toLowerCase();
1887
      if (arguments.length < 2) return headers[name];
1888
      if (value == null) delete headers[name]; else headers[name] = value + "";
1889
      return xhr;
1890
    };
1891
    xhr.mimeType = function(value) {
1892
      if (!arguments.length) return mimeType;
1893
      mimeType = value == null ? null : value + "";
1894
      return xhr;
1895
    };
1896
    xhr.responseType = function(value) {
1897
      if (!arguments.length) return responseType;
1898
      responseType = value;
1899
      return xhr;
1900
    };
1901
    xhr.response = function(value) {
1902
      response = value;
1903
      return xhr;
1904
    };
1905
    [ "get", "post" ].forEach(function(method) {
1906
      xhr[method] = function() {
1907
        return xhr.send.apply(xhr, [ method ].concat(d3_array(arguments)));
1908
      };
1909
    });
1910
    xhr.send = function(method, data, callback) {
1911
      if (arguments.length === 2 && typeof data === "function") callback = data, data = null;
1912
      request.open(method, url, true);
1913
      if (mimeType != null && !("accept" in headers)) headers["accept"] = mimeType + ",*/*";
1914
      if (request.setRequestHeader) for (var name in headers) request.setRequestHeader(name, headers[name]);
1915
      if (mimeType != null && request.overrideMimeType) request.overrideMimeType(mimeType);
1916
      if (responseType != null) request.responseType = responseType;
1917
      if (callback != null) xhr.on("error", callback).on("load", function(request) {
1918
        callback(null, request);
1919
      });
1920
      dispatch.beforesend.call(xhr, request);
1921
      request.send(data == null ? null : data);
1922
      return xhr;
1923
    };
1924
    xhr.abort = function() {
1925
      request.abort();
1926
      return xhr;
1927
    };
1928
    d3.rebind(xhr, dispatch, "on");
1929
    return callback == null ? xhr : xhr.get(d3_xhr_fixCallback(callback));
1930
  }
1931
  function d3_xhr_fixCallback(callback) {
1932
    return callback.length === 1 ? function(error, request) {
1933
      callback(error == null ? request : null);
1934
    } : callback;
1935
  }
1936
  d3.dsv = function(delimiter, mimeType) {
1937
    var reFormat = new RegExp('["' + delimiter + "\n]"), delimiterCode = delimiter.charCodeAt(0);
1938
    function dsv(url, row, callback) {
1939
      if (arguments.length < 3) callback = row, row = null;
1940
      var xhr = d3_xhr(url, mimeType, row == null ? response : typedResponse(row), callback);
1941
      xhr.row = function(_) {
1942
        return arguments.length ? xhr.response((row = _) == null ? response : typedResponse(_)) : row;
1943
      };
1944
      return xhr;
1945
    }
1946
    function response(request) {
1947
      return dsv.parse(request.responseText);
1948
    }
1949
    function typedResponse(f) {
1950
      return function(request) {
1951
        return dsv.parse(request.responseText, f);
1952
      };
1953
    }
1954
    dsv.parse = function(text, f) {
1955
      var o;
1956
      return dsv.parseRows(text, function(row, i) {
1957
        if (o) return o(row, i - 1);
1958
        var a = new Function("d", "return {" + row.map(function(name, i) {
1959
          return JSON.stringify(name) + ": d[" + i + "]";
1960
        }).join(",") + "}");
1961
        o = f ? function(row, i) {
1962
          return f(a(row), i);
1963
        } : a;
1964
      });
1965
    };
1966
    dsv.parseRows = function(text, f) {
1967
      var EOL = {}, EOF = {}, rows = [], N = text.length, I = 0, n = 0, t, eol;
1968
      function token() {
1969
        if (I >= N) return EOF;
1970
        if (eol) return eol = false, EOL;
1971
        var j = I;
1972
        if (text.charCodeAt(j) === 34) {
1973
          var i = j;
1974
          while (i++ < N) {
1975
            if (text.charCodeAt(i) === 34) {
1976
              if (text.charCodeAt(i + 1) !== 34) break;
1977
              ++i;
1978
            }
1979
          }
1980
          I = i + 2;
1981
          var c = text.charCodeAt(i + 1);
1982
          if (c === 13) {
1983
            eol = true;
1984
            if (text.charCodeAt(i + 2) === 10) ++I;
1985
          } else if (c === 10) {
1986
            eol = true;
1987
          }
1988
          return text.substring(j + 1, i).replace(/""/g, '"');
1989
        }
1990
        while (I < N) {
1991
          var c = text.charCodeAt(I++), k = 1;
1992
          if (c === 10) eol = true; else if (c === 13) {
1993
            eol = true;
1994
            if (text.charCodeAt(I) === 10) ++I, ++k;
1995
          } else if (c !== delimiterCode) continue;
1996
          return text.substring(j, I - k);
1997
        }
1998
        return text.substring(j);
1999
      }
2000
      while ((t = token()) !== EOF) {
2001
        var a = [];
2002
        while (t !== EOL && t !== EOF) {
2003
          a.push(t);
2004
          t = token();
2005
        }
2006
        if (f && !(a = f(a, n++))) continue;
2007
        rows.push(a);
2008
      }
2009
      return rows;
2010
    };
2011
    dsv.format = function(rows) {
2012
      if (Array.isArray(rows[0])) return dsv.formatRows(rows);
2013
      var fieldSet = new d3_Set(), fields = [];
2014
      rows.forEach(function(row) {
2015
        for (var field in row) {
2016
          if (!fieldSet.has(field)) {
2017
            fields.push(fieldSet.add(field));
2018
          }
2019
        }
2020
      });
2021
      return [ fields.map(formatValue).join(delimiter) ].concat(rows.map(function(row) {
2022
        return fields.map(function(field) {
2023
          return formatValue(row[field]);
2024
        }).join(delimiter);
2025
      })).join("\n");
2026
    };
2027
    dsv.formatRows = function(rows) {
2028
      return rows.map(formatRow).join("\n");
2029
    };
2030
    function formatRow(row) {
2031
      return row.map(formatValue).join(delimiter);
2032
    }
2033
    function formatValue(text) {
2034
      return reFormat.test(text) ? '"' + text.replace(/\"/g, '""') + '"' : text;
2035
    }
2036
    return dsv;
2037
  };
2038
  d3.csv = d3.dsv(",", "text/csv");
2039
  d3.tsv = d3.dsv("	", "text/tab-separated-values");
2040
  var d3_timer_queueHead, d3_timer_queueTail, d3_timer_interval, d3_timer_timeout, d3_timer_active, d3_timer_frame = d3_window[d3_vendorSymbol(d3_window, "requestAnimationFrame")] || function(callback) {
2041
    setTimeout(callback, 17);
2042
  };
2043
  d3.timer = function(callback, delay, then) {
2044
    var n = arguments.length;
2045
    if (n < 2) delay = 0;
2046
    if (n < 3) then = Date.now();
2047
    var time = then + delay, timer = {
2048
      c: callback,
2049
      t: time,
2050
      f: false,
2051
      n: null
2052
    };
2053
    if (d3_timer_queueTail) d3_timer_queueTail.n = timer; else d3_timer_queueHead = timer;
2054
    d3_timer_queueTail = timer;
2055
    if (!d3_timer_interval) {
2056
      d3_timer_timeout = clearTimeout(d3_timer_timeout);
2057
      d3_timer_interval = 1;
2058
      d3_timer_frame(d3_timer_step);
2059
    }
2060
  };
2061
  function d3_timer_step() {
2062
    var now = d3_timer_mark(), delay = d3_timer_sweep() - now;
2063
    if (delay > 24) {
2064
      if (isFinite(delay)) {
2065
        clearTimeout(d3_timer_timeout);
2066
        d3_timer_timeout = setTimeout(d3_timer_step, delay);
2067
      }
2068
      d3_timer_interval = 0;
2069
    } else {
2070
      d3_timer_interval = 1;
2071
      d3_timer_frame(d3_timer_step);
2072
    }
2073
  }
2074
  d3.timer.flush = function() {
2075
    d3_timer_mark();
2076
    d3_timer_sweep();
2077
  };
2078
  function d3_timer_mark() {
2079
    var now = Date.now();
2080
    d3_timer_active = d3_timer_queueHead;
2081
    while (d3_timer_active) {
2082
      if (now >= d3_timer_active.t) d3_timer_active.f = d3_timer_active.c(now - d3_timer_active.t);
2083
      d3_timer_active = d3_timer_active.n;
2084
    }
2085
    return now;
2086
  }
2087
  function d3_timer_sweep() {
2088
    var t0, t1 = d3_timer_queueHead, time = Infinity;
2089
    while (t1) {
2090
      if (t1.f) {
2091
        t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;
2092
      } else {
2093
        if (t1.t < time) time = t1.t;
2094
        t1 = (t0 = t1).n;
2095
      }
2096
    }
2097
    d3_timer_queueTail = t0;
2098
    return time;
2099
  }
2100
  var d3_format_decimalPoint = ".", d3_format_thousandsSeparator = ",", d3_format_grouping = [ 3, 3 ], d3_format_currencySymbol = "$";
2101
  var d3_formatPrefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ].map(d3_formatPrefix);
2102
  d3.formatPrefix = function(value, precision) {
2103
    var i = 0;
2104
    if (value) {
2105
      if (value < 0) value *= -1;
2106
      if (precision) value = d3.round(value, d3_format_precision(value, precision));
2107
      i = 1 + Math.floor(1e-12 + Math.log(value) / Math.LN10);
2108
      i = Math.max(-24, Math.min(24, Math.floor((i <= 0 ? i + 1 : i - 1) / 3) * 3));
2109
    }
2110
    return d3_formatPrefixes[8 + i / 3];
2111
  };
2112
  function d3_formatPrefix(d, i) {
2113
    var k = Math.pow(10, abs(8 - i) * 3);
2114
    return {
2115
      scale: i > 8 ? function(d) {
2116
        return d / k;
2117
      } : function(d) {
2118
        return d * k;
2119
      },
2120
      symbol: d
2121
    };
2122
  }
2123
  d3.round = function(x, n) {
2124
    return n ? Math.round(x * (n = Math.pow(10, n))) / n : Math.round(x);
2125
  };
2126
  d3.format = function(specifier) {
2127
    var match = d3_format_re.exec(specifier), fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "", symbol = match[4] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
2128
    if (precision) precision = +precision.substring(1);
2129
    if (zfill || fill === "0" && align === "=") {
2130
      zfill = fill = "0";
2131
      align = "=";
2132
      if (comma) width -= Math.floor((width - 1) / 4);
2133
    }
2134
    switch (type) {
2135
     case "n":
2136
      comma = true;
2137
      type = "g";
2138
      break;
2139
2140
     case "%":
2141
      scale = 100;
2142
      suffix = "%";
2143
      type = "f";
2144
      break;
2145
2146
     case "p":
2147
      scale = 100;
2148
      suffix = "%";
2149
      type = "r";
2150
      break;
2151
2152
     case "b":
2153
     case "o":
2154
     case "x":
2155
     case "X":
2156
      if (symbol === "#") symbol = "0" + type.toLowerCase();
2157
2158
     case "c":
2159
     case "d":
2160
      integer = true;
2161
      precision = 0;
2162
      break;
2163
2164
     case "s":
2165
      scale = -1;
2166
      type = "r";
2167
      break;
2168
    }
2169
    if (symbol === "#") symbol = ""; else if (symbol === "$") symbol = d3_format_currencySymbol;
2170
    if (type == "r" && !precision) type = "g";
2171
    if (precision != null) {
2172
      if (type == "g") precision = Math.max(1, Math.min(21, precision)); else if (type == "e" || type == "f") precision = Math.max(0, Math.min(20, precision));
2173
    }
2174
    type = d3_format_types.get(type) || d3_format_typeDefault;
2175
    var zcomma = zfill && comma;
2176
    return function(value) {
2177
      if (integer && value % 1) return "";
2178
      var negative = value < 0 || value === 0 && 1 / value < 0 ? (value = -value, "-") : sign;
2179
      if (scale < 0) {
2180
        var prefix = d3.formatPrefix(value, precision);
2181
        value = prefix.scale(value);
2182
        suffix = prefix.symbol;
2183
      } else {
2184
        value *= scale;
2185
      }
2186
      value = type(value, precision);
2187
      var i = value.lastIndexOf("."), before = i < 0 ? value : value.substring(0, i), after = i < 0 ? "" : d3_format_decimalPoint + value.substring(i + 1);
2188
      if (!zfill && comma) before = d3_format_group(before);
2189
      var length = symbol.length + before.length + after.length + (zcomma ? 0 : negative.length), padding = length < width ? new Array(length = width - length + 1).join(fill) : "";
2190
      if (zcomma) before = d3_format_group(padding + before);
2191
      negative += symbol;
2192
      value = before + after;
2193
      return (align === "<" ? negative + value + padding : align === ">" ? padding + negative + value : align === "^" ? padding.substring(0, length >>= 1) + negative + value + padding.substring(length) : negative + (zcomma ? value : padding + value)) + suffix;
2194
    };
2195
  };
2196
  var d3_format_re = /(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i;
2197
  var d3_format_types = d3.map({
2198
    b: function(x) {
2199
      return x.toString(2);
2200
    },
2201
    c: function(x) {
2202
      return String.fromCharCode(x);
2203
    },
2204
    o: function(x) {
2205
      return x.toString(8);
2206
    },
2207
    x: function(x) {
2208
      return x.toString(16);
2209
    },
2210
    X: function(x) {
2211
      return x.toString(16).toUpperCase();
2212
    },
2213
    g: function(x, p) {
2214
      return x.toPrecision(p);
2215
    },
2216
    e: function(x, p) {
2217
      return x.toExponential(p);
2218
    },
2219
    f: function(x, p) {
2220
      return x.toFixed(p);
2221
    },
2222
    r: function(x, p) {
2223
      return (x = d3.round(x, d3_format_precision(x, p))).toFixed(Math.max(0, Math.min(20, d3_format_precision(x * (1 + 1e-15), p))));
2224
    }
2225
  });
2226
  function d3_format_precision(x, p) {
2227
    return p - (x ? Math.ceil(Math.log(x) / Math.LN10) : 1);
2228
  }
2229
  function d3_format_typeDefault(x) {
2230
    return x + "";
2231
  }
2232
  var d3_format_group = d3_identity;
2233
  if (d3_format_grouping) {
2234
    var d3_format_groupingLength = d3_format_grouping.length;
2235
    d3_format_group = function(value) {
2236
      var i = value.length, t = [], j = 0, g = d3_format_grouping[0];
2237
      while (i > 0 && g > 0) {
2238
        t.push(value.substring(i -= g, i + g));
2239
        g = d3_format_grouping[j = (j + 1) % d3_format_groupingLength];
2240
      }
2241
      return t.reverse().join(d3_format_thousandsSeparator);
2242
    };
2243
  }
2244
  d3.geo = {};
2245
  function d3_adder() {}
2246
  d3_adder.prototype = {
2247
    s: 0,
2248
    t: 0,
2249
    add: function(y) {
2250
      d3_adderSum(y, this.t, d3_adderTemp);
2251
      d3_adderSum(d3_adderTemp.s, this.s, this);
2252
      if (this.s) this.t += d3_adderTemp.t; else this.s = d3_adderTemp.t;
2253
    },
2254
    reset: function() {
2255
      this.s = this.t = 0;
2256
    },
2257
    valueOf: function() {
2258
      return this.s;
2259
    }
2260
  };
2261
  var d3_adderTemp = new d3_adder();
2262
  function d3_adderSum(a, b, o) {
2263
    var x = o.s = a + b, bv = x - a, av = x - bv;
2264
    o.t = a - av + (b - bv);
2265
  }
2266
  d3.geo.stream = function(object, listener) {
2267
    if (object && d3_geo_streamObjectType.hasOwnProperty(object.type)) {
2268
      d3_geo_streamObjectType[object.type](object, listener);
2269
    } else {
2270
      d3_geo_streamGeometry(object, listener);
2271
    }
2272
  };
2273
  function d3_geo_streamGeometry(geometry, listener) {
2274
    if (geometry && d3_geo_streamGeometryType.hasOwnProperty(geometry.type)) {
2275
      d3_geo_streamGeometryType[geometry.type](geometry, listener);
2276
    }
2277
  }
2278
  var d3_geo_streamObjectType = {
2279
    Feature: function(feature, listener) {
2280
      d3_geo_streamGeometry(feature.geometry, listener);
2281
    },
2282
    FeatureCollection: function(object, listener) {
2283
      var features = object.features, i = -1, n = features.length;
2284
      while (++i < n) d3_geo_streamGeometry(features[i].geometry, listener);
2285
    }
2286
  };
2287
  var d3_geo_streamGeometryType = {
2288
    Sphere: function(object, listener) {
2289
      listener.sphere();
2290
    },
2291
    Point: function(object, listener) {
2292
      object = object.coordinates;
2293
      listener.point(object[0], object[1], object[2]);
2294
    },
2295
    MultiPoint: function(object, listener) {
2296
      var coordinates = object.coordinates, i = -1, n = coordinates.length;
2297
      while (++i < n) object = coordinates[i], listener.point(object[0], object[1], object[2]);
2298
    },
2299
    LineString: function(object, listener) {
2300
      d3_geo_streamLine(object.coordinates, listener, 0);
2301
    },
2302
    MultiLineString: function(object, listener) {
2303
      var coordinates = object.coordinates, i = -1, n = coordinates.length;
2304
      while (++i < n) d3_geo_streamLine(coordinates[i], listener, 0);
2305
    },
2306
    Polygon: function(object, listener) {
2307
      d3_geo_streamPolygon(object.coordinates, listener);
2308
    },
2309
    MultiPolygon: function(object, listener) {
2310
      var coordinates = object.coordinates, i = -1, n = coordinates.length;
2311
      while (++i < n) d3_geo_streamPolygon(coordinates[i], listener);
2312
    },
2313
    GeometryCollection: function(object, listener) {
2314
      var geometries = object.geometries, i = -1, n = geometries.length;
2315
      while (++i < n) d3_geo_streamGeometry(geometries[i], listener);
2316
    }
2317
  };
2318
  function d3_geo_streamLine(coordinates, listener, closed) {
2319
    var i = -1, n = coordinates.length - closed, coordinate;
2320
    listener.lineStart();
2321
    while (++i < n) coordinate = coordinates[i], listener.point(coordinate[0], coordinate[1], coordinate[2]);
2322
    listener.lineEnd();
2323
  }
2324
  function d3_geo_streamPolygon(coordinates, listener) {
2325
    var i = -1, n = coordinates.length;
2326
    listener.polygonStart();
2327
    while (++i < n) d3_geo_streamLine(coordinates[i], listener, 1);
2328
    listener.polygonEnd();
2329
  }
2330
  d3.geo.area = function(object) {
2331
    d3_geo_areaSum = 0;
2332
    d3.geo.stream(object, d3_geo_area);
2333
    return d3_geo_areaSum;
2334
  };
2335
  var d3_geo_areaSum, d3_geo_areaRingSum = new d3_adder();
2336
  var d3_geo_area = {
2337
    sphere: function() {
2338
      d3_geo_areaSum += 4 * π;
2339
    },
2340
    point: d3_noop,
2341
    lineStart: d3_noop,
2342
    lineEnd: d3_noop,
2343
    polygonStart: function() {
2344
      d3_geo_areaRingSum.reset();
2345
      d3_geo_area.lineStart = d3_geo_areaRingStart;
2346
    },
2347
    polygonEnd: function() {
2348
      var area = 2 * d3_geo_areaRingSum;
2349
      d3_geo_areaSum += area < 0 ? 4 * π + area : area;
2350
      d3_geo_area.lineStart = d3_geo_area.lineEnd = d3_geo_area.point = d3_noop;
2351
    }
2352
  };
2353
  function d3_geo_areaRingStart() {
2354
    var λ00, φ00, λ0, cosφ0, sinφ0;
2355
    d3_geo_area.point = function(λ, φ) {
2356
      d3_geo_area.point = nextPoint;
2357
      λ0 = (λ00 = λ) * d3_radians, cosφ0 = Math.cos(φ = (φ00 = φ) * d3_radians / 2 + π / 4), 
2358
      sinφ0 = Math.sin(φ);
2359
    };
2360
    function nextPoint(λ, φ) {
2361
      λ *= d3_radians;
2362
      φ = φ * d3_radians / 2 + π / 4;
2363
      var dλ = λ - λ0, cosφ = Math.cos(φ), sinφ = Math.sin(φ), k = sinφ0 * sinφ, u = cosφ0 * cosφ + k * Math.cos(dλ), v = k * Math.sin(dλ);
2364
      d3_geo_areaRingSum.add(Math.atan2(v, u));
2365
      λ0 = λ, cosφ0 = cosφ, sinφ0 = sinφ;
2366
    }
2367
    d3_geo_area.lineEnd = function() {
2368
      nextPoint(λ00, φ00);
2369
    };
2370
  }
2371
  function d3_geo_cartesian(spherical) {
2372
    var λ = spherical[0], φ = spherical[1], cosφ = Math.cos(φ);
2373
    return [ cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ) ];
2374
  }
2375
  function d3_geo_cartesianDot(a, b) {
2376
    return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
2377
  }
2378
  function d3_geo_cartesianCross(a, b) {
2379
    return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
2380
  }
2381
  function d3_geo_cartesianAdd(a, b) {
2382
    a[0] += b[0];
2383
    a[1] += b[1];
2384
    a[2] += b[2];
2385
  }
2386
  function d3_geo_cartesianScale(vector, k) {
2387
    return [ vector[0] * k, vector[1] * k, vector[2] * k ];
2388
  }
2389
  function d3_geo_cartesianNormalize(d) {
2390
    var l = Math.sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
2391
    d[0] /= l;
2392
    d[1] /= l;
2393
    d[2] /= l;
2394
  }
2395
  function d3_geo_spherical(cartesian) {
2396
    return [ Math.atan2(cartesian[1], cartesian[0]), d3_asin(cartesian[2]) ];
2397
  }
2398
  function d3_geo_sphericalEqual(a, b) {
2399
    return abs(a[0] - b[0]) < ε && abs(a[1] - b[1]) < ε;
2400
  }
2401
  d3.geo.bounds = function() {
2402
    var λ0, φ0, λ1, φ1, λ_, λ__, φ__, p0, dλSum, ranges, range;
2403
    var bound = {
2404
      point: point,
2405
      lineStart: lineStart,
2406
      lineEnd: lineEnd,
2407
      polygonStart: function() {
2408
        bound.point = ringPoint;
2409
        bound.lineStart = ringStart;
2410
        bound.lineEnd = ringEnd;
2411
        dλSum = 0;
2412
        d3_geo_area.polygonStart();
2413
      },
2414
      polygonEnd: function() {
2415
        d3_geo_area.polygonEnd();
2416
        bound.point = point;
2417
        bound.lineStart = lineStart;
2418
        bound.lineEnd = lineEnd;
2419
        if (d3_geo_areaRingSum < 0) λ0 = -(λ1 = 180), φ0 = -(φ1 = 90); else if (dλSum > ε) φ1 = 90; else if (dλSum < -ε) φ0 = -90;
2420
        range[0] = λ0, range[1] = λ1;
2421
      }
2422
    };
2423
    function point(λ, φ) {
2424
      ranges.push(range = [ λ0 = λ, λ1 = λ ]);
2425
      if (φ < φ0) φ0 = φ;
2426
      if (φ > φ1) φ1 = φ;
2427
    }
2428
    function linePoint(λ, φ) {
2429
      var p = d3_geo_cartesian([ λ * d3_radians, φ * d3_radians ]);
2430
      if (p0) {
2431
        var normal = d3_geo_cartesianCross(p0, p), equatorial = [ normal[1], -normal[0], 0 ], inflection = d3_geo_cartesianCross(equatorial, normal);
2432
        d3_geo_cartesianNormalize(inflection);
2433
        inflection = d3_geo_spherical(inflection);
2434
        var dλ = λ - λ_, s = dλ > 0 ? 1 : -1, λi = inflection[0] * d3_degrees * s, antimeridian = abs(dλ) > 180;
2435
        if (antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
2436
          var φi = inflection[1] * d3_degrees;
2437
          if (φi > φ1) φ1 = φi;
2438
        } else if (λi = (λi + 360) % 360 - 180, antimeridian ^ (s * λ_ < λi && λi < s * λ)) {
2439
          var φi = -inflection[1] * d3_degrees;
2440
          if (φi < φ0) φ0 = φi;
2441
        } else {
2442
          if (φ < φ0) φ0 = φ;
2443
          if (φ > φ1) φ1 = φ;
2444
        }
2445
        if (antimeridian) {
2446
          if (λ < λ_) {
2447
            if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
2448
          } else {
2449
            if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
2450
          }
2451
        } else {
2452
          if (λ1 >= λ0) {
2453
            if (λ < λ0) λ0 = λ;
2454
            if (λ > λ1) λ1 = λ;
2455
          } else {
2456
            if (λ > λ_) {
2457
              if (angle(λ0, λ) > angle(λ0, λ1)) λ1 = λ;
2458
            } else {
2459
              if (angle(λ, λ1) > angle(λ0, λ1)) λ0 = λ;
2460
            }
2461
          }
2462
        }
2463
      } else {
2464
        point(λ, φ);
2465
      }
2466
      p0 = p, λ_ = λ;
2467
    }
2468
    function lineStart() {
2469
      bound.point = linePoint;
2470
    }
2471
    function lineEnd() {
2472
      range[0] = λ0, range[1] = λ1;
2473
      bound.point = point;
2474
      p0 = null;
2475
    }
2476
    function ringPoint(λ, φ) {
2477
      if (p0) {
2478
        var dλ = λ - λ_;
2479
        dλSum += abs(dλ) > 180 ? dλ + (dλ > 0 ? 360 : -360) : dλ;
2480
      } else λ__ = λ, φ__ = φ;
2481
      d3_geo_area.point(λ, φ);
2482
      linePoint(λ, φ);
2483
    }
2484
    function ringStart() {
2485
      d3_geo_area.lineStart();
2486
    }
2487
    function ringEnd() {
2488
      ringPoint(λ__, φ__);
2489
      d3_geo_area.lineEnd();
2490
      if (abs(dλSum) > ε) λ0 = -(λ1 = 180);
2491
      range[0] = λ0, range[1] = λ1;
2492
      p0 = null;
2493
    }
2494
    function angle(λ0, λ1) {
2495
      return (λ1 -= λ0) < 0 ? λ1 + 360 : λ1;
2496
    }
2497
    function compareRanges(a, b) {
2498
      return a[0] - b[0];
2499
    }
2500
    function withinRange(x, range) {
2501
      return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
2502
    }
2503
    return function(feature) {
2504
      φ1 = λ1 = -(λ0 = φ0 = Infinity);
2505
      ranges = [];
2506
      d3.geo.stream(feature, bound);
2507
      var n = ranges.length;
2508
      if (n) {
2509
        ranges.sort(compareRanges);
2510
        for (var i = 1, a = ranges[0], b, merged = [ a ]; i < n; ++i) {
2511
          b = ranges[i];
2512
          if (withinRange(b[0], a) || withinRange(b[1], a)) {
2513
            if (angle(a[0], b[1]) > angle(a[0], a[1])) a[1] = b[1];
2514
            if (angle(b[0], a[1]) > angle(a[0], a[1])) a[0] = b[0];
2515
          } else {
2516
            merged.push(a = b);
2517
          }
2518
        }
2519
        var best = -Infinity, dλ;
2520
        for (var n = merged.length - 1, i = 0, a = merged[n], b; i <= n; a = b, ++i) {
2521
          b = merged[i];
2522
          if ((dλ = angle(a[1], b[0])) > best) best = dλ, λ0 = b[0], λ1 = a[1];
2523
        }
2524
      }
2525
      ranges = range = null;
2526
      return λ0 === Infinity || φ0 === Infinity ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ λ0, φ0 ], [ λ1, φ1 ] ];
2527
    };
2528
  }();
2529
  d3.geo.centroid = function(object) {
2530
    d3_geo_centroidW0 = d3_geo_centroidW1 = d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
2531
    d3.geo.stream(object, d3_geo_centroid);
2532
    var x = d3_geo_centroidX2, y = d3_geo_centroidY2, z = d3_geo_centroidZ2, m = x * x + y * y + z * z;
2533
    if (m < ε2) {
2534
      x = d3_geo_centroidX1, y = d3_geo_centroidY1, z = d3_geo_centroidZ1;
2535
      if (d3_geo_centroidW1 < ε) x = d3_geo_centroidX0, y = d3_geo_centroidY0, z = d3_geo_centroidZ0;
2536
      m = x * x + y * y + z * z;
2537
      if (m < ε2) return [ NaN, NaN ];
2538
    }
2539
    return [ Math.atan2(y, x) * d3_degrees, d3_asin(z / Math.sqrt(m)) * d3_degrees ];
2540
  };
2541
  var d3_geo_centroidW0, d3_geo_centroidW1, d3_geo_centroidX0, d3_geo_centroidY0, d3_geo_centroidZ0, d3_geo_centroidX1, d3_geo_centroidY1, d3_geo_centroidZ1, d3_geo_centroidX2, d3_geo_centroidY2, d3_geo_centroidZ2;
2542
  var d3_geo_centroid = {
2543
    sphere: d3_noop,
2544
    point: d3_geo_centroidPoint,
2545
    lineStart: d3_geo_centroidLineStart,
2546
    lineEnd: d3_geo_centroidLineEnd,
2547
    polygonStart: function() {
2548
      d3_geo_centroid.lineStart = d3_geo_centroidRingStart;
2549
    },
2550
    polygonEnd: function() {
2551
      d3_geo_centroid.lineStart = d3_geo_centroidLineStart;
2552
    }
2553
  };
2554
  function d3_geo_centroidPoint(λ, φ) {
2555
    λ *= d3_radians;
2556
    var cosφ = Math.cos(φ *= d3_radians);
2557
    d3_geo_centroidPointXYZ(cosφ * Math.cos(λ), cosφ * Math.sin(λ), Math.sin(φ));
2558
  }
2559
  function d3_geo_centroidPointXYZ(x, y, z) {
2560
    ++d3_geo_centroidW0;
2561
    d3_geo_centroidX0 += (x - d3_geo_centroidX0) / d3_geo_centroidW0;
2562
    d3_geo_centroidY0 += (y - d3_geo_centroidY0) / d3_geo_centroidW0;
2563
    d3_geo_centroidZ0 += (z - d3_geo_centroidZ0) / d3_geo_centroidW0;
2564
  }
2565
  function d3_geo_centroidLineStart() {
2566
    var x0, y0, z0;
2567
    d3_geo_centroid.point = function(λ, φ) {
2568
      λ *= d3_radians;
2569
      var cosφ = Math.cos(φ *= d3_radians);
2570
      x0 = cosφ * Math.cos(λ);
2571
      y0 = cosφ * Math.sin(λ);
2572
      z0 = Math.sin(φ);
2573
      d3_geo_centroid.point = nextPoint;
2574
      d3_geo_centroidPointXYZ(x0, y0, z0);
2575
    };
2576
    function nextPoint(λ, φ) {
2577
      λ *= d3_radians;
2578
      var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), w = Math.atan2(Math.sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
2579
      d3_geo_centroidW1 += w;
2580
      d3_geo_centroidX1 += w * (x0 + (x0 = x));
2581
      d3_geo_centroidY1 += w * (y0 + (y0 = y));
2582
      d3_geo_centroidZ1 += w * (z0 + (z0 = z));
2583
      d3_geo_centroidPointXYZ(x0, y0, z0);
2584
    }
2585
  }
2586
  function d3_geo_centroidLineEnd() {
2587
    d3_geo_centroid.point = d3_geo_centroidPoint;
2588
  }
2589
  function d3_geo_centroidRingStart() {
2590
    var λ00, φ00, x0, y0, z0;
2591
    d3_geo_centroid.point = function(λ, φ) {
2592
      λ00 = λ, φ00 = φ;
2593
      d3_geo_centroid.point = nextPoint;
2594
      λ *= d3_radians;
2595
      var cosφ = Math.cos(φ *= d3_radians);
2596
      x0 = cosφ * Math.cos(λ);
2597
      y0 = cosφ * Math.sin(λ);
2598
      z0 = Math.sin(φ);
2599
      d3_geo_centroidPointXYZ(x0, y0, z0);
2600
    };
2601
    d3_geo_centroid.lineEnd = function() {
2602
      nextPoint(λ00, φ00);
2603
      d3_geo_centroid.lineEnd = d3_geo_centroidLineEnd;
2604
      d3_geo_centroid.point = d3_geo_centroidPoint;
2605
    };
2606
    function nextPoint(λ, φ) {
2607
      λ *= d3_radians;
2608
      var cosφ = Math.cos(φ *= d3_radians), x = cosφ * Math.cos(λ), y = cosφ * Math.sin(λ), z = Math.sin(φ), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = Math.sqrt(cx * cx + cy * cy + cz * cz), u = x0 * x + y0 * y + z0 * z, v = m && -d3_acos(u) / m, w = Math.atan2(m, u);
2609
      d3_geo_centroidX2 += v * cx;
2610
      d3_geo_centroidY2 += v * cy;
2611
      d3_geo_centroidZ2 += v * cz;
2612
      d3_geo_centroidW1 += w;
2613
      d3_geo_centroidX1 += w * (x0 + (x0 = x));
2614
      d3_geo_centroidY1 += w * (y0 + (y0 = y));
2615
      d3_geo_centroidZ1 += w * (z0 + (z0 = z));
2616
      d3_geo_centroidPointXYZ(x0, y0, z0);
2617
    }
2618
  }
2619
  function d3_true() {
2620
    return true;
2621
  }
2622
  function d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener) {
2623
    var subject = [], clip = [];
2624
    segments.forEach(function(segment) {
2625
      if ((n = segment.length - 1) <= 0) return;
2626
      var n, p0 = segment[0], p1 = segment[n];
2627
      if (d3_geo_sphericalEqual(p0, p1)) {
2628
        listener.lineStart();
2629
        for (var i = 0; i < n; ++i) listener.point((p0 = segment[i])[0], p0[1]);
2630
        listener.lineEnd();
2631
        return;
2632
      }
2633
      var a = new d3_geo_clipPolygonIntersection(p0, segment, null, true), b = new d3_geo_clipPolygonIntersection(p0, null, a, false);
2634
      a.o = b;
2635
      subject.push(a);
2636
      clip.push(b);
2637
      a = new d3_geo_clipPolygonIntersection(p1, segment, null, false);
2638
      b = new d3_geo_clipPolygonIntersection(p1, null, a, true);
2639
      a.o = b;
2640
      subject.push(a);
2641
      clip.push(b);
2642
    });
2643
    clip.sort(compare);
2644
    d3_geo_clipPolygonLinkCircular(subject);
2645
    d3_geo_clipPolygonLinkCircular(clip);
2646
    if (!subject.length) return;
2647
    for (var i = 0, entry = clipStartInside, n = clip.length; i < n; ++i) {
2648
      clip[i].e = entry = !entry;
2649
    }
2650
    var start = subject[0], points, point;
2651
    while (1) {
2652
      var current = start, isSubject = true;
2653
      while (current.v) if ((current = current.n) === start) return;
2654
      points = current.z;
2655
      listener.lineStart();
2656
      do {
2657
        current.v = current.o.v = true;
2658
        if (current.e) {
2659
          if (isSubject) {
2660
            for (var i = 0, n = points.length; i < n; ++i) listener.point((point = points[i])[0], point[1]);
2661
          } else {
2662
            interpolate(current.x, current.n.x, 1, listener);
2663
          }
2664
          current = current.n;
2665
        } else {
2666
          if (isSubject) {
2667
            points = current.p.z;
2668
            for (var i = points.length - 1; i >= 0; --i) listener.point((point = points[i])[0], point[1]);
2669
          } else {
2670
            interpolate(current.x, current.p.x, -1, listener);
2671
          }
2672
          current = current.p;
2673
        }
2674
        current = current.o;
2675
        points = current.z;
2676
        isSubject = !isSubject;
2677
      } while (!current.v);
2678
      listener.lineEnd();
2679
    }
2680
  }
2681
  function d3_geo_clipPolygonLinkCircular(array) {
2682
    if (!(n = array.length)) return;
2683
    var n, i = 0, a = array[0], b;
2684
    while (++i < n) {
2685
      a.n = b = array[i];
2686
      b.p = a;
2687
      a = b;
2688
    }
2689
    a.n = b = array[0];
2690
    b.p = a;
2691
  }
2692
  function d3_geo_clipPolygonIntersection(point, points, other, entry) {
2693
    this.x = point;
2694
    this.z = points;
2695
    this.o = other;
2696
    this.e = entry;
2697
    this.v = false;
2698
    this.n = this.p = null;
2699
  }
2700
  function d3_geo_clip(pointVisible, clipLine, interpolate, clipStart) {
2701
    return function(rotate, listener) {
2702
      var line = clipLine(listener), rotatedClipStart = rotate.invert(clipStart[0], clipStart[1]);
2703
      var clip = {
2704
        point: point,
2705
        lineStart: lineStart,
2706
        lineEnd: lineEnd,
2707
        polygonStart: function() {
2708
          clip.point = pointRing;
2709
          clip.lineStart = ringStart;
2710
          clip.lineEnd = ringEnd;
2711
          segments = [];
2712
          polygon = [];
2713
          listener.polygonStart();
2714
        },
2715
        polygonEnd: function() {
2716
          clip.point = point;
2717
          clip.lineStart = lineStart;
2718
          clip.lineEnd = lineEnd;
2719
          segments = d3.merge(segments);
2720
          var clipStartInside = d3_geo_pointInPolygon(rotatedClipStart, polygon);
2721
          if (segments.length) {
2722
            d3_geo_clipPolygon(segments, d3_geo_clipSort, clipStartInside, interpolate, listener);
2723
          } else if (clipStartInside) {
2724
            listener.lineStart();
2725
            interpolate(null, null, 1, listener);
2726
            listener.lineEnd();
2727
          }
2728
          listener.polygonEnd();
2729
          segments = polygon = null;
2730
        },
2731
        sphere: function() {
2732
          listener.polygonStart();
2733
          listener.lineStart();
2734
          interpolate(null, null, 1, listener);
2735
          listener.lineEnd();
2736
          listener.polygonEnd();
2737
        }
2738
      };
2739
      function point(λ, φ) {
2740
        var point = rotate(λ, φ);
2741
        if (pointVisible(λ = point[0], φ = point[1])) listener.point(λ, φ);
2742
      }
2743
      function pointLine(λ, φ) {
2744
        var point = rotate(λ, φ);
2745
        line.point(point[0], point[1]);
2746
      }
2747
      function lineStart() {
2748
        clip.point = pointLine;
2749
        line.lineStart();
2750
      }
2751
      function lineEnd() {
2752
        clip.point = point;
2753
        line.lineEnd();
2754
      }
2755
      var segments;
2756
      var buffer = d3_geo_clipBufferListener(), ringListener = clipLine(buffer), polygon, ring;
2757
      function pointRing(λ, φ) {
2758
        ring.push([ λ, φ ]);
2759
        var point = rotate(λ, φ);
2760
        ringListener.point(point[0], point[1]);
2761
      }
2762
      function ringStart() {
2763
        ringListener.lineStart();
2764
        ring = [];
2765
      }
2766
      function ringEnd() {
2767
        pointRing(ring[0][0], ring[0][1]);
2768
        ringListener.lineEnd();
2769
        var clean = ringListener.clean(), ringSegments = buffer.buffer(), segment, n = ringSegments.length;
2770
        ring.pop();
2771
        polygon.push(ring);
2772
        ring = null;
2773
        if (!n) return;
2774
        if (clean & 1) {
2775
          segment = ringSegments[0];
2776
          var n = segment.length - 1, i = -1, point;
2777
          listener.lineStart();
2778
          while (++i < n) listener.point((point = segment[i])[0], point[1]);
2779
          listener.lineEnd();
2780
          return;
2781
        }
2782
        if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
2783
        segments.push(ringSegments.filter(d3_geo_clipSegmentLength1));
2784
      }
2785
      return clip;
2786
    };
2787
  }
2788
  function d3_geo_clipSegmentLength1(segment) {
2789
    return segment.length > 1;
2790
  }
2791
  function d3_geo_clipBufferListener() {
2792
    var lines = [], line;
2793
    return {
2794
      lineStart: function() {
2795
        lines.push(line = []);
2796
      },
2797
      point: function(λ, φ) {
2798
        line.push([ λ, φ ]);
2799
      },
2800
      lineEnd: d3_noop,
2801
      buffer: function() {
2802
        var buffer = lines;
2803
        lines = [];
2804
        line = null;
2805
        return buffer;
2806
      },
2807
      rejoin: function() {
2808
        if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
2809
      }
2810
    };
2811
  }
2812
  function d3_geo_clipSort(a, b) {
2813
    return ((a = a.x)[0] < 0 ? a[1] - halfπ - ε : halfπ - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfπ - ε : halfπ - b[1]);
2814
  }
2815
  function d3_geo_pointInPolygon(point, polygon) {
2816
    var meridian = point[0], parallel = point[1], meridianNormal = [ Math.sin(meridian), -Math.cos(meridian), 0 ], polarAngle = 0, winding = 0;
2817
    d3_geo_areaRingSum.reset();
2818
    for (var i = 0, n = polygon.length; i < n; ++i) {
2819
      var ring = polygon[i], m = ring.length;
2820
      if (!m) continue;
2821
      var point0 = ring[0], λ0 = point0[0], φ0 = point0[1] / 2 + π / 4, sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), j = 1;
2822
      while (true) {
2823
        if (j === m) j = 0;
2824
        point = ring[j];
2825
        var λ = point[0], φ = point[1] / 2 + π / 4, sinφ = Math.sin(φ), cosφ = Math.cos(φ), dλ = λ - λ0, antimeridian = abs(dλ) > π, k = sinφ0 * sinφ;
2826
        d3_geo_areaRingSum.add(Math.atan2(k * Math.sin(dλ), cosφ0 * cosφ + k * Math.cos(dλ)));
2827
        polarAngle += antimeridian ? dλ + (dλ >= 0 ? τ : -τ) : dλ;
2828
        if (antimeridian ^ λ0 >= meridian ^ λ >= meridian) {
2829
          var arc = d3_geo_cartesianCross(d3_geo_cartesian(point0), d3_geo_cartesian(point));
2830
          d3_geo_cartesianNormalize(arc);
2831
          var intersection = d3_geo_cartesianCross(meridianNormal, arc);
2832
          d3_geo_cartesianNormalize(intersection);
2833
          var φarc = (antimeridian ^ dλ >= 0 ? -1 : 1) * d3_asin(intersection[2]);
2834
          if (parallel > φarc || parallel === φarc && (arc[0] || arc[1])) {
2835
            winding += antimeridian ^ dλ >= 0 ? 1 : -1;
2836
          }
2837
        }
2838
        if (!j++) break;
2839
        λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ, point0 = point;
2840
      }
2841
    }
2842
    return (polarAngle < -ε || polarAngle < ε && d3_geo_areaRingSum < 0) ^ winding & 1;
2843
  }
2844
  var d3_geo_clipAntimeridian = d3_geo_clip(d3_true, d3_geo_clipAntimeridianLine, d3_geo_clipAntimeridianInterpolate, [ -π, -π / 2 ]);
2845
  function d3_geo_clipAntimeridianLine(listener) {
2846
    var λ0 = NaN, φ0 = NaN, sλ0 = NaN, clean;
2847
    return {
2848
      lineStart: function() {
2849
        listener.lineStart();
2850
        clean = 1;
2851
      },
2852
      point: function(λ1, φ1) {
2853
        var sλ1 = λ1 > 0 ? π : -π, dλ = abs(λ1 - λ0);
2854
        if (abs(dλ - π) < ε) {
2855
          listener.point(λ0, φ0 = (φ0 + φ1) / 2 > 0 ? halfπ : -halfπ);
2856
          listener.point(sλ0, φ0);
2857
          listener.lineEnd();
2858
          listener.lineStart();
2859
          listener.point(sλ1, φ0);
2860
          listener.point(λ1, φ0);
2861
          clean = 0;
2862
        } else if (sλ0 !== sλ1 && dλ >= π) {
2863
          if (abs(λ0 - sλ0) < ε) λ0 -= sλ0 * ε;
2864
          if (abs(λ1 - sλ1) < ε) λ1 -= sλ1 * ε;
2865
          φ0 = d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1);
2866
          listener.point(sλ0, φ0);
2867
          listener.lineEnd();
2868
          listener.lineStart();
2869
          listener.point(sλ1, φ0);
2870
          clean = 0;
2871
        }
2872
        listener.point(λ0 = λ1, φ0 = φ1);
2873
        sλ0 = sλ1;
2874
      },
2875
      lineEnd: function() {
2876
        listener.lineEnd();
2877
        λ0 = φ0 = NaN;
2878
      },
2879
      clean: function() {
2880
        return 2 - clean;
2881
      }
2882
    };
2883
  }
2884
  function d3_geo_clipAntimeridianIntersect(λ0, φ0, λ1, φ1) {
2885
    var cosφ0, cosφ1, sinλ0_λ1 = Math.sin(λ0 - λ1);
2886
    return abs(sinλ0_λ1) > ε ? Math.atan((Math.sin(φ0) * (cosφ1 = Math.cos(φ1)) * Math.sin(λ1) - Math.sin(φ1) * (cosφ0 = Math.cos(φ0)) * Math.sin(λ0)) / (cosφ0 * cosφ1 * sinλ0_λ1)) : (φ0 + φ1) / 2;
2887
  }
2888
  function d3_geo_clipAntimeridianInterpolate(from, to, direction, listener) {
2889
    var φ;
2890
    if (from == null) {
2891
      φ = direction * halfπ;
2892
      listener.point(-π, φ);
2893
      listener.point(0, φ);
2894
      listener.point(π, φ);
2895
      listener.point(π, 0);
2896
      listener.point(π, -φ);
2897
      listener.point(0, -φ);
2898
      listener.point(-π, -φ);
2899
      listener.point(-π, 0);
2900
      listener.point(-π, φ);
2901
    } else if (abs(from[0] - to[0]) > ε) {
2902
      var s = from[0] < to[0] ? π : -π;
2903
      φ = direction * s / 2;
2904
      listener.point(-s, φ);
2905
      listener.point(0, φ);
2906
      listener.point(s, φ);
2907
    } else {
2908
      listener.point(to[0], to[1]);
2909
    }
2910
  }
2911
  function d3_geo_clipCircle(radius) {
2912
    var cr = Math.cos(radius), smallRadius = cr > 0, notHemisphere = abs(cr) > ε, interpolate = d3_geo_circleInterpolate(radius, 6 * d3_radians);
2913
    return d3_geo_clip(visible, clipLine, interpolate, smallRadius ? [ 0, -radius ] : [ -π, radius - π ]);
2914
    function visible(λ, φ) {
2915
      return Math.cos(λ) * Math.cos(φ) > cr;
2916
    }
2917
    function clipLine(listener) {
2918
      var point0, c0, v0, v00, clean;
2919
      return {
2920
        lineStart: function() {
2921
          v00 = v0 = false;
2922
          clean = 1;
2923
        },
2924
        point: function(λ, φ) {
2925
          var point1 = [ λ, φ ], point2, v = visible(λ, φ), c = smallRadius ? v ? 0 : code(λ, φ) : v ? code(λ + (λ < 0 ? π : -π), φ) : 0;
2926
          if (!point0 && (v00 = v0 = v)) listener.lineStart();
2927
          if (v !== v0) {
2928
            point2 = intersect(point0, point1);
2929
            if (d3_geo_sphericalEqual(point0, point2) || d3_geo_sphericalEqual(point1, point2)) {
2930
              point1[0] += ε;
2931
              point1[1] += ε;
2932
              v = visible(point1[0], point1[1]);
2933
            }
2934
          }
2935
          if (v !== v0) {
2936
            clean = 0;
2937
            if (v) {
2938
              listener.lineStart();
2939
              point2 = intersect(point1, point0);
2940
              listener.point(point2[0], point2[1]);
2941
            } else {
2942
              point2 = intersect(point0, point1);
2943
              listener.point(point2[0], point2[1]);
2944
              listener.lineEnd();
2945
            }
2946
            point0 = point2;
2947
          } else if (notHemisphere && point0 && smallRadius ^ v) {
2948
            var t;
2949
            if (!(c & c0) && (t = intersect(point1, point0, true))) {
2950
              clean = 0;
2951
              if (smallRadius) {
2952
                listener.lineStart();
2953
                listener.point(t[0][0], t[0][1]);
2954
                listener.point(t[1][0], t[1][1]);
2955
                listener.lineEnd();
2956
              } else {
2957
                listener.point(t[1][0], t[1][1]);
2958
                listener.lineEnd();
2959
                listener.lineStart();
2960
                listener.point(t[0][0], t[0][1]);
2961
              }
2962
            }
2963
          }
2964
          if (v && (!point0 || !d3_geo_sphericalEqual(point0, point1))) {
2965
            listener.point(point1[0], point1[1]);
2966
          }
2967
          point0 = point1, v0 = v, c0 = c;
2968
        },
2969
        lineEnd: function() {
2970
          if (v0) listener.lineEnd();
2971
          point0 = null;
2972
        },
2973
        clean: function() {
2974
          return clean | (v00 && v0) << 1;
2975
        }
2976
      };
2977
    }
2978
    function intersect(a, b, two) {
2979
      var pa = d3_geo_cartesian(a), pb = d3_geo_cartesian(b);
2980
      var n1 = [ 1, 0, 0 ], n2 = d3_geo_cartesianCross(pa, pb), n2n2 = d3_geo_cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
2981
      if (!determinant) return !two && a;
2982
      var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = d3_geo_cartesianCross(n1, n2), A = d3_geo_cartesianScale(n1, c1), B = d3_geo_cartesianScale(n2, c2);
2983
      d3_geo_cartesianAdd(A, B);
2984
      var u = n1xn2, w = d3_geo_cartesianDot(A, u), uu = d3_geo_cartesianDot(u, u), t2 = w * w - uu * (d3_geo_cartesianDot(A, A) - 1);
2985
      if (t2 < 0) return;
2986
      var t = Math.sqrt(t2), q = d3_geo_cartesianScale(u, (-w - t) / uu);
2987
      d3_geo_cartesianAdd(q, A);
2988
      q = d3_geo_spherical(q);
2989
      if (!two) return q;
2990
      var λ0 = a[0], λ1 = b[0], φ0 = a[1], φ1 = b[1], z;
2991
      if (λ1 < λ0) z = λ0, λ0 = λ1, λ1 = z;
2992
      var δλ = λ1 - λ0, polar = abs(δλ - π) < ε, meridian = polar || δλ < ε;
2993
      if (!polar && φ1 < φ0) z = φ0, φ0 = φ1, φ1 = z;
2994
      if (meridian ? polar ? φ0 + φ1 > 0 ^ q[1] < (abs(q[0] - λ0) < ε ? φ0 : φ1) : φ0 <= q[1] && q[1] <= φ1 : δλ > π ^ (λ0 <= q[0] && q[0] <= λ1)) {
2995
        var q1 = d3_geo_cartesianScale(u, (-w + t) / uu);
2996
        d3_geo_cartesianAdd(q1, A);
2997
        return [ q, d3_geo_spherical(q1) ];
2998
      }
2999
    }
3000
    function code(λ, φ) {
3001
      var r = smallRadius ? radius : π - radius, code = 0;
3002
      if (λ < -r) code |= 1; else if (λ > r) code |= 2;
3003
      if (φ < -r) code |= 4; else if (φ > r) code |= 8;
3004
      return code;
3005
    }
3006
  }
3007
  function d3_geom_clipLine(x0, y0, x1, y1) {
3008
    return function(line) {
3009
      var a = line.a, b = line.b, ax = a.x, ay = a.y, bx = b.x, by = b.y, t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r;
3010
      r = x0 - ax;
3011
      if (!dx && r > 0) return;
3012
      r /= dx;
3013
      if (dx < 0) {
3014
        if (r < t0) return;
3015
        if (r < t1) t1 = r;
3016
      } else if (dx > 0) {
3017
        if (r > t1) return;
3018
        if (r > t0) t0 = r;
3019
      }
3020
      r = x1 - ax;
3021
      if (!dx && r < 0) return;
3022
      r /= dx;
3023
      if (dx < 0) {
3024
        if (r > t1) return;
3025
        if (r > t0) t0 = r;
3026
      } else if (dx > 0) {
3027
        if (r < t0) return;
3028
        if (r < t1) t1 = r;
3029
      }
3030
      r = y0 - ay;
3031
      if (!dy && r > 0) return;
3032
      r /= dy;
3033
      if (dy < 0) {
3034
        if (r < t0) return;
3035
        if (r < t1) t1 = r;
3036
      } else if (dy > 0) {
3037
        if (r > t1) return;
3038
        if (r > t0) t0 = r;
3039
      }
3040
      r = y1 - ay;
3041
      if (!dy && r < 0) return;
3042
      r /= dy;
3043
      if (dy < 0) {
3044
        if (r > t1) return;
3045
        if (r > t0) t0 = r;
3046
      } else if (dy > 0) {
3047
        if (r < t0) return;
3048
        if (r < t1) t1 = r;
3049
      }
3050
      if (t0 > 0) line.a = {
3051
        x: ax + t0 * dx,
3052
        y: ay + t0 * dy
3053
      };
3054
      if (t1 < 1) line.b = {
3055
        x: ax + t1 * dx,
3056
        y: ay + t1 * dy
3057
      };
3058
      return line;
3059
    };
3060
  }
3061
  var d3_geo_clipExtentMAX = 1e9;
3062
  d3.geo.clipExtent = function() {
3063
    var x0, y0, x1, y1, stream, clip, clipExtent = {
3064
      stream: function(output) {
3065
        if (stream) stream.valid = false;
3066
        stream = clip(output);
3067
        stream.valid = true;
3068
        return stream;
3069
      },
3070
      extent: function(_) {
3071
        if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
3072
        clip = d3_geo_clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]);
3073
        if (stream) stream.valid = false, stream = null;
3074
        return clipExtent;
3075
      }
3076
    };
3077
    return clipExtent.extent([ [ 0, 0 ], [ 960, 500 ] ]);
3078
  };
3079
  function d3_geo_clipExtent(x0, y0, x1, y1) {
3080
    return function(listener) {
3081
      var listener_ = listener, bufferListener = d3_geo_clipBufferListener(), clipLine = d3_geom_clipLine(x0, y0, x1, y1), segments, polygon, ring;
3082
      var clip = {
3083
        point: point,
3084
        lineStart: lineStart,
3085
        lineEnd: lineEnd,
3086
        polygonStart: function() {
3087
          listener = bufferListener;
3088
          segments = [];
3089
          polygon = [];
3090
          clean = true;
3091
        },
3092
        polygonEnd: function() {
3093
          listener = listener_;
3094
          segments = d3.merge(segments);
3095
          var clipStartInside = insidePolygon([ x0, y1 ]), inside = clean && clipStartInside, visible = segments.length;
3096
          if (inside || visible) {
3097
            listener.polygonStart();
3098
            if (inside) {
3099
              listener.lineStart();
3100
              interpolate(null, null, 1, listener);
3101
              listener.lineEnd();
3102
            }
3103
            if (visible) {
3104
              d3_geo_clipPolygon(segments, compare, clipStartInside, interpolate, listener);
3105
            }
3106
            listener.polygonEnd();
3107
          }
3108
          segments = polygon = ring = null;
3109
        }
3110
      };
3111
      function insidePolygon(p) {
3112
        var wn = 0, n = polygon.length, y = p[1];
3113
        for (var i = 0; i < n; ++i) {
3114
          for (var j = 1, v = polygon[i], m = v.length, a = v[0], b; j < m; ++j) {
3115
            b = v[j];
3116
            if (a[1] <= y) {
3117
              if (b[1] > y && isLeft(a, b, p) > 0) ++wn;
3118
            } else {
3119
              if (b[1] <= y && isLeft(a, b, p) < 0) --wn;
3120
            }
3121
            a = b;
3122
          }
3123
        }
3124
        return wn !== 0;
3125
      }
3126
      function isLeft(a, b, c) {
3127
        return (b[0] - a[0]) * (c[1] - a[1]) - (c[0] - a[0]) * (b[1] - a[1]);
3128
      }
3129
      function interpolate(from, to, direction, listener) {
3130
        var a = 0, a1 = 0;
3131
        if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoints(from, to) < 0 ^ direction > 0) {
3132
          do {
3133
            listener.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0);
3134
          } while ((a = (a + direction + 4) % 4) !== a1);
3135
        } else {
3136
          listener.point(to[0], to[1]);
3137
        }
3138
      }
3139
      function pointVisible(x, y) {
3140
        return x0 <= x && x <= x1 && y0 <= y && y <= y1;
3141
      }
3142
      function point(x, y) {
3143
        if (pointVisible(x, y)) listener.point(x, y);
3144
      }
3145
      var x__, y__, v__, x_, y_, v_, first, clean;
3146
      function lineStart() {
3147
        clip.point = linePoint;
3148
        if (polygon) polygon.push(ring = []);
3149
        first = true;
3150
        v_ = false;
3151
        x_ = y_ = NaN;
3152
      }
3153
      function lineEnd() {
3154
        if (segments) {
3155
          linePoint(x__, y__);
3156
          if (v__ && v_) bufferListener.rejoin();
3157
          segments.push(bufferListener.buffer());
3158
        }
3159
        clip.point = point;
3160
        if (v_) listener.lineEnd();
3161
      }
3162
      function linePoint(x, y) {
3163
        x = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, x));
3164
        y = Math.max(-d3_geo_clipExtentMAX, Math.min(d3_geo_clipExtentMAX, y));
3165
        var v = pointVisible(x, y);
3166
        if (polygon) ring.push([ x, y ]);
3167
        if (first) {
3168
          x__ = x, y__ = y, v__ = v;
3169
          first = false;
3170
          if (v) {
3171
            listener.lineStart();
3172
            listener.point(x, y);
3173
          }
3174
        } else {
3175
          if (v && v_) listener.point(x, y); else {
3176
            var l = {
3177
              a: {
3178
                x: x_,
3179
                y: y_
3180
              },
3181
              b: {
3182
                x: x,
3183
                y: y
3184
              }
3185
            };
3186
            if (clipLine(l)) {
3187
              if (!v_) {
3188
                listener.lineStart();
3189
                listener.point(l.a.x, l.a.y);
3190
              }
3191
              listener.point(l.b.x, l.b.y);
3192
              if (!v) listener.lineEnd();
3193
              clean = false;
3194
            } else if (v) {
3195
              listener.lineStart();
3196
              listener.point(x, y);
3197
              clean = false;
3198
            }
3199
          }
3200
        }
3201
        x_ = x, y_ = y, v_ = v;
3202
      }
3203
      return clip;
3204
    };
3205
    function corner(p, direction) {
3206
      return abs(p[0] - x0) < ε ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < ε ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < ε ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
3207
    }
3208
    function compare(a, b) {
3209
      return comparePoints(a.x, b.x);
3210
    }
3211
    function comparePoints(a, b) {
3212
      var ca = corner(a, 1), cb = corner(b, 1);
3213
      return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0];
3214
    }
3215
  }
3216
  function d3_geo_compose(a, b) {
3217
    function compose(x, y) {
3218
      return x = a(x, y), b(x[0], x[1]);
3219
    }
3220
    if (a.invert && b.invert) compose.invert = function(x, y) {
3221
      return x = b.invert(x, y), x && a.invert(x[0], x[1]);
3222
    };
3223
    return compose;
3224
  }
3225
  function d3_geo_conic(projectAt) {
3226
    var φ0 = 0, φ1 = π / 3, m = d3_geo_projectionMutator(projectAt), p = m(φ0, φ1);
3227
    p.parallels = function(_) {
3228
      if (!arguments.length) return [ φ0 / π * 180, φ1 / π * 180 ];
3229
      return m(φ0 = _[0] * π / 180, φ1 = _[1] * π / 180);
3230
    };
3231
    return p;
3232
  }
3233
  function d3_geo_conicEqualArea(φ0, φ1) {
3234
    var sinφ0 = Math.sin(φ0), n = (sinφ0 + Math.sin(φ1)) / 2, C = 1 + sinφ0 * (2 * n - sinφ0), ρ0 = Math.sqrt(C) / n;
3235
    function forward(λ, φ) {
3236
      var ρ = Math.sqrt(C - 2 * n * Math.sin(φ)) / n;
3237
      return [ ρ * Math.sin(λ *= n), ρ0 - ρ * Math.cos(λ) ];
3238
    }
3239
    forward.invert = function(x, y) {
3240
      var ρ0_y = ρ0 - y;
3241
      return [ Math.atan2(x, ρ0_y) / n, d3_asin((C - (x * x + ρ0_y * ρ0_y) * n * n) / (2 * n)) ];
3242
    };
3243
    return forward;
3244
  }
3245
  (d3.geo.conicEqualArea = function() {
3246
    return d3_geo_conic(d3_geo_conicEqualArea);
3247
  }).raw = d3_geo_conicEqualArea;
3248
  d3.geo.albers = function() {
3249
    return d3.geo.conicEqualArea().rotate([ 96, 0 ]).center([ -.6, 38.7 ]).parallels([ 29.5, 45.5 ]).scale(1070);
3250
  };
3251
  d3.geo.albersUsa = function() {
3252
    var lower48 = d3.geo.albers();
3253
    var alaska = d3.geo.conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]);
3254
    var hawaii = d3.geo.conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]);
3255
    var point, pointStream = {
3256
      point: function(x, y) {
3257
        point = [ x, y ];
3258
      }
3259
    }, lower48Point, alaskaPoint, hawaiiPoint;
3260
    function albersUsa(coordinates) {
3261
      var x = coordinates[0], y = coordinates[1];
3262
      point = null;
3263
      (lower48Point(x, y), point) || (alaskaPoint(x, y), point) || hawaiiPoint(x, y);
3264
      return point;
3265
    }
3266
    albersUsa.invert = function(coordinates) {
3267
      var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;
3268
      return (y >= .12 && y < .234 && x >= -.425 && x < -.214 ? alaska : y >= .166 && y < .234 && x >= -.214 && x < -.115 ? hawaii : lower48).invert(coordinates);
3269
    };
3270
    albersUsa.stream = function(stream) {
3271
      var lower48Stream = lower48.stream(stream), alaskaStream = alaska.stream(stream), hawaiiStream = hawaii.stream(stream);
3272
      return {
3273
        point: function(x, y) {
3274
          lower48Stream.point(x, y);
3275
          alaskaStream.point(x, y);
3276
          hawaiiStream.point(x, y);
3277
        },
3278
        sphere: function() {
3279
          lower48Stream.sphere();
3280
          alaskaStream.sphere();
3281
          hawaiiStream.sphere();
3282
        },
3283
        lineStart: function() {
3284
          lower48Stream.lineStart();
3285
          alaskaStream.lineStart();
3286
          hawaiiStream.lineStart();
3287
        },
3288
        lineEnd: function() {
3289
          lower48Stream.lineEnd();
3290
          alaskaStream.lineEnd();
3291
          hawaiiStream.lineEnd();
3292
        },
3293
        polygonStart: function() {
3294
          lower48Stream.polygonStart();
3295
          alaskaStream.polygonStart();
3296
          hawaiiStream.polygonStart();
3297
        },
3298
        polygonEnd: function() {
3299
          lower48Stream.polygonEnd();
3300
          alaskaStream.polygonEnd();
3301
          hawaiiStream.polygonEnd();
3302
        }
3303
      };
3304
    };
3305
    albersUsa.precision = function(_) {
3306
      if (!arguments.length) return lower48.precision();
3307
      lower48.precision(_);
3308
      alaska.precision(_);
3309
      hawaii.precision(_);
3310
      return albersUsa;
3311
    };
3312
    albersUsa.scale = function(_) {
3313
      if (!arguments.length) return lower48.scale();
3314
      lower48.scale(_);
3315
      alaska.scale(_ * .35);
3316
      hawaii.scale(_);
3317
      return albersUsa.translate(lower48.translate());
3318
    };
3319
    albersUsa.translate = function(_) {
3320
      if (!arguments.length) return lower48.translate();
3321
      var k = lower48.scale(), x = +_[0], y = +_[1];
3322
      lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream).point;
3323
      alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + ε, y + .12 * k + ε ], [ x - .214 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;
3324
      hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + ε, y + .166 * k + ε ], [ x - .115 * k - ε, y + .234 * k - ε ] ]).stream(pointStream).point;
3325
      return albersUsa;
3326
    };
3327
    return albersUsa.scale(1070);
3328
  };
3329
  var d3_geo_pathAreaSum, d3_geo_pathAreaPolygon, d3_geo_pathArea = {
3330
    point: d3_noop,
3331
    lineStart: d3_noop,
3332
    lineEnd: d3_noop,
3333
    polygonStart: function() {
3334
      d3_geo_pathAreaPolygon = 0;
3335
      d3_geo_pathArea.lineStart = d3_geo_pathAreaRingStart;
3336
    },
3337
    polygonEnd: function() {
3338
      d3_geo_pathArea.lineStart = d3_geo_pathArea.lineEnd = d3_geo_pathArea.point = d3_noop;
3339
      d3_geo_pathAreaSum += abs(d3_geo_pathAreaPolygon / 2);
3340
    }
3341
  };
3342
  function d3_geo_pathAreaRingStart() {
3343
    var x00, y00, x0, y0;
3344
    d3_geo_pathArea.point = function(x, y) {
3345
      d3_geo_pathArea.point = nextPoint;
3346
      x00 = x0 = x, y00 = y0 = y;
3347
    };
3348
    function nextPoint(x, y) {
3349
      d3_geo_pathAreaPolygon += y0 * x - x0 * y;
3350
      x0 = x, y0 = y;
3351
    }
3352
    d3_geo_pathArea.lineEnd = function() {
3353
      nextPoint(x00, y00);
3354
    };
3355
  }
3356
  var d3_geo_pathBoundsX0, d3_geo_pathBoundsY0, d3_geo_pathBoundsX1, d3_geo_pathBoundsY1;
3357
  var d3_geo_pathBounds = {
3358
    point: d3_geo_pathBoundsPoint,
3359
    lineStart: d3_noop,
3360
    lineEnd: d3_noop,
3361
    polygonStart: d3_noop,
3362
    polygonEnd: d3_noop
3363
  };
3364
  function d3_geo_pathBoundsPoint(x, y) {
3365
    if (x < d3_geo_pathBoundsX0) d3_geo_pathBoundsX0 = x;
3366
    if (x > d3_geo_pathBoundsX1) d3_geo_pathBoundsX1 = x;
3367
    if (y < d3_geo_pathBoundsY0) d3_geo_pathBoundsY0 = y;
3368
    if (y > d3_geo_pathBoundsY1) d3_geo_pathBoundsY1 = y;
3369
  }
3370
  function d3_geo_pathBuffer() {
3371
    var pointCircle = d3_geo_pathBufferCircle(4.5), buffer = [];
3372
    var stream = {
3373
      point: point,
3374
      lineStart: function() {
3375
        stream.point = pointLineStart;
3376
      },
3377
      lineEnd: lineEnd,
3378
      polygonStart: function() {
3379
        stream.lineEnd = lineEndPolygon;
3380
      },
3381
      polygonEnd: function() {
3382
        stream.lineEnd = lineEnd;
3383
        stream.point = point;
3384
      },
3385
      pointRadius: function(_) {
3386
        pointCircle = d3_geo_pathBufferCircle(_);
3387
        return stream;
3388
      },
3389
      result: function() {
3390
        if (buffer.length) {
3391
          var result = buffer.join("");
3392
          buffer = [];
3393
          return result;
3394
        }
3395
      }
3396
    };
3397
    function point(x, y) {
3398
      buffer.push("M", x, ",", y, pointCircle);
3399
    }
3400
    function pointLineStart(x, y) {
3401
      buffer.push("M", x, ",", y);
3402
      stream.point = pointLine;
3403
    }
3404
    function pointLine(x, y) {
3405
      buffer.push("L", x, ",", y);
3406
    }
3407
    function lineEnd() {
3408
      stream.point = point;
3409
    }
3410
    function lineEndPolygon() {
3411
      buffer.push("Z");
3412
    }
3413
    return stream;
3414
  }
3415
  function d3_geo_pathBufferCircle(radius) {
3416
    return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
3417
  }
3418
  var d3_geo_pathCentroid = {
3419
    point: d3_geo_pathCentroidPoint,
3420
    lineStart: d3_geo_pathCentroidLineStart,
3421
    lineEnd: d3_geo_pathCentroidLineEnd,
3422
    polygonStart: function() {
3423
      d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidRingStart;
3424
    },
3425
    polygonEnd: function() {
3426
      d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
3427
      d3_geo_pathCentroid.lineStart = d3_geo_pathCentroidLineStart;
3428
      d3_geo_pathCentroid.lineEnd = d3_geo_pathCentroidLineEnd;
3429
    }
3430
  };
3431
  function d3_geo_pathCentroidPoint(x, y) {
3432
    d3_geo_centroidX0 += x;
3433
    d3_geo_centroidY0 += y;
3434
    ++d3_geo_centroidZ0;
3435
  }
3436
  function d3_geo_pathCentroidLineStart() {
3437
    var x0, y0;
3438
    d3_geo_pathCentroid.point = function(x, y) {
3439
      d3_geo_pathCentroid.point = nextPoint;
3440
      d3_geo_pathCentroidPoint(x0 = x, y0 = y);
3441
    };
3442
    function nextPoint(x, y) {
3443
      var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
3444
      d3_geo_centroidX1 += z * (x0 + x) / 2;
3445
      d3_geo_centroidY1 += z * (y0 + y) / 2;
3446
      d3_geo_centroidZ1 += z;
3447
      d3_geo_pathCentroidPoint(x0 = x, y0 = y);
3448
    }
3449
  }
3450
  function d3_geo_pathCentroidLineEnd() {
3451
    d3_geo_pathCentroid.point = d3_geo_pathCentroidPoint;
3452
  }
3453
  function d3_geo_pathCentroidRingStart() {
3454
    var x00, y00, x0, y0;
3455
    d3_geo_pathCentroid.point = function(x, y) {
3456
      d3_geo_pathCentroid.point = nextPoint;
3457
      d3_geo_pathCentroidPoint(x00 = x0 = x, y00 = y0 = y);
3458
    };
3459
    function nextPoint(x, y) {
3460
      var dx = x - x0, dy = y - y0, z = Math.sqrt(dx * dx + dy * dy);
3461
      d3_geo_centroidX1 += z * (x0 + x) / 2;
3462
      d3_geo_centroidY1 += z * (y0 + y) / 2;
3463
      d3_geo_centroidZ1 += z;
3464
      z = y0 * x - x0 * y;
3465
      d3_geo_centroidX2 += z * (x0 + x);
3466
      d3_geo_centroidY2 += z * (y0 + y);
3467
      d3_geo_centroidZ2 += z * 3;
3468
      d3_geo_pathCentroidPoint(x0 = x, y0 = y);
3469
    }
3470
    d3_geo_pathCentroid.lineEnd = function() {
3471
      nextPoint(x00, y00);
3472
    };
3473
  }
3474
  function d3_geo_pathContext(context) {
3475
    var pointRadius = 4.5;
3476
    var stream = {
3477
      point: point,
3478
      lineStart: function() {
3479
        stream.point = pointLineStart;
3480
      },
3481
      lineEnd: lineEnd,
3482
      polygonStart: function() {
3483
        stream.lineEnd = lineEndPolygon;
3484
      },
3485
      polygonEnd: function() {
3486
        stream.lineEnd = lineEnd;
3487
        stream.point = point;
3488
      },
3489
      pointRadius: function(_) {
3490
        pointRadius = _;
3491
        return stream;
3492
      },
3493
      result: d3_noop
3494
    };
3495
    function point(x, y) {
3496
      context.moveToPixel(x, y);
3497
      context.arc(x, y, pointRadius, 0, τ);
3498
    }
3499
    function pointLineStart(x, y) {
3500
      context.moveToPixel(x, y);
3501
      stream.point = pointLine;
3502
    }
3503
    function pointLine(x, y) {
3504
      context.lineTo(x, y);
3505
    }
3506
    function lineEnd() {
3507
      stream.point = point;
3508
    }
3509
    function lineEndPolygon() {
3510
      context.closePath();
3511
    }
3512
    return stream;
3513
  }
3514
  function d3_geo_resample(project) {
3515
    var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16;
3516
    function resample(stream) {
3517
      return (maxDepth ? resampleRecursive : resampleNone)(stream);
3518
    }
3519
    function resampleNone(stream) {
3520
      return d3_geo_transformPoint(stream, function(x, y) {
3521
        x = project(x, y);
3522
        stream.point(x[0], x[1]);
3523
      });
3524
    }
3525
    function resampleRecursive(stream) {
3526
      var λ00, φ00, x00, y00, a00, b00, c00, λ0, x0, y0, a0, b0, c0;
3527
      var resample = {
3528
        point: point,
3529
        lineStart: lineStart,
3530
        lineEnd: lineEnd,
3531
        polygonStart: function() {
3532
          stream.polygonStart();
3533
          resample.lineStart = ringStart;
3534
        },
3535
        polygonEnd: function() {
3536
          stream.polygonEnd();
3537
          resample.lineStart = lineStart;
3538
        }
3539
      };
3540
      function point(x, y) {
3541
        x = project(x, y);
3542
        stream.point(x[0], x[1]);
3543
      }
3544
      function lineStart() {
3545
        x0 = NaN;
3546
        resample.point = linePoint;
3547
        stream.lineStart();
3548
      }
3549
      function linePoint(λ, φ) {
3550
        var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ);
3551
        resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream);
3552
        stream.point(x0, y0);
3553
      }
3554
      function lineEnd() {
3555
        resample.point = point;
3556
        stream.lineEnd();
3557
      }
3558
      function ringStart() {
3559
        lineStart();
3560
        resample.point = ringPoint;
3561
        resample.lineEnd = ringEnd;
3562
      }
3563
      function ringPoint(λ, φ) {
3564
        linePoint(λ00 = λ, φ00 = φ), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0;
3565
        resample.point = linePoint;
3566
      }
3567
      function ringEnd() {
3568
        resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream);
3569
        resample.lineEnd = lineEnd;
3570
        lineEnd();
3571
      }
3572
      return resample;
3573
    }
3574
    function resampleLineTo(x0, y0, λ0, a0, b0, c0, x1, y1, λ1, a1, b1, c1, depth, stream) {
3575
      var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
3576
      if (d2 > 4 * δ2 && depth--) {
3577
        var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = Math.sqrt(a * a + b * b + c * c), φ2 = Math.asin(c /= m), λ2 = abs(abs(c) - 1) < ε || abs(λ0 - λ1) < ε ? (λ0 + λ1) / 2 : Math.atan2(b, a), p = project(λ2, φ2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
3578
        if (dz * dz / d2 > δ2 || abs((dx * dx2 + dy * dy2) / d2 - .5) > .3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
3579
          resampleLineTo(x0, y0, λ0, a0, b0, c0, x2, y2, λ2, a /= m, b /= m, c, depth, stream);
3580
          stream.point(x2, y2);
3581
          resampleLineTo(x2, y2, λ2, a, b, c, x1, y1, λ1, a1, b1, c1, depth, stream);
3582
        }
3583
      }
3584
    }
3585
    resample.precision = function(_) {
3586
      if (!arguments.length) return Math.sqrt(δ2);
3587
      maxDepth = (δ2 = _ * _) > 0 && 16;
3588
      return resample;
3589
    };
3590
    return resample;
3591
  }
3592
  d3.geo.path = function() {
3593
    var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream;
3594
    function path(object) {
3595
      if (object) {
3596
        if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
3597
        if (!cacheStream || !cacheStream.valid) cacheStream = projectStream(contextStream);
3598
        d3.geo.stream(object, cacheStream);
3599
      }
3600
      return contextStream.result();
3601
    }
3602
    path.area = function(object) {
3603
      d3_geo_pathAreaSum = 0;
3604
      d3.geo.stream(object, projectStream(d3_geo_pathArea));
3605
      return d3_geo_pathAreaSum;
3606
    };
3607
    path.centroid = function(object) {
3608
      d3_geo_centroidX0 = d3_geo_centroidY0 = d3_geo_centroidZ0 = d3_geo_centroidX1 = d3_geo_centroidY1 = d3_geo_centroidZ1 = d3_geo_centroidX2 = d3_geo_centroidY2 = d3_geo_centroidZ2 = 0;
3609
      d3.geo.stream(object, projectStream(d3_geo_pathCentroid));
3610
      return d3_geo_centroidZ2 ? [ d3_geo_centroidX2 / d3_geo_centroidZ2, d3_geo_centroidY2 / d3_geo_centroidZ2 ] : d3_geo_centroidZ1 ? [ d3_geo_centroidX1 / d3_geo_centroidZ1, d3_geo_centroidY1 / d3_geo_centroidZ1 ] : d3_geo_centroidZ0 ? [ d3_geo_centroidX0 / d3_geo_centroidZ0, d3_geo_centroidY0 / d3_geo_centroidZ0 ] : [ NaN, NaN ];
3611
    };
3612
    path.bounds = function(object) {
3613
      d3_geo_pathBoundsX1 = d3_geo_pathBoundsY1 = -(d3_geo_pathBoundsX0 = d3_geo_pathBoundsY0 = Infinity);
3614
      d3.geo.stream(object, projectStream(d3_geo_pathBounds));
3615
      return [ [ d3_geo_pathBoundsX0, d3_geo_pathBoundsY0 ], [ d3_geo_pathBoundsX1, d3_geo_pathBoundsY1 ] ];
3616
    };
3617
    path.projection = function(_) {
3618
      if (!arguments.length) return projection;
3619
      projectStream = (projection = _) ? _.stream || d3_geo_pathProjectStream(_) : d3_identity;
3620
      return reset();
3621
    };
3622
    path.context = function(_) {
3623
      if (!arguments.length) return context;
3624
      contextStream = (context = _) == null ? new d3_geo_pathBuffer() : new d3_geo_pathContext(_);
3625
      if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
3626
      return reset();
3627
    };
3628
    path.pointRadius = function(_) {
3629
      if (!arguments.length) return pointRadius;
3630
      pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
3631
      return path;
3632
    };
3633
    function reset() {
3634
      cacheStream = null;
3635
      return path;
3636
    }
3637
    return path.projection(d3.geo.albersUsa()).context(null);
3638
  };
3639
  function d3_geo_pathProjectStream(project) {
3640
    var resample = d3_geo_resample(function(x, y) {
3641
      return project([ x * d3_degrees, y * d3_degrees ]);
3642
    });
3643
    return function(stream) {
3644
      return d3_geo_projectionRadians(resample(stream));
3645
    };
3646
  }
3647
  d3.geo.transform = function(methods) {
3648
    return {
3649
      stream: function(stream) {
3650
        var transform = new d3_geo_transform(stream);
3651
        for (var k in methods) transform[k] = methods[k];
3652
        return transform;
3653
      }
3654
    };
3655
  };
3656
  function d3_geo_transform(stream) {
3657
    this.stream = stream;
3658
  }
3659
  d3_geo_transform.prototype = {
3660
    point: function(x, y) {
3661
      this.stream.point(x, y);
3662
    },
3663
    sphere: function() {
3664
      this.stream.sphere();
3665
    },
3666
    lineStart: function() {
3667
      this.stream.lineStart();
3668
    },
3669
    lineEnd: function() {
3670
      this.stream.lineEnd();
3671
    },
3672
    polygonStart: function() {
3673
      this.stream.polygonStart();
3674
    },
3675
    polygonEnd: function() {
3676
      this.stream.polygonEnd();
3677
    }
3678
  };
3679
  function d3_geo_transformPoint(stream, point) {
3680
    return {
3681
      point: point,
3682
      sphere: function() {
3683
        stream.sphere();
3684
      },
3685
      lineStart: function() {
3686
        stream.lineStart();
3687
      },
3688
      lineEnd: function() {
3689
        stream.lineEnd();
3690
      },
3691
      polygonStart: function() {
3692
        stream.polygonStart();
3693
      },
3694
      polygonEnd: function() {
3695
        stream.polygonEnd();
3696
      }
3697
    };
3698
  }
3699
  d3.geo.projection = d3_geo_projection;
3700
  d3.geo.projectionMutator = d3_geo_projectionMutator;
3701
  function d3_geo_projection(project) {
3702
    return d3_geo_projectionMutator(function() {
3703
      return project;
3704
    })();
3705
  }
3706
  function d3_geo_projectionMutator(projectAt) {
3707
    var project, rotate, projectRotate, projectResample = d3_geo_resample(function(x, y) {
3708
      x = project(x, y);
3709
      return [ x[0] * k + δx, δy - x[1] * k ];
3710
    }), k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, preclip = d3_geo_clipAntimeridian, postclip = d3_identity, clipAngle = null, clipExtent = null, stream;
3711
    function projection(point) {
3712
      point = projectRotate(point[0] * d3_radians, point[1] * d3_radians);
3713
      return [ point[0] * k + δx, δy - point[1] * k ];
3714
    }
3715
    function invert(point) {
3716
      point = projectRotate.invert((point[0] - δx) / k, (δy - point[1]) / k);
3717
      return point && [ point[0] * d3_degrees, point[1] * d3_degrees ];
3718
    }
3719
    projection.stream = function(output) {
3720
      if (stream) stream.valid = false;
3721
      stream = d3_geo_projectionRadians(preclip(rotate, projectResample(postclip(output))));
3722
      stream.valid = true;
3723
      return stream;
3724
    };
3725
    projection.clipAngle = function(_) {
3726
      if (!arguments.length) return clipAngle;
3727
      preclip = _ == null ? (clipAngle = _, d3_geo_clipAntimeridian) : d3_geo_clipCircle((clipAngle = +_) * d3_radians);
3728
      return invalidate();
3729
    };
3730
    projection.clipExtent = function(_) {
3731
      if (!arguments.length) return clipExtent;
3732
      clipExtent = _;
3733
      postclip = _ ? d3_geo_clipExtent(_[0][0], _[0][1], _[1][0], _[1][1]) : d3_identity;
3734
      return invalidate();
3735
    };
3736
    projection.scale = function(_) {
3737
      if (!arguments.length) return k;
3738
      k = +_;
3739
      return reset();
3740
    };
3741
    projection.translate = function(_) {
3742
      if (!arguments.length) return [ x, y ];
3743
      x = +_[0];
3744
      y = +_[1];
3745
      return reset();
3746
    };
3747
    projection.center = function(_) {
3748
      if (!arguments.length) return [ λ * d3_degrees, φ * d3_degrees ];
3749
      λ = _[0] % 360 * d3_radians;
3750
      φ = _[1] % 360 * d3_radians;
3751
      return reset();
3752
    };
3753
    projection.rotate = function(_) {
3754
      if (!arguments.length) return [ δλ * d3_degrees, δφ * d3_degrees, δγ * d3_degrees ];
3755
      δλ = _[0] % 360 * d3_radians;
3756
      δφ = _[1] % 360 * d3_radians;
3757
      δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0;
3758
      return reset();
3759
    };
3760
    d3.rebind(projection, projectResample, "precision");
3761
    function reset() {
3762
      projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project);
3763
      var center = project(λ, φ);
3764
      δx = x - center[0] * k;
3765
      δy = y + center[1] * k;
3766
      return invalidate();
3767
    }
3768
    function invalidate() {
3769
      if (stream) stream.valid = false, stream = null;
3770
      return projection;
3771
    }
3772
    return function() {
3773
      project = projectAt.apply(this, arguments);
3774
      projection.invert = project.invert && invert;
3775
      return reset();
3776
    };
3777
  }
3778
  function d3_geo_projectionRadians(stream) {
3779
    return d3_geo_transformPoint(stream, function(x, y) {
3780
      stream.point(x * d3_radians, y * d3_radians);
3781
    });
3782
  }
3783
  function d3_geo_equirectangular(λ, φ) {
3784
    return [ λ, φ ];
3785
  }
3786
  (d3.geo.equirectangular = function() {
3787
    return d3_geo_projection(d3_geo_equirectangular);
3788
  }).raw = d3_geo_equirectangular.invert = d3_geo_equirectangular;
3789
  d3.geo.rotation = function(rotate) {
3790
    rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0);
3791
    function forward(coordinates) {
3792
      coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
3793
      return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
3794
    }
3795
    forward.invert = function(coordinates) {
3796
      coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
3797
      return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
3798
    };
3799
    return forward;
3800
  };
3801
  function d3_geo_identityRotation(λ, φ) {
3802
    return [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];
3803
  }
3804
  d3_geo_identityRotation.invert = d3_geo_equirectangular;
3805
  function d3_geo_rotation(δλ, δφ, δγ) {
3806
    return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_identityRotation;
3807
  }
3808
  function d3_geo_forwardRotationλ(δλ) {
3809
    return function(λ, φ) {
3810
      return λ += δλ, [ λ > π ? λ - τ : λ < -π ? λ + τ : λ, φ ];
3811
    };
3812
  }
3813
  function d3_geo_rotationλ(δλ) {
3814
    var rotation = d3_geo_forwardRotationλ(δλ);
3815
    rotation.invert = d3_geo_forwardRotationλ(-δλ);
3816
    return rotation;
3817
  }
3818
  function d3_geo_rotationφγ(δφ, δγ) {
3819
    var cosδφ = Math.cos(δφ), sinδφ = Math.sin(δφ), cosδγ = Math.cos(δγ), sinδγ = Math.sin(δγ);
3820
    function rotation(λ, φ) {
3821
      var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
3822
      return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), d3_asin(k * cosδγ + y * sinδγ) ];
3823
    }
3824
    rotation.invert = function(λ, φ) {
3825
      var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
3826
      return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), d3_asin(k * cosδφ - x * sinδφ) ];
3827
    };
3828
    return rotation;
3829
  }
3830
  d3.geo.circle = function() {
3831
    var origin = [ 0, 0 ], angle, precision = 6, interpolate;
3832
    function circle() {
3833
      var center = typeof origin === "function" ? origin.apply(this, arguments) : origin, rotate = d3_geo_rotation(-center[0] * d3_radians, -center[1] * d3_radians, 0).invert, ring = [];
3834
      interpolate(null, null, 1, {
3835
        point: function(x, y) {
3836
          ring.push(x = rotate(x, y));
3837
          x[0] *= d3_degrees, x[1] *= d3_degrees;
3838
        }
3839
      });
3840
      return {
3841
        type: "Polygon",
3842
        coordinates: [ ring ]
3843
      };
3844
    }
3845
    circle.origin = function(x) {
3846
      if (!arguments.length) return origin;
3847
      origin = x;
3848
      return circle;
3849
    };
3850
    circle.angle = function(x) {
3851
      if (!arguments.length) return angle;
3852
      interpolate = d3_geo_circleInterpolate((angle = +x) * d3_radians, precision * d3_radians);
3853
      return circle;
3854
    };
3855
    circle.precision = function(_) {
3856
      if (!arguments.length) return precision;
3857
      interpolate = d3_geo_circleInterpolate(angle * d3_radians, (precision = +_) * d3_radians);
3858
      return circle;
3859
    };
3860
    return circle.angle(90);
3861
  };
3862
  function d3_geo_circleInterpolate(radius, precision) {
3863
    var cr = Math.cos(radius), sr = Math.sin(radius);
3864
    return function(from, to, direction, listener) {
3865
      var step = direction * precision;
3866
      if (from != null) {
3867
        from = d3_geo_circleAngle(cr, from);
3868
        to = d3_geo_circleAngle(cr, to);
3869
        if (direction > 0 ? from < to : from > to) from += direction * τ;
3870
      } else {
3871
        from = radius + direction * τ;
3872
        to = radius - .5 * step;
3873
      }
3874
      for (var point, t = from; direction > 0 ? t > to : t < to; t -= step) {
3875
        listener.point((point = d3_geo_spherical([ cr, -sr * Math.cos(t), -sr * Math.sin(t) ]))[0], point[1]);
3876
      }
3877
    };
3878
  }
3879
  function d3_geo_circleAngle(cr, point) {
3880
    var a = d3_geo_cartesian(point);
3881
    a[0] -= cr;
3882
    d3_geo_cartesianNormalize(a);
3883
    var angle = d3_acos(-a[1]);
3884
    return ((-a[2] < 0 ? -angle : angle) + 2 * Math.PI - ε) % (2 * Math.PI);
3885
  }
3886
  d3.geo.distance = function(a, b) {
3887
    var Δλ = (b[0] - a[0]) * d3_radians, φ0 = a[1] * d3_radians, φ1 = b[1] * d3_radians, sinΔλ = Math.sin(Δλ), cosΔλ = Math.cos(Δλ), sinφ0 = Math.sin(φ0), cosφ0 = Math.cos(φ0), sinφ1 = Math.sin(φ1), cosφ1 = Math.cos(φ1), t;
3888
    return Math.atan2(Math.sqrt((t = cosφ1 * sinΔλ) * t + (t = cosφ0 * sinφ1 - sinφ0 * cosφ1 * cosΔλ) * t), sinφ0 * sinφ1 + cosφ0 * cosφ1 * cosΔλ);
3889
  };
3890
  d3.geo.graticule = function() {
3891
    var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5;
3892
    function graticule() {
3893
      return {
3894
        type: "MultiLineString",
3895
        coordinates: lines()
3896
      };
3897
    }
3898
    function lines() {
3899
      return d3.range(Math.ceil(X0 / DX) * DX, X1, DX).map(X).concat(d3.range(Math.ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(d3.range(Math.ceil(x0 / dx) * dx, x1, dx).filter(function(x) {
3900
        return abs(x % DX) > ε;
3901
      }).map(x)).concat(d3.range(Math.ceil(y0 / dy) * dy, y1, dy).filter(function(y) {
3902
        return abs(y % DY) > ε;
3903
      }).map(y));
3904
    }
3905
    graticule.lines = function() {
3906
      return lines().map(function(coordinates) {
3907
        return {
3908
          type: "LineString",
3909
          coordinates: coordinates
3910
        };
3911
      });
3912
    };
3913
    graticule.outline = function() {
3914
      return {
3915
        type: "Polygon",
3916
        coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ]
3917
      };
3918
    };
3919
    graticule.extent = function(_) {
3920
      if (!arguments.length) return graticule.minorExtent();
3921
      return graticule.majorExtent(_).minorExtent(_);
3922
    };
3923
    graticule.majorExtent = function(_) {
3924
      if (!arguments.length) return [ [ X0, Y0 ], [ X1, Y1 ] ];
3925
      X0 = +_[0][0], X1 = +_[1][0];
3926
      Y0 = +_[0][1], Y1 = +_[1][1];
3927
      if (X0 > X1) _ = X0, X0 = X1, X1 = _;
3928
      if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _;
3929
      return graticule.precision(precision);
3930
    };
3931
    graticule.minorExtent = function(_) {
3932
      if (!arguments.length) return [ [ x0, y0 ], [ x1, y1 ] ];
3933
      x0 = +_[0][0], x1 = +_[1][0];
3934
      y0 = +_[0][1], y1 = +_[1][1];
3935
      if (x0 > x1) _ = x0, x0 = x1, x1 = _;
3936
      if (y0 > y1) _ = y0, y0 = y1, y1 = _;
3937
      return graticule.precision(precision);
3938
    };
3939
    graticule.step = function(_) {
3940
      if (!arguments.length) return graticule.minorStep();
3941
      return graticule.majorStep(_).minorStep(_);
3942
    };
3943
    graticule.majorStep = function(_) {
3944
      if (!arguments.length) return [ DX, DY ];
3945
      DX = +_[0], DY = +_[1];
3946
      return graticule;
3947
    };
3948
    graticule.minorStep = function(_) {
3949
      if (!arguments.length) return [ dx, dy ];
3950
      dx = +_[0], dy = +_[1];
3951
      return graticule;
3952
    };
3953
    graticule.precision = function(_) {
3954
      if (!arguments.length) return precision;
3955
      precision = +_;
3956
      x = d3_geo_graticuleX(y0, y1, 90);
3957
      y = d3_geo_graticuleY(x0, x1, precision);
3958
      X = d3_geo_graticuleX(Y0, Y1, 90);
3959
      Y = d3_geo_graticuleY(X0, X1, precision);
3960
      return graticule;
3961
    };
3962
    return graticule.majorExtent([ [ -180, -90 + ε ], [ 180, 90 - ε ] ]).minorExtent([ [ -180, -80 - ε ], [ 180, 80 + ε ] ]);
3963
  };
3964
  function d3_geo_graticuleX(y0, y1, dy) {
3965
    var y = d3.range(y0, y1 - ε, dy).concat(y1);
3966
    return function(x) {
3967
      return y.map(function(y) {
3968
        return [ x, y ];
3969
      });
3970
    };
3971
  }
3972
  function d3_geo_graticuleY(x0, x1, dx) {
3973
    var x = d3.range(x0, x1 - ε, dx).concat(x1);
3974
    return function(y) {
3975
      return x.map(function(x) {
3976
        return [ x, y ];
3977
      });
3978
    };
3979
  }
3980
  function d3_source(d) {
3981
    return d.source;
3982
  }
3983
  function d3_target(d) {
3984
    return d.target;
3985
  }
3986
  d3.geo.greatArc = function() {
3987
    var source = d3_source, source_, target = d3_target, target_;
3988
    function greatArc() {
3989
      return {
3990
        type: "LineString",
3991
        coordinates: [ source_ || source.apply(this, arguments), target_ || target.apply(this, arguments) ]
3992
      };
3993
    }
3994
    greatArc.distance = function() {
3995
      return d3.geo.distance(source_ || source.apply(this, arguments), target_ || target.apply(this, arguments));
3996
    };
3997
    greatArc.source = function(_) {
3998
      if (!arguments.length) return source;
3999
      source = _, source_ = typeof _ === "function" ? null : _;
4000
      return greatArc;
4001
    };
4002
    greatArc.target = function(_) {
4003
      if (!arguments.length) return target;
4004
      target = _, target_ = typeof _ === "function" ? null : _;
4005
      return greatArc;
4006
    };
4007
    greatArc.precision = function() {
4008
      return arguments.length ? greatArc : 0;
4009
    };
4010
    return greatArc;
4011
  };
4012
  d3.geo.interpolate = function(source, target) {
4013
    return d3_geo_interpolate(source[0] * d3_radians, source[1] * d3_radians, target[0] * d3_radians, target[1] * d3_radians);
4014
  };
4015
  function d3_geo_interpolate(x0, y0, x1, y1) {
4016
    var cy0 = Math.cos(y0), sy0 = Math.sin(y0), cy1 = Math.cos(y1), sy1 = Math.sin(y1), kx0 = cy0 * Math.cos(x0), ky0 = cy0 * Math.sin(x0), kx1 = cy1 * Math.cos(x1), ky1 = cy1 * Math.sin(x1), d = 2 * Math.asin(Math.sqrt(d3_haversin(y1 - y0) + cy0 * cy1 * d3_haversin(x1 - x0))), k = 1 / Math.sin(d);
4017
    var interpolate = d ? function(t) {
4018
      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;
4019
      return [ Math.atan2(y, x) * d3_degrees, Math.atan2(z, Math.sqrt(x * x + y * y)) * d3_degrees ];
4020
    } : function() {
4021
      return [ x0 * d3_degrees, y0 * d3_degrees ];
4022
    };
4023
    interpolate.distance = d;
4024
    return interpolate;
4025
  }
4026
  d3.geo.length = function(object) {
4027
    d3_geo_lengthSum = 0;
4028
    d3.geo.stream(object, d3_geo_length);
4029
    return d3_geo_lengthSum;
4030
  };
4031
  var d3_geo_lengthSum;
4032
  var d3_geo_length = {
4033
    sphere: d3_noop,
4034
    point: d3_noop,
4035
    lineStart: d3_geo_lengthLineStart,
4036
    lineEnd: d3_noop,
4037
    polygonStart: d3_noop,
4038
    polygonEnd: d3_noop
4039
  };
4040
  function d3_geo_lengthLineStart() {
4041
    var λ0, sinφ0, cosφ0;
4042
    d3_geo_length.point = function(λ, φ) {
4043
      λ0 = λ * d3_radians, sinφ0 = Math.sin(φ *= d3_radians), cosφ0 = Math.cos(φ);
4044
      d3_geo_length.point = nextPoint;
4045
    };
4046
    d3_geo_length.lineEnd = function() {
4047
      d3_geo_length.point = d3_geo_length.lineEnd = d3_noop;
4048
    };
4049
    function nextPoint(λ, φ) {
4050
      var sinφ = Math.sin(φ *= d3_radians), cosφ = Math.cos(φ), t = abs((λ *= d3_radians) - λ0), cosΔλ = Math.cos(t);
4051
      d3_geo_lengthSum += Math.atan2(Math.sqrt((t = cosφ * Math.sin(t)) * t + (t = cosφ0 * sinφ - sinφ0 * cosφ * cosΔλ) * t), sinφ0 * sinφ + cosφ0 * cosφ * cosΔλ);
4052
      λ0 = λ, sinφ0 = sinφ, cosφ0 = cosφ;
4053
    }
4054
  }
4055
  function d3_geo_azimuthal(scale, angle) {
4056
    function azimuthal(λ, φ) {
4057
      var cosλ = Math.cos(λ), cosφ = Math.cos(φ), k = scale(cosλ * cosφ);
4058
      return [ k * cosφ * Math.sin(λ), k * Math.sin(φ) ];
4059
    }
4060
    azimuthal.invert = function(x, y) {
4061
      var ρ = Math.sqrt(x * x + y * y), c = angle(ρ), sinc = Math.sin(c), cosc = Math.cos(c);
4062
      return [ Math.atan2(x * sinc, ρ * cosc), Math.asin(ρ && y * sinc / ρ) ];
4063
    };
4064
    return azimuthal;
4065
  }
4066
  var d3_geo_azimuthalEqualArea = d3_geo_azimuthal(function(cosλcosφ) {
4067
    return Math.sqrt(2 / (1 + cosλcosφ));
4068
  }, function(ρ) {
4069
    return 2 * Math.asin(ρ / 2);
4070
  });
4071
  (d3.geo.azimuthalEqualArea = function() {
4072
    return d3_geo_projection(d3_geo_azimuthalEqualArea);
4073
  }).raw = d3_geo_azimuthalEqualArea;
4074
  var d3_geo_azimuthalEquidistant = d3_geo_azimuthal(function(cosλcosφ) {
4075
    var c = Math.acos(cosλcosφ);
4076
    return c && c / Math.sin(c);
4077
  }, d3_identity);
4078
  (d3.geo.azimuthalEquidistant = function() {
4079
    return d3_geo_projection(d3_geo_azimuthalEquidistant);
4080
  }).raw = d3_geo_azimuthalEquidistant;
4081
  function d3_geo_conicConformal(φ0, φ1) {
4082
    var cosφ0 = Math.cos(φ0), t = function(φ) {
4083
      return Math.tan(π / 4 + φ / 2);
4084
    }, n = φ0 === φ1 ? Math.sin(φ0) : Math.log(cosφ0 / Math.cos(φ1)) / Math.log(t(φ1) / t(φ0)), F = cosφ0 * Math.pow(t(φ0), n) / n;
4085
    if (!n) return d3_geo_mercator;
4086
    function forward(λ, φ) {
4087
      var ρ = abs(abs(φ) - halfπ) < ε ? 0 : F / Math.pow(t(φ), n);
4088
      return [ ρ * Math.sin(n * λ), F - ρ * Math.cos(n * λ) ];
4089
    }
4090
    forward.invert = function(x, y) {
4091
      var ρ0_y = F - y, ρ = d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y);
4092
      return [ Math.atan2(x, ρ0_y) / n, 2 * Math.atan(Math.pow(F / ρ, 1 / n)) - halfπ ];
4093
    };
4094
    return forward;
4095
  }
4096
  (d3.geo.conicConformal = function() {
4097
    return d3_geo_conic(d3_geo_conicConformal);
4098
  }).raw = d3_geo_conicConformal;
4099
  function d3_geo_conicEquidistant(φ0, φ1) {
4100
    var cosφ0 = Math.cos(φ0), n = φ0 === φ1 ? Math.sin(φ0) : (cosφ0 - Math.cos(φ1)) / (φ1 - φ0), G = cosφ0 / n + φ0;
4101
    if (abs(n) < ε) return d3_geo_equirectangular;
4102
    function forward(λ, φ) {
4103
      var ρ = G - φ;
4104
      return [ ρ * Math.sin(n * λ), G - ρ * Math.cos(n * λ) ];
4105
    }
4106
    forward.invert = function(x, y) {
4107
      var ρ0_y = G - y;
4108
      return [ Math.atan2(x, ρ0_y) / n, G - d3_sgn(n) * Math.sqrt(x * x + ρ0_y * ρ0_y) ];
4109
    };
4110
    return forward;
4111
  }
4112
  (d3.geo.conicEquidistant = function() {
4113
    return d3_geo_conic(d3_geo_conicEquidistant);
4114
  }).raw = d3_geo_conicEquidistant;
4115
  var d3_geo_gnomonic = d3_geo_azimuthal(function(cosλcosφ) {
4116
    return 1 / cosλcosφ;
4117
  }, Math.atan);
4118
  (d3.geo.gnomonic = function() {
4119
    return d3_geo_projection(d3_geo_gnomonic);
4120
  }).raw = d3_geo_gnomonic;
4121
  function d3_geo_mercator(λ, φ) {
4122
    return [ λ, Math.log(Math.tan(π / 4 + φ / 2)) ];
4123
  }
4124
  d3_geo_mercator.invert = function(x, y) {
4125
    return [ x, 2 * Math.atan(Math.exp(y)) - halfπ ];
4126
  };
4127
  function d3_geo_mercatorProjection(project) {
4128
    var m = d3_geo_projection(project), scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, clipAuto;
4129
    m.scale = function() {
4130
      var v = scale.apply(m, arguments);
4131
      return v === m ? clipAuto ? m.clipExtent(null) : m : v;
4132
    };
4133
    m.translate = function() {
4134
      var v = translate.apply(m, arguments);
4135
      return v === m ? clipAuto ? m.clipExtent(null) : m : v;
4136
    };
4137
    m.clipExtent = function(_) {
4138
      var v = clipExtent.apply(m, arguments);
4139
      if (v === m) {
4140
        if (clipAuto = _ == null) {
4141
          var k = π * scale(), t = translate();
4142
          clipExtent([ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ]);
4143
        }
4144
      } else if (clipAuto) {
4145
        v = null;
4146
      }
4147
      return v;
4148
    };
4149
    return m.clipExtent(null);
4150
  }
4151
  (d3.geo.mercator = function() {
4152
    return d3_geo_mercatorProjection(d3_geo_mercator);
4153
  }).raw = d3_geo_mercator;
4154
  var d3_geo_orthographic = d3_geo_azimuthal(function() {
4155
    return 1;
4156
  }, Math.asin);
4157
  (d3.geo.orthographic = function() {
4158
    return d3_geo_projection(d3_geo_orthographic);
4159
  }).raw = d3_geo_orthographic;
4160
  var d3_geo_stereographic = d3_geo_azimuthal(function(cosλcosφ) {
4161
    return 1 / (1 + cosλcosφ);
4162
  }, function(ρ) {
4163
    return 2 * Math.atan(ρ);
4164
  });
4165
  (d3.geo.stereographic = function() {
4166
    return d3_geo_projection(d3_geo_stereographic);
4167
  }).raw = d3_geo_stereographic;
4168
  function d3_geo_transverseMercator(λ, φ) {
4169
    var B = Math.cos(φ) * Math.sin(λ);
4170
    return [ Math.log((1 + B) / (1 - B)) / 2, Math.atan2(Math.tan(φ), Math.cos(λ)) ];
4171
  }
4172
  d3_geo_transverseMercator.invert = function(x, y) {
4173
    return [ Math.atan2(d3_sinh(x), Math.cos(y)), d3_asin(Math.sin(y) / d3_cosh(x)) ];
4174
  };
4175
  (d3.geo.transverseMercator = function() {
4176
    return d3_geo_mercatorProjection(d3_geo_transverseMercator);
4177
  }).raw = d3_geo_transverseMercator;
4178
  d3.geom = {};
4179
  function d3_geom_pointX(d) {
4180
    return d[0];
4181
  }
4182
  function d3_geom_pointY(d) {
4183
    return d[1];
4184
  }
4185
  d3.geom.hull = function(vertices) {
4186
    var x = d3_geom_pointX, y = d3_geom_pointY;
4187
    if (arguments.length) return hull(vertices);
4188
    function hull(data) {
4189
      if (data.length < 3) return [];
4190
      var fx = d3_functor(x), fy = d3_functor(y), n = data.length, vertices, plen = n - 1, points = [], stack = [], d, i, j, h = 0, x1, y1, x2, y2, u, v, a, sp;
4191
      if (fx === d3_geom_pointX && y === d3_geom_pointY) vertices = data; else for (i = 0, 
4192
      vertices = []; i < n; ++i) {
4193
        vertices.push([ +fx.call(this, d = data[i], i), +fy.call(this, d, i) ]);
4194
      }
4195
      for (i = 1; i < n; ++i) {
4196
        if (vertices[i][1] < vertices[h][1] || vertices[i][1] == vertices[h][1] && vertices[i][0] < vertices[h][0]) h = i;
4197
      }
4198
      for (i = 0; i < n; ++i) {
4199
        if (i === h) continue;
4200
        y1 = vertices[i][1] - vertices[h][1];
4201
        x1 = vertices[i][0] - vertices[h][0];
4202
        points.push({
4203
          angle: Math.atan2(y1, x1),
4204
          index: i
4205
        });
4206
      }
4207
      points.sort(function(a, b) {
4208
        return a.angle - b.angle;
4209
      });
4210
      a = points[0].angle;
4211
      v = points[0].index;
4212
      u = 0;
4213
      for (i = 1; i < plen; ++i) {
4214
        j = points[i].index;
4215
        if (a == points[i].angle) {
4216
          x1 = vertices[v][0] - vertices[h][0];
4217
          y1 = vertices[v][1] - vertices[h][1];
4218
          x2 = vertices[j][0] - vertices[h][0];
4219
          y2 = vertices[j][1] - vertices[h][1];
4220
          if (x1 * x1 + y1 * y1 >= x2 * x2 + y2 * y2) {
4221
            points[i].index = -1;
4222
            continue;
4223
          } else {
4224
            points[u].index = -1;
4225
          }
4226
        }
4227
        a = points[i].angle;
4228
        u = i;
4229
        v = j;
4230
      }
4231
      stack.push(h);
4232
      for (i = 0, j = 0; i < 2; ++j) {
4233
        if (points[j].index > -1) {
4234
          stack.push(points[j].index);
4235
          i++;
4236
        }
4237
      }
4238
      sp = stack.length;
4239
      for (;j < plen; ++j) {
4240
        if (points[j].index < 0) continue;
4241
        while (!d3_geom_hullCCW(stack[sp - 2], stack[sp - 1], points[j].index, vertices)) {
4242
          --sp;
4243
        }
4244
        stack[sp++] = points[j].index;
4245
      }
4246
      var poly = [];
4247
      for (i = sp - 1; i >= 0; --i) poly.push(data[stack[i]]);
4248
      return poly;
4249
    }
4250
    hull.x = function(_) {
4251
      return arguments.length ? (x = _, hull) : x;
4252
    };
4253
    hull.y = function(_) {
4254
      return arguments.length ? (y = _, hull) : y;
4255
    };
4256
    return hull;
4257
  };
4258
  function d3_geom_hullCCW(i1, i2, i3, v) {
4259
    var t, a, b, c, d, e, f;
4260
    t = v[i1];
4261
    a = t[0];
4262
    b = t[1];
4263
    t = v[i2];
4264
    c = t[0];
4265
    d = t[1];
4266
    t = v[i3];
4267
    e = t[0];
4268
    f = t[1];
4269
    return (f - b) * (c - a) - (d - b) * (e - a) > 0;
4270
  }
4271
  d3.geom.polygon = function(coordinates) {
4272
    d3_subclass(coordinates, d3_geom_polygonPrototype);
4273
    return coordinates;
4274
  };
4275
  var d3_geom_polygonPrototype = d3.geom.polygon.prototype = [];
4276
  d3_geom_polygonPrototype.area = function() {
4277
    var i = -1, n = this.length, a, b = this[n - 1], area = 0;
4278
    while (++i < n) {
4279
      a = b;
4280
      b = this[i];
4281
      area += a[1] * b[0] - a[0] * b[1];
4282
    }
4283
    return area * .5;
4284
  };
4285
  d3_geom_polygonPrototype.centroid = function(k) {
4286
    var i = -1, n = this.length, x = 0, y = 0, a, b = this[n - 1], c;
4287
    if (!arguments.length) k = -1 / (6 * this.area());
4288
    while (++i < n) {
4289
      a = b;
4290
      b = this[i];
4291
      c = a[0] * b[1] - b[0] * a[1];
4292
      x += (a[0] + b[0]) * c;
4293
      y += (a[1] + b[1]) * c;
4294
    }
4295
    return [ x * k, y * k ];
4296
  };
4297
  d3_geom_polygonPrototype.clip = function(subject) {
4298
    var input, closed = d3_geom_polygonClosed(subject), i = -1, n = this.length - d3_geom_polygonClosed(this), j, m, a = this[n - 1], b, c, d;
4299
    while (++i < n) {
4300
      input = subject.slice();
4301
      subject.length = 0;
4302
      b = this[i];
4303
      c = input[(m = input.length - closed) - 1];
4304
      j = -1;
4305
      while (++j < m) {
4306
        d = input[j];
4307
        if (d3_geom_polygonInside(d, a, b)) {
4308
          if (!d3_geom_polygonInside(c, a, b)) {
4309
            subject.push(d3_geom_polygonIntersect(c, d, a, b));
4310
          }
4311
          subject.push(d);
4312
        } else if (d3_geom_polygonInside(c, a, b)) {
4313
          subject.push(d3_geom_polygonIntersect(c, d, a, b));
4314
        }
4315
        c = d;
4316
      }
4317
      if (closed) subject.push(subject[0]);
4318
      a = b;
4319
    }
4320
    return subject;
4321
  };
4322
  function d3_geom_polygonInside(p, a, b) {
4323
    return (b[0] - a[0]) * (p[1] - a[1]) < (b[1] - a[1]) * (p[0] - a[0]);
4324
  }
4325
  function d3_geom_polygonIntersect(c, d, a, b) {
4326
    var x1 = c[0], x3 = a[0], x21 = d[0] - x1, x43 = b[0] - x3, y1 = c[1], y3 = a[1], y21 = d[1] - y1, y43 = b[1] - y3, ua = (x43 * (y1 - y3) - y43 * (x1 - x3)) / (y43 * x21 - x43 * y21);
4327
    return [ x1 + ua * x21, y1 + ua * y21 ];
4328
  }
4329
  function d3_geom_polygonClosed(coordinates) {
4330
    var a = coordinates[0], b = coordinates[coordinates.length - 1];
4331
    return !(a[0] - b[0] || a[1] - b[1]);
4332
  }
4333
  var d3_geom_voronoiEdges, d3_geom_voronoiCells, d3_geom_voronoiBeaches, d3_geom_voronoiBeachPool = [], d3_geom_voronoiFirstCircle, d3_geom_voronoiCircles, d3_geom_voronoiCirclePool = [];
4334
  function d3_geom_voronoiBeach() {
4335
    d3_geom_voronoiRedBlackNode(this);
4336
    this.edge = this.site = this.circle = null;
4337
  }
4338
  function d3_geom_voronoiCreateBeach(site) {
4339
    var beach = d3_geom_voronoiBeachPool.pop() || new d3_geom_voronoiBeach();
4340
    beach.site = site;
4341
    return beach;
4342
  }
4343
  function d3_geom_voronoiDetachBeach(beach) {
4344
    d3_geom_voronoiDetachCircle(beach);
4345
    d3_geom_voronoiBeaches.remove(beach);
4346
    d3_geom_voronoiBeachPool.push(beach);
4347
    d3_geom_voronoiRedBlackNode(beach);
4348
  }
4349
  function d3_geom_voronoiRemoveBeach(beach) {
4350
    var circle = beach.circle, x = circle.x, y = circle.cy, vertex = {
4351
      x: x,
4352
      y: y
4353
    }, previous = beach.P, next = beach.N, disappearing = [ beach ];
4354
    d3_geom_voronoiDetachBeach(beach);
4355
    var lArc = previous;
4356
    while (lArc.circle && abs(x - lArc.circle.x) < ε && abs(y - lArc.circle.cy) < ε) {
4357
      previous = lArc.P;
4358
      disappearing.unshift(lArc);
4359
      d3_geom_voronoiDetachBeach(lArc);
4360
      lArc = previous;
4361
    }
4362
    disappearing.unshift(lArc);
4363
    d3_geom_voronoiDetachCircle(lArc);
4364
    var rArc = next;
4365
    while (rArc.circle && abs(x - rArc.circle.x) < ε && abs(y - rArc.circle.cy) < ε) {
4366
      next = rArc.N;
4367
      disappearing.push(rArc);
4368
      d3_geom_voronoiDetachBeach(rArc);
4369
      rArc = next;
4370
    }
4371
    disappearing.push(rArc);
4372
    d3_geom_voronoiDetachCircle(rArc);
4373
    var nArcs = disappearing.length, iArc;
4374
    for (iArc = 1; iArc < nArcs; ++iArc) {
4375
      rArc = disappearing[iArc];
4376
      lArc = disappearing[iArc - 1];
4377
      d3_geom_voronoiSetEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);
4378
    }
4379
    lArc = disappearing[0];
4380
    rArc = disappearing[nArcs - 1];
4381
    rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, rArc.site, null, vertex);
4382
    d3_geom_voronoiAttachCircle(lArc);
4383
    d3_geom_voronoiAttachCircle(rArc);
4384
  }
4385
  function d3_geom_voronoiAddBeach(site) {
4386
    var x = site.x, directrix = site.y, lArc, rArc, dxl, dxr, node = d3_geom_voronoiBeaches._;
4387
    while (node) {
4388
      dxl = d3_geom_voronoiLeftBreakPoint(node, directrix) - x;
4389
      if (dxl > ε) node = node.L; else {
4390
        dxr = x - d3_geom_voronoiRightBreakPoint(node, directrix);
4391
        if (dxr > ε) {
4392
          if (!node.R) {
4393
            lArc = node;
4394
            break;
4395
          }
4396
          node = node.R;
4397
        } else {
4398
          if (dxl > -ε) {
4399
            lArc = node.P;
4400
            rArc = node;
4401
          } else if (dxr > -ε) {
4402
            lArc = node;
4403
            rArc = node.N;
4404
          } else {
4405
            lArc = rArc = node;
4406
          }
4407
          break;
4408
        }
4409
      }
4410
    }
4411
    var newArc = d3_geom_voronoiCreateBeach(site);
4412
    d3_geom_voronoiBeaches.insert(lArc, newArc);
4413
    if (!lArc && !rArc) return;
4414
    if (lArc === rArc) {
4415
      d3_geom_voronoiDetachCircle(lArc);
4416
      rArc = d3_geom_voronoiCreateBeach(lArc.site);
4417
      d3_geom_voronoiBeaches.insert(newArc, rArc);
4418
      newArc.edge = rArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);
4419
      d3_geom_voronoiAttachCircle(lArc);
4420
      d3_geom_voronoiAttachCircle(rArc);
4421
      return;
4422
    }
4423
    if (!rArc) {
4424
      newArc.edge = d3_geom_voronoiCreateEdge(lArc.site, newArc.site);
4425
      return;
4426
    }
4427
    d3_geom_voronoiDetachCircle(lArc);
4428
    d3_geom_voronoiDetachCircle(rArc);
4429
    var lSite = lArc.site, ax = lSite.x, ay = lSite.y, bx = site.x - ax, by = site.y - ay, rSite = rArc.site, cx = rSite.x - ax, cy = rSite.y - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = {
4430
      x: (cy * hb - by * hc) / d + ax,
4431
      y: (bx * hc - cx * hb) / d + ay
4432
    };
4433
    d3_geom_voronoiSetEdgeEnd(rArc.edge, lSite, rSite, vertex);
4434
    newArc.edge = d3_geom_voronoiCreateEdge(lSite, site, null, vertex);
4435
    rArc.edge = d3_geom_voronoiCreateEdge(site, rSite, null, vertex);
4436
    d3_geom_voronoiAttachCircle(lArc);
4437
    d3_geom_voronoiAttachCircle(rArc);
4438
  }
4439
  function d3_geom_voronoiLeftBreakPoint(arc, directrix) {
4440
    var site = arc.site, rfocx = site.x, rfocy = site.y, pby2 = rfocy - directrix;
4441
    if (!pby2) return rfocx;
4442
    var lArc = arc.P;
4443
    if (!lArc) return -Infinity;
4444
    site = lArc.site;
4445
    var lfocx = site.x, lfocy = site.y, plby2 = lfocy - directrix;
4446
    if (!plby2) return lfocx;
4447
    var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;
4448
    if (aby2) return (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx;
4449
    return (rfocx + lfocx) / 2;
4450
  }
4451
  function d3_geom_voronoiRightBreakPoint(arc, directrix) {
4452
    var rArc = arc.N;
4453
    if (rArc) return d3_geom_voronoiLeftBreakPoint(rArc, directrix);
4454
    var site = arc.site;
4455
    return site.y === directrix ? site.x : Infinity;
4456
  }
4457
  function d3_geom_voronoiCell(site) {
4458
    this.site = site;
4459
    this.edges = [];
4460
  }
4461
  d3_geom_voronoiCell.prototype.prepare = function() {
4462
    var halfEdges = this.edges, iHalfEdge = halfEdges.length, edge;
4463
    while (iHalfEdge--) {
4464
      edge = halfEdges[iHalfEdge].edge;
4465
      if (!edge.b || !edge.a) halfEdges.splice(iHalfEdge, 1);
4466
    }
4467
    halfEdges.sort(d3_geom_voronoiHalfEdgeOrder);
4468
    return halfEdges.length;
4469
  };
4470
  function d3_geom_voronoiCloseCells(extent) {
4471
    var x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], x2, y2, x3, y3, cells = d3_geom_voronoiCells, iCell = cells.length, cell, iHalfEdge, halfEdges, nHalfEdges, start, end;
4472
    while (iCell--) {
4473
      cell = cells[iCell];
4474
      if (!cell || !cell.prepare()) continue;
4475
      halfEdges = cell.edges;
4476
      nHalfEdges = halfEdges.length;
4477
      iHalfEdge = 0;
4478
      while (iHalfEdge < nHalfEdges) {
4479
        end = halfEdges[iHalfEdge].end(), x3 = end.x, y3 = end.y;
4480
        start = halfEdges[++iHalfEdge % nHalfEdges].start(), x2 = start.x, y2 = start.y;
4481
        if (abs(x3 - x2) > ε || abs(y3 - y2) > ε) {
4482
          halfEdges.splice(iHalfEdge, 0, new d3_geom_voronoiHalfEdge(d3_geom_voronoiCreateBorderEdge(cell.site, end, abs(x3 - x0) < ε && y1 - y3 > ε ? {
4483
            x: x0,
4484
            y: abs(x2 - x0) < ε ? y2 : y1
4485
          } : abs(y3 - y1) < ε && x1 - x3 > ε ? {
4486
            x: abs(y2 - y1) < ε ? x2 : x1,
4487
            y: y1
4488
          } : abs(x3 - x1) < ε && y3 - y0 > ε ? {
4489
            x: x1,
4490
            y: abs(x2 - x1) < ε ? y2 : y0
4491
          } : abs(y3 - y0) < ε && x3 - x0 > ε ? {
4492
            x: abs(y2 - y0) < ε ? x2 : x0,
4493
            y: y0
4494
          } : null), cell.site, null));
4495
          ++nHalfEdges;
4496
        }
4497
      }
4498
    }
4499
  }
4500
  function d3_geom_voronoiHalfEdgeOrder(a, b) {
4501
    return b.angle - a.angle;
4502
  }
4503
  function d3_geom_voronoiCircle() {
4504
    d3_geom_voronoiRedBlackNode(this);
4505
    this.x = this.y = this.arc = this.site = this.cy = null;
4506
  }
4507
  function d3_geom_voronoiAttachCircle(arc) {
4508
    var lArc = arc.P, rArc = arc.N;
4509
    if (!lArc || !rArc) return;
4510
    var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;
4511
    if (lSite === rSite) return;
4512
    var bx = cSite.x, by = cSite.y, ax = lSite.x - bx, ay = lSite.y - by, cx = rSite.x - bx, cy = rSite.y - by;
4513
    var d = 2 * (ax * cy - ay * cx);
4514
    if (d >= -ε2) return;
4515
    var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, cy = y + by;
4516
    var circle = d3_geom_voronoiCirclePool.pop() || new d3_geom_voronoiCircle();
4517
    circle.arc = arc;
4518
    circle.site = cSite;
4519
    circle.x = x + bx;
4520
    circle.y = cy + Math.sqrt(x * x + y * y);
4521
    circle.cy = cy;
4522
    arc.circle = circle;
4523
    var before = null, node = d3_geom_voronoiCircles._;
4524
    while (node) {
4525
      if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) {
4526
        if (node.L) node = node.L; else {
4527
          before = node.P;
4528
          break;
4529
        }
4530
      } else {
4531
        if (node.R) node = node.R; else {
4532
          before = node;
4533
          break;
4534
        }
4535
      }
4536
    }
4537
    d3_geom_voronoiCircles.insert(before, circle);
4538
    if (!before) d3_geom_voronoiFirstCircle = circle;
4539
  }
4540
  function d3_geom_voronoiDetachCircle(arc) {
4541
    var circle = arc.circle;
4542
    if (circle) {
4543
      if (!circle.P) d3_geom_voronoiFirstCircle = circle.N;
4544
      d3_geom_voronoiCircles.remove(circle);
4545
      d3_geom_voronoiCirclePool.push(circle);
4546
      d3_geom_voronoiRedBlackNode(circle);
4547
      arc.circle = null;
4548
    }
4549
  }
4550
  function d3_geom_voronoiClipEdges(extent) {
4551
    var edges = d3_geom_voronoiEdges, clip = d3_geom_clipLine(extent[0][0], extent[0][1], extent[1][0], extent[1][1]), i = edges.length, e;
4552
    while (i--) {
4553
      e = edges[i];
4554
      if (!d3_geom_voronoiConnectEdge(e, extent) || !clip(e) || abs(e.a.x - e.b.x) < ε && abs(e.a.y - e.b.y) < ε) {
4555
        e.a = e.b = null;
4556
        edges.splice(i, 1);
4557
      }
4558
    }
4559
  }
4560
  function d3_geom_voronoiConnectEdge(edge, extent) {
4561
    var vb = edge.b;
4562
    if (vb) return true;
4563
    var va = edge.a, x0 = extent[0][0], x1 = extent[1][0], y0 = extent[0][1], y1 = extent[1][1], lSite = edge.l, rSite = edge.r, lx = lSite.x, ly = lSite.y, rx = rSite.x, ry = rSite.y, fx = (lx + rx) / 2, fy = (ly + ry) / 2, fm, fb;
4564
    if (ry === ly) {
4565
      if (fx < x0 || fx >= x1) return;
4566
      if (lx > rx) {
4567
        if (!va) va = {
4568
          x: fx,
4569
          y: y0
4570
        }; else if (va.y >= y1) return;
4571
        vb = {
4572
          x: fx,
4573
          y: y1
4574
        };
4575
      } else {
4576
        if (!va) va = {
4577
          x: fx,
4578
          y: y1
4579
        }; else if (va.y < y0) return;
4580
        vb = {
4581
          x: fx,
4582
          y: y0
4583
        };
4584
      }
4585
    } else {
4586
      fm = (lx - rx) / (ry - ly);
4587
      fb = fy - fm * fx;
4588
      if (fm < -1 || fm > 1) {
4589
        if (lx > rx) {
4590
          if (!va) va = {
4591
            x: (y0 - fb) / fm,
4592
            y: y0
4593
          }; else if (va.y >= y1) return;
4594
          vb = {
4595
            x: (y1 - fb) / fm,
4596
            y: y1
4597
          };
4598
        } else {
4599
          if (!va) va = {
4600
            x: (y1 - fb) / fm,
4601
            y: y1
4602
          }; else if (va.y < y0) return;
4603
          vb = {
4604
            x: (y0 - fb) / fm,
4605
            y: y0
4606
          };
4607
        }
4608
      } else {
4609
        if (ly < ry) {
4610
          if (!va) va = {
4611
            x: x0,
4612
            y: fm * x0 + fb
4613
          }; else if (va.x >= x1) return;
4614
          vb = {
4615
            x: x1,
4616
            y: fm * x1 + fb
4617
          };
4618
        } else {
4619
          if (!va) va = {
4620
            x: x1,
4621
            y: fm * x1 + fb
4622
          }; else if (va.x < x0) return;
4623
          vb = {
4624
            x: x0,
4625
            y: fm * x0 + fb
4626
          };
4627
        }
4628
      }
4629
    }
4630
    edge.a = va;
4631
    edge.b = vb;
4632
    return true;
4633
  }
4634
  function d3_geom_voronoiEdge(lSite, rSite) {
4635
    this.l = lSite;
4636
    this.r = rSite;
4637
    this.a = this.b = null;
4638
  }
4639
  function d3_geom_voronoiCreateEdge(lSite, rSite, va, vb) {
4640
    var edge = new d3_geom_voronoiEdge(lSite, rSite);
4641
    d3_geom_voronoiEdges.push(edge);
4642
    if (va) d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, va);
4643
    if (vb) d3_geom_voronoiSetEdgeEnd(edge, rSite, lSite, vb);
4644
    d3_geom_voronoiCells[lSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, lSite, rSite));
4645
    d3_geom_voronoiCells[rSite.i].edges.push(new d3_geom_voronoiHalfEdge(edge, rSite, lSite));
4646
    return edge;
4647
  }
4648
  function d3_geom_voronoiCreateBorderEdge(lSite, va, vb) {
4649
    var edge = new d3_geom_voronoiEdge(lSite, null);
4650
    edge.a = va;
4651
    edge.b = vb;
4652
    d3_geom_voronoiEdges.push(edge);
4653
    return edge;
4654
  }
4655
  function d3_geom_voronoiSetEdgeEnd(edge, lSite, rSite, vertex) {
4656
    if (!edge.a && !edge.b) {
4657
      edge.a = vertex;
4658
      edge.l = lSite;
4659
      edge.r = rSite;
4660
    } else if (edge.l === rSite) {
4661
      edge.b = vertex;
4662
    } else {
4663
      edge.a = vertex;
4664
    }
4665
  }
4666
  function d3_geom_voronoiHalfEdge(edge, lSite, rSite) {
4667
    var va = edge.a, vb = edge.b;
4668
    this.edge = edge;
4669
    this.site = lSite;
4670
    this.angle = rSite ? Math.atan2(rSite.y - lSite.y, rSite.x - lSite.x) : edge.l === lSite ? Math.atan2(vb.x - va.x, va.y - vb.y) : Math.atan2(va.x - vb.x, vb.y - va.y);
4671
  }
4672
  d3_geom_voronoiHalfEdge.prototype = {
4673
    start: function() {
4674
      return this.edge.l === this.site ? this.edge.a : this.edge.b;
4675
    },
4676
    end: function() {
4677
      return this.edge.l === this.site ? this.edge.b : this.edge.a;
4678
    }
4679
  };
4680
  function d3_geom_voronoiRedBlackTree() {
4681
    this._ = null;
4682
  }
4683
  function d3_geom_voronoiRedBlackNode(node) {
4684
    node.U = node.C = node.L = node.R = node.P = node.N = null;
4685
  }
4686
  d3_geom_voronoiRedBlackTree.prototype = {
4687
    insert: function(after, node) {
4688
      var parent, grandpa, uncle;
4689
      if (after) {
4690
        node.P = after;
4691
        node.N = after.N;
4692
        if (after.N) after.N.P = node;
4693
        after.N = node;
4694
        if (after.R) {
4695
          after = after.R;
4696
          while (after.L) after = after.L;
4697
          after.L = node;
4698
        } else {
4699
          after.R = node;
4700
        }
4701
        parent = after;
4702
      } else if (this._) {
4703
        after = d3_geom_voronoiRedBlackFirst(this._);
4704
        node.P = null;
4705
        node.N = after;
4706
        after.P = after.L = node;
4707
        parent = after;
4708
      } else {
4709
        node.P = node.N = null;
4710
        this._ = node;
4711
        parent = null;
4712
      }
4713
      node.L = node.R = null;
4714
      node.U = parent;
4715
      node.C = true;
4716
      after = node;
4717
      while (parent && parent.C) {
4718
        grandpa = parent.U;
4719
        if (parent === grandpa.L) {
4720
          uncle = grandpa.R;
4721
          if (uncle && uncle.C) {
4722
            parent.C = uncle.C = false;
4723
            grandpa.C = true;
4724
            after = grandpa;
4725
          } else {
4726
            if (after === parent.R) {
4727
              d3_geom_voronoiRedBlackRotateLeft(this, parent);
4728
              after = parent;
4729
              parent = after.U;
4730
            }
4731
            parent.C = false;
4732
            grandpa.C = true;
4733
            d3_geom_voronoiRedBlackRotateRight(this, grandpa);
4734
          }
4735
        } else {
4736
          uncle = grandpa.L;
4737
          if (uncle && uncle.C) {
4738
            parent.C = uncle.C = false;
4739
            grandpa.C = true;
4740
            after = grandpa;
4741
          } else {
4742
            if (after === parent.L) {
4743
              d3_geom_voronoiRedBlackRotateRight(this, parent);
4744
              after = parent;
4745
              parent = after.U;
4746
            }
4747
            parent.C = false;
4748
            grandpa.C = true;
4749
            d3_geom_voronoiRedBlackRotateLeft(this, grandpa);
4750
          }
4751
        }
4752
        parent = after.U;
4753
      }
4754
      this._.C = false;
4755
    },
4756
    remove: function(node) {
4757
      if (node.N) node.N.P = node.P;
4758
      if (node.P) node.P.N = node.N;
4759
      node.N = node.P = null;
4760
      var parent = node.U, sibling, left = node.L, right = node.R, next, red;
4761
      if (!left) next = right; else if (!right) next = left; else next = d3_geom_voronoiRedBlackFirst(right);
4762
      if (parent) {
4763
        if (parent.L === node) parent.L = next; else parent.R = next;
4764
      } else {
4765
        this._ = next;
4766
      }
4767
      if (left && right) {
4768
        red = next.C;
4769
        next.C = node.C;
4770
        next.L = left;
4771
        left.U = next;
4772
        if (next !== right) {
4773
          parent = next.U;
4774
          next.U = node.U;
4775
          node = next.R;
4776
          parent.L = node;
4777
          next.R = right;
4778
          right.U = next;
4779
        } else {
4780
          next.U = parent;
4781
          parent = next;
4782
          node = next.R;
4783
        }
4784
      } else {
4785
        red = node.C;
4786
        node = next;
4787
      }
4788
      if (node) node.U = parent;
4789
      if (red) return;
4790
      if (node && node.C) {
4791
        node.C = false;
4792
        return;
4793
      }
4794
      do {
4795
        if (node === this._) break;
4796
        if (node === parent.L) {
4797
          sibling = parent.R;
4798
          if (sibling.C) {
4799
            sibling.C = false;
4800
            parent.C = true;
4801
            d3_geom_voronoiRedBlackRotateLeft(this, parent);
4802
            sibling = parent.R;
4803
          }
4804
          if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
4805
            if (!sibling.R || !sibling.R.C) {
4806
              sibling.L.C = false;
4807
              sibling.C = true;
4808
              d3_geom_voronoiRedBlackRotateRight(this, sibling);
4809
              sibling = parent.R;
4810
            }
4811
            sibling.C = parent.C;
4812
            parent.C = sibling.R.C = false;
4813
            d3_geom_voronoiRedBlackRotateLeft(this, parent);
4814
            node = this._;
4815
            break;
4816
          }
4817
        } else {
4818
          sibling = parent.L;
4819
          if (sibling.C) {
4820
            sibling.C = false;
4821
            parent.C = true;
4822
            d3_geom_voronoiRedBlackRotateRight(this, parent);
4823
            sibling = parent.L;
4824
          }
4825
          if (sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
4826
            if (!sibling.L || !sibling.L.C) {
4827
              sibling.R.C = false;
4828
              sibling.C = true;
4829
              d3_geom_voronoiRedBlackRotateLeft(this, sibling);
4830
              sibling = parent.L;
4831
            }
4832
            sibling.C = parent.C;
4833
            parent.C = sibling.L.C = false;
4834
            d3_geom_voronoiRedBlackRotateRight(this, parent);
4835
            node = this._;
4836
            break;
4837
          }
4838
        }
4839
        sibling.C = true;
4840
        node = parent;
4841
        parent = parent.U;
4842
      } while (!node.C);
4843
      if (node) node.C = false;
4844
    }
4845
  };
4846
  function d3_geom_voronoiRedBlackRotateLeft(tree, node) {
4847
    var p = node, q = node.R, parent = p.U;
4848
    if (parent) {
4849
      if (parent.L === p) parent.L = q; else parent.R = q;
4850
    } else {
4851
      tree._ = q;
4852
    }
4853
    q.U = parent;
4854
    p.U = q;
4855
    p.R = q.L;
4856
    if (p.R) p.R.U = p;
4857
    q.L = p;
4858
  }
4859
  function d3_geom_voronoiRedBlackRotateRight(tree, node) {
4860
    var p = node, q = node.L, parent = p.U;
4861
    if (parent) {
4862
      if (parent.L === p) parent.L = q; else parent.R = q;
4863
    } else {
4864
      tree._ = q;
4865
    }
4866
    q.U = parent;
4867
    p.U = q;
4868
    p.L = q.R;
4869
    if (p.L) p.L.U = p;
4870
    q.R = p;
4871
  }
4872
  function d3_geom_voronoiRedBlackFirst(node) {
4873
    while (node.L) node = node.L;
4874
    return node;
4875
  }
4876
  function d3_geom_voronoi(sites, bbox) {
4877
    var site = sites.sort(d3_geom_voronoiVertexOrder).pop(), x0, y0, circle;
4878
    d3_geom_voronoiEdges = [];
4879
    d3_geom_voronoiCells = new Array(sites.length);
4880
    d3_geom_voronoiBeaches = new d3_geom_voronoiRedBlackTree();
4881
    d3_geom_voronoiCircles = new d3_geom_voronoiRedBlackTree();
4882
    while (true) {
4883
      circle = d3_geom_voronoiFirstCircle;
4884
      if (site && (!circle || site.y < circle.y || site.y === circle.y && site.x < circle.x)) {
4885
        if (site.x !== x0 || site.y !== y0) {
4886
          d3_geom_voronoiCells[site.i] = new d3_geom_voronoiCell(site);
4887
          d3_geom_voronoiAddBeach(site);
4888
          x0 = site.x, y0 = site.y;
4889
        }
4890
        site = sites.pop();
4891
      } else if (circle) {
4892
        d3_geom_voronoiRemoveBeach(circle.arc);
4893
      } else {
4894
        break;
4895
      }
4896
    }
4897
    if (bbox) d3_geom_voronoiClipEdges(bbox), d3_geom_voronoiCloseCells(bbox);
4898
    var diagram = {
4899
      cells: d3_geom_voronoiCells,
4900
      edges: d3_geom_voronoiEdges
4901
    };
4902
    d3_geom_voronoiBeaches = d3_geom_voronoiCircles = d3_geom_voronoiEdges = d3_geom_voronoiCells = null;
4903
    return diagram;
4904
  }
4905
  function d3_geom_voronoiVertexOrder(a, b) {
4906
    return b.y - a.y || b.x - a.x;
4907
  }
4908
  d3.geom.voronoi = function(points) {
4909
    var x = d3_geom_pointX, y = d3_geom_pointY, fx = x, fy = y, clipExtent = d3_geom_voronoiClipExtent;
4910
    if (points) return voronoi(points);
4911
    function voronoi(data) {
4912
      var polygons = new Array(data.length), x0 = clipExtent[0][0], y0 = clipExtent[0][1], x1 = clipExtent[1][0], y1 = clipExtent[1][1];
4913
      d3_geom_voronoi(sites(data), clipExtent).cells.forEach(function(cell, i) {
4914
        var edges = cell.edges, site = cell.site, polygon = polygons[i] = edges.length ? edges.map(function(e) {
4915
          var s = e.start();
4916
          return [ s.x, s.y ];
4917
        }) : site.x >= x0 && site.x <= x1 && site.y >= y0 && site.y <= y1 ? [ [ x0, y1 ], [ x1, y1 ], [ x1, y0 ], [ x0, y0 ] ] : [];
4918
        polygon.point = data[i];
4919
      });
4920
      return polygons;
4921
    }
4922
    function sites(data) {
4923
      return data.map(function(d, i) {
4924
        return {
4925
          x: Math.round(fx(d, i) / ε) * ε,
4926
          y: Math.round(fy(d, i) / ε) * ε,
4927
          i: i
4928
        };
4929
      });
4930
    }
4931
    voronoi.links = function(data) {
4932
      return d3_geom_voronoi(sites(data)).edges.filter(function(edge) {
4933
        return edge.l && edge.r;
4934
      }).map(function(edge) {
4935
        return {
4936
          source: data[edge.l.i],
4937
          target: data[edge.r.i]
4938
        };
4939
      });
4940
    };
4941
    voronoi.triangles = function(data) {
4942
      var triangles = [];
4943
      d3_geom_voronoi(sites(data)).cells.forEach(function(cell, i) {
4944
        var site = cell.site, edges = cell.edges.sort(d3_geom_voronoiHalfEdgeOrder), j = -1, m = edges.length, e0, s0, e1 = edges[m - 1].edge, s1 = e1.l === site ? e1.r : e1.l;
4945
        while (++j < m) {
4946
          e0 = e1;
4947
          s0 = s1;
4948
          e1 = edges[j].edge;
4949
          s1 = e1.l === site ? e1.r : e1.l;
4950
          if (i < s0.i && i < s1.i && d3_geom_voronoiTriangleArea(site, s0, s1) < 0) {
4951
            triangles.push([ data[i], data[s0.i], data[s1.i] ]);
4952
          }
4953
        }
4954
      });
4955
      return triangles;
4956
    };
4957
    voronoi.x = function(_) {
4958
      return arguments.length ? (fx = d3_functor(x = _), voronoi) : x;
4959
    };
4960
    voronoi.y = function(_) {
4961
      return arguments.length ? (fy = d3_functor(y = _), voronoi) : y;
4962
    };
4963
    voronoi.clipExtent = function(_) {
4964
      if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent;
4965
      clipExtent = _ == null ? d3_geom_voronoiClipExtent : _;
4966
      return voronoi;
4967
    };
4968
    voronoi.size = function(_) {
4969
      if (!arguments.length) return clipExtent === d3_geom_voronoiClipExtent ? null : clipExtent && clipExtent[1];
4970
      return voronoi.clipExtent(_ && [ [ 0, 0 ], _ ]);
4971
    };
4972
    return voronoi;
4973
  };
4974
  var d3_geom_voronoiClipExtent = [ [ -1e6, -1e6 ], [ 1e6, 1e6 ] ];
4975
  function d3_geom_voronoiTriangleArea(a, b, c) {
4976
    return (a.x - c.x) * (b.y - a.y) - (a.x - b.x) * (c.y - a.y);
4977
  }
4978
  d3.geom.delaunay = function(vertices) {
4979
    return d3.geom.voronoi().triangles(vertices);
4980
  };
4981
  d3.geom.quadtree = function(points, x1, y1, x2, y2) {
4982
    var x = d3_geom_pointX, y = d3_geom_pointY, compat;
4983
    if (compat = arguments.length) {
4984
      x = d3_geom_quadtreeCompatX;
4985
      y = d3_geom_quadtreeCompatY;
4986
      if (compat === 3) {
4987
        y2 = y1;
4988
        x2 = x1;
4989
        y1 = x1 = 0;
4990
      }
4991
      return quadtree(points);
4992
    }
4993
    function quadtree(data) {
4994
      var d, fx = d3_functor(x), fy = d3_functor(y), xs, ys, i, n, x1_, y1_, x2_, y2_;
4995
      if (x1 != null) {
4996
        x1_ = x1, y1_ = y1, x2_ = x2, y2_ = y2;
4997
      } else {
4998
        x2_ = y2_ = -(x1_ = y1_ = Infinity);
4999
        xs = [], ys = [];
5000
        n = data.length;
5001
        if (compat) for (i = 0; i < n; ++i) {
5002
          d = data[i];
5003
          if (d.x < x1_) x1_ = d.x;
5004
          if (d.y < y1_) y1_ = d.y;
5005
          if (d.x > x2_) x2_ = d.x;
5006
          if (d.y > y2_) y2_ = d.y;
5007
          xs.push(d.x);
5008
          ys.push(d.y);
5009
        } else for (i = 0; i < n; ++i) {
5010
          var x_ = +fx(d = data[i], i), y_ = +fy(d, i);
5011
          if (x_ < x1_) x1_ = x_;
5012
          if (y_ < y1_) y1_ = y_;
5013
          if (x_ > x2_) x2_ = x_;
5014
          if (y_ > y2_) y2_ = y_;
5015
          xs.push(x_);
5016
          ys.push(y_);
5017
        }
5018
      }
5019
      var dx = x2_ - x1_, dy = y2_ - y1_;
5020
      if (dx > dy) y2_ = y1_ + dx; else x2_ = x1_ + dy;
5021
      function insert(n, d, x, y, x1, y1, x2, y2) {
5022
        if (isNaN(x) || isNaN(y)) return;
5023
        if (n.leaf) {
5024
          var nx = n.x, ny = n.y;
5025
          if (nx != null) {
5026
            if (abs(nx - x) + abs(ny - y) < .01) {
5027
              insertChild(n, d, x, y, x1, y1, x2, y2);
5028
            } else {
5029
              var nPoint = n.point;
5030
              n.x = n.y = n.point = null;
5031
              insertChild(n, nPoint, nx, ny, x1, y1, x2, y2);
5032
              insertChild(n, d, x, y, x1, y1, x2, y2);
5033
            }
5034
          } else {
5035
            n.x = x, n.y = y, n.point = d;
5036
          }
5037
        } else {
5038
          insertChild(n, d, x, y, x1, y1, x2, y2);
5039
        }
5040
      }
5041
      function insertChild(n, d, x, y, x1, y1, x2, y2) {
5042
        var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, right = x >= sx, bottom = y >= sy, i = (bottom << 1) + right;
5043
        n.leaf = false;
5044
        n = n.nodes[i] || (n.nodes[i] = d3_geom_quadtreeNode());
5045
        if (right) x1 = sx; else x2 = sx;
5046
        if (bottom) y1 = sy; else y2 = sy;
5047
        insert(n, d, x, y, x1, y1, x2, y2);
5048
      }
5049
      var root = d3_geom_quadtreeNode();
5050
      root.add = function(d) {
5051
        insert(root, d, +fx(d, ++i), +fy(d, i), x1_, y1_, x2_, y2_);
5052
      };
5053
      root.visit = function(f) {
5054
        d3_geom_quadtreeVisit(f, root, x1_, y1_, x2_, y2_);
5055
      };
5056
      i = -1;
5057
      if (x1 == null) {
5058
        while (++i < n) {
5059
          insert(root, data[i], xs[i], ys[i], x1_, y1_, x2_, y2_);
5060
        }
5061
        --i;
5062
      } else data.forEach(root.add);
5063
      xs = ys = data = d = null;
5064
      return root;
5065
    }
5066
    quadtree.x = function(_) {
5067
      return arguments.length ? (x = _, quadtree) : x;
5068
    };
5069
    quadtree.y = function(_) {
5070
      return arguments.length ? (y = _, quadtree) : y;
5071
    };
5072
    quadtree.extent = function(_) {
5073
      if (!arguments.length) return x1 == null ? null : [ [ x1, y1 ], [ x2, y2 ] ];
5074
      if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = +_[0][0], y1 = +_[0][1], x2 = +_[1][0], 
5075
      y2 = +_[1][1];
5076
      return quadtree;
5077
    };
5078
    quadtree.size = function(_) {
5079
      if (!arguments.length) return x1 == null ? null : [ x2 - x1, y2 - y1 ];
5080
      if (_ == null) x1 = y1 = x2 = y2 = null; else x1 = y1 = 0, x2 = +_[0], y2 = +_[1];
5081
      return quadtree;
5082
    };
5083
    return quadtree;
5084
  };
5085
  function d3_geom_quadtreeCompatX(d) {
5086
    return d.x;
5087
  }
5088
  function d3_geom_quadtreeCompatY(d) {
5089
    return d.y;
5090
  }
5091
  function d3_geom_quadtreeNode() {
5092
    return {
5093
      leaf: true,
5094
      nodes: [],
5095
      point: null,
5096
      x: null,
5097
      y: null
5098
    };
5099
  }
5100
  function d3_geom_quadtreeVisit(f, node, x1, y1, x2, y2) {
5101
    if (!f(node, x1, y1, x2, y2)) {
5102
      var sx = (x1 + x2) * .5, sy = (y1 + y2) * .5, children = node.nodes;
5103
      if (children[0]) d3_geom_quadtreeVisit(f, children[0], x1, y1, sx, sy);
5104
      if (children[1]) d3_geom_quadtreeVisit(f, children[1], sx, y1, x2, sy);
5105
      if (children[2]) d3_geom_quadtreeVisit(f, children[2], x1, sy, sx, y2);
5106
      if (children[3]) d3_geom_quadtreeVisit(f, children[3], sx, sy, x2, y2);
5107
    }
5108
  }
5109
  d3.interpolateRgb = d3_interpolateRgb;
5110
  function d3_interpolateRgb(a, b) {
5111
    a = d3.rgb(a);
5112
    b = d3.rgb(b);
5113
    var ar = a.r, ag = a.g, ab = a.b, br = b.r - ar, bg = b.g - ag, bb = b.b - ab;
5114
    return function(t) {
5115
      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));
5116
    };
5117
  }
5118
  d3.interpolateObject = d3_interpolateObject;
5119
  function d3_interpolateObject(a, b) {
5120
    var i = {}, c = {}, k;
5121
    for (k in a) {
5122
      if (k in b) {
5123
        i[k] = d3_interpolate(a[k], b[k]);
5124
      } else {
5125
        c[k] = a[k];
5126
      }
5127
    }
5128
    for (k in b) {
5129
      if (!(k in a)) {
5130
        c[k] = b[k];
5131
      }
5132
    }
5133
    return function(t) {
5134
      for (k in i) c[k] = i[k](t);
5135
      return c;
5136
    };
5137
  }
5138
  d3.interpolateNumber = d3_interpolateNumber;
5139
  function d3_interpolateNumber(a, b) {
5140
    b -= a = +a;
5141
    return function(t) {
5142
      return a + b * t;
5143
    };
5144
  }
5145
  d3.interpolateString = d3_interpolateString;
5146
  function d3_interpolateString(a, b) {
5147
    var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
5148
    a = a + "", b = b + "";
5149
    d3_interpolate_number.lastIndex = 0;
5150
    for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
5151
      if (m.index) s.push(b.substring(s0, s1 = m.index));
5152
      q.push({
5153
        i: s.length,
5154
        x: m[0]
5155
      });
5156
      s.push(null);
5157
      s0 = d3_interpolate_number.lastIndex;
5158
    }
5159
    if (s0 < b.length) s.push(b.substring(s0));
5160
    for (i = 0, n = q.length; (m = d3_interpolate_number.exec(a)) && i < n; ++i) {
5161
      o = q[i];
5162
      if (o.x == m[0]) {
5163
        if (o.i) {
5164
          if (s[o.i + 1] == null) {
5165
            s[o.i - 1] += o.x;
5166
            s.splice(o.i, 1);
5167
            for (j = i + 1; j < n; ++j) q[j].i--;
5168
          } else {
5169
            s[o.i - 1] += o.x + s[o.i + 1];
5170
            s.splice(o.i, 2);
5171
            for (j = i + 1; j < n; ++j) q[j].i -= 2;
5172
          }
5173
        } else {
5174
          if (s[o.i + 1] == null) {
5175
            s[o.i] = o.x;
5176
          } else {
5177
            s[o.i] = o.x + s[o.i + 1];
5178
            s.splice(o.i + 1, 1);
5179
            for (j = i + 1; j < n; ++j) q[j].i--;
5180
          }
5181
        }
5182
        q.splice(i, 1);
5183
        n--;
5184
        i--;
5185
      } else {
5186
        o.x = d3_interpolateNumber(parseFloat(m[0]), parseFloat(o.x));
5187
      }
5188
    }
5189
    while (i < n) {
5190
      o = q.pop();
5191
      if (s[o.i + 1] == null) {
5192
        s[o.i] = o.x;
5193
      } else {
5194
        s[o.i] = o.x + s[o.i + 1];
5195
        s.splice(o.i + 1, 1);
5196
      }
5197
      n--;
5198
    }
5199
    if (s.length === 1) {
5200
      return s[0] == null ? (o = q[0].x, function(t) {
5201
        return o(t) + "";
5202
      }) : function() {
5203
        return b;
5204
      };
5205
    }
5206
    return function(t) {
5207
      for (i = 0; i < n; ++i) s[(o = q[i]).i] = o.x(t);
5208
      return s.join("");
5209
    };
5210
  }
5211
  var d3_interpolate_number = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
5212
  d3.interpolate = d3_interpolate;
5213
  function d3_interpolate(a, b) {
5214
    var i = d3.interpolators.length, f;
5215
    while (--i >= 0 && !(f = d3.interpolators[i](a, b))) ;
5216
    return f;
5217
  }
5218
  d3.interpolators = [ function(a, b) {
5219
    var t = typeof b;
5220
    return (t === "string" ? d3_rgb_names.has(b) || /^(#|rgb\(|hsl\()/.test(b) ? d3_interpolateRgb : d3_interpolateString : b instanceof d3_Color ? d3_interpolateRgb : t === "object" ? Array.isArray(b) ? d3_interpolateArray : d3_interpolateObject : d3_interpolateNumber)(a, b);
5221
  } ];
5222
  d3.interpolateArray = d3_interpolateArray;
5223
  function d3_interpolateArray(a, b) {
5224
    var x = [], c = [], na = a.length, nb = b.length, n0 = Math.min(a.length, b.length), i;
5225
    for (i = 0; i < n0; ++i) x.push(d3_interpolate(a[i], b[i]));
5226
    for (;i < na; ++i) c[i] = a[i];
5227
    for (;i < nb; ++i) c[i] = b[i];
5228
    return function(t) {
5229
      for (i = 0; i < n0; ++i) c[i] = x[i](t);
5230
      return c;
5231
    };
5232
  }
5233
  var d3_ease_default = function() {
5234
    return d3_identity;
5235
  };
5236
  var d3_ease = d3.map({
5237
    linear: d3_ease_default,
5238
    poly: d3_ease_poly,
5239
    quad: function() {
5240
      return d3_ease_quad;
5241
    },
5242
    cubic: function() {
5243
      return d3_ease_cubic;
5244
    },
5245
    sin: function() {
5246
      return d3_ease_sin;
5247
    },
5248
    exp: function() {
5249
      return d3_ease_exp;
5250
    },
5251
    circle: function() {
5252
      return d3_ease_circle;
5253
    },
5254
    elastic: d3_ease_elastic,
5255
    back: d3_ease_back,
5256
    bounce: function() {
5257
      return d3_ease_bounce;
5258
    }
5259
  });
5260
  var d3_ease_mode = d3.map({
5261
    "in": d3_identity,
5262
    out: d3_ease_reverse,
5263
    "in-out": d3_ease_reflect,
5264
    "out-in": function(f) {
5265
      return d3_ease_reflect(d3_ease_reverse(f));
5266
    }
5267
  });
5268
  d3.ease = function(name) {
5269
    var i = name.indexOf("-"), t = i >= 0 ? name.substring(0, i) : name, m = i >= 0 ? name.substring(i + 1) : "in";
5270
    t = d3_ease.get(t) || d3_ease_default;
5271
    m = d3_ease_mode.get(m) || d3_identity;
5272
    return d3_ease_clamp(m(t.apply(null, d3_arraySlice.call(arguments, 1))));
5273
  };
5274
  function d3_ease_clamp(f) {
5275
    return function(t) {
5276
      return t <= 0 ? 0 : t >= 1 ? 1 : f(t);
5277
    };
5278
  }
5279
  function d3_ease_reverse(f) {
5280
    return function(t) {
5281
      return 1 - f(1 - t);
5282
    };
5283
  }
5284
  function d3_ease_reflect(f) {
5285
    return function(t) {
5286
      return .5 * (t < .5 ? f(2 * t) : 2 - f(2 - 2 * t));
5287
    };
5288
  }
5289
  function d3_ease_quad(t) {
5290
    return t * t;
5291
  }
5292
  function d3_ease_cubic(t) {
5293
    return t * t * t;
5294
  }
5295
  function d3_ease_cubicInOut(t) {
5296
    if (t <= 0) return 0;
5297
    if (t >= 1) return 1;
5298
    var t2 = t * t, t3 = t2 * t;
5299
    return 4 * (t < .5 ? t3 : 3 * (t - t2) + t3 - .75);
5300
  }
5301
  function d3_ease_poly(e) {
5302
    return function(t) {
5303
      return Math.pow(t, e);
5304
    };
5305
  }
5306
  function d3_ease_sin(t) {
5307
    return 1 - Math.cos(t * halfπ);
5308
  }
5309
  function d3_ease_exp(t) {
5310
    return Math.pow(2, 10 * (t - 1));
5311
  }
5312
  function d3_ease_circle(t) {
5313
    return 1 - Math.sqrt(1 - t * t);
5314
  }
5315
  function d3_ease_elastic(a, p) {
5316
    var s;
5317
    if (arguments.length < 2) p = .45;
5318
    if (arguments.length) s = p / τ * Math.asin(1 / a); else a = 1, s = p / 4;
5319
    return function(t) {
5320
      return 1 + a * Math.pow(2, -10 * t) * Math.sin((t - s) * τ / p);
5321
    };
5322
  }
5323
  function d3_ease_back(s) {
5324
    if (!s) s = 1.70158;
5325
    return function(t) {
5326
      return t * t * ((s + 1) * t - s);
5327
    };
5328
  }
5329
  function d3_ease_bounce(t) {
5330
    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;
5331
  }
5332
  d3.interpolateHcl = d3_interpolateHcl;
5333
  function d3_interpolateHcl(a, b) {
5334
    a = d3.hcl(a);
5335
    b = d3.hcl(b);
5336
    var ah = a.h, ac = a.c, al = a.l, bh = b.h - ah, bc = b.c - ac, bl = b.l - al;
5337
    if (isNaN(bc)) bc = 0, ac = isNaN(ac) ? b.c : ac;
5338
    if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
5339
    return function(t) {
5340
      return d3_hcl_lab(ah + bh * t, ac + bc * t, al + bl * t) + "";
5341
    };
5342
  }
5343
  d3.interpolateHsl = d3_interpolateHsl;
5344
  function d3_interpolateHsl(a, b) {
5345
    a = d3.hsl(a);
5346
    b = d3.hsl(b);
5347
    var ah = a.h, as = a.s, al = a.l, bh = b.h - ah, bs = b.s - as, bl = b.l - al;
5348
    if (isNaN(bs)) bs = 0, as = isNaN(as) ? b.s : as;
5349
    if (isNaN(bh)) bh = 0, ah = isNaN(ah) ? b.h : ah; else if (bh > 180) bh -= 360; else if (bh < -180) bh += 360;
5350
    return function(t) {
5351
      return d3_hsl_rgb(ah + bh * t, as + bs * t, al + bl * t) + "";
5352
    };
5353
  }
5354
  d3.interpolateLab = d3_interpolateLab;
5355
  function d3_interpolateLab(a, b) {
5356
    a = d3.lab(a);
5357
    b = d3.lab(b);
5358
    var al = a.l, aa = a.a, ab = a.b, bl = b.l - al, ba = b.a - aa, bb = b.b - ab;
5359
    return function(t) {
5360
      return d3_lab_rgb(al + bl * t, aa + ba * t, ab + bb * t) + "";
5361
    };
5362
  }
5363
  d3.interpolateRound = d3_interpolateRound;
5364
  function d3_interpolateRound(a, b) {
5365
    b -= a;
5366
    return function(t) {
5367
      return Math.round(a + b * t);
5368
    };
5369
  }
5370
  d3.transform = function(string) {
5371
    var g = d3_document.createElementNS(d3.ns.prefix.svg, "g");
5372
    return (d3.transform = function(string) {
5373
      if (string != null) {
5374
        g.setAttribute("transform", string);
5375
        var t = g.transform.baseVal.consolidate();
5376
      }
5377
      return new d3_transform(t ? t.matrix : d3_transformIdentity);
5378
    })(string);
5379
  };
5380
  function d3_transform(m) {
5381
    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;
5382
    if (r0[0] * r1[1] < r1[0] * r0[1]) {
5383
      r0[0] *= -1;
5384
      r0[1] *= -1;
5385
      kx *= -1;
5386
      kz *= -1;
5387
    }
5388
    this.rotate = (kx ? Math.atan2(r0[1], r0[0]) : Math.atan2(-r1[0], r1[1])) * d3_degrees;
5389
    this.translate = [ m.e, m.f ];
5390
    this.scale = [ kx, ky ];
5391
    this.skew = ky ? Math.atan2(kz, ky) * d3_degrees : 0;
5392
  }
5393
  d3_transform.prototype.toString = function() {
5394
    return "translate(" + this.translate + ")rotate(" + this.rotate + ")skewX(" + this.skew + ")scale(" + this.scale + ")";
5395
  };
5396
  function d3_transformDot(a, b) {
5397
    return a[0] * b[0] + a[1] * b[1];
5398
  }
5399
  function d3_transformNormalize(a) {
5400
    var k = Math.sqrt(d3_transformDot(a, a));
5401
    if (k) {
5402
      a[0] /= k;
5403
      a[1] /= k;
5404
    }
5405
    return k;
5406
  }
5407
  function d3_transformCombine(a, b, k) {
5408
    a[0] += k * b[0];
5409
    a[1] += k * b[1];
5410
    return a;
5411
  }
5412
  var d3_transformIdentity = {
5413
    a: 1,
5414
    b: 0,
5415
    c: 0,
5416
    d: 1,
5417
    e: 0,
5418
    f: 0
5419
  };
5420
  d3.interpolateTransform = d3_interpolateTransform;
5421
  function d3_interpolateTransform(a, b) {
5422
    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;
5423
    if (ta[0] != tb[0] || ta[1] != tb[1]) {
5424
      s.push("translate(", null, ",", null, ")");
5425
      q.push({
5426
        i: 1,
5427
        x: d3_interpolateNumber(ta[0], tb[0])
5428
      }, {
5429
        i: 3,
5430
        x: d3_interpolateNumber(ta[1], tb[1])
5431
      });
5432
    } else if (tb[0] || tb[1]) {
5433
      s.push("translate(" + tb + ")");
5434
    } else {
5435
      s.push("");
5436
    }
5437
    if (ra != rb) {
5438
      if (ra - rb > 180) rb += 360; else if (rb - ra > 180) ra += 360;
5439
      q.push({
5440
        i: s.push(s.pop() + "rotate(", null, ")") - 2,
5441
        x: d3_interpolateNumber(ra, rb)
5442
      });
5443
    } else if (rb) {
5444
      s.push(s.pop() + "rotate(" + rb + ")");
5445
    }
5446
    if (wa != wb) {
5447
      q.push({
5448
        i: s.push(s.pop() + "skewX(", null, ")") - 2,
5449
        x: d3_interpolateNumber(wa, wb)
5450
      });
5451
    } else if (wb) {
5452
      s.push(s.pop() + "skewX(" + wb + ")");
5453
    }
5454
    if (ka[0] != kb[0] || ka[1] != kb[1]) {
5455
      n = s.push(s.pop() + "scale(", null, ",", null, ")");
5456
      q.push({
5457
        i: n - 4,
5458
        x: d3_interpolateNumber(ka[0], kb[0])
5459
      }, {
5460
        i: n - 2,
5461
        x: d3_interpolateNumber(ka[1], kb[1])
5462
      });
5463
    } else if (kb[0] != 1 || kb[1] != 1) {
5464
      s.push(s.pop() + "scale(" + kb + ")");
5465
    }
5466
    n = q.length;
5467
    return function(t) {
5468
      var i = -1, o;
5469
      while (++i < n) s[(o = q[i]).i] = o.x(t);
5470
      return s.join("");
5471
    };
5472
  }
5473
  function d3_uninterpolateNumber(a, b) {
5474
    b = b - (a = +a) ? 1 / (b - a) : 0;
5475
    return function(x) {
5476
      return (x - a) * b;
5477
    };
5478
  }
5479
  function d3_uninterpolateClamp(a, b) {
5480
    b = b - (a = +a) ? 1 / (b - a) : 0;
5481
    return function(x) {
5482
      return Math.max(0, Math.min(1, (x - a) * b));
5483
    };
5484
  }
5485
  d3.layout = {};
5486
  d3.layout.bundle = function() {
5487
    return function(links) {
5488
      var paths = [], i = -1, n = links.length;
5489
      while (++i < n) paths.push(d3_layout_bundlePath(links[i]));
5490
      return paths;
5491
    };
5492
  };
5493
  function d3_layout_bundlePath(link) {
5494
    var start = link.source, end = link.target, lca = d3_layout_bundleLeastCommonAncestor(start, end), points = [ start ];
5495
    while (start !== lca) {
5496
      start = start.parent;
5497
      points.push(start);
5498
    }
5499
    var k = points.length;
5500
    while (end !== lca) {
5501
      points.splice(k, 0, end);
5502
      end = end.parent;
5503
    }
5504
    return points;
5505
  }
5506
  function d3_layout_bundleAncestors(node) {
5507
    var ancestors = [], parent = node.parent;
5508
    while (parent != null) {
5509
      ancestors.push(node);
5510
      node = parent;
5511
      parent = parent.parent;
5512
    }
5513
    ancestors.push(node);
5514
    return ancestors;
5515
  }
5516
  function d3_layout_bundleLeastCommonAncestor(a, b) {
5517
    if (a === b) return a;
5518
    var aNodes = d3_layout_bundleAncestors(a), bNodes = d3_layout_bundleAncestors(b), aNode = aNodes.pop(), bNode = bNodes.pop(), sharedNode = null;
5519
    while (aNode === bNode) {
5520
      sharedNode = aNode;
5521
      aNode = aNodes.pop();
5522
      bNode = bNodes.pop();
5523
    }
5524
    return sharedNode;
5525
  }
5526
  d3.layout.chord = function() {
5527
    var chord = {}, chords, groups, matrix, n, padding = 0, sortGroups, sortSubgroups, sortChords;
5528
    function relayout() {
5529
      var subgroups = {}, groupSums = [], groupIndex = d3.range(n), subgroupIndex = [], k, x, x0, i, j;
5530
      chords = [];
5531
      groups = [];
5532
      k = 0, i = -1;
5533
      while (++i < n) {
5534
        x = 0, j = -1;
5535
        while (++j < n) {
5536
          x += matrix[i][j];
5537
        }
5538
        groupSums.push(x);
5539
        subgroupIndex.push(d3.range(n));
5540
        k += x;
5541
      }
5542
      if (sortGroups) {
5543
        groupIndex.sort(function(a, b) {
5544
          return sortGroups(groupSums[a], groupSums[b]);
5545
        });
5546
      }
5547
      if (sortSubgroups) {
5548
        subgroupIndex.forEach(function(d, i) {
5549
          d.sort(function(a, b) {
5550
            return sortSubgroups(matrix[i][a], matrix[i][b]);
5551
          });
5552
        });
5553
      }
5554
      k = (τ - padding * n) / k;
5555
      x = 0, i = -1;
5556
      while (++i < n) {
5557
        x0 = x, j = -1;
5558
        while (++j < n) {
5559
          var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
5560
          subgroups[di + "-" + dj] = {
5561
            index: di,
5562
            subindex: dj,
5563
            startAngle: a0,
5564
            endAngle: a1,
5565
            value: v
5566
          };
5567
        }
5568
        groups[di] = {
5569
          index: di,
5570
          startAngle: x0,
5571
          endAngle: x,
5572
          value: (x - x0) / k
5573
        };
5574
        x += padding;
5575
      }
5576
      i = -1;
5577
      while (++i < n) {
5578
        j = i - 1;
5579
        while (++j < n) {
5580
          var source = subgroups[i + "-" + j], target = subgroups[j + "-" + i];
5581
          if (source.value || target.value) {
5582
            chords.push(source.value < target.value ? {
5583
              source: target,
5584
              target: source
5585
            } : {
5586
              source: source,
5587
              target: target
5588
            });
5589
          }
5590
        }
5591
      }
5592
      if (sortChords) resort();
5593
    }
5594
    function resort() {
5595
      chords.sort(function(a, b) {
5596
        return sortChords((a.source.value + a.target.value) / 2, (b.source.value + b.target.value) / 2);
5597
      });
5598
    }
5599
    chord.matrix = function(x) {
5600
      if (!arguments.length) return matrix;
5601
      n = (matrix = x) && matrix.length;
5602
      chords = groups = null;
5603
      return chord;
5604
    };
5605
    chord.padding = function(x) {
5606
      if (!arguments.length) return padding;
5607
      padding = x;
5608
      chords = groups = null;
5609
      return chord;
5610
    };
5611
    chord.sortGroups = function(x) {
5612
      if (!arguments.length) return sortGroups;
5613
      sortGroups = x;
5614
      chords = groups = null;
5615
      return chord;
5616
    };
5617
    chord.sortSubgroups = function(x) {
5618
      if (!arguments.length) return sortSubgroups;
5619
      sortSubgroups = x;
5620
      chords = null;
5621
      return chord;
5622
    };
5623
    chord.sortChords = function(x) {
5624
      if (!arguments.length) return sortChords;
5625
      sortChords = x;
5626
      if (chords) resort();
5627
      return chord;
5628
    };
5629
    chord.chords = function() {
5630
      if (!chords) relayout();
5631
      return chords;
5632
    };
5633
    chord.groups = function() {
5634
      if (!groups) relayout();
5635
      return groups;
5636
    };
5637
    return chord;
5638
  };
5639
  d3.layout.force = function() {
5640
    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, nodes = [], links = [], distances, strengths, charges;
5641
    function repulse(node) {
5642
      return function(quad, x1, _, x2) {
5643
        if (quad.point !== node) {
5644
          var dx = quad.cx - node.x, dy = quad.cy - node.y, dn = 1 / Math.sqrt(dx * dx + dy * dy);
5645
          if ((x2 - x1) * dn < theta) {
5646
            var k = quad.charge * dn * dn;
5647
            node.px -= dx * k;
5648
            node.py -= dy * k;
5649
            return true;
5650
          }
5651
          if (quad.point && isFinite(dn)) {
5652
            var k = quad.pointCharge * dn * dn;
5653
            node.px -= dx * k;
5654
            node.py -= dy * k;
5655
          }
5656
        }
5657
        return !quad.charge;
5658
      };
5659
    }
5660
    force.tick = function() {
5661
      if ((alpha *= .99) < .005) {
5662
        event.end({
5663
          type: "end",
5664
          alpha: alpha = 0
5665
        });
5666
        return true;
5667
      }
5668
      var n = nodes.length, m = links.length, q, i, o, s, t, l, k, x, y;
5669
      for (i = 0; i < m; ++i) {
5670
        o = links[i];
5671
        s = o.source;
5672
        t = o.target;
5673
        x = t.x - s.x;
5674
        y = t.y - s.y;
5675
        if (l = x * x + y * y) {
5676
          l = alpha * strengths[i] * ((l = Math.sqrt(l)) - distances[i]) / l;
5677
          x *= l;
5678
          y *= l;
5679
          t.x -= x * (k = s.weight / (t.weight + s.weight));
5680
          t.y -= y * k;
5681
          s.x += x * (k = 1 - k);
5682
          s.y += y * k;
5683
        }
5684
      }
5685
      if (k = alpha * gravity) {
5686
        x = size[0] / 2;
5687
        y = size[1] / 2;
5688
        i = -1;
5689
        if (k) while (++i < n) {
5690
          o = nodes[i];
5691
          o.x += (x - o.x) * k;
5692
          o.y += (y - o.y) * k;
5693
        }
5694
      }
5695
      if (charge) {
5696
        d3_layout_forceAccumulate(q = d3.geom.quadtree(nodes), alpha, charges);
5697
        i = -1;
5698
        while (++i < n) {
5699
          if (!(o = nodes[i]).fixed) {
5700
            q.visit(repulse(o));
5701
          }
5702
        }
5703
      }
5704
      i = -1;
5705
      while (++i < n) {
5706
        o = nodes[i];
5707
        if (o.fixed) {
5708
          o.x = o.px;
5709
          o.y = o.py;
5710
        } else {
5711
          o.x -= (o.px - (o.px = o.x)) * friction;
5712
          o.y -= (o.py - (o.py = o.y)) * friction;
5713
        }
5714
      }
5715
      event.tick({
5716
        type: "tick",
5717
        alpha: alpha
5718
      });
5719
    };
5720
    force.nodes = function(x) {
5721
      if (!arguments.length) return nodes;
5722
      nodes = x;
5723
      return force;
5724
    };
5725
    force.links = function(x) {
5726
      if (!arguments.length) return links;
5727
      links = x;
5728
      return force;
5729
    };
5730
    force.size = function(x) {
5731
      if (!arguments.length) return size;
5732
      size = x;
5733
      return force;
5734
    };
5735
    force.linkDistance = function(x) {
5736
      if (!arguments.length) return linkDistance;
5737
      linkDistance = typeof x === "function" ? x : +x;
5738
      return force;
5739
    };
5740
    force.distance = force.linkDistance;
5741
    force.linkStrength = function(x) {
5742
      if (!arguments.length) return linkStrength;
5743
      linkStrength = typeof x === "function" ? x : +x;
5744
      return force;
5745
    };
5746
    force.friction = function(x) {
5747
      if (!arguments.length) return friction;
5748
      friction = +x;
5749
      return force;
5750
    };
5751
    force.charge = function(x) {
5752
      if (!arguments.length) return charge;
5753
      charge = typeof x === "function" ? x : +x;
5754
      return force;
5755
    };
5756
    force.gravity = function(x) {
5757
      if (!arguments.length) return gravity;
5758
      gravity = +x;
5759
      return force;
5760
    };
5761
    force.theta = function(x) {
5762
      if (!arguments.length) return theta;
5763
      theta = +x;
5764
      return force;
5765
    };
5766
    force.alpha = function(x) {
5767
      if (!arguments.length) return alpha;
5768
      x = +x;
5769
      if (alpha) {
5770
        if (x > 0) alpha = x; else alpha = 0;
5771
      } else if (x > 0) {
5772
        event.start({
5773
          type: "start",
5774
          alpha: alpha = x
5775
        });
5776
        d3.timer(force.tick);
5777
      }
5778
      return force;
5779
    };
5780
    force.start = function() {
5781
      var i, n = nodes.length, m = links.length, w = size[0], h = size[1], neighbors, o;
5782
      for (i = 0; i < n; ++i) {
5783
        (o = nodes[i]).index = i;
5784
        o.weight = 0;
5785
      }
5786
      for (i = 0; i < m; ++i) {
5787
        o = links[i];
5788
        if (typeof o.source == "number") o.source = nodes[o.source];
5789
        if (typeof o.target == "number") o.target = nodes[o.target];
5790
        ++o.source.weight;
5791
        ++o.target.weight;
5792
      }
5793
      for (i = 0; i < n; ++i) {
5794
        o = nodes[i];
5795
        if (isNaN(o.x)) o.x = position("x", w);
5796
        if (isNaN(o.y)) o.y = position("y", h);
5797
        if (isNaN(o.px)) o.px = o.x;
5798
        if (isNaN(o.py)) o.py = o.y;
5799
      }
5800
      distances = [];
5801
      if (typeof linkDistance === "function") for (i = 0; i < m; ++i) distances[i] = +linkDistance.call(this, links[i], i); else for (i = 0; i < m; ++i) distances[i] = linkDistance;
5802
      strengths = [];
5803
      if (typeof linkStrength === "function") for (i = 0; i < m; ++i) strengths[i] = +linkStrength.call(this, links[i], i); else for (i = 0; i < m; ++i) strengths[i] = linkStrength;
5804
      charges = [];
5805
      if (typeof charge === "function") for (i = 0; i < n; ++i) charges[i] = +charge.call(this, nodes[i], i); else for (i = 0; i < n; ++i) charges[i] = charge;
5806
      function position(dimension, size) {
5807
        if (!neighbors) {
5808
          neighbors = new Array(n);
5809
          for (j = 0; j < n; ++j) {
5810
            neighbors[j] = [];
5811
          }
5812
          for (j = 0; j < m; ++j) {
5813
            var o = links[j];
5814
            neighbors[o.source.index].push(o.target);
5815
            neighbors[o.target.index].push(o.source);
5816
          }
5817
        }
5818
        var candidates = neighbors[i], j = -1, m = candidates.length, x;
5819
        while (++j < m) if (!isNaN(x = candidates[j][dimension])) return x;
5820
        return Math.random() * size;
5821
      }
5822
      return force.resume();
5823
    };
5824
    force.resume = function() {
5825
      return force.alpha(.1);
5826
    };
5827
    force.stop = function() {
5828
      return force.alpha(0);
5829
    };
5830
    force.drag = function() {
5831
      if (!drag) drag = d3.behavior.drag().origin(d3_identity).on("dragstart.force", d3_layout_forceDragstart).on("drag.force", dragmove).on("dragend.force", d3_layout_forceDragend);
5832
      if (!arguments.length) return drag;
5833
      this.on("mouseover.force", d3_layout_forceMouseover).on("mouseout.force", d3_layout_forceMouseout).call(drag);
5834
    };
5835
    function dragmove(d) {
5836
      d.px = d3.event.x, d.py = d3.event.y;
5837
      force.resume();
5838
    }
5839
    return d3.rebind(force, event, "on");
5840
  };
5841
  function d3_layout_forceDragstart(d) {
5842
    d.fixed |= 2;
5843
  }
5844
  function d3_layout_forceDragend(d) {
5845
    d.fixed &= ~6;
5846
  }
5847
  function d3_layout_forceMouseover(d) {
5848
    d.fixed |= 4;
5849
    d.px = d.x, d.py = d.y;
5850
  }
5851
  function d3_layout_forceMouseout(d) {
5852
    d.fixed &= ~4;
5853
  }
5854
  function d3_layout_forceAccumulate(quad, alpha, charges) {
5855
    var cx = 0, cy = 0;
5856
    quad.charge = 0;
5857
    if (!quad.leaf) {
5858
      var nodes = quad.nodes, n = nodes.length, i = -1, c;
5859
      while (++i < n) {
5860
        c = nodes[i];
5861
        if (c == null) continue;
5862
        d3_layout_forceAccumulate(c, alpha, charges);
5863
        quad.charge += c.charge;
5864
        cx += c.charge * c.cx;
5865
        cy += c.charge * c.cy;
5866
      }
5867
    }
5868
    if (quad.point) {
5869
      if (!quad.leaf) {
5870
        quad.point.x += Math.random() - .5;
5871
        quad.point.y += Math.random() - .5;
5872
      }
5873
      var k = alpha * charges[quad.point.index];
5874
      quad.charge += quad.pointCharge = k;
5875
      cx += k * quad.point.x;
5876
      cy += k * quad.point.y;
5877
    }
5878
    quad.cx = cx / quad.charge;
5879
    quad.cy = cy / quad.charge;
5880
  }
5881
  var d3_layout_forceLinkDistance = 20, d3_layout_forceLinkStrength = 1;
5882
  d3.layout.hierarchy = function() {
5883
    var sort = d3_layout_hierarchySort, children = d3_layout_hierarchyChildren, value = d3_layout_hierarchyValue;
5884
    function recurse(node, depth, nodes) {
5885
      var childs = children.call(hierarchy, node, depth);
5886
      node.depth = depth;
5887
      nodes.push(node);
5888
      if (childs && (n = childs.length)) {
5889
        var i = -1, n, c = node.children = new Array(n), v = 0, j = depth + 1, d;
5890
        while (++i < n) {
5891
          d = c[i] = recurse(childs[i], j, nodes);
5892
          d.parent = node;
5893
          v += d.value;
5894
        }
5895
        if (sort) c.sort(sort);
5896
        if (value) node.value = v;
5897
      } else {
5898
        delete node.children;
5899
        if (value) {
5900
          node.value = +value.call(hierarchy, node, depth) || 0;
5901
        }
5902
      }
5903
      return node;
5904
    }
5905
    function revalue(node, depth) {
5906
      var children = node.children, v = 0;
5907
      if (children && (n = children.length)) {
5908
        var i = -1, n, j = depth + 1;
5909
        while (++i < n) v += revalue(children[i], j);
5910
      } else if (value) {
5911
        v = +value.call(hierarchy, node, depth) || 0;
5912
      }
5913
      if (value) node.value = v;
5914
      return v;
5915
    }
5916
    function hierarchy(d) {
5917
      var nodes = [];
5918
      recurse(d, 0, nodes);
5919
      return nodes;
5920
    }
5921
    hierarchy.sort = function(x) {
5922
      if (!arguments.length) return sort;
5923
      sort = x;
5924
      return hierarchy;
5925
    };
5926
    hierarchy.children = function(x) {
5927
      if (!arguments.length) return children;
5928
      children = x;
5929
      return hierarchy;
5930
    };
5931
    hierarchy.value = function(x) {
5932
      if (!arguments.length) return value;
5933
      value = x;
5934
      return hierarchy;
5935
    };
5936
    hierarchy.revalue = function(root) {
5937
      revalue(root, 0);
5938
      return root;
5939
    };
5940
    return hierarchy;
5941
  };
5942
  function d3_layout_hierarchyRebind(object, hierarchy) {
5943
    d3.rebind(object, hierarchy, "sort", "children", "value");
5944
    object.nodes = object;
5945
    object.links = d3_layout_hierarchyLinks;
5946
    return object;
5947
  }
5948
  function d3_layout_hierarchyChildren(d) {
5949
    return d.children;
5950
  }
5951
  function d3_layout_hierarchyValue(d) {
5952
    return d.value;
5953
  }
5954
  function d3_layout_hierarchySort(a, b) {
5955
    return b.value - a.value;
5956
  }
5957
  function d3_layout_hierarchyLinks(nodes) {
5958
    return d3.merge(nodes.map(function(parent) {
5959
      return (parent.children || []).map(function(child) {
5960
        return {
5961
          source: parent,
5962
          target: child
5963
        };
5964
      });
5965
    }));
5966
  }
5967
  d3.layout.partition = function() {
5968
    var hierarchy = d3.layout.hierarchy(), size = [ 1, 1 ];
5969
    function position(node, x, dx, dy) {
5970
      var children = node.children;
5971
      node.x = x;
5972
      node.y = node.depth * dy;
5973
      node.dx = dx;
5974
      node.dy = dy;
5975
      if (children && (n = children.length)) {
5976
        var i = -1, n, c, d;
5977
        dx = node.value ? dx / node.value : 0;
5978
        while (++i < n) {
5979
          position(c = children[i], x, d = c.value * dx, dy);
5980
          x += d;
5981
        }
5982
      }
5983
    }
5984
    function depth(node) {
5985
      var children = node.children, d = 0;
5986
      if (children && (n = children.length)) {
5987
        var i = -1, n;
5988
        while (++i < n) d = Math.max(d, depth(children[i]));
5989
      }
5990
      return 1 + d;
5991
    }
5992
    function partition(d, i) {
5993
      var nodes = hierarchy.call(this, d, i);
5994
      position(nodes[0], 0, size[0], size[1] / depth(nodes[0]));
5995
      return nodes;
5996
    }
5997
    partition.size = function(x) {
5998
      if (!arguments.length) return size;
5999
      size = x;
6000
      return partition;
6001
    };
6002
    return d3_layout_hierarchyRebind(partition, hierarchy);
6003
  };
6004
  d3.layout.pie = function() {
6005
    var value = Number, sort = d3_layout_pieSortByValue, startAngle = 0, endAngle = τ;
6006
    function pie(data) {
6007
      var values = data.map(function(d, i) {
6008
        return +value.call(pie, d, i);
6009
      });
6010
      var a = +(typeof startAngle === "function" ? startAngle.apply(this, arguments) : startAngle);
6011
      var k = ((typeof endAngle === "function" ? endAngle.apply(this, arguments) : endAngle) - a) / d3.sum(values);
6012
      var index = d3.range(data.length);
6013
      if (sort != null) index.sort(sort === d3_layout_pieSortByValue ? function(i, j) {
6014
        return values[j] - values[i];
6015
      } : function(i, j) {
6016
        return sort(data[i], data[j]);
6017
      });
6018
      var arcs = [];
6019
      index.forEach(function(i) {
6020
        var d;
6021
        arcs[i] = {
6022
          data: data[i],
6023
          value: d = values[i],
6024
          startAngle: a,
6025
          endAngle: a += d * k
6026
        };
6027
      });
6028
      return arcs;
6029
    }
6030
    pie.value = function(x) {
6031
      if (!arguments.length) return value;
6032
      value = x;
6033
      return pie;
6034
    };
6035
    pie.sort = function(x) {
6036
      if (!arguments.length) return sort;
6037
      sort = x;
6038
      return pie;
6039
    };
6040
    pie.startAngle = function(x) {
6041
      if (!arguments.length) return startAngle;
6042
      startAngle = x;
6043
      return pie;
6044
    };
6045
    pie.endAngle = function(x) {
6046
      if (!arguments.length) return endAngle;
6047
      endAngle = x;
6048
      return pie;
6049
    };
6050
    return pie;
6051
  };
6052
  var d3_layout_pieSortByValue = {};
6053
  d3.layout.stack = function() {
6054
    var values = d3_identity, order = d3_layout_stackOrderDefault, offset = d3_layout_stackOffsetZero, out = d3_layout_stackOut, x = d3_layout_stackX, y = d3_layout_stackY;
6055
    function stack(data, index) {
6056
      var series = data.map(function(d, i) {
6057
        return values.call(stack, d, i);
6058
      });
6059
      var points = series.map(function(d) {
6060
        return d.map(function(v, i) {
6061
          return [ x.call(stack, v, i), y.call(stack, v, i) ];
6062
        });
6063
      });
6064
      var orders = order.call(stack, points, index);
6065
      series = d3.permute(series, orders);
6066
      points = d3.permute(points, orders);
6067
      var offsets = offset.call(stack, points, index);
6068
      var n = series.length, m = series[0].length, i, j, o;
6069
      for (j = 0; j < m; ++j) {
6070
        out.call(stack, series[0][j], o = offsets[j], points[0][j][1]);
6071
        for (i = 1; i < n; ++i) {
6072
          out.call(stack, series[i][j], o += points[i - 1][j][1], points[i][j][1]);
6073
        }
6074
      }
6075
      return data;
6076
    }
6077
    stack.values = function(x) {
6078
      if (!arguments.length) return values;
6079
      values = x;
6080
      return stack;
6081
    };
6082
    stack.order = function(x) {
6083
      if (!arguments.length) return order;
6084
      order = typeof x === "function" ? x : d3_layout_stackOrders.get(x) || d3_layout_stackOrderDefault;
6085
      return stack;
6086
    };
6087
    stack.offset = function(x) {
6088
      if (!arguments.length) return offset;
6089
      offset = typeof x === "function" ? x : d3_layout_stackOffsets.get(x) || d3_layout_stackOffsetZero;
6090
      return stack;
6091
    };
6092
    stack.x = function(z) {
6093
      if (!arguments.length) return x;
6094
      x = z;
6095
      return stack;
6096
    };
6097
    stack.y = function(z) {
6098
      if (!arguments.length) return y;
6099
      y = z;
6100
      return stack;
6101
    };
6102
    stack.out = function(z) {
6103
      if (!arguments.length) return out;
6104
      out = z;
6105
      return stack;
6106
    };
6107
    return stack;
6108
  };
6109
  function d3_layout_stackX(d) {
6110
    return d.x;
6111
  }
6112
  function d3_layout_stackY(d) {
6113
    return d.y;
6114
  }
6115
  function d3_layout_stackOut(d, y0, y) {
6116
    d.y0 = y0;
6117
    d.y = y;
6118
  }
6119
  var d3_layout_stackOrders = d3.map({
6120
    "inside-out": function(data) {
6121
      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) {
6122
        return max[a] - max[b];
6123
      }), top = 0, bottom = 0, tops = [], bottoms = [];
6124
      for (i = 0; i < n; ++i) {
6125
        j = index[i];
6126
        if (top < bottom) {
6127
          top += sums[j];
6128
          tops.push(j);
6129
        } else {
6130
          bottom += sums[j];
6131
          bottoms.push(j);
6132
        }
6133
      }
6134
      return bottoms.reverse().concat(tops);
6135
    },
6136
    reverse: function(data) {
6137
      return d3.range(data.length).reverse();
6138
    },
6139
    "default": d3_layout_stackOrderDefault
6140
  });
6141
  var d3_layout_stackOffsets = d3.map({
6142
    silhouette: function(data) {
6143
      var n = data.length, m = data[0].length, sums = [], max = 0, i, j, o, y0 = [];
6144
      for (j = 0; j < m; ++j) {
6145
        for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
6146
        if (o > max) max = o;
6147
        sums.push(o);
6148
      }
6149
      for (j = 0; j < m; ++j) {
6150
        y0[j] = (max - sums[j]) / 2;
6151
      }
6152
      return y0;
6153
    },
6154
    wiggle: function(data) {
6155
      var n = data.length, x = data[0], m = x.length, i, j, k, s1, s2, s3, dx, o, o0, y0 = [];
6156
      y0[0] = o = o0 = 0;
6157
      for (j = 1; j < m; ++j) {
6158
        for (i = 0, s1 = 0; i < n; ++i) s1 += data[i][j][1];
6159
        for (i = 0, s2 = 0, dx = x[j][0] - x[j - 1][0]; i < n; ++i) {
6160
          for (k = 0, s3 = (data[i][j][1] - data[i][j - 1][1]) / (2 * dx); k < i; ++k) {
6161
            s3 += (data[k][j][1] - data[k][j - 1][1]) / dx;
6162
          }
6163
          s2 += s3 * data[i][j][1];
6164
        }
6165
        y0[j] = o -= s1 ? s2 / s1 * dx : 0;
6166
        if (o < o0) o0 = o;
6167
      }
6168
      for (j = 0; j < m; ++j) y0[j] -= o0;
6169
      return y0;
6170
    },
6171
    expand: function(data) {
6172
      var n = data.length, m = data[0].length, k = 1 / n, i, j, o, y0 = [];
6173
      for (j = 0; j < m; ++j) {
6174
        for (i = 0, o = 0; i < n; i++) o += data[i][j][1];
6175
        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;
6176
      }
6177
      for (j = 0; j < m; ++j) y0[j] = 0;
6178
      return y0;
6179
    },
6180
    zero: d3_layout_stackOffsetZero
6181
  });
6182
  function d3_layout_stackOrderDefault(data) {
6183
    return d3.range(data.length);
6184
  }
6185
  function d3_layout_stackOffsetZero(data) {
6186
    var j = -1, m = data[0].length, y0 = [];
6187
    while (++j < m) y0[j] = 0;
6188
    return y0;
6189
  }
6190
  function d3_layout_stackMaxIndex(array) {
6191
    var i = 1, j = 0, v = array[0][1], k, n = array.length;
6192
    for (;i < n; ++i) {
6193
      if ((k = array[i][1]) > v) {
6194
        j = i;
6195
        v = k;
6196
      }
6197
    }
6198
    return j;
6199
  }
6200
  function d3_layout_stackReduceSum(d) {
6201
    return d.reduce(d3_layout_stackSum, 0);
6202
  }
6203
  function d3_layout_stackSum(p, d) {
6204
    return p + d[1];
6205
  }
6206
  d3.layout.histogram = function() {
6207
    var frequency = true, valuer = Number, ranger = d3_layout_histogramRange, binner = d3_layout_histogramBinSturges;
6208
    function histogram(data, i) {
6209
      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;
6210
      while (++i < m) {
6211
        bin = bins[i] = [];
6212
        bin.dx = thresholds[i + 1] - (bin.x = thresholds[i]);
6213
        bin.y = 0;
6214
      }
6215
      if (m > 0) {
6216
        i = -1;
6217
        while (++i < n) {
6218
          x = values[i];
6219
          if (x >= range[0] && x <= range[1]) {
6220
            bin = bins[d3.bisect(thresholds, x, 1, m) - 1];
6221
            bin.y += k;
6222
            bin.push(data[i]);
6223
          }
6224
        }
6225
      }
6226
      return bins;
6227
    }
6228
    histogram.value = function(x) {
6229
      if (!arguments.length) return valuer;
6230
      valuer = x;
6231
      return histogram;
6232
    };
6233
    histogram.range = function(x) {
6234
      if (!arguments.length) return ranger;
6235
      ranger = d3_functor(x);
6236
      return histogram;
6237
    };
6238
    histogram.bins = function(x) {
6239
      if (!arguments.length) return binner;
6240
      binner = typeof x === "number" ? function(range) {
6241
        return d3_layout_histogramBinFixed(range, x);
6242
      } : d3_functor(x);
6243
      return histogram;
6244
    };
6245
    histogram.frequency = function(x) {
6246
      if (!arguments.length) return frequency;
6247
      frequency = !!x;
6248
      return histogram;
6249
    };
6250
    return histogram;
6251
  };
6252
  function d3_layout_histogramBinSturges(range, values) {
6253
    return d3_layout_histogramBinFixed(range, Math.ceil(Math.log(values.length) / Math.LN2 + 1));
6254
  }
6255
  function d3_layout_histogramBinFixed(range, n) {
6256
    var x = -1, b = +range[0], m = (range[1] - b) / n, f = [];
6257
    while (++x <= n) f[x] = m * x + b;
6258
    return f;
6259
  }
6260
  function d3_layout_histogramRange(values) {
6261
    return [ d3.min(values), d3.max(values) ];
6262
  }
6263
  d3.layout.tree = function() {
6264
    var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false;
6265
    function tree(d, i) {
6266
      var nodes = hierarchy.call(this, d, i), root = nodes[0];
6267
      function firstWalk(node, previousSibling) {
6268
        var children = node.children, layout = node._tree;
6269
        if (children && (n = children.length)) {
6270
          var n, firstChild = children[0], previousChild, ancestor = firstChild, child, i = -1;
6271
          while (++i < n) {
6272
            child = children[i];
6273
            firstWalk(child, previousChild);
6274
            ancestor = apportion(child, previousChild, ancestor);
6275
            previousChild = child;
6276
          }
6277
          d3_layout_treeShift(node);
6278
          var midpoint = .5 * (firstChild._tree.prelim + child._tree.prelim);
6279
          if (previousSibling) {
6280
            layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
6281
            layout.mod = layout.prelim - midpoint;
6282
          } else {
6283
            layout.prelim = midpoint;
6284
          }
6285
        } else {
6286
          if (previousSibling) {
6287
            layout.prelim = previousSibling._tree.prelim + separation(node, previousSibling);
6288
          }
6289
        }
6290
      }
6291
      function secondWalk(node, x) {
6292
        node.x = node._tree.prelim + x;
6293
        var children = node.children;
6294
        if (children && (n = children.length)) {
6295
          var i = -1, n;
6296
          x += node._tree.mod;
6297
          while (++i < n) {
6298
            secondWalk(children[i], x);
6299
          }
6300
        }
6301
      }
6302
      function apportion(node, previousSibling, ancestor) {
6303
        if (previousSibling) {
6304
          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;
6305
          while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
6306
            vom = d3_layout_treeLeft(vom);
6307
            vop = d3_layout_treeRight(vop);
6308
            vop._tree.ancestor = node;
6309
            shift = vim._tree.prelim + sim - vip._tree.prelim - sip + separation(vim, vip);
6310
            if (shift > 0) {
6311
              d3_layout_treeMove(d3_layout_treeAncestor(vim, node, ancestor), node, shift);
6312
              sip += shift;
6313
              sop += shift;
6314
            }
6315
            sim += vim._tree.mod;
6316
            sip += vip._tree.mod;
6317
            som += vom._tree.mod;
6318
            sop += vop._tree.mod;
6319
          }
6320
          if (vim && !d3_layout_treeRight(vop)) {
6321
            vop._tree.thread = vim;
6322
            vop._tree.mod += sim - sop;
6323
          }
6324
          if (vip && !d3_layout_treeLeft(vom)) {
6325
            vom._tree.thread = vip;
6326
            vom._tree.mod += sip - som;
6327
            ancestor = node;
6328
          }
6329
        }
6330
        return ancestor;
6331
      }
6332
      d3_layout_treeVisitAfter(root, function(node, previousSibling) {
6333
        node._tree = {
6334
          ancestor: node,
6335
          prelim: 0,
6336
          mod: 0,
6337
          change: 0,
6338
          shift: 0,
6339
          number: previousSibling ? previousSibling._tree.number + 1 : 0
6340
        };
6341
      });
6342
      firstWalk(root);
6343
      secondWalk(root, -root._tree.prelim);
6344
      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;
6345
      d3_layout_treeVisitAfter(root, nodeSize ? function(node) {
6346
        node.x *= size[0];
6347
        node.y = node.depth * size[1];
6348
        delete node._tree;
6349
      } : function(node) {
6350
        node.x = (node.x - x0) / (x1 - x0) * size[0];
6351
        node.y = node.depth / y1 * size[1];
6352
        delete node._tree;
6353
      });
6354
      return nodes;
6355
    }
6356
    tree.separation = function(x) {
6357
      if (!arguments.length) return separation;
6358
      separation = x;
6359
      return tree;
6360
    };
6361
    tree.size = function(x) {
6362
      if (!arguments.length) return nodeSize ? null : size;
6363
      nodeSize = (size = x) == null;
6364
      return tree;
6365
    };
6366
    tree.nodeSize = function(x) {
6367
      if (!arguments.length) return nodeSize ? size : null;
6368
      nodeSize = (size = x) != null;
6369
      return tree;
6370
    };
6371
    return d3_layout_hierarchyRebind(tree, hierarchy);
6372
  };
6373
  function d3_layout_treeSeparation(a, b) {
6374
    return a.parent == b.parent ? 1 : 2;
6375
  }
6376
  function d3_layout_treeLeft(node) {
6377
    var children = node.children;
6378
    return children && children.length ? children[0] : node._tree.thread;
6379
  }
6380
  function d3_layout_treeRight(node) {
6381
    var children = node.children, n;
6382
    return children && (n = children.length) ? children[n - 1] : node._tree.thread;
6383
  }
6384
  function d3_layout_treeSearch(node, compare) {
6385
    var children = node.children;
6386
    if (children && (n = children.length)) {
6387
      var child, n, i = -1;
6388
      while (++i < n) {
6389
        if (compare(child = d3_layout_treeSearch(children[i], compare), node) > 0) {
6390
          node = child;
6391
        }
6392
      }
6393
    }
6394
    return node;
6395
  }
6396
  function d3_layout_treeRightmost(a, b) {
6397
    return a.x - b.x;
6398
  }
6399
  function d3_layout_treeLeftmost(a, b) {
6400
    return b.x - a.x;
6401
  }
6402
  function d3_layout_treeDeepest(a, b) {
6403
    return a.depth - b.depth;
6404
  }
6405
  function d3_layout_treeVisitAfter(node, callback) {
6406
    function visit(node, previousSibling) {
6407
      var children = node.children;
6408
      if (children && (n = children.length)) {
6409
        var child, previousChild = null, i = -1, n;
6410
        while (++i < n) {
6411
          child = children[i];
6412
          visit(child, previousChild);
6413
          previousChild = child;
6414
        }
6415
      }
6416
      callback(node, previousSibling);
6417
    }
6418
    visit(node, null);
6419
  }
6420
  function d3_layout_treeShift(node) {
6421
    var shift = 0, change = 0, children = node.children, i = children.length, child;
6422
    while (--i >= 0) {
6423
      child = children[i]._tree;
6424
      child.prelim += shift;
6425
      child.mod += shift;
6426
      shift += child.shift + (change += child.change);
6427
    }
6428
  }
6429
  function d3_layout_treeMove(ancestor, node, shift) {
6430
    ancestor = ancestor._tree;
6431
    node = node._tree;
6432
    var change = shift / (node.number - ancestor.number);
6433
    ancestor.change += change;
6434
    node.change -= change;
6435
    node.shift += shift;
6436
    node.prelim += shift;
6437
    node.mod += shift;
6438
  }
6439
  function d3_layout_treeAncestor(vim, node, ancestor) {
6440
    return vim._tree.ancestor.parent == node.parent ? vim._tree.ancestor : ancestor;
6441
  }
6442
  d3.layout.pack = function() {
6443
    var hierarchy = d3.layout.hierarchy().sort(d3_layout_packSort), padding = 0, size = [ 1, 1 ], radius;
6444
    function pack(d, i) {
6445
      var nodes = hierarchy.call(this, d, i), root = nodes[0], w = size[0], h = size[1], r = radius == null ? Math.sqrt : typeof radius === "function" ? radius : function() {
6446
        return radius;
6447
      };
6448
      root.x = root.y = 0;
6449
      d3_layout_treeVisitAfter(root, function(d) {
6450
        d.r = +r(d.value);
6451
      });
6452
      d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
6453
      if (padding) {
6454
        var dr = padding * (radius ? 1 : Math.max(2 * root.r / w, 2 * root.r / h)) / 2;
6455
        d3_layout_treeVisitAfter(root, function(d) {
6456
          d.r += dr;
6457
        });
6458
        d3_layout_treeVisitAfter(root, d3_layout_packSiblings);
6459
        d3_layout_treeVisitAfter(root, function(d) {
6460
          d.r -= dr;
6461
        });
6462
      }
6463
      d3_layout_packTransform(root, w / 2, h / 2, radius ? 1 : 1 / Math.max(2 * root.r / w, 2 * root.r / h));
6464
      return nodes;
6465
    }
6466
    pack.size = function(_) {
6467
      if (!arguments.length) return size;
6468
      size = _;
6469
      return pack;
6470
    };
6471
    pack.radius = function(_) {
6472
      if (!arguments.length) return radius;
6473
      radius = _ == null || typeof _ === "function" ? _ : +_;
6474
      return pack;
6475
    };
6476
    pack.padding = function(_) {
6477
      if (!arguments.length) return padding;
6478
      padding = +_;
6479
      return pack;
6480
    };
6481
    return d3_layout_hierarchyRebind(pack, hierarchy);
6482
  };
6483
  function d3_layout_packSort(a, b) {
6484
    return a.value - b.value;
6485
  }
6486
  function d3_layout_packInsert(a, b) {
6487
    var c = a._pack_next;
6488
    a._pack_next = b;
6489
    b._pack_prev = a;
6490
    b._pack_next = c;
6491
    c._pack_prev = b;
6492
  }
6493
  function d3_layout_packSplice(a, b) {
6494
    a._pack_next = b;
6495
    b._pack_prev = a;
6496
  }
6497
  function d3_layout_packIntersects(a, b) {
6498
    var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
6499
    return .999 * dr * dr > dx * dx + dy * dy;
6500
  }
6501
  function d3_layout_packSiblings(node) {
6502
    if (!(nodes = node.children) || !(n = nodes.length)) return;
6503
    var nodes, xMin = Infinity, xMax = -Infinity, yMin = Infinity, yMax = -Infinity, a, b, c, i, j, k, n;
6504
    function bound(node) {
6505
      xMin = Math.min(node.x - node.r, xMin);
6506
      xMax = Math.max(node.x + node.r, xMax);
6507
      yMin = Math.min(node.y - node.r, yMin);
6508
      yMax = Math.max(node.y + node.r, yMax);
6509
    }
6510
    nodes.forEach(d3_layout_packLink);
6511
    a = nodes[0];
6512
    a.x = -a.r;
6513
    a.y = 0;
6514
    bound(a);
6515
    if (n > 1) {
6516
      b = nodes[1];
6517
      b.x = b.r;
6518
      b.y = 0;
6519
      bound(b);
6520
      if (n > 2) {
6521
        c = nodes[2];
6522
        d3_layout_packPlace(a, b, c);
6523
        bound(c);
6524
        d3_layout_packInsert(a, c);
6525
        a._pack_prev = c;
6526
        d3_layout_packInsert(c, b);
6527
        b = a._pack_next;
6528
        for (i = 3; i < n; i++) {
6529
          d3_layout_packPlace(a, b, c = nodes[i]);
6530
          var isect = 0, s1 = 1, s2 = 1;
6531
          for (j = b._pack_next; j !== b; j = j._pack_next, s1++) {
6532
            if (d3_layout_packIntersects(j, c)) {
6533
              isect = 1;
6534
              break;
6535
            }
6536
          }
6537
          if (isect == 1) {
6538
            for (k = a._pack_prev; k !== j._pack_prev; k = k._pack_prev, s2++) {
6539
              if (d3_layout_packIntersects(k, c)) {
6540
                break;
6541
              }
6542
            }
6543
          }
6544
          if (isect) {
6545
            if (s1 < s2 || s1 == s2 && b.r < a.r) d3_layout_packSplice(a, b = j); else d3_layout_packSplice(a = k, b);
6546
            i--;
6547
          } else {
6548
            d3_layout_packInsert(a, c);
6549
            b = c;
6550
            bound(c);
6551
          }
6552
        }
6553
      }
6554
    }
6555
    var cx = (xMin + xMax) / 2, cy = (yMin + yMax) / 2, cr = 0;
6556
    for (i = 0; i < n; i++) {
6557
      c = nodes[i];
6558
      c.x -= cx;
6559
      c.y -= cy;
6560
      cr = Math.max(cr, c.r + Math.sqrt(c.x * c.x + c.y * c.y));
6561
    }
6562
    node.r = cr;
6563
    nodes.forEach(d3_layout_packUnlink);
6564
  }
6565
  function d3_layout_packLink(node) {
6566
    node._pack_next = node._pack_prev = node;
6567
  }
6568
  function d3_layout_packUnlink(node) {
6569
    delete node._pack_next;
6570
    delete node._pack_prev;
6571
  }
6572
  function d3_layout_packTransform(node, x, y, k) {
6573
    var children = node.children;
6574
    node.x = x += k * node.x;
6575
    node.y = y += k * node.y;
6576
    node.r *= k;
6577
    if (children) {
6578
      var i = -1, n = children.length;
6579
      while (++i < n) d3_layout_packTransform(children[i], x, y, k);
6580
    }
6581
  }
6582
  function d3_layout_packPlace(a, b, c) {
6583
    var db = a.r + c.r, dx = b.x - a.x, dy = b.y - a.y;
6584
    if (db && (dx || dy)) {
6585
      var da = b.r + c.r, dc = dx * dx + dy * dy;
6586
      da *= da;
6587
      db *= db;
6588
      var x = .5 + (db - da) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
6589
      c.x = a.x + x * dx + y * dy;
6590
      c.y = a.y + x * dy - y * dx;
6591
    } else {
6592
      c.x = a.x + db;
6593
      c.y = a.y;
6594
    }
6595
  }
6596
  d3.layout.cluster = function() {
6597
    var hierarchy = d3.layout.hierarchy().sort(null).value(null), separation = d3_layout_treeSeparation, size = [ 1, 1 ], nodeSize = false;
6598
    function cluster(d, i) {
6599
      var nodes = hierarchy.call(this, d, i), root = nodes[0], previousNode, x = 0;
6600
      d3_layout_treeVisitAfter(root, function(node) {
6601
        var children = node.children;
6602
        if (children && children.length) {
6603
          node.x = d3_layout_clusterX(children);
6604
          node.y = d3_layout_clusterY(children);
6605
        } else {
6606
          node.x = previousNode ? x += separation(node, previousNode) : 0;
6607
          node.y = 0;
6608
          previousNode = node;
6609
        }
6610
      });
6611
      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;
6612
      d3_layout_treeVisitAfter(root, nodeSize ? function(node) {
6613
        node.x = (node.x - root.x) * size[0];
6614
        node.y = (root.y - node.y) * size[1];
6615
      } : function(node) {
6616
        node.x = (node.x - x0) / (x1 - x0) * size[0];
6617
        node.y = (1 - (root.y ? node.y / root.y : 1)) * size[1];
6618
      });
6619
      return nodes;
6620
    }
6621
    cluster.separation = function(x) {
6622
      if (!arguments.length) return separation;
6623
      separation = x;
6624
      return cluster;
6625
    };
6626
    cluster.size = function(x) {
6627
      if (!arguments.length) return nodeSize ? null : size;
6628
      nodeSize = (size = x) == null;
6629
      return cluster;
6630
    };
6631
    cluster.nodeSize = function(x) {
6632
      if (!arguments.length) return nodeSize ? size : null;
6633
      nodeSize = (size = x) != null;
6634
      return cluster;
6635
    };
6636
    return d3_layout_hierarchyRebind(cluster, hierarchy);
6637
  };
6638
  function d3_layout_clusterY(children) {
6639
    return 1 + d3.max(children, function(child) {
6640
      return child.y;
6641
    });
6642
  }
6643
  function d3_layout_clusterX(children) {
6644
    return children.reduce(function(x, child) {
6645
      return x + child.x;
6646
    }, 0) / children.length;
6647
  }
6648
  function d3_layout_clusterLeft(node) {
6649
    var children = node.children;
6650
    return children && children.length ? d3_layout_clusterLeft(children[0]) : node;
6651
  }
6652
  function d3_layout_clusterRight(node) {
6653
    var children = node.children, n;
6654
    return children && (n = children.length) ? d3_layout_clusterRight(children[n - 1]) : node;
6655
  }
6656
  d3.layout.treemap = function() {
6657
    var hierarchy = d3.layout.hierarchy(), round = Math.round, size = [ 1, 1 ], padding = null, pad = d3_layout_treemapPadNull, sticky = false, stickies, mode = "squarify", ratio = .5 * (1 + Math.sqrt(5));
6658
    function scale(children, k) {
6659
      var i = -1, n = children.length, child, area;
6660
      while (++i < n) {
6661
        area = (child = children[i]).value * (k < 0 ? 0 : k);
6662
        child.area = isNaN(area) || area <= 0 ? 0 : area;
6663
      }
6664
    }
6665
    function squarify(node) {
6666
      var children = node.children;
6667
      if (children && children.length) {
6668
        var rect = pad(node), row = [], remaining = children.slice(), child, best = Infinity, score, u = mode === "slice" ? rect.dx : mode === "dice" ? rect.dy : mode === "slice-dice" ? node.depth & 1 ? rect.dy : rect.dx : Math.min(rect.dx, rect.dy), n;
6669
        scale(remaining, rect.dx * rect.dy / node.value);
6670
        row.area = 0;
6671
        while ((n = remaining.length) > 0) {
6672
          row.push(child = remaining[n - 1]);
6673
          row.area += child.area;
6674
          if (mode !== "squarify" || (score = worst(row, u)) <= best) {
6675
            remaining.pop();
6676
            best = score;
6677
          } else {
6678
            row.area -= row.pop().area;
6679
            position(row, u, rect, false);
6680
            u = Math.min(rect.dx, rect.dy);
6681
            row.length = row.area = 0;
6682
            best = Infinity;
6683
          }
6684
        }
6685
        if (row.length) {
6686
          position(row, u, rect, true);
6687
          row.length = row.area = 0;
6688
        }
6689
        children.forEach(squarify);
6690
      }
6691
    }
6692
    function stickify(node) {
6693
      var children = node.children;
6694
      if (children && children.length) {
6695
        var rect = pad(node), remaining = children.slice(), child, row = [];
6696
        scale(remaining, rect.dx * rect.dy / node.value);
6697
        row.area = 0;
6698
        while (child = remaining.pop()) {
6699
          row.push(child);
6700
          row.area += child.area;
6701
          if (child.z != null) {
6702
            position(row, child.z ? rect.dx : rect.dy, rect, !remaining.length);
6703
            row.length = row.area = 0;
6704
          }
6705
        }
6706
        children.forEach(stickify);
6707
      }
6708
    }
6709
    function worst(row, u) {
6710
      var s = row.area, r, rmax = 0, rmin = Infinity, i = -1, n = row.length;
6711
      while (++i < n) {
6712
        if (!(r = row[i].area)) continue;
6713
        if (r < rmin) rmin = r;
6714
        if (r > rmax) rmax = r;
6715
      }
6716
      s *= s;
6717
      u *= u;
6718
      return s ? Math.max(u * rmax * ratio / s, s / (u * rmin * ratio)) : Infinity;
6719
    }
6720
    function position(row, u, rect, flush) {
6721
      var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
6722
      if (u == rect.dx) {
6723
        if (flush || v > rect.dy) v = rect.dy;
6724
        while (++i < n) {
6725
          o = row[i];
6726
          o.x = x;
6727
          o.y = y;
6728
          o.dy = v;
6729
          x += o.dx = Math.min(rect.x + rect.dx - x, v ? round(o.area / v) : 0);
6730
        }
6731
        o.z = true;
6732
        o.dx += rect.x + rect.dx - x;
6733
        rect.y += v;
6734
        rect.dy -= v;
6735
      } else {
6736
        if (flush || v > rect.dx) v = rect.dx;
6737
        while (++i < n) {
6738
          o = row[i];
6739
          o.x = x;
6740
          o.y = y;
6741
          o.dx = v;
6742
          y += o.dy = Math.min(rect.y + rect.dy - y, v ? round(o.area / v) : 0);
6743
        }
6744
        o.z = false;
6745
        o.dy += rect.y + rect.dy - y;
6746
        rect.x += v;
6747
        rect.dx -= v;
6748
      }
6749
    }
6750
    function treemap(d) {
6751
      var nodes = stickies || hierarchy(d), root = nodes[0];
6752
      root.x = 0;
6753
      root.y = 0;
6754
      root.dx = size[0];
6755
      root.dy = size[1];
6756
      if (stickies) hierarchy.revalue(root);
6757
      scale([ root ], root.dx * root.dy / root.value);
6758
      (stickies ? stickify : squarify)(root);
6759
      if (sticky) stickies = nodes;
6760
      return nodes;
6761
    }
6762
    treemap.size = function(x) {
6763
      if (!arguments.length) return size;
6764
      size = x;
6765
      return treemap;
6766
    };
6767
    treemap.padding = function(x) {
6768
      if (!arguments.length) return padding;
6769
      function padFunction(node) {
6770
        var p = x.call(treemap, node, node.depth);
6771
        return p == null ? d3_layout_treemapPadNull(node) : d3_layout_treemapPad(node, typeof p === "number" ? [ p, p, p, p ] : p);
6772
      }
6773
      function padConstant(node) {
6774
        return d3_layout_treemapPad(node, x);
6775
      }
6776
      var type;
6777
      pad = (padding = x) == null ? d3_layout_treemapPadNull : (type = typeof x) === "function" ? padFunction : type === "number" ? (x = [ x, x, x, x ], 
6778
      padConstant) : padConstant;
6779
      return treemap;
6780
    };
6781
    treemap.round = function(x) {
6782
      if (!arguments.length) return round != Number;
6783
      round = x ? Math.round : Number;
6784
      return treemap;
6785
    };
6786
    treemap.sticky = function(x) {
6787
      if (!arguments.length) return sticky;
6788
      sticky = x;
6789
      stickies = null;
6790
      return treemap;
6791
    };
6792
    treemap.ratio = function(x) {
6793
      if (!arguments.length) return ratio;
6794
      ratio = x;
6795
      return treemap;
6796
    };
6797
    treemap.mode = function(x) {
6798
      if (!arguments.length) return mode;
6799
      mode = x + "";
6800
      return treemap;
6801
    };
6802
    return d3_layout_hierarchyRebind(treemap, hierarchy);
6803
  };
6804
  function d3_layout_treemapPadNull(node) {
6805
    return {
6806
      x: node.x,
6807
      y: node.y,
6808
      dx: node.dx,
6809
      dy: node.dy
6810
    };
6811
  }
6812
  function d3_layout_treemapPad(node, padding) {
6813
    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];
6814
    if (dx < 0) {
6815
      x += dx / 2;
6816
      dx = 0;
6817
    }
6818
    if (dy < 0) {
6819
      y += dy / 2;
6820
      dy = 0;
6821
    }
6822
    return {
6823
      x: x,
6824
      y: y,
6825
      dx: dx,
6826
      dy: dy
6827
    };
6828
  }
6829
  d3.random = {
6830
    normal: function(µ, σ) {
6831
      var n = arguments.length;
6832
      if (n < 2) σ = 1;
6833
      if (n < 1) µ = 0;
6834
      return function() {
6835
        var x, y, r;
6836
        do {
6837
          x = Math.random() * 2 - 1;
6838
          y = Math.random() * 2 - 1;
6839
          r = x * x + y * y;
6840
        } while (!r || r > 1);
6841
        return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
6842
      };
6843
    },
6844
    logNormal: function() {
6845
      var random = d3.random.normal.apply(d3, arguments);
6846
      return function() {
6847
        return Math.exp(random());
6848
      };
6849
    },
6850
    irwinHall: function(m) {
6851
      return function() {
6852
        for (var s = 0, j = 0; j < m; j++) s += Math.random();
6853
        return s / m;
6854
      };
6855
    }
6856
  };
6857
  d3.scale = {};
6858
  function d3_scaleExtent(domain) {
6859
    var start = domain[0], stop = domain[domain.length - 1];
6860
    return start < stop ? [ start, stop ] : [ stop, start ];
6861
  }
6862
  function d3_scaleRange(scale) {
6863
    return scale.rangeExtent ? scale.rangeExtent() : d3_scaleExtent(scale.range());
6864
  }
6865
  function d3_scale_bilinear(domain, range, uninterpolate, interpolate) {
6866
    var u = uninterpolate(domain[0], domain[1]), i = interpolate(range[0], range[1]);
6867
    return function(x) {
6868
      return i(u(x));
6869
    };
6870
  }
6871
  function d3_scale_nice(domain, nice) {
6872
    var i0 = 0, i1 = domain.length - 1, x0 = domain[i0], x1 = domain[i1], dx;
6873
    if (x1 < x0) {
6874
      dx = i0, i0 = i1, i1 = dx;
6875
      dx = x0, x0 = x1, x1 = dx;
6876
    }
6877
    domain[i0] = nice.floor(x0);
6878
    domain[i1] = nice.ceil(x1);
6879
    return domain;
6880
  }
6881
  function d3_scale_niceStep(step) {
6882
    return step ? {
6883
      floor: function(x) {
6884
        return Math.floor(x / step) * step;
6885
      },
6886
      ceil: function(x) {
6887
        return Math.ceil(x / step) * step;
6888
      }
6889
    } : d3_scale_niceIdentity;
6890
  }
6891
  var d3_scale_niceIdentity = {
6892
    floor: d3_identity,
6893
    ceil: d3_identity
6894
  };
6895
  function d3_scale_polylinear(domain, range, uninterpolate, interpolate) {
6896
    var u = [], i = [], j = 0, k = Math.min(domain.length, range.length) - 1;
6897
    if (domain[k] < domain[0]) {
6898
      domain = domain.slice().reverse();
6899
      range = range.slice().reverse();
6900
    }
6901
    while (++j <= k) {
6902
      u.push(uninterpolate(domain[j - 1], domain[j]));
6903
      i.push(interpolate(range[j - 1], range[j]));
6904
    }
6905
    return function(x) {
6906
      var j = d3.bisect(domain, x, 1, k) - 1;
6907
      return i[j](u[j](x));
6908
    };
6909
  }
6910
  d3.scale.linear = function() {
6911
    return d3_scale_linear([ 0, 1 ], [ 0, 1 ], d3_interpolate, false);
6912
  };
6913
  function d3_scale_linear(domain, range, interpolate, clamp) {
6914
    var output, input;
6915
    function rescale() {
6916
      var linear = Math.min(domain.length, range.length) > 2 ? d3_scale_polylinear : d3_scale_bilinear, uninterpolate = clamp ? d3_uninterpolateClamp : d3_uninterpolateNumber;
6917
      output = linear(domain, range, uninterpolate, interpolate);
6918
      input = linear(range, domain, uninterpolate, d3_interpolate);
6919
      return scale;
6920
    }
6921
    function scale(x) {
6922
      return output(x);
6923
    }
6924
    scale.invert = function(y) {
6925
      return input(y);
6926
    };
6927
    scale.domain = function(x) {
6928
      if (!arguments.length) return domain;
6929
      domain = x.map(Number);
6930
      return rescale();
6931
    };
6932
    scale.range = function(x) {
6933
      if (!arguments.length) return range;
6934
      range = x;
6935
      return rescale();
6936
    };
6937
    scale.rangeRound = function(x) {
6938
      return scale.range(x).interpolate(d3_interpolateRound);
6939
    };
6940
    scale.clamp = function(x) {
6941
      if (!arguments.length) return clamp;
6942
      clamp = x;
6943
      return rescale();
6944
    };
6945
    scale.interpolate = function(x) {
6946
      if (!arguments.length) return interpolate;
6947
      interpolate = x;
6948
      return rescale();
6949
    };
6950
    scale.ticks = function(m) {
6951
      return d3_scale_linearTicks(domain, m);
6952
    };
6953
    scale.tickFormat = function(m, format) {
6954
      return d3_scale_linearTickFormat(domain, m, format);
6955
    };
6956
    scale.nice = function(m) {
6957
      d3_scale_linearNice(domain, m);
6958
      return rescale();
6959
    };
6960
    scale.copy = function() {
6961
      return d3_scale_linear(domain, range, interpolate, clamp);
6962
    };
6963
    return rescale();
6964
  }
6965
  function d3_scale_linearRebind(scale, linear) {
6966
    return d3.rebind(scale, linear, "range", "rangeRound", "interpolate", "clamp");
6967
  }
6968
  function d3_scale_linearNice(domain, m) {
6969
    return d3_scale_nice(domain, d3_scale_niceStep(d3_scale_linearTickRange(domain, m)[2]));
6970
  }
6971
  function d3_scale_linearTickRange(domain, m) {
6972
    if (m == null) m = 10;
6973
    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;
6974
    if (err <= .15) step *= 10; else if (err <= .35) step *= 5; else if (err <= .75) step *= 2;
6975
    extent[0] = Math.ceil(extent[0] / step) * step;
6976
    extent[1] = Math.floor(extent[1] / step) * step + step * .5;
6977
    extent[2] = step;
6978
    return extent;
6979
  }
6980
  function d3_scale_linearTicks(domain, m) {
6981
    return d3.range.apply(d3, d3_scale_linearTickRange(domain, m));
6982
  }
6983
  function d3_scale_linearTickFormat(domain, m, format) {
6984
    var range = d3_scale_linearTickRange(domain, m);
6985
    return d3.format(format ? format.replace(d3_format_re, function(a, b, c, d, e, f, g, h, i, j) {
6986
      return [ b, c, d, e, f, g, h, i || "." + d3_scale_linearFormatPrecision(j, range), j ].join("");
6987
    }) : ",." + d3_scale_linearPrecision(range[2]) + "f");
6988
  }
6989
  var d3_scale_linearFormatSignificant = {
6990
    s: 1,
6991
    g: 1,
6992
    p: 1,
6993
    r: 1,
6994
    e: 1
6995
  };
6996
  function d3_scale_linearPrecision(value) {
6997
    return -Math.floor(Math.log(value) / Math.LN10 + .01);
6998
  }
6999
  function d3_scale_linearFormatPrecision(type, range) {
7000
    var p = d3_scale_linearPrecision(range[2]);
7001
    return type in d3_scale_linearFormatSignificant ? Math.abs(p - d3_scale_linearPrecision(Math.max(Math.abs(range[0]), Math.abs(range[1])))) + +(type !== "e") : p - (type === "%") * 2;
7002
  }
7003
  d3.scale.log = function() {
7004
    return d3_scale_log(d3.scale.linear().domain([ 0, 1 ]), 10, true, [ 1, 10 ]);
7005
  };
7006
  function d3_scale_log(linear, base, positive, domain) {
7007
    function log(x) {
7008
      return (positive ? Math.log(x < 0 ? 0 : x) : -Math.log(x > 0 ? 0 : -x)) / Math.log(base);
7009
    }
7010
    function pow(x) {
7011
      return positive ? Math.pow(base, x) : -Math.pow(base, -x);
7012
    }
7013
    function scale(x) {
7014
      return linear(log(x));
7015
    }
7016
    scale.invert = function(x) {
7017
      return pow(linear.invert(x));
7018
    };
7019
    scale.domain = function(x) {
7020
      if (!arguments.length) return domain;
7021
      positive = x[0] >= 0;
7022
      linear.domain((domain = x.map(Number)).map(log));
7023
      return scale;
7024
    };
7025
    scale.base = function(_) {
7026
      if (!arguments.length) return base;
7027
      base = +_;
7028
      linear.domain(domain.map(log));
7029
      return scale;
7030
    };
7031
    scale.nice = function() {
7032
      var niced = d3_scale_nice(domain.map(log), positive ? Math : d3_scale_logNiceNegative);
7033
      linear.domain(niced);
7034
      domain = niced.map(pow);
7035
      return scale;
7036
    };
7037
    scale.ticks = function() {
7038
      var extent = d3_scaleExtent(domain), ticks = [], u = extent[0], v = extent[1], i = Math.floor(log(u)), j = Math.ceil(log(v)), n = base % 1 ? 2 : base;
7039
      if (isFinite(j - i)) {
7040
        if (positive) {
7041
          for (;i < j; i++) for (var k = 1; k < n; k++) ticks.push(pow(i) * k);
7042
          ticks.push(pow(i));
7043
        } else {
7044
          ticks.push(pow(i));
7045
          for (;i++ < j; ) for (var k = n - 1; k > 0; k--) ticks.push(pow(i) * k);
7046
        }
7047
        for (i = 0; ticks[i] < u; i++) {}
7048
        for (j = ticks.length; ticks[j - 1] > v; j--) {}
7049
        ticks = ticks.slice(i, j);
7050
      }
7051
      return ticks;
7052
    };
7053
    scale.tickFormat = function(n, format) {
7054
      if (!arguments.length) return d3_scale_logFormat;
7055
      if (arguments.length < 2) format = d3_scale_logFormat; else if (typeof format !== "function") format = d3.format(format);
7056
      var k = Math.max(.1, n / scale.ticks().length), f = positive ? (e = 1e-12, Math.ceil) : (e = -1e-12, 
7057
      Math.floor), e;
7058
      return function(d) {
7059
        return d / pow(f(log(d) + e)) <= k ? format(d) : "";
7060
      };
7061
    };
7062
    scale.copy = function() {
7063
      return d3_scale_log(linear.copy(), base, positive, domain);
7064
    };
7065
    return d3_scale_linearRebind(scale, linear);
7066
  }
7067
  var d3_scale_logFormat = d3.format(".0e"), d3_scale_logNiceNegative = {
7068
    floor: function(x) {
7069
      return -Math.ceil(-x);
7070
    },
7071
    ceil: function(x) {
7072
      return -Math.floor(-x);
7073
    }
7074
  };
7075
  d3.scale.pow = function() {
7076
    return d3_scale_pow(d3.scale.linear(), 1, [ 0, 1 ]);
7077
  };
7078
  function d3_scale_pow(linear, exponent, domain) {
7079
    var powp = d3_scale_powPow(exponent), powb = d3_scale_powPow(1 / exponent);
7080
    function scale(x) {
7081
      return linear(powp(x));
7082
    }
7083
    scale.invert = function(x) {
7084
      return powb(linear.invert(x));
7085
    };
7086
    scale.domain = function(x) {
7087
      if (!arguments.length) return domain;
7088
      linear.domain((domain = x.map(Number)).map(powp));
7089
      return scale;
7090
    };
7091
    scale.ticks = function(m) {
7092
      return d3_scale_linearTicks(domain, m);
7093
    };
7094
    scale.tickFormat = function(m, format) {
7095
      return d3_scale_linearTickFormat(domain, m, format);
7096
    };
7097
    scale.nice = function(m) {
7098
      return scale.domain(d3_scale_linearNice(domain, m));
7099
    };
7100
    scale.exponent = function(x) {
7101
      if (!arguments.length) return exponent;
7102
      powp = d3_scale_powPow(exponent = x);
7103
      powb = d3_scale_powPow(1 / exponent);
7104
      linear.domain(domain.map(powp));
7105
      return scale;
7106
    };
7107
    scale.copy = function() {
7108
      return d3_scale_pow(linear.copy(), exponent, domain);
7109
    };
7110
    return d3_scale_linearRebind(scale, linear);
7111
  }
7112
  function d3_scale_powPow(e) {
7113
    return function(x) {
7114
      return x < 0 ? -Math.pow(-x, e) : Math.pow(x, e);
7115
    };
7116
  }
7117
  d3.scale.sqrt = function() {
7118
    return d3.scale.pow().exponent(.5);
7119
  };
7120
  d3.scale.ordinal = function() {
7121
    return d3_scale_ordinal([], {
7122
      t: "range",
7123
      a: [ [] ]
7124
    });
7125
  };
7126
  function d3_scale_ordinal(domain, ranger) {
7127
    var index, range, rangeBand;
7128
    function scale(x) {
7129
      return range[((index.get(x) || ranger.t === "range" && index.set(x, domain.push(x))) - 1) % range.length];
7130
    }
7131
    function steps(start, step) {
7132
      return d3.range(domain.length).map(function(i) {
7133
        return start + step * i;
7134
      });
7135
    }
7136
    scale.domain = function(x) {
7137
      if (!arguments.length) return domain;
7138
      domain = [];
7139
      index = new d3_Map();
7140
      var i = -1, n = x.length, xi;
7141
      while (++i < n) if (!index.has(xi = x[i])) index.set(xi, domain.push(xi));
7142
      return scale[ranger.t].apply(scale, ranger.a);
7143
    };
7144
    scale.range = function(x) {
7145
      if (!arguments.length) return range;
7146
      range = x;
7147
      rangeBand = 0;
7148
      ranger = {
7149
        t: "range",
7150
        a: arguments
7151
      };
7152
      return scale;
7153
    };
7154
    scale.rangePoints = function(x, padding) {
7155
      if (arguments.length < 2) padding = 0;
7156
      var start = x[0], stop = x[1], step = (stop - start) / (Math.max(1, domain.length - 1) + padding);
7157
      range = steps(domain.length < 2 ? (start + stop) / 2 : start + step * padding / 2, step);
7158
      rangeBand = 0;
7159
      ranger = {
7160
        t: "rangePoints",
7161
        a: arguments
7162
      };
7163
      return scale;
7164
    };
7165
    scale.rangeBands = function(x, padding, outerPadding) {
7166
      if (arguments.length < 2) padding = 0;
7167
      if (arguments.length < 3) outerPadding = padding;
7168
      var reverse = x[1] < x[0], start = x[reverse - 0], stop = x[1 - reverse], step = (stop - start) / (domain.length - padding + 2 * outerPadding);
7169
      range = steps(start + step * outerPadding, step);
7170
      if (reverse) range.reverse();
7171
      rangeBand = step * (1 - padding);
7172
      ranger = {
7173
        t: "rangeBands",
7174
        a: arguments
7175
      };
7176
      return scale;
7177
    };
7178
    scale.rangeRoundBands = function(x, padding, outerPadding) {
7179
      if (arguments.length < 2) padding = 0;
7180
      if (arguments.length < 3) outerPadding = padding;
7181
      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;
7182
      range = steps(start + Math.round(error / 2), step);
7183
      if (reverse) range.reverse();
7184
      rangeBand = Math.round(step * (1 - padding));
7185
      ranger = {
7186
        t: "rangeRoundBands",
7187
        a: arguments
7188
      };
7189
      return scale;
7190
    };
7191
    scale.rangeBand = function() {
7192
      return rangeBand;
7193
    };
7194
    scale.rangeExtent = function() {
7195
      return d3_scaleExtent(ranger.a[0]);
7196
    };
7197
    scale.copy = function() {
7198
      return d3_scale_ordinal(domain, ranger);
7199
    };
7200
    return scale.domain(domain);
7201
  }
7202
  d3.scale.category10 = function() {
7203
    return d3.scale.ordinal().range(d3_category10);
7204
  };
7205
  d3.scale.category20 = function() {
7206
    return d3.scale.ordinal().range(d3_category20);
7207
  };
7208
  d3.scale.category20b = function() {
7209
    return d3.scale.ordinal().range(d3_category20b);
7210
  };
7211
  d3.scale.category20c = function() {
7212
    return d3.scale.ordinal().range(d3_category20c);
7213
  };
7214
  var d3_category10 = [ 2062260, 16744206, 2924588, 14034728, 9725885, 9197131, 14907330, 8355711, 12369186, 1556175 ].map(d3_rgbString);
7215
  var d3_category20 = [ 2062260, 11454440, 16744206, 16759672, 2924588, 10018698, 14034728, 16750742, 9725885, 12955861, 9197131, 12885140, 14907330, 16234194, 8355711, 13092807, 12369186, 14408589, 1556175, 10410725 ].map(d3_rgbString);
7216
  var d3_category20b = [ 3750777, 5395619, 7040719, 10264286, 6519097, 9216594, 11915115, 13556636, 9202993, 12426809, 15186514, 15190932, 8666169, 11356490, 14049643, 15177372, 8077683, 10834324, 13528509, 14589654 ].map(d3_rgbString);
7217
  var d3_category20c = [ 3244733, 7057110, 10406625, 13032431, 15095053, 16616764, 16625259, 16634018, 3253076, 7652470, 10607003, 13101504, 7695281, 10394312, 12369372, 14342891, 6513507, 9868950, 12434877, 14277081 ].map(d3_rgbString);
7218
  d3.scale.quantile = function() {
7219
    return d3_scale_quantile([], []);
7220
  };
7221
  function d3_scale_quantile(domain, range) {
7222
    var thresholds;
7223
    function rescale() {
7224
      var k = 0, q = range.length;
7225
      thresholds = [];
7226
      while (++k < q) thresholds[k - 1] = d3.quantile(domain, k / q);
7227
      return scale;
7228
    }
7229
    function scale(x) {
7230
      if (!isNaN(x = +x)) return range[d3.bisect(thresholds, x)];
7231
    }
7232
    scale.domain = function(x) {
7233
      if (!arguments.length) return domain;
7234
      domain = x.filter(function(d) {
7235
        return !isNaN(d);
7236
      }).sort(d3.ascending);
7237
      return rescale();
7238
    };
7239
    scale.range = function(x) {
7240
      if (!arguments.length) return range;
7241
      range = x;
7242
      return rescale();
7243
    };
7244
    scale.quantiles = function() {
7245
      return thresholds;
7246
    };
7247
    scale.invertExtent = function(y) {
7248
      y = range.indexOf(y);
7249
      return y < 0 ? [ NaN, NaN ] : [ y > 0 ? thresholds[y - 1] : domain[0], y < thresholds.length ? thresholds[y] : domain[domain.length - 1] ];
7250
    };
7251
    scale.copy = function() {
7252
      return d3_scale_quantile(domain, range);
7253
    };
7254
    return rescale();
7255
  }
7256
  d3.scale.quantize = function() {
7257
    return d3_scale_quantize(0, 1, [ 0, 1 ]);
7258
  };
7259
  function d3_scale_quantize(x0, x1, range) {
7260
    var kx, i;
7261
    function scale(x) {
7262
      return range[Math.max(0, Math.min(i, Math.floor(kx * (x - x0))))];
7263
    }
7264
    function rescale() {
7265
      kx = range.length / (x1 - x0);
7266
      i = range.length - 1;
7267
      return scale;
7268
    }
7269
    scale.domain = function(x) {
7270
      if (!arguments.length) return [ x0, x1 ];
7271
      x0 = +x[0];
7272
      x1 = +x[x.length - 1];
7273
      return rescale();
7274
    };
7275
    scale.range = function(x) {
7276
      if (!arguments.length) return range;
7277
      range = x;
7278
      return rescale();
7279
    };
7280
    scale.invertExtent = function(y) {
7281
      y = range.indexOf(y);
7282
      y = y < 0 ? NaN : y / kx + x0;
7283
      return [ y, y + 1 / kx ];
7284
    };
7285
    scale.copy = function() {
7286
      return d3_scale_quantize(x0, x1, range);
7287
    };
7288
    return rescale();
7289
  }
7290
  d3.scale.threshold = function() {
7291
    return d3_scale_threshold([ .5 ], [ 0, 1 ]);
7292
  };
7293
  function d3_scale_threshold(domain, range) {
7294
    function scale(x) {
7295
      if (x <= x) return range[d3.bisect(domain, x)];
7296
    }
7297
    scale.domain = function(_) {
7298
      if (!arguments.length) return domain;
7299
      domain = _;
7300
      return scale;
7301
    };
7302
    scale.range = function(_) {
7303
      if (!arguments.length) return range;
7304
      range = _;
7305
      return scale;
7306
    };
7307
    scale.invertExtent = function(y) {
7308
      y = range.indexOf(y);
7309
      return [ domain[y - 1], domain[y] ];
7310
    };
7311
    scale.copy = function() {
7312
      return d3_scale_threshold(domain, range);
7313
    };
7314
    return scale;
7315
  }
7316
  d3.scale.identity = function() {
7317
    return d3_scale_identity([ 0, 1 ]);
7318
  };
7319
  function d3_scale_identity(domain) {
7320
    function identity(x) {
7321
      return +x;
7322
    }
7323
    identity.invert = identity;
7324
    identity.domain = identity.range = function(x) {
7325
      if (!arguments.length) return domain;
7326
      domain = x.map(identity);
7327
      return identity;
7328
    };
7329
    identity.ticks = function(m) {
7330
      return d3_scale_linearTicks(domain, m);
7331
    };
7332
    identity.tickFormat = function(m, format) {
7333
      return d3_scale_linearTickFormat(domain, m, format);
7334
    };
7335
    identity.copy = function() {
7336
      return d3_scale_identity(domain);
7337
    };
7338
    return identity;
7339
  }
7340
  d3.svg = {};
7341
  d3.svg.arc = function() {
7342
    var innerRadius = d3_svg_arcInnerRadius, outerRadius = d3_svg_arcOuterRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
7343
    function arc() {
7344
      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, 
7345
      a0 = a1, a1 = da), a1 - a0), df = da < π ? "0" : "1", c0 = Math.cos(a0), s0 = Math.sin(a0), c1 = Math.cos(a1), s1 = Math.sin(a1);
7346
      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";
7347
    }
7348
    arc.innerRadius = function(v) {
7349
      if (!arguments.length) return innerRadius;
7350
      innerRadius = d3_functor(v);
7351
      return arc;
7352
    };
7353
    arc.outerRadius = function(v) {
7354
      if (!arguments.length) return outerRadius;
7355
      outerRadius = d3_functor(v);
7356
      return arc;
7357
    };
7358
    arc.startAngle = function(v) {
7359
      if (!arguments.length) return startAngle;
7360
      startAngle = d3_functor(v);
7361
      return arc;
7362
    };
7363
    arc.endAngle = function(v) {
7364
      if (!arguments.length) return endAngle;
7365
      endAngle = d3_functor(v);
7366
      return arc;
7367
    };
7368
    arc.centroid = function() {
7369
      var r = (innerRadius.apply(this, arguments) + outerRadius.apply(this, arguments)) / 2, a = (startAngle.apply(this, arguments) + endAngle.apply(this, arguments)) / 2 + d3_svg_arcOffset;
7370
      return [ Math.cos(a) * r, Math.sin(a) * r ];
7371
    };
7372
    return arc;
7373
  };
7374
  var d3_svg_arcOffset = -halfπ, d3_svg_arcMax = τ - ε;
7375
  function d3_svg_arcInnerRadius(d) {
7376
    return d.innerRadius;
7377
  }
7378
  function d3_svg_arcOuterRadius(d) {
7379
    return d.outerRadius;
7380
  }
7381
  function d3_svg_arcStartAngle(d) {
7382
    return d.startAngle;
7383
  }
7384
  function d3_svg_arcEndAngle(d) {
7385
    return d.endAngle;
7386
  }
7387
  function d3_svg_line(projection) {
7388
    var x = d3_geom_pointX, y = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, tension = .7;
7389
    function line(data) {
7390
      var segments = [], points = [], i = -1, n = data.length, d, fx = d3_functor(x), fy = d3_functor(y);
7391
      function segment() {
7392
        segments.push("M", interpolate(projection(points), tension));
7393
      }
7394
      while (++i < n) {
7395
        if (defined.call(this, d = data[i], i)) {
7396
          points.push([ +fx.call(this, d, i), +fy.call(this, d, i) ]);
7397
        } else if (points.length) {
7398
          segment();
7399
          points = [];
7400
        }
7401
      }
7402
      if (points.length) segment();
7403
      return segments.length ? segments.join("") : null;
7404
    }
7405
    line.x = function(_) {
7406
      if (!arguments.length) return x;
7407
      x = _;
7408
      return line;
7409
    };
7410
    line.y = function(_) {
7411
      if (!arguments.length) return y;
7412
      y = _;
7413
      return line;
7414
    };
7415
    line.defined = function(_) {
7416
      if (!arguments.length) return defined;
7417
      defined = _;
7418
      return line;
7419
    };
7420
    line.interpolate = function(_) {
7421
      if (!arguments.length) return interpolateKey;
7422
      if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
7423
      return line;
7424
    };
7425
    line.tension = function(_) {
7426
      if (!arguments.length) return tension;
7427
      tension = _;
7428
      return line;
7429
    };
7430
    return line;
7431
  }
7432
  d3.svg.line = function() {
7433
    return d3_svg_line(d3_identity);
7434
  };
7435
  var d3_svg_lineInterpolators = d3.map({
7436
    linear: d3_svg_lineLinear,
7437
    "linear-closed": d3_svg_lineLinearClosed,
7438
    step: d3_svg_lineStep,
7439
    "step-before": d3_svg_lineStepBefore,
7440
    "step-after": d3_svg_lineStepAfter,
7441
    basis: d3_svg_lineBasis,
7442
    "basis-open": d3_svg_lineBasisOpen,
7443
    "basis-closed": d3_svg_lineBasisClosed,
7444
    bundle: d3_svg_lineBundle,
7445
    cardinal: d3_svg_lineCardinal,
7446
    "cardinal-open": d3_svg_lineCardinalOpen,
7447
    "cardinal-closed": d3_svg_lineCardinalClosed,
7448
    monotone: d3_svg_lineMonotone
7449
  });
7450
  d3_svg_lineInterpolators.forEach(function(key, value) {
7451
    value.key = key;
7452
    value.closed = /-closed$/.test(key);
7453
  });
7454
  function d3_svg_lineLinear(points) {
7455
    return points.join("L");
7456
  }
7457
  function d3_svg_lineLinearClosed(points) {
7458
    return d3_svg_lineLinear(points) + "Z";
7459
  }
7460
  function d3_svg_lineStep(points) {
7461
    var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7462
    while (++i < n) path.push("H", (p[0] + (p = points[i])[0]) / 2, "V", p[1]);
7463
    if (n > 1) path.push("H", p[0]);
7464
    return path.join("");
7465
  }
7466
  function d3_svg_lineStepBefore(points) {
7467
    var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7468
    while (++i < n) path.push("V", (p = points[i])[1], "H", p[0]);
7469
    return path.join("");
7470
  }
7471
  function d3_svg_lineStepAfter(points) {
7472
    var i = 0, n = points.length, p = points[0], path = [ p[0], ",", p[1] ];
7473
    while (++i < n) path.push("H", (p = points[i])[0], "V", p[1]);
7474
    return path.join("");
7475
  }
7476
  function d3_svg_lineCardinalOpen(points, tension) {
7477
    return points.length < 4 ? d3_svg_lineLinear(points) : points[1] + d3_svg_lineHermite(points.slice(1, points.length - 1), d3_svg_lineCardinalTangents(points, tension));
7478
  }
7479
  function d3_svg_lineCardinalClosed(points, tension) {
7480
    return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite((points.push(points[0]), 
7481
    points), d3_svg_lineCardinalTangents([ points[points.length - 2] ].concat(points, [ points[1] ]), tension));
7482
  }
7483
  function d3_svg_lineCardinal(points, tension) {
7484
    return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineCardinalTangents(points, tension));
7485
  }
7486
  function d3_svg_lineHermite(points, tangents) {
7487
    if (tangents.length < 1 || points.length != tangents.length && points.length != tangents.length + 2) {
7488
      return d3_svg_lineLinear(points);
7489
    }
7490
    var quad = points.length != tangents.length, path = "", p0 = points[0], p = points[1], t0 = tangents[0], t = t0, pi = 1;
7491
    if (quad) {
7492
      path += "Q" + (p[0] - t0[0] * 2 / 3) + "," + (p[1] - t0[1] * 2 / 3) + "," + p[0] + "," + p[1];
7493
      p0 = points[1];
7494
      pi = 2;
7495
    }
7496
    if (tangents.length > 1) {
7497
      t = tangents[1];
7498
      p = points[pi];
7499
      pi++;
7500
      path += "C" + (p0[0] + t0[0]) + "," + (p0[1] + t0[1]) + "," + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
7501
      for (var i = 2; i < tangents.length; i++, pi++) {
7502
        p = points[pi];
7503
        t = tangents[i];
7504
        path += "S" + (p[0] - t[0]) + "," + (p[1] - t[1]) + "," + p[0] + "," + p[1];
7505
      }
7506
    }
7507
    if (quad) {
7508
      var lp = points[pi];
7509
      path += "Q" + (p[0] + t[0] * 2 / 3) + "," + (p[1] + t[1] * 2 / 3) + "," + lp[0] + "," + lp[1];
7510
    }
7511
    return path;
7512
  }
7513
  function d3_svg_lineCardinalTangents(points, tension) {
7514
    var tangents = [], a = (1 - tension) / 2, p0, p1 = points[0], p2 = points[1], i = 1, n = points.length;
7515
    while (++i < n) {
7516
      p0 = p1;
7517
      p1 = p2;
7518
      p2 = points[i];
7519
      tangents.push([ a * (p2[0] - p0[0]), a * (p2[1] - p0[1]) ]);
7520
    }
7521
    return tangents;
7522
  }
7523
  function d3_svg_lineBasis(points) {
7524
    if (points.length < 3) return d3_svg_lineLinear(points);
7525
    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, "L", d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
7526
    points.push(points[n - 1]);
7527
    while (++i <= n) {
7528
      pi = points[i];
7529
      px.shift();
7530
      px.push(pi[0]);
7531
      py.shift();
7532
      py.push(pi[1]);
7533
      d3_svg_lineBasisBezier(path, px, py);
7534
    }
7535
    points.pop();
7536
    path.push("L", pi);
7537
    return path.join("");
7538
  }
7539
  function d3_svg_lineBasisOpen(points) {
7540
    if (points.length < 4) return d3_svg_lineLinear(points);
7541
    var path = [], i = -1, n = points.length, pi, px = [ 0 ], py = [ 0 ];
7542
    while (++i < 3) {
7543
      pi = points[i];
7544
      px.push(pi[0]);
7545
      py.push(pi[1]);
7546
    }
7547
    path.push(d3_svg_lineDot4(d3_svg_lineBasisBezier3, px) + "," + d3_svg_lineDot4(d3_svg_lineBasisBezier3, py));
7548
    --i;
7549
    while (++i < n) {
7550
      pi = points[i];
7551
      px.shift();
7552
      px.push(pi[0]);
7553
      py.shift();
7554
      py.push(pi[1]);
7555
      d3_svg_lineBasisBezier(path, px, py);
7556
    }
7557
    return path.join("");
7558
  }
7559
  function d3_svg_lineBasisClosed(points) {
7560
    var path, i = -1, n = points.length, m = n + 4, pi, px = [], py = [];
7561
    while (++i < 4) {
7562
      pi = points[i % n];
7563
      px.push(pi[0]);
7564
      py.push(pi[1]);
7565
    }
7566
    path = [ d3_svg_lineDot4(d3_svg_lineBasisBezier3, px), ",", d3_svg_lineDot4(d3_svg_lineBasisBezier3, py) ];
7567
    --i;
7568
    while (++i < m) {
7569
      pi = points[i % n];
7570
      px.shift();
7571
      px.push(pi[0]);
7572
      py.shift();
7573
      py.push(pi[1]);
7574
      d3_svg_lineBasisBezier(path, px, py);
7575
    }
7576
    return path.join("");
7577
  }
7578
  function d3_svg_lineBundle(points, tension) {
7579
    var n = points.length - 1;
7580
    if (n) {
7581
      var x0 = points[0][0], y0 = points[0][1], dx = points[n][0] - x0, dy = points[n][1] - y0, i = -1, p, t;
7582
      while (++i <= n) {
7583
        p = points[i];
7584
        t = i / n;
7585
        p[0] = tension * p[0] + (1 - tension) * (x0 + t * dx);
7586
        p[1] = tension * p[1] + (1 - tension) * (y0 + t * dy);
7587
      }
7588
    }
7589
    return d3_svg_lineBasis(points);
7590
  }
7591
  function d3_svg_lineDot4(a, b) {
7592
    return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
7593
  }
7594
  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 ];
7595
  function d3_svg_lineBasisBezier(path, x, y) {
7596
    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));
7597
  }
7598
  function d3_svg_lineSlope(p0, p1) {
7599
    return (p1[1] - p0[1]) / (p1[0] - p0[0]);
7600
  }
7601
  function d3_svg_lineFiniteDifferences(points) {
7602
    var i = 0, j = points.length - 1, m = [], p0 = points[0], p1 = points[1], d = m[0] = d3_svg_lineSlope(p0, p1);
7603
    while (++i < j) {
7604
      m[i] = (d + (d = d3_svg_lineSlope(p0 = p1, p1 = points[i + 1]))) / 2;
7605
    }
7606
    m[i] = d;
7607
    return m;
7608
  }
7609
  function d3_svg_lineMonotoneTangents(points) {
7610
    var tangents = [], d, a, b, s, m = d3_svg_lineFiniteDifferences(points), i = -1, j = points.length - 1;
7611
    while (++i < j) {
7612
      d = d3_svg_lineSlope(points[i], points[i + 1]);
7613
      if (abs(d) < ε) {
7614
        m[i] = m[i + 1] = 0;
7615
      } else {
7616
        a = m[i] / d;
7617
        b = m[i + 1] / d;
7618
        s = a * a + b * b;
7619
        if (s > 9) {
7620
          s = d * 3 / Math.sqrt(s);
7621
          m[i] = s * a;
7622
          m[i + 1] = s * b;
7623
        }
7624
      }
7625
    }
7626
    i = -1;
7627
    while (++i <= j) {
7628
      s = (points[Math.min(j, i + 1)][0] - points[Math.max(0, i - 1)][0]) / (6 * (1 + m[i] * m[i]));
7629
      tangents.push([ s || 0, m[i] * s || 0 ]);
7630
    }
7631
    return tangents;
7632
  }
7633
  function d3_svg_lineMonotone(points) {
7634
    return points.length < 3 ? d3_svg_lineLinear(points) : points[0] + d3_svg_lineHermite(points, d3_svg_lineMonotoneTangents(points));
7635
  }
7636
  d3.svg.line.radial = function() {
7637
    var line = d3_svg_line(d3_svg_lineRadial);
7638
    line.radius = line.x, delete line.x;
7639
    line.angle = line.y, delete line.y;
7640
    return line;
7641
  };
7642
  function d3_svg_lineRadial(points) {
7643
    var point, i = -1, n = points.length, r, a;
7644
    while (++i < n) {
7645
      point = points[i];
7646
      r = point[0];
7647
      a = point[1] + d3_svg_arcOffset;
7648
      point[0] = r * Math.cos(a);
7649
      point[1] = r * Math.sin(a);
7650
    }
7651
    return points;
7652
  }
7653
  function d3_svg_area(projection) {
7654
    var x0 = d3_geom_pointX, x1 = d3_geom_pointX, y0 = 0, y1 = d3_geom_pointY, defined = d3_true, interpolate = d3_svg_lineLinear, interpolateKey = interpolate.key, interpolateReverse = interpolate, L = "L", tension = .7;
7655
    function area(data) {
7656
      var segments = [], points0 = [], points1 = [], i = -1, n = data.length, d, fx0 = d3_functor(x0), fy0 = d3_functor(y0), fx1 = x0 === x1 ? function() {
7657
        return x;
7658
      } : d3_functor(x1), fy1 = y0 === y1 ? function() {
7659
        return y;
7660
      } : d3_functor(y1), x, y;
7661
      function segment() {
7662
        segments.push("M", interpolate(projection(points1), tension), L, interpolateReverse(projection(points0.reverse()), tension), "Z");
7663
      }
7664
      while (++i < n) {
7665
        if (defined.call(this, d = data[i], i)) {
7666
          points0.push([ x = +fx0.call(this, d, i), y = +fy0.call(this, d, i) ]);
7667
          points1.push([ +fx1.call(this, d, i), +fy1.call(this, d, i) ]);
7668
        } else if (points0.length) {
7669
          segment();
7670
          points0 = [];
7671
          points1 = [];
7672
        }
7673
      }
7674
      if (points0.length) segment();
7675
      return segments.length ? segments.join("") : null;
7676
    }
7677
    area.x = function(_) {
7678
      if (!arguments.length) return x1;
7679
      x0 = x1 = _;
7680
      return area;
7681
    };
7682
    area.x0 = function(_) {
7683
      if (!arguments.length) return x0;
7684
      x0 = _;
7685
      return area;
7686
    };
7687
    area.x1 = function(_) {
7688
      if (!arguments.length) return x1;
7689
      x1 = _;
7690
      return area;
7691
    };
7692
    area.y = function(_) {
7693
      if (!arguments.length) return y1;
7694
      y0 = y1 = _;
7695
      return area;
7696
    };
7697
    area.y0 = function(_) {
7698
      if (!arguments.length) return y0;
7699
      y0 = _;
7700
      return area;
7701
    };
7702
    area.y1 = function(_) {
7703
      if (!arguments.length) return y1;
7704
      y1 = _;
7705
      return area;
7706
    };
7707
    area.defined = function(_) {
7708
      if (!arguments.length) return defined;
7709
      defined = _;
7710
      return area;
7711
    };
7712
    area.interpolate = function(_) {
7713
      if (!arguments.length) return interpolateKey;
7714
      if (typeof _ === "function") interpolateKey = interpolate = _; else interpolateKey = (interpolate = d3_svg_lineInterpolators.get(_) || d3_svg_lineLinear).key;
7715
      interpolateReverse = interpolate.reverse || interpolate;
7716
      L = interpolate.closed ? "M" : "L";
7717
      return area;
7718
    };
7719
    area.tension = function(_) {
7720
      if (!arguments.length) return tension;
7721
      tension = _;
7722
      return area;
7723
    };
7724
    return area;
7725
  }
7726
  d3_svg_lineStepBefore.reverse = d3_svg_lineStepAfter;
7727
  d3_svg_lineStepAfter.reverse = d3_svg_lineStepBefore;
7728
  d3.svg.area = function() {
7729
    return d3_svg_area(d3_identity);
7730
  };
7731
  d3.svg.area.radial = function() {
7732
    var area = d3_svg_area(d3_svg_lineRadial);
7733
    area.radius = area.x, delete area.x;
7734
    area.innerRadius = area.x0, delete area.x0;
7735
    area.outerRadius = area.x1, delete area.x1;
7736
    area.angle = area.y, delete area.y;
7737
    area.startAngle = area.y0, delete area.y0;
7738
    area.endAngle = area.y1, delete area.y1;
7739
    return area;
7740
  };
7741
  d3.svg.chord = function() {
7742
    var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
7743
    function chord(d, i) {
7744
      var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
7745
      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";
7746
    }
7747
    function subgroup(self, f, d, i) {
7748
      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;
7749
      return {
7750
        r: r,
7751
        a0: a0,
7752
        a1: a1,
7753
        p0: [ r * Math.cos(a0), r * Math.sin(a0) ],
7754
        p1: [ r * Math.cos(a1), r * Math.sin(a1) ]
7755
      };
7756
    }
7757
    function equals(a, b) {
7758
      return a.a0 == b.a0 && a.a1 == b.a1;
7759
    }
7760
    function arc(r, p, a) {
7761
      return "A" + r + "," + r + " 0 " + +(a > π) + ",1 " + p;
7762
    }
7763
    function curve(r0, p0, r1, p1) {
7764
      return "Q 0,0 " + p1;
7765
    }
7766
    chord.radius = function(v) {
7767
      if (!arguments.length) return radius;
7768
      radius = d3_functor(v);
7769
      return chord;
7770
    };
7771
    chord.source = function(v) {
7772
      if (!arguments.length) return source;
7773
      source = d3_functor(v);
7774
      return chord;
7775
    };
7776
    chord.target = function(v) {
7777
      if (!arguments.length) return target;
7778
      target = d3_functor(v);
7779
      return chord;
7780
    };
7781
    chord.startAngle = function(v) {
7782
      if (!arguments.length) return startAngle;
7783
      startAngle = d3_functor(v);
7784
      return chord;
7785
    };
7786
    chord.endAngle = function(v) {
7787
      if (!arguments.length) return endAngle;
7788
      endAngle = d3_functor(v);
7789
      return chord;
7790
    };
7791
    return chord;
7792
  };
7793
  function d3_svg_chordRadius(d) {
7794
    return d.radius;
7795
  }
7796
  d3.svg.diagonal = function() {
7797
    var source = d3_source, target = d3_target, projection = d3_svg_diagonalProjection;
7798
    function diagonal(d, i) {
7799
      var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
7800
        x: p0.x,
7801
        y: m
7802
      }, {
7803
        x: p3.x,
7804
        y: m
7805
      }, p3 ];
7806
      p = p.map(projection);
7807
      return "M" + p[0] + "C" + p[1] + " " + p[2] + " " + p[3];
7808
    }
7809
    diagonal.source = function(x) {
7810
      if (!arguments.length) return source;
7811
      source = d3_functor(x);
7812
      return diagonal;
7813
    };
7814
    diagonal.target = function(x) {
7815
      if (!arguments.length) return target;
7816
      target = d3_functor(x);
7817
      return diagonal;
7818
    };
7819
    diagonal.projection = function(x) {
7820
      if (!arguments.length) return projection;
7821
      projection = x;
7822
      return diagonal;
7823
    };
7824
    return diagonal;
7825
  };
7826
  function d3_svg_diagonalProjection(d) {
7827
    return [ d.x, d.y ];
7828
  }
7829
  d3.svg.diagonal.radial = function() {
7830
    var diagonal = d3.svg.diagonal(), projection = d3_svg_diagonalProjection, projection_ = diagonal.projection;
7831
    diagonal.projection = function(x) {
7832
      return arguments.length ? projection_(d3_svg_diagonalRadialProjection(projection = x)) : projection;
7833
    };
7834
    return diagonal;
7835
  };
7836
  function d3_svg_diagonalRadialProjection(projection) {
7837
    return function() {
7838
      var d = projection.apply(this, arguments), r = d[0], a = d[1] + d3_svg_arcOffset;
7839
      return [ r * Math.cos(a), r * Math.sin(a) ];
7840
    };
7841
  }
7842
  d3.svg.symbol = function() {
7843
    var type = d3_svg_symbolType, size = d3_svg_symbolSize;
7844
    function symbol(d, i) {
7845
      return (d3_svg_symbols.get(type.call(this, d, i)) || d3_svg_symbolCircle)(size.call(this, d, i));
7846
    }
7847
    symbol.type = function(x) {
7848
      if (!arguments.length) return type;
7849
      type = d3_functor(x);
7850
      return symbol;
7851
    };
7852
    symbol.size = function(x) {
7853
      if (!arguments.length) return size;
7854
      size = d3_functor(x);
7855
      return symbol;
7856
    };
7857
    return symbol;
7858
  };
7859
  function d3_svg_symbolSize() {
7860
    return 64;
7861
  }
7862
  function d3_svg_symbolType() {
7863
    return "circle";
7864
  }
7865
  function d3_svg_symbolCircle(size) {
7866
    var r = Math.sqrt(size / π);
7867
    return "M0," + r + "A" + r + "," + r + " 0 1,1 0," + -r + "A" + r + "," + r + " 0 1,1 0," + r + "Z";
7868
  }
7869
  var d3_svg_symbols = d3.map({
7870
    circle: d3_svg_symbolCircle,
7871
    cross: function(size) {
7872
      var r = Math.sqrt(size / 5) / 2;
7873
      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";
7874
    },
7875
    diamond: function(size) {
7876
      var ry = Math.sqrt(size / (2 * d3_svg_symbolTan30)), rx = ry * d3_svg_symbolTan30;
7877
      return "M0," + -ry + "L" + rx + ",0" + " 0," + ry + " " + -rx + ",0" + "Z";
7878
    },
7879
    square: function(size) {
7880
      var r = Math.sqrt(size) / 2;
7881
      return "M" + -r + "," + -r + "L" + r + "," + -r + " " + r + "," + r + " " + -r + "," + r + "Z";
7882
    },
7883
    "triangle-down": function(size) {
7884
      var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
7885
      return "M0," + ry + "L" + rx + "," + -ry + " " + -rx + "," + -ry + "Z";
7886
    },
7887
    "triangle-up": function(size) {
7888
      var rx = Math.sqrt(size / d3_svg_symbolSqrt3), ry = rx * d3_svg_symbolSqrt3 / 2;
7889
      return "M0," + -ry + "L" + rx + "," + ry + " " + -rx + "," + ry + "Z";
7890
    }
7891
  });
7892
  d3.svg.symbolTypes = d3_svg_symbols.keys();
7893
  var d3_svg_symbolSqrt3 = Math.sqrt(3), d3_svg_symbolTan30 = Math.tan(30 * d3_radians);
7894
  function d3_transition(groups, id) {
7895
    d3_subclass(groups, d3_transitionPrototype);
7896
    groups.id = id;
7897
    return groups;
7898
  }
7899
  var d3_transitionPrototype = [], d3_transitionId = 0, d3_transitionInheritId, d3_transitionInherit;
7900
  d3_transitionPrototype.call = d3_selectionPrototype.call;
7901
  d3_transitionPrototype.empty = d3_selectionPrototype.empty;
7902
  d3_transitionPrototype.node = d3_selectionPrototype.node;
7903
  d3_transitionPrototype.size = d3_selectionPrototype.size;
7904
  d3.transition = function(selection) {
7905
    return arguments.length ? d3_transitionInheritId ? selection.transition() : selection : d3_selectionRoot.transition();
7906
  };
7907
  d3.transition.prototype = d3_transitionPrototype;
7908
  d3_transitionPrototype.select = function(selector) {
7909
    var id = this.id, subgroups = [], subgroup, subnode, node;
7910
    selector = d3_selection_selector(selector);
7911
    for (var j = -1, m = this.length; ++j < m; ) {
7912
      subgroups.push(subgroup = []);
7913
      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
7914
        if ((node = group[i]) && (subnode = selector.call(node, node.__data__, i, j))) {
7915
          if ("__data__" in node) subnode.__data__ = node.__data__;
7916
          d3_transitionNode(subnode, i, id, node.__transition__[id]);
7917
          subgroup.push(subnode);
7918
        } else {
7919
          subgroup.push(null);
7920
        }
7921
      }
7922
    }
7923
    return d3_transition(subgroups, id);
7924
  };
7925
  d3_transitionPrototype.selectAll = function(selector) {
7926
    var id = this.id, subgroups = [], subgroup, subnodes, node, subnode, transition;
7927
    selector = d3_selection_selectorAll(selector);
7928
    for (var j = -1, m = this.length; ++j < m; ) {
7929
      for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
7930
        if (node = group[i]) {
7931
          transition = node.__transition__[id];
7932
          subnodes = selector.call(node, node.__data__, i, j);
7933
          subgroups.push(subgroup = []);
7934
          for (var k = -1, o = subnodes.length; ++k < o; ) {
7935
            if (subnode = subnodes[k]) d3_transitionNode(subnode, k, id, transition);
7936
            subgroup.push(subnode);
7937
          }
7938
        }
7939
      }
7940
    }
7941
    return d3_transition(subgroups, id);
7942
  };
7943
  d3_transitionPrototype.filter = function(filter) {
7944
    var subgroups = [], subgroup, group, node;
7945
    if (typeof filter !== "function") filter = d3_selection_filter(filter);
7946
    for (var j = 0, m = this.length; j < m; j++) {
7947
      subgroups.push(subgroup = []);
7948
      for (var group = this[j], i = 0, n = group.length; i < n; i++) {
7949
        if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
7950
          subgroup.push(node);
7951
        }
7952
      }
7953
    }
7954
    return d3_transition(subgroups, this.id);
7955
  };
7956
  d3_transitionPrototype.tween = function(name, tween) {
7957
    var id = this.id;
7958
    if (arguments.length < 2) return this.node().__transition__[id].tween.get(name);
7959
    return d3_selection_each(this, tween == null ? function(node) {
7960
      node.__transition__[id].tween.remove(name);
7961
    } : function(node) {
7962
      node.__transition__[id].tween.set(name, tween);
7963
    });
7964
  };
7965
  function d3_transition_tween(groups, name, value, tween) {
7966
    var id = groups.id;
7967
    return d3_selection_each(groups, typeof value === "function" ? function(node, i, j) {
7968
      node.__transition__[id].tween.set(name, tween(value.call(node, node.__data__, i, j)));
7969
    } : (value = tween(value), function(node) {
7970
      node.__transition__[id].tween.set(name, value);
7971
    }));
7972
  }
7973
  d3_transitionPrototype.attr = function(nameNS, value) {
7974
    if (arguments.length < 2) {
7975
      for (value in nameNS) this.attr(value, nameNS[value]);
7976
      return this;
7977
    }
7978
    var interpolate = nameNS == "transform" ? d3_interpolateTransform : d3_interpolate, name = d3.ns.qualify(nameNS);
7979
    function attrNull() {
7980
      this.removeAttribute(name);
7981
    }
7982
    function attrNullNS() {
7983
      this.removeAttributeNS(name.space, name.local);
7984
    }
7985
    function attrTween(b) {
7986
      return b == null ? attrNull : (b += "", function() {
7987
        var a = this.getAttribute(name), i;
7988
        return a !== b && (i = interpolate(a, b), function(t) {
7989
          this.setAttribute(name, i(t));
7990
        });
7991
      });
7992
    }
7993
    function attrTweenNS(b) {
7994
      return b == null ? attrNullNS : (b += "", function() {
7995
        var a = this.getAttributeNS(name.space, name.local), i;
7996
        return a !== b && (i = interpolate(a, b), function(t) {
7997
          this.setAttributeNS(name.space, name.local, i(t));
7998
        });
7999
      });
8000
    }
8001
    return d3_transition_tween(this, "attr." + nameNS, value, name.local ? attrTweenNS : attrTween);
8002
  };
8003
  d3_transitionPrototype.attrTween = function(nameNS, tween) {
8004
    var name = d3.ns.qualify(nameNS);
8005
    function attrTween(d, i) {
8006
      var f = tween.call(this, d, i, this.getAttribute(name));
8007
      return f && function(t) {
8008
        this.setAttribute(name, f(t));
8009
      };
8010
    }
8011
    function attrTweenNS(d, i) {
8012
      var f = tween.call(this, d, i, this.getAttributeNS(name.space, name.local));
8013
      return f && function(t) {
8014
        this.setAttributeNS(name.space, name.local, f(t));
8015
      };
8016
    }
8017
    return this.tween("attr." + nameNS, name.local ? attrTweenNS : attrTween);
8018
  };
8019
  d3_transitionPrototype.style = function(name, value, priority) {
8020
    var n = arguments.length;
8021
    if (n < 3) {
8022
      if (typeof name !== "string") {
8023
        if (n < 2) value = "";
8024
        for (priority in name) this.style(priority, name[priority], value);
8025
        return this;
8026
      }
8027
      priority = "";
8028
    }
8029
    function styleNull() {
8030
      this.style.removeProperty(name);
8031
    }
8032
    function styleString(b) {
8033
      return b == null ? styleNull : (b += "", function() {
8034
        var a = d3_window.getComputedStyle(this, null).getPropertyValue(name), i;
8035
        return a !== b && (i = d3_interpolate(a, b), function(t) {
8036
          this.style.setProperty(name, i(t), priority);
8037
        });
8038
      });
8039
    }
8040
    return d3_transition_tween(this, "style." + name, value, styleString);
8041
  };
8042
  d3_transitionPrototype.styleTween = function(name, tween, priority) {
8043
    if (arguments.length < 3) priority = "";
8044
    function styleTween(d, i) {
8045
      var f = tween.call(this, d, i, d3_window.getComputedStyle(this, null).getPropertyValue(name));
8046
      return f && function(t) {
8047
        this.style.setProperty(name, f(t), priority);
8048
      };
8049
    }
8050
    return this.tween("style." + name, styleTween);
8051
  };
8052
  d3_transitionPrototype.text = function(value) {
8053
    return d3_transition_tween(this, "text", value, d3_transition_text);
8054
  };
8055
  function d3_transition_text(b) {
8056
    if (b == null) b = "";
8057
    return function() {
8058
      this.textContent = b;
8059
    };
8060
  }
8061
  d3_transitionPrototype.remove = function() {
8062
    return this.each("end.transition", function() {
8063
      var p;
8064
      if (this.__transition__.count < 2 && (p = this.parentNode)) p.removeChild(this);
8065
    });
8066
  };
8067
  d3_transitionPrototype.ease = function(value) {
8068
    var id = this.id;
8069
    if (arguments.length < 1) return this.node().__transition__[id].ease;
8070
    if (typeof value !== "function") value = d3.ease.apply(d3, arguments);
8071
    return d3_selection_each(this, function(node) {
8072
      node.__transition__[id].ease = value;
8073
    });
8074
  };
8075
  d3_transitionPrototype.delay = function(value) {
8076
    var id = this.id;
8077
    return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
8078
      node.__transition__[id].delay = +value.call(node, node.__data__, i, j);
8079
    } : (value = +value, function(node) {
8080
      node.__transition__[id].delay = value;
8081
    }));
8082
  };
8083
  d3_transitionPrototype.duration = function(value) {
8084
    var id = this.id;
8085
    return d3_selection_each(this, typeof value === "function" ? function(node, i, j) {
8086
      node.__transition__[id].duration = Math.max(1, value.call(node, node.__data__, i, j));
8087
    } : (value = Math.max(1, value), function(node) {
8088
      node.__transition__[id].duration = value;
8089
    }));
8090
  };
8091
  d3_transitionPrototype.each = function(type, listener) {
8092
    var id = this.id;
8093
    if (arguments.length < 2) {
8094
      var inherit = d3_transitionInherit, inheritId = d3_transitionInheritId;
8095
      d3_transitionInheritId = id;
8096
      d3_selection_each(this, function(node, i, j) {
8097
        d3_transitionInherit = node.__transition__[id];
8098
        type.call(node, node.__data__, i, j);
8099
      });
8100
      d3_transitionInherit = inherit;
8101
      d3_transitionInheritId = inheritId;
8102
    } else {
8103
      d3_selection_each(this, function(node) {
8104
        var transition = node.__transition__[id];
8105
        (transition.event || (transition.event = d3.dispatch("start", "end"))).on(type, listener);
8106
      });
8107
    }
8108
    return this;
8109
  };
8110
  d3_transitionPrototype.transition = function() {
8111
    var id0 = this.id, id1 = ++d3_transitionId, subgroups = [], subgroup, group, node, transition;
8112
    for (var j = 0, m = this.length; j < m; j++) {
8113
      subgroups.push(subgroup = []);
8114
      for (var group = this[j], i = 0, n = group.length; i < n; i++) {
8115
        if (node = group[i]) {
8116
          transition = Object.create(node.__transition__[id0]);
8117
          transition.delay += transition.duration;
8118
          d3_transitionNode(node, i, id1, transition);
8119
        }
8120
        subgroup.push(node);
8121
      }
8122
    }
8123
    return d3_transition(subgroups, id1);
8124
  };
8125
  function d3_transitionNode(node, i, id, inherit) {
8126
    var lock = node.__transition__ || (node.__transition__ = {
8127
      active: 0,
8128
      count: 0
8129
    }), transition = lock[id];
8130
    if (!transition) {
8131
      var time = inherit.time;
8132
      transition = lock[id] = {
8133
        tween: new d3_Map(),
8134
        time: time,
8135
        ease: inherit.ease,
8136
        delay: inherit.delay,
8137
        duration: inherit.duration
8138
      };
8139
      ++lock.count;
8140
      d3.timer(function(elapsed) {
8141
        var d = node.__data__, ease = transition.ease, delay = transition.delay, duration = transition.duration, timer = d3_timer_active, tweened = [];
8142
        timer.t = delay + time;
8143
        if (delay <= elapsed) return start(elapsed - delay);
8144
        timer.c = start;
8145
        function start(elapsed) {
8146
          if (lock.active > id) return stop();
8147
          lock.active = id;
8148
          transition.event && transition.event.start.call(node, d, i);
8149
          transition.tween.forEach(function(key, value) {
8150
            if (value = value.call(node, d, i)) {
8151
              tweened.push(value);
8152
            }
8153
          });
8154
          d3.timer(function() {
8155
            timer.c = tick(elapsed || 1) ? d3_true : tick;
8156
            return 1;
8157
          }, 0, time);
8158
        }
8159
        function tick(elapsed) {
8160
          if (lock.active !== id) return stop();
8161
          var t = elapsed / duration, e = ease(t), n = tweened.length;
8162
          while (n > 0) {
8163
            tweened[--n].call(node, e);
8164
          }
8165
          if (t >= 1) {
8166
            transition.event && transition.event.end.call(node, d, i);
8167
            return stop();
8168
          }
8169
        }
8170
        function stop() {
8171
          if (--lock.count) delete lock[id]; else delete node.__transition__;
8172
          return 1;
8173
        }
8174
      }, 0, time);
8175
    }
8176
  }
8177
  d3.svg.axis = function() {
8178
    var scale = d3.scale.linear(), orient = d3_svg_axisDefaultOrient, innerTickSize = 6, outerTickSize = 6, tickPadding = 3, tickArguments_ = [ 10 ], tickValues = null, tickFormat_;
8179
    function axis(g) {
8180
      g.each(function() {
8181
        var g = d3.select(this);
8182
        var scale0 = this.__chart__ || scale, scale1 = this.__chart__ = scale.copy();
8183
        var ticks = tickValues == null ? scale1.ticks ? scale1.ticks.apply(scale1, tickArguments_) : scale1.domain() : tickValues, tickFormat = tickFormat_ == null ? scale1.tickFormat ? scale1.tickFormat.apply(scale1, tickArguments_) : d3_identity : tickFormat_, tick = g.selectAll(".tick").data(ticks, scale1), tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick").style("opacity", ε), tickExit = d3.transition(tick.exit()).style("opacity", ε).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
8184
        var range = d3_scaleRange(scale1), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"), 
8185
        d3.transition(path));
8186
        tickEnter.append("line");
8187
        tickEnter.append("text");
8188
        var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
8189
        switch (orient) {
8190
         case "bottom":
8191
          {
8192
            tickTransform = d3_svg_axisX;
8193
            lineEnter.attr("y2", innerTickSize);
8194
            textEnter.attr("y", Math.max(innerTickSize, 0) + tickPadding);
8195
            lineUpdate.attr("x2", 0).attr("y2", innerTickSize);
8196
            textUpdate.attr("x", 0).attr("y", Math.max(innerTickSize, 0) + tickPadding);
8197
            text.attr("dy", ".71em").style("text-anchor", "middle");
8198
            pathUpdate.attr("d", "M" + range[0] + "," + outerTickSize + "V0H" + range[1] + "V" + outerTickSize);
8199
            break;
8200
          }
8201
8202
         case "top":
8203
          {
8204
            tickTransform = d3_svg_axisX;
8205
            lineEnter.attr("y2", -innerTickSize);
8206
            textEnter.attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
8207
            lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
8208
            textUpdate.attr("x", 0).attr("y", -(Math.max(innerTickSize, 0) + tickPadding));
8209
            text.attr("dy", "0em").style("text-anchor", "middle");
8210
            pathUpdate.attr("d", "M" + range[0] + "," + -outerTickSize + "V0H" + range[1] + "V" + -outerTickSize);
8211
            break;
8212
          }
8213
8214
         case "left":
8215
          {
8216
            tickTransform = d3_svg_axisY;
8217
            lineEnter.attr("x2", -innerTickSize);
8218
            textEnter.attr("x", -(Math.max(innerTickSize, 0) + tickPadding));
8219
            lineUpdate.attr("x2", -innerTickSize).attr("y2", 0);
8220
            textUpdate.attr("x", -(Math.max(innerTickSize, 0) + tickPadding)).attr("y", 0);
8221
            text.attr("dy", ".32em").style("text-anchor", "end");
8222
            pathUpdate.attr("d", "M" + -outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + -outerTickSize);
8223
            break;
8224
          }
8225
8226
         case "right":
8227
          {
8228
            tickTransform = d3_svg_axisY;
8229
            lineEnter.attr("x2", innerTickSize);
8230
            textEnter.attr("x", Math.max(innerTickSize, 0) + tickPadding);
8231
            lineUpdate.attr("x2", innerTickSize).attr("y2", 0);
8232
            textUpdate.attr("x", Math.max(innerTickSize, 0) + tickPadding).attr("y", 0);
8233
            text.attr("dy", ".32em").style("text-anchor", "start");
8234
            pathUpdate.attr("d", "M" + outerTickSize + "," + range[0] + "H0V" + range[1] + "H" + outerTickSize);
8235
            break;
8236
          }
8237
        }
8238
        if (scale1.rangeBand) {
8239
          var x = scale1, dx = x.rangeBand() / 2;
8240
          scale0 = scale1 = function(d) {
8241
            return x(d) + dx;
8242
          };
8243
        } else if (scale0.rangeBand) {
8244
          scale0 = scale1;
8245
        } else {
8246
          tickExit.call(tickTransform, scale1);
8247
        }
8248
        tickEnter.call(tickTransform, scale0);
8249
        tickUpdate.call(tickTransform, scale1);
8250
      });
8251
    }
8252
    axis.scale = function(x) {
8253
      if (!arguments.length) return scale;
8254
      scale = x;
8255
      return axis;
8256
    };
8257
    axis.orient = function(x) {
8258
      if (!arguments.length) return orient;
8259
      orient = x in d3_svg_axisOrients ? x + "" : d3_svg_axisDefaultOrient;
8260
      return axis;
8261
    };
8262
    axis.ticks = function() {
8263
      if (!arguments.length) return tickArguments_;
8264
      tickArguments_ = arguments;
8265
      return axis;
8266
    };
8267
    axis.tickValues = function(x) {
8268
      if (!arguments.length) return tickValues;
8269
      tickValues = x;
8270
      return axis;
8271
    };
8272
    axis.tickFormat = function(x) {
8273
      if (!arguments.length) return tickFormat_;
8274
      tickFormat_ = x;
8275
      return axis;
8276
    };
8277
    axis.tickSize = function(x) {
8278
      var n = arguments.length;
8279
      if (!n) return innerTickSize;
8280
      innerTickSize = +x;
8281
      outerTickSize = +arguments[n - 1];
8282
      return axis;
8283
    };
8284
    axis.innerTickSize = function(x) {
8285
      if (!arguments.length) return innerTickSize;
8286
      innerTickSize = +x;
8287
      return axis;
8288
    };
8289
    axis.outerTickSize = function(x) {
8290
      if (!arguments.length) return outerTickSize;
8291
      outerTickSize = +x;
8292
      return axis;
8293
    };
8294
    axis.tickPadding = function(x) {
8295
      if (!arguments.length) return tickPadding;
8296
      tickPadding = +x;
8297
      return axis;
8298
    };
8299
    axis.tickSubdivide = function() {
8300
      return arguments.length && axis;
8301
    };
8302
    return axis;
8303
  };
8304
  var d3_svg_axisDefaultOrient = "bottom", d3_svg_axisOrients = {
8305
    top: 1,
8306
    right: 1,
8307
    bottom: 1,
8308
    left: 1
8309
  };
8310
  function d3_svg_axisX(selection, x) {
8311
    selection.attr("transform", function(d) {
8312
      return "translate(" + x(d) + ",0)";
8313
    });
8314
  }
8315
  function d3_svg_axisY(selection, y) {
8316
    selection.attr("transform", function(d) {
8317
      return "translate(0," + y(d) + ")";
8318
    });
8319
  }
8320
  d3.svg.brush = function() {
8321
    var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, xExtent = [ 0, 0 ], yExtent = [ 0, 0 ], xExtentDomain, yExtentDomain, xClamp = true, yClamp = true, resizes = d3_svg_brushResizes[0];
8322
    function brush(g) {
8323
      g.each(function() {
8324
        var g = d3.select(this).style("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
8325
        var background = g.selectAll(".background").data([ 0 ]);
8326
        background.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
8327
        g.selectAll(".extent").data([ 0 ]).enter().append("rect").attr("class", "extent").style("cursor", "move");
8328
        var resize = g.selectAll(".resize").data(resizes, d3_identity);
8329
        resize.exit().remove();
8330
        resize.enter().append("g").attr("class", function(d) {
8331
          return "resize " + d;
8332
        }).style("cursor", function(d) {
8333
          return d3_svg_brushCursor[d];
8334
        }).append("rect").attr("x", function(d) {
8335
          return /[ew]$/.test(d) ? -3 : null;
8336
        }).attr("y", function(d) {
8337
          return /^[ns]/.test(d) ? -3 : null;
8338
        }).attr("width", 6).attr("height", 6).style("visibility", "hidden");
8339
        resize.style("display", brush.empty() ? "none" : null);
8340
        var gUpdate = d3.transition(g), backgroundUpdate = d3.transition(background), range;
8341
        if (x) {
8342
          range = d3_scaleRange(x);
8343
          backgroundUpdate.attr("x", range[0]).attr("width", range[1] - range[0]);
8344
          redrawX(gUpdate);
8345
        }
8346
        if (y) {
8347
          range = d3_scaleRange(y);
8348
          backgroundUpdate.attr("y", range[0]).attr("height", range[1] - range[0]);
8349
          redrawY(gUpdate);
8350
        }
8351
        redraw(gUpdate);
8352
      });
8353
    }
8354
    brush.event = function(g) {
8355
      g.each(function() {
8356
        var event_ = event.of(this, arguments), extent1 = {
8357
          x: xExtent,
8358
          y: yExtent,
8359
          i: xExtentDomain,
8360
          j: yExtentDomain
8361
        }, extent0 = this.__chart__ || extent1;
8362
        this.__chart__ = extent1;
8363
        if (d3_transitionInheritId) {
8364
          d3.select(this).transition().each("start.brush", function() {
8365
            xExtentDomain = extent0.i;
8366
            yExtentDomain = extent0.j;
8367
            xExtent = extent0.x;
8368
            yExtent = extent0.y;
8369
            event_({
8370
              type: "brushstart"
8371
            });
8372
          }).tween("brush:brush", function() {
8373
            var xi = d3_interpolateArray(xExtent, extent1.x), yi = d3_interpolateArray(yExtent, extent1.y);
8374
            xExtentDomain = yExtentDomain = null;
8375
            return function(t) {
8376
              xExtent = extent1.x = xi(t);
8377
              yExtent = extent1.y = yi(t);
8378
              event_({
8379
                type: "brush",
8380
                mode: "resize"
8381
              });
8382
            };
8383
          }).each("end.brush", function() {
8384
            xExtentDomain = extent1.i;
8385
            yExtentDomain = extent1.j;
8386
            event_({
8387
              type: "brush",
8388
              mode: "resize"
8389
            });
8390
            event_({
8391
              type: "brushend"
8392
            });
8393
          });
8394
        } else {
8395
          event_({
8396
            type: "brushstart"
8397
          });
8398
          event_({
8399
            type: "brush",
8400
            mode: "resize"
8401
          });
8402
          event_({
8403
            type: "brushend"
8404
          });
8405
        }
8406
      });
8407
    };
8408
    function redraw(g) {
8409
      g.selectAll(".resize").attr("transform", function(d) {
8410
        return "translate(" + xExtent[+/e$/.test(d)] + "," + yExtent[+/^s/.test(d)] + ")";
8411
      });
8412
    }
8413
    function redrawX(g) {
8414
      g.select(".extent").attr("x", xExtent[0]);
8415
      g.selectAll(".extent,.n>rect,.s>rect").attr("width", xExtent[1] - xExtent[0]);
8416
    }
8417
    function redrawY(g) {
8418
      g.select(".extent").attr("y", yExtent[0]);
8419
      g.selectAll(".extent,.e>rect,.w>rect").attr("height", yExtent[1] - yExtent[0]);
8420
    }
8421
    function brushstart() {
8422
      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"), dragRestore = d3_event_dragSuppress(), center, origin = d3.mouse(target), offset;
8423
      var w = d3.select(d3_window).on("keydown.brush", keydown).on("keyup.brush", keyup);
8424
      if (d3.event.changedTouches) {
8425
        w.on("touchmove.brush", brushmove).on("touchend.brush", brushend);
8426
      } else {
8427
        w.on("mousemove.brush", brushmove).on("mouseup.brush", brushend);
8428
      }
8429
      g.interrupt().selectAll("*").interrupt();
8430
      if (dragging) {
8431
        origin[0] = xExtent[0] - origin[0];
8432
        origin[1] = yExtent[0] - origin[1];
8433
      } else if (resizing) {
8434
        var ex = +/w$/.test(resizing), ey = +/^n/.test(resizing);
8435
        offset = [ xExtent[1 - ex] - origin[0], yExtent[1 - ey] - origin[1] ];
8436
        origin[0] = xExtent[ex];
8437
        origin[1] = yExtent[ey];
8438
      } else if (d3.event.altKey) center = origin.slice();
8439
      g.style("pointer-events", "none").selectAll(".resize").style("display", null);
8440
      d3.select("body").style("cursor", eventTarget.style("cursor"));
8441
      event_({
8442
        type: "brushstart"
8443
      });
8444
      brushmove();
8445
      function keydown() {
8446
        if (d3.event.keyCode == 32) {
8447
          if (!dragging) {
8448
            center = null;
8449
            origin[0] -= xExtent[1];
8450
            origin[1] -= yExtent[1];
8451
            dragging = 2;
8452
          }
8453
          d3_eventPreventDefault();
8454
        }
8455
      }
8456
      function keyup() {
8457
        if (d3.event.keyCode == 32 && dragging == 2) {
8458
          origin[0] += xExtent[1];
8459
          origin[1] += yExtent[1];
8460
          dragging = 0;
8461
          d3_eventPreventDefault();
8462
        }
8463
      }
8464
      function brushmove() {
8465
        var point = d3.mouse(target), moved = false;
8466
        if (offset) {
8467
          point[0] += offset[0];
8468
          point[1] += offset[1];
8469
        }
8470
        if (!dragging) {
8471
          if (d3.event.altKey) {
8472
            if (!center) center = [ (xExtent[0] + xExtent[1]) / 2, (yExtent[0] + yExtent[1]) / 2 ];
8473
            origin[0] = xExtent[+(point[0] < center[0])];
8474
            origin[1] = yExtent[+(point[1] < center[1])];
8475
          } else center = null;
8476
        }
8477
        if (resizingX && move1(point, x, 0)) {
8478
          redrawX(g);
8479
          moved = true;
8480
        }
8481
        if (resizingY && move1(point, y, 1)) {
8482
          redrawY(g);
8483
          moved = true;
8484
        }
8485
        if (moved) {
8486
          redraw(g);
8487
          event_({
8488
            type: "brush",
8489
            mode: dragging ? "move" : "resize"
8490
          });
8491
        }
8492
      }
8493
      function move1(point, scale, i) {
8494
        var range = d3_scaleRange(scale), r0 = range[0], r1 = range[1], position = origin[i], extent = i ? yExtent : xExtent, size = extent[1] - extent[0], min, max;
8495
        if (dragging) {
8496
          r0 -= position;
8497
          r1 -= size + position;
8498
        }
8499
        min = (i ? yClamp : xClamp) ? Math.max(r0, Math.min(r1, point[i])) : point[i];
8500
        if (dragging) {
8501
          max = (min += position) + size;
8502
        } else {
8503
          if (center) position = Math.max(r0, Math.min(r1, 2 * center[i] - min));
8504
          if (position < min) {
8505
            max = min;
8506
            min = position;
8507
          } else {
8508
            max = position;
8509
          }
8510
        }
8511
        if (extent[0] != min || extent[1] != max) {
8512
          if (i) yExtentDomain = null; else xExtentDomain = null;
8513
          extent[0] = min;
8514
          extent[1] = max;
8515
          return true;
8516
        }
8517
      }
8518
      function brushend() {
8519
        brushmove();
8520
        g.style("pointer-events", "all").selectAll(".resize").style("display", brush.empty() ? "none" : null);
8521
        d3.select("body").style("cursor", null);
8522
        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);
8523
        dragRestore();
8524
        event_({
8525
          type: "brushend"
8526
        });
8527
      }
8528
    }
8529
    brush.x = function(z) {
8530
      if (!arguments.length) return x;
8531
      x = z;
8532
      resizes = d3_svg_brushResizes[!x << 1 | !y];
8533
      return brush;
8534
    };
8535
    brush.y = function(z) {
8536
      if (!arguments.length) return y;
8537
      y = z;
8538
      resizes = d3_svg_brushResizes[!x << 1 | !y];
8539
      return brush;
8540
    };
8541
    brush.clamp = function(z) {
8542
      if (!arguments.length) return x && y ? [ xClamp, yClamp ] : x ? xClamp : y ? yClamp : null;
8543
      if (x && y) xClamp = !!z[0], yClamp = !!z[1]; else if (x) xClamp = !!z; else if (y) yClamp = !!z;
8544
      return brush;
8545
    };
8546
    brush.extent = function(z) {
8547
      var x0, x1, y0, y1, t;
8548
      if (!arguments.length) {
8549
        if (x) {
8550
          if (xExtentDomain) {
8551
            x0 = xExtentDomain[0], x1 = xExtentDomain[1];
8552
          } else {
8553
            x0 = xExtent[0], x1 = xExtent[1];
8554
            if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
8555
            if (x1 < x0) t = x0, x0 = x1, x1 = t;
8556
          }
8557
        }
8558
        if (y) {
8559
          if (yExtentDomain) {
8560
            y0 = yExtentDomain[0], y1 = yExtentDomain[1];
8561
          } else {
8562
            y0 = yExtent[0], y1 = yExtent[1];
8563
            if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
8564
            if (y1 < y0) t = y0, y0 = y1, y1 = t;
8565
          }
8566
        }
8567
        return x && y ? [ [ x0, y0 ], [ x1, y1 ] ] : x ? [ x0, x1 ] : y && [ y0, y1 ];
8568
      }
8569
      if (x) {
8570
        x0 = z[0], x1 = z[1];
8571
        if (y) x0 = x0[0], x1 = x1[0];
8572
        xExtentDomain = [ x0, x1 ];
8573
        if (x.invert) x0 = x(x0), x1 = x(x1);
8574
        if (x1 < x0) t = x0, x0 = x1, x1 = t;
8575
        if (x0 != xExtent[0] || x1 != xExtent[1]) xExtent = [ x0, x1 ];
8576
      }
8577
      if (y) {
8578
        y0 = z[0], y1 = z[1];
8579
        if (x) y0 = y0[1], y1 = y1[1];
8580
        yExtentDomain = [ y0, y1 ];
8581
        if (y.invert) y0 = y(y0), y1 = y(y1);
8582
        if (y1 < y0) t = y0, y0 = y1, y1 = t;
8583
        if (y0 != yExtent[0] || y1 != yExtent[1]) yExtent = [ y0, y1 ];
8584
      }
8585
      return brush;
8586
    };
8587
    brush.clear = function() {
8588
      if (!brush.empty()) {
8589
        xExtent = [ 0, 0 ], yExtent = [ 0, 0 ];
8590
        xExtentDomain = yExtentDomain = null;
8591
      }
8592
      return brush;
8593
    };
8594
    brush.empty = function() {
8595
      return !!x && xExtent[0] == xExtent[1] || !!y && yExtent[0] == yExtent[1];
8596
    };
8597
    return d3.rebind(brush, event, "on");
8598
  };
8599
  var d3_svg_brushCursor = {
8600
    n: "ns-resize",
8601
    e: "ew-resize",
8602
    s: "ns-resize",
8603
    w: "ew-resize",
8604
    nw: "nwse-resize",
8605
    ne: "nesw-resize",
8606
    se: "nwse-resize",
8607
    sw: "nesw-resize"
8608
  };
8609
  var d3_svg_brushResizes = [ [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ], [ "e", "w" ], [ "n", "s" ], [] ];
8610
  var d3_time = d3.time = {}, d3_date = Date, d3_time_daySymbols = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
8611
  function d3_date_utc() {
8612
    this._ = new Date(arguments.length > 1 ? Date.UTC.apply(this, arguments) : arguments[0]);
8613
  }
8614
  d3_date_utc.prototype = {
8615
    getDate: function() {
8616
      return this._.getUTCDate();
8617
    },
8618
    getDay: function() {
8619
      return this._.getUTCDay();
8620
    },
8621
    getFullYear: function() {
8622
      return this._.getUTCFullYear();
8623
    },
8624
    getHours: function() {
8625
      return this._.getUTCHours();
8626
    },
8627
    getMilliseconds: function() {
8628
      return this._.getUTCMilliseconds();
8629
    },
8630
    getMinutes: function() {
8631
      return this._.getUTCMinutes();
8632
    },
8633
    getMonth: function() {
8634
      return this._.getUTCMonth();
8635
    },
8636
    getSeconds: function() {
8637
      return this._.getUTCSeconds();
8638
    },
8639
    getTime: function() {
8640
      return this._.getTime();
8641
    },
8642
    getTimezoneOffset: function() {
8643
      return 0;
8644
    },
8645
    valueOf: function() {
8646
      return this._.valueOf();
8647
    },
8648
    setDate: function() {
8649
      d3_time_prototype.setUTCDate.apply(this._, arguments);
8650
    },
8651
    setDay: function() {
8652
      d3_time_prototype.setUTCDay.apply(this._, arguments);
8653
    },
8654
    setFullYear: function() {
8655
      d3_time_prototype.setUTCFullYear.apply(this._, arguments);
8656
    },
8657
    setHours: function() {
8658
      d3_time_prototype.setUTCHours.apply(this._, arguments);
8659
    },
8660
    setMilliseconds: function() {
8661
      d3_time_prototype.setUTCMilliseconds.apply(this._, arguments);
8662
    },
8663
    setMinutes: function() {
8664
      d3_time_prototype.setUTCMinutes.apply(this._, arguments);
8665
    },
8666
    setMonth: function() {
8667
      d3_time_prototype.setUTCMonth.apply(this._, arguments);
8668
    },
8669
    setSeconds: function() {
8670
      d3_time_prototype.setUTCSeconds.apply(this._, arguments);
8671
    },
8672
    setTime: function() {
8673
      d3_time_prototype.setTime.apply(this._, arguments);
8674
    }
8675
  };
8676
  var d3_time_prototype = Date.prototype;
8677
  var d3_time_formatDateTime = "%a %b %e %X %Y", d3_time_formatDate = "%m/%d/%Y", d3_time_formatTime = "%H:%M:%S";
8678
  var d3_time_days = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], d3_time_dayAbbreviations = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], d3_time_months = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ], d3_time_monthAbbreviations = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];
8679
  function d3_time_interval(local, step, number) {
8680
    function round(date) {
8681
      var d0 = local(date), d1 = offset(d0, 1);
8682
      return date - d0 < d1 - date ? d0 : d1;
8683
    }
8684
    function ceil(date) {
8685
      step(date = local(new d3_date(date - 1)), 1);
8686
      return date;
8687
    }
8688
    function offset(date, k) {
8689
      step(date = new d3_date(+date), k);
8690
      return date;
8691
    }
8692
    function range(t0, t1, dt) {
8693
      var time = ceil(t0), times = [];
8694
      if (dt > 1) {
8695
        while (time < t1) {
8696
          if (!(number(time) % dt)) times.push(new Date(+time));
8697
          step(time, 1);
8698
        }
8699
      } else {
8700
        while (time < t1) times.push(new Date(+time)), step(time, 1);
8701
      }
8702
      return times;
8703
    }
8704
    function range_utc(t0, t1, dt) {
8705
      try {
8706
        d3_date = d3_date_utc;
8707
        var utc = new d3_date_utc();
8708
        utc._ = t0;
8709
        return range(utc, t1, dt);
8710
      } finally {
8711
        d3_date = Date;
8712
      }
8713
    }
8714
    local.floor = local;
8715
    local.round = round;
8716
    local.ceil = ceil;
8717
    local.offset = offset;
8718
    local.range = range;
8719
    var utc = local.utc = d3_time_interval_utc(local);
8720
    utc.floor = utc;
8721
    utc.round = d3_time_interval_utc(round);
8722
    utc.ceil = d3_time_interval_utc(ceil);
8723
    utc.offset = d3_time_interval_utc(offset);
8724
    utc.range = range_utc;
8725
    return local;
8726
  }
8727
  function d3_time_interval_utc(method) {
8728
    return function(date, k) {
8729
      try {
8730
        d3_date = d3_date_utc;
8731
        var utc = new d3_date_utc();
8732
        utc._ = date;
8733
        return method(utc, k)._;
8734
      } finally {
8735
        d3_date = Date;
8736
      }
8737
    };
8738
  }
8739
  d3_time.year = d3_time_interval(function(date) {
8740
    date = d3_time.day(date);
8741
    date.setMonth(0, 1);
8742
    return date;
8743
  }, function(date, offset) {
8744
    date.setFullYear(date.getFullYear() + offset);
8745
  }, function(date) {
8746
    return date.getFullYear();
8747
  });
8748
  d3_time.years = d3_time.year.range;
8749
  d3_time.years.utc = d3_time.year.utc.range;
8750
  d3_time.day = d3_time_interval(function(date) {
8751
    var day = new d3_date(2e3, 0);
8752
    day.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
8753
    return day;
8754
  }, function(date, offset) {
8755
    date.setDate(date.getDate() + offset);
8756
  }, function(date) {
8757
    return date.getDate() - 1;
8758
  });
8759
  d3_time.days = d3_time.day.range;
8760
  d3_time.days.utc = d3_time.day.utc.range;
8761
  d3_time.dayOfYear = function(date) {
8762
    var year = d3_time.year(date);
8763
    return Math.floor((date - year - (date.getTimezoneOffset() - year.getTimezoneOffset()) * 6e4) / 864e5);
8764
  };
8765
  d3_time_daySymbols.forEach(function(day, i) {
8766
    day = day.toLowerCase();
8767
    i = 7 - i;
8768
    var interval = d3_time[day] = d3_time_interval(function(date) {
8769
      (date = d3_time.day(date)).setDate(date.getDate() - (date.getDay() + i) % 7);
8770
      return date;
8771
    }, function(date, offset) {
8772
      date.setDate(date.getDate() + Math.floor(offset) * 7);
8773
    }, function(date) {
8774
      var day = d3_time.year(date).getDay();
8775
      return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7) - (day !== i);
8776
    });
8777
    d3_time[day + "s"] = interval.range;
8778
    d3_time[day + "s"].utc = interval.utc.range;
8779
    d3_time[day + "OfYear"] = function(date) {
8780
      var day = d3_time.year(date).getDay();
8781
      return Math.floor((d3_time.dayOfYear(date) + (day + i) % 7) / 7);
8782
    };
8783
  });
8784
  d3_time.week = d3_time.sunday;
8785
  d3_time.weeks = d3_time.sunday.range;
8786
  d3_time.weeks.utc = d3_time.sunday.utc.range;
8787
  d3_time.weekOfYear = d3_time.sundayOfYear;
8788
  d3_time.format = d3_time_format;
8789
  function d3_time_format(template) {
8790
    var n = template.length;
8791
    function format(date) {
8792
      var string = [], i = -1, j = 0, c, p, f;
8793
      while (++i < n) {
8794
        if (template.charCodeAt(i) === 37) {
8795
          string.push(template.substring(j, i));
8796
          if ((p = d3_time_formatPads[c = template.charAt(++i)]) != null) c = template.charAt(++i);
8797
          if (f = d3_time_formats[c]) c = f(date, p == null ? c === "e" ? " " : "0" : p);
8798
          string.push(c);
8799
          j = i + 1;
8800
        }
8801
      }
8802
      string.push(template.substring(j, i));
8803
      return string.join("");
8804
    }
8805
    format.parse = function(string) {
8806
      var d = {
8807
        y: 1900,
8808
        m: 0,
8809
        d: 1,
8810
        H: 0,
8811
        M: 0,
8812
        S: 0,
8813
        L: 0,
8814
        Z: null
8815
      }, i = d3_time_parse(d, template, string, 0);
8816
      if (i != string.length) return null;
8817
      if ("p" in d) d.H = d.H % 12 + d.p * 12;
8818
      var localZ = d.Z != null && d3_date !== d3_date_utc, date = new (localZ ? d3_date_utc : d3_date)();
8819
      if ("j" in d) date.setFullYear(d.y, 0, d.j); else if ("w" in d && ("W" in d || "U" in d)) {
8820
        date.setFullYear(d.y, 0, 1);
8821
        date.setFullYear(d.y, 0, "W" in d ? (d.w + 6) % 7 + d.W * 7 - (date.getDay() + 5) % 7 : d.w + d.U * 7 - (date.getDay() + 6) % 7);
8822
      } else date.setFullYear(d.y, d.m, d.d);
8823
      date.setHours(d.H + Math.floor(d.Z / 100), d.M + d.Z % 100, d.S, d.L);
8824
      return localZ ? date._ : date;
8825
    };
8826
    format.toString = function() {
8827
      return template;
8828
    };
8829
    return format;
8830
  }
8831
  function d3_time_parse(date, template, string, j) {
8832
    var c, p, t, i = 0, n = template.length, m = string.length;
8833
    while (i < n) {
8834
      if (j >= m) return -1;
8835
      c = template.charCodeAt(i++);
8836
      if (c === 37) {
8837
        t = template.charAt(i++);
8838
        p = d3_time_parsers[t in d3_time_formatPads ? template.charAt(i++) : t];
8839
        if (!p || (j = p(date, string, j)) < 0) return -1;
8840
      } else if (c != string.charCodeAt(j++)) {
8841
        return -1;
8842
      }
8843
    }
8844
    return j;
8845
  }
8846
  function d3_time_formatRe(names) {
8847
    return new RegExp("^(?:" + names.map(d3.requote).join("|") + ")", "i");
8848
  }
8849
  function d3_time_formatLookup(names) {
8850
    var map = new d3_Map(), i = -1, n = names.length;
8851
    while (++i < n) map.set(names[i].toLowerCase(), i);
8852
    return map;
8853
  }
8854
  function d3_time_formatPad(value, fill, width) {
8855
    var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length;
8856
    return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
8857
  }
8858
  var d3_time_dayRe = d3_time_formatRe(d3_time_days), d3_time_dayLookup = d3_time_formatLookup(d3_time_days), d3_time_dayAbbrevRe = d3_time_formatRe(d3_time_dayAbbreviations), d3_time_dayAbbrevLookup = d3_time_formatLookup(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), d3_time_percentRe = /^%/;
8859
  var d3_time_formatPads = {
8860
    "-": "",
8861
    _: " ",
8862
    "0": "0"
8863
  };
8864
  var d3_time_formats = {
8865
    a: function(d) {
8866
      return d3_time_dayAbbreviations[d.getDay()];
8867
    },
8868
    A: function(d) {
8869
      return d3_time_days[d.getDay()];
8870
    },
8871
    b: function(d) {
8872
      return d3_time_monthAbbreviations[d.getMonth()];
8873
    },
8874
    B: function(d) {
8875
      return d3_time_months[d.getMonth()];
8876
    },
8877
    c: d3_time_format(d3_time_formatDateTime),
8878
    d: function(d, p) {
8879
      return d3_time_formatPad(d.getDate(), p, 2);
8880
    },
8881
    e: function(d, p) {
8882
      return d3_time_formatPad(d.getDate(), p, 2);
8883
    },
8884
    H: function(d, p) {
8885
      return d3_time_formatPad(d.getHours(), p, 2);
8886
    },
8887
    I: function(d, p) {
8888
      return d3_time_formatPad(d.getHours() % 12 || 12, p, 2);
8889
    },
8890
    j: function(d, p) {
8891
      return d3_time_formatPad(1 + d3_time.dayOfYear(d), p, 3);
8892
    },
8893
    L: function(d, p) {
8894
      return d3_time_formatPad(d.getMilliseconds(), p, 3);
8895
    },
8896
    m: function(d, p) {
8897
      return d3_time_formatPad(d.getMonth() + 1, p, 2);
8898
    },
8899
    M: function(d, p) {
8900
      return d3_time_formatPad(d.getMinutes(), p, 2);
8901
    },
8902
    p: function(d) {
8903
      return d.getHours() >= 12 ? "PM" : "AM";
8904
    },
8905
    S: function(d, p) {
8906
      return d3_time_formatPad(d.getSeconds(), p, 2);
8907
    },
8908
    U: function(d, p) {
8909
      return d3_time_formatPad(d3_time.sundayOfYear(d), p, 2);
8910
    },
8911
    w: function(d) {
8912
      return d.getDay();
8913
    },
8914
    W: function(d, p) {
8915
      return d3_time_formatPad(d3_time.mondayOfYear(d), p, 2);
8916
    },
8917
    x: d3_time_format(d3_time_formatDate),
8918
    X: d3_time_format(d3_time_formatTime),
8919
    y: function(d, p) {
8920
      return d3_time_formatPad(d.getFullYear() % 100, p, 2);
8921
    },
8922
    Y: function(d, p) {
8923
      return d3_time_formatPad(d.getFullYear() % 1e4, p, 4);
8924
    },
8925
    Z: d3_time_zone,
8926
    "%": function() {
8927
      return "%";
8928
    }
8929
  };
8930
  var d3_time_parsers = {
8931
    a: d3_time_parseWeekdayAbbrev,
8932
    A: d3_time_parseWeekday,
8933
    b: d3_time_parseMonthAbbrev,
8934
    B: d3_time_parseMonth,
8935
    c: d3_time_parseLocaleFull,
8936
    d: d3_time_parseDay,
8937
    e: d3_time_parseDay,
8938
    H: d3_time_parseHour24,
8939
    I: d3_time_parseHour24,
8940
    j: d3_time_parseDayOfYear,
8941
    L: d3_time_parseMilliseconds,
8942
    m: d3_time_parseMonthNumber,
8943
    M: d3_time_parseMinutes,
8944
    p: d3_time_parseAmPm,
8945
    S: d3_time_parseSeconds,
8946
    U: d3_time_parseWeekNumberSunday,
8947
    w: d3_time_parseWeekdayNumber,
8948
    W: d3_time_parseWeekNumberMonday,
8949
    x: d3_time_parseLocaleDate,
8950
    X: d3_time_parseLocaleTime,
8951
    y: d3_time_parseYear,
8952
    Y: d3_time_parseFullYear,
8953
    Z: d3_time_parseZone,
8954
    "%": d3_time_parseLiteralPercent
8955
  };
8956
  function d3_time_parseWeekdayAbbrev(date, string, i) {
8957
    d3_time_dayAbbrevRe.lastIndex = 0;
8958
    var n = d3_time_dayAbbrevRe.exec(string.substring(i));
8959
    return n ? (date.w = d3_time_dayAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
8960
  }
8961
  function d3_time_parseWeekday(date, string, i) {
8962
    d3_time_dayRe.lastIndex = 0;
8963
    var n = d3_time_dayRe.exec(string.substring(i));
8964
    return n ? (date.w = d3_time_dayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
8965
  }
8966
  function d3_time_parseWeekdayNumber(date, string, i) {
8967
    d3_time_numberRe.lastIndex = 0;
8968
    var n = d3_time_numberRe.exec(string.substring(i, i + 1));
8969
    return n ? (date.w = +n[0], i + n[0].length) : -1;
8970
  }
8971
  function d3_time_parseWeekNumberSunday(date, string, i) {
8972
    d3_time_numberRe.lastIndex = 0;
8973
    var n = d3_time_numberRe.exec(string.substring(i));
8974
    return n ? (date.U = +n[0], i + n[0].length) : -1;
8975
  }
8976
  function d3_time_parseWeekNumberMonday(date, string, i) {
8977
    d3_time_numberRe.lastIndex = 0;
8978
    var n = d3_time_numberRe.exec(string.substring(i));
8979
    return n ? (date.W = +n[0], i + n[0].length) : -1;
8980
  }
8981
  function d3_time_parseMonthAbbrev(date, string, i) {
8982
    d3_time_monthAbbrevRe.lastIndex = 0;
8983
    var n = d3_time_monthAbbrevRe.exec(string.substring(i));
8984
    return n ? (date.m = d3_time_monthAbbrevLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
8985
  }
8986
  function d3_time_parseMonth(date, string, i) {
8987
    d3_time_monthRe.lastIndex = 0;
8988
    var n = d3_time_monthRe.exec(string.substring(i));
8989
    return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1;
8990
  }
8991
  function d3_time_parseLocaleFull(date, string, i) {
8992
    return d3_time_parse(date, d3_time_formats.c.toString(), string, i);
8993
  }
8994
  function d3_time_parseLocaleDate(date, string, i) {
8995
    return d3_time_parse(date, d3_time_formats.x.toString(), string, i);
8996
  }
8997
  function d3_time_parseLocaleTime(date, string, i) {
8998
    return d3_time_parse(date, d3_time_formats.X.toString(), string, i);
8999
  }
9000
  function d3_time_parseFullYear(date, string, i) {
9001
    d3_time_numberRe.lastIndex = 0;
9002
    var n = d3_time_numberRe.exec(string.substring(i, i + 4));
9003
    return n ? (date.y = +n[0], i + n[0].length) : -1;
9004
  }
9005
  function d3_time_parseYear(date, string, i) {
9006
    d3_time_numberRe.lastIndex = 0;
9007
    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
9008
    return n ? (date.y = d3_time_expandYear(+n[0]), i + n[0].length) : -1;
9009
  }
9010
  function d3_time_parseZone(date, string, i) {
9011
    return /^[+-]\d{4}$/.test(string = string.substring(i, i + 5)) ? (date.Z = +string, 
9012
    i + 5) : -1;
9013
  }
9014
  function d3_time_expandYear(d) {
9015
    return d + (d > 68 ? 1900 : 2e3);
9016
  }
9017
  function d3_time_parseMonthNumber(date, string, i) {
9018
    d3_time_numberRe.lastIndex = 0;
9019
    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
9020
    return n ? (date.m = n[0] - 1, i + n[0].length) : -1;
9021
  }
9022
  function d3_time_parseDay(date, string, i) {
9023
    d3_time_numberRe.lastIndex = 0;
9024
    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
9025
    return n ? (date.d = +n[0], i + n[0].length) : -1;
9026
  }
9027
  function d3_time_parseDayOfYear(date, string, i) {
9028
    d3_time_numberRe.lastIndex = 0;
9029
    var n = d3_time_numberRe.exec(string.substring(i, i + 3));
9030
    return n ? (date.j = +n[0], i + n[0].length) : -1;
9031
  }
9032
  function d3_time_parseHour24(date, string, i) {
9033
    d3_time_numberRe.lastIndex = 0;
9034
    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
9035
    return n ? (date.H = +n[0], i + n[0].length) : -1;
9036
  }
9037
  function d3_time_parseMinutes(date, string, i) {
9038
    d3_time_numberRe.lastIndex = 0;
9039
    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
9040
    return n ? (date.M = +n[0], i + n[0].length) : -1;
9041
  }
9042
  function d3_time_parseSeconds(date, string, i) {
9043
    d3_time_numberRe.lastIndex = 0;
9044
    var n = d3_time_numberRe.exec(string.substring(i, i + 2));
9045
    return n ? (date.S = +n[0], i + n[0].length) : -1;
9046
  }
9047
  function d3_time_parseMilliseconds(date, string, i) {
9048
    d3_time_numberRe.lastIndex = 0;
9049
    var n = d3_time_numberRe.exec(string.substring(i, i + 3));
9050
    return n ? (date.L = +n[0], i + n[0].length) : -1;
9051
  }
9052
  var d3_time_numberRe = /^\s*\d+/;
9053
  function d3_time_parseAmPm(date, string, i) {
9054
    var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
9055
    return n == null ? -1 : (date.p = n, i);
9056
  }
9057
  var d3_time_amPmLookup = d3.map({
9058
    am: 0,
9059
    pm: 1
9060
  });
9061
  function d3_time_zone(d) {
9062
    var z = d.getTimezoneOffset(), zs = z > 0 ? "-" : "+", zh = ~~(abs(z) / 60), zm = abs(z) % 60;
9063
    return zs + d3_time_formatPad(zh, "0", 2) + d3_time_formatPad(zm, "0", 2);
9064
  }
9065
  function d3_time_parseLiteralPercent(date, string, i) {
9066
    d3_time_percentRe.lastIndex = 0;
9067
    var n = d3_time_percentRe.exec(string.substring(i, i + 1));
9068
    return n ? i + n[0].length : -1;
9069
  }
9070
  d3_time_format.utc = d3_time_formatUtc;
9071
  function d3_time_formatUtc(template) {
9072
    var local = d3_time_format(template);
9073
    function format(date) {
9074
      try {
9075
        d3_date = d3_date_utc;
9076
        var utc = new d3_date();
9077
        utc._ = date;
9078
        return local(utc);
9079
      } finally {
9080
        d3_date = Date;
9081
      }
9082
    }
9083
    format.parse = function(string) {
9084
      try {
9085
        d3_date = d3_date_utc;
9086
        var date = local.parse(string);
9087
        return date && date._;
9088
      } finally {
9089
        d3_date = Date;
9090
      }
9091
    };
9092
    format.toString = local.toString;
9093
    return format;
9094
  }
9095
  var d3_time_formatIso = d3_time_formatUtc("%Y-%m-%dT%H:%M:%S.%LZ");
9096
  d3_time_format.iso = Date.prototype.toISOString && +new Date("2000-01-01T00:00:00.000Z") ? d3_time_formatIsoNative : d3_time_formatIso;
9097
  function d3_time_formatIsoNative(date) {
9098
    return date.toISOString();
9099
  }
9100
  d3_time_formatIsoNative.parse = function(string) {
9101
    var date = new Date(string);
9102
    return isNaN(date) ? null : date;
9103
  };
9104
  d3_time_formatIsoNative.toString = d3_time_formatIso.toString;
9105
  d3_time.second = d3_time_interval(function(date) {
9106
    return new d3_date(Math.floor(date / 1e3) * 1e3);
9107
  }, function(date, offset) {
9108
    date.setTime(date.getTime() + Math.floor(offset) * 1e3);
9109
  }, function(date) {
9110
    return date.getSeconds();
9111
  });
9112
  d3_time.seconds = d3_time.second.range;
9113
  d3_time.seconds.utc = d3_time.second.utc.range;
9114
  d3_time.minute = d3_time_interval(function(date) {
9115
    return new d3_date(Math.floor(date / 6e4) * 6e4);
9116
  }, function(date, offset) {
9117
    date.setTime(date.getTime() + Math.floor(offset) * 6e4);
9118
  }, function(date) {
9119
    return date.getMinutes();
9120
  });
9121
  d3_time.minutes = d3_time.minute.range;
9122
  d3_time.minutes.utc = d3_time.minute.utc.range;
9123
  d3_time.hour = d3_time_interval(function(date) {
9124
    var timezone = date.getTimezoneOffset() / 60;
9125
    return new d3_date((Math.floor(date / 36e5 - timezone) + timezone) * 36e5);
9126
  }, function(date, offset) {
9127
    date.setTime(date.getTime() + Math.floor(offset) * 36e5);
9128
  }, function(date) {
9129
    return date.getHours();
9130
  });
9131
  d3_time.hours = d3_time.hour.range;
9132
  d3_time.hours.utc = d3_time.hour.utc.range;
9133
  d3_time.month = d3_time_interval(function(date) {
9134
    date = d3_time.day(date);
9135
    date.setDate(1);
9136
    return date;
9137
  }, function(date, offset) {
9138
    date.setMonth(date.getMonth() + offset);
9139
  }, function(date) {
9140
    return date.getMonth();
9141
  });
9142
  d3_time.months = d3_time.month.range;
9143
  d3_time.months.utc = d3_time.month.utc.range;
9144
  function d3_time_scale(linear, methods, format) {
9145
    function scale(x) {
9146
      return linear(x);
9147
    }
9148
    scale.invert = function(x) {
9149
      return d3_time_scaleDate(linear.invert(x));
9150
    };
9151
    scale.domain = function(x) {
9152
      if (!arguments.length) return linear.domain().map(d3_time_scaleDate);
9153
      linear.domain(x);
9154
      return scale;
9155
    };
9156
    function tickMethod(extent, count) {
9157
      var span = extent[1] - extent[0], target = span / count, i = d3.bisect(d3_time_scaleSteps, target);
9158
      return i == d3_time_scaleSteps.length ? [ methods.year, d3_scale_linearTickRange(extent.map(function(d) {
9159
        return d / 31536e6;
9160
      }), count)[2] ] : !i ? [ d3_time_scaleMilliseconds, d3_scale_linearTickRange(extent, count)[2] ] : methods[target / d3_time_scaleSteps[i - 1] < d3_time_scaleSteps[i] / target ? i - 1 : i];
9161
    }
9162
    scale.nice = function(interval, skip) {
9163
      var domain = scale.domain(), extent = d3_scaleExtent(domain), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" && tickMethod(extent, interval);
9164
      if (method) interval = method[0], skip = method[1];
9165
      function skipped(date) {
9166
        return !isNaN(date) && !interval.range(date, d3_time_scaleDate(+date + 1), skip).length;
9167
      }
9168
      return scale.domain(d3_scale_nice(domain, skip > 1 ? {
9169
        floor: function(date) {
9170
          while (skipped(date = interval.floor(date))) date = d3_time_scaleDate(date - 1);
9171
          return date;
9172
        },
9173
        ceil: function(date) {
9174
          while (skipped(date = interval.ceil(date))) date = d3_time_scaleDate(+date + 1);
9175
          return date;
9176
        }
9177
      } : interval));
9178
    };
9179
    scale.ticks = function(interval, skip) {
9180
      var extent = d3_scaleExtent(scale.domain()), method = interval == null ? tickMethod(extent, 10) : typeof interval === "number" ? tickMethod(extent, interval) : !interval.range && [ {
9181
        range: interval
9182
      }, skip ];
9183
      if (method) interval = method[0], skip = method[1];
9184
      return interval.range(extent[0], d3_time_scaleDate(+extent[1] + 1), skip < 1 ? 1 : skip);
9185
    };
9186
    scale.tickFormat = function() {
9187
      return format;
9188
    };
9189
    scale.copy = function() {
9190
      return d3_time_scale(linear.copy(), methods, format);
9191
    };
9192
    return d3_scale_linearRebind(scale, linear);
9193
  }
9194
  function d3_time_scaleDate(t) {
9195
    return new Date(t);
9196
  }
9197
  function d3_time_scaleFormat(formats) {
9198
    return function(date) {
9199
      var i = formats.length - 1, f = formats[i];
9200
      while (!f[1](date)) f = formats[--i];
9201
      return f[0](date);
9202
    };
9203
  }
9204
  var d3_time_scaleSteps = [ 1e3, 5e3, 15e3, 3e4, 6e4, 3e5, 9e5, 18e5, 36e5, 108e5, 216e5, 432e5, 864e5, 1728e5, 6048e5, 2592e6, 7776e6, 31536e6 ];
9205
  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 ] ];
9206
  var d3_time_scaleLocalFormats = [ [ d3_time_format("%Y"), d3_true ], [ d3_time_format("%B"), function(d) {
9207
    return d.getMonth();
9208
  } ], [ d3_time_format("%b %d"), function(d) {
9209
    return d.getDate() != 1;
9210
  } ], [ d3_time_format("%a %d"), function(d) {
9211
    return d.getDay() && d.getDate() != 1;
9212
  } ], [ d3_time_format("%I %p"), function(d) {
9213
    return d.getHours();
9214
  } ], [ d3_time_format("%I:%M"), function(d) {
9215
    return d.getMinutes();
9216
  } ], [ d3_time_format(":%S"), function(d) {
9217
    return d.getSeconds();
9218
  } ], [ d3_time_format(".%L"), function(d) {
9219
    return d.getMilliseconds();
9220
  } ] ];
9221
  var d3_time_scaleLocalFormat = d3_time_scaleFormat(d3_time_scaleLocalFormats);
9222
  d3_time_scaleLocalMethods.year = d3_time.year;
9223
  d3_time.scale = function() {
9224
    return d3_time_scale(d3.scale.linear(), d3_time_scaleLocalMethods, d3_time_scaleLocalFormat);
9225
  };
9226
  var d3_time_scaleMilliseconds = {
9227
    range: function(start, stop, step) {
9228
      return d3.range(+start, +stop, step).map(d3_time_scaleDate);
9229
    }
9230
  };
9231
  var d3_time_scaleUTCMethods = d3_time_scaleLocalMethods.map(function(m) {
9232
    return [ m[0].utc, m[1] ];
9233
  });
9234
  var d3_time_scaleUTCFormats = [ [ d3_time_formatUtc("%Y"), d3_true ], [ d3_time_formatUtc("%B"), function(d) {
9235
    return d.getUTCMonth();
9236
  } ], [ d3_time_formatUtc("%b %d"), function(d) {
9237
    return d.getUTCDate() != 1;
9238
  } ], [ d3_time_formatUtc("%a %d"), function(d) {
9239
    return d.getUTCDay() && d.getUTCDate() != 1;
9240
  } ], [ d3_time_formatUtc("%I %p"), function(d) {
9241
    return d.getUTCHours();
9242
  } ], [ d3_time_formatUtc("%I:%M"), function(d) {
9243
    return d.getUTCMinutes();
9244
  } ], [ d3_time_formatUtc(":%S"), function(d) {
9245
    return d.getUTCSeconds();
9246
  } ], [ d3_time_formatUtc(".%L"), function(d) {
9247
    return d.getUTCMilliseconds();
9248
  } ] ];
9249
  var d3_time_scaleUTCFormat = d3_time_scaleFormat(d3_time_scaleUTCFormats);
9250
  d3_time_scaleUTCMethods.year = d3_time.year.utc;
9251
  d3_time.scale.utc = function() {
9252
    return d3_time_scale(d3.scale.linear(), d3_time_scaleUTCMethods, d3_time_scaleUTCFormat);
9253
  };
9254
  d3.text = d3_xhrType(function(request) {
9255
    return request.responseText;
9256
  });
9257
  d3.json = function(url, callback) {
9258
    return d3_xhr(url, "application/json", d3_json, callback);
9259
  };
9260
  function d3_json(request) {
9261
    return JSON.parse(request.responseText);
9262
  }
9263
  d3.html = function(url, callback) {
9264
    return d3_xhr(url, "text/html", d3_html, callback);
9265
  };
9266
  function d3_html(request) {
9267
    var range = d3_document.createRange();
9268
    range.selectNode(d3_document.body);
9269
    return range.createContextualFragment(request.responseText);
9270
  }
9271
  d3.xml = d3_xhrType(function(request) {
9272
    return request.responseXML;
9273
  });
9274
  return d3;
9275
}();