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