app/assets/javascripts/d3.v4.js in d3-rails-4.2.6 vs app/assets/javascripts/d3.v4.js in d3-rails-4.3.0

- old
+ new

@@ -1,17 +1,17 @@ -// https://d3js.org Version 4.2.6. Copyright 2016 Mike Bostock. +// https://d3js.org Version 4.3.0. Copyright 2016 Mike Bostock. (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.d3 = global.d3 || {}))); }(this, (function (exports) { 'use strict'; -var version = "4.2.6"; +var version = "4.3.0"; var ascending = function(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; -} +}; var bisector = function(compare) { if (compare.length === 1) compare = ascendingComparator(compare); return { left: function(a, x, lo, hi) { @@ -33,11 +33,11 @@ else lo = mid + 1; } return lo; } }; -} +}; function ascendingComparator(f) { return function(d, x) { return ascending(f(d), x); }; @@ -47,15 +47,15 @@ var bisectRight = ascendingBisect.right; var bisectLeft = ascendingBisect.left; var descending = function(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} +}; var number = function(x) { return x === null ? NaN : +x; -} +}; var variance = function(array, f) { var n = array.length, m = 0, a, @@ -83,16 +83,16 @@ } } } if (j > 1) return s / (j - 1); -} +}; var deviation = function(array, f) { var v = variance(array, f); return v ? Math.sqrt(v) : v; -} +}; var extent = function(array, f) { var i = -1, n = array.length, a, @@ -114,26 +114,26 @@ if (c < b) c = b; } } return [a, c]; -} +}; var array = Array.prototype; var slice = array.slice; var map = array.map; var constant$1 = function(x) { return function() { return x; }; -} +}; var identity = function(x) { return x; -} +}; var range = function(start, stop, step) { start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; var i = -1, @@ -143,11 +143,11 @@ while (++i < n) { range[i] = start + i * step; } return range; -} +}; var e10 = Math.sqrt(50); var e5 = Math.sqrt(10); var e2 = Math.sqrt(2); @@ -156,11 +156,11 @@ return range( Math.ceil(start / step) * step, Math.floor(stop / step) * step + step / 2, // inclusive step ); -} +}; function tickStep(start, stop, count) { var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; @@ -170,11 +170,11 @@ return stop < start ? -step1 : step1; } var sturges = function(values) { return Math.ceil(Math.log(values.length) / Math.LN2) + 1; -} +}; var histogram = function() { var value = identity, domain = extent, threshold = sturges; @@ -234,11 +234,11 @@ histogram.thresholds = function(_) { return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant$1(slice.call(_)) : constant$1(_), histogram) : threshold; }; return histogram; -} +}; var threshold = function(array, p, f) { if (f == null) f = number; if (!(n = array.length)) return; if ((p = +p) <= 0 || n < 2) return +f(array[0], 0, array); @@ -247,20 +247,20 @@ h = (n - 1) * p, i = Math.floor(h), a = +f(array[i], i, array), b = +f(array[i + 1], i + 1, array); return a + (b - a) * (h - i); -} +}; var freedmanDiaconis = function(values, min, max) { values = map.call(values, number).sort(ascending); return Math.ceil((max - min) / (2 * (threshold(values, 0.75) - threshold(values, 0.25)) * Math.pow(values.length, -1 / 3))); -} +}; var scott = function(values, min, max) { return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3))); -} +}; var max = function(array, f) { var i = -1, n = array.length, a, @@ -275,11 +275,11 @@ while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; } while (++i < n) if ((b = f(array[i], i, array)) != null && b > a) a = b; } return a; -} +}; var mean = function(array, f) { var s = 0, n = array.length, a, @@ -293,11 +293,11 @@ else { while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) s += a; else --j; } if (j) return s / j; -} +}; var median = function(array, f) { var numbers = [], n = array.length, a, @@ -310,11 +310,11 @@ else { while (++i < n) if (!isNaN(a = number(f(array[i], i, array)))) numbers.push(a); } return threshold(numbers.sort(ascending), 0.5); -} +}; var merge = function(arrays) { var n = arrays.length, m, i = -1, @@ -332,11 +332,11 @@ merged[--j] = array[m]; } } return merged; -} +}; var min = function(array, f) { var i = -1, n = array.length, a, @@ -351,23 +351,23 @@ while (++i < n) if ((b = f(array[i], i, array)) != null && b >= b) { a = b; break; } while (++i < n) if ((b = f(array[i], i, array)) != null && a > b) a = b; } return a; -} +}; var pairs = function(array) { var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); while (i < n) pairs[i] = [p, p = array[++i]]; return pairs; -} +}; var permute = function(array, indexes) { var i = indexes.length, permutes = new Array(i); while (i--) permutes[i] = array[indexes[i]]; return permutes; -} +}; var scan = function(array, compare) { if (!(n = array.length)) return; var i = 0, n, @@ -378,11 +378,11 @@ if (!compare) compare = ascending; while (++i < n) if (compare(xi = array[i], xj) < 0 || compare(xj, xj) !== 0) xj = xi, j = i; if (compare(xj, xj) === 0) return j; -} +}; var shuffle = function(array, i0, i1) { var m = (i1 == null ? array.length : i1) - (i0 = i0 == null ? 0 : +i0), t, i; @@ -393,11 +393,11 @@ array[m + i0] = array[i + i0]; array[i + i0] = t; } return array; -} +}; var sum = function(array, f) { var s = 0, n = array.length, a, @@ -410,29 +410,29 @@ else { while (++i < n) if (a = +f(array[i], i, array)) s += a; } return s; -} +}; var transpose = function(matrix) { if (!(n = matrix.length)) return []; for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m;) { for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n;) { row[j] = matrix[j][i]; } } return transpose; -} +}; function length(d) { return d.length; } var zip = function() { return transpose(arguments); -} +}; var prefix = "$"; function Map() {} @@ -558,11 +558,11 @@ key: function(d) { keys.push(d); return nest; }, sortKeys: function(order) { sortKeys[keys.length - 1] = order; return nest; }, sortValues: function(order) { sortValues = order; return nest; }, rollup: function(f) { rollup = f; return nest; } }; -} +}; function createObject() { return {}; } @@ -616,33 +616,33 @@ var keys = function(map) { var keys = []; for (var key in map) keys.push(key); return keys; -} +}; var values = function(map) { var values = []; for (var key in map) values.push(map[key]); return values; -} +}; var entries = function(map) { var entries = []; for (var key in map) entries.push({key: key, value: map[key]}); return entries; -} +}; var uniform = function(min, max) { min = min == null ? 0 : +min; max = max == null ? 1 : +max; if (arguments.length === 1) max = min, min = 0; else max -= min; return function() { return Math.random() * max + min; }; -} +}; var normal = function(mu, sigma) { var x, r; mu = mu == null ? 0 : +mu; sigma = sigma == null ? 1 : +sigma; @@ -659,38 +659,38 @@ r = x * x + y * y; } while (!r || r > 1); return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r); }; -} +}; var logNormal = function() { var randomNormal = normal.apply(this, arguments); return function() { return Math.exp(randomNormal()); }; -} +}; var irwinHall = function(n) { return function() { for (var sum = 0, i = 0; i < n; ++i) sum += Math.random(); return sum; }; -} +}; var bates = function(n) { var randomIrwinHall = irwinHall(n); return function() { return randomIrwinHall() / n; }; -} +}; var exponential = function(lambda) { return function() { return -Math.log(1 - Math.random()) / lambda; }; -} +}; function linear(t) { return +t; } @@ -913,11 +913,11 @@ b = polygon[i]; area += a[1] * b[0] - a[0] * b[1]; } return area / 2; -} +}; var centroid = function(polygon) { var i = -1, n = polygon.length, x = 0, @@ -934,19 +934,19 @@ x += (a[0] + b[0]) * c; y += (a[1] + b[1]) * c; } return k *= 3, [x / k, y / k]; -} +}; // Returns the 2D cross product of AB and AC vectors, i.e., the z-component of // the 3D cross product in a quadrant I Cartesian coordinate system (+x is // right, +y is up). Returns a positive value if ABC is counter-clockwise, // negative if clockwise, and zero if the points are collinear. var cross = function(a, b, c) { return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]); -} +}; function lexicographicOrder(a, b) { return a[0] - b[0] || a[1] - b[1]; } @@ -990,11 +990,11 @@ // Then add lower hull in left-to-right order. for (i = upperIndexes.length - 1; i >= 0; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]); for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]); return hull; -} +}; var contains = function(polygon, point) { var n = polygon.length, p = polygon[n - 1], x = point[0], y = point[1], @@ -1007,11 +1007,11 @@ if (((y1 > y) !== (y0 > y)) && (x < (x0 - x1) * (y - y1) / (y0 - y1) + x1)) inside = !inside; x0 = x1, y0 = y1; } return inside; -} +}; var length$1 = function(polygon) { var i = -1, n = polygon.length, b = polygon[n - 1], @@ -1031,11 +1031,11 @@ ya -= yb; perimeter += Math.sqrt(xa * xa + ya * ya); } return perimeter; -} +}; var pi$1 = Math.PI; var tau$1 = 2 * pi$1; var epsilon = 1e-6; var tauEpsilon = tau$1 - epsilon; @@ -1181,11 +1181,11 @@ var tree_add = function(d) { var x = +this._x.call(null, d), y = +this._y.call(null, d); return add(this.cover(x, y), x, y, d); -} +}; function add(tree, x, y, d) { if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points var parent, @@ -1320,33 +1320,33 @@ this._x0 = x0; this._y0 = y0; this._x1 = x1; this._y1 = y1; return this; -} +}; var tree_data = function() { var data = []; this.visit(function(node) { if (!node.length) do data.push(node.data); while (node = node.next) }); return data; -} +}; var tree_extent = function(_) { return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? undefined : [[this._x0, this._y0], [this._x1, this._y1]]; -} +}; var Quad = function(node, x0, y0, x1, y1) { this.node = node; this.x0 = x0; this.y0 = y0; this.x1 = x1; this.y1 = y1; -} +}; var tree_find = function(x, y, radius) { var data, x0 = this._x0, y0 = this._y0, @@ -1411,11 +1411,11 @@ } } } return data; -} +}; var tree_remove = function(d) { if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this; // ignore invalid points var parent, @@ -1469,28 +1469,28 @@ if (retainer) retainer[j] = node; else this._root = node; } return this; -} +}; function removeAll(data) { for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); return this; } var tree_root = function() { return this._root; -} +}; var tree_size = function() { var size = 0; this.visit(function(node) { if (!node.length) do ++size; while (node = node.next) }); return size; -} +}; var tree_visit = function(callback) { var quads = [], q, node = this._root, child, x0, y0, x1, y1; if (node) quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); while (q = quads.pop()) { @@ -1501,11 +1501,11 @@ if (child = node[1]) quads.push(new Quad(child, xm, y0, x1, ym)); if (child = node[0]) quads.push(new Quad(child, x0, y0, xm, ym)); } } return this; -} +}; var tree_visitAfter = function(callback) { var quads = [], next = [], q; if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); while (q = quads.pop()) { @@ -1521,27 +1521,27 @@ } while (q = next.pop()) { callback(q.node, q.x0, q.y0, q.x1, q.y1); } return this; -} +}; function defaultX(d) { return d[0]; } var tree_x = function(_) { return arguments.length ? (this._x = _, this) : this._x; -} +}; function defaultY(d) { return d[1]; } var tree_y = function(_) { return arguments.length ? (this._y = _, this) : this._y; -} +}; function quadtree(nodes, x, y) { var tree = new Quadtree(x == null ? defaultX : x, y == null ? defaultY : y, NaN, NaN, NaN, NaN); return nodes == null ? tree : tree.addAll(nodes); } @@ -1722,11 +1722,11 @@ var constant$2 = function(x) { return function constant() { return x; }; -} +}; var epsilon$1 = 1e-12; var pi$2 = Math.PI; var halfPi$1 = pi$2 / 2; var tau$2 = 2 * pi$2; @@ -1987,11 +1987,11 @@ arc.context = function(_) { return arguments.length ? ((context = _ == null ? null : _), arc) : context; }; return arc; -} +}; function Linear(context) { this._context = context; } @@ -2019,11 +2019,11 @@ } }; var curveLinear = function(context) { return new Linear(context); -} +}; function x(p) { return p[0]; } @@ -2078,11 +2078,11 @@ line.context = function(_) { return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line) : context; }; return line; -} +}; var area$1 = function() { var x0 = x, x1 = null, y0 = constant$2(0), @@ -2182,19 +2182,19 @@ area.context = function(_) { return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), area) : context; }; return area; -} +}; var descending$1 = function(a, b) { return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN; -} +}; var identity$1 = function(d) { return d; -} +}; var pie = function() { var value = identity$1, sortValues = descending$1, sort = null, @@ -2265,11 +2265,11 @@ pie.padAngle = function(_) { return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$2(+_), pie) : padAngle; }; return pie; -} +}; var curveRadialLinear = curveRadial(curveLinear); function Radial(curve) { this._curve = curve; @@ -2317,11 +2317,11 @@ return l; } var radialLine$1 = function() { return radialLine(line().curve(curveRadialLinear)); -} +}; var radialArea = function() { var a = area$1().curve(curveRadialLinear), c = a.curve, x0 = a.lineX0, @@ -2343,11 +2343,11 @@ a.curve = function(_) { return arguments.length ? c(curveRadial(_)) : c()._curve; }; return a; -} +}; var circle = { draw: function(context, size) { var r = Math.sqrt(size / pi$2); context.moveTo(r, 0); @@ -2492,13 +2492,13 @@ symbol.context = function(_) { return arguments.length ? (context = _ == null ? null : _, symbol) : context; }; return symbol; -} +}; -var noop = function() {} +var noop = function() {}; function point(that, x, y) { that._context.bezierCurveTo( (2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, @@ -2546,11 +2546,11 @@ } }; var basis = function(context) { return new Basis(context); -} +}; function BasisClosed(context) { this._context = context; } @@ -2596,11 +2596,11 @@ } }; var basisClosed = function(context) { return new BasisClosed(context); -} +}; function BasisOpen(context) { this._context = context; } @@ -2634,11 +2634,11 @@ } }; var basisOpen = function(context) { return new BasisOpen(context); -} +}; function Bundle(context, beta) { this._basis = new Basis(context); this._beta = beta; } @@ -3099,11 +3099,11 @@ } }; var linearClosed = function(context) { return new LinearClosed(context); -} +}; function sign(x) { return x < 0 ? -1 : 1; } @@ -3177,11 +3177,11 @@ this._x0 = this._x1, this._x1 = x; this._y0 = this._y1, this._y1 = y; this._t0 = t1; } -} +}; function MonotoneY(context) { this._context = new ReflectContext(context); } @@ -3270,11 +3270,11 @@ return [a, b]; } var natural = function(context) { return new Natural(context); -} +}; function Step(context, t) { this._context = context; this._t = t; } @@ -3316,11 +3316,11 @@ } }; var step = function(context) { return new Step(context, 0.5); -} +}; function stepBefore(context) { return new Step(context, 0); } @@ -3336,17 +3336,17 @@ s0 = s1, s1 = series[order[i]]; for (var j = 0; j < m; ++j) { s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; } } -} +}; var none$1 = function(series) { var n = series.length, o = new Array(n); while (--n >= 0) o[n] = n; return o; -} +}; function stackValue(d, key) { return d[key]; } @@ -3395,29 +3395,29 @@ stack.offset = function(_) { return arguments.length ? (offset = _ == null ? none : _, stack) : offset; }; return stack; -} +}; var expand = function(series, order) { if (!((n = series.length) > 0)) return; for (var i, n, j = 0, m = series[0].length, y; j < m; ++j) { for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0; if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y; } none(series, order); -} +}; var silhouette = function(series, order) { if (!((n = series.length) > 0)) return; for (var j = 0, s0 = series[order[0]], n, m = s0.length; j < m; ++j) { for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0; s0[j][1] += s0[j][0] = -y / 2; } none(series, order); -} +}; var wiggle = function(series, order) { if (!((n = series.length) > 0) || !((m = (s0 = series[order[0]]).length) > 0)) return; for (var y = 0, j = 1, s0, m, n; j < m; ++j) { for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { @@ -3436,26 +3436,26 @@ s0[j - 1][1] += s0[j - 1][0] = y; if (s1) y -= s2 / s1; } s0[j - 1][1] += s0[j - 1][0] = y; none(series, order); -} +}; var ascending$1 = function(series) { var sums = series.map(sum$1); return none$1(series).sort(function(a, b) { return sums[a] - sums[b]; }); -} +}; function sum$1(series) { var s = 0, i = -1, n = series.length, v; while (++i < n) if (v = +series[i][1]) s += v; return s; } var descending$2 = function(series) { return ascending$1(series).reverse(); -} +}; var insideOut = function(series) { var n = series.length, i, j, @@ -3476,20 +3476,20 @@ bottoms.push(j); } } return bottoms.reverse().concat(tops); -} +}; var reverse = function(series) { return none$1(series).reverse(); -} +}; var define = function(constructor, factory, prototype) { constructor.prototype = factory.prototype = prototype; prototype.constructor = constructor; -} +}; function extend(parent, definition) { var prototype = Object.create(parent.prototype); for (var key in definition) prototype[key] = definition[key]; return prototype; @@ -4003,11 +4003,11 @@ v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; return basis$1((t - i / n) * n, v0, v1, v2, v3); }; -} +}; var basisClosed$1 = function(values) { var n = values.length; return function(t) { var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), @@ -4015,17 +4015,17 @@ v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; return basis$1((t - i / n) * n, v0, v1, v2, v3); }; -} +}; var constant$3 = function(x) { return function() { return x; }; -} +}; function linear$1(a, d) { return function(t) { return a + t * d; }; @@ -4116,24 +4116,24 @@ return function(t) { for (i = 0; i < na; ++i) c[i] = x[i](t); return c; }; -} +}; var date = function(a, b) { var d = new Date; return a = +a, b -= a, function(t) { return d.setTime(a + b * t), d; }; -} +}; var interpolateNumber = function(a, b) { return a = +a, b -= a, function(t) { return a + b * t; }; -} +}; var object = function(a, b) { var i = {}, c = {}, k; @@ -4151,11 +4151,11 @@ return function(t) { for (k in i) c[k] = i[k](t); return c; }; -} +}; var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g; var reB = new RegExp(reA.source, "g"); function zero(b) { @@ -4214,11 +4214,11 @@ : zero(b)) : (b = q.length, function(t) { for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); return s.join(""); }); -} +}; var interpolate = function(a, b) { var t = typeof b, c; return b == null || t === "boolean" ? constant$3(b) : (t === "number" ? interpolateNumber @@ -4226,17 +4226,17 @@ : b instanceof color ? interpolateRgb : b instanceof Date ? date : Array.isArray(b) ? array$1 : isNaN(b) ? object : interpolateNumber)(a, b); -} +}; var interpolateRound = function(a, b) { return a = +a, b -= a, function(t) { return Math.round(a + b * t); }; -} +}; var degrees = 180 / Math.PI; var identity$2 = { translateX: 0, @@ -4259,11 +4259,11 @@ rotate: Math.atan2(b, a) * degrees, skewX: Math.atan(skewX) * degrees, scaleX: scaleX, scaleY: scaleY }; -} +}; var cssNode; var cssRoot; var cssView; var svgNode; @@ -4383,11 +4383,11 @@ return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S) ]; - } + }; } // General case. else { var d1 = Math.sqrt(d2), @@ -4403,17 +4403,17 @@ return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0) ]; - } + }; } i.duration = S * 1000; return i; -} +}; function hsl$1(hue$$1) { return function(start, end) { var h = hue$$1((start = hsl(start)).h, (end = hsl(end)).h), s = nogamma(start.s, end.s), @@ -4494,11 +4494,11 @@ var quantize = function(interpolator, n) { var samples = new Array(n); for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); return samples; -} +}; var noop$1 = {value: function() {}}; function dispatch() { for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) { @@ -4712,11 +4712,11 @@ parse: parse, parseRows: parseRows, format: format, formatRows: formatRows }; -} +}; var csv = dsv(","); var csvParse = csv.parse; var csvParseRows = csv.parseRows; @@ -4862,11 +4862,11 @@ if (typeof callback !== "function") throw new Error("invalid callback: " + callback); return request.get(callback); } return request; -} +}; function fixCallback(callback) { return function(error, xhr) { callback(error == null ? xhr : null); }; @@ -4886,11 +4886,11 @@ if (typeof callback !== "function") throw new Error("invalid callback: " + callback); return r.get(callback); } return r; }; -} +}; var html = type("text/html", function(xhr) { return document.createRange().createContextualFragment(xhr.responseText); }); @@ -4914,11 +4914,11 @@ var r = request(url).mimeType(defaultMimeType); r.row = function(_) { return arguments.length ? r.response(responseOf(parse, row = _)) : row; }; r.row(row); return callback ? r.get(callback) : r; }; -} +}; function responseOf(parse, row) { return function(request$$1) { return parse(request$$1.responseText, row); }; @@ -5045,11 +5045,11 @@ t.restart(function(elapsed) { t.stop(); callback(elapsed + delay); }, delay, time); return t; -} +}; var interval$1 = function(callback, delay, time) { var t = new Timer, total = delay; if (delay == null) return t.restart(callback, delay, time), t; delay = +delay, time = time == null ? now() : +time; @@ -5057,11 +5057,11 @@ elapsed += total; t.restart(tick, total += delay, time); callback(elapsed); }, delay, time); return t; -} +}; var t0$1 = new Date; var t1$1 = new Date; function newInterval(floori, offseti, count, field) { @@ -5378,15 +5378,15 @@ // (e.g., 1.2e+3) or the form \de[-+]\d+ (e.g., 1e+3). return [ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1) ]; -} +}; var exponent$1 = function(x) { return x = formatDecimal(Math.abs(x)), x ? x[1] : NaN; -} +}; var formatGroup = function(grouping, thousands) { return function(value, width) { var i = value.length, t = [], @@ -5401,11 +5401,11 @@ g = grouping[j = (j + 1) % grouping.length]; } return t.reverse().join(thousands); }; -} +}; var formatDefault = function(x, p) { x = x.toPrecision(p); out: for (var n = x.length, i = 1, i0 = -1, i1; i < n; ++i) { @@ -5416,11 +5416,11 @@ default: if (i0 > 0) i0 = 0; break; } } return i0 > 0 ? x.slice(0, i0) + x.slice(i1 + 1) : x; -} +}; var prefixExponent; var formatPrefixAuto = function(x, p) { var d = formatDecimal(x, p); @@ -5431,21 +5431,21 @@ n = coefficient.length; return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0]; // less than 1y! -} +}; var formatRounded = function(x, p) { var d = formatDecimal(x, p); if (!d) return x + ""; var coefficient = d[0], exponent = d[1]; return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0"); -} +}; var formatTypes = { "": formatDefault, "%": function(x, p) { return (x * 100).toFixed(p); }, "b": function(x) { return Math.round(x).toString(2); }, @@ -5465,11 +5465,11 @@ // [[fill]align][sign][symbol][0][width][,][.precision][type] var re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i; var formatSpecifier = function(specifier) { return new FormatSpecifier(specifier); -} +}; function FormatSpecifier(specifier) { if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); var match, @@ -5647,11 +5647,11 @@ return { format: newFormat, formatPrefix: formatPrefix }; -} +}; var locale$1; @@ -5669,20 +5669,20 @@ return locale$1; } var precisionFixed = function(step) { return Math.max(0, -exponent$1(Math.abs(step))); -} +}; var precisionPrefix = function(step, value) { return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) * 3 - exponent$1(Math.abs(step))); -} +}; var precisionRound = function(step, max) { step = Math.abs(step), max = Math.abs(max) - step; return Math.max(0, exponent$1(max) - exponent$1(step)) + 1; -} +}; function localDate(d) { if (0 <= d.y && d.y < 100) { var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); date.setFullYear(d.y); @@ -6405,15 +6405,15 @@ var constant$4 = function(x) { return function() { return x; }; -} +}; var number$1 = function(x) { return +x; -} +}; var unit = [0, 1]; function deinterpolateLinear(a, b) { return (b -= (a = +a)) @@ -6546,11 +6546,11 @@ if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; break; } } return exports.format(specifier); -} +}; function linearish(scale) { var domain = scale.domain; scale.ticks = function(count) { @@ -6628,11 +6628,11 @@ } domain[i0] = interval.floor(x0); domain[i1] = interval.ceil(x1); return domain; -} +}; function deinterpolate(a, b) { return (b = Math.log(b / a)) ? function(x) { return Math.log(x / a) / b; } : constant$4(b); @@ -7037,21 +7037,21 @@ return scale; } var time = function() { return calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]); -} +}; var utcTime = function() { return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]); -} +}; var colors = function(s) { return s.match(/.{6}/g).map(function(x) { return "#" + x; }); -} +}; var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); var category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"); @@ -7072,11 +7072,11 @@ var ts = Math.abs(t - 0.5); rainbow.h = 360 * t - 100; rainbow.s = 1.5 - 1.5 * ts; rainbow.l = 0.8 - 0.9 * ts; return rainbow + ""; -} +}; function ramp(range) { var n = range.length; return function(t) { return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; @@ -7132,11 +7132,11 @@ var namespace = function(name) { var prefix = name += "", i = prefix.indexOf(":"); if (i >= 0 && (prefix = name.slice(0, i)) !== "xmlns") name = name.slice(i + 1); return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name; -} +}; function creatorInherit(name) { return function() { var document = this.ownerDocument, uri = this.namespaceURI; @@ -7155,11 +7155,11 @@ var creator = function(name) { var fullname = namespace(name); return (fullname.local ? creatorFixed : creatorInherit)(fullname); -} +}; var nextId = 0; function local() { return new Local; @@ -7303,11 +7303,11 @@ on = value ? onAdd : onRemove; if (capture == null) capture = false; for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture)); return this; -} +}; function customEvent(event1, listener, that, args) { var event0 = exports.event; event1.sourceEvent = exports.event; exports.event = event1; @@ -7320,11 +7320,11 @@ var sourceEvent = function() { var current = exports.event, source; while (source = current.sourceEvent) current = source; return current; -} +}; var point$5 = function(node, event) { var svg = node.ownerSVGElement || node; if (svg.createSVGPoint) { @@ -7334,25 +7334,25 @@ return [point.x, point.y]; } var rect = node.getBoundingClientRect(); return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop]; -} +}; var mouse = function(node) { var event = sourceEvent(); if (event.changedTouches) event = event.changedTouches[0]; return point$5(node, event); -} +}; function none$2() {} var selector = function(selector) { return selector == null ? none$2 : function() { return this.querySelector(selector); }; -} +}; var selection_select = function(select) { if (typeof select !== "function") select = selector(select); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { @@ -7363,21 +7363,21 @@ } } } return new Selection(subgroups, this._parents); -} +}; function empty() { return []; } var selectorAll = function(selector) { return selector == null ? empty : function() { return this.querySelectorAll(selector); }; -} +}; var selection_selectAll = function(select) { if (typeof select !== "function") select = selectorAll(select); for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) { @@ -7388,11 +7388,11 @@ } } } return new Selection(subgroups, parents); -} +}; var selection_filter = function(match) { if (typeof match !== "function") match = matcher$1(match); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { @@ -7402,19 +7402,19 @@ } } } return new Selection(subgroups, this._parents); -} +}; var sparse = function(update) { return new Array(update.length); -} +}; var selection_enter = function() { return new Selection(this._enter || this._groups.map(sparse), this._parents); -} +}; function EnterNode(parent, datum) { this.ownerDocument = parent.ownerDocument; this.namespaceURI = parent.namespaceURI; this._next = null; @@ -7432,11 +7432,11 @@ var constant$5 = function(x) { return function() { return x; }; -} +}; var keyPrefix = "$"; // Protect against keys like “__proto__”. function bindIndex(parent, group, enter, update, exit, data) { var i = 0, @@ -7547,15 +7547,15 @@ update = new Selection(update, parents); update._enter = enter; update._exit = exit; return update; -} +}; var selection_exit = function() { return new Selection(this._exit || this._groups.map(sparse), this._parents); -} +}; var selection_merge = function(selection) { for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) { @@ -7568,11 +7568,11 @@ for (; j < m0; ++j) { merges[j] = groups0[j]; } return new Selection(merges, this._parents); -} +}; var selection_order = function() { for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) { for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) { @@ -7582,11 +7582,11 @@ } } } return this; -} +}; var selection_sort = function(compare) { if (!compare) compare = ascending$2; function compareNode(a, b) { @@ -7601,28 +7601,28 @@ } sortgroup.sort(compareNode); } return new Selection(sortgroups, this._parents).order(); -} +}; function ascending$2(a, b) { return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; } var selection_call = function() { var callback = arguments[0]; arguments[0] = this; callback.apply(null, arguments); return this; -} +}; var selection_nodes = function() { var nodes = new Array(this.size()), i = -1; this.each(function() { nodes[++i] = this; }); return nodes; -} +}; var selection_node = function() { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length; i < n; ++i) { @@ -7630,32 +7630,32 @@ if (node) return node; } } return null; -} +}; var selection_size = function() { var size = 0; this.each(function() { ++size; }); return size; -} +}; var selection_empty = function() { return !this.node(); -} +}; var selection_each = function(callback) { for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) { for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) { if (node = group[i]) callback.call(node, node.__data__, i, group); } } return this; -} +}; function attrRemove(name) { return function() { this.removeAttribute(name); }; @@ -7707,17 +7707,17 @@ return this.each((value == null ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction) : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value)); -} +}; var window = function(node) { return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node || (node.document && node) // node is a Window || node.defaultView; // node is a Document -} +}; function styleRemove(name) { return function() { this.style.removeProperty(name); }; @@ -7745,11 +7745,11 @@ ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : window(node = this.node()) .getComputedStyle(node, null) .getPropertyValue(name); -} +}; function propertyRemove(name) { return function() { delete this[name]; }; @@ -7774,11 +7774,11 @@ ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name]; -} +}; function classArray(string) { return string.trim().split(/^|\s+/); } @@ -7850,11 +7850,11 @@ return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value)); -} +}; function textRemove() { this.textContent = ""; } @@ -7876,11 +7876,11 @@ ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent; -} +}; function htmlRemove() { this.innerHTML = ""; } @@ -7902,34 +7902,34 @@ ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML; -} +}; function raise$1() { if (this.nextSibling) this.parentNode.appendChild(this); } var selection_raise = function() { return this.each(raise$1); -} +}; function lower() { if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); } var selection_lower = function() { return this.each(lower); -} +}; var selection_append = function(name) { var create = typeof name === "function" ? name : creator(name); return this.select(function() { return this.appendChild(create.apply(this, arguments)); }); -} +}; function constantNull() { return null; } @@ -7937,26 +7937,26 @@ var create = typeof name === "function" ? name : creator(name), select = before == null ? constantNull : typeof before === "function" ? before : selector(before); return this.select(function() { return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null); }); -} +}; function remove() { var parent = this.parentNode; if (parent) parent.removeChild(this); } var selection_remove = function() { return this.each(remove); -} +}; var selection_datum = function(value) { return arguments.length ? this.property("__data__", value) : this.node().__data__; -} +}; function dispatchEvent(node, type, params) { var window$$1 = window(node), event = window$$1.CustomEvent; @@ -7985,11 +7985,11 @@ var selection_dispatch = function(type, params) { return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params)); -} +}; var root = [null]; function Selection(groups, parents) { this._groups = groups; @@ -8035,17 +8035,17 @@ var select = function(selector) { return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root); -} +}; var selectAll = function(selector) { return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([selector == null ? [] : selector], root); -} +}; var touch = function(node, touches, identifier) { if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches; for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) { @@ -8053,21 +8053,21 @@ return point$5(node, touch); } } return null; -} +}; var touches = function(node, touches) { if (touches == null) touches = sourceEvent().touches; for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) { points[i] = point$5(node, touches[i]); } return points; -} +}; var emptyOn = dispatch("start", "end", "interrupt"); var emptyTween = []; var CREATED = 0; @@ -8093,11 +8093,11 @@ duration: timing.duration, ease: timing.ease, timer: null, state: CREATED }); -} +}; function init(node, id) { var schedule = node.__transition; if (!schedule || !(schedule = schedule[id]) || schedule.state > CREATED) throw new Error("too late"); return schedule; @@ -8231,25 +8231,25 @@ name = name == null ? null : name + ""; for (i in schedules) { if ((schedule = schedules[i]).name !== name) { empty = false; continue; } - active = schedule.state === STARTED; + active = schedule.state > STARTING && schedule.state < ENDING; schedule.state = ENDED; schedule.timer.stop(); if (active) schedule.on.call("interrupt", node, node.__data__, schedule.index, schedule.group); delete schedules[i]; } if (empty) delete node.__transition; -} +}; var selection_interrupt = function(name) { return this.each(function() { interrupt(this, name); }); -} +}; function tweenRemove(id, name) { var tween0, tween1; return function() { var schedule = set$3(this, id), @@ -8312,11 +8312,11 @@ } return null; } return this.each((value == null ? tweenRemove : tweenFunction)(id, name, value)); -} +}; function tweenValue(transition, name, value) { var id = transition._id; transition.each(function() { @@ -8333,11 +8333,11 @@ var c; return (typeof b === "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c = color(b)) ? (b = c, interpolateRgb) : interpolateString)(a, b); -} +}; function attrRemove$1(name) { return function() { this.removeAttribute(name); }; @@ -8403,11 +8403,11 @@ var fullname = namespace(name), i = fullname === "transform" ? interpolateTransformSvg : interpolate$1; return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname) : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value)); -} +}; function attrTweenNS(fullname, value) { function tween() { var node = this, i = value.apply(node, arguments); return i && function(t) { @@ -8434,11 +8434,11 @@ if (arguments.length < 2) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error; var fullname = namespace(name); return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value)); -} +}; function delayFunction(id, value) { return function() { init(this, id).delay = +value.apply(this, arguments); }; @@ -8456,11 +8456,11 @@ return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get$1(this.node(), id).delay; -} +}; function durationFunction(id, value) { return function() { set$3(this, id).duration = +value.apply(this, arguments); }; @@ -8478,11 +8478,11 @@ return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get$1(this.node(), id).duration; -} +}; function easeConstant(id, value) { if (typeof value !== "function") throw new Error; return function() { set$3(this, id).ease = value; @@ -8493,11 +8493,11 @@ var id = this._id; return arguments.length ? this.each(easeConstant(id, value)) : get$1(this.node(), id).ease; -} +}; var transition_filter = function(match) { if (typeof match !== "function") match = matcher$1(match); for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) { @@ -8507,11 +8507,11 @@ } } } return new Transition(subgroups, this._parents, this._name, this._id); -} +}; var transition_merge = function(transition) { if (transition._id !== this._id) throw new Error; for (var groups0 = this._groups, groups1 = transition._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) { @@ -8525,11 +8525,11 @@ for (; j < m0; ++j) { merges[j] = groups0[j]; } return new Transition(merges, this._parents, this._name, this._id); -} +}; function start$1(name) { return (name + "").trim().split(/^|\s+/).every(function(t) { var i = t.indexOf("."); if (i >= 0) t = t.slice(0, i); @@ -8556,11 +8556,11 @@ var id = this._id; return arguments.length < 2 ? get$1(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener)); -} +}; function removeFunction(id) { return function() { var parent = this.parentNode; for (var i in this.__transition) if (+i !== id) return; @@ -8568,11 +8568,11 @@ }; } var transition_remove = function() { return this.on("end.remove", removeFunction(this._id)); -} +}; var transition_select = function(select$$1) { var name = this._name, id = this._id; @@ -8587,11 +8587,11 @@ } } } return new Transition(subgroups, this._parents, name, id); -} +}; var transition_selectAll = function(select$$1) { var name = this._name, id = this._id; @@ -8610,17 +8610,17 @@ } } } return new Transition(subgroups, parents, name, id); -} +}; var Selection$1 = selection.prototype.constructor; var transition_selection = function() { return new Selection$1(this._groups, this._parents); -} +}; function styleRemove$1(name, interpolate$$1) { var value00, value10, interpolate0; @@ -8672,11 +8672,11 @@ .styleTween(name, styleRemove$1(name, i)) .on("end.style." + name, styleRemoveEnd(name)) : this.styleTween(name, typeof value === "function" ? styleFunction$1(name, i, tweenValue(this, "style." + name, value)) : styleConstant$1(name, i, value), priority); -} +}; function styleTween(name, value, priority) { function tween() { var node = this, i = value.apply(node, arguments); return i && function(t) { @@ -8691,11 +8691,11 @@ var key = "style." + (name += ""); if (arguments.length < 2) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error; return this.tween(key, styleTween(name, value, priority == null ? "" : priority)); -} +}; function textConstant$1(value) { return function() { this.textContent = value; }; @@ -8710,11 +8710,11 @@ var transition_text = function(value) { return this.tween("text", typeof value === "function" ? textFunction$1(tweenValue(this, "text", value)) : textConstant$1(value == null ? "" : value + "")); -} +}; var transition_transition = function() { var name = this._name, id0 = this._id, id1 = newId(); @@ -8732,11 +8732,11 @@ } } } return new Transition(groups, this._parents, name, id1); -} +}; var id = 0; function Transition(groups, parents, name, id) { this._groups = groups; @@ -8816,11 +8816,11 @@ } } } return new Transition(groups, this._parents, name, id); -} +}; selection.prototype.interrupt = selection_interrupt; selection.prototype.transition = selection_transition; var root$1 = [null]; @@ -8838,17 +8838,17 @@ } } } return null; -} +}; var slice$4 = Array.prototype.slice; var identity$5 = function(x) { return x; -} +}; var top = 1; var right = 2; var bottom = 3; var left = 4; @@ -9100,11 +9100,11 @@ cluster.nodeSize = function(x) { return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null); }; return cluster; -} +}; var node_each = function(callback) { var node = this, current, next = [node], children, i, n; do { current = next.reverse(), next = []; @@ -9114,22 +9114,22 @@ next.push(children[i]); } } } while (next.length); return this; -} +}; var node_eachBefore = function(callback) { var node = this, nodes = [node], children, i; while (node = nodes.pop()) { callback(node), children = node.children; if (children) for (i = children.length - 1; i >= 0; --i) { nodes.push(children[i]); } } return this; -} +}; var node_eachAfter = function(callback) { var node = this, nodes = [node], next = [], children, i, n; while (node = nodes.pop()) { next.push(node), children = node.children; @@ -9139,29 +9139,29 @@ } while (node = next.pop()) { callback(node); } return this; -} +}; var node_sum = function(value) { return this.eachAfter(function(node) { var sum = +value(node.data) || 0, children = node.children, i = children && children.length; while (--i >= 0) sum += children[i].value; node.value = sum; }); -} +}; var node_sort = function(compare) { return this.eachBefore(function(node) { if (node.children) { node.children.sort(compare); } }); -} +}; var node_path = function(end) { var start = this, ancestor = leastCommonAncestor(start, end), nodes = [start]; @@ -9173,11 +9173,11 @@ while (end !== ancestor) { nodes.splice(k, 0, end); end = end.parent; } return nodes; -} +}; function leastCommonAncestor(a, b) { if (a === b) return a; var aNodes = a.ancestors(), bNodes = b.ancestors(), @@ -9196,39 +9196,39 @@ var node = this, nodes = [node]; while (node = node.parent) { nodes.push(node); } return nodes; -} +}; var node_descendants = function() { var nodes = []; this.each(function(node) { nodes.push(node); }); return nodes; -} +}; var node_leaves = function() { var leaves = []; this.eachBefore(function(node) { if (!node.children) { leaves.push(node); } }); return leaves; -} +}; var node_links = function() { var root = this, links = []; root.each(function(node) { if (node !== root) { // Don’t include the root’s parent, if any. links.push({source: node.parent, target: node}); } }); return links; -} +}; function hierarchy(data, children) { var root = new Node(data), valued = +data.value && (root.value = data.value), node, @@ -9315,15 +9315,15 @@ return { head: head, tail: node }; -} +}; var enclose = function(circles) { return encloseN(shuffle$1(circles), []); -} +}; function encloses(a, b) { var dx = b.x - a.x, dy = b.y - a.y, dr = a.r - b.r; @@ -9550,11 +9550,11 @@ } var siblings = function(circles) { packEnclose(circles); return circles; -} +}; function optional(f) { return f == null ? null : required(f); } @@ -9569,11 +9569,11 @@ var constant$6 = function(x) { return function() { return x; }; -} +}; function defaultRadius(d) { return Math.sqrt(d.value); } @@ -9609,11 +9609,11 @@ pack.padding = function(x) { return arguments.length ? (padding = typeof x === "function" ? x : constant$6(+x), pack) : padding; }; return pack; -} +}; function radiusLeaf(radius) { return function(node) { if (!node.children) { node.r = Math.max(0, +radius(node) || 0); @@ -9652,11 +9652,11 @@ var roundNode = function(node) { node.x0 = Math.round(node.x0); node.y0 = Math.round(node.y0); node.x1 = Math.round(node.x1); node.y1 = Math.round(node.y1); -} +}; var treemapDice = function(parent, x0, y0, x1, y1) { var nodes = parent.children, node, i = -1, @@ -9665,11 +9665,11 @@ while (++i < n) { node = nodes[i], node.y0 = y0, node.y1 = y1; node.x0 = x0, node.x1 = x0 += node.value * k; } -} +}; var partition = function() { var dx = 1, dy = 1, padding = 0, @@ -9715,11 +9715,11 @@ partition.padding = function(x) { return arguments.length ? (padding = +x, partition) : padding; }; return partition; -} +}; var keyPrefix$1 = "$"; var preroot = {depth: -1}; var ambiguous = {}; @@ -9786,11 +9786,11 @@ stratify.parentId = function(x) { return arguments.length ? (parentId = required(x), stratify) : parentId; }; return stratify; -} +}; function defaultSeparation$1(a, b) { return a.parent === b.parent ? 1 : 2; } @@ -10022,11 +10022,11 @@ tree.nodeSize = function(x) { return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null); }; return tree; -} +}; var treemapSlice = function(parent, x0, y0, x1, y1) { var nodes = parent.children, node, i = -1, @@ -10035,11 +10035,11 @@ while (++i < n) { node = nodes[i], node.x0 = x0, node.x1 = x1; node.y0 = y0, node.y1 = y0 += node.value * k; } -} +}; var phi = (1 + Math.sqrt(5)) / 2; function squarifyRatio(ratio, parent, x0, y0, x1, y1) { var rows = [], @@ -10186,11 +10186,11 @@ treemap.paddingLeft = function(x) { return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$6(+x), treemap) : paddingLeft; }; return treemap; -} +}; var binary = function(parent, x0, y0, x1, y1) { var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1); @@ -10231,15 +10231,15 @@ var xk = (x0 * valueRight + x1 * valueLeft) / value; partition(i, k, valueLeft, x0, y0, xk, y1); partition(k, j, valueRight, xk, y0, x1, y1); } } -} +}; var sliceDice = function(parent, x0, y0, x1, y1) { (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1); -} +}; var resquarify = (function custom(ratio) { function resquarify(parent, x0, y0, x1, y1) { if ((rows = parent._squarify) && (rows.ratio === ratio)) { @@ -10305,21 +10305,21 @@ force.y = function(_) { return arguments.length ? (y = +_, force) : y; }; return force; -} +}; var constant$7 = function(x) { return function() { return x; }; -} +}; var jiggle = function() { return (Math.random() - 0.5) * 1e-6; -} +}; function x$1(d) { return d.x + d.vx; } @@ -10385,13 +10385,20 @@ quad.r = quad[i].r; } } } - force.initialize = function(_) { - var i, n = (nodes = _).length; radii = new Array(n); + function initialize() { + if (!nodes) return; + var i, n = nodes.length; + radii = new Array(n); for (i = 0; i < n; ++i) radii[i] = +radius(nodes[i], i, nodes); + } + + force.initialize = function(_) { + nodes = _; + initialize(); }; force.iterations = function(_) { return arguments.length ? (iterations = +_, force) : iterations; }; @@ -10399,20 +10406,26 @@ force.strength = function(_) { return arguments.length ? (strength = +_, force) : strength; }; force.radius = function(_) { - return arguments.length ? (radius = typeof _ === "function" ? _ : constant$7(+_), force) : radius; + return arguments.length ? (radius = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : radius; }; return force; -} +}; function index$2(d, i) { return i; } +function find(nodeById, nodeId) { + var node = nodeById.get(nodeId); + if (!node) throw new Error("missing: " + nodeId); + return node; +} + var link = function(links) { var id = index$2, strength = defaultStrength, strengths, distance = constant$7(30), @@ -10458,12 +10471,12 @@ count[i] = 0; } for (i = 0; i < m; ++i) { link = links[i], link.index = i; - if (typeof link.source !== "object") link.source = nodeById.get(link.source); - if (typeof link.target !== "object") link.target = nodeById.get(link.target); + if (typeof link.source !== "object") link.source = find(nodeById, link.source); + if (typeof link.target !== "object") link.target = find(nodeById, link.target); ++count[link.source.index], ++count[link.target.index]; } for (i = 0, bias = new Array(m); i < m; ++i) { link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]); @@ -10513,11 +10526,11 @@ force.distance = function(_) { return arguments.length ? (distance = typeof _ === "function" ? _ : constant$7(+_), initializeDistance(), force) : distance; }; return force; -} +}; function x$2(d) { return d.x; } @@ -10653,11 +10666,11 @@ on: function(name, _) { return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name); } }; -} +}; var manyBody = function() { var nodes, node, alpha, @@ -10763,11 +10776,11 @@ force.theta = function(_) { return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2); }; return force; -} +}; var x$3 = function(x) { var strength = constant$7(0.1), nodes, strengths, @@ -10803,11 +10816,11 @@ force.x = function(_) { return arguments.length ? (x = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : x; }; return force; -} +}; var y$3 = function(y) { var strength = constant$7(0.1), nodes, strengths, @@ -10843,31 +10856,31 @@ force.y = function(_) { return arguments.length ? (y = typeof _ === "function" ? _ : constant$7(+_), initialize(), force) : y; }; return force; -} +}; function nopropagation() { exports.event.stopImmediatePropagation(); } var noevent = function() { exports.event.preventDefault(); exports.event.stopImmediatePropagation(); -} +}; var dragDisable = function(view) { var root = view.document.documentElement, selection$$1 = select(view).on("dragstart.drag", noevent, true); if ("onselectstart" in root) { selection$$1.on("selectstart.drag", noevent, true); } else { root.__noselect = root.style.MozUserSelect; root.style.MozUserSelect = "none"; } -} +}; function yesdrag(view, noclick) { var root = view.document.documentElement, selection$$1 = select(view).on("dragstart.drag", null); if (noclick) { @@ -10884,11 +10897,11 @@ var constant$8 = function(x) { return function() { return x; }; -} +}; function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) { this.target = target; this.type = type; this.subject = subject; @@ -11040,17 +11053,17 @@ var value = listeners.on.apply(listeners, arguments); return value === listeners ? drag : value; }; return drag; -} +}; var constant$9 = function(x) { return function() { return x; }; -} +}; function x$4(d) { return d[0]; } @@ -11939,11 +11952,11 @@ while (++j < m) { s0 = s1; e1 = edges[halfedges[j]]; s1 = e1.left === site ? e1.right : e1.left; - if (i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) { + if (s0 && s1 && i < s0.index && i < s1.index && triangleArea(site, s0, s1) < 0) { triangles.push([site.data, s0.data, s1.data]); } } }); @@ -11957,12 +11970,37 @@ return { source: edge.left.data, target: edge.right.data }; }); + }, + + find: function(x, y, radius) { + var that = this, + i0, i1 = that._found || 0, + cell = that.cells[i1] || that.cells[i1 = 0], + dx = x - cell.site[0], + dy = y - cell.site[1], + d2 = dx * dx + dy * dy; + + do { + cell = that.cells[i0 = i1], i1 = null; + cell.halfedges.forEach(function(e) { + var edge = that.edges[e], v = edge.left; + if ((v === cell.site || !v) && !(v = edge.right)) return; + var vx = x - v[0], + vy = y - v[1], + v2 = vx * vx + vy * vy; + if (v2 < d2) d2 = v2, i1 = v.index; + }); + } while (i1 !== null); + + that._found = i0; + + return radius == null || d2 <= radius * radius ? cell.site : null; } -} +}; var voronoi = function() { var x$$1 = x$4, y$$1 = y$4, extent = null; @@ -12003,17 +12041,17 @@ voronoi.size = function(_) { return arguments.length ? (extent = _ == null ? null : [[0, 0], [+_[0], +_[1]]], voronoi) : extent && [extent[1][0] - extent[0][0], extent[1][1] - extent[0][1]]; }; return voronoi; -} +}; var constant$10 = function(x) { return function() { return x; }; -} +}; function ZoomEvent(target, type, transform) { this.target = target; this.type = type; this.transform = transform; @@ -12075,11 +12113,11 @@ } var noevent$1 = function() { exports.event.preventDefault(); exports.event.stopImmediatePropagation(); -} +}; // Ignore right-click, since that should open the context menu. function defaultFilter$1() { return !exports.event.button; } @@ -12428,32 +12466,32 @@ var value = listeners.on.apply(listeners, arguments); return value === listeners ? zoom : value; }; return zoom; -} +}; var constant$11 = function(x) { return function() { return x; }; -} +}; var BrushEvent = function(target, type, selection) { this.target = target; this.type = type; this.selection = selection; -} +}; function nopropagation$2() { exports.event.stopImmediatePropagation(); } var noevent$2 = function() { exports.event.preventDefault(); exports.event.stopImmediatePropagation(); -} +}; var MODE_DRAG = {name: "drag"}; var MODE_SPACE = {name: "space"}; var MODE_HANDLE = {name: "handle"}; var MODE_CENTER = {name: "center"}; @@ -12574,11 +12612,11 @@ return brush$1(Y); } var brush = function() { return brush$1(XY); -} +}; function brush$1(dim) { var extent = defaultExtent$1, filter = defaultFilter$2, listeners = dispatch(brush, "start", "brush", "end"), @@ -13106,19 +13144,19 @@ chord.sortChords = function(_) { return arguments.length ? (_ == null ? sortChords = null : (sortChords = compareValue(_))._ = _, chord) : sortChords && sortChords._; }; return chord; -} +}; var slice$5 = Array.prototype.slice; var constant$12 = function(x) { return function() { return x; }; -} +}; function defaultSource(d) { return d.source; } @@ -13197,22 +13235,22 @@ ribbon.context = function(_) { return arguments.length ? ((context = _ == null ? null : _), ribbon) : context; }; return ribbon; -} +}; // Adds floating point numbers with twice the normal precision. // Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and // Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) // 305–363 (1997). // Code adapted from GeographicLib by Charles F. F. Karney, // http://geographiclib.sourceforge.net/ var adder = function() { return new Adder; -} +}; function Adder() { this.reset(); } @@ -13346,11 +13384,11 @@ if (object && streamObjectType.hasOwnProperty(object.type)) { streamObjectType[object.type](object, stream); } else { streamGeometry(object, stream); } -} +}; var areaRingSum = adder(); var areaSum = adder(); var lambda00; @@ -13416,11 +13454,11 @@ var area$2 = function(object) { areaSum.reset(); geoStream(object, areaStream); return areaSum * 2; -} +}; function spherical(cartesian) { return [atan2(cartesian[1], cartesian[0]), asin$1(cartesian[2])]; } @@ -13621,11 +13659,11 @@ ranges = range$1 = null; return lambda0$1 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0$1, phi0], [lambda1, phi1]]; -} +}; var W0; var W1; var X0; var Y0; @@ -13769,17 +13807,17 @@ // If the feature still has an undefined ccentroid, then return. if (m < epsilon2$2) return [NaN, NaN]; } return [atan2(y, x) * degrees$1, asin$1(z / sqrt$1(m)) * degrees$1]; -} +}; var constant$13 = function(x) { return function() { return x; }; -} +}; var compose = function(a, b) { function compose(x, y) { return x = a(x, y), b(x[0], x[1]); @@ -13788,11 +13826,11 @@ if (a.invert && b.invert) compose.invert = function(x, y) { return x = b.invert(x, y), x && a.invert(x[0], x[1]); }; return compose; -} +}; function rotationIdentity(lambda, phi) { return [lambda > pi$4 ? lambda - tau$4 : lambda < -pi$4 ? lambda + tau$4 : lambda, phi]; } @@ -13862,11 +13900,11 @@ coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); return coordinates[0] *= degrees$1, coordinates[1] *= degrees$1, coordinates; }; return forward; -} +}; // Generates a circle centered at [0°, 0°], with a given radius and precision. function circleStream(stream, radius, delta, direction, t0, t1) { if (!delta) return; var cosRadius = cos$1(radius), @@ -13930,11 +13968,11 @@ circle.precision = function(_) { return arguments.length ? (precision = typeof _ === "function" ? _ : constant$13(+_), circle) : precision; }; return circle; -} +}; var clipBuffer = function() { var lines = [], line; return { @@ -13953,11 +13991,11 @@ lines = []; line = null; return result; } }; -} +}; var clipLine = function(a, b, x0, y0, x1, y1) { var ax = a[0], ay = a[1], bx = b[0], @@ -14013,15 +14051,15 @@ } if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; return true; -} +}; var pointEqual = function(a, b) { return abs(a[0] - b[0]) < epsilon$4 && abs(a[1] - b[1]) < epsilon$4; -} +}; function Intersection(point, points, other, entry) { this.x = point; this.z = points; this.o = other; // another intersection @@ -14102,11 +14140,11 @@ points = current.z; isSubject = !isSubject; } while (!current.v); stream.lineEnd(); } -} +}; function link$1(array) { if (!(n = array.length)) return; var n, i = 0, @@ -14300,11 +14338,11 @@ }, extent: function(_) { return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], cache = cacheStream = null, clip) : [[x0, y0], [x1, y1]]; } }; -} +}; var lengthSum = adder(); var lambda0$2; var sinPhi0$1; var cosPhi0$1; @@ -14349,20 +14387,20 @@ var length$2 = function(object) { lengthSum.reset(); geoStream(object, lengthStream); return +lengthSum; -} +}; var coordinates = [null, null]; var object$1 = {type: "LineString", coordinates: coordinates}; var distance = function(a, b) { coordinates[0] = a; coordinates[1] = b; return length$2(object$1); -} +}; function graticuleX(y0, y1, dy) { var y = range(y0, y1 - epsilon$4, dy).concat(y1); return function(x) { return y.map(function(y) { return [x, y]; }); }; } @@ -14370,11 +14408,11 @@ function graticuleY(x0, x1, dx) { var x = range(x0, x1 - epsilon$4, dx).concat(x1); return function(y) { return x.map(function(x) { return [x, y]; }); }; } -var graticule = function() { +function graticule() { var x1, x0, X1, X0, y1, y0, Y1, Y0, dx = 10, dy = dx, DX = 90, DY = 360, x, y, X, Y, precision = 2.5; @@ -14459,10 +14497,14 @@ return graticule .extentMajor([[-180, -90 + epsilon$4], [180, 90 - epsilon$4]]) .extentMinor([[-180, -80 - epsilon$4], [180, 80 + epsilon$4]]); } +function graticule10() { + return graticule()(); +} + var interpolate$2 = function(a, b) { var x0 = a[0] * radians, y0 = a[1] * radians, x1 = b[0] * radians, y1 = b[1] * radians, @@ -14492,15 +14534,15 @@ }; interpolate.distance = d; return interpolate; -} +}; var identity$7 = function(x) { return x; -} +}; var areaSum$1 = adder(); var areaRingSum$1 = adder(); var x00; var y00; @@ -14763,15 +14805,13 @@ + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; } -var index$3 = function() { +var index$3 = function(projection, context) { var pointRadius = 4.5, - projection, projectionStream, - context, contextStream; function path(object) { if (object) { if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); @@ -14810,12 +14850,12 @@ if (!arguments.length) return pointRadius; pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); return path; }; - return path.projection(null).context(null); -} + return path.projection(projection).context(context); +}; var sum$2 = adder(); var polygonContains = function(polygon, point) { var lambda = point[0], @@ -14876,11 +14916,11 @@ // Second, count the (signed) number of times a segment crosses a lambda // from the point to the South pole. If it is zero, then the point is the // same side as the South pole. return (angle < -epsilon$4 || angle < epsilon$4 && sum$2 < -epsilon$4) ^ (winding & 1); -} +}; var clip = function(pointVisible, clipLine, interpolate, start) { return function(rotate, sink) { var line = clipLine(sink), rotatedStart = rotate.invert(start[0], start[1]), @@ -14995,11 +15035,11 @@ segments.push(ringSegments.filter(validSegment)); } return clip; }; -} +}; function validSegment(segment) { return segment.length > 1; } @@ -15272,86 +15312,77 @@ else if (phi > r) code |= 8; // above return code; } return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$4, radius - pi$4]); -} +}; -var transform$1 = function(prototype) { +var transform$1 = function(methods) { return { - stream: transform$2(prototype) + stream: transformer(methods) }; -} +}; -function transform$2(prototype) { - function T() {} - var p = T.prototype = Object.create(Transform$1.prototype); - for (var k in prototype) p[k] = prototype[k]; +function transformer(methods) { return function(stream) { - var t = new T; - t.stream = stream; - return t; + var s = new TransformStream; + for (var key in methods) s[key] = methods[key]; + s.stream = stream; + return s; }; } -function Transform$1() {} +function TransformStream() {} -Transform$1.prototype = { +TransformStream.prototype = { + constructor: TransformStream, point: function(x, y) { this.stream.point(x, y); }, sphere: function() { this.stream.sphere(); }, lineStart: function() { this.stream.lineStart(); }, lineEnd: function() { this.stream.lineEnd(); }, polygonStart: function() { this.stream.polygonStart(); }, polygonEnd: function() { this.stream.polygonEnd(); } }; -function fit(project, extent, object) { +function fitExtent(projection, extent, object) { var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], - clip = project.clipExtent && project.clipExtent(); + clip = projection.clipExtent && projection.clipExtent(); - project + projection .scale(150) .translate([0, 0]); - if (clip != null) project.clipExtent(null); + if (clip != null) projection.clipExtent(null); - geoStream(object, project.stream(boundsStream$1)); + geoStream(object, projection.stream(boundsStream$1)); var b = boundsStream$1.result(), k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - if (clip != null) project.clipExtent(clip); + if (clip != null) projection.clipExtent(clip); - return project + return projection .scale(k * 150) .translate([x, y]); } -function fitSize(project) { - return function(size, object) { - return fit(project, [[0, 0], size], object); - }; +function fitSize(projection, size, object) { + return fitExtent(projection, [[0, 0], size], object); } -function fitExtent(project) { - return function(extent, object) { - return fit(project, extent, object); - }; -} - var maxDepth = 16; var cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance) var resample = function(project, delta2) { return +delta2 ? resample$1(project, delta2) : resampleNone(project); -} +}; function resampleNone(project) { - return transform$2({ + return transformer({ point: function(x, y) { x = project(x, y); this.stream.point(x[0], x[1]); } }); @@ -15438,11 +15469,11 @@ return resampleStream; }; } -var transformRadians = transform$2({ +var transformRadians = transformer({ point: function(x, y) { this.stream.point(x * radians, y * radians); } }); @@ -15506,13 +15537,17 @@ projection.precision = function(_) { return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$1(delta2); }; - projection.fitExtent = fitExtent(projection); + projection.fitExtent = function(extent, object) { + return fitExtent(projection, extent, object); + }; - projection.fitSize = fitSize(projection); + projection.fitSize = function(size, object) { + return fitSize(projection, size, object); + }; function recenter() { projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project); var center = project(lambda, phi); dx = x - center[0] * k; @@ -15543,43 +15578,59 @@ }; return p; } +function cylindricalEqualAreaRaw(phi0) { + var cosPhi0 = cos$1(phi0); + + function forward(lambda, phi) { + return [lambda * cosPhi0, sin$1(phi) / cosPhi0]; + } + + forward.invert = function(x, y) { + return [x / cosPhi0, asin$1(y * cosPhi0)]; + }; + + return forward; +} + function conicEqualAreaRaw(y0, y1) { - var sy0 = sin$1(y0), - n = (sy0 + sin$1(y1)) / 2, - c = 1 + sy0 * (2 * n - sy0), - r0 = sqrt$1(c) / n; + var sy0 = sin$1(y0), n = (sy0 + sin$1(y1)) / 2; + // Are the parallels symmetrical around the Equator? + if (abs(n) < epsilon$4) return cylindricalEqualAreaRaw(y0); + + var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt$1(c) / n; + function project(x, y) { var r = sqrt$1(c - 2 * n * sin$1(y)) / n; return [r * sin$1(x *= n), r0 - r * cos$1(x)]; } project.invert = function(x, y) { var r0y = r0 - y; - return [atan2(x, r0y) / n, asin$1((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; + return [atan2(x, abs(r0y)) / n * sign$1(r0y), asin$1((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; }; return project; } var conicEqualArea = function() { return conicProjection(conicEqualAreaRaw) .scale(155.424) .center([0, 33.6442]); -} +}; var albers = function() { return conicEqualArea() .parallels([29.5, 45.5]) .scale(1070) .translate([480, 250]) .rotate([96, 0]) .center([-0.6, 38.7]); -} +}; // The projections must have mutually exclusive clip regions on the sphere, // as this will avoid emitting interleaving lines and polygons. function multiplex(streams) { var n = streams.length; @@ -15660,21 +15711,25 @@ .stream(pointStream); return reset(); }; - albersUsa.fitExtent = fitExtent(albersUsa); + albersUsa.fitExtent = function(extent, object) { + return fitExtent(albersUsa, extent, object); + }; - albersUsa.fitSize = fitSize(albersUsa); + albersUsa.fitSize = function(size, object) { + return fitSize(albersUsa, size, object); + }; function reset() { cache = cacheStream = null; return albersUsa; } return albersUsa.scale(1070); -} +}; function azimuthalRaw(scale) { return function(x, y) { var cx = cos$1(x), cy = cos$1(y), @@ -15709,11 +15764,11 @@ var azimuthalEqualArea = function() { return projection(azimuthalEqualAreaRaw) .scale(124.75) .clipAngle(180 - 1e-3); -} +}; var azimuthalEquidistantRaw = azimuthalRaw(function(c) { return (c = acos(c)) && c / sin$1(c); }); @@ -15723,11 +15778,11 @@ var azimuthalEquidistant = function() { return projection(azimuthalEquidistantRaw) .scale(79.4188) .clipAngle(180 - 1e-3); -} +}; function mercatorRaw(lambda, phi) { return [lambda, log$1(tan((halfPi$3 + phi) / 2))]; } @@ -15736,11 +15791,11 @@ }; var mercator = function() { return mercatorProjection(mercatorRaw) .scale(961 / tau$4); -} +}; function mercatorProjection(project) { var m = projection(project), scale = m.scale, translate = m.translate, @@ -15787,32 +15842,32 @@ return [r * sin$1(n * x), f - r * cos$1(n * x)]; } project.invert = function(x, y) { var fy = f - y, r = sign$1(n) * sqrt$1(x * x + fy * fy); - return [atan2(x, fy) / n, 2 * atan(pow$1(f / r, 1 / n)) - halfPi$3]; + return [atan2(x, abs(fy)) / n * sign$1(fy), 2 * atan(pow$1(f / r, 1 / n)) - halfPi$3]; }; return project; } var conicConformal = function() { return conicProjection(conicConformalRaw) .scale(109.5) .parallels([30, 30]); -} +}; function equirectangularRaw(lambda, phi) { return [lambda, phi]; } equirectangularRaw.invert = equirectangularRaw; var equirectangular = function() { return projection(equirectangularRaw) .scale(152.63); -} +}; function conicEquidistantRaw(y0, y1) { var cy0 = cos$1(y0), n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0), g = cy0 / n + y0; @@ -15824,21 +15879,21 @@ return [gy * sin$1(nx), g - gy * cos$1(nx)]; } project.invert = function(x, y) { var gy = g - y; - return [atan2(x, gy) / n, g - sign$1(n) * sqrt$1(x * x + gy * gy)]; + return [atan2(x, abs(gy)) / n * sign$1(gy), g - sign$1(n) * sqrt$1(x * x + gy * gy)]; }; return project; } var conicEquidistant = function() { return conicProjection(conicEquidistantRaw) .scale(131.154) .center([0, 13.9389]); -} +}; function gnomonicRaw(x, y) { var cy = cos$1(y), k = cos$1(x) * cy; return [cy * sin$1(x) / k, sin$1(y) / k]; } @@ -15847,23 +15902,65 @@ var gnomonic = function() { return projection(gnomonicRaw) .scale(144.049) .clipAngle(60); +}; + +function scaleTranslate(k, tx, ty) { + return k === 1 && tx === 0 && ty === 0 ? identity$7 : transformer({ + point: function(x, y) { + this.stream.point(x * k + tx, y * k + ty); + } + }); } +var identity$8 = function() { + var k = 1, tx = 0, ty = 0, transform = identity$7, // scale and translate + x0 = null, y0, x1, y1, clip = identity$7, // clip extent + cache, + cacheStream, + projection; + + function reset() { + cache = cacheStream = null; + return projection; + } + + return projection = { + stream: function(stream) { + return cache && cacheStream === stream ? cache : cache = transform(clip(cacheStream = stream)); + }, + clipExtent: function(_) { + return arguments.length ? (clip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$7) : clipExtent(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; + }, + scale: function(_) { + return arguments.length ? (transform = scaleTranslate(k = +_, tx, ty), reset()) : k; + }, + translate: function(_) { + return arguments.length ? (transform = scaleTranslate(k, tx = +_[0], ty = +_[1]), reset()) : [tx, ty]; + }, + fitExtent: function(extent, object) { + return fitExtent(projection, extent, object); + }, + fitSize: function(size, object) { + return fitSize(projection, size, object); + } + }; +}; + function orthographicRaw(x, y) { return [cos$1(y) * sin$1(x), sin$1(y)]; } orthographicRaw.invert = azimuthalInvert(asin$1); var orthographic = function() { return projection(orthographicRaw) .scale(249.5) .clipAngle(90 + epsilon$4); -} +}; function stereographicRaw(x, y) { var cy = cos$1(y), k = 1 + cos$1(x) * cy; return [cy * sin$1(x) / k, sin$1(y) / k]; } @@ -15874,11 +15971,11 @@ var stereographic = function() { return projection(stereographicRaw) .scale(250) .clipAngle(142); -} +}; function transverseMercatorRaw(lambda, phi) { return [log$1(tan((halfPi$3 + phi) / 2)), -lambda]; } @@ -15899,11 +15996,11 @@ return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); }; return rotate([0, 0, 90]) .scale(159.155); -} +}; exports.version = version; exports.bisect = bisectRight; exports.bisectRight = bisectRight; exports.bisectLeft = bisectLeft; @@ -16260,9 +16357,11 @@ exports.geoEquirectangular = equirectangular; exports.geoEquirectangularRaw = equirectangularRaw; exports.geoGnomonic = gnomonic; exports.geoGnomonicRaw = gnomonicRaw; exports.geoGraticule = graticule; +exports.geoGraticule10 = graticule10; +exports.geoIdentity = identity$8; exports.geoInterpolate = interpolate$2; exports.geoLength = length$2; exports.geoMercator = mercator; exports.geoMercatorRaw = mercatorRaw; exports.geoOrthographic = orthographic;