plotly.js-dist
Version:
Ready-to-use plotly.js distributed bundle.
1,331 lines (1,327 loc) • 10.8 MB
JavaScript
/**
* plotly.js v3.0.1
* Copyright 2012-2025, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
*/
(
function(root, factory) {
if (typeof module === "object" && module.exports) {
module.exports = factory();
} else {
root.moduleName = factory();
}
} (typeof self !== "undefined" ? self : this, () => {
"use strict";
var Plotly = (() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name2 in all)
__defProp(target, name2, { get: all[name2], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/version.js
var require_version = __commonJS({
"src/version.js"(exports) {
"use strict";
exports.version = "3.0.1";
}
});
// node_modules/native-promise-only/lib/npo.src.js
var require_npo_src = __commonJS({
"node_modules/native-promise-only/lib/npo.src.js"(exports, module) {
(function UMD(name2, context, definition) {
context[name2] = context[name2] || definition();
if (typeof module != "undefined" && module.exports) {
module.exports = context[name2];
} else if (typeof define == "function" && false) {
define(function $AMD$() {
return context[name2];
});
}
})("Promise", typeof window != "undefined" ? window : exports, function DEF() {
"use strict";
var builtInProp, cycle, scheduling_queue, ToString = Object.prototype.toString, timer = typeof setImmediate != "undefined" ? function timer2(fn) {
return setImmediate(fn);
} : setTimeout;
try {
Object.defineProperty({}, "x", {});
builtInProp = function builtInProp2(obj, name2, val, config) {
return Object.defineProperty(obj, name2, {
value: val,
writable: true,
configurable: config !== false
});
};
} catch (err) {
builtInProp = function builtInProp2(obj, name2, val) {
obj[name2] = val;
return obj;
};
}
scheduling_queue = /* @__PURE__ */ function Queue() {
var first, last, item;
function Item(fn, self2) {
this.fn = fn;
this.self = self2;
this.next = void 0;
}
return {
add: function add(fn, self2) {
item = new Item(fn, self2);
if (last) {
last.next = item;
} else {
first = item;
}
last = item;
item = void 0;
},
drain: function drain() {
var f = first;
first = last = cycle = void 0;
while (f) {
f.fn.call(f.self);
f = f.next;
}
}
};
}();
function schedule(fn, self2) {
scheduling_queue.add(fn, self2);
if (!cycle) {
cycle = timer(scheduling_queue.drain);
}
}
function isThenable(o) {
var _then, o_type = typeof o;
if (o != null && (o_type == "object" || o_type == "function")) {
_then = o.then;
}
return typeof _then == "function" ? _then : false;
}
function notify() {
for (var i = 0; i < this.chain.length; i++) {
notifyIsolated(
this,
this.state === 1 ? this.chain[i].success : this.chain[i].failure,
this.chain[i]
);
}
this.chain.length = 0;
}
function notifyIsolated(self2, cb, chain) {
var ret, _then;
try {
if (cb === false) {
chain.reject(self2.msg);
} else {
if (cb === true) {
ret = self2.msg;
} else {
ret = cb.call(void 0, self2.msg);
}
if (ret === chain.promise) {
chain.reject(TypeError("Promise-chain cycle"));
} else if (_then = isThenable(ret)) {
_then.call(ret, chain.resolve, chain.reject);
} else {
chain.resolve(ret);
}
}
} catch (err) {
chain.reject(err);
}
}
function resolve(msg) {
var _then, self2 = this;
if (self2.triggered) {
return;
}
self2.triggered = true;
if (self2.def) {
self2 = self2.def;
}
try {
if (_then = isThenable(msg)) {
schedule(function() {
var def_wrapper = new MakeDefWrapper(self2);
try {
_then.call(
msg,
function $resolve$() {
resolve.apply(def_wrapper, arguments);
},
function $reject$() {
reject.apply(def_wrapper, arguments);
}
);
} catch (err) {
reject.call(def_wrapper, err);
}
});
} else {
self2.msg = msg;
self2.state = 1;
if (self2.chain.length > 0) {
schedule(notify, self2);
}
}
} catch (err) {
reject.call(new MakeDefWrapper(self2), err);
}
}
function reject(msg) {
var self2 = this;
if (self2.triggered) {
return;
}
self2.triggered = true;
if (self2.def) {
self2 = self2.def;
}
self2.msg = msg;
self2.state = 2;
if (self2.chain.length > 0) {
schedule(notify, self2);
}
}
function iteratePromises(Constructor, arr, resolver, rejecter) {
for (var idx = 0; idx < arr.length; idx++) {
(function IIFE(idx2) {
Constructor.resolve(arr[idx2]).then(
function $resolver$(msg) {
resolver(idx2, msg);
},
rejecter
);
})(idx);
}
}
function MakeDefWrapper(self2) {
this.def = self2;
this.triggered = false;
}
function MakeDef(self2) {
this.promise = self2;
this.state = 0;
this.triggered = false;
this.chain = [];
this.msg = void 0;
}
function Promise2(executor) {
if (typeof executor != "function") {
throw TypeError("Not a function");
}
if (this.__NPO__ !== 0) {
throw TypeError("Not a promise");
}
this.__NPO__ = 1;
var def = new MakeDef(this);
this["then"] = function then(success, failure) {
var o = {
success: typeof success == "function" ? success : true,
failure: typeof failure == "function" ? failure : false
};
o.promise = new this.constructor(function extractChain(resolve2, reject2) {
if (typeof resolve2 != "function" || typeof reject2 != "function") {
throw TypeError("Not a function");
}
o.resolve = resolve2;
o.reject = reject2;
});
def.chain.push(o);
if (def.state !== 0) {
schedule(notify, def);
}
return o.promise;
};
this["catch"] = function $catch$(failure) {
return this.then(void 0, failure);
};
try {
executor.call(
void 0,
function publicResolve(msg) {
resolve.call(def, msg);
},
function publicReject(msg) {
reject.call(def, msg);
}
);
} catch (err) {
reject.call(def, err);
}
}
var PromisePrototype = builtInProp(
{},
"constructor",
Promise2,
/*configurable=*/
false
);
Promise2.prototype = PromisePrototype;
builtInProp(
PromisePrototype,
"__NPO__",
0,
/*configurable=*/
false
);
builtInProp(Promise2, "resolve", function Promise$resolve(msg) {
var Constructor = this;
if (msg && typeof msg == "object" && msg.__NPO__ === 1) {
return msg;
}
return new Constructor(function executor(resolve2, reject2) {
if (typeof resolve2 != "function" || typeof reject2 != "function") {
throw TypeError("Not a function");
}
resolve2(msg);
});
});
builtInProp(Promise2, "reject", function Promise$reject(msg) {
return new this(function executor(resolve2, reject2) {
if (typeof resolve2 != "function" || typeof reject2 != "function") {
throw TypeError("Not a function");
}
reject2(msg);
});
});
builtInProp(Promise2, "all", function Promise$all(arr) {
var Constructor = this;
if (ToString.call(arr) != "[object Array]") {
return Constructor.reject(TypeError("Not an array"));
}
if (arr.length === 0) {
return Constructor.resolve([]);
}
return new Constructor(function executor(resolve2, reject2) {
if (typeof resolve2 != "function" || typeof reject2 != "function") {
throw TypeError("Not a function");
}
var len = arr.length, msgs = Array(len), count = 0;
iteratePromises(Constructor, arr, function resolver(idx, msg) {
msgs[idx] = msg;
if (++count === len) {
resolve2(msgs);
}
}, reject2);
});
});
builtInProp(Promise2, "race", function Promise$race(arr) {
var Constructor = this;
if (ToString.call(arr) != "[object Array]") {
return Constructor.reject(TypeError("Not an array"));
}
return new Constructor(function executor(resolve2, reject2) {
if (typeof resolve2 != "function" || typeof reject2 != "function") {
throw TypeError("Not a function");
}
iteratePromises(Constructor, arr, function resolver(idx, msg) {
resolve2(msg);
}, reject2);
});
});
return Promise2;
});
}
});
// node_modules/@plotly/d3/d3.js
var require_d3 = __commonJS({
"node_modules/@plotly/d3/d3.js"(exports, module) {
!function() {
var d3 = {
version: "3.8.2"
};
var d3_arraySlice = [].slice, d3_array = function(list) {
return d3_arraySlice.call(list);
};
var d3_document = self.document;
function d3_documentElement(node) {
return node && (node.ownerDocument || node.document || node).documentElement;
}
function d3_window(node) {
return node && (node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView);
}
if (d3_document) {
try {
d3_array(d3_document.documentElement.childNodes)[0].nodeType;
} catch (e) {
d3_array = function(list) {
var i = list.length, array = new Array(i);
while (i--) array[i] = list[i];
return array;
};
}
}
if (!Date.now) Date.now = function() {
return +/* @__PURE__ */ new Date();
};
if (d3_document) {
try {
d3_document.createElement("DIV").style.setProperty("opacity", 0, "");
} catch (error) {
var d3_element_prototype = this.Element.prototype, d3_element_setAttribute = d3_element_prototype.setAttribute, d3_element_setAttributeNS = d3_element_prototype.setAttributeNS, d3_style_prototype = this.CSSStyleDeclaration.prototype, d3_style_setProperty = d3_style_prototype.setProperty;
d3_element_prototype.setAttribute = function(name2, value) {
d3_element_setAttribute.call(this, name2, value + "");
};
d3_element_prototype.setAttributeNS = function(space, local, value) {
d3_element_setAttributeNS.call(this, space, local, value + "");
};
d3_style_prototype.setProperty = function(name2, value, priority) {
d3_style_setProperty.call(this, name2, value + "", priority);
};
}
}
d3.ascending = d3_ascending;
function d3_ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
d3.descending = function(a, b) {
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
};
d3.min = function(array, f) {
var i = -1, n = array.length, a, b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = array[i]) != null && a > b) a = b;
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = f.call(array, array[i], i)) != null && a > b) a = b;
}
return a;
};
d3.max = function(array, f) {
var i = -1, n = array.length, a, b;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = array[i]) != null && b > a) a = b;
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {
a = b;
break;
}
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b > a) a = b;
}
return a;
};
d3.extent = function(array, f) {
var i = -1, n = array.length, a, b, c;
if (arguments.length === 1) {
while (++i < n) if ((b = array[i]) != null && b >= b) {
a = c = b;
break;
}
while (++i < n) if ((b = array[i]) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
} else {
while (++i < n) if ((b = f.call(array, array[i], i)) != null && b >= b) {
a = c = b;
break;
}
while (++i < n) if ((b = f.call(array, array[i], i)) != null) {
if (a > b) a = b;
if (c < b) c = b;
}
}
return [a, c];
};
function d3_number(x) {
return x === null ? NaN : +x;
}
function d3_numeric(x) {
return !isNaN(x);
}
d3.sum = function(array, f) {
var s = 0, n = array.length, a, i = -1;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = +array[i])) s += a;
} else {
while (++i < n) if (d3_numeric(a = +f.call(array, array[i], i))) s += a;
}
return s;
};
d3.mean = function(array, f) {
var s = 0, n = array.length, a, i = -1, j = n;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) s += a;
else --j;
} else {
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) s += a;
else --j;
}
if (j) return s / j;
};
d3.quantile = function(values, p) {
var H = (values.length - 1) * p + 1, h = Math.floor(H), v = +values[h - 1], e = H - h;
return e ? v + e * (values[h] - v) : v;
};
d3.median = function(array, f) {
var numbers = [], n = array.length, a, i = -1;
if (arguments.length === 1) {
while (++i < n) if (d3_numeric(a = d3_number(array[i]))) numbers.push(a);
} else {
while (++i < n) if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) numbers.push(a);
}
if (numbers.length) return d3.quantile(numbers.sort(d3_ascending), 0.5);
};
d3.variance = function(array, f) {
var n = array.length, m = 0, a, d, s = 0, i = -1, j = 0;
if (arguments.length === 1) {
while (++i < n) {
if (d3_numeric(a = d3_number(array[i]))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
} else {
while (++i < n) {
if (d3_numeric(a = d3_number(f.call(array, array[i], i)))) {
d = a - m;
m += d / ++j;
s += d * (a - m);
}
}
}
if (j > 1) return s / (j - 1);
};
d3.deviation = function() {
var v = d3.variance.apply(this, arguments);
return v ? Math.sqrt(v) : v;
};
function d3_bisector(compare) {
return {
left: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) < 0) lo = mid + 1;
else hi = mid;
}
return lo;
},
right: function(a, x, lo, hi) {
if (arguments.length < 3) lo = 0;
if (arguments.length < 4) hi = a.length;
while (lo < hi) {
var mid = lo + hi >>> 1;
if (compare(a[mid], x) > 0) hi = mid;
else lo = mid + 1;
}
return lo;
}
};
}
var d3_bisect = d3_bisector(d3_ascending);
d3.bisectLeft = d3_bisect.left;
d3.bisect = d3.bisectRight = d3_bisect.right;
d3.bisector = function(f) {
return d3_bisector(f.length === 1 ? function(d, x) {
return d3_ascending(f(d), x);
} : f);
};
d3.shuffle = function(array, i0, i1) {
if ((m = arguments.length) < 3) {
i1 = array.length;
if (m < 2) i0 = 0;
}
var m = i1 - i0, t, i;
while (m) {
i = Math.random() * m-- | 0;
t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t;
}
return array;
};
d3.permute = function(array, indexes) {
var i = indexes.length, permutes = new Array(i);
while (i--) permutes[i] = array[indexes[i]];
return permutes;
};
d3.pairs = function(array) {
var i = 0, n = array.length - 1, p0, p1 = array[0], pairs = new Array(n < 0 ? 0 : n);
while (i < n) pairs[i] = [p0 = p1, p1 = array[++i]];
return pairs;
};
d3.transpose = function(matrix) {
if (!(n = matrix.length)) return [];
for (var i = -1, m = d3.min(matrix, d3_transposeLength), transpose = new Array(m); ++i < m; ) {
for (var j = -1, n, row = transpose[i] = new Array(n); ++j < n; ) {
row[j] = matrix[j][i];
}
}
return transpose;
};
function d3_transposeLength(d) {
return d.length;
}
d3.zip = function() {
return d3.transpose(arguments);
};
d3.keys = function(map) {
var keys = [];
for (var key in map) keys.push(key);
return keys;
};
d3.values = function(map) {
var values = [];
for (var key in map) values.push(map[key]);
return values;
};
d3.entries = function(map) {
var entries = [];
for (var key in map) entries.push({
key,
value: map[key]
});
return entries;
};
d3.merge = function(arrays) {
var n = arrays.length, m, i = -1, j = 0, merged, array;
while (++i < n) j += arrays[i].length;
merged = new Array(j);
while (--n >= 0) {
array = arrays[n];
m = array.length;
while (--m >= 0) {
merged[--j] = array[m];
}
}
return merged;
};
var abs = Math.abs;
d3.range = function(start, stop, step) {
if (arguments.length < 3) {
step = 1;
if (arguments.length < 2) {
stop = start;
start = 0;
}
}
if ((stop - start) / step === Infinity) throw new Error("infinite range");
var range = [], k = d3_range_integerScale(abs(step)), i = -1, j;
start *= k, stop *= k, step *= k;
if (step < 0) while ((j = start + step * ++i) > stop) range.push(j / k);
else while ((j = start + step * ++i) < stop) range.push(j / k);
return range;
};
function d3_range_integerScale(x) {
var k = 1;
while (x * k % 1) k *= 10;
return k;
}
function d3_class(ctor, properties) {
for (var key in properties) {
Object.defineProperty(ctor.prototype, key, {
value: properties[key],
enumerable: false
});
}
}
d3.map = function(object, f) {
var map = new d3_Map();
if (object instanceof d3_Map) {
object.forEach(function(key2, value) {
map.set(key2, value);
});
} else if (Array.isArray(object)) {
var i = -1, n = object.length, o;
if (arguments.length === 1) while (++i < n) map.set(i, object[i]);
else while (++i < n) map.set(f.call(object, o = object[i], i), o);
} else {
for (var key in object) map.set(key, object[key]);
}
return map;
};
function d3_Map() {
this._ = /* @__PURE__ */ Object.create(null);
}
var d3_map_proto = "__proto__", d3_map_zero = "\0";
d3_class(d3_Map, {
has: d3_map_has,
get: function(key) {
return this._[d3_map_escape(key)];
},
set: function(key, value) {
return this._[d3_map_escape(key)] = value;
},
remove: d3_map_remove,
keys: d3_map_keys,
values: function() {
var values = [];
for (var key in this._) values.push(this._[key]);
return values;
},
entries: function() {
var entries = [];
for (var key in this._) entries.push({
key: d3_map_unescape(key),
value: this._[key]
});
return entries;
},
size: d3_map_size,
empty: d3_map_empty,
forEach: function(f) {
for (var key in this._) f.call(this, d3_map_unescape(key), this._[key]);
}
});
function d3_map_escape(key) {
return (key += "") === d3_map_proto || key[0] === d3_map_zero ? d3_map_zero + key : key;
}
function d3_map_unescape(key) {
return (key += "")[0] === d3_map_zero ? key.slice(1) : key;
}
function d3_map_has(key) {
return d3_map_escape(key) in this._;
}
function d3_map_remove(key) {
return (key = d3_map_escape(key)) in this._ && delete this._[key];
}
function d3_map_keys() {
var keys = [];
for (var key in this._) keys.push(d3_map_unescape(key));
return keys;
}
function d3_map_size() {
var size = 0;
for (var key in this._) ++size;
return size;
}
function d3_map_empty() {
for (var key in this._) return false;
return true;
}
d3.nest = function() {
var nest = {}, keys = [], sortKeys = [], sortValues, rollup;
function map(mapType, array, depth) {
if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
var i = -1, n = array.length, key = keys[depth++], keyValue, object, setter, valuesByKey = new d3_Map(), values;
while (++i < n) {
if (values = valuesByKey.get(keyValue = key(object = array[i]))) {
values.push(object);
} else {
valuesByKey.set(keyValue, [object]);
}
}
if (mapType) {
object = mapType();
setter = function(keyValue2, values2) {
object.set(keyValue2, map(mapType, values2, depth));
};
} else {
object = {};
setter = function(keyValue2, values2) {
object[keyValue2] = map(mapType, values2, depth);
};
}
valuesByKey.forEach(setter);
return object;
}
function entries(map2, depth) {
if (depth >= keys.length) return map2;
var array = [], sortKey = sortKeys[depth++];
map2.forEach(function(key, keyMap) {
array.push({
key,
values: entries(keyMap, depth)
});
});
return sortKey ? array.sort(function(a, b) {
return sortKey(a.key, b.key);
}) : array;
}
nest.map = function(array, mapType) {
return map(mapType, array, 0);
};
nest.entries = function(array) {
return entries(map(d3.map, array, 0), 0);
};
nest.key = function(d) {
keys.push(d);
return nest;
};
nest.sortKeys = function(order) {
sortKeys[keys.length - 1] = order;
return nest;
};
nest.sortValues = function(order) {
sortValues = order;
return nest;
};
nest.rollup = function(f) {
rollup = f;
return nest;
};
return nest;
};
d3.set = function(array) {
var set = new d3_Set();
if (array) for (var i = 0, n = array.length; i < n; ++i) set.add(array[i]);
return set;
};
function d3_Set() {
this._ = /* @__PURE__ */ Object.create(null);
}
d3_class(d3_Set, {
has: d3_map_has,
add: function(key) {
this._[d3_map_escape(key += "")] = true;
return key;
},
remove: d3_map_remove,
values: d3_map_keys,
size: d3_map_size,
empty: d3_map_empty,
forEach: function(f) {
for (var key in this._) f.call(this, d3_map_unescape(key));
}
});
d3.behavior = {};
function d3_identity(d) {
return d;
}
d3.rebind = function(target, source) {
var i = 1, n = arguments.length, method;
while (++i < n) target[method = arguments[i]] = d3_rebind(target, source, source[method]);
return target;
};
function d3_rebind(target, source, method) {
return function() {
var value = method.apply(source, arguments);
return value === source ? target : value;
};
}
function d3_vendorSymbol(object, name2) {
if (name2 in object) return name2;
name2 = name2.charAt(0).toUpperCase() + name2.slice(1);
for (var i = 0, n = d3_vendorPrefixes.length; i < n; ++i) {
var prefixName = d3_vendorPrefixes[i] + name2;
if (prefixName in object) return prefixName;
}
}
var d3_vendorPrefixes = ["webkit", "ms", "moz", "Moz", "o", "O"];
function d3_noop() {
}
d3.dispatch = function() {
var dispatch = new d3_dispatch(), i = -1, n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
return dispatch;
};
function d3_dispatch() {
}
d3_dispatch.prototype.on = function(type, listener) {
var i = type.indexOf("."), name2 = "";
if (i >= 0) {
name2 = type.slice(i + 1);
type = type.slice(0, i);
}
if (type) return arguments.length < 2 ? this[type].on(name2) : this[type].on(name2, listener);
if (arguments.length === 2) {
if (listener == null) for (type in this) {
if (this.hasOwnProperty(type)) this[type].on(name2, null);
}
return this;
}
};
function d3_dispatch_event(dispatch) {
var listeners = [], listenerByName = new d3_Map();
function event() {
var z = listeners, i = -1, n = z.length, l;
while (++i < n) if (l = z[i].on) l.apply(this, arguments);
return dispatch;
}
event.on = function(name2, listener) {
var l = listenerByName.get(name2), i;
if (arguments.length < 2) return l && l.on;
if (l) {
l.on = null;
listeners = listeners.slice(0, i = listeners.indexOf(l)).concat(listeners.slice(i + 1));
listenerByName.remove(name2);
}
if (listener) listeners.push(listenerByName.set(name2, {
on: listener
}));
return dispatch;
};
return event;
}
d3.event = null;
function d3_eventPreventDefault() {
d3.event.preventDefault();
}
function d3_eventSource() {
var e = d3.event, s;
while (s = e.sourceEvent) e = s;
return e;
}
function d3_eventDispatch(target) {
var dispatch = new d3_dispatch(), i = 0, n = arguments.length;
while (++i < n) dispatch[arguments[i]] = d3_dispatch_event(dispatch);
dispatch.of = function(thiz, argumentz) {
return function(e1) {
try {
var e0 = e1.sourceEvent = d3.event;
e1.target = target;
d3.event = e1;
dispatch[e1.type].apply(thiz, argumentz);
} finally {
d3.event = e0;
}
};
};
return dispatch;
}
d3.requote = function(s) {
return s.replace(d3_requote_re, "\\$&");
};
var d3_requote_re = /[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g;
var d3_subclass = {}.__proto__ ? function(object, prototype) {
object.__proto__ = prototype;
} : function(object, prototype) {
for (var property in prototype) object[property] = prototype[property];
};
function d3_selection(groups) {
d3_subclass(groups, d3_selectionPrototype);
return groups;
}
var d3_select = function(s, n) {
return n.querySelector(s);
}, d3_selectAll = function(s, n) {
return n.querySelectorAll(s);
}, d3_selectMatches = function(n, s) {
var d3_selectMatcher = n.matches || n[d3_vendorSymbol(n, "matchesSelector")];
d3_selectMatches = function(n2, s2) {
return d3_selectMatcher.call(n2, s2);
};
return d3_selectMatches(n, s);
};
if (typeof Sizzle === "function") {
d3_select = function(s, n) {
return Sizzle(s, n)[0] || null;
};
d3_selectAll = Sizzle;
d3_selectMatches = Sizzle.matchesSelector;
}
d3.selection = function() {
return d3.select(d3_document.documentElement);
};
var d3_selectionPrototype = d3.selection.prototype = [];
d3_selectionPrototype.select = function(selector) {
var subgroups = [], subgroup, subnode, group, node;
selector = d3_selection_selector(selector);
for (var j = -1, m = this.length; ++j < m; ) {
subgroups.push(subgroup = []);
subgroup.parentNode = (group = this[j]).parentNode;
for (var i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroup.push(subnode = selector.call(node, node.__data__, i, j));
if (subnode && "__data__" in node) subnode.__data__ = node.__data__;
} else {
subgroup.push(null);
}
}
}
return d3_selection(subgroups);
};
function d3_selection_selector(selector) {
return typeof selector === "function" ? selector : function() {
return d3_select(selector, this);
};
}
d3_selectionPrototype.selectAll = function(selector) {
var subgroups = [], subgroup, node;
selector = d3_selection_selectorAll(selector);
for (var j = -1, m = this.length; ++j < m; ) {
for (var group = this[j], i = -1, n = group.length; ++i < n; ) {
if (node = group[i]) {
subgroups.push(subgroup = d3_array(selector.call(node, node.__data__, i, j)));
subgroup.parentNode = node;
}
}
}
return d3_selection(subgroups);
};
function d3_selection_selectorAll(selector) {
return typeof selector === "function" ? selector : function() {
return d3_selectAll(selector, this);
};
}
var d3_nsXhtml = "http://www.w3.org/1999/xhtml";
var d3_nsPrefix = {
svg: "http://www.w3.org/2000/svg",
xhtml: d3_nsXhtml,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
d3.ns = {
prefix: d3_nsPrefix,
qualify: function(name2) {
var i = name2.indexOf(":"), prefix = name2;
if (i >= 0 && (prefix = name2.slice(0, i)) !== "xmlns") name2 = name2.slice(i + 1);
return d3_nsPrefix.hasOwnProperty(prefix) ? {
space: d3_nsPrefix[prefix],
local: name2
} : name2;
}
};
d3_selectionPrototype.attr = function(name2, value) {
if (arguments.length < 2) {
if (typeof name2 === "string") {
var node = this.node();
name2 = d3.ns.qualify(name2);
return name2.local ? node.getAttributeNS(name2.space, name2.local) : node.getAttribute(name2);
}
for (value in name2) this.each(d3_selection_attr(value, name2[value]));
return this;
}
return this.each(d3_selection_attr(name2, value));
};
function d3_selection_attr(name2, value) {
name2 = d3.ns.qualify(name2);
function attrNull() {
this.removeAttribute(name2);
}
function attrNullNS() {
this.removeAttributeNS(name2.space, name2.local);
}
function attrConstant() {
this.setAttribute(name2, value);
}
function attrConstantNS() {
this.setAttributeNS(name2.space, name2.local, value);
}
function attrFunction() {
var x = value.apply(this, arguments);
if (x == null) this.removeAttribute(name2);
else this.setAttribute(name2, x);
}
function attrFunctionNS() {
var x = value.apply(this, arguments);
if (x == null) this.removeAttributeNS(name2.space, name2.local);
else this.setAttributeNS(name2.space, name2.local, x);
}
return value == null ? name2.local ? attrNullNS : attrNull : typeof value === "function" ? name2.local ? attrFunctionNS : attrFunction : name2.local ? attrConstantNS : attrConstant;
}
function d3_collapse(s) {
return s.trim().replace(/\s+/g, " ");
}
d3_selectionPrototype.classed = function(name2, value) {
if (arguments.length < 2) {
if (typeof name2 === "string") {
var node = this.node(), n = (name2 = d3_selection_classes(name2)).length, i = -1;
if (value = node.classList) {
while (++i < n) if (!value.contains(name2[i])) return false;
} else {
value = node.getAttribute("class");
while (++i < n) if (!d3_selection_classedRe(name2[i]).test(value)) return false;
}
return true;
}
for (value in name2) this.each(d3_selection_classed(value, name2[value]));
return this;
}
return this.each(d3_selection_classed(name2, value));
};
function d3_selection_classedRe(name2) {
return new RegExp("(?:^|\\s+)" + d3.requote(name2) + "(?:\\s+|$)", "g");
}
function d3_selection_classes(name2) {
return (name2 + "").trim().split(/^|\s+/);
}
function d3_selection_classed(name2, value) {
name2 = d3_selection_classes(name2).map(d3_selection_classedName);
var n = name2.length;
function classedConstant() {
var i = -1;
while (++i < n) name2[i](this, value);
}
function classedFunction() {
var i = -1, x = value.apply(this, arguments);
while (++i < n) name2[i](this, x);
}
return typeof value === "function" ? classedFunction : classedConstant;
}
function d3_selection_classedName(name2) {
var re = d3_selection_classedRe(name2);
return function(node, value) {
if (c = node.classList) return value ? c.add(name2) : c.remove(name2);
var c = node.getAttribute("class") || "";
if (value) {
re.lastIndex = 0;
if (!re.test(c)) node.setAttribute("class", d3_collapse(c + " " + name2));
} else {
node.setAttribute("class", d3_collapse(c.replace(re, " ")));
}
};
}
d3_selectionPrototype.style = function(name2, value, priority) {
var n = arguments.length;
if (n < 3) {
if (typeof name2 !== "string") {
if (n < 2) value = "";
for (priority in name2) this.each(d3_selection_style(priority, name2[priority], value));
return this;
}
if (n < 2) {
var node = this.node();
return d3_window(node).getComputedStyle(node, null).getPropertyValue(name2);
}
priority = "";
}
return this.each(d3_selection_style(name2, value, priority));
};
function d3_selection_style(name2, value, priority) {
function styleNull() {
this.style.removeProperty(name2);
}
function styleConstant() {
this.style.setProperty(name2, value, priority);
}
function styleFunction() {
var x = value.apply(this, arguments);
if (x == null) this.style.removeProperty(name2);
else this.style.setProperty(name2, x, priority);
}
return value == null ? styleNull : typeof value === "function" ? styleFunction : styleConstant;
}
d3_selectionPrototype.property = function(name2, value) {
if (arguments.length < 2) {
if (typeof name2 === "string") return this.node()[name2];
for (value in name2) this.each(d3_selection_property(value, name2[value]));
return this;
}
return this.each(d3_selection_property(name2, value));
};
function d3_selection_property(name2, value) {
function propertyNull() {
delete this[name2];
}
function propertyConstant() {
this[name2] = value;
}
function propertyFunction() {
var x = value.apply(this, arguments);
if (x == null) delete this[name2];
else this[name2] = x;
}
return value == null ? propertyNull : typeof value === "function" ? propertyFunction : propertyConstant;
}
d3_selectionPrototype.text = function(value) {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
} : value == null ? function() {
this.textContent = "";
} : function() {
this.textContent = value;
}) : this.node().textContent;
};
d3_selectionPrototype.html = function(value) {
return arguments.length ? this.each(typeof value === "function" ? function() {
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
} : value == null ? function() {
this.innerHTML = "";
} : function() {
this.innerHTML = value;
}) : this.node().innerHTML;
};
d3_selectionPrototype.append = function(name2) {
name2 = d3_selection_creator(name2);
return this.select(function() {
return this.appendChild(name2.apply(this, arguments));
});
};
function d3_selection_creator(name2) {
function create() {
var document2 = this.ownerDocument, namespace = this.namespaceURI;
return namespace === d3_nsXhtml && document2.documentElement.namespaceURI === d3_nsXhtml ? document2.createElement(name2) : document2.createElementNS(namespace, name2);
}
function createNS() {
return this.ownerDocument.createElementNS(name2.space, name2.local);
}
return typeof name2 === "function" ? name2 : (name2 = d3.ns.qualify(name2)).local ? createNS : create;
}
d3_selectionPrototype.insert = function(name2, before) {
name2 = d3_selection_creator(name2);
before = d3_selection_selector(before);
return this.select(function() {
return this.insertBefore(name2.apply(this, arguments), before.apply(this, arguments) || null);
});
};
d3_selectionPrototype.remove = function() {
return this.each(d3_selectionRemove);
};
function d3_selectionRemove() {
var parent = this.parentNode;
if (parent) parent.removeChild(this);
}
d3_selectionPrototype.data = function(value, key) {
var i = -1, n = this.length, group, node;
if (!arguments.length) {
value = new Array(n = (group = this[0]).length);
while (++i < n) {
if (node = group[i]) {
value[i] = node.__data__;
}
}
return value;
}
function bind(group2, groupData) {
var i2, n2 = group2.length, m = groupData.length, n0 = Math.min(n2, m), updateNodes = new Array(m), enterNodes = new Array(m), exitNodes = new Array(n2), node2, nodeData;
if (key) {
var nodeByKeyValue = new d3_Map(), keyValues = new Array(n2), keyValue;
for (i2 = -1; ++i2 < n2; ) {
if (node2 = group2[i2]) {
if (nodeByKeyValue.has(keyValue = key.call(node2, node2.__data__, i2))) {
exitNodes[i2] = node2;
} else {
nodeByKeyValue.set(keyValue, node2);
}
keyValues[i2] = keyValue;
}
}
for (i2 = -1; ++i2 < m; ) {
if (!(node2 = nodeByKeyValue.get(keyValue = key.call(groupData, nodeData = groupData[i2], i2)))) {
enterNodes[i2] = d3_selection_dataNode(nodeData);
} else if (node2 !== true) {
updateNodes[i2] = node2;
node2.__data__ = nodeData;
}
nodeByKeyValue.set(keyValue, true);
}
for (i2 = -1; ++i2 < n2; ) {
if (i2 in keyValues && nodeByKeyValue.get(keyValues[i2]) !== true) {
exitNodes[i2] = group2[i2];
}
}
} else {
for (i2 = -1; ++i2 < n0; ) {
node2 = group2[i2];
nodeData = groupData[i2];
if (node2) {
node2.__data__ = nodeData;
updateNodes[i2] = node2;
} else {
enterNodes[i2] = d3_selection_dataNode(nodeData);
}
}
for (; i2 < m; ++i2) {
enterNodes[i2] = d3_selection_dataNode(groupData[i2]);
}
for (; i2 < n2; ++i2) {
exitNodes[i2] = group2[i2];
}
}
enterNodes.update = updateNodes;
enterNodes.parentNode = updateNodes.parentNode = exitNodes.parentNode = group2.parentNode;
enter.push(enterNodes);
update.push(updateNodes);
exit.push(exitNodes);
}
var enter = d3_selection_enter([]), update = d3_selection([]), exit = d3_selection([]);
if (typeof value === "function") {
while (++i < n) {
bind(group = this[i], value.call(group, group.parentNode.__data__, i));
}
} else {
while (++i < n) {
bind(group = this[i], value);
}
}
update.enter = function() {
return enter;
};
update.exit = function() {
return exit;
};
return update;
};
function d3_selection_dataNode(data) {
return {
__data__: data
};
}
d3_selectionPrototype.datum = function(value) {
return arguments.length ? this.property("__data__", value) : this.property("__data__");
};
d3_selectionPrototype.filter = function(filter) {
var subgroups = [], subgroup, group, node;
if (typeof filter !== "function") filter = d3_selection_filter(filter);
for (var j = 0, m = this.length; j < m; j++) {
subgroups.push(subgroup = []);
subgroup.parentNode = (group = this[j]).parentNode;
for (var i = 0, n = group.length; i < n; i++) {
if ((node = group[i]) && filter.call(node, node.__data__, i, j)) {
subgroup.push(node);
}
}
}
return d3_selection(subgroups);
};
function d3_selection_filter(selector) {
return function() {
return d3_selectMatches(this, selector);
};
}
d3_selectionPrototype.order = function() {
for (var j = -1, m = this.length; ++j < m; ) {