vendor/assets/javascripts/vega.js in vega-0.1.3 vs vendor/assets/javascripts/vega.js in vega-0.2.0
- old
+ new
@@ -3,13 +3,13 @@
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}));
}(this, (function (exports) { 'use strict';
var name = "vega";
- var version = "5.19.1";
+ var version$1 = "5.21.0";
var description = "The Vega visualization grammar.";
- var keywords = [
+ var keywords$1 = [
"vega",
"visualization",
"interaction",
"dataflow",
"library",
@@ -34,46 +34,46 @@
prepublishOnly: "yarn test && yarn build",
postpublish: "./schema-deploy.sh"
};
var dependencies = {
"vega-crossfilter": "~4.0.5",
- "vega-dataflow": "~5.7.3",
+ "vega-dataflow": "~5.7.4",
"vega-encode": "~4.8.3",
- "vega-event-selector": "~2.0.6",
- "vega-expression": "~4.0.1",
+ "vega-event-selector": "~3.0.0",
+ "vega-expression": "~5.0.0",
"vega-force": "~4.0.7",
"vega-format": "~1.0.4",
- "vega-functions": "~5.12.0",
+ "vega-functions": "~5.12.1",
"vega-geo": "~4.3.8",
"vega-hierarchy": "~4.0.9",
- "vega-label": "~1.0.0",
- "vega-loader": "~4.4.0",
- "vega-parser": "~6.1.3",
+ "vega-label": "~1.1.0",
+ "vega-loader": "~4.4.1",
+ "vega-parser": "~6.1.4",
"vega-projection": "~1.4.5",
"vega-regression": "~1.0.9",
"vega-runtime": "~6.1.3",
"vega-scale": "~7.1.1",
- "vega-scenegraph": "~4.9.3",
- "vega-statistics": "~1.7.9",
+ "vega-scenegraph": "~4.9.4",
+ "vega-statistics": "~1.7.10",
"vega-time": "~2.0.4",
- "vega-transforms": "~4.9.3",
- "vega-typings": "~0.19.2",
- "vega-util": "~1.16.0",
- "vega-view": "~5.9.2",
+ "vega-transforms": "~4.9.4",
+ "vega-typings": "~0.22.0",
+ "vega-util": "~1.17.0",
+ "vega-view": "~5.10.1",
"vega-view-transforms": "~4.5.8",
"vega-voronoi": "~4.1.5",
"vega-wordcloud": "~4.1.3"
};
var devDependencies = {
"vega-schema": "*"
};
- var gitHead = "f112ee55fc5ddd025df8820fce371803106a3968";
+ var gitHead = "774165e29850b66ec8b79ba52a7955f1ab936ea6";
var pkg = {
name: name,
- version: version,
+ version: version$1,
description: description,
- keywords: keywords,
+ keywords: keywords$1,
license: license,
author: author,
main: main,
module: module,
unpkg: unpkg,
@@ -185,36 +185,36 @@
}
return path;
}
- function field(field, name, opt) {
+ function field$1(field, name, opt) {
const path = splitAccessPath(field);
field = path.length === 1 ? path[0] : field;
return accessor((opt && opt.get || getter)(path), [field], name || field);
}
- const id = field('id');
- const identity = accessor(_ => _, [], 'identity');
- const zero = accessor(() => 0, [], 'zero');
- const one = accessor(() => 1, [], 'one');
+ const id = field$1('id');
+ const identity$6 = accessor(_ => _, [], 'identity');
+ const zero$2 = accessor(() => 0, [], 'zero');
+ const one$2 = accessor(() => 1, [], 'one');
const truthy = accessor(() => true, [], 'true');
const falsy = accessor(() => false, [], 'false');
- function log(method, level, input) {
+ function log$1$1(method, level, input) {
const args = [level].concat([].slice.call(input));
console[method].apply(console, args); // eslint-disable-line no-console
}
- const None = 0;
+ const None$2 = 0;
const Error$1 = 1;
const Warn = 2;
const Info = 3;
const Debug = 4;
- function logger(_, method) {
- let level = _ || None;
+ function logger(_, method, handler = log$1$1) {
+ let level = _ || None$2;
return {
level(_) {
if (arguments.length) {
level = +_;
return this;
@@ -222,26 +222,26 @@
return level;
}
},
error() {
- if (level >= Error$1) log(method || 'error', 'ERROR', arguments);
+ if (level >= Error$1) handler(method || 'error', 'ERROR', arguments);
return this;
},
warn() {
- if (level >= Warn) log(method || 'warn', 'WARN', arguments);
+ if (level >= Warn) handler(method || 'warn', 'WARN', arguments);
return this;
},
info() {
- if (level >= Info) log(method || 'log', 'INFO', arguments);
+ if (level >= Info) handler(method || 'log', 'INFO', arguments);
return this;
},
debug() {
- if (level >= Debug) log(method || 'log', 'DEBUG', arguments);
+ if (level >= Debug) handler(method || 'log', 'DEBUG', arguments);
return this;
}
};
}
@@ -312,85 +312,85 @@
b.forEach(add);
a.forEach(add);
return out;
}
- function peek(array) {
+ function peek$1(array) {
return array[array.length - 1];
}
function toNumber(_) {
return _ == null || _ === '' ? null : +_;
}
- const exp = sign => x => sign * Math.exp(x);
+ const exp$2 = sign => x => sign * Math.exp(x);
- const log$1 = sign => x => Math.log(sign * x);
+ const log$4 = sign => x => Math.log(sign * x);
- const symlog = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));
+ const symlog$1 = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));
const symexp = c => x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;
- const pow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
+ const pow$4 = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
function pan(domain, delta, lift, ground) {
const d0 = lift(domain[0]),
- d1 = lift(peek(domain)),
+ d1 = lift(peek$1(domain)),
dd = (d1 - d0) * delta;
return [ground(d0 - dd), ground(d1 - dd)];
}
function panLinear(domain, delta) {
- return pan(domain, delta, toNumber, identity);
+ return pan(domain, delta, toNumber, identity$6);
}
function panLog(domain, delta) {
var sign = Math.sign(domain[0]);
- return pan(domain, delta, log$1(sign), exp(sign));
+ return pan(domain, delta, log$4(sign), exp$2(sign));
}
function panPow(domain, delta, exponent) {
- return pan(domain, delta, pow(exponent), pow(1 / exponent));
+ return pan(domain, delta, pow$4(exponent), pow$4(1 / exponent));
}
function panSymlog(domain, delta, constant) {
- return pan(domain, delta, symlog(constant), symexp(constant));
+ return pan(domain, delta, symlog$1(constant), symexp(constant));
}
- function zoom(domain, anchor, scale, lift, ground) {
+ function zoom$1(domain, anchor, scale, lift, ground) {
const d0 = lift(domain[0]),
- d1 = lift(peek(domain)),
+ d1 = lift(peek$1(domain)),
da = anchor != null ? lift(anchor) : (d0 + d1) / 2;
return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)];
}
function zoomLinear(domain, anchor, scale) {
- return zoom(domain, anchor, scale, toNumber, identity);
+ return zoom$1(domain, anchor, scale, toNumber, identity$6);
}
function zoomLog(domain, anchor, scale) {
const sign = Math.sign(domain[0]);
- return zoom(domain, anchor, scale, log$1(sign), exp(sign));
+ return zoom$1(domain, anchor, scale, log$4(sign), exp$2(sign));
}
function zoomPow(domain, anchor, scale, exponent) {
- return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent));
+ return zoom$1(domain, anchor, scale, pow$4(exponent), pow$4(1 / exponent));
}
function zoomSymlog(domain, anchor, scale, constant) {
- return zoom(domain, anchor, scale, symlog(constant), symexp(constant));
+ return zoom$1(domain, anchor, scale, symlog$1(constant), symexp(constant));
}
function quarter(date) {
return 1 + ~~(new Date(date).getMonth() / 3);
}
function utcquarter(date) {
return 1 + ~~(new Date(date).getUTCMonth() / 3);
}
- function array(_) {
+ function array$5(_) {
return _ != null ? isArray(_) ? _ : [_] : [];
}
/**
* Span-preserving range clamp. If the span of the input range is less
* than (max - min) and an endpoint exceeds either the min or max value,
@@ -419,32 +419,32 @@
return typeof _ === 'function';
}
const DESCENDING = 'descending';
- function compare(fields, orders, opt) {
+ function compare$1(fields, orders, opt) {
opt = opt || {};
- orders = array(orders) || [];
+ orders = array$5(orders) || [];
const ord = [],
get = [],
fmap = {},
gen = opt.comparator || comparator;
- array(fields).forEach((f, i) => {
+ array$5(fields).forEach((f, i) => {
if (f == null) return;
ord.push(orders[i] === DESCENDING ? -1 : 1);
- get.push(f = isFunction(f) ? f : field(f, null, opt));
+ get.push(f = isFunction(f) ? f : field$1(f, null, opt));
(accessorFields(f) || []).forEach(_ => fmap[_] = 1);
});
return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap));
}
- const ascending = (u, v) => (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;
+ const ascending$3 = (u, v) => (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;
const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length);
const compare1 = (field, order) => function (a, b) {
- return ascending(field(a), field(b)) * order;
+ return ascending$3(field(a), field(b)) * order;
};
const compareN = (fields, orders, n) => {
orders.push(0); // pad zero for convenient lookup
@@ -453,18 +453,18 @@
c = 0,
i = -1;
while (c === 0 && ++i < n) {
f = fields[i];
- c = ascending(f(a), f(b));
+ c = ascending$3(f(a), f(b));
}
return c * orders[i];
};
};
- function constant(_) {
+ function constant$4(_) {
return isFunction(_) ? _ : () => _;
}
function debounce(delay, handler) {
let tid;
@@ -472,11 +472,11 @@
if (tid) clearTimeout(tid);
tid = setTimeout(() => (handler(e), tid = null), delay);
};
}
- function extend(_) {
+ function extend$1(_) {
for (let x, k, i = 1, len = arguments.length; i < len; ++i) {
x = arguments[i];
for (k in x) {
_[k] = x[k];
@@ -603,46 +603,46 @@
return [u, v];
}
const hop = Object.prototype.hasOwnProperty;
- function has(object, property) {
+ function has$1(object, property) {
return hop.call(object, property);
}
const NULL = {};
function fastmap(input) {
let obj = {},
test;
- function has$1(key) {
- return has(obj, key) && obj[key] !== NULL;
+ function has$1$1(key) {
+ return has$1(obj, key) && obj[key] !== NULL;
}
const map = {
size: 0,
empty: 0,
object: obj,
- has: has$1,
+ has: has$1$1,
get(key) {
- return has$1(key) ? obj[key] : undefined;
+ return has$1$1(key) ? obj[key] : undefined;
},
set(key, value) {
- if (!has$1(key)) {
+ if (!has$1$1(key)) {
++map.size;
if (obj[key] === NULL) --map.empty;
}
obj[key] = value;
return this;
},
delete(key) {
- if (has$1(key)) {
+ if (has$1$1(key)) {
--map.size;
++map.empty;
obj[key] = NULL;
}
@@ -690,11 +690,11 @@
function flush(range, value, threshold, left, right, center) {
if (!threshold && threshold !== 0) return center;
const t = +threshold;
let a = range[0],
- b = peek(range),
+ b = peek$1(range),
l; // swap endpoints if range is reversed
if (b < a) {
l = a;
a = b;
@@ -708,12 +708,17 @@
return l < r && l <= t ? left : r <= t ? right : center;
}
function inherits(child, parent, members) {
const proto = child.prototype = Object.create(parent.prototype);
- proto.constructor = child;
- return extend(proto, members);
+ Object.defineProperty(proto, 'constructor', {
+ value: child,
+ writable: true,
+ enumerable: true,
+ configurable: true
+ });
+ return extend$1(proto, members);
}
/**
* Predicate that returns true if the value lies within the span
* of the given range. The left and right flags control the use
* of inclusive (true) or exclusive (false) comparisons.
@@ -734,23 +739,23 @@
left = left === undefined || left;
right = right === undefined || right;
return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1);
}
- function isBoolean(_) {
+ function isBoolean$1(_) {
return typeof _ === 'boolean';
}
- function isDate(_) {
+ function isDate$1(_) {
return Object.prototype.toString.call(_) === '[object Date]';
}
function isIterable(_) {
return _ && isFunction(_[Symbol.iterator]);
}
- function isNumber(_) {
+ function isNumber$1(_) {
return typeof _ === 'number';
}
function isRegExp(_) {
return Object.prototype.toString.call(_) === '[object RegExp]';
@@ -760,11 +765,11 @@
return typeof _ === 'string';
}
function key(fields, flat, opt) {
if (fields) {
- fields = flat ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) : array(fields);
+ fields = flat ? array$5(fields).map(f => f.replace(/\\(.)/g, '$1')) : array$5(fields);
}
const len = fields && fields.length,
gen = opt && opt.get || getter,
map = f => gen(flat ? [f] : splitAccessPath(f));
@@ -797,11 +802,11 @@
return accessor(fn, fields, 'key');
}
function lerp(array, frac) {
const lo = array[0],
- hi = peek(array),
+ hi = peek$1(array),
f = +frac;
return !f ? lo : f === 1 ? hi : lo + f * (hi - lo);
}
const DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License)
@@ -827,17 +832,17 @@
};
clear();
return {
clear,
- has: key => has(curr, key) || has(prev, key),
- get: key => has(curr, key) ? curr[key] : has(prev, key) ? update(key, prev[key]) : undefined,
- set: (key, value) => has(curr, key) ? curr[key] = value : update(key, value)
+ has: key => has$1(curr, key) || has$1(prev, key),
+ get: key => has$1(curr, key) ? curr[key] : has$1(prev, key) ? update(key, prev[key]) : undefined,
+ set: (key, value) => has$1(curr, key) ? curr[key] = value : update(key, value)
};
}
- function merge(compare, array0, array1, output) {
+ function merge$3(compare, array0, array1, output) {
const n0 = array0.length,
n1 = array1.length;
if (!n1) return array0;
if (!n0) return array1;
const merged = output || new array0.constructor(n0 + n1);
@@ -866,11 +871,11 @@
while (--reps >= 0) s += str;
return s;
}
- function pad(str, length, padchar, align) {
+ function pad$2(str, length, padchar, align) {
const c = padchar || ' ',
s = str + '',
n = length - s.length;
return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n);
}
@@ -879,11 +884,11 @@
* the last and first values.
*/
function span(array) {
- return array && peek(array) - array[0] || 0;
+ return array && peek$1(array) - array[0] || 0;
}
function $(x) {
return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings.
// See http://timelessrepo.com/json-isnt-a-javascript-subset
@@ -892,11 +897,11 @@
function toBoolean(_) {
return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
}
- const defaultParser = _ => isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);
+ const defaultParser = _ => isNumber$1(_) ? _ : isDate$1(_) ? _ : Date.parse(_);
function toDate(_, parser) {
parser = parser || defaultParser;
return _ == null || _ === '' ? null : parser(_);
}
@@ -912,11 +917,11 @@
for (let i = 0; i < n; ++i) s[_[i]] = true;
return s;
}
- function truncate(str, length, align, ellipsis) {
+ function truncate$1(str, length, align, ellipsis) {
const e = ellipsis != null ? ellipsis : '\u2026',
s = str + '',
n = s.length,
l = Math.max(0, length - e.length);
return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e;
@@ -935,235 +940,10 @@
array.forEach(visitor);
}
}
}
- // https://... file://... //...
-
- const protocol_re = /^([A-Za-z]+:)?\/\//; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file://
-
- const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
-
- const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
- // Special treatment in node.js for the file: protocol
-
- const fileProtocol = 'file://';
- /**
- * Factory for a loader constructor that provides methods for requesting
- * files from either the network or disk, and for sanitizing request URIs.
- * @param {function} fetch - The Fetch API for HTTP network requests.
- * If null or undefined, HTTP loading will be disabled.
- * @param {object} fs - The file system interface for file loading.
- * If null or undefined, local file loading will be disabled.
- * @return {function} A loader constructor with the following signature:
- * param {object} [options] - Optional default loading options to use.
- * return {object} - A new loader instance.
- */
-
- function loaderFactory (fetch, fs) {
- return options => ({
- options: options || {},
- sanitize: sanitize,
- load: load,
- fileAccess: !!fs,
- file: fileLoader(fs),
- http: httpLoader(fetch)
- });
- }
- /**
- * Load an external resource, typically either from the web or from the local
- * filesystem. This function uses {@link sanitize} to first sanitize the uri,
- * then calls either {@link http} (for web requests) or {@link file} (for
- * filesystem loading).
- * @param {string} uri - The resource indicator (e.g., URL or filename).
- * @param {object} [options] - Optional loading options. These options will
- * override any existing default options.
- * @return {Promise} - A promise that resolves to the loaded content.
- */
-
- async function load(uri, options) {
- const opt = await this.sanitize(uri, options),
- url = opt.href;
- return opt.localFile ? this.file(url) : this.http(url, options);
- }
- /**
- * URI sanitizer function.
- * @param {string} uri - The uri (url or filename) to check.
- * @param {object} options - An options hash.
- * @return {Promise} - A promise that resolves to an object containing
- * sanitized uri data, or rejects it the input uri is deemed invalid.
- * The properties of the resolved object are assumed to be
- * valid attributes for an HTML 'a' tag. The sanitized uri *must* be
- * provided by the 'href' property of the returned object.
- */
-
-
- async function sanitize(uri, options) {
- options = extend({}, this.options, options);
- const fileAccess = this.fileAccess,
- result = {
- href: null
- };
- let isFile, loadFile, base;
- const isAllowed = allowed_re.test(uri.replace(whitespace_re, ''));
-
- if (uri == null || typeof uri !== 'string' || !isAllowed) {
- error('Sanitize failure, invalid URI: ' + $(uri));
- }
-
- const hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL
-
- if ((base = options.baseURL) && !hasProtocol) {
- // Ensure that there is a slash between the baseURL (e.g. hostname) and url
- if (!uri.startsWith('/') && base[base.length - 1] !== '/') {
- uri = '/' + uri;
- }
-
- uri = base + uri;
- } // should we load from file system?
-
-
- loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess;
-
- if (isFile) {
- // strip file protocol
- uri = uri.slice(fileProtocol.length);
- } else if (uri.startsWith('//')) {
- if (options.defaultProtocol === 'file') {
- // if is file, strip protocol and set loadFile flag
- uri = uri.slice(2);
- loadFile = true;
- } else {
- // if relative protocol (starts with '//'), prepend default protocol
- uri = (options.defaultProtocol || 'http') + ':' + uri;
- }
- } // set non-enumerable mode flag to indicate local file load
-
-
- Object.defineProperty(result, 'localFile', {
- value: !!loadFile
- }); // set uri
-
- result.href = uri; // set default result target, if specified
-
- if (options.target) {
- result.target = options.target + '';
- } // set default result rel, if specified (#1542)
-
-
- if (options.rel) {
- result.rel = options.rel + '';
- } // provide control over cross-origin image handling (#2238)
- // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
-
-
- if (options.context === 'image' && options.crossOrigin) {
- result.crossOrigin = options.crossOrigin + '';
- } // return
-
-
- return result;
- }
- /**
- * File system loader factory.
- * @param {object} fs - The file system interface.
- * @return {function} - A file loader with the following signature:
- * param {string} filename - The file system path to load.
- * param {string} filename - The file system path to load.
- * return {Promise} A promise that resolves to the file contents.
- */
-
-
- function fileLoader(fs) {
- return fs ? filename => new Promise((accept, reject) => {
- fs.readFile(filename, (error, data) => {
- if (error) reject(error);else accept(data);
- });
- }) : fileReject;
- }
- /**
- * Default file system loader that simply rejects.
- */
-
-
- async function fileReject() {
- error('No file system access.');
- }
- /**
- * HTTP request handler factory.
- * @param {function} fetch - The Fetch API method.
- * @return {function} - An http loader with the following signature:
- * param {string} url - The url to request.
- * param {object} options - An options hash.
- * return {Promise} - A promise that resolves to the file contents.
- */
-
-
- function httpLoader(fetch) {
- return fetch ? async function (url, options) {
- const opt = extend({}, this.options.http, options),
- type = options && options.response,
- response = await fetch(url, opt);
- return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
- } : httpReject;
- }
- /**
- * Default http request handler that simply rejects.
- */
-
-
- async function httpReject() {
- error('No HTTP fetch method available.');
- }
-
- const isValid = _ => _ != null && _ === _;
-
- const isBoolean$1 = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;
-
- const isDate$1 = _ => !Number.isNaN(Date.parse(_));
-
- const isNumber$1 = _ => !Number.isNaN(+_) && !(_ instanceof Date);
-
- const isInteger = _ => isNumber$1(_) && Number.isInteger(+_);
-
- const typeParsers = {
- boolean: toBoolean,
- integer: toNumber,
- number: toNumber,
- date: toDate,
- string: toString,
- unknown: identity
- };
- const typeTests = [isBoolean$1, isInteger, isNumber$1, isDate$1];
- const typeList = ['boolean', 'integer', 'number', 'date'];
- function inferType(values, field) {
- if (!values || !values.length) return 'unknown';
- const n = values.length,
- m = typeTests.length,
- a = typeTests.map((_, i) => i + 1);
-
- for (let i = 0, t = 0, j, value; i < n; ++i) {
- value = field ? values[i][field] : values[i];
-
- for (j = 0; j < m; ++j) {
- if (a[j] && isValid(value) && !typeTests[j](value)) {
- a[j] = 0;
- ++t;
- if (t === typeTests.length) return 'string';
- }
- }
- }
-
- return typeList[a.reduce((u, v) => u === 0 ? v : u, 0) - 1];
- }
- function inferTypes(data, fields) {
- return fields.reduce((types, field) => {
- types[field] = inferType(data, field);
- return types;
- }, {});
- }
-
var EOL = {},
EOF = {},
QUOTE = 34,
NEWLINE = 10,
RETURN = 13;
@@ -1199,20 +979,20 @@
var s = value + "",
length = s.length;
return length < width ? new Array(width - length + 1).join(0) + s : s;
}
- function formatYear(year) {
+ function formatYear$1(year) {
return year < 0 ? "-" + pad$1(-year, 6) : year > 9999 ? "+" + pad$1(year, 6) : pad$1(year, 4);
}
function formatDate(date) {
var hours = date.getUTCHours(),
minutes = date.getUTCMinutes(),
seconds = date.getUTCSeconds(),
milliseconds = date.getUTCMilliseconds();
- return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad$1(date.getUTCMonth() + 1, 2) + "-" + pad$1(date.getUTCDate(), 2) + (milliseconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "." + pad$1(milliseconds, 3) + "Z" : seconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "Z" : minutes || hours ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + "Z" : "");
+ return isNaN(date) ? "Invalid Date" : formatYear$1(date.getUTCFullYear()) + "-" + pad$1(date.getUTCMonth() + 1, 2) + "-" + pad$1(date.getUTCDate(), 2) + (milliseconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "." + pad$1(milliseconds, 3) + "Z" : seconds ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + ":" + pad$1(seconds, 2) + "Z" : minutes || hours ? "T" + pad$1(hours, 2) + ":" + pad$1(minutes, 2) + "Z" : "");
}
function dsvFormat (delimiter) {
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"),
DELIMITER = delimiter.charCodeAt(0);
@@ -1328,54 +1108,16 @@
formatRow: formatRow,
formatValue: formatValue
};
}
- function delimitedFormat(delimiter) {
- const parse = function (data, format) {
- const delim = {
- delimiter: delimiter
- };
- return dsv(data, format ? extend(format, delim) : delim);
- };
-
- parse.responseType = 'text';
- return parse;
- }
- function dsv(data, format) {
- if (format.header) {
- data = format.header.map($).join(format.delimiter) + '\n' + data;
- }
-
- return dsvFormat(format.delimiter).parse(data + '');
- }
- dsv.responseType = 'text';
-
- function isBuffer(_) {
- return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;
- }
-
- function json(data, format) {
- const prop = format && format.property ? field(format.property) : identity;
- return isObject(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data));
- }
- json.responseType = 'json';
-
- function parseJSON(data, format) {
- if (!isArray(data) && isIterable(data)) {
- data = [...data];
- }
-
- return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;
- }
-
- function identity$1 (x) {
+ function identity$5 (x) {
return x;
}
- function transform (transform) {
- if (transform == null) return identity$1;
+ function transform$3 (transform) {
+ if (transform == null) return identity$5;
var x0,
y0,
kx = transform.scale[0],
ky = transform.scale[1],
dx = transform.translate[0],
@@ -1392,11 +1134,11 @@
return output;
};
}
- function reverse (array, n) {
+ function reverse$1 (array, n) {
var t,
j = array.length,
i = j - n;
while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;
@@ -1414,11 +1156,11 @@
function feature$1(topology, o) {
var id = o.id,
bbox = o.bbox,
properties = o.properties == null ? {} : o.properties,
- geometry = object(topology, o);
+ geometry = object$1(topology, o);
return id == null && bbox == null ? {
type: "Feature",
properties: properties,
geometry: geometry
} : bbox == null ? {
@@ -1433,22 +1175,22 @@
properties: properties,
geometry: geometry
};
}
- function object(topology, o) {
- var transformPoint = transform(topology.transform),
+ function object$1(topology, o) {
+ var transformPoint = transform$3(topology.transform),
arcs = topology.arcs;
function arc(i, points) {
if (points.length) points.pop();
for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) {
points.push(transformPoint(a[k], k));
}
- if (i < 0) reverse(points, n);
+ if (i < 0) reverse$1(points, n);
}
function point(p) {
return transformPoint(p);
}
@@ -1606,11 +1348,11 @@
});
return fragments;
}
function mesh (topology) {
- return object(topology, meshArcs.apply(this, arguments));
+ return object$1(topology, meshArcs.apply(this, arguments));
}
function meshArcs(topology, object, filter) {
var arcs, i, n;
if (arguments.length > 1) arcs = extractArcs(topology, object, filter);else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) arcs[i] = i;
return {
@@ -1672,66 +1414,22 @@
if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i);
});
return arcs;
}
- const filters = {
- interior: (a, b) => a !== b,
- exterior: (a, b) => a === b
- };
- function topojson(data, format) {
- let method, object, property, filter;
- data = json(data, format);
-
- if (format && format.feature) {
- method = feature;
- property = format.feature;
- } else if (format && format.mesh) {
- method = mesh;
- property = format.mesh;
- filter = filters[format.filter];
- } else {
- error('Missing TopoJSON feature or mesh parameter.');
- }
-
- object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property);
- return object && object.features || [object];
- }
- topojson.responseType = 'json';
-
- const format = {
- dsv: dsv,
- csv: delimitedFormat(','),
- tsv: delimitedFormat('\t'),
- json: json,
- topojson: topojson
- };
- function formats(name, reader) {
- if (arguments.length > 1) {
- format[name] = reader;
- return this;
- } else {
- return has(format, name) ? format[name] : null;
- }
- }
- function responseType(type) {
- const f = formats(type);
- return f && f.responseType || 'text';
- }
-
- function ascending$1 (a, b) {
+ function ascending$2 (a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
- function bisector (f) {
+ function bisector$1 (f) {
let delta = f;
let compare = f;
if (f.length === 1) {
delta = (d, x) => f(d) - x;
- compare = ascendingComparator(f);
+ compare = ascendingComparator$1(f);
}
function left(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
@@ -1768,18 +1466,18 @@
center,
right
};
}
- function ascendingComparator(f) {
- return (d, x) => ascending$1(f(d), x);
+ function ascendingComparator$1(f) {
+ return (d, x) => ascending$2(f(d), x);
}
- function number (x) {
+ function number$6 (x) {
return x === null ? NaN : +x;
}
- function* numbers(values, valueof) {
+ function* numbers$2(values, valueof) {
if (valueof === undefined) {
for (let value of values) {
if (value != null && (value = +value) >= value) {
yield value;
}
@@ -1793,14 +1491,15 @@
}
}
}
}
- const ascendingBisect = bisector(ascending$1);
- const bisectRight = ascendingBisect.right;
- const bisectLeft = ascendingBisect.left;
- const bisectCenter = bisector(number).center;
+ const ascendingBisect = bisector$1(ascending$2);
+ const bisectRight$1 = ascendingBisect.right;
+ const bisectLeft$1 = ascendingBisect.left;
+ bisector$1(number$6).center;
+ var bisect$1 = bisectRight$1;
function variance(values, valueof) {
let count = 0;
let delta;
let mean = 0;
@@ -1887,10 +1586,14 @@
return hi;
}
}
+ function permute (source, keys) {
+ return Array.from(keys, key => source[key]);
+ }
+
var e10 = Math.sqrt(50),
e5 = Math.sqrt(10),
e2 = Math.sqrt(2);
function ticks (start, stop, count) {
var reverse,
@@ -1902,22 +1605,26 @@
if (start === stop && count > 0) return [start];
if (reverse = stop < start) n = start, start = stop, stop = n;
if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
if (step > 0) {
- start = Math.ceil(start / step);
- stop = Math.floor(stop / step);
- ticks = new Array(n = Math.ceil(stop - start + 1));
+ let r0 = Math.round(start / step),
+ r1 = Math.round(stop / step);
+ if (r0 * step < start) ++r0;
+ if (r1 * step > stop) --r1;
+ ticks = new Array(n = r1 - r0 + 1);
- while (++i < n) ticks[i] = (start + i) * step;
+ while (++i < n) ticks[i] = (r0 + i) * step;
} else {
step = -step;
- start = Math.ceil(start * step);
- stop = Math.floor(stop * step);
- ticks = new Array(n = Math.ceil(stop - start + 1));
+ let r0 = Math.round(start * step),
+ r1 = Math.round(stop * step);
+ if (r0 / step < start) ++r0;
+ if (r1 / step > stop) --r1;
+ ticks = new Array(n = r1 - r0 + 1);
- while (++i < n) ticks[i] = (start + i) / step;
+ while (++i < n) ticks[i] = (r0 + i) / step;
}
if (reverse) ticks.reverse();
return ticks;
}
@@ -1933,11 +1640,11 @@
error = step0 / step1;
if (error >= e10) step1 *= 10;else if (error >= e5) step1 *= 5;else if (error >= e2) step1 *= 2;
return stop < start ? -step1 : step1;
}
- function max(values, valueof) {
+ function max$2(values, valueof) {
let max;
if (valueof === undefined) {
for (const value of values) {
if (value != null && (max < value || max === undefined && value >= value)) {
@@ -1955,11 +1662,11 @@
}
return max;
}
- function min(values, valueof) {
+ function min$2(values, valueof) {
let min;
if (valueof === undefined) {
for (const value of values) {
if (value != null && (min > value || min === undefined && value >= value)) {
@@ -1979,11 +1686,11 @@
return min;
}
// ISC license, Copyright 2018 Vladimir Agafonkin.
- function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending$1) {
+ function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending$2) {
while (right > left) {
if (right - left > 600) {
const n = right - left + 1;
const m = k - left + 1;
const z = Math.log(n);
@@ -1995,48 +1702,48 @@
}
const t = array[k];
let i = left;
let j = right;
- swap(array, left, k);
- if (compare(array[right], t) > 0) swap(array, left, right);
+ swap$1(array, left, k);
+ if (compare(array[right], t) > 0) swap$1(array, left, right);
while (i < j) {
- swap(array, i, j), ++i, --j;
+ swap$1(array, i, j), ++i, --j;
while (compare(array[i], t) < 0) ++i;
while (compare(array[j], t) > 0) --j;
}
- if (compare(array[left], t) === 0) swap(array, left, j);else ++j, swap(array, j, right);
+ if (compare(array[left], t) === 0) swap$1(array, left, j);else ++j, swap$1(array, j, right);
if (j <= k) left = j + 1;
if (k <= j) right = j - 1;
}
return array;
}
- function swap(array, i, j) {
+ function swap$1(array, i, j) {
const t = array[i];
array[i] = array[j];
array[j] = t;
}
- function quantile(values, p, valueof) {
- values = Float64Array.from(numbers(values, valueof));
+ function quantile$1(values, p, valueof) {
+ values = Float64Array.from(numbers$2(values, valueof));
if (!(n = values.length)) return;
- if ((p = +p) <= 0 || n < 2) return min(values);
- if (p >= 1) return max(values);
+ if ((p = +p) <= 0 || n < 2) return min$2(values);
+ if (p >= 1) return max$2(values);
var n,
i = (n - 1) * p,
i0 = Math.floor(i),
- value0 = max(quickselect(values, i0).subarray(0, i0 + 1)),
- value1 = min(values.subarray(i0 + 1));
+ value0 = max$2(quickselect(values, i0).subarray(0, i0 + 1)),
+ value1 = min$2(values.subarray(i0 + 1));
return value0 + (value1 - value0) * (i - i0);
}
- function quantileSorted(values, p, valueof = number) {
+ function quantileSorted(values, p, valueof = number$6) {
if (!(n = values.length)) return;
if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
if (p >= 1) return +valueof(values[n - 1], n - 1, values);
var n,
i = (n - 1) * p,
@@ -2068,28 +1775,24 @@
if (count) return sum / count;
}
function median (values, valueof) {
- return quantile(values, 0.5, valueof);
+ return quantile$1(values, 0.5, valueof);
}
function* flatten(arrays) {
for (const array of arrays) {
yield* array;
}
}
- function merge$1(arrays) {
+ function merge$2(arrays) {
return Array.from(flatten(arrays));
}
- function permute (source, keys) {
- return Array.from(keys, key => source[key]);
- }
-
- function range$1 (start, stop, step) {
+ function range$1$1 (start, stop, step) {
start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
var i = -1,
n = Math.max(0, Math.ceil((stop - start) / step)) | 0,
range = new Array(n);
@@ -2262,22 +1965,22 @@
"s": formatPrefixAuto,
"X": x => Math.round(x).toString(16).toUpperCase(),
"x": x => Math.round(x).toString(16)
};
- function identity$2 (x) {
+ function identity$4 (x) {
return x;
}
- var map = Array.prototype.map,
+ var map$1 = Array.prototype.map,
prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
- function formatLocale (locale) {
- var group = locale.grouping === undefined || locale.thousands === undefined ? identity$2 : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
+ function formatLocale$1 (locale) {
+ var group = locale.grouping === undefined || locale.thousands === undefined ? identity$4 : formatGroup(map$1.call(locale.grouping, Number), locale.thousands + ""),
currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "",
currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "",
decimal = locale.decimal === undefined ? "." : locale.decimal + "",
- numerals = locale.numerals === undefined ? identity$2 : formatNumerals(map.call(locale.numerals, String)),
+ numerals = locale.numerals === undefined ? identity$4 : formatNumerals(map$1.call(locale.numerals, String)),
percent = locale.percent === undefined ? "%" : locale.percent + "",
minus = locale.minus === undefined ? "−" : locale.minus + "",
nan = locale.nan === undefined ? "NaN" : locale.nan + "";
function newFormat(specifier) {
@@ -2400,23 +2103,23 @@
format: newFormat,
formatPrefix: formatPrefix
};
}
- var locale;
- var format$1;
+ var locale$2;
+ var format$3;
var formatPrefix;
- defaultLocale({
+ defaultLocale$2({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
- function defaultLocale(definition) {
- locale = formatLocale(definition);
- format$1 = locale.format;
- formatPrefix = locale.formatPrefix;
- return locale;
+ function defaultLocale$2(definition) {
+ locale$2 = formatLocale$1(definition);
+ format$3 = locale$2.format;
+ formatPrefix = locale$2.formatPrefix;
+ return locale$2;
}
function precisionFixed (step) {
return Math.max(0, -exponent(Math.abs(step)));
}
@@ -2428,12 +2131,12 @@
function precisionRound (step, max) {
step = Math.abs(step), max = Math.abs(max) - step;
return Math.max(0, exponent(max) - exponent(step)) + 1;
}
- var t0 = new Date(),
- t1 = new Date();
+ var t0$2 = new Date(),
+ t1$1 = new Date();
function newInterval(floori, offseti, count, field) {
function interval(date) {
return floori(date = arguments.length === 0 ? new Date() : new Date(+date)), date;
}
@@ -2483,13 +2186,13 @@
});
};
if (count) {
interval.count = function (start, end) {
- t0.setTime(+start), t1.setTime(+end);
- floori(t0), floori(t1);
- return Math.floor(count(t0, t1));
+ t0$2.setTime(+start), t1$1.setTime(+end);
+ floori(t0$2), floori(t1$1);
+ return Math.floor(count(t0$2, t1$1));
};
interval.every = function (step) {
step = Math.floor(step);
return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval : interval.filter(field ? function (d) {
@@ -2521,66 +2224,74 @@
}, function (start, end) {
return (end - start) / k;
});
};
- var durationSecond = 1e3;
- var durationMinute = 6e4;
- var durationHour = 36e5;
- var durationDay = 864e5;
- var durationWeek = 6048e5;
+ var utcMillisecond = millisecond;
+ const durationSecond$1 = 1000;
+ const durationMinute$1 = durationSecond$1 * 60;
+ const durationHour$1 = durationMinute$1 * 60;
+ const durationDay$1 = durationHour$1 * 24;
+ const durationWeek$1 = durationDay$1 * 7;
+ const durationMonth$1 = durationDay$1 * 30;
+ const durationYear$1 = durationDay$1 * 365;
+
var second = newInterval(function (date) {
date.setTime(date - date.getMilliseconds());
}, function (date, step) {
- date.setTime(+date + step * durationSecond);
+ date.setTime(+date + step * durationSecond$1);
}, function (start, end) {
- return (end - start) / durationSecond;
+ return (end - start) / durationSecond$1;
}, function (date) {
return date.getUTCSeconds();
});
+ var utcSecond = second;
var minute = newInterval(function (date) {
- date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond$1);
}, function (date, step) {
- date.setTime(+date + step * durationMinute);
+ date.setTime(+date + step * durationMinute$1);
}, function (start, end) {
- return (end - start) / durationMinute;
+ return (end - start) / durationMinute$1;
}, function (date) {
return date.getMinutes();
});
+ var timeMinute = minute;
var hour = newInterval(function (date) {
- date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond$1 - date.getMinutes() * durationMinute$1);
}, function (date, step) {
- date.setTime(+date + step * durationHour);
+ date.setTime(+date + step * durationHour$1);
}, function (start, end) {
- return (end - start) / durationHour;
+ return (end - start) / durationHour$1;
}, function (date) {
return date.getHours();
});
+ var timeHour = hour;
- var day = newInterval(date => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay, date => date.getDate() - 1);
+ var day = newInterval(date => date.setHours(0, 0, 0, 0), (date, step) => date.setDate(date.getDate() + step), (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationDay$1, date => date.getDate() - 1);
+ var timeDay = day;
- function weekday(i) {
+ function weekday$1(i) {
return newInterval(function (date) {
date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
date.setHours(0, 0, 0, 0);
}, function (date, step) {
date.setDate(date.getDate() + step * 7);
}, function (start, end) {
- return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
+ return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;
});
}
- var sunday = weekday(0);
- var monday = weekday(1);
- var tuesday = weekday(2);
- var wednesday = weekday(3);
- var thursday = weekday(4);
- var friday = weekday(5);
- var saturday = weekday(6);
+ var sunday = weekday$1(0);
+ var monday = weekday$1(1);
+ weekday$1(2);
+ weekday$1(3);
+ var thursday = weekday$1(4);
+ weekday$1(5);
+ weekday$1(6);
var month = newInterval(function (date) {
date.setDate(1);
date.setHours(0, 0, 0, 0);
}, function (date, step) {
@@ -2588,10 +2299,11 @@
}, function (start, end) {
return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
}, function (date) {
return date.getMonth();
});
+ var timeMonth = month;
var year = newInterval(function (date) {
date.setMonth(0, 1);
date.setHours(0, 0, 0, 0);
}, function (date, step) {
@@ -2610,58 +2322,63 @@
}, function (date, step) {
date.setFullYear(date.getFullYear() + step * k);
});
};
+ var timeYear = year;
+
var utcMinute = newInterval(function (date) {
date.setUTCSeconds(0, 0);
}, function (date, step) {
- date.setTime(+date + step * durationMinute);
+ date.setTime(+date + step * durationMinute$1);
}, function (start, end) {
- return (end - start) / durationMinute;
+ return (end - start) / durationMinute$1;
}, function (date) {
return date.getUTCMinutes();
});
+ var utcMinute$1 = utcMinute;
var utcHour = newInterval(function (date) {
date.setUTCMinutes(0, 0, 0);
}, function (date, step) {
- date.setTime(+date + step * durationHour);
+ date.setTime(+date + step * durationHour$1);
}, function (start, end) {
- return (end - start) / durationHour;
+ return (end - start) / durationHour$1;
}, function (date) {
return date.getUTCHours();
});
+ var utcHour$1 = utcHour;
var utcDay = newInterval(function (date) {
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
date.setUTCDate(date.getUTCDate() + step);
}, function (start, end) {
- return (end - start) / durationDay;
+ return (end - start) / durationDay$1;
}, function (date) {
return date.getUTCDate() - 1;
});
+ var utcDay$1 = utcDay;
function utcWeekday(i) {
return newInterval(function (date) {
date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
date.setUTCDate(date.getUTCDate() + step * 7);
}, function (start, end) {
- return (end - start) / durationWeek;
+ return (end - start) / durationWeek$1;
});
}
var utcSunday = utcWeekday(0);
var utcMonday = utcWeekday(1);
- var utcTuesday = utcWeekday(2);
- var utcWednesday = utcWeekday(3);
+ utcWeekday(2);
+ utcWeekday(3);
var utcThursday = utcWeekday(4);
- var utcFriday = utcWeekday(5);
- var utcSaturday = utcWeekday(6);
+ utcWeekday(5);
+ utcWeekday(6);
var utcMonth = newInterval(function (date) {
date.setUTCDate(1);
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
@@ -2669,10 +2386,11 @@
}, function (start, end) {
return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
}, function (date) {
return date.getUTCMonth();
});
+ var utcMonth$1 = utcMonth;
var utcYear = newInterval(function (date) {
date.setUTCMonth(0, 1);
date.setUTCHours(0, 0, 0, 0);
}, function (date, step) {
@@ -2691,10 +2409,39 @@
}, function (date, step) {
date.setUTCFullYear(date.getUTCFullYear() + step * k);
});
};
+ var utcYear$1 = utcYear;
+
+ function ticker(year, month, week, day, hour, minute) {
+ const tickIntervals = [[utcSecond, 1, durationSecond$1], [utcSecond, 5, 5 * durationSecond$1], [utcSecond, 15, 15 * durationSecond$1], [utcSecond, 30, 30 * durationSecond$1], [minute, 1, durationMinute$1], [minute, 5, 5 * durationMinute$1], [minute, 15, 15 * durationMinute$1], [minute, 30, 30 * durationMinute$1], [hour, 1, durationHour$1], [hour, 3, 3 * durationHour$1], [hour, 6, 6 * durationHour$1], [hour, 12, 12 * durationHour$1], [day, 1, durationDay$1], [day, 2, 2 * durationDay$1], [week, 1, durationWeek$1], [month, 1, durationMonth$1], [month, 3, 3 * durationMonth$1], [year, 1, durationYear$1]];
+
+ function ticks(start, stop, count) {
+ const reverse = stop < start;
+ if (reverse) [start, stop] = [stop, start];
+ const interval = count && typeof count.range === "function" ? count : tickInterval(start, stop, count);
+ const ticks = interval ? interval.range(start, +stop + 1) : []; // inclusive stop
+
+ return reverse ? ticks.reverse() : ticks;
+ }
+
+ function tickInterval(start, stop, count) {
+ const target = Math.abs(stop - start) / count;
+ const i = bisector$1(([,, step]) => step).right(tickIntervals, target);
+ if (i === tickIntervals.length) return year.every(tickStep(start / durationYear$1, stop / durationYear$1, count));
+ if (i === 0) return utcMillisecond.every(Math.max(tickStep(start, stop, count), 1));
+ const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
+ return t.every(step);
+ }
+
+ return [ticks, tickInterval];
+ }
+
+ const [utcTicks, utcTickInterval] = ticker(utcYear$1, utcMonth$1, utcSunday, utcDay$1, utcHour$1, utcMinute$1);
+ const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, sunday, timeDay, timeHour, timeMinute);
+
const YEAR = 'year';
const QUARTER = 'quarter';
const MONTH = 'month';
const WEEK = 'week';
const DATE = 'date';
@@ -2706,25 +2453,25 @@
const MILLISECONDS = 'milliseconds';
const TIME_UNITS = [YEAR, QUARTER, MONTH, WEEK, DATE, DAY, DAYOFYEAR, HOURS, MINUTES, SECONDS, MILLISECONDS];
const UNITS = TIME_UNITS.reduce((o, u, i) => (o[u] = 1 + i, o), {});
function timeUnits(units) {
- const u = array(units).slice(),
+ const u = array$5(units).slice(),
m = {}; // check validity
if (!u.length) error('Missing time unit.');
u.forEach(unit => {
- if (has(UNITS, unit)) {
+ if (has$1(UNITS, unit)) {
m[unit] = 1;
} else {
- error("Invalid time unit: ".concat(unit, "."));
+ error(`Invalid time unit: ${unit}.`);
}
});
const numTypes = (m[WEEK] || m[DAY] ? 1 : 0) + (m[QUARTER] || m[MONTH] || m[DATE] ? 1 : 0) + (m[DAYOFYEAR] ? 1 : 0);
if (numTypes > 1) {
- error("Incompatible time units: ".concat(units));
+ error(`Incompatible time units: ${units}`);
} // ensure proper sort order
u.sort((a, b) => UNITS[a] - UNITS[b]);
return u;
@@ -2740,17 +2487,17 @@
[DAYOFYEAR]: '%j ',
[HOURS]: '%H:00',
[MINUTES]: '00:%M',
[SECONDS]: ':%S',
[MILLISECONDS]: '.%L',
- ["".concat(YEAR, "-").concat(MONTH)]: '%Y-%m ',
- ["".concat(YEAR, "-").concat(MONTH, "-").concat(DATE)]: '%Y-%m-%d ',
- ["".concat(HOURS, "-").concat(MINUTES)]: '%H:%M'
+ [`${YEAR}-${MONTH}`]: '%Y-%m ',
+ [`${YEAR}-${MONTH}-${DATE}`]: '%Y-%m-%d ',
+ [`${HOURS}-${MINUTES}`]: '%H:%M'
};
function timeUnitSpecifier(units, specifiers) {
- const s = extend({}, defaultSpecifiers, specifiers),
+ const s = extend$1({}, defaultSpecifiers, specifiers),
u = timeUnits(units),
n = u.length;
let fmt = '',
start = 0,
end,
@@ -2788,22 +2535,22 @@
function week(d) {
return localWeekNum(new Date(d));
}
function localDayOfYear(d) {
- return day.count(localYear(d.getFullYear()) - 1, d);
+ return timeDay.count(localYear(d.getFullYear()) - 1, d);
}
function localWeekNum(d) {
return sunday.count(localYear(d.getFullYear()) - 1, d);
}
function localFirst(y) {
return localYear(y).getDay();
}
- function localDate(y, m, d, H, M, S, L) {
+ function localDate$1(y, m, d, H, M, S, L) {
if (0 <= y && y < 100) {
const date = new Date(-1, m, d, H, M, S, L);
date.setFullYear(y);
return date;
}
@@ -2819,11 +2566,11 @@
return utcWeekNum(new Date(d));
}
function utcDayOfYear(d) {
const y = Date.UTC(d.getUTCFullYear(), 0, 1);
- return utcDay.count(y - 1, d);
+ return utcDay$1.count(y - 1, d);
}
function utcWeekNum(d) {
const y = Date.UTC(d.getUTCFullYear(), 0, 1);
return utcSunday.count(y - 1, d);
@@ -2832,11 +2579,11 @@
function utcFirst(y) {
t0$1.setTime(Date.UTC(y, 0, 1));
return t0$1.getUTCDay();
}
- function utcDate(y, m, d, H, M, S, L) {
+ function utcDate$1(y, m, d, H, M, S, L) {
if (0 <= y && y < 100) {
const date = new Date(Date.UTC(-1, m, d, H, M, S, L));
date.setUTCFullYear(d.y);
return date;
}
@@ -2844,25 +2591,25 @@
return new Date(Date.UTC(y, m, d, H, M, S, L));
}
function floor(units, step, get, inv, newDate) {
const s = step || 1,
- b = peek(units),
+ b = peek$1(units),
_ = (unit, p, key) => {
key = key || unit;
return getUnit(get[key], inv[key], unit === b && s, p);
};
const t = new Date(),
u = toSet(units),
- y = u[YEAR] ? _(YEAR) : constant(2012),
- m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero,
- d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one,
- H = u[HOURS] ? _(HOURS) : zero,
- M = u[MINUTES] ? _(MINUTES) : zero,
- S = u[SECONDS] ? _(SECONDS) : zero,
- L = u[MILLISECONDS] ? _(MILLISECONDS) : zero;
+ y = u[YEAR] ? _(YEAR) : constant$4(2012),
+ m = u[MONTH] ? _(MONTH) : u[QUARTER] ? _(QUARTER) : zero$2,
+ d = u[WEEK] && u[DAY] ? _(DAY, 1, WEEK + DAY) : u[WEEK] ? _(WEEK, 1) : u[DAY] ? _(DAY, 1) : u[DATE] ? _(DATE, 1) : u[DAYOFYEAR] ? _(DAYOFYEAR, 1) : one$2,
+ H = u[HOURS] ? _(HOURS) : zero$2,
+ M = u[MINUTES] ? _(MINUTES) : zero$2,
+ S = u[SECONDS] ? _(SECONDS) : zero$2,
+ L = u[MILLISECONDS] ? _(MILLISECONDS) : zero$2;
return function (v) {
t.setTime(+v);
const year = y(t);
return newDate(year, m(t), d(t, year), H(t), M(t), S(t), L(t));
};
@@ -2873,11 +2620,11 @@
return inv ? (d, y) => inv(u(d, y), y) : u;
} // returns the day of the year based on week number, day of week,
// and the day of the week for the first day of the year
- function weekday$1(week, day, firstDay) {
+ function weekday(week, day, firstDay) {
return day + week * 7 - (firstDay + 6) % 7;
} // -- LOCAL TIME --
const localGet = {
@@ -2889,20 +2636,20 @@
[MINUTES]: d => d.getMinutes(),
[SECONDS]: d => d.getSeconds(),
[MILLISECONDS]: d => d.getMilliseconds(),
[DAYOFYEAR]: d => localDayOfYear(d),
[WEEK]: d => localWeekNum(d),
- [WEEK + DAY]: (d, y) => weekday$1(localWeekNum(d), d.getDay(), localFirst(y)),
- [DAY]: (d, y) => weekday$1(1, d.getDay(), localFirst(y))
+ [WEEK + DAY]: (d, y) => weekday(localWeekNum(d), d.getDay(), localFirst(y)),
+ [DAY]: (d, y) => weekday(1, d.getDay(), localFirst(y))
};
const localInv = {
[QUARTER]: q => 3 * q,
- [WEEK]: (w, y) => weekday$1(w, 0, localFirst(y))
+ [WEEK]: (w, y) => weekday(w, 0, localFirst(y))
};
function timeFloor(units, step) {
- return floor(units, step || 1, localGet, localInv, localDate);
+ return floor(units, step || 1, localGet, localInv, localDate$1);
} // -- UTC TIME --
const utcGet = {
[YEAR]: d => d.getUTCFullYear(),
@@ -2913,103 +2660,103 @@
[MINUTES]: d => d.getUTCMinutes(),
[SECONDS]: d => d.getUTCSeconds(),
[MILLISECONDS]: d => d.getUTCMilliseconds(),
[DAYOFYEAR]: d => utcDayOfYear(d),
[WEEK]: d => utcWeekNum(d),
- [DAY]: (d, y) => weekday$1(1, d.getUTCDay(), utcFirst(y)),
- [WEEK + DAY]: (d, y) => weekday$1(utcWeekNum(d), d.getUTCDay(), utcFirst(y))
+ [DAY]: (d, y) => weekday(1, d.getUTCDay(), utcFirst(y)),
+ [WEEK + DAY]: (d, y) => weekday(utcWeekNum(d), d.getUTCDay(), utcFirst(y))
};
const utcInv = {
[QUARTER]: q => 3 * q,
- [WEEK]: (w, y) => weekday$1(w, 0, utcFirst(y))
+ [WEEK]: (w, y) => weekday(w, 0, utcFirst(y))
};
function utcFloor(units, step) {
- return floor(units, step || 1, utcGet, utcInv, utcDate);
+ return floor(units, step || 1, utcGet, utcInv, utcDate$1);
}
const timeIntervals = {
- [YEAR]: year,
- [QUARTER]: month.every(3),
- [MONTH]: month,
+ [YEAR]: timeYear,
+ [QUARTER]: timeMonth.every(3),
+ [MONTH]: timeMonth,
[WEEK]: sunday,
- [DATE]: day,
- [DAY]: day,
- [DAYOFYEAR]: day,
- [HOURS]: hour,
- [MINUTES]: minute,
- [SECONDS]: second,
- [MILLISECONDS]: millisecond
+ [DATE]: timeDay,
+ [DAY]: timeDay,
+ [DAYOFYEAR]: timeDay,
+ [HOURS]: timeHour,
+ [MINUTES]: timeMinute,
+ [SECONDS]: utcSecond,
+ [MILLISECONDS]: utcMillisecond
};
const utcIntervals = {
- [YEAR]: utcYear,
- [QUARTER]: utcMonth.every(3),
- [MONTH]: utcMonth,
+ [YEAR]: utcYear$1,
+ [QUARTER]: utcMonth$1.every(3),
+ [MONTH]: utcMonth$1,
[WEEK]: utcSunday,
- [DATE]: utcDay,
- [DAY]: utcDay,
- [DAYOFYEAR]: utcDay,
- [HOURS]: utcHour,
- [MINUTES]: utcMinute,
- [SECONDS]: second,
- [MILLISECONDS]: millisecond
+ [DATE]: utcDay$1,
+ [DAY]: utcDay$1,
+ [DAYOFYEAR]: utcDay$1,
+ [HOURS]: utcHour$1,
+ [MINUTES]: utcMinute$1,
+ [SECONDS]: utcSecond,
+ [MILLISECONDS]: utcMillisecond
};
function timeInterval(unit) {
return timeIntervals[unit];
}
function utcInterval(unit) {
return utcIntervals[unit];
}
- function offset(ival, date, step) {
+ function offset$3(ival, date, step) {
return ival ? ival.offset(date, step) : undefined;
}
function timeOffset(unit, date, step) {
- return offset(timeInterval(unit), date, step);
+ return offset$3(timeInterval(unit), date, step);
}
function utcOffset(unit, date, step) {
- return offset(utcInterval(unit), date, step);
+ return offset$3(utcInterval(unit), date, step);
}
- function sequence(ival, start, stop, step) {
+ function sequence$1(ival, start, stop, step) {
return ival ? ival.range(start, stop, step) : undefined;
}
function timeSequence(unit, start, stop, step) {
- return sequence(timeInterval(unit), start, stop, step);
+ return sequence$1(timeInterval(unit), start, stop, step);
}
function utcSequence(unit, start, stop, step) {
- return sequence(utcInterval(unit), start, stop, step);
+ return sequence$1(utcInterval(unit), start, stop, step);
}
- const durationSecond$1 = 1000,
- durationMinute$1 = durationSecond$1 * 60,
- durationHour$1 = durationMinute$1 * 60,
- durationDay$1 = durationHour$1 * 24,
- durationWeek$1 = durationDay$1 * 7,
- durationMonth = durationDay$1 * 30,
- durationYear = durationDay$1 * 365;
+ const durationSecond = 1000,
+ durationMinute = durationSecond * 60,
+ durationHour = durationMinute * 60,
+ durationDay = durationHour * 24,
+ durationWeek = durationDay * 7,
+ durationMonth = durationDay * 30,
+ durationYear = durationDay * 365;
const Milli = [YEAR, MONTH, DATE, HOURS, MINUTES, SECONDS, MILLISECONDS],
Seconds = Milli.slice(0, -1),
Minutes = Seconds.slice(0, -1),
Hours = Minutes.slice(0, -1),
Day = Hours.slice(0, -1),
Week = [YEAR, WEEK],
Month = [YEAR, MONTH],
Year = [YEAR];
- const intervals = [[Seconds, 1, durationSecond$1], [Seconds, 5, 5 * durationSecond$1], [Seconds, 15, 15 * durationSecond$1], [Seconds, 30, 30 * durationSecond$1], [Minutes, 1, durationMinute$1], [Minutes, 5, 5 * durationMinute$1], [Minutes, 15, 15 * durationMinute$1], [Minutes, 30, 30 * durationMinute$1], [Hours, 1, durationHour$1], [Hours, 3, 3 * durationHour$1], [Hours, 6, 6 * durationHour$1], [Hours, 12, 12 * durationHour$1], [Day, 1, durationDay$1], [Week, 1, durationWeek$1], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];
+ const intervals = [[Seconds, 1, durationSecond], [Seconds, 5, 5 * durationSecond], [Seconds, 15, 15 * durationSecond], [Seconds, 30, 30 * durationSecond], [Minutes, 1, durationMinute], [Minutes, 5, 5 * durationMinute], [Minutes, 15, 15 * durationMinute], [Minutes, 30, 30 * durationMinute], [Hours, 1, durationHour], [Hours, 3, 3 * durationHour], [Hours, 6, 6 * durationHour], [Hours, 12, 12 * durationHour], [Day, 1, durationDay], [Week, 1, durationWeek], [Month, 1, durationMonth], [Month, 3, 3 * durationMonth], [Year, 1, durationYear]];
- function bin(opt) {
+ function bin$1(opt) {
const ext = opt.extent,
max = opt.maxbins || 40,
target = Math.abs(span(ext)) / max;
- let i = bisector(i => i[2]).right(intervals, target),
+ let i = bisector$1(i => i[2]).right(intervals, target),
units,
step;
if (i === intervals.length) {
units = Year, step = tickStep(ext[0] / durationYear, ext[1] / durationYear, max);
@@ -3026,21 +2773,21 @@
units,
step
};
}
- function localDate$1(d) {
+ function localDate(d) {
if (0 <= d.y && d.y < 100) {
var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
date.setFullYear(d.y);
return date;
}
return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
}
- function utcDate$1(d) {
+ function utcDate(d) {
if (0 <= d.y && d.y < 100) {
var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
date.setUTCFullYear(d.y);
return date;
}
@@ -3058,11 +2805,11 @@
S: 0,
L: 0
};
}
- function formatLocale$1(locale) {
+ function formatLocale(locale) {
var locale_dateTime = locale.dateTime,
locale_date = locale.date,
locale_time = locale.time,
locale_periods = locale.periods,
locale_weekdays = locale.days,
@@ -3106,11 +2853,11 @@
"V": formatWeekNumberISO,
"w": formatWeekdayNumberSunday,
"W": formatWeekNumberMonday,
"x": null,
"X": null,
- "y": formatYear$1,
+ "y": formatYear,
"Y": formatFullYear,
"Z": formatZone,
"%": formatLiteralPercent
};
var utcFormats = {
@@ -3218,11 +2965,11 @@
function newParse(specifier, Z) {
return function (string) {
var d = newDate(1900, undefined, 1),
i = parseSpecifier(d, specifier, string += "", 0),
week,
- day$1;
+ day;
if (i != string.length) return null; // If a UNIX timestamp is specified, return it.
if ("Q" in d) return new Date(d.Q);
if ("s" in d) return new Date(d.s * 1000 + ("L" in d ? d.L : 0)); // If this is utcParse, never use the local timezone.
@@ -3235,41 +2982,41 @@
if ("V" in d) {
if (d.V < 1 || d.V > 53) return null;
if (!("w" in d)) d.w = 1;
if ("Z" in d) {
- week = utcDate$1(newDate(d.y, 0, 1)), day$1 = week.getUTCDay();
- week = day$1 > 4 || day$1 === 0 ? utcMonday.ceil(week) : utcMonday(week);
- week = utcDay.offset(week, (d.V - 1) * 7);
+ week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
+ week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
+ week = utcDay$1.offset(week, (d.V - 1) * 7);
d.y = week.getUTCFullYear();
d.m = week.getUTCMonth();
d.d = week.getUTCDate() + (d.w + 6) % 7;
} else {
- week = localDate$1(newDate(d.y, 0, 1)), day$1 = week.getDay();
- week = day$1 > 4 || day$1 === 0 ? monday.ceil(week) : monday(week);
- week = day.offset(week, (d.V - 1) * 7);
+ week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
+ week = day > 4 || day === 0 ? monday.ceil(week) : monday(week);
+ week = timeDay.offset(week, (d.V - 1) * 7);
d.y = week.getFullYear();
d.m = week.getMonth();
d.d = week.getDate() + (d.w + 6) % 7;
}
} else if ("W" in d || "U" in d) {
if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
- day$1 = "Z" in d ? utcDate$1(newDate(d.y, 0, 1)).getUTCDay() : localDate$1(newDate(d.y, 0, 1)).getDay();
+ day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
d.m = 0;
- d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$1 + 5) % 7 : d.w + d.U * 7 - (day$1 + 6) % 7;
+ d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
} // If a time zone is specified, all fields are interpreted as UTC and then
// offset according to the specified time zone.
if ("Z" in d) {
d.H += d.Z / 100 | 0;
d.M += d.Z % 100;
- return utcDate$1(d);
+ return utcDate(d);
} // Otherwise, all fields are in local time.
- return localDate$1(d);
+ return localDate(d);
};
}
function parseSpecifier(d, specifier, string, j) {
var i = 0,
@@ -3426,11 +3173,11 @@
numberRe = /^\s*\d+/,
// note: ignores next directive
percentRe = /^%/,
requoteRe = /[\\^$*+?|[\]().{}]/g;
- function pad$2(value, fill, width) {
+ function pad(value, fill, width) {
var sign = value < 0 ? "-" : "",
string = (sign ? -value : value) + "",
length = string.length;
return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
}
@@ -3546,176 +3293,176 @@
var n = numberRe.exec(string.slice(i));
return n ? (d.s = +n[0], i + n[0].length) : -1;
}
function formatDayOfMonth(d, p) {
- return pad$2(d.getDate(), p, 2);
+ return pad(d.getDate(), p, 2);
}
function formatHour24(d, p) {
- return pad$2(d.getHours(), p, 2);
+ return pad(d.getHours(), p, 2);
}
function formatHour12(d, p) {
- return pad$2(d.getHours() % 12 || 12, p, 2);
+ return pad(d.getHours() % 12 || 12, p, 2);
}
function formatDayOfYear(d, p) {
- return pad$2(1 + day.count(year(d), d), p, 3);
+ return pad(1 + timeDay.count(timeYear(d), d), p, 3);
}
function formatMilliseconds(d, p) {
- return pad$2(d.getMilliseconds(), p, 3);
+ return pad(d.getMilliseconds(), p, 3);
}
function formatMicroseconds(d, p) {
return formatMilliseconds(d, p) + "000";
}
function formatMonthNumber(d, p) {
- return pad$2(d.getMonth() + 1, p, 2);
+ return pad(d.getMonth() + 1, p, 2);
}
function formatMinutes(d, p) {
- return pad$2(d.getMinutes(), p, 2);
+ return pad(d.getMinutes(), p, 2);
}
function formatSeconds(d, p) {
- return pad$2(d.getSeconds(), p, 2);
+ return pad(d.getSeconds(), p, 2);
}
function formatWeekdayNumberMonday(d) {
var day = d.getDay();
return day === 0 ? 7 : day;
}
function formatWeekNumberSunday(d, p) {
- return pad$2(sunday.count(year(d) - 1, d), p, 2);
+ return pad(sunday.count(timeYear(d) - 1, d), p, 2);
}
function dISO(d) {
var day = d.getDay();
return day >= 4 || day === 0 ? thursday(d) : thursday.ceil(d);
}
function formatWeekNumberISO(d, p) {
d = dISO(d);
- return pad$2(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
+ return pad(thursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
}
function formatWeekdayNumberSunday(d) {
return d.getDay();
}
function formatWeekNumberMonday(d, p) {
- return pad$2(monday.count(year(d) - 1, d), p, 2);
+ return pad(monday.count(timeYear(d) - 1, d), p, 2);
}
- function formatYear$1(d, p) {
- return pad$2(d.getFullYear() % 100, p, 2);
+ function formatYear(d, p) {
+ return pad(d.getFullYear() % 100, p, 2);
}
function formatYearISO(d, p) {
d = dISO(d);
- return pad$2(d.getFullYear() % 100, p, 2);
+ return pad(d.getFullYear() % 100, p, 2);
}
function formatFullYear(d, p) {
- return pad$2(d.getFullYear() % 10000, p, 4);
+ return pad(d.getFullYear() % 10000, p, 4);
}
function formatFullYearISO(d, p) {
var day = d.getDay();
d = day >= 4 || day === 0 ? thursday(d) : thursday.ceil(d);
- return pad$2(d.getFullYear() % 10000, p, 4);
+ return pad(d.getFullYear() % 10000, p, 4);
}
function formatZone(d) {
var z = d.getTimezoneOffset();
- return (z > 0 ? "-" : (z *= -1, "+")) + pad$2(z / 60 | 0, "0", 2) + pad$2(z % 60, "0", 2);
+ return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2);
}
function formatUTCDayOfMonth(d, p) {
- return pad$2(d.getUTCDate(), p, 2);
+ return pad(d.getUTCDate(), p, 2);
}
function formatUTCHour24(d, p) {
- return pad$2(d.getUTCHours(), p, 2);
+ return pad(d.getUTCHours(), p, 2);
}
function formatUTCHour12(d, p) {
- return pad$2(d.getUTCHours() % 12 || 12, p, 2);
+ return pad(d.getUTCHours() % 12 || 12, p, 2);
}
function formatUTCDayOfYear(d, p) {
- return pad$2(1 + utcDay.count(utcYear(d), d), p, 3);
+ return pad(1 + utcDay$1.count(utcYear$1(d), d), p, 3);
}
function formatUTCMilliseconds(d, p) {
- return pad$2(d.getUTCMilliseconds(), p, 3);
+ return pad(d.getUTCMilliseconds(), p, 3);
}
function formatUTCMicroseconds(d, p) {
return formatUTCMilliseconds(d, p) + "000";
}
function formatUTCMonthNumber(d, p) {
- return pad$2(d.getUTCMonth() + 1, p, 2);
+ return pad(d.getUTCMonth() + 1, p, 2);
}
function formatUTCMinutes(d, p) {
- return pad$2(d.getUTCMinutes(), p, 2);
+ return pad(d.getUTCMinutes(), p, 2);
}
function formatUTCSeconds(d, p) {
- return pad$2(d.getUTCSeconds(), p, 2);
+ return pad(d.getUTCSeconds(), p, 2);
}
function formatUTCWeekdayNumberMonday(d) {
var dow = d.getUTCDay();
return dow === 0 ? 7 : dow;
}
function formatUTCWeekNumberSunday(d, p) {
- return pad$2(utcSunday.count(utcYear(d) - 1, d), p, 2);
+ return pad(utcSunday.count(utcYear$1(d) - 1, d), p, 2);
}
function UTCdISO(d) {
var day = d.getUTCDay();
return day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
}
function formatUTCWeekNumberISO(d, p) {
d = UTCdISO(d);
- return pad$2(utcThursday.count(utcYear(d), d) + (utcYear(d).getUTCDay() === 4), p, 2);
+ return pad(utcThursday.count(utcYear$1(d), d) + (utcYear$1(d).getUTCDay() === 4), p, 2);
}
function formatUTCWeekdayNumberSunday(d) {
return d.getUTCDay();
}
function formatUTCWeekNumberMonday(d, p) {
- return pad$2(utcMonday.count(utcYear(d) - 1, d), p, 2);
+ return pad(utcMonday.count(utcYear$1(d) - 1, d), p, 2);
}
function formatUTCYear(d, p) {
- return pad$2(d.getUTCFullYear() % 100, p, 2);
+ return pad(d.getUTCFullYear() % 100, p, 2);
}
function formatUTCYearISO(d, p) {
d = UTCdISO(d);
- return pad$2(d.getUTCFullYear() % 100, p, 2);
+ return pad(d.getUTCFullYear() % 100, p, 2);
}
function formatUTCFullYear(d, p) {
- return pad$2(d.getUTCFullYear() % 10000, p, 4);
+ return pad(d.getUTCFullYear() % 10000, p, 4);
}
function formatUTCFullYearISO(d, p) {
var day = d.getUTCDay();
d = day >= 4 || day === 0 ? utcThursday(d) : utcThursday.ceil(d);
- return pad$2(d.getUTCFullYear() % 10000, p, 4);
+ return pad(d.getUTCFullYear() % 10000, p, 4);
}
function formatUTCZone() {
return "+0000";
}
@@ -3731,14 +3478,14 @@
function formatUnixTimestampSeconds(d) {
return Math.floor(+d / 1000);
}
var locale$1;
- var timeFormat;
- var timeParse;
- var utcFormat;
- var utcParse;
+ var timeFormat$1;
+ var timeParse$1;
+ var utcFormat$1;
+ var utcParse$1;
defaultLocale$1({
dateTime: "%x, %X",
date: "%-m/%-d/%Y",
time: "%-I:%M:%S %p",
periods: ["AM", "PM"],
@@ -3746,15 +3493,15 @@
shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});
function defaultLocale$1(definition) {
- locale$1 = formatLocale$1(definition);
- timeFormat = locale$1.format;
- timeParse = locale$1.parse;
- utcFormat = locale$1.utcFormat;
- utcParse = locale$1.utcParse;
+ locale$1 = formatLocale(definition);
+ timeFormat$1 = locale$1.format;
+ timeParse$1 = locale$1.parse;
+ utcFormat$1 = locale$1.utcFormat;
+ utcParse$1 = locale$1.utcParse;
return locale$1;
}
function memoize(method) {
const cache = {};
@@ -3871,28 +3618,28 @@
let defaultNumberLocale;
resetNumberFormatDefaultLocale();
function resetNumberFormatDefaultLocale() {
return defaultNumberLocale = numberLocale({
- format: format$1,
+ format: format$3,
formatPrefix: formatPrefix
});
}
function numberFormatLocale(definition) {
- return numberLocale(formatLocale(definition));
+ return numberLocale(formatLocale$1(definition));
}
function numberFormatDefaultLocale(definition) {
return arguments.length ? defaultNumberLocale = numberFormatLocale(definition) : defaultNumberLocale;
}
function timeMultiFormat(format, interval, spec) {
spec = spec || {};
if (!isObject(spec)) {
- error("Invalid time multi-format specifier: ".concat(spec));
+ error(`Invalid time multi-format specifier: ${spec}`);
}
const second = interval(SECONDS),
minute = interval(MINUTES),
hour = interval(HOURS),
@@ -3927,34 +3674,34 @@
let defaultTimeLocale;
resetTimeFormatDefaultLocale();
function resetTimeFormatDefaultLocale() {
return defaultTimeLocale = timeLocale({
- format: timeFormat,
- parse: timeParse,
- utcFormat: utcFormat,
- utcParse: utcParse
+ format: timeFormat$1,
+ parse: timeParse$1,
+ utcFormat: utcFormat$1,
+ utcParse: utcParse$1
});
}
function timeFormatLocale(definition) {
- return timeLocale(formatLocale$1(definition));
+ return timeLocale(formatLocale(definition));
}
function timeFormatDefaultLocale(definition) {
return arguments.length ? defaultTimeLocale = timeFormatLocale(definition) : defaultTimeLocale;
}
- const createLocale = (number, time) => extend({}, number, time);
+ const createLocale = (number, time) => extend$1({}, number, time);
- function locale$2(numberSpec, timeSpec) {
+ function locale(numberSpec, timeSpec) {
const number = numberSpec ? numberFormatLocale(numberSpec) : numberFormatDefaultLocale();
const time = timeSpec ? timeFormatLocale(timeSpec) : timeFormatDefaultLocale();
return createLocale(number, time);
}
- function defaultLocale$2(numberSpec, timeSpec) {
+ function defaultLocale(numberSpec, timeSpec) {
const args = arguments.length;
if (args && args !== 2) {
error('defaultLocale expects either zero or two arguments.');
}
@@ -3963,24 +3710,338 @@
}
function resetDefaultLocale() {
resetNumberFormatDefaultLocale();
resetTimeFormatDefaultLocale();
- return defaultLocale$2();
+ return defaultLocale();
}
- function read (data, schema, timeParser, utcParser) {
+ const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file://
+
+ const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape
+
+ const whitespace_re = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g; // eslint-disable-line no-control-regex
+ // Special treatment in node.js for the file: protocol
+
+ const fileProtocol = 'file://';
+ /**
+ * Factory for a loader constructor that provides methods for requesting
+ * files from either the network or disk, and for sanitizing request URIs.
+ * @param {function} fetch - The Fetch API for HTTP network requests.
+ * If null or undefined, HTTP loading will be disabled.
+ * @param {object} fs - The file system interface for file loading.
+ * If null or undefined, local file loading will be disabled.
+ * @return {function} A loader constructor with the following signature:
+ * param {object} [options] - Optional default loading options to use.
+ * return {object} - A new loader instance.
+ */
+
+ function loaderFactory(fetch, fs) {
+ return options => ({
+ options: options || {},
+ sanitize: sanitize,
+ load: load$1,
+ fileAccess: !!fs,
+ file: fileLoader(fs),
+ http: httpLoader(fetch)
+ });
+ }
+ /**
+ * Load an external resource, typically either from the web or from the local
+ * filesystem. This function uses {@link sanitize} to first sanitize the uri,
+ * then calls either {@link http} (for web requests) or {@link file} (for
+ * filesystem loading).
+ * @param {string} uri - The resource indicator (e.g., URL or filename).
+ * @param {object} [options] - Optional loading options. These options will
+ * override any existing default options.
+ * @return {Promise} - A promise that resolves to the loaded content.
+ */
+
+
+ async function load$1(uri, options) {
+ const opt = await this.sanitize(uri, options),
+ url = opt.href;
+ return opt.localFile ? this.file(url) : this.http(url, options);
+ }
+ /**
+ * URI sanitizer function.
+ * @param {string} uri - The uri (url or filename) to check.
+ * @param {object} options - An options hash.
+ * @return {Promise} - A promise that resolves to an object containing
+ * sanitized uri data, or rejects it the input uri is deemed invalid.
+ * The properties of the resolved object are assumed to be
+ * valid attributes for an HTML 'a' tag. The sanitized uri *must* be
+ * provided by the 'href' property of the returned object.
+ */
+
+
+ async function sanitize(uri, options) {
+ options = extend$1({}, this.options, options);
+ const fileAccess = this.fileAccess,
+ result = {
+ href: null
+ };
+ let isFile, loadFile, base;
+ const isAllowed = allowed_re.test(uri.replace(whitespace_re, ''));
+
+ if (uri == null || typeof uri !== 'string' || !isAllowed) {
+ error('Sanitize failure, invalid URI: ' + $(uri));
+ }
+
+ const hasProtocol = protocol_re.test(uri); // if relative url (no protocol/host), prepend baseURL
+
+ if ((base = options.baseURL) && !hasProtocol) {
+ // Ensure that there is a slash between the baseURL (e.g. hostname) and url
+ if (!uri.startsWith('/') && !base.endsWith('/')) {
+ uri = '/' + uri;
+ }
+
+ uri = base + uri;
+ } // should we load from file system?
+
+
+ loadFile = (isFile = uri.startsWith(fileProtocol)) || options.mode === 'file' || options.mode !== 'http' && !hasProtocol && fileAccess;
+
+ if (isFile) {
+ // strip file protocol
+ uri = uri.slice(fileProtocol.length);
+ } else if (uri.startsWith('//')) {
+ if (options.defaultProtocol === 'file') {
+ // if is file, strip protocol and set loadFile flag
+ uri = uri.slice(2);
+ loadFile = true;
+ } else {
+ // if relative protocol (starts with '//'), prepend default protocol
+ uri = (options.defaultProtocol || 'http') + ':' + uri;
+ }
+ } // set non-enumerable mode flag to indicate local file load
+
+
+ Object.defineProperty(result, 'localFile', {
+ value: !!loadFile
+ }); // set uri
+
+ result.href = uri; // set default result target, if specified
+
+ if (options.target) {
+ result.target = options.target + '';
+ } // set default result rel, if specified (#1542)
+
+
+ if (options.rel) {
+ result.rel = options.rel + '';
+ } // provide control over cross-origin image handling (#2238)
+ // https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
+
+
+ if (options.context === 'image' && options.crossOrigin) {
+ result.crossOrigin = options.crossOrigin + '';
+ } // return
+
+
+ return result;
+ }
+ /**
+ * File system loader factory.
+ * @param {object} fs - The file system interface.
+ * @return {function} - A file loader with the following signature:
+ * param {string} filename - The file system path to load.
+ * param {string} filename - The file system path to load.
+ * return {Promise} A promise that resolves to the file contents.
+ */
+
+
+ function fileLoader(fs) {
+ return fs ? filename => new Promise((accept, reject) => {
+ fs.readFile(filename, (error, data) => {
+ if (error) reject(error);else accept(data);
+ });
+ }) : fileReject;
+ }
+ /**
+ * Default file system loader that simply rejects.
+ */
+
+
+ async function fileReject() {
+ error('No file system access.');
+ }
+ /**
+ * HTTP request handler factory.
+ * @param {function} fetch - The Fetch API method.
+ * @return {function} - An http loader with the following signature:
+ * param {string} url - The url to request.
+ * param {object} options - An options hash.
+ * return {Promise} - A promise that resolves to the file contents.
+ */
+
+
+ function httpLoader(fetch) {
+ return fetch ? async function (url, options) {
+ const opt = extend$1({}, this.options.http, options),
+ type = options && options.response,
+ response = await fetch(url, opt);
+ return !response.ok ? error(response.status + '' + response.statusText) : isFunction(response[type]) ? response[type]() : response.text();
+ } : httpReject;
+ }
+ /**
+ * Default http request handler that simply rejects.
+ */
+
+
+ async function httpReject() {
+ error('No HTTP fetch method available.');
+ }
+
+ const isValid = _ => _ != null && _ === _;
+
+ const isBoolean = _ => _ === 'true' || _ === 'false' || _ === true || _ === false;
+
+ const isDate = _ => !Number.isNaN(Date.parse(_));
+
+ const isNumber = _ => !Number.isNaN(+_) && !(_ instanceof Date);
+
+ const isInteger = _ => isNumber(_) && Number.isInteger(+_);
+
+ const typeParsers = {
+ boolean: toBoolean,
+ integer: toNumber,
+ number: toNumber,
+ date: toDate,
+ string: toString,
+ unknown: identity$6
+ };
+ const typeTests = [isBoolean, isInteger, isNumber, isDate];
+ const typeList = ['boolean', 'integer', 'number', 'date'];
+
+ function inferType(values, field) {
+ if (!values || !values.length) return 'unknown';
+ const n = values.length,
+ m = typeTests.length,
+ a = typeTests.map((_, i) => i + 1);
+
+ for (let i = 0, t = 0, j, value; i < n; ++i) {
+ value = field ? values[i][field] : values[i];
+
+ for (j = 0; j < m; ++j) {
+ if (a[j] && isValid(value) && !typeTests[j](value)) {
+ a[j] = 0;
+ ++t;
+ if (t === typeTests.length) return 'string';
+ }
+ }
+ }
+
+ return typeList[a.reduce((u, v) => u === 0 ? v : u, 0) - 1];
+ }
+
+ function inferTypes(data, fields) {
+ return fields.reduce((types, field) => {
+ types[field] = inferType(data, field);
+ return types;
+ }, {});
+ }
+
+ function delimitedFormat(delimiter) {
+ const parse = function (data, format) {
+ const delim = {
+ delimiter: delimiter
+ };
+ return dsv(data, format ? extend$1(format, delim) : delim);
+ };
+
+ parse.responseType = 'text';
+ return parse;
+ }
+
+ function dsv(data, format) {
+ if (format.header) {
+ data = format.header.map($).join(format.delimiter) + '\n' + data;
+ }
+
+ return dsvFormat(format.delimiter).parse(data + '');
+ }
+
+ dsv.responseType = 'text';
+
+ function isBuffer(_) {
+ return typeof Buffer === 'function' && isFunction(Buffer.isBuffer) ? Buffer.isBuffer(_) : false;
+ }
+
+ function json(data, format) {
+ const prop = format && format.property ? field$1(format.property) : identity$6;
+ return isObject(data) && !isBuffer(data) ? parseJSON(prop(data), format) : prop(JSON.parse(data));
+ }
+
+ json.responseType = 'json';
+
+ function parseJSON(data, format) {
+ if (!isArray(data) && isIterable(data)) {
+ data = [...data];
+ }
+
+ return format && format.copy ? JSON.parse(JSON.stringify(data)) : data;
+ }
+
+ const filters = {
+ interior: (a, b) => a !== b,
+ exterior: (a, b) => a === b
+ };
+
+ function topojson(data, format) {
+ let method, object, property, filter;
+ data = json(data, format);
+
+ if (format && format.feature) {
+ method = feature;
+ property = format.feature;
+ } else if (format && format.mesh) {
+ method = mesh;
+ property = format.mesh;
+ filter = filters[format.filter];
+ } else {
+ error('Missing TopoJSON feature or mesh parameter.');
+ }
+
+ object = (object = data.objects[property]) ? method(data, object, filter) : error('Invalid TopoJSON object: ' + property);
+ return object && object.features || [object];
+ }
+
+ topojson.responseType = 'json';
+ const format$2 = {
+ dsv: dsv,
+ csv: delimitedFormat(','),
+ tsv: delimitedFormat('\t'),
+ json: json,
+ topojson: topojson
+ };
+
+ function formats$1(name, reader) {
+ if (arguments.length > 1) {
+ format$2[name] = reader;
+ return this;
+ } else {
+ return has$1(format$2, name) ? format$2[name] : null;
+ }
+ }
+
+ function responseType(type) {
+ const f = formats$1(type);
+ return f && f.responseType || 'text';
+ }
+
+ function read(data, schema, timeParser, utcParser) {
schema = schema || {};
- const reader = formats(schema.type || 'json');
+ const reader = formats$1(schema.type || 'json');
if (!reader) error('Unknown data format type: ' + schema.type);
data = reader(data, schema);
- if (schema.parse) parse(data, schema.parse, timeParser, utcParser);
- if (has(data, 'columns')) delete data.columns;
+ if (schema.parse) parse$5(data, schema.parse, timeParser, utcParser);
+ if (has$1(data, 'columns')) delete data.columns;
return data;
}
- function parse(data, types, timeParser, utcParser) {
+ function parse$5(data, types, timeParser, utcParser) {
if (!data.length) return; // early exit for empty data
const locale = timeFormatDefaultLocale();
timeParser = timeParser || locale.timeParse;
utcParser = utcParser || locale.utcParse;
@@ -4030,11 +4091,11 @@
const loader = loaderFactory(typeof fetch !== 'undefined' && fetch, // use built-in fetch API
null // no file system access
);
function UniqueList(idFunc) {
- const $ = idFunc || identity,
+ const $ = idFunc || identity$6,
list = [],
ids = {};
list.add = _ => {
const id = $(_);
@@ -4121,11 +4182,11 @@
* @param datum - The value to ingest.
* @return {object} The ingested data tuple.
*/
- function ingest(datum) {
+ function ingest$1(datum) {
const t = datum === Object(datum) ? datum : {
data: datum
};
return tupleid(t) ? t : setid(t, TUPLE_ID++);
}
@@ -4135,11 +4196,11 @@
* @return {object} The derived tuple.
*/
function derive(t) {
- return rederive(t, ingest({}));
+ return rederive(t, ingest$1({}));
}
/**
* Rederive a derived tuple by copying values from the source tuple.
* @param {object} t - The source tuple.
* @param {object} d - The derived tuple.
@@ -4158,11 +4219,11 @@
* @param {object} d - The new tuple that replaces the old.
* @return {object} The new tuple.
*/
- function replace(t, d) {
+ function replace$1(t, d) {
return setid(d, tupleid(t));
}
/**
* Generate an augmented comparator function that provides stable
* sorting by tuple id when the given comparator produces ties.
@@ -4195,32 +4256,32 @@
reflow = false;
return {
constructor: changeset,
insert(t) {
- const d = array(t),
+ const d = array$5(t),
n = d.length;
for (let i = 0; i < n; ++i) add.push(d[i]);
return this;
},
remove(t) {
const a = isFunction(t) ? remp : rem,
- d = array(t),
+ d = array$5(t),
n = d.length;
for (let i = 0; i < n; ++i) a.push(d[i]);
return this;
},
modify(t, field, value) {
const m = {
field: field,
- value: constant(value)
+ value: constant$4(value)
};
if (isFunction(t)) {
m.filter = t;
modp.push(m);
@@ -4285,11 +4346,11 @@
// tuple already resides in dataset
// if flagged for both add and remove, cancel
cur[id] = 1;
} else {
// tuple does not reside in dataset, add
- pulse.add.push(ingest(add[i]));
+ pulse.add.push(ingest$1(add[i]));
}
} // populate pulse rem list
for (i = 0, n = tuples.length; i < n; ++i) {
@@ -4438,11 +4499,11 @@
};
let OP_ID = 0;
const PULSE = 'pulse',
NO_PARAMS = new Parameters(); // Boolean Flags
- const SKIP = 1,
+ const SKIP$1$1 = 1,
MODIFIED = 2;
/**
* An Operator is a processing node in a dataflow graph.
* Each operator stores a value and an optional value update function.
* Operators can accept a hash of named parameters. Parameter values can
@@ -4513,11 +4574,11 @@
* Indicates that operator evaluation should be skipped on the next pulse.
* This operator will still propagate incoming pulses, but its update function
* will not be invoked. The skip flag is reset after every pulse, so calling
* this method will affect processing of the next pulse only.
*/
- skip: flag(SKIP),
+ skip: flag(SKIP$1$1),
/**
* Indicates that this operator's value has been modified on its most recent
* pulse. Normally modification is checked via strict equality; however, in
* some cases it is more efficient to update the internal state of an object.
@@ -4570,11 +4631,11 @@
for (name in params) {
value = params[name];
if (name === PULSE) {
- array(value).forEach(op => {
+ array$5(value).forEach(op => {
if (!(op instanceof Operator)) {
error('Pulse parameters must be operator instances.');
} else if (op !== this) {
op.targets().add(this);
deps.push(op);
@@ -4645,11 +4706,16 @@
if (op._targets) {
op._targets.remove(this);
}
}
- }
+ } // remove references to the source and pulse object,
+ // if present, to prevent memory leaks of old data.
+
+
+ this.pulse = null;
+ this.source = null;
},
/**
* Delegate method to perform operator processing.
* Subclasses can override this method to perform custom processing.
@@ -4716,11 +4782,11 @@
* @param {boolean} [react=true] - Flag indicating if this operator should
* listen for changes to upstream operators included as parameters.
* @return {Operator} - The added operator.
*/
- function add(init, update, params, react) {
+ function add$3(init, update, params, react) {
let shift = 1,
op;
if (init instanceof Operator) {
op = init;
@@ -4800,11 +4866,11 @@
return new EventStream(filter, apply, receive);
}
EventStream.prototype = {
_filter: truthy,
- _apply: identity,
+ _apply: identity$6,
targets() {
return this._targets || (this._targets = UniqueList(id));
},
@@ -4881,12 +4947,16 @@
a.targets().add(stream(null, null, () => active = true));
b.targets().add(stream(null, null, () => active = false));
return this.filter(() => active);
},
- detach() {// no-op for handling detach requests
+ detach() {
// ensures compatibility with operators (#2753)
+ // remove references to other streams and filter functions that may
+ // be bound to subcontexts that need to be garbage collected.
+ this._filter = truthy;
+ this._targets = null;
}
};
/**
* Create a new event stream from an event source.
@@ -4898,11 +4968,11 @@
* If provided, this function will be invoked and the result will be
* used as the downstream event value.
* @return {EventStream}
*/
- function events(source, type, filter, apply) {
+ function events$1(source, type, filter, apply) {
const df = this,
s = stream(filter, apply),
send = function (e) {
e.dataflow = df;
@@ -4918,11 +4988,11 @@
let sources;
if (typeof source === 'string' && typeof document !== 'undefined') {
sources = document.querySelectorAll(source);
} else {
- sources = array(source);
+ sources = array$5(source);
}
const n = sources.length;
for (let i = 0; i < n; ++i) {
@@ -4930,11 +5000,11 @@
}
return s;
}
- function parse$1(data, format) {
+ function parse$4(data, format) {
const locale = this.locale();
return read(data, format, locale.timeParse, locale.utcParse);
}
/**
* Ingests new data into the dataflow. First parses the data using the
@@ -4947,11 +5017,11 @@
* loaded data. This object is passed to the vega-loader read method.
* @returns {Dataflow}
*/
- function ingest$1(target, data, format) {
+ function ingest(target, data, format) {
data = this.parse(data, format);
return this.pulse(target, this.changeset().insert(data));
}
/**
* Request data from an external source, parse it, and return a Promise.
@@ -5017,11 +5087,11 @@
};
return df._pending = pending;
}
- const SKIP$1 = {
+ const SKIP$2 = {
skip: true
};
/**
* Perform operator updates in response to events. Applies an
* update function to compute a new operator value. If the update function
@@ -5054,13 +5124,13 @@
fn(this, source, target, update, params, options);
return this;
}
function onStream(df, stream, target, update, params, options) {
- const opt = extend({}, options, SKIP$1);
+ const opt = extend$1({}, options, SKIP$2);
let func, op;
- if (!isFunction(target)) target = constant(target);
+ if (!isFunction(target)) target = constant$4(target);
if (update === undefined) {
func = e => df.touch(target(e));
} else if (isFunction(update)) {
op = new Operator(null, update, params, false);
@@ -5100,11 +5170,11 @@
}
}
}
function updater(target, update) {
- update = isFunction(update) ? update : constant(update);
+ update = isFunction(update) ? update : constant$4(update);
return target ? function (_, pulse) {
const value = update(_, pulse);
if (!target.skip()) {
target.skip(value !== this.value).value = value;
@@ -5153,14 +5223,14 @@
const StopPropagation = {}; // Pulse visit type flags
const ADD = 1 << 0,
REM = 1 << 1,
- MOD = 1 << 2,
+ MOD$1 = 1 << 2,
ADD_REM = ADD | REM,
- ADD_MOD = ADD | MOD,
- ALL = ADD | REM | MOD,
+ ADD_MOD = ADD | MOD$1,
+ ALL = ADD | REM | MOD$1,
REFLOW = 1 << 3,
SOURCE = 1 << 4,
NO_SOURCE = 1 << 5,
NO_FIELDS = 1 << 6;
/**
@@ -5201,11 +5271,11 @@
const out = [];
visitArray(data, filter, _ => out.push(_));
return out;
}
- function filter(pulse, flags) {
+ function filter$1(pulse, flags) {
const map = {};
pulse.visit(flags, t => {
map[tupleid(t)] = 1;
});
return t => map[tupleid(t)] ? null : t;
@@ -5232,11 +5302,11 @@
REM,
/**
* Boolean flag indicating MOD (modified) tuples.
*/
- MOD,
+ MOD: MOD$1,
/**
* Boolean flag indicating ADD (added) and REM (removed) tuples.
*/
ADD_REM,
@@ -5368,11 +5438,11 @@
} else {
p.remF = null;
p.rem = [];
}
- if (flags & MOD) {
+ if (flags & MOD$1) {
p.modF = src.modF;
p.mod = src.mod;
} else {
p.modF = null;
p.mod = [];
@@ -5405,11 +5475,11 @@
* @return {boolean} - Returns true if one or more queried tuple types have
* changed, false otherwise.
*/
changed(flags) {
const f = flags || ALL;
- return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD && this.mod.length;
+ return f & ADD && this.add.length || f & REM && this.rem.length || f & MOD$1 && this.mod.length;
},
/**
* Forces a "reflow" of tuple values, such that all tuples in the backing
* source are added to the MOD set, unless already present in the ADD set.
@@ -5422,11 +5492,11 @@
const len = this.add.length,
src = this.source && this.source.length;
if (src && src !== len) {
this.mod = this.source;
- if (len) this.filter(MOD, filter(this, ADD));
+ if (len) this.filter(MOD$1, filter$1(this, ADD));
}
return this;
},
@@ -5492,11 +5562,11 @@
*/
filter(flags, filter) {
const p = this;
if (flags & ADD) p.addF = addFilter(p.addF, filter);
if (flags & REM) p.remF = addFilter(p.remF, filter);
- if (flags & MOD) p.modF = addFilter(p.modF, filter);
+ if (flags & MOD$1) p.modF = addFilter(p.modF, filter);
if (flags & SOURCE) p.srcF = addFilter(p.srcF, filter);
return p;
},
/**
@@ -5518,11 +5588,11 @@
if (flags & REM && p.remF) {
p.rem = materialize(p.rem, p.remF);
p.remF = null;
}
- if (flags & MOD && p.modF) {
+ if (flags & MOD$1 && p.modF) {
p.mod = materialize(p.mod, p.modF);
p.modF = null;
}
if (flags & SOURCE && p.srcF) {
@@ -5550,17 +5620,17 @@
return p;
}
if (flags & ADD) visitArray(p.add, p.addF, v);
if (flags & REM) visitArray(p.rem, p.remF, v);
- if (flags & MOD) visitArray(p.mod, p.modF, v);
+ if (flags & MOD$1) visitArray(p.mod, p.modF, v);
const src = p.source;
if (flags & REFLOW && src) {
const sum = p.add.length + p.mod.length;
if (sum === src.length) ;else if (sum) {
- visitArray(src, filter(p, ADD_MOD), v);
+ visitArray(src, filter$1(p, ADD_MOD), v);
} else {
// if no add/rem/mod tuples, visit source
visitArray(src, p.srcF, v);
}
}
@@ -5581,21 +5651,19 @@
* @param {number} stamp - The timestamp.
* @param {Array<Pulse>} pulses - The sub-pulses for this multi-pulse.
*/
function MultiPulse(dataflow, stamp, pulses, encode) {
- const p = this,
- n = pulses.length;
+ const p = this;
let c = 0;
this.dataflow = dataflow;
this.stamp = stamp;
this.fields = null;
this.encode = encode || null;
this.pulses = pulses;
- for (let i = 0; i < n; ++i) {
- const pulse = pulses[i];
+ for (const pulse of pulses) {
if (pulse.stamp !== stamp) continue;
if (pulse.fields) {
const hash = p.fields || (p.fields = {});
@@ -5759,11 +5827,11 @@
} // reset pulse map
df._input = {};
df._pulse = null;
- df.debug("Pulse ".concat(stamp, ": ").concat(count, " operators"));
+ df.debug(`Pulse ${stamp}: ${count} operators`);
if (error) {
df._postrun = [];
df.error(error);
} // invoke callbacks queued via runAfter
@@ -5997,11 +6065,11 @@
* be skipped: it will not be evaluated, but its dependents will be.
* @return {Dataflow}
*/
- function update(op, value, options) {
+ function update$6(op, value, options) {
const opt = options || NO_OPT;
if (op.set(value) || opt.force) {
this.touch(op, opt);
}
@@ -6111,11 +6179,11 @@
function Dataflow() {
this.logger(logger());
this.logLevel(Error$1);
this._clock = 0;
this._rank = 0;
- this._locale = defaultLocale$2();
+ this._locale = defaultLocale();
try {
this._loader = loader();
} catch (e) {// do nothing if loader module is unavailable
}
@@ -6242,26 +6310,26 @@
* Empty entry threshold for garbage cleaning. Map data structures will
* perform cleaning once the number of empty entries exceeds this value.
*/
cleanThreshold: 1e4,
// OPERATOR REGISTRATION
- add,
+ add: add$3,
connect,
rank,
rerank,
// OPERATOR UPDATES
pulse,
touch,
- update,
+ update: update$6,
changeset,
// DATA LOADING
- ingest: ingest$1,
- parse: parse$1,
+ ingest,
+ parse: parse$4,
preload,
request,
// EVENT HANDLING
- events,
+ events: events$1,
on,
// PULSE PROPAGATION
evaluate,
run,
runAsync,
@@ -6337,18 +6405,18 @@
transform() {}
});
const transforms = {};
- function definition(type) {
- const t = transform$1(type);
+ function definition$1(type) {
+ const t = transform$2(type);
return t && t.Definition || null;
}
- function transform$1(type) {
+ function transform$2(type) {
type = type && type.toLowerCase();
- return has(transforms, type) ? transforms[type] : null;
+ return has$1(transforms, type) ? transforms[type] : null;
}
function* numbers$1(values, valueof) {
if (valueof == null) {
for (let value of values) {
@@ -6371,11 +6439,11 @@
function quantiles(array, p, f) {
const values = Float64Array.from(numbers$1(array, f)); // don't depend on return value from typed array sort call
// protects against undefined sort results in Safari (vega/vega-lite#4964)
- values.sort(ascending$1);
+ values.sort(ascending$2);
return p.map(_ => quantileSorted(values, _));
}
function quartiles(array, f) {
return quantiles(array, [0.25, 0.50, 0.75], f);
@@ -6389,11 +6457,11 @@
h = (q[2] - q[0]) / 1.34,
v = Math.min(d, h) || d || Math.abs(q[0]) || 1;
return 1.06 * v * Math.pow(n, -0.2);
}
- function bin$1(_) {
+ function bin(_) {
// determine range
const maxb = _.maxbins || 20,
base = _.base || 10,
logb = Math.log(base),
div = _.divide || [5, 2];
@@ -6471,12 +6539,12 @@
}
mu[j] = a / n;
}
- mu.sort(ascending$1);
- return [quantile(mu, alpha / 2), quantile(mu, 1 - alpha / 2)];
+ mu.sort(ascending$2);
+ return [quantile$1(mu, alpha / 2), quantile$1(mu, 1 - alpha / 2)];
} // Dot density binning for dot plot construction.
// Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.
// https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf
@@ -6548,11 +6616,11 @@
}
return v;
}
- function lcg(seed) {
+ function lcg$1(seed) {
// Random numbers using a Linear Congruential Generator with seed value
// Uses glibc values from https://en.wikipedia.org/wiki/Linear_congruential_generator
return function () {
seed = (1103515245 * seed + 12345) % 2147483647;
return seed / 2147483647;
@@ -6911,11 +6979,11 @@
icdf: p => quantileLogNormal(p, mu, sigma)
};
return dist.mean(mean).stdev(stdev);
}
- function mixture(dists, weights) {
+ function mixture$1(dists, weights) {
let m = 0,
w;
function normalize(x) {
const w = [];
@@ -7151,11 +7219,11 @@
});
return 1 - SSE / SST;
} // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
- function linear(data, x, y) {
+ function linear$2(data, x, y) {
let X = 0,
Y = 0,
XY = 0,
X2 = 0,
n = 0;
@@ -7176,11 +7244,11 @@
rSquared: rSquared(data, x, y, Y, predict)
};
} // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
- function log$2(data, x, y) {
+ function log$3(data, x, y) {
let X = 0,
Y = 0,
XY = 0,
X2 = 0,
n = 0;
@@ -7233,11 +7301,11 @@
rSquared: rSquared(data, x, y, uy, predict)
};
} // License: https://github.com/HarryStevens/d3-regression/blob/master/LICENSE
- function pow$1(data, x, y) {
+ function pow$3(data, x, y) {
let X = 0,
Y = 0,
XY = 0,
X2 = 0,
YS = 0,
@@ -7310,11 +7378,11 @@
// License: https://github.com/Tom-Alexander/regression-js/blob/master/LICENSE
function poly(data, x, y, order) {
// use more efficient methods for lower orders
- if (order === 1) return linear(data, x, y);
+ if (order === 1) return linear$2(data, x, y);
if (order === 2) return quad(data, x, y);
const [xv, yv, ux, uy] = points(data, x, y),
n = xv.length,
lhs = [],
rhs = [],
@@ -7424,11 +7492,11 @@
return coef;
}
const maxiters = 2,
- epsilon = 1e-12; // Adapted from science.js by Jason Davies
+ epsilon$5 = 1e-12; // Adapted from science.js by Jason Davies
// Source: https://github.com/jasondavies/science.js/blob/master/src/stats/loess.js
// License: https://github.com/jasondavies/science.js/blob/master/LICENSE
function loess(data, x, y, bandwidth) {
const [xv, yv, ux, uy] = points(data, x, y, true),
@@ -7476,21 +7544,21 @@
if (iter === maxiters) {
break;
}
const medianResidual = median(residuals);
- if (Math.abs(medianResidual) < epsilon) break;
+ if (Math.abs(medianResidual) < epsilon$5) break;
for (let i = 0, arg, w; i < n; ++i) {
arg = residuals[i] / (6 * medianResidual); // default to epsilon (rather than zero) for large deviations
// keeping weights tiny but non-zero prevents singularites
- robustWeights[i] = arg >= 1 ? epsilon : (w = 1 - arg * arg) * w;
+ robustWeights[i] = arg >= 1 ? epsilon$5 : (w = 1 - arg * arg) * w;
}
}
- return output(xv, yhat, ux, uy);
+ return output$1(xv, yhat, ux, uy);
} // weighting kernel for local regression
function tricube(x) {
return (x = 1 - x * x * x) * x * x;
@@ -7511,11 +7579,11 @@
}
} // generate smoothed output points
// average points with repeated x values
- function output(xv, yhat, ux, uy) {
+ function output$1(xv, yhat, ux, uy) {
const n = xv.length,
out = [];
let i = 0,
cnt = 0,
prev = [],
@@ -7536,14 +7604,14 @@
}
}
prev[1] += uy;
return out;
- } // subdivide up to accuracy of 0.1 degrees
+ } // subdivide up to accuracy of 0.5 degrees
- const MIN_RADIANS = 0.1 * Math.PI / 180; // Adaptively sample an interpolated function over a domain extent
+ const MIN_RADIANS = 0.5 * Math.PI / 180; // Adaptively sample an interpolated function over a domain extent
function sampleCurve(f, extent, minSteps, maxSteps) {
minSteps = minSteps || 25;
maxSteps = Math.max(minSteps, maxSteps || 200);
@@ -7571,20 +7639,23 @@
for (let i = minSteps; --i > 0;) {
next.push(point(minX + i / minSteps * span));
}
}
- let p0 = prev[0],
- p1 = next[next.length - 1];
+ let p0 = prev[0];
+ let p1 = next[next.length - 1];
+ const sx = 1 / span;
+ const sy = scaleY(p0[1], next);
while (p1) {
// midpoint for potential curve subdivision
const pm = point((p0[0] + p1[0]) / 2);
+ const dx = pm[0] - p0[0] >= stop;
- if (pm[0] - p0[0] >= stop && angleDelta(p0, pm, p1) > MIN_RADIANS) {
+ if (dx && angleDelta(p0, pm, p1, sx, sy) > MIN_RADIANS) {
// maximum resolution has not yet been met, and
- // subdivision midpoint sufficiently different from endpoint
+ // subdivision midpoint is sufficiently different from endpoint
// save subdivision, push midpoint onto the visitation stack
next.push(pm);
} else {
// subdivision midpoint sufficiently similar to endpoint
// skip subdivision, store endpoint, move to next point on the stack
@@ -7597,13 +7668,27 @@
}
return prev;
}
- function angleDelta(p, q, r) {
- const a0 = Math.atan2(r[1] - p[1], r[0] - p[0]),
- a1 = Math.atan2(q[1] - p[1], q[0] - p[0]);
+ function scaleY(init, points) {
+ let ymin = init;
+ let ymax = init;
+ const n = points.length;
+
+ for (let i = 0; i < n; ++i) {
+ const y = points[i][1];
+ if (y < ymin) ymin = y;
+ if (y > ymax) ymax = y;
+ }
+
+ return 1 / (ymax - ymin);
+ }
+
+ function angleDelta(p, q, r, sx, sy) {
+ const a0 = Math.atan2(sy * (r[1] - p[1]), sx * (r[0] - p[0])),
+ a1 = Math.atan2(sy * (q[1] - p[1]), sx * (q[0] - p[0]));
return Math.abs(a0 - a1);
}
function multikey(f) {
return x => {
@@ -7627,16 +7712,16 @@
function measureName(op, field, as) {
return as || op + (!field ? '' : '_' + field);
}
- const noop = () => {};
+ const noop$4 = () => {};
const base_op = {
- init: noop,
- add: noop,
- rem: noop,
+ init: noop$4,
+ add: noop$4,
+ rem: noop$4,
idx: 0
};
const AggregateOps = {
values: {
init: m => m.cell.store = true,
@@ -7786,11 +7871,11 @@
}
};
const ValidAggregateOps = Object.keys(AggregateOps);
function measure(key, value) {
- return out => extend({
+ return out => extend$1({
name: key,
out: out || key
}, base_op, value);
}
@@ -7826,11 +7911,11 @@
this.missing = 0;
this._ops.forEach(op => op.init(this));
}
- function add$1(v, t) {
+ function add$2(v, t) {
if (v == null || v === '') {
++this.missing;
return;
}
@@ -7850,18 +7935,18 @@
--this.valid;
this._ops.forEach(op => op.rem(this, v, t));
}
- function set(t) {
+ function set$3(t) {
this._out.forEach(op => t[op.out] = op.value(this));
return t;
}
function compileMeasures(agg, field) {
- const get = field || identity,
+ const get = field || identity$6,
ops = resolve(agg),
out = agg.slice().sort(compareIndex);
function ctr(cell) {
this._ops = ops;
@@ -7869,42 +7954,42 @@
this.cell = cell;
this.init();
}
ctr.prototype.init = init;
- ctr.prototype.add = add$1;
+ ctr.prototype.add = add$2;
ctr.prototype.rem = rem;
- ctr.prototype.set = set;
+ ctr.prototype.set = set$3;
ctr.prototype.get = get;
ctr.fields = agg.map(op => op.out);
return ctr;
}
function TupleStore(key) {
- this._key = key ? field(key) : tupleid;
+ this._key = key ? field$1(key) : tupleid;
this.reset();
}
- const prototype = TupleStore.prototype;
+ const prototype$1 = TupleStore.prototype;
- prototype.reset = function () {
+ prototype$1.reset = function () {
this._add = [];
this._rem = [];
this._ext = null;
this._get = null;
this._q = null;
};
- prototype.add = function (v) {
+ prototype$1.add = function (v) {
this._add.push(v);
};
- prototype.rem = function (v) {
+ prototype$1.rem = function (v) {
this._rem.push(v);
};
- prototype.values = function () {
+ prototype$1.values = function () {
this._get = null;
if (this._rem.length === 0) return this._add;
const a = this._add,
r = this._rem,
k = this._key,
@@ -7929,93 +8014,93 @@
this._rem = [];
return this._add = x;
}; // memoizing statistics methods
- prototype.distinct = function (get) {
+ prototype$1.distinct = function (get) {
const v = this.values(),
map = {};
let n = v.length,
count = 0,
s;
while (--n >= 0) {
s = get(v[n]) + '';
- if (!has(map, s)) {
+ if (!has$1(map, s)) {
map[s] = 1;
++count;
}
}
return count;
};
- prototype.extent = function (get) {
+ prototype$1.extent = function (get) {
if (this._get !== get || !this._ext) {
const v = this.values(),
i = extentIndex(v, get);
this._ext = [v[i[0]], v[i[1]]];
this._get = get;
}
return this._ext;
};
- prototype.argmin = function (get) {
+ prototype$1.argmin = function (get) {
return this.extent(get)[0] || {};
};
- prototype.argmax = function (get) {
+ prototype$1.argmax = function (get) {
return this.extent(get)[1] || {};
};
- prototype.min = function (get) {
+ prototype$1.min = function (get) {
const m = this.extent(get)[0];
return m != null ? get(m) : undefined;
};
- prototype.max = function (get) {
+ prototype$1.max = function (get) {
const m = this.extent(get)[1];
return m != null ? get(m) : undefined;
};
- prototype.quartile = function (get) {
+ prototype$1.quartile = function (get) {
if (this._get !== get || !this._q) {
this._q = quartiles(this.values(), get);
this._get = get;
}
return this._q;
};
- prototype.q1 = function (get) {
+ prototype$1.q1 = function (get) {
return this.quartile(get)[0];
};
- prototype.q2 = function (get) {
+ prototype$1.q2 = function (get) {
return this.quartile(get)[1];
};
- prototype.q3 = function (get) {
+ prototype$1.q3 = function (get) {
return this.quartile(get)[2];
};
- prototype.ci = function (get) {
+ prototype$1.ci = function (get) {
if (this._get !== get || !this._ci) {
this._ci = bootstrapCI(this.values(), 1000, 0.05, get);
this._get = get;
}
return this._ci;
};
- prototype.ci0 = function (get) {
+ prototype$1.ci0 = function (get) {
return this.ci(get)[0];
};
- prototype.ci1 = function (get) {
+ prototype$1.ci1 = function (get) {
return this.ci(get)[1];
};
/**
* Group-by aggregation operator.
* @constructor
@@ -8029,11 +8114,11 @@
* If true, the drop parameter is ignored and empty cells are retained.
* @param {boolean} [params.drop=true] - A flag indicating if empty cells should be removed.
*/
- function Aggregate(params) {
+ function Aggregate$1(params) {
Transform.call(this, null, params);
this._adds = []; // array of added output tuples
this._mods = []; // array of modified output tuples
@@ -8060,11 +8145,11 @@
this._inputs = null; // array of dependent input tuple field names
this._outputs = null; // array of output tuple field names
}
- Aggregate.Definition = {
+ Aggregate$1.Definition = {
'type': 'Aggregate',
'metadata': {
'generates': true,
'changes': true
},
@@ -8098,11 +8183,11 @@
}, {
'name': 'key',
'type': 'field'
}]
};
- inherits(Aggregate, Transform, {
+ inherits(Aggregate$1, Transform, {
transform(_, pulse) {
const aggr = this,
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
mod = _.modified();
@@ -8177,11 +8262,11 @@
const inputs = this._inputs = [],
outputs = this._outputs = [],
inputMap = {};
function inputVisit(get) {
- const fields = array(accessorFields(get)),
+ const fields = array$5(accessorFields(get)),
n = fields.length;
let i = 0,
f;
for (; i < n; ++i) {
@@ -8191,11 +8276,11 @@
}
}
} // initialize group-by dimensions
- this._dims = array(_.groupby);
+ this._dims = array$5(_.groupby);
this._dnames = this._dims.map(d => {
const dname = accessorName(d);
inputVisit(d);
outputs.push(dname);
return dname;
@@ -8307,11 +8392,11 @@
for (let i = 0; i < n; ++i) {
x[names[i]] = dims[i](t);
}
- return p ? replace(p.tuple, x) : ingest(x);
+ return p ? replace$1(p.tuple, x) : ingest$1(x);
},
clean() {
const cells = this.value;
@@ -8403,11 +8488,11 @@
this._prev = null;
return out;
}
});
- const EPSILON = 1e-14;
+ const EPSILON$1 = 1e-14;
/**
* Generates a binning function for discretizing data.
* @constructor
* @param {object} params - The parameters for this operator. The
* provided values should be valid options for the {@link bin} function.
@@ -8518,11 +8603,11 @@
if (this.value && !_.modified()) {
return this.value;
}
const field = _.field,
- bins = bin$1(_),
+ bins = bin(_),
step = bins.step;
let start = bins.start,
stop = start + Math.ceil((bins.stop - start) / step) * step,
a,
d;
@@ -8533,11 +8618,11 @@
stop += d;
}
const f = function (t) {
let v = toNumber(field(t));
- return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON + (v - start) / step));
+ return v == null ? null : v < start ? -Infinity : v > stop ? +Infinity : (v = Math.max(start, Math.min(v, stop - step)), start + step * Math.floor(EPSILON$1 + (v - start) / step));
};
f.start = start;
f.stop = bins.stop;
f.step = step;
@@ -8566,11 +8651,11 @@
if (resort && compare) {
data.sort(compare);
}
if (add.length) {
- data = compare ? merge(compare, data, add.sort(compare)) : data.concat(add);
+ data = compare ? merge$3(compare, data, add.sort(compare)) : data.concat(add);
add = [];
}
return data;
}
@@ -8583,25 +8668,25 @@
* @param {function(*,*): number} [params.sort] - An optional
* comparator function for additionally sorting the collected tuples.
*/
- function Collect(params) {
+ function Collect$1(params) {
Transform.call(this, [], params);
}
- Collect.Definition = {
+ Collect$1.Definition = {
'type': 'Collect',
'metadata': {
'source': true
},
'params': [{
'name': 'sort',
'type': 'compare'
}]
};
- inherits(Collect, Transform, {
+ inherits(Collect$1, Transform, {
transform(_, pulse) {
const out = pulse.fork(pulse.ALL),
list = SortedList(tupleid, this.value, out.materialize(out.ADD).add),
sort = _.sort,
mod = pulse.changed() || sort && (_.modified('sort') || pulse.modified(sort.fields));
@@ -8624,18 +8709,18 @@
* @param {Array<string|function>} params.fields - The fields to compare.
* @param {Array<string>} [params.orders] - The sort orders.
* Each entry should be one of "ascending" (default) or "descending".
*/
- function Compare(params) {
- Operator.call(this, null, update$1, params);
+ function Compare$1(params) {
+ Operator.call(this, null, update$5, params);
}
- inherits(Compare, Operator);
+ inherits(Compare$1, Operator);
- function update$1(_) {
- return this.value && !_.modified() ? this.value : compare(_.fields, _.orders);
+ function update$5(_) {
+ return this.value && !_.modified() ? this.value : compare$1(_.fields, _.orders);
}
/**
* Count regexp-defined pattern occurrences in a text field.
* @constructor
* @param {object} params - The parameters for this operator.
@@ -8758,11 +8843,11 @@
for (w in counts) {
t = tuples[w];
c = counts[w] || 0;
if (!t && c) {
- tuples[w] = t = ingest({});
+ tuples[w] = t = ingest$1({});
t[text] = w;
t[count] = c;
out.add.push(t);
} else if (c === 0) {
if (t) out.rem.push(t);
@@ -8844,11 +8929,11 @@
for (j = 0; j < n; ++j) {
t[b] = input[j];
if (filter(t)) {
- data.push(ingest(t));
+ data.push(ingest$1(t));
t = {};
t[a] = left;
}
}
}
@@ -8856,11 +8941,11 @@
return data;
}
const Distributions = {
kde: kde,
- mixture: mixture,
+ mixture: mixture$1,
normal: gaussian,
lognormal: lognormal,
uniform: uniform
};
const DISTRIBUTIONS = 'distributions',
@@ -8876,14 +8961,14 @@
* is not provided. Typically this method returns backing
* source data for a Pulse object.
* @return {object} - The output distribution object.
*/
- function parse$2(def, data) {
+ function parse$3(def, data) {
const func = def[FUNCTION];
- if (!has(Distributions, func)) {
+ if (!has$1(Distributions, func)) {
error('Unknown distribution function: ' + func);
}
const d = Distributions[func]();
@@ -8891,15 +8976,15 @@
// if data field, extract values
if (name === FIELD) {
d.data((def.from || data()).map(def[name]));
} // if distribution mixture, recurse to parse each definition
else if (name === DISTRIBUTIONS) {
- d[name](def[name].map(_ => parse$2(_, data)));
- } // otherwise, simply set the parameter
- else if (typeof d[name] === FUNCTION) {
- d[name](def[name]);
- }
+ d[name](def[name].map(_ => parse$3(_, data)));
+ } // otherwise, simply set the parameter
+ else if (typeof d[name] === FUNCTION) {
+ d[name](def[name]);
+ }
}
return d;
}
/**
@@ -8986,11 +9071,11 @@
'name': 'bandwidth',
'type': 'number',
'default': 0
}]
}];
- const mixture$1 = {
+ const mixture = {
'key': {
'function': 'mixture'
},
'params': [{
'name': 'distributions',
@@ -9030,11 +9115,11 @@
'default': 'pdf',
'values': ['pdf', 'cdf']
}, {
'name': 'distribution',
'type': 'param',
- 'params': distributions.concat(mixture$1)
+ 'params': distributions.concat(mixture)
}, {
'name': 'as',
'type': 'string',
'array': true,
'default': ['value', 'density']
@@ -9043,11 +9128,11 @@
inherits(Density, Transform, {
transform(_, pulse) {
const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
if (!this.value || pulse.changed() || _.modified()) {
- const dist = parse$2(_.distribution, source(pulse)),
+ const dist = parse$3(_.distribution, source$1(pulse)),
minsteps = _.steps || _.minsteps || 25,
maxsteps = _.steps || _.maxsteps || 200;
let method = _.method || 'pdf';
if (method !== 'pdf' && method !== 'cdf') {
@@ -9063,31 +9148,31 @@
domain = _.extent || extent(dist.data()),
values = sampleCurve(method, domain, minsteps, maxsteps).map(v => {
const tuple = {};
tuple[as[0]] = v[0];
tuple[as[1]] = v[1];
- return ingest(tuple);
+ return ingest$1(tuple);
});
if (this.value) out.rem = this.value;
this.value = out.add = out.source = values;
}
return out;
}
});
- function source(pulse) {
+ function source$1(pulse) {
return () => pulse.materialize(pulse.SOURCE).source;
}
function fieldNames(fields, as) {
if (!fields) return null;
return fields.map((f, i) => as[i] || accessorName(f));
}
- function partition(data, groupby, field) {
+ function partition$1$1(data, groupby, field) {
const groups = [],
get = f => f(t);
let map, i, n, t, k, g; // partition data points into groups
@@ -9110,11 +9195,11 @@
}
return groups;
}
- const Output = 'bin';
+ const Output$5 = 'bin';
/**
* Dot density binning for dot plot construction.
* Based on Leland Wilkinson, Dot Plots, The American Statistician, 1999.
* https://www.cs.uic.edu/~wilkinson/Publications/dotplots.pdf
* @constructor
@@ -9152,11 +9237,11 @@
'type': 'boolean',
'default': false
}, {
'name': 'as',
'type': 'string',
- 'default': Output
+ 'default': Output$5
}]
};
const autostep = (data, field) => span(extent(data, field)) / 30;
@@ -9165,16 +9250,16 @@
if (this.value && !(_.modified() || pulse.changed())) {
return pulse; // early exit
}
const source = pulse.materialize(pulse.SOURCE).source,
- groups = partition(pulse.source, _.groupby, identity),
+ groups = partition$1$1(pulse.source, _.groupby, identity$6),
smooth = _.smooth || false,
field = _.field,
step = _.step || autostep(source, field),
sort = stableCompare((a, b) => field(a) - field(b)),
- as = _.as || Output,
+ as = _.as || Output$5,
n = groups.length; // compute dotplot bins per group
let min = Infinity,
max = -Infinity,
i = 0,
@@ -9208,18 +9293,18 @@
* function should accept both a datum and a parameter object.
* This operator's value will be a new function that wraps the
* expression function with access to this operator's parameters.
*/
- function Expression(params) {
- Operator.call(this, null, update$1$1, params);
+ function Expression$1(params) {
+ Operator.call(this, null, update$4, params);
this.modified(true);
}
- inherits(Expression, Operator);
+ inherits(Expression$1, Operator);
- function update$1$1(_) {
+ function update$4(_) {
const expr = _.expr;
return this.value && !_.modified('expr') ? this.value : accessor(datum => expr(datum, _), accessorFields(expr), accessorName(expr));
}
/**
* Computes extents (min/max) for a data field.
@@ -9266,12 +9351,12 @@
}
});
if (!Number.isFinite(min) || !Number.isFinite(max)) {
let name = accessorName(field);
- if (name) name = " for field \"".concat(name, "\"");
- pulse.dataflow.warn("Infinite extent".concat(name, ": [").concat(min, ", ").concat(max, "]"));
+ if (name) name = ` for field "${name}"`;
+ pulse.dataflow.warn(`Infinite extent${name}: [${min}, ${max}]`);
min = max = undefined;
}
this.value = [min, max];
}
@@ -9355,11 +9440,11 @@
* @param {function(Dataflow, string): Operator} params.subflow - A function
* that generates a subflow of operators and returns its root operator.
* @param {function(object): *} params.key - The key field to facet by.
*/
- function Facet(params) {
+ function Facet$1(params) {
Transform.call(this, {}, params);
this._keys = fastmap(); // cache previously calculated key values
// keep track of active subflows, use as targets array for listeners
// this allows us to limit propagation to only updated subflows
@@ -9371,19 +9456,19 @@
f(a[i], i, a);
}
};
}
- inherits(Facet, Transform, {
+ inherits(Facet$1, Transform, {
activate(flow) {
this._targets[this._targets.active++] = flow;
},
// parent argument provided by PreFacet subclass
subflow(key, flow, pulse, parent) {
const flows = this.value;
- let sf = has(flows, key) && flows[key],
+ let sf = has$1(flows, key) && flows[key],
df,
p;
if (!sf) {
p = parent || (p = this._group[key]) && p.tuple;
@@ -9400,29 +9485,44 @@
return sf;
},
clean() {
const flows = this.value;
+ let detached = 0;
for (const key in flows) {
if (flows[key].count === 0) {
const detach = flows[key].detachSubflow;
if (detach) detach();
delete flows[key];
+ ++detached;
}
+ } // remove inactive targets from the active targets array
+
+
+ if (detached) {
+ const active = this._targets.filter(sf => sf && sf.count > 0);
+
+ this.initTargets(active);
}
},
- initTargets() {
+ initTargets(act) {
const a = this._targets,
- n = a.length;
+ n = a.length,
+ m = act ? act.length : 0;
+ let i = 0;
- for (let i = 0; i < n && a[i] != null; ++i) {
+ for (; i < m; ++i) {
+ a[i] = act[i];
+ }
+
+ for (; i < n && a[i] != null; ++i) {
a[i] = null; // ensure old flows can be garbage collected
}
- a.active = 0;
+ a.active = m;
},
transform(_, pulse) {
const df = pulse.dataflow,
key = _.key,
@@ -9504,18 +9604,18 @@
* @param {object} params - The parameters for this operator.
* @param {string} params.name - The field name(s) to access.
* @param {string} params.as - The accessor function name.
*/
- function Field(params) {
- Operator.call(this, null, update$2, params);
+ function Field$1(params) {
+ Operator.call(this, null, update$3, params);
}
- inherits(Field, Operator);
+ inherits(Field$1, Operator);
- function update$2(_) {
- return this.value && !_.modified() ? this.value : isArray(_.name) ? array(_.name).map(f => field(f)) : field(_.name, _.as);
+ function update$3(_) {
+ return this.value && !_.modified() ? this.value : isArray(_.name) ? array$5(_.name).map(f => field$1(f)) : field$1(_.name, _.as);
}
/**
* Filters data tuples according to a predicate function.
* @constructor
* @param {object} params - The parameters for this operator.
@@ -9796,11 +9896,11 @@
t;
if (num > 0) {
// need more tuples, generate and add
for (add = []; --num >= 0;) {
- add.push(t = ingest(gen(_)));
+ add.push(t = ingest$1(gen(_)));
data.push(t);
}
out.add = out.add.length ? out.materialize(out.ADD).add.concat(add) : add;
} else {
@@ -9813,18 +9913,18 @@
out.source = this.value = data;
return out;
}
});
- const Methods = {
+ const Methods$1 = {
value: 'value',
median: median,
mean: mean,
- min: min,
- max: max
+ min: min$2,
+ max: max$2
};
- const Empty = [];
+ const Empty$1 = [];
/**
* Impute missing values.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to impute.
@@ -9877,37 +9977,37 @@
'default': 0
}]
};
function getValue(_) {
- var m = _.method || Methods.value,
+ var m = _.method || Methods$1.value,
v;
- if (Methods[m] == null) {
+ if (Methods$1[m] == null) {
error('Unrecognized imputation method: ' + m);
- } else if (m === Methods.value) {
+ } else if (m === Methods$1.value) {
v = _.value !== undefined ? _.value : 0;
return () => v;
} else {
- return Methods[m];
+ return Methods$1[m];
}
}
- function getField(_) {
+ function getField$1(_) {
const f = _.field;
return t => t ? f(t) : NaN;
}
inherits(Impute, Transform, {
transform(_, pulse) {
var out = pulse.fork(pulse.ALL),
impute = getValue(_),
- field = getField(_),
+ field = getField$1(_),
fName = accessorName(_.field),
kName = accessorName(_.key),
gNames = (_.groupby || []).map(accessorName),
- groups = partition$1(pulse.source, _.groupby, _.key, _.keyvals),
+ groups = partition$4(pulse.source, _.groupby, _.key, _.keyvals),
curr = [],
prev = this.value,
m = groups.domain.length,
group,
value,
@@ -9934,11 +10034,11 @@
for (i = 0, n = gVals.length; i < n; ++i) t[gNames[i]] = gVals[i];
t[kName] = kVal;
t[fName] = Number.isNaN(value) ? value = impute(group, field) : value;
- curr.push(ingest(t));
+ curr.push(ingest$1(t));
}
} // update pulse with imputed tuples
if (curr.length) out.add = out.materialize(out.ADD).add.concat(curr);
@@ -9947,11 +10047,11 @@
return out;
}
});
- function partition$1(data, groupby, key, keyvals) {
+ function partition$4(data, groupby, key, keyvals) {
var get = f => f(t),
groups = [],
domain = keyvals ? keyvals.slice() : [],
kMap = {},
gMap = {},
@@ -9968,11 +10068,11 @@
for (i = 0, n = data.length; i < n; ++i) {
t = data[i];
k = key(t);
j = kMap[k] || (kMap[k] = domain.push(k));
- gKey = (gVals = groupby ? groupby.map(get) : Empty) + '';
+ gKey = (gVals = groupby ? groupby.map(get) : Empty$1) + '';
if (!(group = gMap[gKey])) {
group = gMap[gKey] = [];
groups.push(group);
group.values = gVals;
@@ -9990,11 +10090,11 @@
* @constructor
*/
function JoinAggregate(params) {
- Aggregate.call(this, params);
+ Aggregate$1.call(this, params);
}
JoinAggregate.Definition = {
'type': 'JoinAggregate',
'metadata': {
@@ -10022,11 +10122,11 @@
}, {
'name': 'key',
'type': 'field'
}]
};
- inherits(JoinAggregate, Aggregate, {
+ inherits(JoinAggregate, Aggregate$1, {
transform(_, pulse) {
const aggr = this,
mod = _.modified();
let cells; // process all input tuples to calculate aggregates
@@ -10042,11 +10142,11 @@
aggr.changes(); // write aggregate values to input tuples
pulse.visit(pulse.SOURCE, t => {
- extend(t, cells[aggr.cellkey(t)].tuple);
+ extend$1(t, cells[aggr.cellkey(t)].tuple);
});
return pulse.reflow(mod).modifies(this._outputs);
},
changes() {
@@ -10161,11 +10261,11 @@
transform(_, pulse) {
const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
if (!this.value || pulse.changed() || _.modified()) {
const source = pulse.materialize(pulse.SOURCE).source,
- groups = partition(source, _.groupby, _.field),
+ groups = partition$1$1(source, _.groupby, _.field),
names = (_.groupby || []).map(accessorName),
bandwidth = _.bandwidth,
method = _.cumulative ? 'cdf' : 'pdf',
as = _.as || ['value', 'density'],
values = [];
@@ -10193,11 +10293,11 @@
t[names[i]] = g.dims[i];
}
t[as[0]] = v[0];
t[as[1]] = v[1] * scale;
- values.push(ingest(t));
+ values.push(ingest$1(t));
});
});
if (this.value) out.rem = this.value;
this.value = out.add = out.source = values;
}
@@ -10214,17 +10314,17 @@
* @param {boolean} params.flat - A boolean flag indicating if the field names
* should be treated as flat property names, side-stepping nested field
* lookups normally indicated by dot or bracket notation.
*/
- function Key(params) {
- Operator.call(this, null, update$3, params);
+ function Key$1(params) {
+ Operator.call(this, null, update$2, params);
}
- inherits(Key, Operator);
+ inherits(Key$1, Operator);
- function update$3(_) {
+ function update$2(_) {
return this.value && !_.modified() ? this.value : key(_.fields, _.flat);
}
/**
* Load and parse data from an external source. Marshalls parameter
* values and then invokes the Dataflow request method.
@@ -10233,52 +10333,52 @@
* @param {string} params.url - The URL to load from.
* @param {object} params.format - The data format options.
*/
- function Load(params) {
+ function Load$1(params) {
Transform.call(this, [], params);
this._pending = null;
}
- inherits(Load, Transform, {
+ inherits(Load$1, Transform, {
transform(_, pulse) {
const df = pulse.dataflow;
if (this._pending) {
// update state and return pulse
- return output$1(this, pulse, this._pending);
+ return output(this, pulse, this._pending);
}
if (stop(_)) return pulse.StopPropagation;
if (_.values) {
// parse and ingest values, return output pulse
- return output$1(this, pulse, df.parse(_.values, _.format));
+ return output(this, pulse, df.parse(_.values, _.format));
} else if (_.async) {
// return promise for non-blocking async loading
const p = df.request(_.url, _.format).then(res => {
- this._pending = array(res.data);
+ this._pending = array$5(res.data);
return df => df.touch(this);
});
return {
async: p
};
} else {
// return promise for synchronous loading
- return df.request(_.url, _.format).then(res => output$1(this, pulse, array(res.data)));
+ return df.request(_.url, _.format).then(res => output(this, pulse, array$5(res.data)));
}
}
});
function stop(_) {
return _.modified('async') && !(_.modified('values') || _.modified('url') || _.modified('format'));
}
- function output$1(op, pulse, data) {
- data.forEach(ingest);
+ function output(op, pulse, data) {
+ data.forEach(ingest$1);
const out = pulse.fork(pulse.NO_FIELDS & pulse.NO_SOURCE);
out.rem = op.value;
op.value = out.source = out.add = data;
op._pending = null;
if (out.rem.length) out.clean(true);
@@ -10399,17 +10499,17 @@
* @constructor
* @param {object} params - The parameters for this operator.
* @param {Array<Array<number>>} params.extents - The input extents.
*/
- function MultiExtent(params) {
- Operator.call(this, null, update$4, params);
+ function MultiExtent$1(params) {
+ Operator.call(this, null, update$1, params);
}
- inherits(MultiExtent, Operator);
+ inherits(MultiExtent$1, Operator);
- function update$4(_) {
+ function update$1(_) {
if (this.value && !_.modified()) {
return this.value;
}
const ext = _.extents,
@@ -10433,32 +10533,32 @@
* @param {object} params - The parameters for this operator.
* @param {Array<Array<*>>} params.values - The input value arrrays.
*/
- function MultiValues(params) {
- Operator.call(this, null, update$5, params);
+ function MultiValues$1(params) {
+ Operator.call(this, null, update, params);
}
- inherits(MultiValues, Operator);
+ inherits(MultiValues$1, Operator);
- function update$5(_) {
+ function update(_) {
return this.value && !_.modified() ? this.value : _.values.reduce((data, _) => data.concat(_), []);
}
/**
* Operator whose value is simply its parameter hash. This operator is
* useful for enabling reactive updates to values of nested objects.
* @constructor
* @param {object} params - The parameters for this operator.
*/
- function Params(params) {
+ function Params$2(params) {
Transform.call(this, null, params);
}
- inherits(Params, Transform, {
+ inherits(Params$2, Transform, {
transform(_, pulse) {
this.modified(_.modified());
this.value = _;
return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS); // do not pass tuples
}
@@ -10480,11 +10580,11 @@
* number of pivoted fields to generate. The pivoted field names are sorted in
* ascending order prior to enforcing the limit.
*/
function Pivot(params) {
- Aggregate.call(this, params);
+ Aggregate$1.call(this, params);
}
Pivot.Definition = {
'type': 'Pivot',
'metadata': {
@@ -10515,12 +10615,12 @@
}, {
'name': 'key',
'type': 'field'
}]
};
- inherits(Pivot, Aggregate, {
- _transform: Aggregate.prototype.transform,
+ inherits(Pivot, Aggregate$1, {
+ _transform: Aggregate$1.prototype.transform,
transform(_, pulse) {
return this._transform(aggregateParams(_, pulse), pulse);
}
@@ -10539,19 +10639,19 @@
if (pulse.changed()) _.set('__pivot__', null, null, true);
return {
key: _.key,
groupby: _.groupby,
ops: keys.map(() => op),
- fields: keys.map(k => get(k, key, value, fields)),
+ fields: keys.map(k => get$4(k, key, value, fields)),
as: keys.map(k => k + ''),
modified: _.modified.bind(_)
};
} // Generate aggregate field accessor.
// Output NaN for non-existent values; aggregator will ignore!
- function get(k, key, value, fields) {
+ function get$4(k, key, value, fields) {
return accessor(d => key(d) === k ? value(d) : NaN, fields, k + '');
} // Collect (and optionally limit) all unique pivot values.
function pivotKeys(key, limit, pulse) {
@@ -10563,11 +10663,11 @@
if (!map[k]) {
map[k] = 1;
list.push(k);
}
});
- list.sort(ascending);
+ list.sort(ascending$3);
return limit ? list.slice(0, limit) : list;
}
/**
* Partitions pre-faceted data into tuple subflows.
* @constructor
@@ -10577,15 +10677,15 @@
* @param {function(object): Array<object>} params.field - The field
* accessor for an array of subflow tuple objects.
*/
- function PreFacet(params) {
- Facet.call(this, params);
+ function PreFacet$1(params) {
+ Facet$1.call(this, params);
}
- inherits(PreFacet, Facet, {
+ inherits(PreFacet$1, Facet$1, {
transform(_, pulse) {
const flow = _.subflow,
field = _.field,
subflow = t => this.subflow(tupleid(t), flow, pulse, t);
@@ -10600,11 +10700,11 @@
const sf = subflow(t);
field(t).forEach(_ => sf.mod(_));
});
pulse.visit(pulse.ADD, t => {
const sf = subflow(t);
- field(t).forEach(_ => sf.add(ingest(_)));
+ field(t).forEach(_ => sf.add(ingest$1(_)));
});
pulse.visit(pulse.REM, t => {
const sf = subflow(t);
field(t).forEach(_ => sf.rem(_));
});
@@ -10675,11 +10775,11 @@
const id = tupleid(t);
out.rem.push(lut[id]);
lut[id] = null;
});
pulse.visit(pulse.ADD, t => {
- const dt = derive(t, ingest({}));
+ const dt = derive(t, ingest$1({}));
lut[tupleid(t)] = dt;
out.add.push(dt);
});
pulse.visit(pulse.MOD, t => {
out.mod.push(derive(t, lut[tupleid(t)]));
@@ -10703,15 +10803,15 @@
* @param {object} params - The parameters for this operator.
* @param {*} params.value - The value to proxy, becomes the value of this operator.
*/
- function Proxy(params) {
+ function Proxy$1(params) {
Transform.call(this, null, params);
}
- inherits(Proxy, Transform, {
+ inherits(Proxy$1, Transform, {
transform(_, pulse) {
this.value = _.value;
return _.modified('value') ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;
}
@@ -10731,15 +10831,15 @@
* sampling quantile values. All values from one-half the step size up to
* 1 (exclusive) will be sampled. This parameter is only used if the
* *quantiles* parameter is not provided.
*/
- function Quantile(params) {
+ function Quantile$1(params) {
Transform.call(this, null, params);
}
- Quantile.Definition = {
+ Quantile$1.Definition = {
'type': 'Quantile',
'metadata': {
'generates': true,
'changes': true
},
@@ -10764,27 +10864,27 @@
'type': 'string',
'array': true,
'default': ['prob', 'value']
}]
};
- const EPSILON$1 = 1e-14;
- inherits(Quantile, Transform, {
+ const EPSILON$2 = 1e-14;
+ inherits(Quantile$1, Transform, {
transform(_, pulse) {
const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
as = _.as || ['prob', 'value'];
if (this.value && !_.modified() && !pulse.changed()) {
out.source = this.value;
return out;
}
const source = pulse.materialize(pulse.SOURCE).source,
- groups = partition(source, _.groupby, _.field),
+ groups = partition$1$1(source, _.groupby, _.field),
names = (_.groupby || []).map(accessorName),
values = [],
step = _.step || 0.01,
- p = _.probs || range$1(step / 2, 1 - EPSILON$1, step),
+ p = _.probs || range$1$1(step / 2, 1 - EPSILON$2, step),
n = p.length;
groups.forEach(g => {
const q = quantiles(g, p);
for (let i = 0; i < n; ++i) {
@@ -10794,11 +10894,11 @@
t[names[i]] = g.dims[i];
}
t[as[0]] = p[i];
t[as[1]] = q[i];
- values.push(ingest(t));
+ values.push(ingest$1(t));
}
});
if (this.value) out.rem = this.value;
this.value = out.add = out.source = values;
return out;
@@ -10814,15 +10914,15 @@
* @param {number} [params.derive=false] - Boolean flag indicating if
* the transform should make derived copies of incoming tuples.
* @constructor
*/
- function Relay(params) {
+ function Relay$1(params) {
Transform.call(this, null, params);
}
- inherits(Relay, Transform, {
+ inherits(Relay$1, Transform, {
transform(_, pulse) {
let out, lut;
if (this.value) {
lut = this.value;
@@ -11014,14 +11114,14 @@
transform(_, pulse) {
if (this.value && !_.modified()) return;
const out = pulse.materialize().fork(pulse.MOD),
as = _.as || 'data';
out.rem = this.value ? pulse.rem.concat(this.value) : pulse.rem;
- this.value = range$1(_.start, _.stop, _.step || 1).map(v => {
+ this.value = range$1$1(_.start, _.stop, _.step || 1).map(v => {
const t = {};
t[as] = v;
- return ingest(t);
+ return ingest$1(t);
});
out.add = pulse.add.concat(this.value);
return out;
}
@@ -11031,16 +11131,16 @@
* pulse contains some added, removed or modified tuples.
* @param {object} params - The parameters for this operator.
* @constructor
*/
- function Sieve(params) {
+ function Sieve$1(params) {
Transform.call(this, null, params);
this.modified(true); // always treat as modified
}
- inherits(Sieve, Transform, {
+ inherits(Sieve$1, Transform, {
transform(_, pulse) {
this.value = pulse.source;
return pulse.changed() ? pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS) : pulse.StopPropagation;
}
@@ -11149,19 +11249,19 @@
units,
step
} = _.units ? {
units: _.units,
step: _.step || 1
- } : bin({
+ } : bin$1({
extent: _.extent || extent(pulse.materialize(pulse.SOURCE).source, _.field),
maxbins: _.maxbins
}); // check / standardize time units
const tunits = timeUnits(units),
prev = this.value || {},
floor = (utc ? utcFloor : timeFloor)(tunits, step);
- floor.unit = peek(tunits);
+ floor.unit = peek$1(tunits);
floor.units = tunits;
floor.step = step;
floor.start = prev.start;
floor.stop = prev.stop;
return this.value = floor;
@@ -11214,15 +11314,15 @@
* @param {function(*,*): number} [params.sort] - An optional
* comparator function for sorting the values. The comparator will be
* applied to backing tuples prior to value extraction.
*/
- function Values(params) {
+ function Values$1(params) {
Transform.call(this, null, params);
}
- inherits(Values, Transform, {
+ inherits(Values$1, Transform, {
transform(_, pulse) {
const run = !this.value || _.modified('field') || _.modified('sort') || pulse.changed() || _.sort && pulse.modified(_.sort.fields);
if (run) {
this.value = (_.sort ? pulse.source.slice().sort(stableCompare(_.sort)) : pulse.source).map(_.field);
@@ -11232,11 +11332,11 @@
});
function WindowOp(op, field, param, as) {
const fn = WindowOps[op](field, param);
return {
- init: fn.init || zero,
+ init: fn.init || zero$2,
update: function (w, t) {
t[as] = fn.next(w);
}
};
}
@@ -11359,17 +11459,17 @@
let v, i;
return {
init: () => (v = null, i = -1),
next: w => {
const d = w.data;
- return w.index <= i ? v : (i = find(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]);
+ return w.index <= i ? v : (i = find$2(field, d, w.index)) < 0 ? (i = d.length, v = null) : v = field(d[i]);
}
};
}
};
- function find(field, data, index) {
+ function find$2(field, data, index) {
for (let n = data.length; index < n; ++index) {
const v = field(data[index]);
if (v != null) return index;
}
@@ -11377,75 +11477,75 @@
}
const ValidWindowOps = Object.keys(WindowOps);
function WindowState(_) {
- const ops = array(_.ops),
- fields = array(_.fields),
- params = array(_.params),
- as = array(_.as),
+ const ops = array$5(_.ops),
+ fields = array$5(_.fields),
+ params = array$5(_.params),
+ as = array$5(_.as),
outputs = this.outputs = [],
windows = this.windows = [],
inputs = {},
map = {},
counts = [],
measures = [];
let countOnly = true;
function visitInputs(f) {
- array(accessorFields(f)).forEach(_ => inputs[_] = 1);
+ array$5(accessorFields(f)).forEach(_ => inputs[_] = 1);
}
visitInputs(_.sort);
ops.forEach((op, i) => {
const field = fields[i],
mname = accessorName(field),
name = measureName(op, mname, as[i]);
visitInputs(field);
outputs.push(name); // Window operation
- if (has(WindowOps, op)) {
+ if (has$1(WindowOps, op)) {
windows.push(WindowOp(op, fields[i], params[i], name));
} // Aggregate operation
else {
- if (field == null && op !== 'count') {
- error('Null aggregate field specified.');
- }
+ if (field == null && op !== 'count') {
+ error('Null aggregate field specified.');
+ }
- if (op === 'count') {
- counts.push(name);
- return;
- }
+ if (op === 'count') {
+ counts.push(name);
+ return;
+ }
- countOnly = false;
- let m = map[mname];
+ countOnly = false;
+ let m = map[mname];
- if (!m) {
- m = map[mname] = [];
- m.field = field;
- measures.push(m);
- }
-
- m.push(createMeasure(op, name));
+ if (!m) {
+ m = map[mname] = [];
+ m.field = field;
+ measures.push(m);
}
+
+ m.push(createMeasure(op, name));
+ }
});
if (counts.length || measures.length) {
this.cell = cell(measures, counts, countOnly);
}
this.inputs = Object.keys(inputs);
}
- const prototype$1 = WindowState.prototype;
+ const prototype = WindowState.prototype;
- prototype$1.init = function () {
+ prototype.init = function () {
this.windows.forEach(_ => _.init());
if (this.cell) this.cell.init();
};
- prototype$1.update = function (w, t) {
+ prototype.update = function (w, t) {
const cell = this.cell,
wind = this.windows,
data = w.data,
m = wind && wind.length;
let j;
@@ -11649,19 +11749,19 @@
range = sort && !_.ignorePeers,
frame = _.frame || [null, 0],
data = list.data(cmp),
// use cmp for stable sort
n = data.length,
- b = range ? bisector(sort) : null,
+ b = range ? bisector$1(sort) : null,
w = {
i0: 0,
i1: 0,
p0: 0,
p1: 0,
index: 0,
data: data,
- compare: sort || constant(-1)
+ compare: sort || constant$4(-1)
};
state.init();
for (let i = 0; i < n; ++i) {
setWindow(w, frame, i, n);
@@ -11689,70 +11789,70 @@
if (r1 < n && !c(d[r1], d[r1 + 1])) w.i1 = bisect.right(d, d[r1]);
}
var tx = /*#__PURE__*/Object.freeze({
__proto__: null,
- aggregate: Aggregate,
+ aggregate: Aggregate$1,
bin: Bin,
- collect: Collect,
- compare: Compare,
+ collect: Collect$1,
+ compare: Compare$1,
countpattern: CountPattern,
cross: Cross,
density: Density,
dotbin: DotBin,
- expression: Expression,
+ expression: Expression$1,
extent: Extent,
- facet: Facet,
- field: Field,
+ facet: Facet$1,
+ field: Field$1,
filter: Filter,
flatten: Flatten,
fold: Fold,
formula: Formula,
generate: Generate,
impute: Impute,
joinaggregate: JoinAggregate,
kde: KDE,
- key: Key,
- load: Load,
+ key: Key$1,
+ load: Load$1,
lookup: Lookup,
- multiextent: MultiExtent,
- multivalues: MultiValues,
- params: Params,
+ multiextent: MultiExtent$1,
+ multivalues: MultiValues$1,
+ params: Params$2,
pivot: Pivot,
- prefacet: PreFacet,
+ prefacet: PreFacet$1,
project: Project,
- proxy: Proxy,
- quantile: Quantile,
- relay: Relay,
+ proxy: Proxy$1,
+ quantile: Quantile$1,
+ relay: Relay$1,
sample: Sample,
sequence: Sequence,
- sieve: Sieve,
+ sieve: Sieve$1,
subflow: Subflow,
timeunit: TimeUnit,
tupleindex: TupleIndex,
- values: Values,
+ values: Values$1,
window: Window
});
- const pi = Math.PI,
- tau = 2 * pi,
- epsilon$1 = 1e-6,
- tauEpsilon = tau - epsilon$1;
+ const pi$3 = Math.PI,
+ tau$3 = 2 * pi$3,
+ epsilon$4 = 1e-6,
+ tauEpsilon = tau$3 - epsilon$4;
- function Path() {
+ function Path$1() {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null; // end of current subpath
this._ = "";
}
- function path() {
- return new Path();
+ function path$3() {
+ return new Path$1();
}
- Path.prototype = path.prototype = {
- constructor: Path,
+ Path$1.prototype = path$3.prototype = {
+ constructor: Path$1,
moveTo: function (x, y) {
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
},
closePath: function () {
if (this._x1 !== null) {
@@ -11782,33 +11882,33 @@
if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x1,y1).
if (this._x1 === null) {
this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
} // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
- else if (!(l01_2 > epsilon$1)) ; // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
- // Equivalently, is (x1,y1) coincident with (x2,y2)?
- // Or, is the radius zero? Line to (x1,y1).
- else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r) {
- this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
- } // Otherwise, draw an arc!
- else {
- var x20 = x2 - x0,
- y20 = y2 - y0,
- l21_2 = x21 * x21 + y21 * y21,
- l20_2 = x20 * x20 + y20 * y20,
- l21 = Math.sqrt(l21_2),
- l01 = Math.sqrt(l01_2),
- l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
- t01 = l / l01,
- t21 = l / l21; // If the start tangent is not coincident with (x0,y0), line to.
+ else if (!(l01_2 > epsilon$4)) ; // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
+ // Equivalently, is (x1,y1) coincident with (x2,y2)?
+ // Or, is the radius zero? Line to (x1,y1).
+ else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$4) || !r) {
+ this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
+ } // Otherwise, draw an arc!
+ else {
+ var x20 = x2 - x0,
+ y20 = y2 - y0,
+ l21_2 = x21 * x21 + y21 * y21,
+ l20_2 = x20 * x20 + y20 * y20,
+ l21 = Math.sqrt(l21_2),
+ l01 = Math.sqrt(l01_2),
+ l = r * Math.tan((pi$3 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
+ t01 = l / l01,
+ t21 = l / l21; // If the start tangent is not coincident with (x0,y0), line to.
- if (Math.abs(t01 - 1) > epsilon$1) {
- this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
- }
+ if (Math.abs(t01 - 1) > epsilon$4) {
+ this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
+ }
- this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
- }
+ this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
+ }
},
arc: function (x, y, r, a0, a1, ccw) {
x = +x, y = +y, r = +r, ccw = !!ccw;
var dx = r * Math.cos(a0),
dy = r * Math.sin(a0),
@@ -11820,56 +11920,56 @@
if (r < 0) throw new Error("negative radius: " + r); // Is this path empty? Move to (x0,y0).
if (this._x1 === null) {
this._ += "M" + x0 + "," + y0;
} // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
- else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) {
- this._ += "L" + x0 + "," + y0;
- } // Is this arc empty? We’re done.
+ else if (Math.abs(this._x1 - x0) > epsilon$4 || Math.abs(this._y1 - y0) > epsilon$4) {
+ this._ += "L" + x0 + "," + y0;
+ } // Is this arc empty? We’re done.
if (!r) return; // Does the angle go the wrong way? Flip the direction.
- if (da < 0) da = da % tau + tau; // Is this a complete circle? Draw two arcs to complete the circle.
+ if (da < 0) da = da % tau$3 + tau$3; // Is this a complete circle? Draw two arcs to complete the circle.
if (da > tauEpsilon) {
this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
} // Is this arc non-empty? Draw an arc!
- else if (da > epsilon$1) {
- this._ += "A" + r + "," + r + ",0," + +(da >= pi) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
- }
+ else if (da > epsilon$4) {
+ this._ += "A" + r + "," + r + ",0," + +(da >= pi$3) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
+ }
},
rect: function (x, y, w, h) {
this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
},
toString: function () {
return this._;
}
};
- function constant$1 (x) {
+ function constant$3 (x) {
return function constant() {
return x;
};
}
- var abs = Math.abs;
- var atan2 = Math.atan2;
- var cos = Math.cos;
+ var abs$2 = Math.abs;
+ var atan2$1 = Math.atan2;
+ var cos$2 = Math.cos;
var max$1 = Math.max;
var min$1 = Math.min;
- var sin = Math.sin;
- var sqrt = Math.sqrt;
- var epsilon$2 = 1e-12;
- var pi$1 = Math.PI;
- var halfPi = pi$1 / 2;
- var tau$1 = 2 * pi$1;
- function acos(x) {
- return x > 1 ? 0 : x < -1 ? pi$1 : Math.acos(x);
+ var sin$2 = Math.sin;
+ var sqrt$3 = Math.sqrt;
+ var epsilon$3 = 1e-12;
+ var pi$2 = Math.PI;
+ var halfPi$2 = pi$2 / 2;
+ var tau$2 = 2 * pi$2;
+ function acos$1(x) {
+ return x > 1 ? 0 : x < -1 ? pi$2 : Math.acos(x);
}
- function asin(x) {
- return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
+ function asin$2(x) {
+ return x >= 1 ? halfPi$2 : x <= -1 ? -halfPi$2 : Math.asin(x);
}
function arcInnerRadius(d) {
return d.innerRadius;
}
@@ -11888,27 +11988,27 @@
function arcPadAngle(d) {
return d && d.padAngle; // Note: optional!
}
- function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
+ function intersect$3(x0, y0, x1, y1, x2, y2, x3, y3) {
var x10 = x1 - x0,
y10 = y1 - y0,
x32 = x3 - x2,
y32 = y3 - y2,
t = y32 * x10 - x32 * y10;
- if (t * t < epsilon$2) return;
+ if (t * t < epsilon$3) return;
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
return [x0 + t * x10, y0 + t * y10];
} // Compute perpendicular offset line of length rc.
// http://mathworld.wolfram.com/Circle-LineIntersection.html
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
var x01 = x0 - x1,
y01 = y0 - y1,
- lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
+ lo = (cw ? rc : -rc) / sqrt$3(x01 * x01 + y01 * y01),
ox = lo * y01,
oy = -lo * x01,
x11 = x0 + ox,
y11 = y0 + oy,
x10 = x1 + ox,
@@ -11918,11 +12018,11 @@
dx = x10 - x11,
dy = y10 - y11,
d2 = dx * dx + dy * dy,
r = r1 - rc,
D = x11 * y10 - x10 * y11,
- d = (dy < 0 ? -1 : 1) * sqrt(max$1(0, r * r * d2 - D * D)),
+ d = (dy < 0 ? -1 : 1) * sqrt$3(max$1(0, r * r * d2 - D * D)),
cx0 = (D * dy - dx * d) / d2,
cy0 = (-D * dx - dy * d) / d2,
cx1 = (D * dy + dx * d) / d2,
cy1 = (-D * dx + dy * d) / d2,
dx0 = cx0 - x00,
@@ -11940,14 +12040,14 @@
x11: cx0 * (r1 / r - 1),
y11: cy0 * (r1 / r - 1)
};
}
- function arc$2 () {
+ function arc$2$1 () {
var innerRadius = arcInnerRadius,
outerRadius = arcOuterRadius,
- cornerRadius = constant$1(0),
+ cornerRadius = constant$3(0),
padRadius = null,
startAngle = arcStartAngle,
endAngle = arcEndAngle,
padAngle = arcPadAngle,
context = null;
@@ -11955,161 +12055,161 @@
function arc() {
var buffer,
r,
r0 = +innerRadius.apply(this, arguments),
r1 = +outerRadius.apply(this, arguments),
- a0 = startAngle.apply(this, arguments) - halfPi,
- a1 = endAngle.apply(this, arguments) - halfPi,
- da = abs(a1 - a0),
+ a0 = startAngle.apply(this, arguments) - halfPi$2,
+ a1 = endAngle.apply(this, arguments) - halfPi$2,
+ da = abs$2(a1 - a0),
cw = a1 > a0;
- if (!context) context = buffer = path(); // Ensure that the outer radius is always larger than the inner radius.
+ if (!context) context = buffer = path$3(); // Ensure that the outer radius is always larger than the inner radius.
if (r1 < r0) r = r1, r1 = r0, r0 = r; // Is it a point?
- if (!(r1 > epsilon$2)) context.moveTo(0, 0); // Or is it a circle or annulus?
- else if (da > tau$1 - epsilon$2) {
- context.moveTo(r1 * cos(a0), r1 * sin(a0));
- context.arc(0, 0, r1, a0, a1, !cw);
+ if (!(r1 > epsilon$3)) context.moveTo(0, 0); // Or is it a circle or annulus?
+ else if (da > tau$2 - epsilon$3) {
+ context.moveTo(r1 * cos$2(a0), r1 * sin$2(a0));
+ context.arc(0, 0, r1, a0, a1, !cw);
- if (r0 > epsilon$2) {
- context.moveTo(r0 * cos(a1), r0 * sin(a1));
- context.arc(0, 0, r0, a1, a0, cw);
- }
- } // Or is it a circular or annular sector?
- else {
- var a01 = a0,
- a11 = a1,
- a00 = a0,
- a10 = a1,
- da0 = da,
- da1 = da,
- ap = padAngle.apply(this, arguments) / 2,
- rp = ap > epsilon$2 && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
- rc = min$1(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
- rc0 = rc,
- rc1 = rc,
- t0,
- t1; // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
+ if (r0 > epsilon$3) {
+ context.moveTo(r0 * cos$2(a1), r0 * sin$2(a1));
+ context.arc(0, 0, r0, a1, a0, cw);
+ }
+ } // Or is it a circular or annular sector?
+ else {
+ var a01 = a0,
+ a11 = a1,
+ a00 = a0,
+ a10 = a1,
+ da0 = da,
+ da1 = da,
+ ap = padAngle.apply(this, arguments) / 2,
+ rp = ap > epsilon$3 && (padRadius ? +padRadius.apply(this, arguments) : sqrt$3(r0 * r0 + r1 * r1)),
+ rc = min$1(abs$2(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
+ rc0 = rc,
+ rc1 = rc,
+ t0,
+ t1; // Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
- if (rp > epsilon$2) {
- var p0 = asin(rp / r0 * sin(ap)),
- p1 = asin(rp / r1 * sin(ap));
- if ((da0 -= p0 * 2) > epsilon$2) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;else da0 = 0, a00 = a10 = (a0 + a1) / 2;
- if ((da1 -= p1 * 2) > epsilon$2) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;else da1 = 0, a01 = a11 = (a0 + a1) / 2;
- }
+ if (rp > epsilon$3) {
+ var p0 = asin$2(rp / r0 * sin$2(ap)),
+ p1 = asin$2(rp / r1 * sin$2(ap));
+ if ((da0 -= p0 * 2) > epsilon$3) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;else da0 = 0, a00 = a10 = (a0 + a1) / 2;
+ if ((da1 -= p1 * 2) > epsilon$3) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;else da1 = 0, a01 = a11 = (a0 + a1) / 2;
+ }
- var x01 = r1 * cos(a01),
- y01 = r1 * sin(a01),
- x10 = r0 * cos(a10),
- y10 = r0 * sin(a10); // Apply rounded corners?
+ var x01 = r1 * cos$2(a01),
+ y01 = r1 * sin$2(a01),
+ x10 = r0 * cos$2(a10),
+ y10 = r0 * sin$2(a10); // Apply rounded corners?
- if (rc > epsilon$2) {
- var x11 = r1 * cos(a11),
- y11 = r1 * sin(a11),
- x00 = r0 * cos(a00),
- y00 = r0 * sin(a00),
- oc; // Restrict the corner radius according to the sector angle.
+ if (rc > epsilon$3) {
+ var x11 = r1 * cos$2(a11),
+ y11 = r1 * sin$2(a11),
+ x00 = r0 * cos$2(a00),
+ y00 = r0 * sin$2(a00),
+ oc; // Restrict the corner radius according to the sector angle.
- if (da < pi$1 && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
- var ax = x01 - oc[0],
- ay = y01 - oc[1],
- bx = x11 - oc[0],
- by = y11 - oc[1],
- kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
- lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
- rc0 = min$1(rc, (r0 - lc) / (kc - 1));
- rc1 = min$1(rc, (r1 - lc) / (kc + 1));
- }
- } // Is the sector collapsed to a line?
+ if (da < pi$2 && (oc = intersect$3(x01, y01, x00, y00, x11, y11, x10, y10))) {
+ var ax = x01 - oc[0],
+ ay = y01 - oc[1],
+ bx = x11 - oc[0],
+ by = y11 - oc[1],
+ kc = 1 / sin$2(acos$1((ax * bx + ay * by) / (sqrt$3(ax * ax + ay * ay) * sqrt$3(bx * bx + by * by))) / 2),
+ lc = sqrt$3(oc[0] * oc[0] + oc[1] * oc[1]);
+ rc0 = min$1(rc, (r0 - lc) / (kc - 1));
+ rc1 = min$1(rc, (r1 - lc) / (kc + 1));
+ }
+ } // Is the sector collapsed to a line?
- if (!(da1 > epsilon$2)) context.moveTo(x01, y01); // Does the sector’s outer ring have rounded corners?
- else if (rc1 > epsilon$2) {
- t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
- t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
- context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged?
+ if (!(da1 > epsilon$3)) context.moveTo(x01, y01); // Does the sector’s outer ring have rounded corners?
+ else if (rc1 > epsilon$3) {
+ t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
+ t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
+ context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged?
- if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring.
- else {
- context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
- context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
- context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
- }
- } // Or is the outer ring just a circular arc?
- else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); // Is there no inner ring, and it’s a circular sector?
- // Or perhaps it’s an annular sector collapsed due to padding?
+ if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring.
+ else {
+ context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw);
+ context.arc(0, 0, r1, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
+ context.arc(t1.cx, t1.cy, rc1, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw);
+ }
+ } // Or is the outer ring just a circular arc?
+ else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); // Is there no inner ring, and it’s a circular sector?
+ // Or perhaps it’s an annular sector collapsed due to padding?
- if (!(r0 > epsilon$2) || !(da0 > epsilon$2)) context.lineTo(x10, y10); // Does the sector’s inner ring (or point) have rounded corners?
- else if (rc0 > epsilon$2) {
- t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
- t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
- context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged?
+ if (!(r0 > epsilon$3) || !(da0 > epsilon$3)) context.lineTo(x10, y10); // Does the sector’s inner ring (or point) have rounded corners?
+ else if (rc0 > epsilon$3) {
+ t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
+ t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
+ context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01); // Have the corners merged?
- if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring.
- else {
- context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
- context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
- context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
- }
- } // Or is the inner ring just a circular arc?
- else context.arc(0, 0, r0, a10, a00, cw);
+ if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw); // Otherwise, draw the two corners and the ring.
+ else {
+ context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw);
+ context.arc(0, 0, r0, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), cw);
+ context.arc(t1.cx, t1.cy, rc0, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw);
}
+ } // Or is the inner ring just a circular arc?
+ else context.arc(0, 0, r0, a10, a00, cw);
+ }
context.closePath();
if (buffer) return context = null, buffer + "" || null;
}
arc.centroid = function () {
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
- a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$1 / 2;
- return [cos(a) * r, sin(a) * r];
+ a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$2 / 2;
+ return [cos$2(a) * r, sin$2(a) * r];
};
arc.innerRadius = function (_) {
- return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : innerRadius;
+ return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant$3(+_), arc) : innerRadius;
};
arc.outerRadius = function (_) {
- return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : outerRadius;
+ return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant$3(+_), arc) : outerRadius;
};
arc.cornerRadius = function (_) {
- return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$1(+_), arc) : cornerRadius;
+ return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant$3(+_), arc) : cornerRadius;
};
arc.padRadius = function (_) {
- return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), arc) : padRadius;
+ return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), arc) : padRadius;
};
arc.startAngle = function (_) {
- return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : startAngle;
+ return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant$3(+_), arc) : startAngle;
};
arc.endAngle = function (_) {
- return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : endAngle;
+ return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant$3(+_), arc) : endAngle;
};
arc.padAngle = function (_) {
- return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$1(+_), arc) : padAngle;
+ return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant$3(+_), arc) : padAngle;
};
arc.context = function (_) {
return arguments.length ? (context = _ == null ? null : _, arc) : context;
};
return arc;
}
- function array$1 (x) {
+ function array$4 (x) {
return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like
: Array.from(x); // Map, Set, iterable, string, or anything else
}
- function Linear(context) {
+ function Linear$1(context) {
this._context = context;
}
- Linear.prototype = {
+ Linear$1.prototype = {
areaStart: function () {
this._line = 0;
},
areaEnd: function () {
this._line = NaN;
@@ -12140,57 +12240,57 @@
break;
}
}
};
function curveLinear (context) {
- return new Linear(context);
+ return new Linear$1(context);
}
- function x(p) {
+ function x$3(p) {
return p[0];
}
- function y(p) {
+ function y$3(p) {
return p[1];
}
- function line$2 (x$1, y$1) {
- var defined = constant$1(true),
+ function line$2$1 (x, y) {
+ var defined = constant$3(true),
context = null,
curve = curveLinear,
output = null;
- x$1 = typeof x$1 === "function" ? x$1 : x$1 === undefined ? x : constant$1(x$1);
- y$1 = typeof y$1 === "function" ? y$1 : y$1 === undefined ? y : constant$1(y$1);
+ x = typeof x === "function" ? x : x === undefined ? x$3 : constant$3(x);
+ y = typeof y === "function" ? y : y === undefined ? y$3 : constant$3(y);
function line(data) {
var i,
- n = (data = array$1(data)).length,
+ n = (data = array$4(data)).length,
d,
defined0 = false,
buffer;
- if (context == null) output = curve(buffer = path());
+ if (context == null) output = curve(buffer = path$3());
for (i = 0; i <= n; ++i) {
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0) output.lineStart();else output.lineEnd();
}
- if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data));
+ if (defined0) output.point(+x(d, i, data), +y(d, i, data));
}
if (buffer) return output = null, buffer + "" || null;
}
line.x = function (_) {
- return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant$1(+_), line) : x$1;
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant$3(+_), line) : x;
};
line.y = function (_) {
- return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant$1(+_), line) : y$1;
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant$3(+_), line) : y;
};
line.defined = function (_) {
- return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), line) : defined;
+ return arguments.length ? (defined = typeof _ === "function" ? _ : constant$3(!!_), line) : defined;
};
line.curve = function (_) {
return arguments.length ? (curve = _, context != null && (output = curve(context)), line) : curve;
};
@@ -12200,31 +12300,31 @@
};
return line;
}
- function area$2 (x0, y0, y1) {
+ function area$2$1 (x0, y0, y1) {
var x1 = null,
- defined = constant$1(true),
+ defined = constant$3(true),
context = null,
curve = curveLinear,
output = null;
- x0 = typeof x0 === "function" ? x0 : x0 === undefined ? x : constant$1(+x0);
- y0 = typeof y0 === "function" ? y0 : y0 === undefined ? constant$1(0) : constant$1(+y0);
- y1 = typeof y1 === "function" ? y1 : y1 === undefined ? y : constant$1(+y1);
+ x0 = typeof x0 === "function" ? x0 : x0 === undefined ? x$3 : constant$3(+x0);
+ y0 = typeof y0 === "function" ? y0 : y0 === undefined ? constant$3(0) : constant$3(+y0);
+ y1 = typeof y1 === "function" ? y1 : y1 === undefined ? y$3 : constant$3(+y1);
function area(data) {
var i,
j,
k,
- n = (data = array$1(data)).length,
+ n = (data = array$4(data)).length,
d,
defined0 = false,
buffer,
x0z = new Array(n),
y0z = new Array(n);
- if (context == null) output = curve(buffer = path());
+ if (context == null) output = curve(buffer = path$3());
for (i = 0; i <= n; ++i) {
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0) {
j = i;
@@ -12251,35 +12351,35 @@
if (buffer) return output = null, buffer + "" || null;
}
function arealine() {
- return line$2().defined(defined).curve(curve).context(context);
+ return line$2$1().defined(defined).curve(curve).context(context);
}
area.x = function (_) {
- return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), x1 = null, area) : x0;
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$3(+_), x1 = null, area) : x0;
};
area.x0 = function (_) {
- return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$1(+_), area) : x0;
+ return arguments.length ? (x0 = typeof _ === "function" ? _ : constant$3(+_), area) : x0;
};
area.x1 = function (_) {
- return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : x1;
+ return arguments.length ? (x1 = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), area) : x1;
};
area.y = function (_) {
- return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), y1 = null, area) : y0;
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$3(+_), y1 = null, area) : y0;
};
area.y0 = function (_) {
- return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$1(+_), area) : y0;
+ return arguments.length ? (y0 = typeof _ === "function" ? _ : constant$3(+_), area) : y0;
};
area.y1 = function (_) {
- return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$1(+_), area) : y1;
+ return arguments.length ? (y1 = _ == null ? null : typeof _ === "function" ? _ : constant$3(+_), area) : y1;
};
area.lineX0 = area.lineY0 = function () {
return arealine().x(x0).y(y0);
};
@@ -12291,11 +12391,11 @@
area.lineX1 = function () {
return arealine().x(x1).y(y0);
};
area.defined = function (_) {
- return arguments.length ? (defined = typeof _ === "function" ? _ : constant$1(!!_), area) : defined;
+ return arguments.length ? (defined = typeof _ === "function" ? _ : constant$3(!!_), area) : defined;
};
area.curve = function (_) {
return arguments.length ? (curve = _, context != null && (output = curve(context)), area) : curve;
};
@@ -12305,48 +12405,48 @@
};
return area;
}
- var circle = {
+ var circle$1 = {
draw: function (context, size) {
- var r = Math.sqrt(size / pi$1);
+ var r = Math.sqrt(size / pi$2);
context.moveTo(r, 0);
- context.arc(0, 0, r, 0, tau$1);
+ context.arc(0, 0, r, 0, tau$2);
}
};
function symbol$2 (type, size) {
var context = null;
- type = typeof type === "function" ? type : constant$1(type || circle);
- size = typeof size === "function" ? size : constant$1(size === undefined ? 64 : +size);
+ type = typeof type === "function" ? type : constant$3(type || circle$1);
+ size = typeof size === "function" ? size : constant$3(size === undefined ? 64 : +size);
function symbol() {
var buffer;
- if (!context) context = buffer = path();
+ if (!context) context = buffer = path$3();
type.apply(this, arguments).draw(context, +size.apply(this, arguments));
if (buffer) return context = null, buffer + "" || null;
}
symbol.type = function (_) {
- return arguments.length ? (type = typeof _ === "function" ? _ : constant$1(_), symbol) : type;
+ return arguments.length ? (type = typeof _ === "function" ? _ : constant$3(_), symbol) : type;
};
symbol.size = function (_) {
- return arguments.length ? (size = typeof _ === "function" ? _ : constant$1(+_), symbol) : size;
+ return arguments.length ? (size = typeof _ === "function" ? _ : constant$3(+_), symbol) : size;
};
symbol.context = function (_) {
return arguments.length ? (context = _ == null ? null : _, symbol) : context;
};
return symbol;
}
- function noop$1 () {}
+ function noop$3 () {}
- function point(that, x, y) {
+ function point$5(that, x, y) {
that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6);
}
function Basis(context) {
this._context = context;
}
@@ -12362,11 +12462,11 @@
this._point = 0;
},
lineEnd: function () {
switch (this._point) {
case 3:
- point(this, this._x1, this._y1);
+ point$5(this, this._x1, this._y1);
// proceed
case 2:
this._context.lineTo(this._x1, this._y1);
@@ -12395,11 +12495,11 @@
this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
// proceed
default:
- point(this, x, y);
+ point$5(this, x, y);
break;
}
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
@@ -12412,12 +12512,12 @@
function BasisClosed(context) {
this._context = context;
}
BasisClosed.prototype = {
- areaStart: noop$1,
- areaEnd: noop$1,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function () {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN;
this._point = 0;
},
lineEnd: function () {
@@ -12472,11 +12572,11 @@
this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6);
break;
default:
- point(this, x, y);
+ point$5(this, x, y);
break;
}
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
@@ -12527,11 +12627,11 @@
case 3:
this._point = 4;
// proceed
default:
- point(this, x, y);
+ point$5(this, x, y);
break;
}
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
@@ -12593,11 +12693,11 @@
};
return bundle;
})(0.85);
- function point$1(that, x, y) {
+ function point$4(that, x, y) {
that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2);
}
function Cardinal(context, tension) {
this._context = context;
this._k = (1 - tension) / 6;
@@ -12619,11 +12719,11 @@
this._context.lineTo(this._x2, this._y2);
break;
case 3:
- point$1(this, this._x1, this._y1);
+ point$4(this, this._x1, this._y1);
break;
}
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
this._line = 1 - this._line;
@@ -12645,11 +12745,11 @@
case 2:
this._point = 3;
// proceed
default:
- point$1(this, x, y);
+ point$4(this, x, y);
break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
@@ -12670,12 +12770,12 @@
function CardinalClosed(context, tension) {
this._context = context;
this._k = (1 - tension) / 6;
}
CardinalClosed.prototype = {
- areaStart: noop$1,
- areaEnd: noop$1,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function () {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
this._point = 0;
},
lineEnd: function () {
@@ -12727,11 +12827,11 @@
this._point = 3;
this._x5 = x, this._y5 = y;
break;
default:
- point$1(this, x, y);
+ point$4(this, x, y);
break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
@@ -12788,11 +12888,11 @@
case 3:
this._point = 4;
// proceed
default:
- point$1(this, x, y);
+ point$4(this, x, y);
break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
@@ -12808,24 +12908,24 @@
};
return cardinal;
})(0);
- function point$2(that, x, y) {
+ function point$3(that, x, y) {
var x1 = that._x1,
y1 = that._y1,
x2 = that._x2,
y2 = that._y2;
- if (that._l01_a > epsilon$2) {
+ if (that._l01_a > epsilon$3) {
var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a,
n = 3 * that._l01_a * (that._l01_a + that._l12_a);
x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n;
y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
}
- if (that._l23_a > epsilon$2) {
+ if (that._l23_a > epsilon$3) {
var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a,
m = 3 * that._l23_a * (that._l23_a + that._l12_a);
x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m;
y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
}
@@ -12886,11 +12986,11 @@
case 2:
this._point = 3;
// proceed
default:
- point$2(this, x, y);
+ point$3(this, x, y);
break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
@@ -12914,12 +13014,12 @@
this._context = context;
this._alpha = alpha;
}
CatmullRomClosed.prototype = {
- areaStart: noop$1,
- areaEnd: noop$1,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function () {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
},
lineEnd: function () {
@@ -12977,11 +13077,11 @@
this._point = 3;
this._x5 = x, this._y5 = y;
break;
default:
- point$2(this, x, y);
+ point$3(this, x, y);
break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
@@ -13047,11 +13147,11 @@
case 3:
this._point = 4;
// proceed
default:
- point$2(this, x, y);
+ point$3(this, x, y);
break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a;
this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a;
@@ -13074,12 +13174,12 @@
function LinearClosed(context) {
this._context = context;
}
LinearClosed.prototype = {
- areaStart: noop$1,
- areaEnd: noop$1,
+ areaStart: noop$3,
+ areaEnd: noop$3,
lineStart: function () {
this._point = 0;
},
lineEnd: function () {
if (this._point) this._context.closePath();
@@ -13091,11 +13191,11 @@
};
function curveLinearClosed (context) {
return new LinearClosed(context);
}
- function sign(x) {
+ function sign$1(x) {
return x < 0 ? -1 : 1;
} // Calculate the slopes of the tangents (Hermite-type interpolation) based on
// the following paper: Steffen, M. 1990. A Simple Method for Monotonic
// Interpolation in One Dimension. Astronomy and Astrophysics, Vol. 239, NO.
// NOV(II), P. 443, 1990.
@@ -13105,11 +13205,11 @@
var h0 = that._x1 - that._x0,
h1 = x2 - that._x1,
s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0),
s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0),
p = (s0 * h1 + s1 * h0) / (h0 + h1);
- return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
+ return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0;
} // Calculate a one-sided slope.
function slope2(that, t) {
var h = that._x1 - that._x0;
@@ -13117,11 +13217,11 @@
} // According to https://en.wikipedia.org/wiki/Cubic_Hermite_spline#Representations
// "you can express cubic Hermite interpolation in terms of cubic Bézier curves
// with respect to the four values p0, p0 + m0 / 3, p1 - m1 / 3, p1".
- function point$3(that, t0, t1) {
+ function point$2(that, t0, t1) {
var x0 = that._x0,
y0 = that._y0,
x1 = that._x1,
y1 = that._y1,
dx = (x1 - x0) / 3;
@@ -13150,11 +13250,11 @@
this._context.lineTo(this._x1, this._y1);
break;
case 3:
- point$3(this, this._t0, slope2(this, this._t0));
+ point$2(this, this._t0, slope2(this, this._t0));
break;
}
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
this._line = 1 - this._line;
@@ -13174,15 +13274,15 @@
this._point = 2;
break;
case 2:
this._point = 3;
- point$3(this, slope2(this, t1 = slope3(this, x, y)), t1);
+ point$2(this, slope2(this, t1 = slope3(this, x, y)), t1);
break;
default:
- point$3(this, this._t0, t1 = slope3(this, x, y));
+ point$2(this, this._t0, t1 = slope3(this, x, y));
break;
}
this._x0 = this._x1, this._x1 = x;
this._y0 = this._y1, this._y1 = y;
@@ -13375,10 +13475,11 @@
}
}
return null;
}
+
const domImage = () => typeof Image !== 'undefined' ? Image : null;
function initRange(domain, range) {
switch (arguments.length) {
case 0:
@@ -13467,11 +13568,11 @@
function define (constructor, factory, prototype) {
constructor.prototype = factory.prototype = prototype;
prototype.constructor = constructor;
}
- function extend$1(parent, definition) {
+ function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition) prototype[key] = definition[key];
return prototype;
@@ -13638,11 +13739,11 @@
white: 0xffffff,
whitesmoke: 0xf5f5f5,
yellow: 0xffff00,
yellowgreen: 0x9acd32
};
- define(Color, color, {
+ define(Color, color$2, {
copy: function (channels) {
return Object.assign(new this.constructor(), this, channels);
},
displayable: function () {
return this.rgb().displayable();
@@ -13665,11 +13766,11 @@
function color_formatRgb() {
return this.rgb().formatRgb();
}
- function color(format) {
+ function color$2(format) {
var m, l;
format = (format + "").trim().toLowerCase();
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
: l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00
: l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
@@ -13693,25 +13794,25 @@
if (a <= 0) r = g = b = NaN;
return new Rgb(r, g, b, a);
}
function rgbConvert(o) {
- if (!(o instanceof Color)) o = color(o);
+ if (!(o instanceof Color)) o = color$2(o);
if (!o) return new Rgb();
o = o.rgb();
return new Rgb(o.r, o.g, o.b, o.opacity);
}
- function rgb(r, g, b, opacity) {
+ function rgb$1(r, g, b, opacity) {
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
}
function Rgb(r, g, b, opacity) {
this.r = +r;
this.g = +g;
this.b = +b;
this.opacity = +opacity;
}
- define(Rgb, rgb, extend$1(Color, {
+ define(Rgb, rgb$1, extend(Color, {
brighter: function (k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker: function (k) {
@@ -13751,11 +13852,11 @@
return new Hsl(h, s, l, a);
}
function hslConvert(o) {
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
- if (!(o instanceof Color)) o = color(o);
+ if (!(o instanceof Color)) o = color$2(o);
if (!o) return new Hsl();
if (o instanceof Hsl) return o;
o = o.rgb();
var r = o.r / 255,
g = o.g / 255,
@@ -13774,22 +13875,22 @@
s = l > 0 && l < 1 ? 0 : h;
}
return new Hsl(h, s, l, o.opacity);
}
- function hsl(h, s, l, opacity) {
+ function hsl$2(h, s, l, opacity) {
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
}
function Hsl(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
- define(Hsl, hsl, extend$1(Color, {
+ define(Hsl, hsl$2, extend(Color, {
brighter: function (k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker: function (k) {
@@ -13817,21 +13918,21 @@
function hsl2rgb(h, m1, m2) {
return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
}
- const radians = Math.PI / 180;
- const degrees = 180 / Math.PI;
+ const radians$1 = Math.PI / 180;
+ const degrees$2 = 180 / Math.PI;
const K = 18,
Xn = 0.96422,
Yn = 1,
Zn = 0.82521,
- t0$2 = 4 / 29,
- t1$1 = 6 / 29,
- t2 = 3 * t1$1 * t1$1,
- t3 = t1$1 * t1$1 * t1$1;
+ t0 = 4 / 29,
+ t1 = 6 / 29,
+ t2 = 3 * t1 * t1,
+ t3 = t1 * t1 * t1;
function labConvert(o) {
if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
if (o instanceof Hcl) return hcl2lab(o);
if (!(o instanceof Rgb)) o = rgbConvert(o);
@@ -13845,20 +13946,20 @@
x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
}
return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}
- function lab(l, a, b, opacity) {
+ function lab$1(l, a, b, opacity) {
return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}
function Lab(l, a, b, opacity) {
this.l = +l;
this.a = +a;
this.b = +b;
this.opacity = +opacity;
}
- define(Lab, lab, extend$1(Color, {
+ define(Lab, lab$1, extend(Color, {
brighter: function (k) {
return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
},
darker: function (k) {
return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
@@ -13873,15 +13974,15 @@
return new Rgb(lrgb2rgb(3.1338561 * x - 1.6168667 * y - 0.4906146 * z), lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z), lrgb2rgb(0.0719453 * x - 0.2289914 * y + 1.4052427 * z), this.opacity);
}
}));
function xyz2lab(t) {
- return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$2;
+ return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
}
function lab2xyz(t) {
- return t > t1$1 ? t * t * t : t2 * (t - t0$2);
+ return t > t1 ? t * t * t : t2 * (t - t0);
}
function lrgb2rgb(x) {
return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}
@@ -13892,14 +13993,14 @@
function hclConvert(o) {
if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
if (!(o instanceof Lab)) o = labConvert(o);
if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
- var h = Math.atan2(o.b, o.a) * degrees;
+ var h = Math.atan2(o.b, o.a) * degrees$2;
return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}
- function hcl(h, c, l, opacity) {
+ function hcl$2(h, c, l, opacity) {
return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}
function Hcl(h, c, l, opacity) {
this.h = +h;
this.c = +c;
@@ -13907,15 +14008,15 @@
this.opacity = +opacity;
}
function hcl2lab(o) {
if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
- var h = o.h * radians;
+ var h = o.h * radians$1;
return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}
- define(Hcl, hcl, extend$1(Color, {
+ define(Hcl, hcl$2, extend(Color, {
brighter: function (k) {
return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
},
darker: function (k) {
return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
@@ -13925,57 +14026,57 @@
}
}));
var A = -0.14861,
B = +1.78277,
- C = -0.29227,
+ C$1 = -0.29227,
D = -0.90649,
E = +1.97294,
ED = E * D,
EB = E * B,
- BC_DA = B * C - D * A;
+ BC_DA = B * C$1 - D * A;
function cubehelixConvert(o) {
if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
if (!(o instanceof Rgb)) o = rgbConvert(o);
var r = o.r / 255,
g = o.g / 255,
b = o.b / 255,
l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
bl = b - l,
- k = (E * (g - l) - C * bl) / D,
+ k = (E * (g - l) - C$1 * bl) / D,
s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)),
// NaN if l=0 or l=1
- h = s ? Math.atan2(k, bl) * degrees - 120 : NaN;
+ h = s ? Math.atan2(k, bl) * degrees$2 - 120 : NaN;
return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}
- function cubehelix(h, s, l, opacity) {
+ function cubehelix$2(h, s, l, opacity) {
return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
}
function Cubehelix(h, s, l, opacity) {
this.h = +h;
this.s = +s;
this.l = +l;
this.opacity = +opacity;
}
- define(Cubehelix, cubehelix, extend$1(Color, {
+ define(Cubehelix, cubehelix$2, extend(Color, {
brighter: function (k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
darker: function (k) {
k = k == null ? darker : Math.pow(darker, k);
return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
},
rgb: function () {
- var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
+ var h = isNaN(this.h) ? 0 : (this.h + 120) * radians$1,
l = +this.l,
a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
cosh = Math.cos(h),
sinh = Math.sin(h);
- return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
+ return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C$1 * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
}
}));
function basis(t1, v0, v1, v2, v3) {
var t2 = t1 * t1,
@@ -14018,11 +14119,11 @@
return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function (t) {
return Math.pow(a + t * b, y);
};
}
- function hue(a, b) {
+ function hue$1(a, b) {
var d = b - a;
return d ? linear$1(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$2(isNaN(a) ? b : a);
}
function gamma(y) {
return (y = +y) === 1 ? nogamma : function (a, b) {
@@ -14032,15 +14133,15 @@
function nogamma(a, b) {
var d = b - a;
return d ? linear$1(a, d) : constant$2(isNaN(a) ? b : a);
}
- var rgb$1 = (function rgbGamma(y) {
+ var rgb = (function rgbGamma(y) {
var color = gamma(y);
- function rgb$1(start, end) {
- var r = color((start = rgb(start)).r, (end = rgb(end)).r),
+ function rgb(start, end) {
+ var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
g = color(start.g, end.g),
b = color(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function (t) {
start.r = r(t);
@@ -14049,12 +14150,12 @@
start.opacity = opacity(t);
return start + "";
};
}
- rgb$1.gamma = rgbGamma;
- return rgb$1;
+ rgb.gamma = rgbGamma;
+ return rgb;
})(1);
function rgbSpline(spline) {
return function (colors) {
var n = colors.length,
@@ -14063,11 +14164,11 @@
b = new Array(n),
i,
color;
for (i = 0; i < n; ++i) {
- color = rgb(colors[i]);
+ color = rgb$1(colors[i]);
r[i] = color.r || 0;
g[i] = color.g || 0;
b[i] = color.b || 0;
}
@@ -14100,11 +14201,11 @@
}
function isNumberArray(x) {
return ArrayBuffer.isView(x) && !(x instanceof DataView);
}
- function array$2 (a, b) {
+ function array$3 (a, b) {
return (isNumberArray(b) ? numberArray : genericArray)(a, b);
}
function genericArray(a, b) {
var nb = b ? b.length : 0,
na = a ? Math.min(nb, a.length) : 0,
@@ -14121,11 +14222,11 @@
return c;
};
}
- function date (a, b) {
+ function date$1 (a, b) {
var d = new Date();
return a = +a, b = +b, function (t) {
return d.setTime(a * (1 - t) + b * t), d;
};
}
@@ -14134,11 +14235,11 @@
return a = +a, b = +b, function (t) {
return a * (1 - t) + b * t;
};
}
- function object$1 (a, b) {
+ function object (a, b) {
var i = {},
c = {},
k;
if (a === null || typeof a !== "object") a = {};
if (b === null || typeof b !== "object") b = {};
@@ -14232,22 +14333,22 @@
}
function interpolate$1 (a, b) {
var t = typeof b,
c;
- return b == null || t === "boolean" ? constant$2(b) : (t === "number" ? interpolateNumber : t === "string" ? (c = color(b)) ? (b = c, rgb$1) : string : b instanceof color ? rgb$1 : b instanceof Date ? date : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object$1 : interpolateNumber)(a, b);
+ return b == null || t === "boolean" ? constant$2(b) : (t === "number" ? interpolateNumber : t === "string" ? (c = color$2(b)) ? (b = c, rgb) : string : b instanceof color$2 ? rgb : b instanceof Date ? date$1 : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object : interpolateNumber)(a, b);
}
- function discrete (range) {
+ function discrete$1 (range) {
var n = range.length;
return function (t) {
return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
};
}
- function hue$1 (a, b) {
- var i = hue(+a, +b);
+ function hue (a, b) {
+ var i = hue$1(+a, +b);
return function (t) {
var x = i(t);
return x - 360 * Math.floor(x / 360);
};
}
@@ -14383,11 +14484,11 @@
}
var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
- var epsilon2 = 1e-12;
+ var epsilon2$1 = 1e-12;
function cosh(x) {
return ((x = Math.exp(x)) + 1 / x) / 2;
}
@@ -14397,11 +14498,11 @@
function tanh(x) {
return ((x = Math.exp(2 * x)) - 1) / (x + 1);
}
- var zoom$1 = (function zoomRho(rho, rho2, rho4) {
+ var zoom = (function zoomRho(rho, rho2, rho4) {
// p0 = [ux0, uy0, w0]
// p1 = [ux1, uy1, w1]
function zoom(p0, p1) {
var ux0 = p0[0],
uy0 = p0[1],
@@ -14413,32 +14514,32 @@
dy = uy1 - uy0,
d2 = dx * dx + dy * dy,
i,
S; // Special case for u0 ≅ u1.
- if (d2 < epsilon2) {
+ if (d2 < epsilon2$1) {
S = Math.log(w1 / w0) / rho;
i = function (t) {
return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)];
};
} // General case.
else {
- var d1 = Math.sqrt(d2),
- b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
- b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
- r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
- r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
- S = (r1 - r0) / rho;
+ var d1 = Math.sqrt(d2),
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
+ S = (r1 - r0) / rho;
- i = function (t) {
- var s = t * S,
- coshr0 = cosh(r0),
- u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
- return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
- };
- }
+ i = function (t) {
+ var s = t * S,
+ coshr0 = cosh(r0),
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
+ return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
+ };
+ }
i.duration = S * 1000 * rho / Math.SQRT2;
return i;
}
@@ -14451,13 +14552,13 @@
};
return zoom;
})(Math.SQRT2, 2, 4);
- function hsl$1(hue) {
+ function hsl(hue) {
return function (start, end) {
- var h = hue((start = hsl(start)).h, (end = hsl(end)).h),
+ var h = hue((start = hsl$2(start)).h, (end = hsl$2(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function (t) {
start.h = h(t);
@@ -14467,15 +14568,15 @@
return start + "";
};
};
}
- var hsl$2 = hsl$1(hue);
- var hslLong = hsl$1(nogamma);
+ var hsl$1 = hsl(hue$1);
+ var hslLong = hsl(nogamma);
- function lab$1(start, end) {
- var l = nogamma((start = lab(start)).l, (end = lab(end)).l),
+ function lab(start, end) {
+ var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l),
a = nogamma(start.a, end.a),
b = nogamma(start.b, end.b),
opacity = nogamma(start.opacity, end.opacity);
return function (t) {
start.l = l(t);
@@ -14484,13 +14585,13 @@
start.opacity = opacity(t);
return start + "";
};
}
- function hcl$1(hue) {
+ function hcl(hue) {
return function (start, end) {
- var h = hue((start = hcl(start)).h, (end = hcl(end)).h),
+ var h = hue((start = hcl$2(start)).h, (end = hcl$2(end)).h),
c = nogamma(start.c, end.c),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function (t) {
start.h = h(t);
@@ -14500,19 +14601,19 @@
return start + "";
};
};
}
- var hcl$2 = hcl$1(hue);
- var hclLong = hcl$1(nogamma);
+ var hcl$1 = hcl(hue$1);
+ var hclLong = hcl(nogamma);
- function cubehelix$1(hue) {
+ function cubehelix(hue) {
return function cubehelixGamma(y) {
y = +y;
- function cubehelix$1(start, end) {
- var h = hue((start = cubehelix(start)).h, (end = cubehelix(end)).h),
+ function cubehelix(start, end) {
+ var h = hue((start = cubehelix$2(start)).h, (end = cubehelix$2(end)).h),
s = nogamma(start.s, end.s),
l = nogamma(start.l, end.l),
opacity = nogamma(start.opacity, end.opacity);
return function (t) {
start.h = h(t);
@@ -14521,17 +14622,17 @@
start.opacity = opacity(t);
return start + "";
};
}
- cubehelix$1.gamma = cubehelixGamma;
- return cubehelix$1;
+ cubehelix.gamma = cubehelixGamma;
+ return cubehelix;
}(1);
}
- var cubehelix$2 = cubehelix$1(hue);
- var cubehelixLong = cubehelix$1(nogamma);
+ var cubehelix$1 = cubehelix(hue$1);
+ var cubehelixLong = cubehelix(nogamma);
function piecewise(interpolate, values) {
if (values === undefined) values = interpolate, interpolate = interpolate$1;
var i = 0,
n = values.length - 1,
@@ -14544,61 +14645,61 @@
var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
return I[i](t - i);
};
}
- function quantize (interpolator, n) {
+ function quantize$2 (interpolator, n) {
var samples = new Array(n);
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
return samples;
}
var $$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
interpolate: interpolate$1,
- interpolateArray: array$2,
+ interpolateArray: array$3,
interpolateBasis: basis$1,
interpolateBasisClosed: basisClosed,
- interpolateDate: date,
- interpolateDiscrete: discrete,
- interpolateHue: hue$1,
+ interpolateDate: date$1,
+ interpolateDiscrete: discrete$1,
+ interpolateHue: hue,
interpolateNumber: interpolateNumber,
interpolateNumberArray: numberArray,
- interpolateObject: object$1,
+ interpolateObject: object,
interpolateRound: interpolateRound,
interpolateString: string,
interpolateTransformCss: interpolateTransformCss,
interpolateTransformSvg: interpolateTransformSvg,
- interpolateZoom: zoom$1,
- interpolateRgb: rgb$1,
+ interpolateZoom: zoom,
+ interpolateRgb: rgb,
interpolateRgbBasis: rgbBasis,
interpolateRgbBasisClosed: rgbBasisClosed,
- interpolateHsl: hsl$2,
+ interpolateHsl: hsl$1,
interpolateHslLong: hslLong,
- interpolateLab: lab$1,
- interpolateHcl: hcl$2,
+ interpolateLab: lab,
+ interpolateHcl: hcl$1,
interpolateHclLong: hclLong,
- interpolateCubehelix: cubehelix$2,
+ interpolateCubehelix: cubehelix$1,
interpolateCubehelixLong: cubehelixLong,
piecewise: piecewise,
- quantize: quantize
+ quantize: quantize$2
});
function constants(x) {
return function () {
return x;
};
}
- function number$1(x) {
+ function number$5(x) {
return +x;
}
var unit = [0, 1];
- function identity$4(x) {
+ function identity$2(x) {
return x;
}
function normalize(a, b) {
return (b -= a = +a) ? function (x) {
@@ -14642,48 +14743,48 @@
d[i] = normalize(domain[i], domain[i + 1]);
r[i] = interpolate(range[i], range[i + 1]);
}
return function (x) {
- var i = bisectRight(domain, x, 1, j) - 1;
+ var i = bisect$1(domain, x, 1, j) - 1;
return r[i](d[i](x));
};
}
- function copy(source, target) {
+ function copy$2(source, target) {
return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
}
- function transformer() {
+ function transformer$3() {
var domain = unit,
range = unit,
interpolate = interpolate$1,
transform,
untransform,
unknown,
- clamp = identity$4,
+ clamp = identity$2,
piecewise,
output,
input;
function rescale() {
var n = Math.min(domain.length, range.length);
- if (clamp !== identity$4) clamp = clamper(domain[0], domain[n - 1]);
+ if (clamp !== identity$2) clamp = clamper(domain[0], domain[n - 1]);
piecewise = n > 2 ? polymap : bimap;
output = input = null;
return scale;
}
function scale(x) {
- return isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
+ return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate)))(transform(clamp(x)));
}
scale.invert = function (y) {
return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y)));
};
scale.domain = function (_) {
- return arguments.length ? (domain = Array.from(_, number$1), rescale()) : domain.slice();
+ return arguments.length ? (domain = Array.from(_, number$5), rescale()) : domain.slice();
};
scale.range = function (_) {
return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
};
@@ -14691,11 +14792,11 @@
scale.rangeRound = function (_) {
return range = Array.from(_), interpolate = interpolateRound, rescale();
};
scale.clamp = function (_) {
- return arguments.length ? (clamp = _ ? true : identity$4, rescale()) : clamp !== identity$4;
+ return arguments.length ? (clamp = _ ? true : identity$2, rescale()) : clamp !== identity$2;
};
scale.interpolate = function (_) {
return arguments.length ? (interpolate = _, rescale()) : interpolate;
};
@@ -14707,15 +14808,15 @@
return function (t, u) {
transform = t, untransform = u;
return rescale();
};
}
- function continuous() {
- return transformer()(identity$4, identity$4);
+ function continuous$1() {
+ return transformer$3()(identity$2, identity$2);
}
- function tickFormat(start, stop, count, specifier) {
+ function tickFormat$1(start, stop, count, specifier) {
var step = tickStep(start, stop, count),
precision;
specifier = formatSpecifier(specifier == null ? ",f" : specifier);
switch (specifier.type) {
@@ -14742,11 +14843,11 @@
if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2;
break;
}
}
- return format$1(specifier);
+ return format$3(specifier);
}
function linearish(scale) {
var domain = scale.domain;
@@ -14755,11 +14856,11 @@
return ticks(d[0], d[d.length - 1], count == null ? 10 : count);
};
scale.tickFormat = function (count, specifier) {
var d = domain();
- return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
+ return tickFormat$1(d[0], d[d.length - 1], count == null ? 10 : count, specifier);
};
scale.nice = function (count) {
if (count == null) count = 10;
var d = domain();
@@ -14799,43 +14900,43 @@
return scale;
};
return scale;
}
- function linear$2() {
- var scale = continuous();
+ function linear() {
+ var scale = continuous$1();
scale.copy = function () {
- return copy(scale, linear$2());
+ return copy$2(scale, linear());
};
initRange.apply(scale, arguments);
return linearish(scale);
}
- function identity$5(domain) {
+ function identity$1(domain) {
var unknown;
function scale(x) {
- return isNaN(x = +x) ? unknown : x;
+ return x == null || isNaN(x = +x) ? unknown : x;
}
scale.invert = scale;
scale.domain = scale.range = function (_) {
- return arguments.length ? (domain = Array.from(_, number$1), scale) : domain.slice();
+ return arguments.length ? (domain = Array.from(_, number$5), scale) : domain.slice();
};
scale.unknown = function (_) {
return arguments.length ? (unknown = _, scale) : unknown;
};
scale.copy = function () {
- return identity$5(domain).unknown(unknown);
+ return identity$1(domain).unknown(unknown);
};
- domain = arguments.length ? Array.from(domain, number$1) : [0, 1];
+ domain = arguments.length ? Array.from(domain, number$5) : [0, 1];
return linearish(scale);
}
function nice(domain, interval) {
domain = domain.slice();
@@ -14960,11 +15061,11 @@
return r ? z.reverse() : z;
};
scale.tickFormat = function (count, specifier) {
if (specifier == null) specifier = base === 10 ? ".0e" : ",";
- if (typeof specifier !== "function") specifier = format$1(specifier);
+ if (typeof specifier !== "function") specifier = format$3(specifier);
if (count === Infinity) return specifier;
if (count == null) count = 10;
var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
return function (d) {
@@ -14985,15 +15086,15 @@
}));
};
return scale;
}
- function log$3() {
- var scale = loggish(transformer()).domain([1, 10]);
+ function log$2() {
+ var scale = loggish(transformer$3()).domain([1, 10]);
scale.copy = function () {
- return copy(scale, log$3()).base(scale.base());
+ return copy$2(scale, log$2()).base(scale.base());
};
initRange.apply(scale, arguments);
return scale;
}
@@ -15018,15 +15119,15 @@
return arguments.length ? transform(transformSymlog(c = +_), transformSymexp(c)) : c;
};
return linearish(scale);
}
- function symlog$1() {
- var scale = symlogish(transformer());
+ function symlog() {
+ var scale = symlogish(transformer$3());
scale.copy = function () {
- return copy(scale, symlog$1()).constant(scale.constant());
+ return copy$2(scale, symlog()).constant(scale.constant());
};
return initRange.apply(scale, arguments);
}
@@ -15043,38 +15144,38 @@
function transformSquare(x) {
return x < 0 ? -x * x : x * x;
}
function powish(transform) {
- var scale = transform(identity$4, identity$4),
+ var scale = transform(identity$2, identity$2),
exponent = 1;
function rescale() {
- return exponent === 1 ? transform(identity$4, identity$4) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent));
+ return exponent === 1 ? transform(identity$2, identity$2) : exponent === 0.5 ? transform(transformSqrt, transformSquare) : transform(transformPow(exponent), transformPow(1 / exponent));
}
scale.exponent = function (_) {
return arguments.length ? (exponent = +_, rescale()) : exponent;
};
return linearish(scale);
}
function pow$2() {
- var scale = powish(transformer());
+ var scale = powish(transformer$3());
scale.copy = function () {
- return copy(scale, pow$2()).exponent(scale.exponent());
+ return copy$2(scale, pow$2()).exponent(scale.exponent());
};
initRange.apply(scale, arguments);
return scale;
}
- function sqrt$1() {
+ function sqrt$2() {
return pow$2.apply(null, arguments).exponent(0.5);
}
- function quantile$1() {
+ function quantile() {
var domain = [],
range = [],
thresholds = [],
unknown;
@@ -15087,11 +15188,11 @@
return scale;
}
function scale(x) {
- return isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)];
+ return x == null || isNaN(x = +x) ? unknown : range[bisect$1(thresholds, x)];
}
scale.invertExtent = function (y) {
var i = range.indexOf(y);
return i < 0 ? [NaN, NaN] : [i > 0 ? thresholds[i - 1] : domain[0], i < thresholds.length ? thresholds[i] : domain[domain.length - 1]];
@@ -15101,11 +15202,11 @@
if (!arguments.length) return domain.slice();
domain = [];
for (let d of _) if (d != null && !isNaN(d = +d)) domain.push(d);
- domain.sort(ascending$1);
+ domain.sort(ascending$2);
return rescale();
};
scale.range = function (_) {
return arguments.length ? (range = Array.from(_), rescale()) : range.slice();
@@ -15118,11 +15219,11 @@
scale.quantiles = function () {
return thresholds.slice();
};
scale.copy = function () {
- return quantile$1().domain(domain).range(range).unknown(unknown);
+ return quantile().domain(domain).range(range).unknown(unknown);
};
return initRange.apply(scale, arguments);
}
@@ -15133,11 +15234,11 @@
domain = [0.5],
range = [0, 1],
unknown;
function scale(x) {
- return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown;
+ return x != null && x <= x ? range[bisect$1(domain, x, 0, n)] : unknown;
}
function rescale() {
var i = -1;
domain = new Array(n);
@@ -15180,11 +15281,11 @@
range = [0, 1],
unknown,
n = 1;
function scale(x) {
- return x <= x ? range[bisectRight(domain, x, 0, n)] : unknown;
+ return x != null && x <= x ? range[bisect$1(domain, x, 0, n)] : unknown;
}
scale.domain = function (_) {
return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
};
@@ -15207,131 +15308,85 @@
};
return initRange.apply(scale, arguments);
}
- var durationSecond$2 = 1000,
- durationMinute$2 = durationSecond$2 * 60,
- durationHour$2 = durationMinute$2 * 60,
- durationDay$2 = durationHour$2 * 24,
- durationWeek$2 = durationDay$2 * 7,
- durationMonth$1 = durationDay$2 * 30,
- durationYear$1 = durationDay$2 * 365;
-
- function date$1(t) {
+ function date(t) {
return new Date(t);
}
- function number$2(t) {
+ function number$4(t) {
return t instanceof Date ? +t : +new Date(+t);
}
- function calendar(year, month, week, day, hour, minute, second, millisecond, format) {
- var scale = continuous(),
+ function calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format) {
+ var scale = continuous$1(),
invert = scale.invert,
domain = scale.domain;
var formatMillisecond = format(".%L"),
formatSecond = format(":%S"),
formatMinute = format("%I:%M"),
formatHour = format("%I %p"),
formatDay = format("%a %d"),
formatWeek = format("%b %d"),
formatMonth = format("%B"),
formatYear = format("%Y");
- var tickIntervals = [[second, 1, durationSecond$2], [second, 5, 5 * durationSecond$2], [second, 15, 15 * durationSecond$2], [second, 30, 30 * durationSecond$2], [minute, 1, durationMinute$2], [minute, 5, 5 * durationMinute$2], [minute, 15, 15 * durationMinute$2], [minute, 30, 30 * durationMinute$2], [hour, 1, durationHour$2], [hour, 3, 3 * durationHour$2], [hour, 6, 6 * durationHour$2], [hour, 12, 12 * durationHour$2], [day, 1, durationDay$2], [day, 2, 2 * durationDay$2], [week, 1, durationWeek$2], [month, 1, durationMonth$1], [month, 3, 3 * durationMonth$1], [year, 1, durationYear$1]];
function tickFormat(date) {
return (second(date) < date ? formatMillisecond : minute(date) < date ? formatSecond : hour(date) < date ? formatMinute : day(date) < date ? formatHour : month(date) < date ? week(date) < date ? formatDay : formatWeek : year(date) < date ? formatMonth : formatYear)(date);
}
- function tickInterval(interval, start, stop) {
- if (interval == null) interval = 10; // If a desired tick count is specified, pick a reasonable tick interval
- // based on the extent of the domain and a rough estimate of tick size.
- // Otherwise, assume interval is already a time interval and use it.
-
- if (typeof interval === "number") {
- var target = Math.abs(stop - start) / interval,
- i = bisector(function (i) {
- return i[2];
- }).right(tickIntervals, target),
- step;
-
- if (i === tickIntervals.length) {
- step = tickStep(start / durationYear$1, stop / durationYear$1, interval);
- interval = year;
- } else if (i) {
- i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i];
- step = i[1];
- interval = i[0];
- } else {
- step = Math.max(tickStep(start, stop, interval), 1);
- interval = millisecond;
- }
-
- return interval.every(step);
- }
-
- return interval;
- }
-
scale.invert = function (y) {
return new Date(invert(y));
};
scale.domain = function (_) {
- return arguments.length ? domain(Array.from(_, number$2)) : domain().map(date$1);
+ return arguments.length ? domain(Array.from(_, number$4)) : domain().map(date);
};
scale.ticks = function (interval) {
- var d = domain(),
- t0 = d[0],
- t1 = d[d.length - 1],
- r = t1 < t0,
- t;
- if (r) t = t0, t0 = t1, t1 = t;
- t = tickInterval(interval, t0, t1);
- t = t ? t.range(t0, t1 + 1) : []; // inclusive stop
-
- return r ? t.reverse() : t;
+ var d = domain();
+ return ticks(d[0], d[d.length - 1], interval == null ? 10 : interval);
};
scale.tickFormat = function (count, specifier) {
return specifier == null ? tickFormat : format(specifier);
};
scale.nice = function (interval) {
var d = domain();
- return (interval = tickInterval(interval, d[0], d[d.length - 1])) ? domain(nice(d, interval)) : scale;
+ if (!interval || typeof interval.range !== "function") interval = tickInterval(d[0], d[d.length - 1], interval == null ? 10 : interval);
+ return interval ? domain(nice(d, interval)) : scale;
};
scale.copy = function () {
- return copy(scale, calendar(year, month, week, day, hour, minute, second, millisecond, format));
+ return copy$2(scale, calendar(ticks, tickInterval, year, month, week, day, hour, minute, second, format));
};
return scale;
}
- function time() {
- return initRange.apply(calendar(year, month, sunday, day, hour, minute, second, millisecond, timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
+ function time$1() {
+ return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, sunday, timeDay, timeHour, timeMinute, utcSecond, timeFormat$1).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
}
function utcTime() {
- return initRange.apply(calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, utcFormat).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
+ return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear$1, utcMonth$1, utcSunday, utcDay$1, utcHour$1, utcMinute$1, utcSecond, utcFormat$1).domain([Date.UTC(2000, 0, 1), Date.UTC(2000, 0, 2)]), arguments);
}
- function transformer$1() {
+ function transformer$2() {
var x0 = 0,
x1 = 1,
t0,
t1,
k10,
transform,
- interpolator = identity$4,
+ interpolator = identity$2,
clamp = false,
unknown;
function scale(x) {
- return isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
+ return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x));
}
scale.domain = function (_) {
return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1];
};
@@ -15366,38 +15421,38 @@
function copy$1(source, target) {
return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown());
}
function sequential() {
- var scale = linearish(transformer$1()(identity$4));
+ var scale = linearish(transformer$2()(identity$2));
scale.copy = function () {
return copy$1(scale, sequential());
};
return initInterpolator.apply(scale, arguments);
}
function sequentialLog() {
- var scale = loggish(transformer$1()).domain([1, 10]);
+ var scale = loggish(transformer$2()).domain([1, 10]);
scale.copy = function () {
return copy$1(scale, sequentialLog()).base(scale.base());
};
return initInterpolator.apply(scale, arguments);
}
function sequentialSymlog() {
- var scale = symlogish(transformer$1());
+ var scale = symlogish(transformer$2());
scale.copy = function () {
return copy$1(scale, sequentialSymlog()).constant(scale.constant());
};
return initInterpolator.apply(scale, arguments);
}
function sequentialPow() {
- var scale = powish(transformer$1());
+ var scale = powish(transformer$2());
scale.copy = function () {
return copy$1(scale, sequentialPow()).exponent(scale.exponent());
};
@@ -15405,21 +15460,21 @@
}
function sequentialSqrt() {
return sequentialPow.apply(null, arguments).exponent(0.5);
}
- function transformer$2() {
+ function transformer$1() {
var x0 = 0,
x1 = 0.5,
x2 = 1,
s = 1,
t0,
t1,
t2,
k10,
k21,
- interpolator = identity$4,
+ interpolator = identity$2,
transform,
clamp = false,
unknown;
function scale(x) {
@@ -15457,38 +15512,38 @@
return scale;
};
}
function diverging() {
- var scale = linearish(transformer$2()(identity$4));
+ var scale = linearish(transformer$1()(identity$2));
scale.copy = function () {
return copy$1(scale, diverging());
};
return initInterpolator.apply(scale, arguments);
}
function divergingLog() {
- var scale = loggish(transformer$2()).domain([0.1, 1, 10]);
+ var scale = loggish(transformer$1()).domain([0.1, 1, 10]);
scale.copy = function () {
return copy$1(scale, divergingLog()).base(scale.base());
};
return initInterpolator.apply(scale, arguments);
}
function divergingSymlog() {
- var scale = symlogish(transformer$2());
+ var scale = symlogish(transformer$1());
scale.copy = function () {
return copy$1(scale, divergingSymlog()).constant(scale.constant());
};
return initInterpolator.apply(scale, arguments);
}
function divergingPow() {
- var scale = powish(transformer$2());
+ var scale = powish(transformer$1());
scale.copy = function () {
return copy$1(scale, divergingPow()).exponent(scale.exponent());
};
@@ -15502,29 +15557,29 @@
const space = count - paddingInner + paddingOuter * 2;
return count ? space > 0 ? space : 1 : 0;
}
const Identity = 'identity';
- const Linear$1 = 'linear';
+ const Linear = 'linear';
const Log = 'log';
const Pow = 'pow';
const Sqrt = 'sqrt';
const Symlog = 'symlog';
const Time = 'time';
const UTC = 'utc';
const Sequential = 'sequential';
const Diverging = 'diverging';
- const Quantile$1 = 'quantile';
+ const Quantile = 'quantile';
const Quantize = 'quantize';
const Threshold = 'threshold';
const Ordinal = 'ordinal';
const Point = 'point';
const Band = 'band';
const BinOrdinal = 'bin-ordinal'; // categories
const Continuous = 'continuous';
- const Discrete = 'discrete';
+ const Discrete$1 = 'discrete';
const Discretizing = 'discretizing';
const Interpolating = 'interpolating';
const Temporal = 'temporal';
function invertRange(scale) {
@@ -15576,25 +15631,25 @@
function band() {
const scale = ordinal().unknown(undefined),
domain = scale.domain,
ordinalRange = scale.range;
- let range$1$1 = [0, 1],
+ let range$1 = [0, 1],
step,
bandwidth,
round = false,
paddingInner = 0,
paddingOuter = 0,
align = 0.5;
delete scale.unknown;
function rescale() {
const n = domain().length,
- reverse = range$1$1[1] < range$1$1[0],
- stop = range$1$1[1 - reverse],
+ reverse = range$1[1] < range$1[0],
+ stop = range$1[1 - reverse],
space = bandSpace(n, paddingInner, paddingOuter);
- let start = range$1$1[reverse - 0];
+ let start = range$1[reverse - 0];
step = (stop - start) / (space || 1);
if (round) {
step = Math.floor(step);
}
@@ -15605,11 +15660,11 @@
if (round) {
start = Math.round(start);
bandwidth = Math.round(bandwidth);
}
- const values = range$1(n).map(i => start + step * i);
+ const values = range$1$1(n).map(i => start + step * i);
return ordinalRange(reverse ? values.reverse() : values);
}
scale.domain = function (_) {
if (arguments.length) {
@@ -15620,19 +15675,19 @@
}
};
scale.range = function (_) {
if (arguments.length) {
- range$1$1 = [+_[0], +_[1]];
+ range$1 = [+_[0], +_[1]];
return rescale();
} else {
- return range$1$1.slice();
+ return range$1.slice();
}
};
scale.rangeRound = function (_) {
- range$1$1 = [+_[0], +_[1]];
+ range$1 = [+_[0], +_[1]];
round = true;
return rescale();
};
scale.bandwidth = function () {
@@ -15690,11 +15745,11 @@
};
scale.invertRange = function (_) {
// bail if range has null or undefined values
if (_[0] == null || _[1] == null) return;
- const reverse = range$1$1[1] < range$1$1[0],
+ const reverse = range$1[1] < range$1[0],
values = reverse ? ordinalRange().reverse() : ordinalRange(),
n = values.length - 1;
let lo = +_[0],
hi = +_[1],
a,
@@ -15707,14 +15762,14 @@
t = lo;
lo = hi;
hi = t;
}
- if (hi < values[0] || lo > range$1$1[1 - reverse]) return; // binary search to index into scale range
+ if (hi < values[0] || lo > range$1[1 - reverse]) return; // binary search to index into scale range
- a = Math.max(0, bisectRight(values, lo) - 1);
- b = lo === hi ? a : bisectRight(values, hi) - 1; // increment index a if lo is within padding gap
+ a = Math.max(0, bisectRight$1(values, lo) - 1);
+ b = lo === hi ? a : bisectRight$1(values, hi) - 1; // increment index a if lo is within padding gap
if (lo - values[a] > bandwidth + 1e-10) ++a;
if (reverse) {
// map + swap
@@ -15730,11 +15785,11 @@
const value = scale.invertRange([_, _]);
return value ? value[0] : value;
};
scale.copy = function () {
- return band().domain(domain()).range(range$1$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
+ return band().domain(domain()).range(range$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
};
return rescale();
}
@@ -15748,50 +15803,50 @@
};
return scale;
}
- function point$4() {
+ function point$1() {
return pointish(band().paddingInner(1));
}
- var map$1 = Array.prototype.map;
+ var map = Array.prototype.map;
- function numbers$2(_) {
- return map$1.call(_, toNumber);
+ function numbers(_) {
+ return map.call(_, toNumber);
}
- const slice = Array.prototype.slice;
+ const slice$1 = Array.prototype.slice;
function scaleBinOrdinal() {
let domain = [],
range = [];
function scale(x) {
- return x == null || x !== x ? undefined : range[(bisectRight(domain, x) - 1) % range.length];
+ return x == null || x !== x ? undefined : range[(bisect$1(domain, x) - 1) % range.length];
}
scale.domain = function (_) {
if (arguments.length) {
- domain = numbers$2(_);
+ domain = numbers(_);
return scale;
} else {
return domain.slice();
}
};
scale.range = function (_) {
if (arguments.length) {
- range = slice.call(_);
+ range = slice$1.call(_);
return scale;
} else {
return range.slice();
}
};
scale.tickFormat = function (count, specifier) {
- return tickFormat(domain[0], peek(domain), count == null ? 10 : count, specifier);
+ return tickFormat$1(domain[0], peek$1(domain), count == null ? 10 : count, specifier);
};
scale.copy = function () {
return scaleBinOrdinal().domain(scale.domain()).range(scale.range());
};
@@ -15802,11 +15857,11 @@
const scales = {};
/**
* Augment scales with their type and needed inverse methods.
*/
- function create(type, constructor, metadata) {
+ function create$2(type, constructor, metadata) {
const ctr = function scale() {
const s = constructor();
if (!s.invertRange) {
s.invertRange = s.invert ? invertRange(s) : s.invertExtent ? invertRangeExtent(s) : undefined;
@@ -15814,59 +15869,59 @@
s.type = type;
return s;
};
- ctr.metadata = toSet(array(metadata));
+ ctr.metadata = toSet(array$5(metadata));
return ctr;
}
- function scale(type, scale, metadata) {
+ function scale$4(type, scale, metadata) {
if (arguments.length > 1) {
- scales[type] = create(type, scale, metadata);
+ scales[type] = create$2(type, scale, metadata);
return this;
} else {
return isValidScaleType(type) ? scales[type] : undefined;
}
} // identity scale
- scale(Identity, identity$5); // continuous scales
+ scale$4(Identity, identity$1); // continuous scales
- scale(Linear$1, linear$2, Continuous);
- scale(Log, log$3, [Continuous, Log]);
- scale(Pow, pow$2, Continuous);
- scale(Sqrt, sqrt$1, Continuous);
- scale(Symlog, symlog$1, Continuous);
- scale(Time, time, [Continuous, Temporal]);
- scale(UTC, utcTime, [Continuous, Temporal]); // sequential scales
+ scale$4(Linear, linear, Continuous);
+ scale$4(Log, log$2, [Continuous, Log]);
+ scale$4(Pow, pow$2, Continuous);
+ scale$4(Sqrt, sqrt$2, Continuous);
+ scale$4(Symlog, symlog, Continuous);
+ scale$4(Time, time$1, [Continuous, Temporal]);
+ scale$4(UTC, utcTime, [Continuous, Temporal]); // sequential scales
- scale(Sequential, sequential, [Continuous, Interpolating]); // backwards compat
+ scale$4(Sequential, sequential, [Continuous, Interpolating]); // backwards compat
- scale("".concat(Sequential, "-").concat(Linear$1), sequential, [Continuous, Interpolating]);
- scale("".concat(Sequential, "-").concat(Log), sequentialLog, [Continuous, Interpolating, Log]);
- scale("".concat(Sequential, "-").concat(Pow), sequentialPow, [Continuous, Interpolating]);
- scale("".concat(Sequential, "-").concat(Sqrt), sequentialSqrt, [Continuous, Interpolating]);
- scale("".concat(Sequential, "-").concat(Symlog), sequentialSymlog, [Continuous, Interpolating]); // diverging scales
+ scale$4(`${Sequential}-${Linear}`, sequential, [Continuous, Interpolating]);
+ scale$4(`${Sequential}-${Log}`, sequentialLog, [Continuous, Interpolating, Log]);
+ scale$4(`${Sequential}-${Pow}`, sequentialPow, [Continuous, Interpolating]);
+ scale$4(`${Sequential}-${Sqrt}`, sequentialSqrt, [Continuous, Interpolating]);
+ scale$4(`${Sequential}-${Symlog}`, sequentialSymlog, [Continuous, Interpolating]); // diverging scales
- scale("".concat(Diverging, "-").concat(Linear$1), diverging, [Continuous, Interpolating]);
- scale("".concat(Diverging, "-").concat(Log), divergingLog, [Continuous, Interpolating, Log]);
- scale("".concat(Diverging, "-").concat(Pow), divergingPow, [Continuous, Interpolating]);
- scale("".concat(Diverging, "-").concat(Sqrt), divergingSqrt, [Continuous, Interpolating]);
- scale("".concat(Diverging, "-").concat(Symlog), divergingSymlog, [Continuous, Interpolating]); // discretizing scales
+ scale$4(`${Diverging}-${Linear}`, diverging, [Continuous, Interpolating]);
+ scale$4(`${Diverging}-${Log}`, divergingLog, [Continuous, Interpolating, Log]);
+ scale$4(`${Diverging}-${Pow}`, divergingPow, [Continuous, Interpolating]);
+ scale$4(`${Diverging}-${Sqrt}`, divergingSqrt, [Continuous, Interpolating]);
+ scale$4(`${Diverging}-${Symlog}`, divergingSymlog, [Continuous, Interpolating]); // discretizing scales
- scale(Quantile$1, quantile$1, [Discretizing, Quantile$1]);
- scale(Quantize, quantize$1, Discretizing);
- scale(Threshold, threshold, Discretizing); // discrete scales
+ scale$4(Quantile, quantile, [Discretizing, Quantile]);
+ scale$4(Quantize, quantize$1, Discretizing);
+ scale$4(Threshold, threshold, Discretizing); // discrete scales
- scale(BinOrdinal, scaleBinOrdinal, [Discrete, Discretizing]);
- scale(Ordinal, ordinal, Discrete);
- scale(Band, band, Discrete);
- scale(Point, point$4, Discrete);
+ scale$4(BinOrdinal, scaleBinOrdinal, [Discrete$1, Discretizing]);
+ scale$4(Ordinal, ordinal, Discrete$1);
+ scale$4(Band, band, Discrete$1);
+ scale$4(Point, point$1, Discrete$1);
function isValidScaleType(type) {
- return has(scales, type);
+ return has$1(scales, type);
}
function hasType(key, type) {
const s = scales[key];
return s && s.metadata[type];
@@ -15875,11 +15930,11 @@
function isContinuous(key) {
return hasType(key, Continuous);
}
function isDiscrete(key) {
- return hasType(key, Discrete);
+ return hasType(key, Discrete$1);
}
function isDiscretizing(key) {
return hasType(key, Discretizing);
}
@@ -15895,18 +15950,18 @@
function isInterpolating(key) {
return hasType(key, Interpolating);
}
function isQuantile(key) {
- return hasType(key, Quantile$1);
+ return hasType(key, Quantile);
}
const scaleProps = ['clamp', 'base', 'constant', 'exponent'];
function interpolateRange(interpolator, range) {
const start = range[0],
- span = peek(range) - start;
+ span = peek$1(range) - start;
return function (i) {
return interpolator(start + i * span);
};
}
@@ -15926,15 +15981,15 @@
function scaleFraction(scale$1, min, max) {
const delta = max - min;
let i, t, s;
if (!delta || !Number.isFinite(delta)) {
- return constant(0.5);
+ return constant$4(0.5);
} else {
i = (t = scale$1.type).indexOf('-');
t = i < 0 ? t : t.slice(i + 1);
- s = scale(t)().domain([min, max]).range([0, 1]);
+ s = scale$4(t)().domain([min, max]).range([0, 1]);
scaleProps.forEach(m => scale$1[m] ? s[m](scale$1[m]()) : 0);
return s;
}
}
@@ -15945,11 +16000,11 @@
function method(type) {
return 'interpolate' + type.toLowerCase().split('-').map(s => s[0].toUpperCase() + s.slice(1)).join('');
}
- const continuous$1 = {
+ const continuous = {
blues: 'cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90',
greens: 'd3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429',
greys: 'e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e',
oranges: 'fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303',
purples: 'e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c',
@@ -16000,11 +16055,11 @@
darkGold: '3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff',
darkGreen: '3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa',
darkMulti: '3737371f5287197d8c29a86995ce3fffe800ffffff',
darkRed: '3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c'
};
- const discrete$1 = {
+ const discrete = {
category10: '1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf',
category20: '1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5',
category20b: '393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6',
category20c: '3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9',
tableau10: '4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac',
@@ -16033,12 +16088,12 @@
function apply(_, f) {
for (const k in _) scheme(k, f(_[k]));
}
const schemes = {};
- apply(discrete$1, colors);
- apply(continuous$1, _ => interpolateColors(colors(_)));
+ apply(discrete, colors);
+ apply(continuous, _ => interpolateColors(colors(_)));
function scheme(name, scheme) {
name = name && name.toLowerCase();
if (arguments.length > 1) {
@@ -16053,11 +16108,11 @@
const DiscreteLegend = 'discrete';
const GradientLegend = 'gradient';
const defaultFormatter = value => isArray(value) ? value.map(v => String(v)) : String(value);
- const ascending$2 = (a, b) => a[1] - b[1];
+ const ascending$1 = (a, b) => a[1] - b[1];
const descending = (a, b) => b[1] - a[1];
/**
* Determine the tick count or interval function.
* @param {Scale} scale - The scale for which to generate tick values.
@@ -16068,11 +16123,11 @@
function tickCount(scale, count, minStep) {
let step;
- if (isNumber(count)) {
+ if (isNumber$1(count)) {
if (scale.bins) {
count = Math.max(count, scale.bins.length);
}
if (minStep != null) {
@@ -16103,12 +16158,12 @@
function validTicks(scale, ticks, count) {
let range = scale.range(),
lo = range[0],
- hi = peek(range),
- cmp = ascending$2;
+ hi = peek$1(range),
+ cmp = ascending$1;
if (lo > hi) {
range = hi;
hi = lo;
lo = range;
@@ -16120,11 +16175,11 @@
// additionally sort ticks in range order (#2579)
ticks = ticks.map(v => [v, scale(v)]).filter(_ => lo <= _[1] && _[1] <= hi).sort(cmp).map(_ => _[0]);
if (count > 0 && ticks.length > 1) {
- const endpoints = [ticks[0], peek(ticks)];
+ const endpoints = [ticks[0], peek$1(ticks)];
while (ticks.length > count && ticks.length >= 3) {
ticks = ticks.filter((_, i) => !(i % 2));
}
@@ -16164,11 +16219,11 @@
* time multi-format specifier object.
* @return {function(*):string} - The generated label formatter.
*/
- function tickFormat$1(locale, scale, count, specifier, formatType, noSkip) {
+ function tickFormat(locale, scale, count, specifier, formatType, noSkip) {
const type = scale.type;
let format = defaultFormatter;
if (type === Time || formatType === Time) {
format = locale.timeFormat(specifier);
@@ -16208,26 +16263,26 @@
};
return values ? ticks.filter(test) : test;
}
- const symbols = {
- [Quantile$1]: 'quantiles',
+ const symbols$1 = {
+ [Quantile]: 'quantiles',
[Quantize]: 'thresholds',
[Threshold]: 'domain'
};
- const formats$1 = {
- [Quantile$1]: 'quantiles',
+ const formats = {
+ [Quantile]: 'quantiles',
[Quantize]: 'domain'
};
function labelValues(scale, count) {
- return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols[scale.type] ? thresholdValues(scale[symbols[scale.type]]()) : tickValues(scale, count);
+ return scale.bins ? binValues(scale.bins) : scale.type === Log ? tickLog(scale, count, true) : symbols$1[scale.type] ? thresholdValues(scale[symbols$1[scale.type]]()) : tickValues(scale, count);
}
function thresholdFormat(locale, scale, specifier) {
- const _ = scale[formats$1[scale.type]](),
+ const _ = scale[formats[scale.type]](),
n = _.length;
let d = n > 1 ? _[1] - _[0] : _[0],
i;
@@ -16245,41 +16300,41 @@
return values;
}
function binValues(bins) {
const values = bins.slice(0, -1);
- values.max = peek(bins);
+ values.max = peek$1(bins);
return values;
}
- const isDiscreteRange = scale => symbols[scale.type] || scale.bins;
+ const isDiscreteRange = scale => symbols$1[scale.type] || scale.bins;
function labelFormat(locale, scale, count, type, specifier, formatType, noSkip) {
- const format = formats$1[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat$1(locale, scale, count, specifier, formatType, noSkip);
+ const format = formats[scale.type] && formatType !== Time && formatType !== UTC ? thresholdFormat(locale, scale, specifier) : tickFormat(locale, scale, count, specifier, formatType, noSkip);
return type === SymbolLegend && isDiscreteRange(scale) ? formatRange(format) : type === DiscreteLegend ? formatDiscrete(format) : formatPoint(format);
}
const formatRange = format => (value, index, array) => {
- const limit = get$1(array[index + 1], get$1(array.max, +Infinity)),
- lo = formatValue(value, format),
- hi = formatValue(limit, format);
+ const limit = get$3(array[index + 1], get$3(array.max, +Infinity)),
+ lo = formatValue$1(value, format),
+ hi = formatValue$1(limit, format);
return lo && hi ? lo + ' \u2013 ' + hi : hi ? '< ' + hi : '\u2265 ' + lo;
};
- const get$1 = (value, dflt) => value != null ? value : dflt;
+ const get$3 = (value, dflt) => value != null ? value : dflt;
const formatDiscrete = format => (value, index) => index ? format(value) : null;
const formatPoint = format => value => format(value);
- const formatValue = (value, format) => Number.isFinite(value) ? format(value) : null;
+ const formatValue$1 = (value, format) => Number.isFinite(value) ? format(value) : null;
function labelFraction(scale) {
const domain = scale.domain(),
count = domain.length - 1;
let lo = +domain[0],
- hi = +peek(domain),
+ hi = +peek$1(domain),
span = hi - lo;
if (scale.type === Threshold) {
const adjust = count ? span / count : 0.1;
lo -= adjust;
@@ -16288,11 +16343,11 @@
}
return value => (value - lo) / span;
}
- function format$2(locale, scale, specifier, formatType) {
+ function format$1(locale, scale, specifier, formatType) {
const type = formatType || scale.type; // replace abbreviated time specifiers to improve screen reader experience
if (isString(specifier) && isTemporal(type)) {
specifier = specifier.replace(/%a/g, '%A').replace(/%b/g, '%B');
}
@@ -16301,27 +16356,27 @@
}
function domainCaption(locale, scale, opt) {
opt = opt || {};
const max = Math.max(3, opt.maxlen || 7),
- fmt = format$2(locale, scale, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries
+ fmt = format$1(locale, scale, opt.format, opt.formatType); // if scale breaks domain into bins, describe boundaries
if (isDiscretizing(scale.type)) {
const v = labelValues(scale).slice(1).map(fmt),
n = v.length;
- return "".concat(n, " boundar").concat(n === 1 ? 'y' : 'ies', ": ").concat(v.join(', '));
+ return `${n} boundar${n === 1 ? 'y' : 'ies'}: ${v.join(', ')}`;
} // if scale domain is discrete, list values
else if (isDiscrete(scale.type)) {
- const d = scale.domain(),
- n = d.length,
- v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', ');
- return "".concat(n, " value").concat(n === 1 ? '' : 's', ": ").concat(v);
- } // if scale domain is continuous, describe value range
- else {
- const d = scale.domain();
- return "values from ".concat(fmt(d[0]), " to ").concat(fmt(peek(d)));
- }
+ const d = scale.domain(),
+ n = d.length,
+ v = n > max ? d.slice(0, max - 2).map(fmt).join(', ') + ', ending with ' + d.slice(-1).map(fmt) : d.map(fmt).join(', ');
+ return `${n} value${n === 1 ? '' : 's'}: ${v}`;
+ } // if scale domain is continuous, describe value range
+ else {
+ const d = scale.domain();
+ return `values from ${fmt(d[0])} to ${fmt(peek$1(d))}`;
+ }
}
let gradient_id = 0;
function resetSVGGradientId() {
@@ -16366,11 +16421,11 @@
function get$2(val, def) {
return val != null ? val : def;
}
- function Gradient(p0, p1) {
+ function Gradient$1(p0, p1) {
var stops = [],
gradient;
return gradient = {
gradient: 'linear',
x1: p0 ? p0[0] : 0,
@@ -16386,11 +16441,11 @@
return gradient;
}
};
}
- const lookup = {
+ const lookup$4 = {
'basis': {
curve: curveBasis
},
'basis-closed': {
curve: curveBasisClosed
@@ -16456,11 +16511,11 @@
curve: stepBefore
}
};
function curves(type, orientation, tension) {
- var entry = has(lookup, type) && lookup[type],
+ var entry = has$1(lookup$4, type) && lookup$4[type],
curve = null;
if (entry) {
curve = entry.curve || entry[orientation || 'vertical'];
@@ -16530,14 +16585,14 @@
const HalfPi = Math.PI / 2;
const Tau = Math.PI * 2;
const HalfSqrt3 = Math.sqrt(3) / 2;
var segmentCache = {};
var bezierCache = {};
- var join = [].join; // Copied from Inkscape svgtopdf, thanks!
+ var join$1 = [].join; // Copied from Inkscape svgtopdf, thanks!
function segments(x, y, rx, ry, large, sweep, rotateX, ox, oy) {
- const key = join.call(arguments);
+ const key = join$1.call(arguments);
if (segmentCache[key]) {
return segmentCache[key];
}
@@ -16592,11 +16647,11 @@
return segmentCache[key] = result;
}
function bezier(params) {
- const key = join.call(params);
+ const key = join$1.call(params);
if (bezierCache[key]) {
return bezierCache[key];
}
@@ -16628,11 +16683,11 @@
return bezierCache[key] = [a00 * x1 + a01 * y1, a10 * x1 + a11 * y1, a00 * x2 + a01 * y2, a10 * x2 + a11 * y2, a00 * x3 + a01 * y3, a10 * x3 + a11 * y3];
}
const temp = ['l', 0, 0, 0, 0, 0, 0, 0];
- function scale$1(current, sX, sY) {
+ function scale$1$1(current, sX, sY) {
const c = temp[0] = current[0];
if (c === 'a' || c === 'A') {
temp[1] = sX * current[1];
temp[2] = sY * current[2];
@@ -16678,11 +16733,11 @@
for (var i = 0, len = path.length; i < len; ++i) {
current = path[i];
if (sX !== 1 || sY !== 1) {
- current = scale$1(current, sX, sY);
+ current = scale$1$1(current, sX, sY);
}
switch (current[0]) {
// first letter
case 'l':
@@ -17031,18 +17086,18 @@
context.lineTo(r, 0);
}
}
};
- function symbols$1(_) {
- return has(builtins, _) ? builtins[_] : customSymbol(_);
+ function symbols(_) {
+ return has$1(builtins, _) ? builtins[_] : customSymbol(_);
}
var custom = {};
function customSymbol(path) {
- if (!has(custom, path)) {
+ if (!has$1(custom, path)) {
const parsed = pathParse(path);
custom[path] = {
draw: function (context, size) {
pathRender(context, parsed, 0, 0, Math.sqrt(size) / 2);
}
@@ -17050,11 +17105,11 @@
}
return custom[path];
}
- const C$1 = 0.448084975506; // C = 1 - c
+ const C = 0.448084975506; // C = 1 - c
function rectangleX(d) {
return d.x;
}
@@ -17098,26 +17153,26 @@
s = Math.min(w, h) / 2,
tl = clamp(+crTL.call(this, _), 0, s),
tr = clamp(+crTR.call(this, _), 0, s),
bl = clamp(+crBL.call(this, _), 0, s),
br = clamp(+crBR.call(this, _), 0, s);
- if (!context) context = buffer = path();
+ if (!context) context = buffer = path$3();
if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) {
context.rect(x1, y1, w, h);
} else {
var x2 = x1 + w,
y2 = y1 + h;
context.moveTo(x1 + tl, y1);
context.lineTo(x2 - tr, y1);
- context.bezierCurveTo(x2 - C$1 * tr, y1, x2, y1 + C$1 * tr, x2, y1 + tr);
+ context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr);
context.lineTo(x2, y2 - br);
- context.bezierCurveTo(x2, y2 - C$1 * br, x2 - C$1 * br, y2, x2 - br, y2);
+ context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2);
context.lineTo(x1 + bl, y2);
- context.bezierCurveTo(x1 + C$1 * bl, y2, x1, y2 - C$1 * bl, x1, y2 - bl);
+ context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl);
context.lineTo(x1, y1 + tl);
- context.bezierCurveTo(x1, y1 + C$1 * tl, x1 + C$1 * tl, y1, x1 + tl, y1);
+ context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1);
context.closePath();
}
if (buffer) {
context = null;
@@ -17233,11 +17288,11 @@
var i,
n = data.length,
d,
defined0 = false,
buffer;
- if (context == null) context = buffer = path();
+ if (context == null) context = buffer = path$3();
for (i = 0; i <= n; ++i) {
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
if (defined0 = !defined0) ready = 0;
}
@@ -17302,86 +17357,86 @@
};
return trail;
}
- function value(a, b) {
+ function value$1(a, b) {
return a != null ? a : b;
}
- const x$1 = item => item.x || 0,
- y$1 = item => item.y || 0,
+ const x$2 = item => item.x || 0,
+ y$2 = item => item.y || 0,
w = item => item.width || 0,
h = item => item.height || 0,
xw = item => (item.x || 0) + (item.width || 0),
yh = item => (item.y || 0) + (item.height || 0),
sa = item => item.startAngle || 0,
ea = item => item.endAngle || 0,
pa = item => item.padAngle || 0,
ir = item => item.innerRadius || 0,
or = item => item.outerRadius || 0,
cr = item => item.cornerRadius || 0,
- tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0,
- tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0,
- br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0,
- bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0,
- sz = item => value(item.size, 64),
+ tl = item => value$1(item.cornerRadiusTopLeft, item.cornerRadius) || 0,
+ tr = item => value$1(item.cornerRadiusTopRight, item.cornerRadius) || 0,
+ br = item => value$1(item.cornerRadiusBottomRight, item.cornerRadius) || 0,
+ bl = item => value$1(item.cornerRadiusBottomLeft, item.cornerRadius) || 0,
+ sz = item => value$1(item.size, 64),
ts = item => item.size || 1,
def = item => !(item.defined === false),
- type = item => symbols$1(item.shape || 'circle');
+ type = item => symbols(item.shape || 'circle');
- const arcShape = arc$2().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr),
- areavShape = area$2().x(x$1).y1(y$1).y0(yh).defined(def),
- areahShape = area$2().y(y$1).x1(x$1).x0(xw).defined(def),
- lineShape = line$2().x(x$1).y(y$1).defined(def),
- rectShape = vg_rect().x(x$1).y(y$1).width(w).height(h).cornerRadius(tl, tr, br, bl),
+ const arcShape = arc$2$1().startAngle(sa).endAngle(ea).padAngle(pa).innerRadius(ir).outerRadius(or).cornerRadius(cr),
+ areavShape = area$2$1().x(x$2).y1(y$2).y0(yh).defined(def),
+ areahShape = area$2$1().y(y$2).x1(x$2).x0(xw).defined(def),
+ lineShape = line$2$1().x(x$2).y(y$2).defined(def),
+ rectShape = vg_rect().x(x$2).y(y$2).width(w).height(h).cornerRadius(tl, tr, br, bl),
symbolShape = symbol$2().type(type).size(sz),
- trailShape = vg_trail().x(x$1).y(y$1).defined(def).size(ts);
+ trailShape = vg_trail().x(x$2).y(y$2).defined(def).size(ts);
function hasCornerRadius(item) {
return item.cornerRadius || item.cornerRadiusTopLeft || item.cornerRadiusTopRight || item.cornerRadiusBottomRight || item.cornerRadiusBottomLeft;
}
- function arc(context, item) {
+ function arc$1(context, item) {
return arcShape.context(context)(item);
}
- function area(context, items) {
+ function area$1(context, items) {
const item = items[0],
interp = item.interpolate || 'linear';
return (item.orient === 'horizontal' ? areahShape : areavShape).curve(curves(interp, item.orient, item.tension)).context(context)(items);
}
- function line(context, items) {
+ function line$1(context, items) {
const item = items[0],
interp = item.interpolate || 'linear';
return lineShape.curve(curves(interp, item.orient, item.tension)).context(context)(items);
}
function rectangle(context, item, x, y) {
return rectShape.context(context)(item, x, y);
}
- function shape(context, item) {
+ function shape$1(context, item) {
return (item.mark.shape || item.shape).context(context)(item);
}
- function symbol(context, item) {
+ function symbol$1(context, item) {
return symbolShape.context(context)(item);
}
- function trail(context, items) {
+ function trail$1(context, items) {
return trailShape.context(context)(items);
}
var clip_id = 1;
function resetSVGClipId() {
clip_id = 1;
}
- function clip(renderer, item, size) {
+ function clip$1$1(renderer, item, size) {
var clip = item.clip,
defs = renderer._defs,
id = item.clip_id || (item.clip_id = 'clip' + clip_id++),
c = defs.clipping[id] || (defs.clipping[id] = {
id: id
@@ -17602,11 +17657,11 @@
url: url
};
const img = new Image(); // set crossOrigin only if cors is defined; empty string sets anonymous mode
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/crossOrigin
- const cors = has(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous';
+ const cors = has$1(opt, 'crossOrigin') ? opt.crossOrigin : 'anonymous';
if (cors != null) img.crossOrigin = cors; // attempt to load image resource
img.onload = () => decrement(loader);
img.onerror = () => decrement(loader);
@@ -17654,23 +17709,23 @@
}
const circleThreshold = Tau - 1e-8;
let bounds, lx, ly, rot, ma, mb, mc, md;
- const add$2 = (x, y) => bounds.add(x, y);
+ const add$1 = (x, y) => bounds.add(x, y);
- const addL = (x, y) => add$2(lx = x, ly = y);
+ const addL = (x, y) => add$1(lx = x, ly = y);
- const addX = x => add$2(x, bounds.y1);
+ const addX = x => add$1(x, bounds.y1);
- const addY = y => add$2(bounds.x1, y);
+ const addY = y => add$1(bounds.x1, y);
const px = (x, y) => ma * x + mc * y;
const py = (x, y) => mb * x + md * y;
- const addp = (x, y) => add$2(px(x, y), py(x, y));
+ const addp = (x, y) => add$1(px(x, y), py(x, y));
const addpL = (x, y) => addL(px(x, y), py(x, y));
function boundContext(_, deg) {
bounds = _;
@@ -17683,14 +17738,14 @@
} else {
ma = md = 1;
rot = mb = mc = 0;
}
- return context;
+ return context$1;
}
- const context = {
+ const context$1 = {
beginPath() {},
closePath() {},
moveTo: addpL,
@@ -17701,11 +17756,11 @@
addp(x + w, y);
addp(x + w, y + h);
addp(x, y + h);
addpL(x, y);
} else {
- add$2(x + w, y + h);
+ add$1(x + w, y + h);
addL(x, y);
}
},
quadraticCurveTo(x1, y1, x2, y2) {
@@ -17737,14 +17792,14 @@
lx = r * Math.cos(ea) + cx;
ly = r * Math.sin(ea) + cy;
if (Math.abs(ea - sa) > circleThreshold) {
// treat as full circle
- add$2(cx - r, cy - r);
- add$2(cx + r, cy + r);
+ add$1(cx - r, cy - r);
+ add$1(cx + r, cy + r);
} else {
- const update = a => add$2(r * Math.cos(a) + cx, r * Math.sin(a) + cy);
+ const update = a => add$1(r * Math.cos(a) + cx, r * Math.sin(a) + cy);
let s, i; // sample end points
update(sa);
update(ea); // sample interior points aligned with 90 degrees
@@ -17816,19 +17871,19 @@
s2 = s * s,
t2 = t * t;
return s2 * s * x0 + 3 * s2 * t * x1 + 3 * s * t2 * x2 + t2 * t * x3;
}
- var context$1 = (context$1 = domCanvas(1, 1)) ? context$1.getContext('2d') : null;
+ var context$2 = (context$2 = domCanvas(1, 1)) ? context$2.getContext('2d') : null;
const b = new Bounds();
function intersectPath(draw) {
return function (item, brush) {
// rely on (inaccurate) bounds intersection if no context
- if (!context$1) return true; // add path to offscreen graphics context
+ if (!context$2) return true; // add path to offscreen graphics context
- draw(context$1, item); // get bounds intersection region
+ draw(context$2, item); // get bounds intersection region
b.clear().union(item.bounds).intersect(brush).round();
const {
x1,
y1,
@@ -17837,11 +17892,11 @@
} = b; // iterate over intersection region
// perform fine grained inclusion test
for (let y = y1; y <= y2; ++y) {
for (let x = x1; x <= x2; ++x) {
- if (context$1.isPointInPath(x, y)) {
+ if (context$2.isPointInPath(x, y)) {
return true;
}
}
} // false if no hits in intersection region
@@ -17922,11 +17977,11 @@
function blend(context, item) {
context.globalCompositeOperation = item.blend || 'source-over';
}
- function value$1(value, dflt) {
+ function value$2(value, dflt) {
return value == null ? dflt : value;
}
function addStops(gradient, stops) {
const n = stops.length;
@@ -17936,23 +17991,23 @@
}
return gradient;
}
- function gradient(context, spec, bounds) {
+ function gradient$1(context, spec, bounds) {
const w = bounds.width(),
h = bounds.height();
let gradient;
if (spec.gradient === 'radial') {
- gradient = context.createRadialGradient(bounds.x1 + value$1(spec.x1, 0.5) * w, bounds.y1 + value$1(spec.y1, 0.5) * h, Math.max(w, h) * value$1(spec.r1, 0), bounds.x1 + value$1(spec.x2, 0.5) * w, bounds.y1 + value$1(spec.y2, 0.5) * h, Math.max(w, h) * value$1(spec.r2, 0.5));
+ gradient = context.createRadialGradient(bounds.x1 + value$2(spec.x1, 0.5) * w, bounds.y1 + value$2(spec.y1, 0.5) * h, Math.max(w, h) * value$2(spec.r1, 0), bounds.x1 + value$2(spec.x2, 0.5) * w, bounds.y1 + value$2(spec.y2, 0.5) * h, Math.max(w, h) * value$2(spec.r2, 0.5));
} else {
// linear gradient
- const x1 = value$1(spec.x1, 0),
- y1 = value$1(spec.y1, 0),
- x2 = value$1(spec.x2, 1),
- y2 = value$1(spec.y2, 0);
+ const x1 = value$2(spec.x1, 0),
+ y1 = value$2(spec.y1, 0),
+ x2 = value$2(spec.x2, 1),
+ y2 = value$2(spec.y2, 0);
if (x1 === x2 || y1 === y2 || w === h) {
// axis aligned: use normal gradient
gradient = context.createLinearGradient(bounds.x1 + x1 * w, bounds.y1 + y1 * h, bounds.x1 + x2 * w, bounds.y1 + y2 * h);
} else {
@@ -17969,11 +18024,11 @@
return addStops(gradient, spec.stops);
}
function color$1(context, item, value) {
- return isGradient(value) ? gradient(context, value, item.bounds) : value;
+ return isGradient(value) ? gradient$1(context, value, item.bounds) : value;
}
function fill(context, item, opacity) {
opacity *= item.fillOpacity == null ? 1 : item.fillOpacity;
@@ -17984,11 +18039,11 @@
} else {
return false;
}
}
- var Empty$1 = [];
+ var Empty = [];
function stroke(context, item, opacity) {
var lw = (lw = item.strokeWidth) != null ? lw : 1;
if (lw <= 0) return false;
opacity *= item.strokeOpacity == null ? 1 : item.strokeOpacity;
@@ -18000,21 +18055,21 @@
context.lineCap = item.strokeCap || 'butt';
context.lineJoin = item.strokeJoin || 'miter';
context.miterLimit = item.strokeMiterLimit || 10;
if (context.setLineDash) {
- context.setLineDash(item.strokeDash || Empty$1);
+ context.setLineDash(item.strokeDash || Empty);
context.lineDashOffset = item.strokeDashOffset || 0;
}
return true;
} else {
return false;
}
}
- function compare$1(a, b) {
+ function compare(a, b) {
return a.zindex - b.zindex || a.index - b.index;
}
function zorder(scene) {
if (!scene.zdirty) return scene.zitems;
@@ -18029,11 +18084,11 @@
item.index = i;
if (item.zindex) output.push(item);
}
scene.zdirty = false;
- return scene.zitems = output.sort(compare$1);
+ return scene.zitems = output.sort(compare);
}
function visit(scene, visitor) {
var items = scene.items,
i,
@@ -18108,11 +18163,11 @@
if (item.stroke && stroke(context, item, opacity)) {
context.stroke();
}
}
- function pick(test) {
+ function pick$1(test) {
test = test || truthy;
return function (context, scene, x, y, gx, gy) {
x *= context.pixelRatio;
y *= context.pixelRatio;
return pickVisit(scene, item => {
@@ -18143,35 +18198,35 @@
return path(context, o) ? false : fill && context.isPointInPath(x, y) || stroke && context.isPointInStroke(x, y);
};
}
function pickPath(path) {
- return pick(hitPath(path));
+ return pick$1(hitPath(path));
}
- function translate(x, y) {
+ function translate$1(x, y) {
return 'translate(' + x + ',' + y + ')';
}
function rotate(a) {
return 'rotate(' + a + ')';
}
- function scale$1$1(scaleX, scaleY) {
+ function scale$3(scaleX, scaleY) {
return 'scale(' + scaleX + ',' + scaleY + ')';
}
function translateItem(item) {
- return translate(item.x || 0, item.y || 0);
+ return translate$1(item.x || 0, item.y || 0);
}
function rotateItem(item) {
- return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '');
+ return translate$1(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '');
}
function transformItem(item) {
- return translate(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale$1$1(item.scaleX || 1, item.scaleY || 1) : '');
+ return translate$1(item.x || 0, item.y || 0) + (item.angle ? ' ' + rotate(item.angle) : '') + (item.scaleX || item.scaleY ? ' ' + scale$3(item.scaleX || 1, item.scaleY || 1) : '');
}
function markItemPath(type, shape, isect) {
function attr(emit, item) {
emit('transform', rotateItem(item));
@@ -18205,11 +18260,11 @@
pick: pickPath(draw),
isect: isect || intersectPath(draw)
};
}
- var arc$1 = markItemPath('arc', arc);
+ var arc$2 = markItemPath('arc', arc$1);
function pickArea(a, p) {
var v = a[0].orient === 'horizontal' ? p[1] : p[0],
z = a[0].orient === 'horizontal' ? 'y' : 'x',
i = a.length,
@@ -18314,13 +18369,13 @@
isect: intersectPoint,
tip: tip
};
}
- var area$1 = markMultiItemPath('area', area, pickArea);
+ var area$2 = markMultiItemPath('area', area$1, pickArea);
- function clip$1(context, scene) {
+ function clip$2(context, scene) {
var clip = scene.clip;
context.save();
if (isFunction(clip)) {
context.beginPath();
@@ -18336,24 +18391,24 @@
hasCornerRadius(group) ? rectangle(context, group, 0, 0) : context.rect(0, 0, group.width || 0, group.height || 0);
context.clip();
}
function offset$1(item) {
- const sw = value$1(item.strokeWidth, 1);
+ const sw = value$2(item.strokeWidth, 1);
return item.strokeOffset != null ? item.strokeOffset : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1) : 0;
}
- function attr(emit, item) {
+ function attr$5(emit, item) {
emit('transform', translateItem(item));
}
function emitRectangle(emit, item) {
const off = offset$1(item);
emit('d', rectangle(null, item, off, off));
}
- function background(emit, item) {
+ function background$1(emit, item) {
emit('class', 'background');
emit('aria-hidden', true);
emitRectangle(emit, item);
}
@@ -18367,15 +18422,15 @@
emit('d', '');
}
}
function content(emit, item, renderer) {
- const url = item.clip ? clip(renderer, item, item) : null;
+ const url = item.clip ? clip$1$1(renderer, item, item) : null;
emit('clip-path', url);
}
- function bound(bounds, group) {
+ function bound$5(bounds, group) {
if (!group.clip && group.items) {
const items = group.items,
m = items.length;
for (let j = 0; j < m; ++j) {
@@ -18399,11 +18454,11 @@
const hitBackground = hitPath(rectanglePath);
const hitForeground = hitPath(rectanglePath, false);
const hitCorner = hitPath(rectanglePath, true);
- function draw(context, scene, bounds) {
+ function draw$4(context, scene, bounds) {
visit(scene, group => {
const gx = group.x || 0,
gy = group.y || 0,
fore = group.strokeForeground,
opacity = group.opacity == null ? 1 : group.opacity; // draw group background
@@ -18443,11 +18498,11 @@
}
}
});
}
- function pick$1(context, scene, x, y, gx, gy) {
+ function pick(context, scene, x, y, gx, gy) {
if (scene.bounds && !scene.bounds.contains(gx, gy) || !scene.items) {
return null;
}
const cx = x * context.pixelRatio,
@@ -18502,17 +18557,17 @@
var group = {
type: 'group',
tag: 'g',
nested: false,
- attr: attr,
- bound: bound,
- draw: draw,
- pick: pick$1,
+ attr: attr$5,
+ bound: bound$5,
+ draw: draw$4,
+ pick: pick,
isect: intersectRect,
content: content,
- background: background,
+ background: background$1,
foreground: foreground
};
var metadata = {
'xmlns': 'http://www.w3.org/2000/svg',
'xmlns:xlink': 'http://www.w3.org/1999/xlink',
@@ -18551,41 +18606,43 @@
function imageYOffset(baseline, h) {
return baseline === 'middle' ? h / 2 : baseline === 'bottom' ? h : 0;
}
- function attr$1(emit, item, renderer) {
+ function attr$4(emit, item, renderer) {
const img = getImage(item, renderer),
w = imageWidth(item, img),
h = imageHeight(item, img),
x = (item.x || 0) - imageXOffset(item.align, w),
y = (item.y || 0) - imageYOffset(item.baseline, h),
i = !img.src && img.toDataURL ? img.toDataURL() : img.src || '';
emit('href', i, metadata['xmlns:xlink'], 'xlink:href');
- emit('transform', translate(x, y));
+ emit('transform', translate$1(x, y));
emit('width', w);
emit('height', h);
emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid');
}
- function bound$1(bounds, item) {
+ function bound$4(bounds, item) {
const img = item.image,
w = imageWidth(item, img),
h = imageHeight(item, img),
x = (item.x || 0) - imageXOffset(item.align, w),
y = (item.y || 0) - imageYOffset(item.baseline, h);
return bounds.set(x, y, x + w, y + h);
}
- function draw$1(context, scene, bounds) {
+ function draw$3(context, scene, bounds) {
visit(scene, item => {
if (bounds && !bounds.intersects(item.bounds)) return; // bounds check
const img = getImage(item, this);
- let w = imageWidth(item, img),
- h = imageHeight(item, img),
- x = (item.x || 0) - imageXOffset(item.align, w),
+ let w = imageWidth(item, img);
+ let h = imageHeight(item, img);
+ if (w === 0 || h === 0) return; // early exit
+
+ let x = (item.x || 0) - imageXOffset(item.align, w),
y = (item.y || 0) - imageYOffset(item.baseline, h),
opacity,
ar0,
ar1,
t;
@@ -18618,23 +18675,23 @@
var image = {
type: 'image',
tag: 'image',
nested: false,
- attr: attr$1,
- bound: bound$1,
- draw: draw$1,
- pick: pick(),
+ attr: attr$4,
+ bound: bound$4,
+ draw: draw$3,
+ pick: pick$1(),
isect: truthy,
// bounds check is sufficient
get: getImage,
xOffset: imageXOffset,
yOffset: imageYOffset
};
- var line$1 = markMultiItemPath('line', line, pickLine);
+ var line$2 = markMultiItemPath('line', line$1, pickLine);
- function attr$2(emit, item) {
+ function attr$3(emit, item) {
var sx = item.scaleX || 1,
sy = item.scaleY || 1;
if (sx !== 1 || sy !== 1) {
emit('vector-effect', 'non-scaling-stroke');
@@ -18667,30 +18724,30 @@
} else {
pathRender(context, cache, x, y, sx, sy);
}
}
- function bound$2(bounds, item) {
+ function bound$3(bounds, item) {
return path$1(boundContext(bounds, item.angle), item) ? bounds.set(0, 0, 0, 0) : boundStroke(bounds, item, true);
}
- var path$1$1 = {
+ var path$2 = {
type: 'path',
tag: 'path',
nested: false,
- attr: attr$2,
- bound: bound$2,
+ attr: attr$3,
+ bound: bound$3,
draw: drawAll(path$1),
pick: pickPath(path$1),
isect: intersectPath(path$1)
};
- function attr$3(emit, item) {
+ function attr$2(emit, item) {
emit('d', rectangle(null, item));
}
- function bound$3(bounds, item) {
+ function bound$2(bounds, item) {
var x, y;
return boundStroke(bounds.set(x = item.x || 0, y = item.y || 0, x + item.width || 0, y + item.height || 0), item);
}
function draw$2(context, item) {
@@ -18700,29 +18757,29 @@
var rect = {
type: 'rect',
tag: 'path',
nested: false,
- attr: attr$3,
- bound: bound$3,
+ attr: attr$2,
+ bound: bound$2,
draw: drawAll(draw$2),
pick: pickPath(draw$2),
isect: intersectRect
};
- function attr$4(emit, item) {
+ function attr$1(emit, item) {
emit('transform', translateItem(item));
emit('x2', item.x2 != null ? item.x2 - (item.x || 0) : 0);
emit('y2', item.y2 != null ? item.y2 - (item.y || 0) : 0);
}
- function bound$4(bounds, item) {
+ function bound$1(bounds, item) {
var x1, y1;
return boundStroke(bounds.set(x1 = item.x || 0, y1 = item.y || 0, item.x2 != null ? item.x2 : x1, item.y2 != null ? item.y2 : y1), item);
}
- function path$2(context, item, opacity) {
+ function path(context, item, opacity) {
var x1, y1, x2, y2;
if (item.stroke && stroke(context, item, opacity)) {
x1 = item.x || 0;
y1 = item.y || 0;
@@ -18735,40 +18792,40 @@
}
return false;
}
- function draw$3(context, scene, bounds) {
+ function draw$1(context, scene, bounds) {
visit(scene, item => {
if (bounds && !bounds.intersects(item.bounds)) return; // bounds check
var opacity = item.opacity == null ? 1 : item.opacity;
- if (opacity && path$2(context, item, opacity)) {
+ if (opacity && path(context, item, opacity)) {
blend(context, item);
context.stroke();
}
});
}
- function hit(context, item, x, y) {
+ function hit$1(context, item, x, y) {
if (!context.isPointInStroke) return false;
- return path$2(context, item, 1) && context.isPointInStroke(x, y);
+ return path(context, item, 1) && context.isPointInStroke(x, y);
}
- var rule = {
+ var rule$1 = {
type: 'rule',
tag: 'line',
nested: false,
- attr: attr$4,
- bound: bound$4,
- draw: draw$3,
- pick: pick(hit),
+ attr: attr$1,
+ bound: bound$1,
+ draw: draw$1,
+ pick: pick$1(hit$1),
isect: intersectRule
};
- var shape$1 = markItemPath('shape', shape);
- var symbol$1 = markItemPath('symbol', symbol, intersectPoint);
+ var shape = markItemPath('shape', shape$1);
+ var symbol = markItemPath('symbol', symbol$1, intersectPoint);
const widthCache = lruCache();
var textMetrics = {
height: fontSize,
measureWidth: measureWidth,
estimateWidth: estimateWidth,
@@ -18776,11 +18833,11 @@
canvas: useCanvas
};
useCanvas(true);
function useCanvas(use) {
- textMetrics.width = use && context$1 ? measureWidth : estimateWidth;
+ textMetrics.width = use && context$2 ? measureWidth : estimateWidth;
} // make simple estimate if no canvas is available
function estimateWidth(item, text) {
return _estimateWidth(textValue(item, text), fontSize(item));
@@ -18794,16 +18851,16 @@
function measureWidth(item, text) {
return fontSize(item) <= 0 || !(text = textValue(item, text)) ? 0 : _measureWidth(text, font(item));
}
function _measureWidth(text, currentFont) {
- const key = "(".concat(currentFont, ") ").concat(text);
+ const key = `(${currentFont}) ${text}`;
let width = widthCache.get(key);
if (width === undefined) {
- context$1.font = currentFont;
- width = context$1.measureText(text).width;
+ context$2.font = currentFont;
+ width = context$2.measureText(text).width;
widthCache.set(key, width);
}
return width;
}
@@ -18829,11 +18886,11 @@
return (isArray(tl) ? tl.length - 1 : 0) * lineHeight(item);
}
function textValue(item, line) {
const text = line == null ? '' : (line + '').trim();
- return item.limit > 0 && text.length ? truncate$1(item, text) : text;
+ return item.limit > 0 && text.length ? truncate(item, text) : text;
}
function widthGetter(item) {
if (textMetrics.width === measureWidth) {
// we are using canvas
@@ -18844,11 +18901,11 @@
const currentFontHeight = fontSize(item);
return text => _estimateWidth(text, currentFontHeight);
}
}
- function truncate$1(item, text) {
+ function truncate(item, text) {
var limit = +item.limit,
width = widthGetter(item);
if (width(text) < limit) return text;
var ellipsis = item.ellipsis || '\u2026',
rtl = item.dir === 'rtl',
@@ -18881,11 +18938,11 @@
function font(item, quote) {
return '' + (item.fontStyle ? item.fontStyle + ' ' : '') + (item.fontVariant ? item.fontVariant + ' ' : '') + (item.fontWeight ? item.fontWeight + ' ' : '') + fontSize(item) + 'px ' + fontFamily(item, quote);
}
- function offset$1$1(item) {
+ function offset$2(item) {
// perform our own font baseline calculation
// why? not all browsers support SVG 1.1 'alignment-baseline' :(
// this also ensures consistent layout across renderers
var baseline = item.baseline,
h = fontSize(item);
@@ -18895,11 +18952,11 @@
const textAlign = {
'left': 'start',
'center': 'middle',
'right': 'end'
};
- const tempBounds = new Bounds();
+ const tempBounds$1 = new Bounds();
function anchorPoint(item) {
var x = item.x || 0,
y = item.y || 0,
r = item.radius || 0,
@@ -18909,43 +18966,43 @@
t = (item.theta || 0) - HalfPi;
x += r * Math.cos(t);
y += r * Math.sin(t);
}
- tempBounds.x1 = x;
- tempBounds.y1 = y;
- return tempBounds;
+ tempBounds$1.x1 = x;
+ tempBounds$1.y1 = y;
+ return tempBounds$1;
}
- function attr$5(emit, item) {
+ function attr(emit, item) {
var dx = item.dx || 0,
- dy = (item.dy || 0) + offset$1$1(item),
+ dy = (item.dy || 0) + offset$2(item),
p = anchorPoint(item),
x = p.x1,
y = p.y1,
a = item.angle || 0,
t;
emit('text-anchor', textAlign[item.align] || 'start');
if (a) {
- t = translate(x, y) + ' ' + rotate(a);
- if (dx || dy) t += ' ' + translate(dx, dy);
+ t = translate$1(x, y) + ' ' + rotate(a);
+ if (dx || dy) t += ' ' + translate$1(dx, dy);
} else {
- t = translate(x + dx, y + dy);
+ t = translate$1(x + dx, y + dy);
}
emit('transform', t);
}
- function bound$5(bounds, item, mode) {
+ function bound(bounds, item, mode) {
var h = textMetrics.height(item),
a = item.align,
p = anchorPoint(item),
x = p.x1,
y = p.y1,
dx = item.dx || 0,
- dy = (item.dy || 0) + offset$1$1(item) - Math.round(0.8 * h),
+ dy = (item.dy || 0) + offset$2(item) - Math.round(0.8 * h),
// use 4/5 offset
tl = textLines(item),
w; // get dimensions
if (isArray(tl)) {
@@ -18973,11 +19030,11 @@
}
return bounds;
}
- function draw$4(context, scene, bounds) {
+ function draw$5(context, scene, bounds) {
visit(scene, item => {
var opacity = item.opacity == null ? 1 : item.opacity,
p,
x,
y,
@@ -18998,11 +19055,11 @@
context.rotate(item.angle * DegToRad);
x = y = 0; // reset x, y
}
x += item.dx || 0;
- y += (item.dy || 0) + offset$1$1(item);
+ y += (item.dy || 0) + offset$2(item);
tl = textLines(item);
blend(context, item);
if (isArray(tl)) {
lh = lineHeight(item);
@@ -19034,59 +19091,59 @@
if (item.angle) context.restore();
});
}
- function hit$1(context, item, x, y, gx, gy) {
+ function hit(context, item, x, y, gx, gy) {
if (item.fontSize <= 0) return false;
if (!item.angle) return true; // bounds sufficient if no rotation
// project point into space of unrotated bounds
var p = anchorPoint(item),
ax = p.x1,
ay = p.y1,
- b = bound$5(tempBounds, item, 1),
+ b = bound(tempBounds$1, item, 1),
a = -item.angle * DegToRad,
cos = Math.cos(a),
sin = Math.sin(a),
px = cos * gx - sin * gy + (ax - cos * ax + sin * ay),
py = sin * gx + cos * gy + (ay - sin * ax - cos * ay);
return b.contains(px, py);
}
function intersectText(item, box) {
- const p = bound$5(tempBounds, item, 2);
+ const p = bound(tempBounds$1, item, 2);
return intersectBoxLine(box, p[0], p[1], p[2], p[3]) || intersectBoxLine(box, p[0], p[1], p[4], p[5]) || intersectBoxLine(box, p[4], p[5], p[6], p[7]) || intersectBoxLine(box, p[2], p[3], p[6], p[7]);
}
var text = {
type: 'text',
tag: 'text',
nested: false,
- attr: attr$5,
- bound: bound$5,
- draw: draw$4,
- pick: pick(hit$1),
+ attr: attr,
+ bound: bound,
+ draw: draw$5,
+ pick: pick$1(hit),
isect: intersectText
};
- var trail$1 = markMultiItemPath('trail', trail, pickTrail);
+ var trail = markMultiItemPath('trail', trail$1, pickTrail);
var Marks = {
- arc: arc$1,
- area: area$1,
+ arc: arc$2,
+ area: area$2,
group: group,
image: image,
- line: line$1,
- path: path$1$1,
+ line: line$2,
+ path: path$2,
rect: rect,
- rule: rule,
- shape: shape$1,
- symbol: symbol$1,
+ rule: rule$1,
+ shape: shape,
+ symbol: symbol,
text: text,
- trail: trail$1
+ trail: trail
};
- function boundItem(item, func, opt) {
+ function boundItem$1(item, func, opt) {
var type = Marks[item.mark.marktype],
bound = func || type.bound;
if (type.nested) item = item.mark;
return bound(item.bounds || (item.bounds = new Bounds()), item, opt);
}
@@ -19112,27 +19169,27 @@
// no items, fake it
DUMMY.mark = mark;
item = DUMMY;
}
- b = boundItem(item, bound, opt);
+ b = boundItem$1(item, bound, opt);
bounds = bounds && bounds.union(b) || b;
return bounds;
}
bounds = bounds || mark.bounds && mark.bounds.clear() || new Bounds();
if (hasItems) {
for (i = 0, n = items.length; i < n; ++i) {
- bounds.union(boundItem(items[i], bound, opt));
+ bounds.union(boundItem$1(items[i], bound, opt));
}
}
return mark.bounds = bounds;
}
- const keys = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline', // layout
+ const keys$1 = ['marktype', 'name', 'role', 'interactive', 'clip', 'items', 'zindex', 'x', 'y', 'width', 'height', 'align', 'baseline', // layout
'fill', 'fillOpacity', 'opacity', 'blend', // fill
'stroke', 'strokeOpacity', 'strokeWidth', 'strokeCap', // stroke
'strokeDash', 'strokeDashOffset', // stroke dash
'strokeForeground', 'strokeOffset', // group
'startAngle', 'endAngle', 'innerRadius', 'outerRadius', // arc
@@ -19147,19 +19204,19 @@
'ellipsis', 'limit', 'lineBreak', 'lineHeight', 'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant', // font
'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria
];
function sceneToJSON(scene, indent) {
- return JSON.stringify(scene, keys, indent);
+ return JSON.stringify(scene, keys$1, indent);
}
function sceneFromJSON(json) {
const scene = typeof json === 'string' ? JSON.parse(json) : json;
- return initialize(scene);
+ return initialize$1(scene);
}
- function initialize(scene) {
+ function initialize$1(scene) {
var type = scene.marktype,
items = scene.items,
parent,
i,
n;
@@ -19167,11 +19224,11 @@
if (items) {
for (i = 0, n = items.length; i < n; ++i) {
parent = type ? 'mark' : 'group';
items[i][parent] = scene;
if (items[i].zindex) items[i][parent].zdirty = true;
- if ('group' === (type || parent)) initialize(items[i]);
+ if ('group' === (type || parent)) initialize$1(items[i]);
}
}
if (type) boundMark(scene);
return scene;
@@ -19278,22 +19335,22 @@
function cssClass(mark) {
return 'mark-' + mark.marktype + (mark.role ? ' role-' + mark.role : '') + (mark.name ? ' ' + mark.name : '');
}
- function point$5(event, el) {
+ function point(event, el) {
const rect = el.getBoundingClientRect();
return [event.clientX - rect.left - (el.clientLeft || 0), event.clientY - rect.top - (el.clientTop || 0)];
}
function resolveItem(item, event, el, origin) {
var mark = item && item.mark,
mdef,
p;
if (mark && (mdef = Marks[mark.marktype]).tip) {
- p = point$5(event, el);
+ p = point(event, el);
p[0] -= origin[0];
p[1] -= origin[1];
while (item = item.mark.group) {
p[0] -= item.x || 0;
@@ -19318,16 +19375,16 @@
function Handler(customLoader, customTooltip) {
this._active = null;
this._handlers = {};
this._loader = customLoader || loader();
- this._tooltip = customTooltip || defaultTooltip;
+ this._tooltip = customTooltip || defaultTooltip$1;
} // The default tooltip display handler.
// Sets the HTML title attribute on the visualization container.
- function defaultTooltip(handler, event, item, value) {
+ function defaultTooltip$1(handler, event, item, value) {
handler.element().setAttribute('title', value || '');
}
Handler.prototype = {
/**
@@ -19384,20 +19441,16 @@
},
/**
* Add an event handler. Subclasses should override this method.
*/
- on()
- /*type, handler*/
- {},
+ on() {},
/**
* Remove an event handler. Subclasses should override this method.
*/
- off()
- /*type, handler*/
- {},
+ off() {},
/**
* Utility method for finding the array index of an event handler.
* @param {Array} h - An array of registered event handlers.
* @param {string} type - The event type.
@@ -19602,13 +19655,11 @@
* Report a dirty item whose bounds should be redrawn.
* This base class method does nothing. Subclasses that perform
* incremental should implement this method.
* @param {Item} item - The dirty item whose bounds should be redrawn.
*/
- dirty()
- /*item*/
- {},
+ dirty() {},
/**
* Render an input scenegraph, potentially with a set of dirty items.
* This method will perform an immediate rendering with available resources.
* The renderer may also need to perform image loading to perform a complete
@@ -19638,13 +19689,11 @@
/**
* Internal rendering method. Renderer subclasses should override this
* method to actually perform rendering.
* @param {object} scene - The root mark of a scenegraph to render.
*/
- _render()
- /*scene*/
- {// subclasses to override
+ _render() {// subclasses to override
},
/**
* Asynchronous rendering method. Similar to render, but returns a Promise
* that resolves when all rendering is completed. Sometimes a renderer must
@@ -19897,11 +19946,11 @@
return this;
},
pickEvent(evt) {
- const p = point$5(evt, this._canvas),
+ const p = point(evt, this._canvas),
o = this._origin;
return this.pick(this._scene, p[0], p[1], p[0] - o[0], p[1] - o[1]);
},
// find the scenegraph item at the current mouse position
@@ -19948,11 +19997,11 @@
this._redraw = false;
this._dirty = new Bounds();
this._tempb = new Bounds();
}
- const base = Renderer.prototype;
+ const base$1 = Renderer.prototype;
const viewBounds = (origin, width, height) => new Bounds().set(0, 0, width, height).translate(-origin[0], -origin[1]);
function clipToBounds(g, b, origin) {
// expand bounds by 1 pixel, then round to pixel boundaries
@@ -19981,15 +20030,15 @@
this._canvas.setAttribute('class', 'marks');
} // this method will invoke resize to size the canvas appropriately
- return base.initialize.call(this, el, width, height, origin, scaleFactor);
+ return base$1.initialize.call(this, el, width, height, origin, scaleFactor);
},
resize(width, height, origin, scaleFactor) {
- base.resize.call(this, width, height, origin, scaleFactor);
+ base$1.resize.call(this, width, height, origin, scaleFactor);
if (this._canvas) {
// configure canvas size and transform
resize(this._canvas, this._width, this._height, this._origin, this._scale, this._options.context);
} else {
@@ -20044,11 +20093,11 @@
return this;
},
draw(ctx, scene, bounds) {
const mark = Marks[scene.marktype];
- if (scene.clip) clip$1(ctx, scene);
+ if (scene.clip) clip$2(ctx, scene);
mark.draw.call(this, ctx, scene, bounds);
if (scene.clip) ctx.restore();
},
clear(x, y, w, h) {
@@ -20179,15 +20228,15 @@
desc: 'legend',
caption: legendCaption
},
'title-text': {
desc: 'title',
- caption: item => "Title text '".concat(titleCaption(item), "'")
+ caption: item => `Title text '${titleCaption(item)}'`
},
'title-subtitle': {
desc: 'subtitle',
- caption: item => "Subtitle text '".concat(titleCaption(item), "'")
+ caption: item => `Subtitle text '${titleCaption(item)}'`
}
}; // aria properties generated for mark item encoding channels
const AriaEncode = {
ariaRole: ARIA_ROLE,
@@ -20205,11 +20254,11 @@
}
} else {
const type = item.mark.marktype;
emit(ARIA_LABEL, item.description);
emit(ARIA_ROLE, item.ariaRole || (type === 'group' ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL));
- emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || "".concat(type, " mark"));
+ emit(ARIA_ROLEDESCRIPTION, item.ariaRoleDescription || `${type} mark`);
}
}
function ariaMarkAttributes(mark) {
return mark.aria === false ? {
@@ -20218,11 +20267,11 @@
}
function ariaMark(mark) {
const type = mark.marktype;
const recurse = type === 'group' || type === 'text' || mark.items.some(_ => _.description != null && _.aria !== false);
- return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, "".concat(type, " mark container"), mark.description);
+ return bundle(recurse ? GRAPHICS_OBJECT : GRAPHICS_SYMBOL, `${type} mark container`, mark.description);
}
function ariaGuide(mark, opt) {
try {
const item = mark.items[0],
@@ -20233,11 +20282,11 @@
return null;
}
}
function titleCaption(item) {
- return array(item.text).join(' ');
+ return array$5(item.text).join(' ');
}
function axisCaption(item) {
const datum = item.datum,
orient = item.orient,
@@ -20245,36 +20294,36 @@
ctx = item.context,
scale = ctx.scales[datum.scale].value,
locale = ctx.dataflow.locale(),
type = scale.type,
xy = orient === 'left' || orient === 'right' ? 'Y' : 'X';
- return "".concat(xy, "-axis") + (title ? " titled '".concat(title, "'") : '') + " for a ".concat(isDiscrete(type) ? 'discrete' : type, " scale") + " with ".concat(domainCaption(locale, scale, item));
+ return `${xy}-axis` + (title ? ` titled '${title}'` : '') + ` for a ${isDiscrete(type) ? 'discrete' : type} scale` + ` with ${domainCaption(locale, scale, item)}`;
}
function legendCaption(item) {
const datum = item.datum,
title = datum.title ? extractTitle(item) : null,
- type = "".concat(datum.type || '', " legend").trim(),
+ type = `${datum.type || ''} legend`.trim(),
scales = datum.scales,
props = Object.keys(scales),
ctx = item.context,
scale = ctx.scales[scales[props[0]]].value,
locale = ctx.dataflow.locale();
- return capitalize(type) + (title ? " titled '".concat(title, "'") : '') + " for ".concat(channelCaption(props)) + " with ".concat(domainCaption(locale, scale, item));
+ return capitalize(type) + (title ? ` titled '${title}'` : '') + ` for ${channelCaption(props)}` + ` with ${domainCaption(locale, scale, item)}`;
}
function extractTitle(item) {
try {
- return array(peek(item.items).items[0].text).join(' ');
+ return array$5(peek$1(item.items).items[0].text).join(' ');
} catch (err) {
return null;
}
}
function channelCaption(props) {
props = props.map(p => p + (p === 'fill' || p === 'stroke' ? ' color' : ''));
- return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + peek(props);
+ return props.length < 2 ? props[0] : props.slice(0, -1).join(', ') + ' and ' + peek$1(props);
}
function capitalize(s) {
return s.length ? s[0].toUpperCase() + s.slice(1) : s;
}
@@ -20290,18 +20339,18 @@
const stack = [],
clear = () => outer = inner = '',
push = tag => {
if (outer) {
- buf += "".concat(outer, ">").concat(inner);
+ buf += `${outer}>${inner}`;
clear();
}
stack.push(tag);
},
attr = (name, value) => {
- if (value != null) outer += " ".concat(name, "=\"").concat(attrText(value), "\"");
+ if (value != null) outer += ` ${name}="${attrText(value)}"`;
return m;
},
m = {
open(tag, ...attrs) {
push(tag);
@@ -20316,13 +20365,13 @@
close() {
const tag = stack.pop();
if (outer) {
- buf += outer + (inner ? ">".concat(inner, "</").concat(tag, ">") : '/>');
+ buf += outer + (inner ? `>${inner}</${tag}>` : '/>');
} else {
- buf += "</".concat(tag, ">");
+ buf += `</${tag}>`;
}
clear();
return m;
},
@@ -20348,15 +20397,13 @@
m.attr(attrs[i].name, attrs[i].value);
}
}
if (node.hasChildNodes()) {
- const children = node.childNodes,
- n = children.length;
+ const children = node.childNodes;
- for (let i = 0; i < n; i++) {
- const child = children[i];
+ for (const child of children) {
child.nodeType === 3 // text node
? m.text(child.nodeValue) : _serialize(m, child);
}
}
@@ -20393,11 +20440,11 @@
this._svg = null;
this._root = null;
this._defs = null;
}
- const base$1 = Renderer.prototype;
+ const base = Renderer.prototype;
inherits(SVGRenderer, Renderer, {
/**
* Initialize a new SVGRenderer instance.
* @param {DOMElement} el - The containing DOM element for the display.
* @param {number} width - The coordinate width of the display, in pixels.
@@ -20433,22 +20480,22 @@
domClear(this._svg, RootIndex + 1);
} // set background color if defined
this.background(this._bgcolor);
- return base$1.initialize.call(this, el, width, height, origin, scaleFactor);
+ return base.initialize.call(this, el, width, height, origin, scaleFactor);
},
/**
* Get / set the background color.
*/
background(bgcolor) {
if (arguments.length && this._svg) {
this._svg.style.setProperty('background-color', bgcolor);
}
- return base$1.background.apply(this, arguments);
+ return base.background.apply(this, arguments);
},
/**
* Resize the display.
* @param {number} width - The new coordinate width of the display, in pixels.
@@ -20458,20 +20505,20 @@
* @param {number} [scaleFactor=1] - Optional scaleFactor by which to multiply
* the width and height to determine the final pixel size.
* @return {SVGRenderer} - This renderer instance;
*/
resize(width, height, origin, scaleFactor) {
- base$1.resize.call(this, width, height, origin, scaleFactor);
+ base.resize.call(this, width, height, origin, scaleFactor);
if (this._svg) {
setAttributes(this._svg, {
width: this._width * this._scale,
height: this._height * this._scale,
- viewBox: "0 0 ".concat(this._width, " ").concat(this._height)
+ viewBox: `0 0 ${this._width} ${this._height}`
});
- this._root.setAttribute('transform', "translate(".concat(this._origin, ")"));
+ this._root.setAttribute('transform', `translate(${this._origin})`);
}
this._dirty = [];
return this;
},
@@ -20634,26 +20681,26 @@
mdef = Marks[scene.marktype],
events = scene.interactive === false ? 'none' : null,
isGroup = mdef.tag === 'g';
let sibling = null,
i = 0;
- const parent = bind(scene, el, prev, 'g', svg);
+ const parent = bind$1(scene, el, prev, 'g', svg);
parent.setAttribute('class', cssClass(scene)); // apply aria attributes to parent container element
const aria = ariaMarkAttributes(scene);
for (const key in aria) setAttribute(parent, key, aria[key]);
if (!isGroup) {
setAttribute(parent, 'pointer-events', events);
}
- setAttribute(parent, 'clip-path', scene.clip ? clip(this, scene, scene.group) : null);
+ setAttribute(parent, 'clip-path', scene.clip ? clip$1$1(this, scene, scene.group) : null);
const process = item => {
const dirty = this.isDirty(item),
- node = bind(item, parent, sibling, mdef.tag, svg);
+ node = bind$1(item, parent, sibling, mdef.tag, svg);
if (dirty) {
this._update(mdef, node, item);
if (isGroup) recurse(this, node, item);
@@ -20680,22 +20727,22 @@
* @param {Item} item - The mark item.
*/
_update(mdef, el, item) {
// set dom element and values cache
// provides access to emit method
- element = el;
+ element$1 = el;
values = el.__values__; // apply aria-specific properties
ariaItemAttributes(emit, item); // apply svg attributes
mdef.attr(emit, item, this); // some marks need special treatment
const extra = mark_extras[mdef.type];
if (extra) extra.call(this, mdef, el, item); // apply svg style attributes
// note: element state may have been modified by 'extra' method
- if (element) this.style(element, item);
+ if (element$1) this.style(element$1, item);
},
/**
* Update the presentation attributes of an SVG element for a mark item.
* @param {SVGElement} el - The SVG element.
@@ -20790,11 +20837,11 @@
});
pt = domChild(pt, 0, 'rect', svgns);
setAttributes(pt, {
width: 1,
height: 1,
- fill: "url(".concat(href(), "#").concat(grad.id, ")")
+ fill: `url(${href()}#${grad.id})`
});
el = domChild(el, index++, 'radialGradient', svgns);
setAttributes(el, {
id: grad.id,
fx: grad.x1,
@@ -20861,11 +20908,11 @@
domClear(el, 1 + idx);
} // Bind a scenegraph item to an SVG DOM element.
// Create new SVG elements as needed.
- function bind(item, el, sibling, tag, svg) {
+ function bind$1(item, el, sibling, tag, svg) {
let node = item._svg,
doc; // create a new dom node if needed
if (!node) {
doc = el.ownerDocument;
@@ -20907,25 +20954,25 @@
function siblingCheck(node, sibling) {
return node.parentNode && node.parentNode.childNodes.length > 1 && node.previousSibling != sibling; // treat null/undefined the same
} // -- Set attributes & styles on SVG elements ---
- let element = null,
+ let element$1 = null,
// temp var for current SVG element
values = null; // temp var for current values hash
// Extra configuration for certain mark types
const mark_extras = {
group(mdef, el, item) {
- const fg = element = el.childNodes[2];
+ const fg = element$1 = el.childNodes[2];
values = fg.__values__;
mdef.foreground(emit, item, this);
values = el.__values__; // use parent's values hash
- element = el.childNodes[1];
+ element$1 = el.childNodes[1];
mdef.content(emit, item, this);
- const bg = element = el.childNodes[0];
+ const bg = element$1 = el.childNodes[0];
mdef.background(emit, item, this);
const value = item.mark.interactive === false ? 'none' : null;
if (value !== values.events) {
setAttribute(fg, 'pointer-events', value);
@@ -20943,11 +20990,11 @@
if (fill) item.fill = null;
values = fg.__values__;
this.style(fg, item);
if (fill) item.fill = fill; // leave element null to prevent downstream styling
- element = null;
+ element$1 = null;
} else {
// ensure foreground is ignored
setAttribute(fg, 'display', 'none');
}
},
@@ -21011,13 +21058,13 @@
function emit(name, value, ns) {
// early exit if value is unchanged
if (value === values[name]) return; // use appropriate method given namespace (ns)
if (ns) {
- setAttributeNS(element, name, value, ns);
+ setAttributeNS(element$1, name, value, ns);
} else {
- setAttribute(element, name, value);
+ setAttribute(element$1, name, value);
} // note current value for future comparison
values[name] = value;
}
@@ -21088,15 +21135,15 @@
* @param {object} scene - The root mark of a scenegraph to render.
*/
_render(scene) {
const m = markup(); // svg tag
- m.open('svg', extend({}, metadata, {
+ m.open('svg', extend$1({}, metadata, {
class: 'marks',
width: this._width * this._scale,
height: this._height * this._scale,
- viewBox: "0 0 ".concat(this._width, " ").concat(this._height)
+ viewBox: `0 0 ${this._width} ${this._height}`
})); // background, if defined
const bg = this._bgcolor;
if (bg && bg !== 'transparent' && bg !== 'none') {
@@ -21131,11 +21178,11 @@
tag = mdef.tag,
attrList = [ariaItemAttributes, mdef.attr]; // render opening group tag
m.open('g', {
'class': cssClass(scene),
- 'clip-path': scene.clip ? clip(this, scene, scene.group) : null
+ 'clip-path': scene.clip ? clip$1$1(this, scene, scene.group) : null
}, ariaMarkAttributes(scene), {
'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null
}); // render contained elements
const process = item => {
@@ -21420,11 +21467,11 @@
} else {
return modules[name];
}
}
- function intersect$1(scene, bounds, filter) {
+ function intersect$2(scene, bounds, filter) {
const hits = [],
// intersection results
box = new Bounds().union(bounds),
// defensive copy
type = scene.marktype;
@@ -21508,11 +21555,11 @@
}
const TOLERANCE = 1e-9;
function sceneEqual(a, b, key) {
- return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : isNumber(a) && isNumber(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !isObject(a) && !isObject(b) ? a == b : objectEqual(a, b);
+ return a === b ? true : key === 'path' ? pathEqual(a, b) : a instanceof Date && b instanceof Date ? +a === +b : isNumber$1(a) && isNumber$1(b) ? Math.abs(a - b) <= TOLERANCE : !a || !b || !isObject(a) && !isObject(b) ? a == b : objectEqual(a, b);
}
function pathEqual(a, b) {
return sceneEqual(pathParse(a), pathParse(b));
}
@@ -21541,42 +21588,42 @@
function resetSVGDefIds() {
resetSVGClipId();
resetSVGGradientId();
}
- const Top = 'top';
- const Left = 'left';
- const Right = 'right';
- const Bottom = 'bottom';
+ const Top$1 = 'top';
+ const Left$1 = 'left';
+ const Right$1 = 'right';
+ const Bottom$1 = 'bottom';
const TopLeft = 'top-left';
const TopRight = 'top-right';
const BottomLeft = 'bottom-left';
const BottomRight = 'bottom-right';
- const Start = 'start';
- const Middle = 'middle';
- const End = 'end';
+ const Start$1 = 'start';
+ const Middle$1 = 'middle';
+ const End$1 = 'end';
const X = 'x';
const Y = 'y';
const Group = 'group';
- const AxisRole = 'axis';
- const TitleRole = 'title';
- const FrameRole = 'frame';
- const ScopeRole = 'scope';
- const LegendRole = 'legend';
+ const AxisRole$1 = 'axis';
+ const TitleRole$1 = 'title';
+ const FrameRole$1 = 'frame';
+ const ScopeRole$1 = 'scope';
+ const LegendRole$1 = 'legend';
const RowHeader = 'row-header';
const RowFooter = 'row-footer';
const RowTitle = 'row-title';
const ColHeader = 'column-header';
const ColFooter = 'column-footer';
const ColTitle = 'column-title';
- const Padding = 'padding';
- const Symbols = 'symbol';
+ const Padding$1 = 'padding';
+ const Symbols$1 = 'symbol';
const Fit = 'fit';
const FitX = 'fit-x';
const FitY = 'fit-y';
const Pad = 'pad';
- const None$2 = 'none';
+ const None = 'none';
const All = 'all';
const Each = 'each';
const Flush = 'flush';
const Column = 'column';
const Row = 'row';
@@ -21585,15 +21632,15 @@
* @constructor
* @param {object} params - The parameters for this operator.
* @param {object} params.mark - The scenegraph mark instance to bound.
*/
- function Bound(params) {
+ function Bound$1(params) {
Transform.call(this, null, params);
}
- inherits(Bound, Transform, {
+ inherits(Bound$1, Transform, {
transform(_, pulse) {
const view = pulse.dataflow,
mark = _.mark,
type = mark.marktype,
entry = Marks[type],
@@ -21602,37 +21649,37 @@
rebound;
if (entry.nested) {
// multi-item marks have a single bounds instance
if (mark.items.length) view.dirty(mark.items[0]);
- markBounds = boundItem$1(mark, bound);
+ markBounds = boundItem(mark, bound);
mark.items.forEach(item => {
item.bounds.clear().union(markBounds);
});
} else if (type === Group || _.modified()) {
// operator parameters modified -> re-bound all items
// updates group bounds in response to modified group content
pulse.visit(pulse.MOD, item => view.dirty(item));
markBounds.clear();
- mark.items.forEach(item => markBounds.union(boundItem$1(item, bound))); // force reflow for axes/legends/titles to propagate any layout changes
+ mark.items.forEach(item => markBounds.union(boundItem(item, bound))); // force reflow for axes/legends/titles to propagate any layout changes
switch (mark.role) {
- case AxisRole:
- case LegendRole:
- case TitleRole:
+ case AxisRole$1:
+ case LegendRole$1:
+ case TitleRole$1:
pulse.reflow();
}
} else {
// incrementally update bounds, re-bound mark as needed
rebound = pulse.changed(pulse.REM);
pulse.visit(pulse.ADD, item => {
- markBounds.union(boundItem$1(item, bound));
+ markBounds.union(boundItem(item, bound));
});
pulse.visit(pulse.MOD, item => {
rebound = rebound || markBounds.alignsWith(item.bounds);
view.dirty(item);
- markBounds.union(boundItem$1(item, bound));
+ markBounds.union(boundItem(item, bound));
});
if (rebound) {
markBounds.clear();
mark.items.forEach(item => markBounds.union(item.bounds));
@@ -21644,11 +21691,11 @@
return pulse.modifies('bounds');
}
});
- function boundItem$1(item, bound, opt) {
+ function boundItem(item, bound, opt) {
return bound(item.bounds.clear(), item, opt);
}
const COUNTER_NAME = ':vega_identifier:';
/**
@@ -21661,26 +21708,26 @@
* @constructor
* @param {object} params - The parameters for this operator.
* @param {string} params.as - The field name for the generated identifier.
*/
- function Identifier(params) {
+ function Identifier$1(params) {
Transform.call(this, 0, params);
}
- Identifier.Definition = {
+ Identifier$1.Definition = {
'type': 'Identifier',
'metadata': {
'modifies': true
},
'params': [{
'name': 'as',
'type': 'string',
'required': true
}]
};
- inherits(Identifier, Transform, {
+ inherits(Identifier$1, Transform, {
transform(_, pulse) {
const counter = getCounter(pulse.dataflow),
as = _.as;
let id = counter.value;
pulse.visit(pulse.ADD, t => t[as] = t[as] || ++id);
@@ -21701,20 +21748,20 @@
* This is an object of legal scenegraph mark properties which *must* include
* the 'marktype' property.
*/
- function Mark(params) {
+ function Mark$1(params) {
Transform.call(this, null, params);
}
- inherits(Mark, Transform, {
+ inherits(Mark$1, Transform, {
transform(_, pulse) {
let mark = this.value; // acquire mark on first invocation, bind context and group
if (!mark) {
- mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1(_), _.index);
+ mark = pulse.dataflow.scenegraph().mark(_.markdef, lookup$1$1(_), _.index);
mark.group.context = _.context;
if (!_.context.group) _.context.group = mark.group;
mark.source = this.source; // point to upstream collector
mark.clip = _.clip;
@@ -21739,11 +21786,11 @@
return pulse;
}
});
- function lookup$1(_) {
+ function lookup$1$1(_) {
const g = _.groups,
p = _.parent;
return g && g.size === 1 ? g.get(Object.keys(g.object)[0]) : g && p ? g.lookup(p) : null;
}
/**
@@ -21769,28 +21816,28 @@
* an item's bounds may exceed the scale range bounds and not be culled.
* @constructor
*/
- function Overlap(params) {
+ function Overlap$1(params) {
Transform.call(this, null, params);
}
const methods = {
parity: items => items.filter((item, i) => i % 2 ? item.opacity = 0 : 1),
greedy: (items, sep) => {
let a;
- return items.filter((b, i) => !i || !intersect$2(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0);
+ return items.filter((b, i) => !i || !intersect$1(a.bounds, b.bounds, sep) ? (a = b, 1) : b.opacity = 0);
}
}; // compute bounding box intersection
// including padding pixels of separation
- const intersect$2 = (a, b, sep) => sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
+ const intersect$1 = (a, b, sep) => sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
const hasOverlap = (items, pad) => {
for (var i = 1, n = items.length, a = items[0].bounds, b; i < n; a = b, ++i) {
- if (intersect$2(a, b = items[i].bounds, pad)) return true;
+ if (intersect$1(a, b = items[i].bounds, pad)) return true;
}
};
const hasBounds = item => {
const b = item.bounds;
@@ -21799,11 +21846,11 @@
const boundTest = (scale, orient, tolerance) => {
var range = scale.range(),
b = new Bounds();
- if (orient === Top || orient === Bottom) {
+ if (orient === Top$1 || orient === Bottom$1) {
b.set(range[0], -Infinity, range[1], +Infinity);
} else {
b.set(-Infinity, range[0], +Infinity, range[1]);
}
@@ -21819,11 +21866,11 @@
// fork prevents cross-stream tuple pollution (e.g., pulse from scale)
const reflow = (pulse, _) => pulse.reflow(_.modified()).modifies('opacity');
- inherits(Overlap, Transform, {
+ inherits(Overlap$1, Transform, {
transform(_, pulse) {
const reduce = methods[_.method] || methods.parity,
sep = _.separation || 0;
let source = pulse.materialize(pulse.SOURCE).source,
items,
@@ -21855,13 +21902,13 @@
if (items.length >= 3 && hasOverlap(items, sep)) {
do {
items = reduce(items, sep);
} while (items.length >= 3 && hasOverlap(items, sep));
- if (items.length < 3 && !peek(source).opacity) {
- if (items.length > 1) peek(items).opacity = 0;
- peek(source).opacity = 1;
+ if (items.length < 3 && !peek$1(source).opacity) {
+ if (items.length > 1) peek$1(items).opacity = 0;
+ peek$1(source).opacity = 1;
}
}
if (_.boundScale && _.boundTolerance >= 0) {
test = boundTest(_.boundScale, _.boundOrient, +_.boundTolerance);
@@ -21882,15 +21929,15 @@
/**
* Queue modified scenegraph items for rendering.
* @constructor
*/
- function Render(params) {
+ function Render$1(params) {
Transform.call(this, null, params);
}
- inherits(Render, Transform, {
+ inherits(Render$1, Transform, {
transform(_, pulse) {
const view = pulse.dataflow;
pulse.visit(pulse.ALL, item => view.dirty(item)); // set z-index dirty flag as needed
if (pulse.fields && pulse.fields['zindex']) {
@@ -21898,19 +21945,19 @@
if (item) item.mark.zdirty = true;
}
}
});
- const tempBounds$1 = new Bounds();
+ const tempBounds = new Bounds();
- function set$1(item, property, value) {
+ function set$2(item, property, value) {
return item[property] === value ? 0 : (item[property] = value, 1);
}
function isYAxis(mark) {
var orient = mark.items[0].orient;
- return orient === Left || orient === Right;
+ return orient === Left$1 || orient === Right$1;
}
function axisIndices(datum) {
let index = +datum.grid;
return [datum.ticks ? index++ : -1, // ticks index
@@ -21936,41 +21983,41 @@
dl = title && multiLineOffset(title),
x = 0,
y = 0,
i,
s;
- tempBounds$1.clear().union(bounds);
+ tempBounds.clear().union(bounds);
bounds.clear();
if ((i = indices[0]) > -1) bounds.union(item.items[i].bounds);
if ((i = indices[1]) > -1) bounds.union(item.items[i].bounds); // position axis group and title
switch (orient) {
- case Top:
+ case Top$1:
x = position || 0;
y = -offset;
s = Math.max(minExtent, Math.min(maxExtent, -bounds.y1));
bounds.add(0, -s).add(range, 0);
if (title) axisTitleLayout(view, title, s, titlePadding, dl, 0, -1, bounds);
break;
- case Left:
+ case Left$1:
x = -offset;
y = position || 0;
s = Math.max(minExtent, Math.min(maxExtent, -bounds.x1));
bounds.add(-s, 0).add(0, range);
if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, -1, bounds);
break;
- case Right:
+ case Right$1:
x = width + offset;
y = position || 0;
s = Math.max(minExtent, Math.min(maxExtent, bounds.x2));
bounds.add(0, 0).add(s, range);
if (title) axisTitleLayout(view, title, s, titlePadding, dl, 1, 1, bounds);
break;
- case Bottom:
+ case Bottom$1:
x = position || 0;
y = height + offset;
s = Math.max(minExtent, Math.min(maxExtent, bounds.y2));
bounds.add(0, 0).add(range, s);
if (title) axisTitleLayout(view, title, s, titlePadding, 0, 0, 1, bounds);
@@ -21982,12 +22029,12 @@
} // update bounds
boundStroke(bounds.translate(x, y), item);
- if (set$1(item, 'x', x + delta) | set$1(item, 'y', y + delta)) {
- item.bounds = tempBounds$1;
+ if (set$2(item, 'x', x + delta) | set$2(item, 'y', y + delta)) {
+ item.bounds = tempBounds;
view.dirty(item);
item.bounds = bounds;
view.dirty(item);
}
@@ -22008,13 +22055,13 @@
}
bounds.union(b);
}
- const min$2 = (a, b) => Math.floor(Math.min(a, b));
+ const min = (a, b) => Math.floor(Math.min(a, b));
- const max$2 = (a, b) => Math.ceil(Math.max(a, b));
+ const max = (a, b) => Math.ceil(Math.max(a, b));
function gridLayoutGroups(group) {
var groups = group.items,
n = groups.length,
i = 0,
@@ -22034,13 +22081,13 @@
mark = groups[i];
items = mark.items;
if (mark.marktype === Group) {
switch (mark.role) {
- case AxisRole:
- case LegendRole:
- case TitleRole:
+ case AxisRole$1:
+ case LegendRole$1:
+ case TitleRole$1:
break;
case RowHeader:
views.rowheaders.push(...items);
break;
@@ -22081,27 +22128,27 @@
function bboxFull(item) {
const b = item.bounds.clone();
return b.empty() ? b.set(0, 0, 0, 0) : b.translate(-(item.x || 0), -(item.y || 0));
}
- function get$3(opt, key, d) {
+ function get$1(opt, key, d) {
const v = isObject(opt) ? opt[key] : opt;
return v != null ? v : d !== undefined ? d : 0;
}
- function offsetValue(v) {
+ function offsetValue$1(v) {
return v < 0 ? Math.ceil(-v) : 0;
}
function gridLayout(view, groups, opt) {
var dirty = !opt.nodirty,
bbox = opt.bounds === Flush ? bboxFlush : bboxFull,
- bounds = tempBounds$1.set(0, 0, 0, 0),
- alignCol = get$3(opt.align, Column),
- alignRow = get$3(opt.align, Row),
- padCol = get$3(opt.padding, Column),
- padRow = get$3(opt.padding, Row),
+ bounds = tempBounds.set(0, 0, 0, 0),
+ alignCol = get$1(opt.align, Column),
+ alignRow = get$1(opt.align, Row),
+ padCol = get$1(opt.padding, Column),
+ padRow = get$1(opt.padding, Row),
ncols = opt.columns || groups.length,
nrows = ncols <= 0 ? 1 : Math.ceil(groups.length / ncols),
n = groups.length,
xOffset = Array(n),
xExtent = Array(ncols),
@@ -22140,12 +22187,12 @@
r = ~~(i / ncols);
xMax = Math.max(xMax, px = Math.ceil(b.x2));
yMax = Math.max(yMax, py = Math.ceil(b.y2));
xExtent[c] = Math.max(xExtent[c], px);
yExtent[r] = Math.max(yExtent[r], py);
- xOffset[i] = padCol + offsetValue(b.x1);
- yOffset[i] = padRow + offsetValue(b.y1);
+ xOffset[i] = padCol + offsetValue$1(b.x1);
+ yOffset[i] = padRow + offsetValue$1(b.y1);
if (dirty) view.dirty(groups[i]);
} // set initial alignment offsets
for (i = 0; i < n; ++i) {
@@ -22220,20 +22267,20 @@
dy[i] += y - groups[i].y;
}
} // perform horizontal centering
- if (alignCol && get$3(opt.center, Column) && nrows > 1) {
+ if (alignCol && get$1(opt.center, Column) && nrows > 1) {
for (i = 0; i < n; ++i) {
b = alignCol === All ? xMax : xExtent[i % ncols];
x = b - boxes[i].x2 - groups[i].x - dx[i];
if (x > 0) dx[i] += x / 2;
}
} // perform vertical centering
- if (alignRow && get$3(opt.center, Row) && ncols !== 1) {
+ if (alignRow && get$1(opt.center, Row) && ncols !== 1) {
for (i = 0; i < n; ++i) {
b = alignRow === All ? yMax : yExtent[~~(i / ncols)];
y = b - boxes[i].y2 - groups[i].y - dy[i];
if (y > 0) dy[i] += y / 2;
}
@@ -22242,28 +22289,28 @@
for (i = 0; i < n; ++i) {
bounds.union(boxes[i].translate(dx[i], dy[i]));
}
- x = get$3(opt.anchor, X);
- y = get$3(opt.anchor, Y);
+ x = get$1(opt.anchor, X);
+ y = get$1(opt.anchor, Y);
- switch (get$3(opt.anchor, Column)) {
- case End:
+ switch (get$1(opt.anchor, Column)) {
+ case End$1:
x -= bounds.width();
break;
- case Middle:
+ case Middle$1:
x -= bounds.width() / 2;
}
- switch (get$3(opt.anchor, Row)) {
- case End:
+ switch (get$1(opt.anchor, Row)) {
+ case End$1:
y -= bounds.height();
break;
- case Middle:
+ case Middle$1:
y -= bounds.height() / 2;
}
x = Math.round(x);
y = Math.round(y); // update mark positions, bounds, dirty
@@ -22305,47 +22352,47 @@
if (bounds.empty()) bounds.set(0, 0, 0, 0); // empty grid
// -- layout grid headers and footers --
// perform row header layout
if (views.rowheaders) {
- band = get$3(opt.headerBand, Row, null);
- x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$3(off, 'rowHeader'), min$2, 0, bbox, 'x1', 0, ncols, 1, band);
+ band = get$1(opt.headerBand, Row, null);
+ x = layoutHeaders(view, views.rowheaders, groups, ncols, nrows, -get$1(off, 'rowHeader'), min, 0, bbox, 'x1', 0, ncols, 1, band);
} // perform column header layout
if (views.colheaders) {
- band = get$3(opt.headerBand, Column, null);
- y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$3(off, 'columnHeader'), min$2, 1, bbox, 'y1', 0, 1, ncols, band);
+ band = get$1(opt.headerBand, Column, null);
+ y = layoutHeaders(view, views.colheaders, groups, ncols, ncols, -get$1(off, 'columnHeader'), min, 1, bbox, 'y1', 0, 1, ncols, band);
} // perform row footer layout
if (views.rowfooters) {
- band = get$3(opt.footerBand, Row, null);
- x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$3(off, 'rowFooter'), max$2, 0, bbox, 'x2', ncols - 1, ncols, 1, band);
+ band = get$1(opt.footerBand, Row, null);
+ x2 = layoutHeaders(view, views.rowfooters, groups, ncols, nrows, get$1(off, 'rowFooter'), max, 0, bbox, 'x2', ncols - 1, ncols, 1, band);
} // perform column footer layout
if (views.colfooters) {
- band = get$3(opt.footerBand, Column, null);
- y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$3(off, 'columnFooter'), max$2, 1, bbox, 'y2', cells - ncols, 1, ncols, band);
+ band = get$1(opt.footerBand, Column, null);
+ y2 = layoutHeaders(view, views.colfooters, groups, ncols, ncols, get$1(off, 'columnFooter'), max, 1, bbox, 'y2', cells - ncols, 1, ncols, band);
} // perform row title layout
if (views.rowtitle) {
- anchor = get$3(opt.titleAnchor, Row);
- offset = get$3(off, 'rowTitle');
- offset = anchor === End ? x2 + offset : x - offset;
- band = get$3(opt.titleBand, Row, 0.5);
+ anchor = get$1(opt.titleAnchor, Row);
+ offset = get$1(off, 'rowTitle');
+ offset = anchor === End$1 ? x2 + offset : x - offset;
+ band = get$1(opt.titleBand, Row, 0.5);
layoutTitle(view, views.rowtitle, offset, 0, bounds, band);
} // perform column title layout
if (views.coltitle) {
- anchor = get$3(opt.titleAnchor, Column);
- offset = get$3(off, 'columnTitle');
- offset = anchor === End ? y2 + offset : y - offset;
- band = get$3(opt.titleBand, Column, 0.5);
+ anchor = get$1(opt.titleAnchor, Column);
+ offset = get$1(off, 'columnTitle');
+ offset = anchor === End$1 ? y2 + offset : y - offset;
+ band = get$1(opt.titleBand, Column, 0.5);
layoutTitle(view, views.coltitle, offset, 1, bounds, band);
}
}
function boundFlush(item, field) {
@@ -22434,11 +22481,11 @@
g.y = y; // queue title for redraw
view.dirty(g);
}
- function lookup$1$1(config, orient) {
+ function lookup$3(config, orient) {
const opt = config[orient] || {};
return (key, d) => opt[key] != null ? opt[key] : config[key] != null ? config[key] : d;
} // if legends specify offset directly, use the maximum specified value
@@ -22449,14 +22496,14 @@
});
return max > -Infinity ? max : value;
}
function legendParams(g, orient, config, xb, yb, w, h) {
- const _ = lookup$1$1(config, orient),
+ const _ = lookup$3(config, orient),
offset = offsets(g, _('offset', 0)),
- anchor = _('anchor', Start),
- mult = anchor === End ? 1 : anchor === Middle ? 0.5 : 0;
+ anchor = _('anchor', Start$1),
+ mult = anchor === End$1 ? 1 : anchor === Middle$1 ? 0.5 : 0;
const p = {
align: Each,
bounds: _('bounds', Flush),
columns: _('direction') === 'vertical' ? 1 : g.length,
@@ -22464,37 +22511,37 @@
center: _('center'),
nodirty: true
};
switch (orient) {
- case Left:
+ case Left$1:
p.anchor = {
x: Math.floor(xb.x1) - offset,
- column: End,
+ column: End$1,
y: mult * (h || xb.height() + 2 * xb.y1),
row: anchor
};
break;
- case Right:
+ case Right$1:
p.anchor = {
x: Math.ceil(xb.x2) + offset,
y: mult * (h || xb.height() + 2 * xb.y1),
row: anchor
};
break;
- case Top:
+ case Top$1:
p.anchor = {
y: Math.floor(yb.y1) - offset,
- row: End,
+ row: End$1,
x: mult * (w || yb.width() + 2 * yb.x1),
column: anchor
};
break;
- case Bottom:
+ case Bottom$1:
p.anchor = {
y: Math.ceil(yb.y2) + offset,
x: mult * (w || yb.width() + 2 * yb.x1),
column: anchor
};
@@ -22509,28 +22556,28 @@
case TopRight:
p.anchor = {
x: w - offset,
y: offset,
- column: End
+ column: End$1
};
break;
case BottomLeft:
p.anchor = {
x: offset,
y: h - offset,
- row: End
+ row: End$1
};
break;
case BottomRight:
p.anchor = {
x: w - offset,
y: h - offset,
- column: End,
- row: End
+ column: End$1,
+ row: End$1
};
break;
}
return p;
@@ -22558,15 +22605,15 @@
if (!bounds.empty()) {
w = Math.ceil(bounds.width() + w);
h = Math.ceil(bounds.height() + h);
}
- if (datum.type === Symbols) {
+ if (datum.type === Symbols$1) {
legendEntryLayout(item.items[0].items[0].items[0].items);
}
- if (orient !== None$2) {
+ if (orient !== None) {
item.x = x = 0;
item.y = y = 0;
}
item.width = w;
@@ -22589,57 +22636,57 @@
var pad = item.padding,
ex = pad - entry.x,
ey = pad - entry.y;
if (!item.datum.title) {
- if (ex || ey) translate$1(view, entry, ex, ey);
+ if (ex || ey) translate(view, entry, ex, ey);
} else {
var title = item.items[1].items[0],
anchor = title.anchor,
tpad = item.titlePadding || 0,
tx = pad - title.x,
ty = pad - title.y;
switch (title.orient) {
- case Left:
+ case Left$1:
ex += Math.ceil(title.bounds.width()) + tpad;
break;
- case Right:
- case Bottom:
+ case Right$1:
+ case Bottom$1:
break;
default:
ey += title.bounds.height() + tpad;
}
- if (ex || ey) translate$1(view, entry, ex, ey);
+ if (ex || ey) translate(view, entry, ex, ey);
switch (title.orient) {
- case Left:
+ case Left$1:
ty += legendTitleOffset(item, entry, title, anchor, 1, 1);
break;
- case Right:
- tx += legendTitleOffset(item, entry, title, End, 0, 0) + tpad;
+ case Right$1:
+ tx += legendTitleOffset(item, entry, title, End$1, 0, 0) + tpad;
ty += legendTitleOffset(item, entry, title, anchor, 1, 1);
break;
- case Bottom:
+ case Bottom$1:
tx += legendTitleOffset(item, entry, title, anchor, 0, 0);
- ty += legendTitleOffset(item, entry, title, End, -1, 0, 1) + tpad;
+ ty += legendTitleOffset(item, entry, title, End$1, -1, 0, 1) + tpad;
break;
default:
tx += legendTitleOffset(item, entry, title, anchor, 0, 0);
}
- if (tx || ty) translate$1(view, title, tx, ty); // translate legend if title pushes into negative coordinates
+ if (tx || ty) translate(view, title, tx, ty); // translate legend if title pushes into negative coordinates
if ((tx = Math.round(title.bounds.x1 - pad)) < 0) {
- translate$1(view, entry, -tx, 0);
- translate$1(view, title, -tx, 0);
+ translate(view, entry, -tx, 0);
+ translate(view, title, -tx, 0);
}
}
}
function legendTitleOffset(item, entry, title, anchor, y, lr, noBar) {
@@ -22648,14 +22695,14 @@
e = grad && (lr || !vgrad) && !noBar ? entry.items[0] : entry,
s = e.bounds[y ? 'y2' : 'x2'] - item.padding,
u = vgrad && lr ? s : 0,
v = vgrad && lr ? 0 : s,
o = y <= 0 ? 0 : multiLineOffset(title);
- return Math.round(anchor === Start ? u : anchor === End ? v - o : 0.5 * (s - o));
+ return Math.round(anchor === Start$1 ? u : anchor === End$1 ? v - o : 0.5 * (s - o));
}
- function translate$1(view, item, dx, dy) {
+ function translate(view, item, dx, dy) {
item.x += dx;
item.y += dy;
item.bounds.translate(dx, dy);
item.mark.bounds.translate(dx, dy);
view.dirty(item);
@@ -22681,91 +22728,91 @@
anchor = group.anchor,
offset = group.offset,
padding = group.padding,
title = group.items[0].items[0],
subtitle = group.items[1] && group.items[1].items[0],
- end = orient === Left || orient === Right ? height : width,
+ end = orient === Left$1 || orient === Right$1 ? height : width,
start = 0,
x = 0,
y = 0,
sx = 0,
sy = 0,
pos;
if (frame !== Group) {
- orient === Left ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2);
- } else if (orient === Left) {
+ orient === Left$1 ? (start = viewBounds.y2, end = viewBounds.y1) : orient === Right$1 ? (start = viewBounds.y1, end = viewBounds.y2) : (start = viewBounds.x1, end = viewBounds.x2);
+ } else if (orient === Left$1) {
start = height, end = 0;
}
- pos = anchor === Start ? start : anchor === End ? end : (start + end) / 2;
+ pos = anchor === Start$1 ? start : anchor === End$1 ? end : (start + end) / 2;
if (subtitle && subtitle.text) {
// position subtitle
switch (orient) {
- case Top:
- case Bottom:
+ case Top$1:
+ case Bottom$1:
sy = title.bounds.height() + padding;
break;
- case Left:
+ case Left$1:
sx = title.bounds.width() + padding;
break;
- case Right:
+ case Right$1:
sx = -title.bounds.width() - padding;
break;
}
- tempBounds$1.clear().union(subtitle.bounds);
- tempBounds$1.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0));
+ tempBounds.clear().union(subtitle.bounds);
+ tempBounds.translate(sx - (subtitle.x || 0), sy - (subtitle.y || 0));
- if (set$1(subtitle, 'x', sx) | set$1(subtitle, 'y', sy)) {
+ if (set$2(subtitle, 'x', sx) | set$2(subtitle, 'y', sy)) {
view.dirty(subtitle);
- subtitle.bounds.clear().union(tempBounds$1);
- subtitle.mark.bounds.clear().union(tempBounds$1);
+ subtitle.bounds.clear().union(tempBounds);
+ subtitle.mark.bounds.clear().union(tempBounds);
view.dirty(subtitle);
}
- tempBounds$1.clear().union(subtitle.bounds);
+ tempBounds.clear().union(subtitle.bounds);
} else {
- tempBounds$1.clear();
+ tempBounds.clear();
}
- tempBounds$1.union(title.bounds); // position title group
+ tempBounds.union(title.bounds); // position title group
switch (orient) {
- case Top:
+ case Top$1:
x = pos;
- y = viewBounds.y1 - tempBounds$1.height() - offset;
+ y = viewBounds.y1 - tempBounds.height() - offset;
break;
- case Left:
- x = viewBounds.x1 - tempBounds$1.width() - offset;
+ case Left$1:
+ x = viewBounds.x1 - tempBounds.width() - offset;
y = pos;
break;
- case Right:
- x = viewBounds.x2 + tempBounds$1.width() + offset;
+ case Right$1:
+ x = viewBounds.x2 + tempBounds.width() + offset;
y = pos;
break;
- case Bottom:
+ case Bottom$1:
x = pos;
y = viewBounds.y2 + offset;
break;
default:
x = group.x;
y = group.y;
}
- if (set$1(group, 'x', x) | set$1(group, 'y', y)) {
- tempBounds$1.translate(x, y);
+ if (set$2(group, 'x', x) | set$2(group, 'y', y)) {
+ tempBounds.translate(x, y);
view.dirty(group);
- group.bounds.clear().union(tempBounds$1);
- mark.bounds.clear().union(tempBounds$1);
+ group.bounds.clear().union(tempBounds);
+ mark.bounds.clear().union(tempBounds);
view.dirty(group);
}
return group.bounds;
}
@@ -22776,15 +22823,15 @@
* @param {object} params - The parameters for this operator.
* @param {object} params.mark - Scenegraph mark of groups to layout.
*/
- function ViewLayout(params) {
+ function ViewLayout$1(params) {
Transform.call(this, null, params);
}
- inherits(ViewLayout, Transform, {
+ inherits(ViewLayout$1, Transform, {
transform(_, pulse) {
const view = pulse.dataflow;
_.mark.items.forEach(group => {
if (_.layout) trellisLayout(view, group, _.layout);
@@ -22822,25 +22869,25 @@
for (i = 0, n = items.length; i < n; ++i) {
mark = items[i];
switch (mark.role) {
- case AxisRole:
+ case AxisRole$1:
b = isYAxis(mark) ? xBounds : yBounds;
b.union(axisLayout(view, mark, width, height));
break;
- case TitleRole:
+ case TitleRole$1:
title = mark;
break;
- case LegendRole:
+ case LegendRole$1:
legends.push(legendLayout(view, mark));
break;
- case FrameRole:
- case ScopeRole:
+ case FrameRole$1:
+ case ScopeRole$1:
case RowHeader:
case RowFooter:
case RowTitle:
case ColHeader:
case ColFooter:
@@ -22857,12 +22904,12 @@
if (legends.length) {
// group legends by orient
const l = {};
legends.forEach(item => {
- orient = item.orient || Right;
- if (orient !== None$2) (l[orient] || (l[orient] = [])).push(item);
+ orient = item.orient || Right$1;
+ if (orient !== None) (l[orient] || (l[orient] = [])).push(item);
}); // perform grid layout for each orient group
for (const orient in l) {
const g = l[orient];
gridLayout(view, g, legendParams(g, orient, _.legends, xBounds, yBounds, width, height));
@@ -22883,17 +22930,17 @@
if (_.autosize && _.autosize.type === Fit) {
// For autosize fit, incorporate the orthogonal dimension only.
// Legends that overrun the chart area will then be clipped;
// otherwise the chart area gets reduced to nothing!
switch (item.orient) {
- case Left:
- case Right:
+ case Left$1:
+ case Right$1:
viewBounds.add(b.x1, 0).add(b.x2, 0);
break;
- case Top:
- case Bottom:
+ case Top$1:
+ case Bottom$1:
viewBounds.add(0, b.y1).add(0, b.y2);
}
} else {
viewBounds.union(b);
}
@@ -22927,17 +22974,17 @@
height = Math.max(0, group.height || 0),
top = Math.max(0, Math.ceil(-viewBounds.y1));
const right = Math.max(0, Math.ceil(viewBounds.x2 - width)),
bottom = Math.max(0, Math.ceil(viewBounds.y2 - height));
- if (auto.contains === Padding) {
+ if (auto.contains === Padding$1) {
const padding = view.padding();
viewWidth -= padding.left + padding.right;
viewHeight -= padding.top + padding.bottom;
}
- if (type === None$2) {
+ if (type === None) {
left = 0;
top = 0;
width = viewWidth;
height = viewHeight;
} else if (type === Fit) {
@@ -22957,16 +23004,16 @@
view._resizeView(viewWidth, viewHeight, width, height, [left, top], auto.resize);
}
var vtx = /*#__PURE__*/Object.freeze({
__proto__: null,
- bound: Bound,
- identifier: Identifier,
- mark: Mark,
- overlap: Overlap,
- render: Render,
- viewlayout: ViewLayout
+ bound: Bound$1,
+ identifier: Identifier$1,
+ mark: Mark$1,
+ overlap: Overlap$1,
+ render: Render$1,
+ viewlayout: ViewLayout$1
});
/**
* Generates axis ticks for visualizing a spatial scale.
* @constructor
@@ -22982,15 +23029,15 @@
* any valid d3 4.0 format specifier.
* @param {function(*):string} [params.format] - The format function to use.
* If provided, the formatSpecifier argument is ignored.
*/
- function AxisTicks(params) {
+ function AxisTicks$1(params) {
Transform.call(this, null, params);
}
- inherits(AxisTicks, Transform, {
+ inherits(AxisTicks$1, Transform, {
transform(_, pulse) {
if (this.value && !_.modified()) {
return pulse.StopPropagation;
}
@@ -22998,23 +23045,23 @@
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
ticks = this.value,
scale = _.scale,
tally = _.count == null ? _.values ? _.values.length : 10 : _.count,
count = tickCount(scale, tally, _.minstep),
- format = _.format || tickFormat$1(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),
+ format = _.format || tickFormat(locale, scale, count, _.formatSpecifier, _.formatType, !!_.values),
values = _.values ? validTicks(scale, _.values, count) : tickValues(scale, count);
if (ticks) out.rem = ticks;
- ticks = values.map((value, i) => ingest({
+ ticks = values.map((value, i) => ingest$1({
index: i / (values.length - 1 || 1),
value: value,
label: format(value)
}));
if (_.extra && ticks.length) {
// add an extra tick pegged to the initial domain value
// this is used to generate axes with 'binned' domains
- ticks.push(ingest({
+ ticks.push(ingest$1({
index: -1,
extra: {
value: ticks[0].value
},
label: ''
@@ -23034,27 +23081,27 @@
* @param {object} params - The parameters for this operator.
* @param {function(object): object} [params.item] - An item generator function.
* @param {function(object): *} [params.key] - The key field associating data and visual items.
*/
- function DataJoin(params) {
+ function DataJoin$1(params) {
Transform.call(this, null, params);
}
function defaultItemCreate() {
- return ingest({});
+ return ingest$1({});
}
function newMap(key) {
const map = fastmap().test(t => t.exit);
map.lookup = t => map.get(key(t));
return map;
}
- inherits(DataJoin, Transform, {
+ inherits(DataJoin$1, Transform, {
transform(_, pulse) {
var df = pulse.dataflow,
out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
item = _.item || defaultItemCreate,
key = _.key || tupleid,
@@ -23134,15 +23181,15 @@
* @param {function(object, object): boolean} [param.encoders.update] - Update encoding set
* @param {function(object, object): boolean} [param.encoders.enter] - Enter encoding set
* @param {function(object, object): boolean} [param.encoders.exit] - Exit encoding set
*/
- function Encode(params) {
+ function Encode$1(params) {
Transform.call(this, null, params);
}
- inherits(Encode, Transform, {
+ inherits(Encode$1, Transform, {
transform(_, pulse) {
var out = pulse.fork(pulse.ADD_REM),
fmod = _.mod || false,
encoders = _.encoders,
encode = pulse.encode; // if an array, the encode directive includes additional sets
@@ -23227,15 +23274,15 @@
* any valid D3 format specifier string.
* @param {function(*):string} [params.format] - The format function to use.
* If provided, the formatSpecifier argument is ignored.
*/
- function LegendEntries(params) {
+ function LegendEntries$1(params) {
Transform.call(this, [], params);
}
- inherits(LegendEntries, Transform, {
+ inherits(LegendEntries$1, Transform, {
transform(_, pulse) {
if (this.value != null && !_.modified()) {
return pulse.StopPropagation;
}
@@ -23272,49 +23319,49 @@
} // compute size offset for legend entries
offset = items.reduce((max, value) => Math.max(max, size(value, _)), 0);
} else {
- size = constant(offset = size || 8);
+ size = constant$4(offset = size || 8);
}
- items = items.map((value, index) => ingest({
+ items = items.map((value, index) => ingest$1({
index: index,
label: format(value, index, items),
value: value,
offset: offset,
size: size(value, _)
}));
if (ellipsis) {
ellipsis = values[items.length];
- items.push(ingest({
+ items.push(ingest$1({
index: items.length,
- label: "\u2026".concat(values.length - items.length, " entries"),
+ label: `\u2026${values.length - items.length} entries`,
value: ellipsis,
offset: offset,
size: size(ellipsis, _)
}));
}
} else if (type === GradientLegend) {
- domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek(domain)); // if automatic label generation produces 2 or fewer values,
+ domain = scale.domain(), fraction = scaleFraction(scale, domain[0], peek$1(domain)); // if automatic label generation produces 2 or fewer values,
// use the domain end points instead (fixes vega/vega#1364)
- if (values.length < 3 && !_.values && domain[0] !== peek(domain)) {
- values = [domain[0], peek(domain)];
+ if (values.length < 3 && !_.values && domain[0] !== peek$1(domain)) {
+ values = [domain[0], peek$1(domain)];
}
- items = values.map((value, index) => ingest({
+ items = values.map((value, index) => ingest$1({
index: index,
label: format(value, index, values),
value: value,
perc: fraction(value)
}));
} else {
size = values.length - 1;
fraction = labelFraction(scale);
- items = values.map((value, index) => ingest({
+ items = values.map((value, index) => ingest$1({
index: index,
label: format(value, index, values),
value: value,
perc: index ? fraction(value) : 0,
perc2: index === size ? 1 : fraction(values[index + 1])
@@ -23408,23 +23455,23 @@
return pulse.reflow(_.modified()).modifies(as);
}
});
- const line$3 = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;
+ const line = (sx, sy, tx, ty) => 'M' + sx + ',' + sy + 'L' + tx + ',' + ty;
- const lineR = (sa, sr, ta, tr) => line$3(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
+ const lineR = (sa, sr, ta, tr) => line(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
- const arc$3 = (sx, sy, tx, ty) => {
+ const arc = (sx, sy, tx, ty) => {
var dx = tx - sx,
dy = ty - sy,
rr = Math.sqrt(dx * dx + dy * dy) / 2,
ra = 180 * Math.atan2(dy, dx) / Math.PI;
return 'M' + sx + ',' + sy + 'A' + rr + ',' + rr + ' ' + ra + ' 0 1' + ' ' + tx + ',' + ty;
};
- const arcR = (sa, sr, ta, tr) => arc$3(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
+ const arcR = (sa, sr, ta, tr) => arc(sr * Math.cos(sa), sr * Math.sin(sa), tr * Math.cos(ta), tr * Math.sin(ta));
const curve = (sx, sy, tx, ty) => {
const dx = tx - sx,
dy = ty - sy,
ix = 0.2 * (dx + dy),
@@ -23465,13 +23512,13 @@
mr = (sr + tr) / 2;
return 'M' + sr * sc + ',' + sr * ss + 'C' + mr * sc + ',' + mr * ss + ' ' + mr * tc + ',' + mr * ts + ' ' + tr * tc + ',' + tr * ts;
};
const Paths = fastmap({
- 'line': line$3,
+ 'line': line,
'line-radial': lineR,
- 'arc': arc$3,
+ 'arc': arc,
'arc-radial': arcR,
'curve': curve,
'curve-radial': curveR,
'orthogonal-horizontal': orthoX,
'orthogonal-vertical': orthoY,
@@ -23525,19 +23572,19 @@
inherits(Pie, Transform, {
transform(_, pulse) {
var as = _.as || ['startAngle', 'endAngle'],
startAngle = as[0],
endAngle = as[1],
- field = _.field || one,
+ field = _.field || one$2,
start = _.startAngle || 0,
stop = _.endAngle != null ? _.endAngle : 2 * Math.PI,
data = pulse.source,
values = data.map(field),
n = values.length,
a = start,
k = (stop - start) / sum(values),
- index = range$1(n),
+ index = range$1$1(n),
i,
t,
v;
if (_.sort) {
@@ -23558,40 +23605,40 @@
});
const DEFAULT_COUNT = 5;
function includeZero(scale) {
const type = scale.type;
- return !scale.bins && (type === Linear$1 || type === Pow || type === Sqrt);
+ return !scale.bins && (type === Linear || type === Pow || type === Sqrt);
}
function includePad(type) {
return isContinuous(type) && type !== Sequential;
}
- const SKIP$2 = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);
+ const SKIP$1 = toSet(['set', 'modified', 'clear', 'type', 'scheme', 'schemeExtent', 'schemeCount', 'domain', 'domainMin', 'domainMid', 'domainMax', 'domainRaw', 'domainImplicit', 'nice', 'zero', 'bins', 'range', 'rangeStep', 'round', 'reverse', 'interpolate', 'interpolateGamma']);
/**
* Maintains a scale function mapping data values to visual channels.
* @constructor
* @param {object} params - The parameters for this operator.
*/
- function Scale(params) {
+ function Scale$1(params) {
Transform.call(this, null, params);
this.modified(true); // always treat as modified
}
- inherits(Scale, Transform, {
+ inherits(Scale$1, Transform, {
transform(_, pulse) {
var df = pulse.dataflow,
scale$1 = this.value,
key = scaleKey(_);
if (!scale$1 || key !== scale$1.type) {
- this.value = scale$1 = scale(key)();
+ this.value = scale$1 = scale$4(key)();
}
- for (key in _) if (!SKIP$2[key]) {
+ for (key in _) if (!SKIP$1[key]) {
// padding is a scale property for band/point but not others
if (key === 'padding' && includePad(scale$1.type)) continue; // invoke scale property setter, raise warning if not found
isFunction(scale$1[key]) ? scale$1[key](_[key]) : df.warn('Unsupported scale property: ' + key);
}
@@ -23605,18 +23652,18 @@
function scaleKey(_) {
var t = _.type,
d = '',
n; // backwards compatibility pre Vega 5.
- if (t === Sequential) return Sequential + '-' + Linear$1;
+ if (t === Sequential) return Sequential + '-' + Linear;
if (isContinuousColor(_)) {
n = _.rawDomain ? _.rawDomain.length : _.domain ? _.domain.length + +(_.domainMid != null) : 0;
d = n === 2 ? Sequential + '-' : n === 3 ? Diverging + '-' : '';
}
- return (d + t || Linear$1).toLowerCase();
+ return (d + t || Linear).toLowerCase();
}
function isContinuousColor(_) {
const t = _.type;
return isContinuous(t) && t !== Time && t !== UTC && (_.scheme || _.range && _.range.length && _.range.every(isString));
@@ -23631,11 +23678,11 @@
zero = _.zero || _.zero === undefined && includeZero(scale),
n,
mid;
if (!domain) return 0; // adjust continuous domain for minimum pixel padding
- if (includePad(type) && _.padding && domain[0] !== peek(domain)) {
+ if (includePad(type) && _.padding && domain[0] !== peek$1(domain)) {
domain = padDomain(type, domain, _.range, _.padding, _.exponent, _.constant);
} // adjust domain based on zero, min, max settings
if (zero || _.domainMin != null || _.domainMax != null || _.domainMid != null) {
@@ -23682,11 +23729,11 @@
return -1;
}
}
function padDomain(type, domain, range, pad, exponent, constant) {
- var span = Math.abs(peek(range) - range[0]),
+ var span = Math.abs(peek$1(range) - range[0]),
frac = span / (span - 2 * pad),
d = type === Log ? zoomLog(domain, null, frac) : type === Sqrt ? zoomPow(domain, null, frac, 0.5) : type === Pow ? zoomPow(domain, null, frac, exponent || 1) : type === Symlog ? zoomSymlog(domain, null, frac, constant || 1) : zoomLinear(domain, null, frac);
domain = domain.slice();
domain[0] = d[0];
domain[domain.length - 1] = d[1];
@@ -23712,18 +23759,18 @@
if (bins && !isArray(bins)) {
// generate bin boundary array
const domain = scale.domain(),
lo = domain[0],
- hi = peek(domain),
+ hi = peek$1(domain),
step = bins.step;
let start = bins.start == null ? lo : bins.start,
stop = bins.stop == null ? hi : bins.stop;
if (!step) error('Scale bins parameter missing step property.');
if (start < lo) start = step * Math.ceil(lo / step);
if (stop > hi) stop = step * Math.floor(hi / step);
- bins = range$1(start, stop + step / 2, step);
+ bins = range$1$1(start, stop + step / 2, step);
}
if (bins) {
// assign bin boundaries to scale instance
scale.bins = bins;
@@ -23755,20 +23802,20 @@
if (_.rangeStep != null) {
range = configureRangeStep(type, _, count);
} // else if a range scheme is defined, use that
else if (_.scheme) {
- range = configureScheme(type, _, count);
+ range = configureScheme(type, _, count);
- if (isFunction(range)) {
- if (scale.interpolator) {
- return scale.interpolator(range);
- } else {
- error("Scale type ".concat(type, " does not support interpolating color schemes."));
- }
+ if (isFunction(range)) {
+ if (scale.interpolator) {
+ return scale.interpolator(range);
+ } else {
+ error(`Scale type ${type} does not support interpolating color schemes.`);
}
- } // given a range array for an interpolating scale, convert to interpolator
+ }
+ } // given a range array for an interpolating scale, convert to interpolator
if (range && isInterpolating(type)) {
return scale.interpolator(interpolateColors(flip(range, _.reverse), _.interpolate, _.interpolateGamma));
} // configure rounding / interpolation
@@ -23804,15 +23851,15 @@
if (isArray(_.scheme)) {
scheme$1 = interpolateColors(_.scheme, _.interpolate, _.interpolateGamma);
} else {
name = _.scheme.toLowerCase();
scheme$1 = scheme(name);
- if (!scheme$1) error("Unrecognized scheme name: ".concat(_.scheme));
+ if (!scheme$1) error(`Unrecognized scheme name: ${_.scheme}`);
} // determine size for potential discrete range
- count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile$1 || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate
+ count = type === Threshold ? count + 1 : type === BinOrdinal ? count - 1 : type === Quantile || type === Quantize ? +_.schemeCount || DEFAULT_COUNT : count; // adjust and/or quantize scheme as appropriate
return isInterpolating(type) ? adjustScheme(scheme$1, extent, _.reverse) : isFunction(scheme$1) ? quantizeInterpolator(adjustScheme(scheme$1, extent), count) : type === Ordinal ? scheme$1 : scheme$1.slice(0, count);
}
function adjustScheme(scheme, extent, reverse) {
@@ -23829,25 +23876,25 @@
* @param {function(*,*): number} [params.sort] - A comparator
* function for sorting tuples.
*/
- function SortItems(params) {
+ function SortItems$1(params) {
Transform.call(this, null, params);
}
- inherits(SortItems, Transform, {
+ inherits(SortItems$1, Transform, {
transform(_, pulse) {
const mod = _.modified('sort') || pulse.changed(pulse.ADD) || pulse.modified(_.sort.fields) || pulse.modified('datum');
if (mod) pulse.source.sort(stableCompare(_.sort));
this.modified(mod);
return pulse;
}
});
const Zero = 'zero',
- Center = 'center',
+ Center$1 = 'center',
Normalize = 'normalize',
DefOutput = ['y0', 'y1'];
/**
* Stack layout for visualization elements.
* @constructor
@@ -23879,11 +23926,11 @@
'type': 'compare'
}, {
'name': 'offset',
'type': 'enum',
'default': Zero,
- 'values': [Zero, Center, Normalize]
+ 'values': [Zero, Center$1, Normalize]
}, {
'name': 'as',
'type': 'string',
'array': true,
'length': 2,
@@ -23894,18 +23941,18 @@
transform(_, pulse) {
var as = _.as || DefOutput,
y0 = as[0],
y1 = as[1],
sort = stableCompare(_.sort),
- field = _.field || one,
- stack = _.offset === Center ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
+ field = _.field || one$2,
+ stack = _.offset === Center$1 ? stackCenter : _.offset === Normalize ? stackNormalize : stackZero,
groups,
i,
n,
max; // partition, sum, and sort the stack groups
- groups = partition$2(pulse.source, _.groupby, sort, field); // compute stack layouts per group
+ groups = partition$3(pulse.source, _.groupby, sort, field); // compute stack layouts per group
for (i = 0, n = groups.length, max = groups.max; i < n; ++i) {
stack(groups[i], max, field, y0, y1);
}
@@ -23962,11 +24009,11 @@
t[y1] = lastPos += v;
}
}
}
- function partition$2(data, groupby, sort, field) {
+ function partition$3(data, groupby, sort, field) {
var groups = [],
get = f => f(t),
map,
i,
n,
@@ -24010,48 +24057,48 @@
groups.max = max;
return groups;
}
- var encode = /*#__PURE__*/Object.freeze({
+ var encode$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
- axisticks: AxisTicks,
- datajoin: DataJoin,
- encode: Encode,
- legendentries: LegendEntries,
+ axisticks: AxisTicks$1,
+ datajoin: DataJoin$1,
+ encode: Encode$1,
+ legendentries: LegendEntries$1,
linkpath: LinkPath,
pie: Pie,
- scale: Scale,
- sortitems: SortItems,
+ scale: Scale$1,
+ sortitems: SortItems$1,
stack: Stack
});
- var epsilon$3 = 1e-6;
- var epsilon2$1 = 1e-12;
- var pi$2 = Math.PI;
- var halfPi$1 = pi$2 / 2;
- var quarterPi = pi$2 / 4;
- var tau$2 = pi$2 * 2;
- var degrees$2 = 180 / pi$2;
- var radians$1 = pi$2 / 180;
+ var epsilon$2 = 1e-6;
+ var epsilon2 = 1e-12;
+ var pi$1 = Math.PI;
+ var halfPi$1 = pi$1 / 2;
+ var quarterPi = pi$1 / 4;
+ var tau$1 = pi$1 * 2;
+ var degrees = 180 / pi$1;
+ var radians = pi$1 / 180;
var abs$1 = Math.abs;
var atan = Math.atan;
- var atan2$1 = Math.atan2;
+ var atan2 = Math.atan2;
var cos$1 = Math.cos;
var ceil = Math.ceil;
- var exp$2 = Math.exp;
+ var exp = Math.exp;
var hypot = Math.hypot;
- var log$4 = Math.log;
- var pow$3 = Math.pow;
+ var log$1 = Math.log;
+ var pow$1 = Math.pow;
var sin$1 = Math.sin;
- var sign$1 = Math.sign || function (x) {
+ var sign = Math.sign || function (x) {
return x > 0 ? 1 : x < 0 ? -1 : 0;
};
- var sqrt$2 = Math.sqrt;
+ var sqrt$1 = Math.sqrt;
var tan = Math.tan;
- function acos$1(x) {
- return x > 1 ? 0 : x < -1 ? pi$2 : Math.acos(x);
+ function acos(x) {
+ return x > 1 ? 0 : x < -1 ? pi$1 : Math.acos(x);
}
function asin$1(x) {
return x > 1 ? halfPi$1 : x < -1 ? -halfPi$1 : Math.asin(x);
}
@@ -24146,80 +24193,80 @@
} else {
streamGeometry(object, stream);
}
}
- var areaRingSum = new Adder(); // hello?
+ var areaRingSum$1 = new Adder(); // hello?
- var areaSum = new Adder(),
- lambda00,
- phi00,
- lambda0,
+ var areaSum$1 = new Adder(),
+ lambda00$2,
+ phi00$2,
+ lambda0$1,
cosPhi0,
sinPhi0;
- var areaStream = {
+ var areaStream$1 = {
point: noop$2,
lineStart: noop$2,
lineEnd: noop$2,
polygonStart: function () {
- areaRingSum = new Adder();
- areaStream.lineStart = areaRingStart;
- areaStream.lineEnd = areaRingEnd;
+ areaRingSum$1 = new Adder();
+ areaStream$1.lineStart = areaRingStart$1;
+ areaStream$1.lineEnd = areaRingEnd$1;
},
polygonEnd: function () {
- var areaRing = +areaRingSum;
- areaSum.add(areaRing < 0 ? tau$2 + areaRing : areaRing);
+ var areaRing = +areaRingSum$1;
+ areaSum$1.add(areaRing < 0 ? tau$1 + areaRing : areaRing);
this.lineStart = this.lineEnd = this.point = noop$2;
},
sphere: function () {
- areaSum.add(tau$2);
+ areaSum$1.add(tau$1);
}
};
- function areaRingStart() {
- areaStream.point = areaPointFirst;
+ function areaRingStart$1() {
+ areaStream$1.point = areaPointFirst$1;
}
- function areaRingEnd() {
- areaPoint(lambda00, phi00);
+ function areaRingEnd$1() {
+ areaPoint$1(lambda00$2, phi00$2);
}
- function areaPointFirst(lambda, phi) {
- areaStream.point = areaPoint;
- lambda00 = lambda, phi00 = phi;
- lambda *= radians$1, phi *= radians$1;
- lambda0 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi);
+ function areaPointFirst$1(lambda, phi) {
+ areaStream$1.point = areaPoint$1;
+ lambda00$2 = lambda, phi00$2 = phi;
+ lambda *= radians, phi *= radians;
+ lambda0$1 = lambda, cosPhi0 = cos$1(phi = phi / 2 + quarterPi), sinPhi0 = sin$1(phi);
}
- function areaPoint(lambda, phi) {
- lambda *= radians$1, phi *= radians$1;
+ function areaPoint$1(lambda, phi) {
+ lambda *= radians, phi *= radians;
phi = phi / 2 + quarterPi; // half the angular distance from south pole
// Spherical excess E for a spherical triangle with vertices: south pole,
// previous point, current point. Uses a formula derived from Cagnoli’s
// theorem. See Todhunter, Spherical Trig. (1871), Sec. 103, Eq. (2).
- var dLambda = lambda - lambda0,
+ var dLambda = lambda - lambda0$1,
sdLambda = dLambda >= 0 ? 1 : -1,
adLambda = sdLambda * dLambda,
cosPhi = cos$1(phi),
sinPhi = sin$1(phi),
k = sinPhi0 * sinPhi,
u = cosPhi0 * cosPhi + k * cos$1(adLambda),
v = k * sdLambda * sin$1(adLambda);
- areaRingSum.add(atan2$1(v, u)); // Advance the previous points.
+ areaRingSum$1.add(atan2(v, u)); // Advance the previous points.
- lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
+ lambda0$1 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
}
function geoArea$1 (object) {
- areaSum = new Adder();
- geoStream(object, areaStream);
- return areaSum * 2;
+ areaSum$1 = new Adder();
+ geoStream(object, areaStream$1);
+ return areaSum$1 * 2;
}
function spherical(cartesian) {
- return [atan2$1(cartesian[1], cartesian[0]), asin$1(cartesian[2])];
+ return [atan2(cartesian[1], cartesian[0]), asin$1(cartesian[2])];
}
function cartesian(spherical) {
var lambda = spherical[0],
phi = spherical[1],
cosPhi = cos$1(phi);
@@ -24238,109 +24285,109 @@
function cartesianScale(vector, k) {
return [vector[0] * k, vector[1] * k, vector[2] * k];
} // TODO return d
function cartesianNormalizeInPlace(d) {
- var l = sqrt$2(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
+ var l = sqrt$1(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
d[0] /= l, d[1] /= l, d[2] /= l;
}
- var lambda0$1, phi0, lambda1, phi1, // bounds
+ var lambda0, phi0, lambda1, phi1, // bounds
lambda2, // previous lambda-coordinate
lambda00$1, phi00$1, // first point
p0, // previous 3D point
- deltaSum, ranges, range;
- var boundsStream = {
- point: boundsPoint,
+ deltaSum, ranges, range$2;
+ var boundsStream$2 = {
+ point: boundsPoint$1,
lineStart: boundsLineStart,
lineEnd: boundsLineEnd,
polygonStart: function () {
- boundsStream.point = boundsRingPoint;
- boundsStream.lineStart = boundsRingStart;
- boundsStream.lineEnd = boundsRingEnd;
+ boundsStream$2.point = boundsRingPoint;
+ boundsStream$2.lineStart = boundsRingStart;
+ boundsStream$2.lineEnd = boundsRingEnd;
deltaSum = new Adder();
- areaStream.polygonStart();
+ areaStream$1.polygonStart();
},
polygonEnd: function () {
- areaStream.polygonEnd();
- boundsStream.point = boundsPoint;
- boundsStream.lineStart = boundsLineStart;
- boundsStream.lineEnd = boundsLineEnd;
- if (areaRingSum < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon$3) phi1 = 90;else if (deltaSum < -epsilon$3) phi0 = -90;
- range[0] = lambda0$1, range[1] = lambda1;
+ areaStream$1.polygonEnd();
+ boundsStream$2.point = boundsPoint$1;
+ boundsStream$2.lineStart = boundsLineStart;
+ boundsStream$2.lineEnd = boundsLineEnd;
+ if (areaRingSum$1 < 0) lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);else if (deltaSum > epsilon$2) phi1 = 90;else if (deltaSum < -epsilon$2) phi0 = -90;
+ range$2[0] = lambda0, range$2[1] = lambda1;
},
sphere: function () {
- lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);
+ lambda0 = -(lambda1 = 180), phi0 = -(phi1 = 90);
}
};
- function boundsPoint(lambda, phi) {
- ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);
+ function boundsPoint$1(lambda, phi) {
+ ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]);
if (phi < phi0) phi0 = phi;
if (phi > phi1) phi1 = phi;
}
function linePoint(lambda, phi) {
- var p = cartesian([lambda * radians$1, phi * radians$1]);
+ var p = cartesian([lambda * radians, phi * radians]);
if (p0) {
var normal = cartesianCross(p0, p),
equatorial = [normal[1], -normal[0], 0],
inflection = cartesianCross(equatorial, normal);
cartesianNormalizeInPlace(inflection);
inflection = spherical(inflection);
var delta = lambda - lambda2,
sign = delta > 0 ? 1 : -1,
- lambdai = inflection[0] * degrees$2 * sign,
+ lambdai = inflection[0] * degrees * sign,
phii,
antimeridian = abs$1(delta) > 180;
if (antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {
- phii = inflection[1] * degrees$2;
+ phii = inflection[1] * degrees;
if (phii > phi1) phi1 = phii;
} else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign * lambda2 < lambdai && lambdai < sign * lambda)) {
- phii = -inflection[1] * degrees$2;
+ phii = -inflection[1] * degrees;
if (phii < phi0) phi0 = phii;
} else {
if (phi < phi0) phi0 = phi;
if (phi > phi1) phi1 = phi;
}
if (antimeridian) {
if (lambda < lambda2) {
- if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;
+ if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;
} else {
- if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;
+ if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;
}
} else {
- if (lambda1 >= lambda0$1) {
- if (lambda < lambda0$1) lambda0$1 = lambda;
+ if (lambda1 >= lambda0) {
+ if (lambda < lambda0) lambda0 = lambda;
if (lambda > lambda1) lambda1 = lambda;
} else {
if (lambda > lambda2) {
- if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda;
+ if (angle(lambda0, lambda) > angle(lambda0, lambda1)) lambda1 = lambda;
} else {
- if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda;
+ if (angle(lambda, lambda1) > angle(lambda0, lambda1)) lambda0 = lambda;
}
}
}
} else {
- ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]);
+ ranges.push(range$2 = [lambda0 = lambda, lambda1 = lambda]);
}
if (phi < phi0) phi0 = phi;
if (phi > phi1) phi1 = phi;
p0 = p, lambda2 = lambda;
}
function boundsLineStart() {
- boundsStream.point = linePoint;
+ boundsStream$2.point = linePoint;
}
function boundsLineEnd() {
- range[0] = lambda0$1, range[1] = lambda1;
- boundsStream.point = boundsPoint;
+ range$2[0] = lambda0, range$2[1] = lambda1;
+ boundsStream$2.point = boundsPoint$1;
p0 = null;
}
function boundsRingPoint(lambda, phi) {
if (p0) {
@@ -24348,23 +24395,23 @@
deltaSum.add(abs$1(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
} else {
lambda00$1 = lambda, phi00$1 = phi;
}
- areaStream.point(lambda, phi);
+ areaStream$1.point(lambda, phi);
linePoint(lambda, phi);
}
function boundsRingStart() {
- areaStream.lineStart();
+ areaStream$1.lineStart();
}
function boundsRingEnd() {
boundsRingPoint(lambda00$1, phi00$1);
- areaStream.lineEnd();
- if (abs$1(deltaSum) > epsilon$3) lambda0$1 = -(lambda1 = 180);
- range[0] = lambda0$1, range[1] = lambda1;
+ areaStream$1.lineEnd();
+ if (abs$1(deltaSum) > epsilon$2) lambda0 = -(lambda1 = 180);
+ range$2[0] = lambda0, range$2[1] = lambda1;
p0 = null;
} // Finds the left-right distance between two longitudes.
// This is almost the same as (lambda1 - lambda0 + 360°) % 360°, except that we want
// the distance between ±180° to be 360°.
@@ -24381,13 +24428,13 @@
return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
}
function geoBounds$1 (feature) {
var i, n, a, b, merged, deltaMax, delta;
- phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);
+ phi1 = lambda1 = -(lambda0 = phi0 = Infinity);
ranges = [];
- geoStream(feature, boundsStream); // First, sort ranges by their minimum longitudes.
+ geoStream(feature, boundsStream$2); // First, sort ranges by their minimum longitudes.
if (n = ranges.length) {
ranges.sort(rangeCompare); // Then, merge any ranges that overlap.
for (i = 1, a = ranges[0], merged = [a]; i < n; ++i) {
@@ -24403,148 +24450,148 @@
// The final bounding box will be the inverse of this gap.
for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a = merged[n]; i <= n; a = b, ++i) {
b = merged[i];
- if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a[1];
+ if ((delta = angle(a[1], b[0])) > deltaMax) deltaMax = delta, lambda0 = b[0], lambda1 = a[1];
}
}
- ranges = range = null;
- return lambda0$1 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0$1, phi0], [lambda1, phi1]];
+ ranges = range$2 = null;
+ return lambda0 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0, phi0], [lambda1, phi1]];
}
- var W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00$2, phi00$2, // first point
- x0, y0, z0; // previous point
+ var W0, W1, X0$1, Y0$1, Z0$1, X1$1, Y1$1, Z1$1, X2$1, Y2$1, Z2$1, lambda00, phi00, // first point
+ x0$4, y0$4, z0; // previous point
- var centroidStream = {
+ var centroidStream$1 = {
sphere: noop$2,
- point: centroidPoint,
- lineStart: centroidLineStart,
- lineEnd: centroidLineEnd,
+ point: centroidPoint$1,
+ lineStart: centroidLineStart$1,
+ lineEnd: centroidLineEnd$1,
polygonStart: function () {
- centroidStream.lineStart = centroidRingStart;
- centroidStream.lineEnd = centroidRingEnd;
+ centroidStream$1.lineStart = centroidRingStart$1;
+ centroidStream$1.lineEnd = centroidRingEnd$1;
},
polygonEnd: function () {
- centroidStream.lineStart = centroidLineStart;
- centroidStream.lineEnd = centroidLineEnd;
+ centroidStream$1.lineStart = centroidLineStart$1;
+ centroidStream$1.lineEnd = centroidLineEnd$1;
}
}; // Arithmetic mean of Cartesian vectors.
- function centroidPoint(lambda, phi) {
- lambda *= radians$1, phi *= radians$1;
+ function centroidPoint$1(lambda, phi) {
+ lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi);
centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi));
}
function centroidPointCartesian(x, y, z) {
++W0;
- X0 += (x - X0) / W0;
- Y0 += (y - Y0) / W0;
- Z0 += (z - Z0) / W0;
+ X0$1 += (x - X0$1) / W0;
+ Y0$1 += (y - Y0$1) / W0;
+ Z0$1 += (z - Z0$1) / W0;
}
- function centroidLineStart() {
- centroidStream.point = centroidLinePointFirst;
+ function centroidLineStart$1() {
+ centroidStream$1.point = centroidLinePointFirst;
}
function centroidLinePointFirst(lambda, phi) {
- lambda *= radians$1, phi *= radians$1;
+ lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi);
- x0 = cosPhi * cos$1(lambda);
- y0 = cosPhi * sin$1(lambda);
+ x0$4 = cosPhi * cos$1(lambda);
+ y0$4 = cosPhi * sin$1(lambda);
z0 = sin$1(phi);
- centroidStream.point = centroidLinePoint;
- centroidPointCartesian(x0, y0, z0);
+ centroidStream$1.point = centroidLinePoint;
+ centroidPointCartesian(x0$4, y0$4, z0);
}
function centroidLinePoint(lambda, phi) {
- lambda *= radians$1, phi *= radians$1;
+ lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi),
x = cosPhi * cos$1(lambda),
y = cosPhi * sin$1(lambda),
z = sin$1(phi),
- w = atan2$1(sqrt$2((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
+ w = atan2(sqrt$1((w = y0$4 * z - z0 * y) * w + (w = z0 * x - x0$4 * z) * w + (w = x0$4 * y - y0$4 * x) * w), x0$4 * x + y0$4 * y + z0 * z);
W1 += w;
- X1 += w * (x0 + (x0 = x));
- Y1 += w * (y0 + (y0 = y));
- Z1 += w * (z0 + (z0 = z));
- centroidPointCartesian(x0, y0, z0);
+ X1$1 += w * (x0$4 + (x0$4 = x));
+ Y1$1 += w * (y0$4 + (y0$4 = y));
+ Z1$1 += w * (z0 + (z0 = z));
+ centroidPointCartesian(x0$4, y0$4, z0);
}
- function centroidLineEnd() {
- centroidStream.point = centroidPoint;
+ function centroidLineEnd$1() {
+ centroidStream$1.point = centroidPoint$1;
} // See J. E. Brock, The Inertia Tensor for a Spherical Triangle,
// J. Applied Mechanics 42, 239 (1975).
- function centroidRingStart() {
- centroidStream.point = centroidRingPointFirst;
+ function centroidRingStart$1() {
+ centroidStream$1.point = centroidRingPointFirst;
}
- function centroidRingEnd() {
- centroidRingPoint(lambda00$2, phi00$2);
- centroidStream.point = centroidPoint;
+ function centroidRingEnd$1() {
+ centroidRingPoint(lambda00, phi00);
+ centroidStream$1.point = centroidPoint$1;
}
function centroidRingPointFirst(lambda, phi) {
- lambda00$2 = lambda, phi00$2 = phi;
- lambda *= radians$1, phi *= radians$1;
- centroidStream.point = centroidRingPoint;
+ lambda00 = lambda, phi00 = phi;
+ lambda *= radians, phi *= radians;
+ centroidStream$1.point = centroidRingPoint;
var cosPhi = cos$1(phi);
- x0 = cosPhi * cos$1(lambda);
- y0 = cosPhi * sin$1(lambda);
+ x0$4 = cosPhi * cos$1(lambda);
+ y0$4 = cosPhi * sin$1(lambda);
z0 = sin$1(phi);
- centroidPointCartesian(x0, y0, z0);
+ centroidPointCartesian(x0$4, y0$4, z0);
}
function centroidRingPoint(lambda, phi) {
- lambda *= radians$1, phi *= radians$1;
+ lambda *= radians, phi *= radians;
var cosPhi = cos$1(phi),
x = cosPhi * cos$1(lambda),
y = cosPhi * sin$1(lambda),
z = sin$1(phi),
- cx = y0 * z - z0 * y,
- cy = z0 * x - x0 * z,
- cz = x0 * y - y0 * x,
+ cx = y0$4 * z - z0 * y,
+ cy = z0 * x - x0$4 * z,
+ cz = x0$4 * y - y0$4 * x,
m = hypot(cx, cy, cz),
w = asin$1(m),
// line weight = angle
v = m && -w / m; // area weight multiplier
- X2.add(v * cx);
- Y2.add(v * cy);
- Z2.add(v * cz);
+ X2$1.add(v * cx);
+ Y2$1.add(v * cy);
+ Z2$1.add(v * cz);
W1 += w;
- X1 += w * (x0 + (x0 = x));
- Y1 += w * (y0 + (y0 = y));
- Z1 += w * (z0 + (z0 = z));
- centroidPointCartesian(x0, y0, z0);
+ X1$1 += w * (x0$4 + (x0$4 = x));
+ Y1$1 += w * (y0$4 + (y0$4 = y));
+ Z1$1 += w * (z0 + (z0 = z));
+ centroidPointCartesian(x0$4, y0$4, z0);
}
function geoCentroid$1 (object) {
- W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = 0;
- X2 = new Adder();
- Y2 = new Adder();
- Z2 = new Adder();
- geoStream(object, centroidStream);
- var x = +X2,
- y = +Y2,
- z = +Z2,
+ W0 = W1 = X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = 0;
+ X2$1 = new Adder();
+ Y2$1 = new Adder();
+ Z2$1 = new Adder();
+ geoStream(object, centroidStream$1);
+ var x = +X2$1,
+ y = +Y2$1,
+ z = +Z2$1,
m = hypot(x, y, z); // If the area-weighted ccentroid is undefined, fall back to length-weighted ccentroid.
- if (m < epsilon2$1) {
- x = X1, y = Y1, z = Z1; // If the feature has zero length, fall back to arithmetic mean of point vectors.
+ if (m < epsilon2) {
+ x = X1$1, y = Y1$1, z = Z1$1; // If the feature has zero length, fall back to arithmetic mean of point vectors.
- if (W1 < epsilon$3) x = X0, y = Y0, z = Z0;
+ if (W1 < epsilon$2) x = X0$1, y = Y0$1, z = Z0$1;
m = hypot(x, y, z); // If the feature still has an undefined ccentroid, then return.
- if (m < epsilon2$1) return [NaN, NaN];
+ if (m < epsilon2) return [NaN, NaN];
}
- return [atan2$1(y, x) * degrees$2, asin$1(z / m) * degrees$2];
+ return [atan2(y, x) * degrees, asin$1(z / m) * degrees];
}
function compose (a, b) {
function compose(x, y) {
return x = a(x, y), b(x[0], x[1]);
@@ -24555,21 +24602,21 @@
};
return compose;
}
function rotationIdentity(lambda, phi) {
- return [abs$1(lambda) > pi$2 ? lambda + Math.round(-lambda / tau$2) * tau$2 : lambda, phi];
+ return [abs$1(lambda) > pi$1 ? lambda + Math.round(-lambda / tau$1) * tau$1 : lambda, phi];
}
rotationIdentity.invert = rotationIdentity;
function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
- return (deltaLambda %= tau$2) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
+ return (deltaLambda %= tau$1) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
}
function forwardRotationLambda(deltaLambda) {
return function (lambda, phi) {
- return lambda += deltaLambda, [lambda > pi$2 ? lambda - tau$2 : lambda < -pi$2 ? lambda + tau$2 : lambda, phi];
+ return lambda += deltaLambda, [lambda > pi$1 ? lambda - tau$1 : lambda < -pi$1 ? lambda + tau$1 : lambda, phi];
};
}
function rotationLambda(deltaLambda) {
var rotation = forwardRotationLambda(deltaLambda);
@@ -24587,36 +24634,36 @@
var cosPhi = cos$1(phi),
x = cos$1(lambda) * cosPhi,
y = sin$1(lambda) * cosPhi,
z = sin$1(phi),
k = z * cosDeltaPhi + x * sinDeltaPhi;
- return [atan2$1(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), asin$1(k * cosDeltaGamma + y * sinDeltaGamma)];
+ return [atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), asin$1(k * cosDeltaGamma + y * sinDeltaGamma)];
}
rotation.invert = function (lambda, phi) {
var cosPhi = cos$1(phi),
x = cos$1(lambda) * cosPhi,
y = sin$1(lambda) * cosPhi,
z = sin$1(phi),
k = z * cosDeltaGamma - y * sinDeltaGamma;
- return [atan2$1(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), asin$1(k * cosDeltaPhi - x * sinDeltaPhi)];
+ return [atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), asin$1(k * cosDeltaPhi - x * sinDeltaPhi)];
};
return rotation;
}
function rotation (rotate) {
- rotate = rotateRadians(rotate[0] * radians$1, rotate[1] * radians$1, rotate.length > 2 ? rotate[2] * radians$1 : 0);
+ rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
function forward(coordinates) {
- coordinates = rotate(coordinates[0] * radians$1, coordinates[1] * radians$1);
- return coordinates[0] *= degrees$2, coordinates[1] *= degrees$2, coordinates;
+ coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
+ return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
}
forward.invert = function (coordinates) {
- coordinates = rotate.invert(coordinates[0] * radians$1, coordinates[1] * radians$1);
- return coordinates[0] *= degrees$2, coordinates[1] *= degrees$2, coordinates;
+ coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
+ return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
};
return forward;
}
@@ -24625,16 +24672,16 @@
var cosRadius = cos$1(radius),
sinRadius = sin$1(radius),
step = direction * delta;
if (t0 == null) {
- t0 = radius + direction * tau$2;
+ t0 = radius + direction * tau$1;
t1 = radius - step / 2;
} else {
t0 = circleRadius(cosRadius, t0);
t1 = circleRadius(cosRadius, t1);
- if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$2;
+ if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau$1;
}
for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) {
point = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]);
stream.point(point[0], point[1]);
@@ -24642,12 +24689,12 @@
} // Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0].
function circleRadius(cosRadius, point) {
point = cartesian(point), point[0] -= cosRadius;
cartesianNormalizeInPlace(point);
- var radius = acos$1(-point[1]);
- return ((-point[2] < 0 ? -radius : radius) + tau$2 - epsilon$3) % tau$2;
+ var radius = acos(-point[1]);
+ return ((-point[2] < 0 ? -radius : radius) + tau$1 - epsilon$2) % tau$1;
}
function clipBuffer () {
var lines = [],
line;
@@ -24670,11 +24717,11 @@
}
};
}
function pointEqual (a, b) {
- return abs$1(a[0] - b[0]) < epsilon$3 && abs$1(a[1] - b[1]) < epsilon$3;
+ return abs$1(a[0] - b[0]) < epsilon$2 && abs$1(a[1] - b[1]) < epsilon$2;
}
function Intersection(point, points, other, entry) {
this.x = point;
this.z = points;
@@ -24711,11 +24758,11 @@
stream.lineEnd();
return;
} // handle degenerate cases by moving the point
- p1[0] += 2 * epsilon$3;
+ p1[0] += 2 * epsilon$2;
}
subject.push(x = new Intersection(p0, segment, null, true));
clip.push(x.o = new Intersection(p0, null, x, false));
subject.push(x = new Intersection(p1, segment, null, false));
@@ -24792,22 +24839,22 @@
a.n = b = array[0];
b.p = a;
}
function longitude(point) {
- if (abs$1(point[0]) <= pi$2) return point[0];else return sign$1(point[0]) * ((abs$1(point[0]) + pi$2) % tau$2 - pi$2);
+ if (abs$1(point[0]) <= pi$1) return point[0];else return sign(point[0]) * ((abs$1(point[0]) + pi$1) % tau$1 - pi$1);
}
function polygonContains (polygon, point) {
var lambda = longitude(point),
phi = point[1],
sinPhi = sin$1(phi),
normal = [sin$1(lambda), -cos$1(lambda), 0],
angle = 0,
winding = 0;
var sum = new Adder();
- if (sinPhi === 1) phi = halfPi$1 + epsilon$3;else if (sinPhi === -1) phi = -halfPi$1 - epsilon$3;
+ if (sinPhi === 1) phi = halfPi$1 + epsilon$2;else if (sinPhi === -1) phi = -halfPi$1 - epsilon$2;
for (var i = 0, n = polygon.length; i < n; ++i) {
if (!(m = (ring = polygon[i]).length)) continue;
var ring,
m,
@@ -24824,14 +24871,14 @@
sinPhi1 = sin$1(phi1),
cosPhi1 = cos$1(phi1),
delta = lambda1 - lambda0,
sign = delta >= 0 ? 1 : -1,
absDelta = sign * delta,
- antimeridian = absDelta > pi$2,
+ antimeridian = absDelta > pi$1,
k = sinPhi0 * sinPhi1;
- sum.add(atan2$1(k * sign * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta)));
- angle += antimeridian ? delta + sign * tau$2 : delta; // Are the longitudes either side of the point’s meridian (lambda),
+ sum.add(atan2(k * sign * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta)));
+ angle += antimeridian ? delta + sign * tau$1 : delta; // Are the longitudes either side of the point’s meridian (lambda),
// and are the latitudes smaller than the parallel (phi)?
if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
var arc = cartesianCross(cartesian(point0), cartesian(point1));
cartesianNormalizeInPlace(arc);
@@ -24854,14 +24901,14 @@
// Second, count the (signed) number of times a segment crosses a lambda
// from the point to the South pole. If it is zero, then the point is the
// same side as the South pole.
- return (angle < -epsilon$3 || angle < epsilon$3 && sum < -epsilon2$1) ^ winding & 1;
+ return (angle < -epsilon$2 || angle < epsilon$2 && sum < -epsilon2) ^ winding & 1;
}
- function clip$2 (pointVisible, clipLine, interpolate, start) {
+ function clip$1 (pointVisible, clipLine, interpolate, start) {
return function (sink) {
var line = clipLine(sink),
ringBuffer = clipBuffer(),
ringSink = clipLine(ringBuffer),
polygonStarted = false,
@@ -24881,11 +24928,11 @@
},
polygonEnd: function () {
clip.point = point;
clip.lineStart = lineStart;
clip.lineEnd = lineEnd;
- segments = merge$1(segments);
+ segments = merge$2(segments);
var startInside = polygonContains(polygon, start);
if (segments.length) {
if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
clipRejoin(segments, compareIntersection, startInside, interpolate, sink);
@@ -24981,16 +25028,16 @@
} // Intersections are sorted along the clip edge. For both antimeridian cutting
// and circle clipping, the same comparison is used.
function compareIntersection(a, b) {
- return ((a = a.x)[0] < 0 ? a[1] - halfPi$1 - epsilon$3 : halfPi$1 - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi$1 - epsilon$3 : halfPi$1 - b[1]);
+ return ((a = a.x)[0] < 0 ? a[1] - halfPi$1 - epsilon$2 : halfPi$1 - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi$1 - epsilon$2 : halfPi$1 - b[1]);
}
- var clipAntimeridian = clip$2(function () {
+ var clipAntimeridian = clip$1(function () {
return true;
- }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi$2, -halfPi$1]); // Takes a line and cuts into visible segments. Return values: 0 - there were
+ }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi$1, -halfPi$1]); // Takes a line and cuts into visible segments. Return values: 0 - there were
// intersections or the line was empty; 1 - no intersections; 2 - there were
// intersections, and the first and last segments should be rejoined.
function clipAntimeridianLine(stream) {
var lambda0 = NaN,
@@ -25002,27 +25049,27 @@
lineStart: function () {
stream.lineStart();
clean = 1;
},
point: function (lambda1, phi1) {
- var sign1 = lambda1 > 0 ? pi$2 : -pi$2,
+ var sign1 = lambda1 > 0 ? pi$1 : -pi$1,
delta = abs$1(lambda1 - lambda0);
- if (abs$1(delta - pi$2) < epsilon$3) {
+ if (abs$1(delta - pi$1) < epsilon$2) {
// line crosses a pole
stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi$1 : -halfPi$1);
stream.point(sign0, phi0);
stream.lineEnd();
stream.lineStart();
stream.point(sign1, phi0);
stream.point(lambda1, phi0);
clean = 0;
- } else if (sign0 !== sign1 && delta >= pi$2) {
+ } else if (sign0 !== sign1 && delta >= pi$1) {
// line crosses antimeridian
- if (abs$1(lambda0 - sign0) < epsilon$3) lambda0 -= sign0 * epsilon$3; // handle degeneracies
+ if (abs$1(lambda0 - sign0) < epsilon$2) lambda0 -= sign0 * epsilon$2; // handle degeneracies
- if (abs$1(lambda1 - sign1) < epsilon$3) lambda1 -= sign1 * epsilon$3;
+ if (abs$1(lambda1 - sign1) < epsilon$2) lambda1 -= sign1 * epsilon$2;
phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1);
stream.point(sign0, phi0);
stream.lineEnd();
stream.lineStart();
stream.point(sign1, phi0);
@@ -25044,29 +25091,29 @@
function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) {
var cosPhi0,
cosPhi1,
sinLambda0Lambda1 = sin$1(lambda0 - lambda1);
- return abs$1(sinLambda0Lambda1) > epsilon$3 ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1) - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;
+ return abs$1(sinLambda0Lambda1) > epsilon$2 ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1) - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;
}
function clipAntimeridianInterpolate(from, to, direction, stream) {
var phi;
if (from == null) {
phi = direction * halfPi$1;
- stream.point(-pi$2, phi);
+ stream.point(-pi$1, phi);
stream.point(0, phi);
- stream.point(pi$2, phi);
- stream.point(pi$2, 0);
- stream.point(pi$2, -phi);
+ stream.point(pi$1, phi);
+ stream.point(pi$1, 0);
+ stream.point(pi$1, -phi);
stream.point(0, -phi);
- stream.point(-pi$2, -phi);
- stream.point(-pi$2, 0);
- stream.point(-pi$2, phi);
- } else if (abs$1(from[0] - to[0]) > epsilon$3) {
- var lambda = from[0] < to[0] ? pi$2 : -pi$2;
+ stream.point(-pi$1, -phi);
+ stream.point(-pi$1, 0);
+ stream.point(-pi$1, phi);
+ } else if (abs$1(from[0] - to[0]) > epsilon$2) {
+ var lambda = from[0] < to[0] ? pi$1 : -pi$1;
phi = direction * lambda / 2;
stream.point(-lambda, phi);
stream.point(0, phi);
stream.point(lambda, phi);
} else {
@@ -25074,13 +25121,13 @@
}
}
function clipCircle (radius) {
var cr = cos$1(radius),
- delta = 6 * radians$1,
+ delta = 6 * radians,
smallRadius = cr > 0,
- notHemisphere = abs$1(cr) > epsilon$3; // TODO optimise for this common case
+ notHemisphere = abs$1(cr) > epsilon$2; // TODO optimise for this common case
function interpolate(from, to, direction, stream) {
circleStream(stream, radius, delta, direction, from, to);
}
@@ -25106,11 +25153,11 @@
},
point: function (lambda, phi) {
var point1 = [lambda, phi],
point2,
v = visible(lambda, phi),
- c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi$2 : -pi$2), phi) : 0;
+ c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi$1 : -pi$1), phi) : 0;
if (!point0 && (v00 = v0 = v)) stream.lineStart();
if (v !== v0) {
point2 = intersect(point0, point1);
if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) point1[2] = 1;
@@ -25196,11 +25243,11 @@
var u = n1xn2,
w = cartesianDot(A, u),
uu = cartesianDot(u, u),
t2 = w * w - uu * (cartesianDot(A, A) - 1);
if (t2 < 0) return;
- var t = sqrt$2(t2),
+ var t = sqrt$1(t2),
q = cartesianScale(u, (-w - t) / uu);
cartesianAddInPlace(q, A);
q = spherical(q);
if (!two) return q; // Two intersection points.
@@ -25209,36 +25256,36 @@
phi0 = a[1],
phi1 = b[1],
z;
if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z;
var delta = lambda1 - lambda0,
- polar = abs$1(delta - pi$2) < epsilon$3,
- meridian = polar || delta < epsilon$3;
+ polar = abs$1(delta - pi$1) < epsilon$2,
+ meridian = polar || delta < epsilon$2;
if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; // Check that the first point is between a and b.
- if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs$1(q[0] - lambda0) < epsilon$3 ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi$2 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
+ if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs$1(q[0] - lambda0) < epsilon$2 ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi$1 ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
var q1 = cartesianScale(u, (-w + t) / uu);
cartesianAddInPlace(q1, A);
return [q, spherical(q1)];
}
} // Generates a 4-bit vector representing the location of a point relative to
// the small circle's bounding box.
function code(lambda, phi) {
- var r = smallRadius ? radius : pi$2 - radius,
+ var r = smallRadius ? radius : pi$1 - radius,
code = 0;
if (lambda < -r) code |= 1; // left
else if (lambda > r) code |= 2; // right
if (phi < -r) code |= 4; // below
else if (phi > r) code |= 8; // above
return code;
}
- return clip$2(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$2, radius - pi$2]);
+ return clip$1(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi$1, radius - pi$1]);
}
function clipLine (a, b, x0, y0, x1, y1) {
var ax = a[0],
ay = a[1],
@@ -25321,11 +25368,11 @@
stream.point(to[0], to[1]);
}
}
function corner(p, direction) {
- return abs$1(p[0] - x0) < epsilon$3 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x1) < epsilon$3 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y0) < epsilon$3 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon
+ return abs$1(p[0] - x0) < epsilon$2 ? direction > 0 ? 0 : 3 : abs$1(p[0] - x1) < epsilon$2 ? direction > 0 ? 2 : 1 : abs$1(p[1] - y0) < epsilon$2 ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon
}
function compareIntersection(a, b) {
return comparePoint(a.x, b.x);
}
@@ -25388,11 +25435,11 @@
}
function polygonEnd() {
var startInside = polygonInside(),
cleanInside = clean && startInside,
- visible = (segments = merge$1(segments)).length;
+ visible = (segments = merge$2(segments)).length;
if (cleanInside || visible) {
stream.polygonStart();
if (cleanInside) {
@@ -25473,20 +25520,20 @@
return clipStream;
};
}
function graticuleX(y0, y1, dy) {
- var y = range$1(y0, y1 - epsilon$3, dy).concat(y1);
+ var y = range$1$1(y0, y1 - epsilon$2, dy).concat(y1);
return function (x) {
return y.map(function (y) {
return [x, y];
});
};
}
function graticuleY(x0, x1, dx) {
- var x = range$1(x0, x1 - epsilon$3, dx).concat(x1);
+ var x = range$1$1(x0, x1 - epsilon$2, dx).concat(x1);
return function (y) {
return x.map(function (x) {
return [x, y];
});
};
@@ -25517,14 +25564,14 @@
coordinates: lines()
};
}
function lines() {
- return range$1(ceil(X0 / DX) * DX, X1, DX).map(X).concat(range$1(ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(range$1(ceil(x0 / dx) * dx, x1, dx).filter(function (x) {
- return abs$1(x % DX) > epsilon$3;
- }).map(x)).concat(range$1(ceil(y0 / dy) * dy, y1, dy).filter(function (y) {
- return abs$1(y % DY) > epsilon$3;
+ return range$1$1(ceil(X0 / DX) * DX, X1, DX).map(X).concat(range$1$1(ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(range$1$1(ceil(x0 / dx) * dx, x1, dx).filter(function (x) {
+ return abs$1(x % DX) > epsilon$2;
+ }).map(x)).concat(range$1$1(ceil(y0 / dy) * dy, y1, dy).filter(function (y) {
+ return abs$1(y % DY) > epsilon$2;
}).map(y));
}
graticule.lines = function () {
return lines().map(function (coordinates) {
@@ -25590,65 +25637,67 @@
X = graticuleX(Y0, Y1, 90);
Y = graticuleY(X0, X1, precision);
return graticule;
};
- return graticule.extentMajor([[-180, -90 + epsilon$3], [180, 90 - epsilon$3]]).extentMinor([[-180, -80 - epsilon$3], [180, 80 + epsilon$3]]);
+ return graticule.extentMajor([[-180, -90 + epsilon$2], [180, 90 - epsilon$2]]).extentMinor([[-180, -80 - epsilon$2], [180, 80 + epsilon$2]]);
}
- var identity$6 = (x => x);
+ var identity = (x => x);
- var areaSum$1 = new Adder(),
- areaRingSum$1 = new Adder(),
- x00,
- y00,
- x0$1,
- y0$1;
- var areaStream$1 = {
+ var areaSum = new Adder(),
+ areaRingSum = new Adder(),
+ x00$2,
+ y00$2,
+ x0$3,
+ y0$3;
+ var areaStream = {
point: noop$2,
lineStart: noop$2,
lineEnd: noop$2,
polygonStart: function () {
- areaStream$1.lineStart = areaRingStart$1;
- areaStream$1.lineEnd = areaRingEnd$1;
+ areaStream.lineStart = areaRingStart;
+ areaStream.lineEnd = areaRingEnd;
},
polygonEnd: function () {
- areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$2;
- areaSum$1.add(abs$1(areaRingSum$1));
- areaRingSum$1 = new Adder();
+ areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$2;
+ areaSum.add(abs$1(areaRingSum));
+ areaRingSum = new Adder();
},
result: function () {
- var area = areaSum$1 / 2;
- areaSum$1 = new Adder();
+ var area = areaSum / 2;
+ areaSum = new Adder();
return area;
}
};
- function areaRingStart$1() {
- areaStream$1.point = areaPointFirst$1;
+ function areaRingStart() {
+ areaStream.point = areaPointFirst;
}
- function areaPointFirst$1(x, y) {
- areaStream$1.point = areaPoint$1;
- x00 = x0$1 = x, y00 = y0$1 = y;
+ function areaPointFirst(x, y) {
+ areaStream.point = areaPoint;
+ x00$2 = x0$3 = x, y00$2 = y0$3 = y;
}
- function areaPoint$1(x, y) {
- areaRingSum$1.add(y0$1 * x - x0$1 * y);
- x0$1 = x, y0$1 = y;
+ function areaPoint(x, y) {
+ areaRingSum.add(y0$3 * x - x0$3 * y);
+ x0$3 = x, y0$3 = y;
}
- function areaRingEnd$1() {
- areaPoint$1(x00, y00);
+ function areaRingEnd() {
+ areaPoint(x00$2, y00$2);
}
+ var pathArea = areaStream;
+
var x0$2 = Infinity,
y0$2 = x0$2,
x1 = -x0$2,
y1 = x1;
- var boundsStream$1 = {
- point: boundsPoint$1,
+ var boundsStream = {
+ point: boundsPoint,
lineStart: noop$2,
lineEnd: noop$2,
polygonStart: noop$2,
polygonEnd: noop$2,
result: function () {
@@ -25656,106 +25705,110 @@
x1 = y1 = -(y0$2 = x0$2 = Infinity);
return bounds;
}
};
- function boundsPoint$1(x, y) {
+ function boundsPoint(x, y) {
if (x < x0$2) x0$2 = x;
if (x > x1) x1 = x;
if (y < y0$2) y0$2 = y;
if (y > y1) y1 = y;
}
- var X0$1 = 0,
- Y0$1 = 0,
- Z0$1 = 0,
- X1$1 = 0,
- Y1$1 = 0,
- Z1$1 = 0,
- X2$1 = 0,
- Y2$1 = 0,
- Z2$1 = 0,
+ var boundsStream$1 = boundsStream;
+
+ var X0 = 0,
+ Y0 = 0,
+ Z0 = 0,
+ X1 = 0,
+ Y1 = 0,
+ Z1 = 0,
+ X2 = 0,
+ Y2 = 0,
+ Z2 = 0,
x00$1,
y00$1,
- x0$3,
- y0$3;
- var centroidStream$1 = {
- point: centroidPoint$1,
- lineStart: centroidLineStart$1,
- lineEnd: centroidLineEnd$1,
+ x0$1,
+ y0$1;
+ var centroidStream = {
+ point: centroidPoint,
+ lineStart: centroidLineStart,
+ lineEnd: centroidLineEnd,
polygonStart: function () {
- centroidStream$1.lineStart = centroidRingStart$1;
- centroidStream$1.lineEnd = centroidRingEnd$1;
+ centroidStream.lineStart = centroidRingStart;
+ centroidStream.lineEnd = centroidRingEnd;
},
polygonEnd: function () {
- centroidStream$1.point = centroidPoint$1;
- centroidStream$1.lineStart = centroidLineStart$1;
- centroidStream$1.lineEnd = centroidLineEnd$1;
+ centroidStream.point = centroidPoint;
+ centroidStream.lineStart = centroidLineStart;
+ centroidStream.lineEnd = centroidLineEnd;
},
result: function () {
- var centroid = Z2$1 ? [X2$1 / Z2$1, Y2$1 / Z2$1] : Z1$1 ? [X1$1 / Z1$1, Y1$1 / Z1$1] : Z0$1 ? [X0$1 / Z0$1, Y0$1 / Z0$1] : [NaN, NaN];
- X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = X2$1 = Y2$1 = Z2$1 = 0;
+ var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
+ X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
return centroid;
}
};
- function centroidPoint$1(x, y) {
- X0$1 += x;
- Y0$1 += y;
- ++Z0$1;
+ function centroidPoint(x, y) {
+ X0 += x;
+ Y0 += y;
+ ++Z0;
}
- function centroidLineStart$1() {
- centroidStream$1.point = centroidPointFirstLine;
+ function centroidLineStart() {
+ centroidStream.point = centroidPointFirstLine;
}
function centroidPointFirstLine(x, y) {
- centroidStream$1.point = centroidPointLine;
- centroidPoint$1(x0$3 = x, y0$3 = y);
+ centroidStream.point = centroidPointLine;
+ centroidPoint(x0$1 = x, y0$1 = y);
}
function centroidPointLine(x, y) {
- var dx = x - x0$3,
- dy = y - y0$3,
- z = sqrt$2(dx * dx + dy * dy);
- X1$1 += z * (x0$3 + x) / 2;
- Y1$1 += z * (y0$3 + y) / 2;
- Z1$1 += z;
- centroidPoint$1(x0$3 = x, y0$3 = y);
+ var dx = x - x0$1,
+ dy = y - y0$1,
+ z = sqrt$1(dx * dx + dy * dy);
+ X1 += z * (x0$1 + x) / 2;
+ Y1 += z * (y0$1 + y) / 2;
+ Z1 += z;
+ centroidPoint(x0$1 = x, y0$1 = y);
}
- function centroidLineEnd$1() {
- centroidStream$1.point = centroidPoint$1;
+ function centroidLineEnd() {
+ centroidStream.point = centroidPoint;
}
- function centroidRingStart$1() {
- centroidStream$1.point = centroidPointFirstRing;
+ function centroidRingStart() {
+ centroidStream.point = centroidPointFirstRing;
}
- function centroidRingEnd$1() {
+ function centroidRingEnd() {
centroidPointRing(x00$1, y00$1);
}
function centroidPointFirstRing(x, y) {
- centroidStream$1.point = centroidPointRing;
- centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y);
+ centroidStream.point = centroidPointRing;
+ centroidPoint(x00$1 = x0$1 = x, y00$1 = y0$1 = y);
}
function centroidPointRing(x, y) {
- var dx = x - x0$3,
- dy = y - y0$3,
- z = sqrt$2(dx * dx + dy * dy);
- X1$1 += z * (x0$3 + x) / 2;
- Y1$1 += z * (y0$3 + y) / 2;
- Z1$1 += z;
- z = y0$3 * x - x0$3 * y;
- X2$1 += z * (x0$3 + x);
- Y2$1 += z * (y0$3 + y);
- Z2$1 += z * 3;
- centroidPoint$1(x0$3 = x, y0$3 = y);
+ var dx = x - x0$1,
+ dy = y - y0$1,
+ z = sqrt$1(dx * dx + dy * dy);
+ X1 += z * (x0$1 + x) / 2;
+ Y1 += z * (y0$1 + y) / 2;
+ Z1 += z;
+ z = y0$1 * x - x0$1 * y;
+ X2 += z * (x0$1 + x);
+ Y2 += z * (y0$1 + y);
+ Z2 += z * 3;
+ centroidPoint(x0$1 = x, y0$1 = y);
}
+ var pathCentroid = centroidStream;
+
function PathContext(context) {
this._context = context;
}
PathContext.prototype = {
_radius: 4.5,
@@ -25794,32 +25847,32 @@
default:
{
this._context.moveTo(x + this._radius, y);
- this._context.arc(x, y, this._radius, 0, tau$2);
+ this._context.arc(x, y, this._radius, 0, tau$1);
break;
}
}
},
result: noop$2
};
var lengthSum = new Adder(),
lengthRing,
- x00$2,
- y00$2,
- x0$4,
- y0$4;
+ x00,
+ y00,
+ x0,
+ y0;
var lengthStream = {
point: noop$2,
lineStart: function () {
lengthStream.point = lengthPointFirst;
},
lineEnd: function () {
- if (lengthRing) lengthPoint(x00$2, y00$2);
+ if (lengthRing) lengthPoint(x00, y00);
lengthStream.point = noop$2;
},
polygonStart: function () {
lengthRing = true;
},
@@ -25833,25 +25886,27 @@
}
};
function lengthPointFirst(x, y) {
lengthStream.point = lengthPoint;
- x00$2 = x0$4 = x, y00$2 = y0$4 = y;
+ x00 = x0 = x, y00 = y0 = y;
}
function lengthPoint(x, y) {
- x0$4 -= x, y0$4 -= y;
- lengthSum.add(sqrt$2(x0$4 * x0$4 + y0$4 * y0$4));
- x0$4 = x, y0$4 = y;
+ x0 -= x, y0 -= y;
+ lengthSum.add(sqrt$1(x0 * x0 + y0 * y0));
+ x0 = x, y0 = y;
}
+ var pathMeasure = lengthStream;
+
function PathString() {
this._string = [];
}
PathString.prototype = {
_radius: 4.5,
- _circle: circle$1(4.5),
+ _circle: circle(4.5),
pointRadius: function (_) {
if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;
return this;
},
polygonStart: function () {
@@ -25884,11 +25939,11 @@
break;
}
default:
{
- if (this._circle == null) this._circle = circle$1(this._radius);
+ if (this._circle == null) this._circle = circle(this._radius);
this._string.push("M", x, ",", y, this._circle);
break;
}
@@ -25904,11 +25959,11 @@
return null;
}
}
};
- function circle$1(radius) {
+ function circle(radius) {
return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
}
function geoPath (projection, context) {
var pointRadius = 4.5,
@@ -25923,31 +25978,31 @@
return contextStream.result();
}
path.area = function (object) {
- geoStream(object, projectionStream(areaStream$1));
- return areaStream$1.result();
+ geoStream(object, projectionStream(pathArea));
+ return pathArea.result();
};
path.measure = function (object) {
- geoStream(object, projectionStream(lengthStream));
- return lengthStream.result();
+ geoStream(object, projectionStream(pathMeasure));
+ return pathMeasure.result();
};
path.bounds = function (object) {
geoStream(object, projectionStream(boundsStream$1));
return boundsStream$1.result();
};
path.centroid = function (object) {
- geoStream(object, projectionStream(centroidStream$1));
- return centroidStream$1.result();
+ geoStream(object, projectionStream(pathCentroid));
+ return pathCentroid.result();
};
path.projection = function (_) {
- return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$6) : (projection = _).stream, path) : projection;
+ return arguments.length ? (projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream, path) : projection;
};
path.context = function (_) {
if (!arguments.length) return context;
contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _);
@@ -25962,11 +26017,11 @@
};
return path.projection(projection).context(context);
}
- function transformer$3(methods) {
+ function transformer(methods) {
return function (stream) {
var s = new TransformStream();
for (var key in methods) s[key] = methods[key];
@@ -25997,22 +26052,22 @@
polygonEnd: function () {
this.stream.polygonEnd();
}
};
- function fit(projection, fitBounds, object) {
+ function fit$1(projection, fitBounds, object) {
var clip = projection.clipExtent && projection.clipExtent();
projection.scale(150).translate([0, 0]);
if (clip != null) projection.clipExtent(null);
geoStream(object, projection.stream(boundsStream$1));
fitBounds(boundsStream$1.result());
if (clip != null) projection.clipExtent(clip);
return projection;
}
function fitExtent(projection, extent, object) {
- return fit(projection, function (b) {
+ return fit$1(projection, function (b) {
var w = extent[1][0] - extent[0][0],
h = extent[1][1] - extent[0][1],
k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])),
x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2,
y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
@@ -26021,38 +26076,38 @@
}
function fitSize(projection, size, object) {
return fitExtent(projection, [[0, 0], size], object);
}
function fitWidth(projection, width, object) {
- return fit(projection, function (b) {
+ return fit$1(projection, function (b) {
var w = +width,
k = w / (b[1][0] - b[0][0]),
x = (w - k * (b[1][0] + b[0][0])) / 2,
y = -k * b[0][1];
projection.scale(150 * k).translate([x, y]);
}, object);
}
function fitHeight(projection, height, object) {
- return fit(projection, function (b) {
+ return fit$1(projection, function (b) {
var h = +height,
k = h / (b[1][1] - b[0][1]),
x = -k * b[0][0],
y = (h - k * (b[1][1] + b[0][1])) / 2;
projection.scale(150 * k).translate([x, y]);
}, object);
}
var maxDepth = 16,
// maximum depth of subdivision
- cosMinDistance = cos$1(30 * radians$1); // cos(minimum angular distance)
+ cosMinDistance = cos$1(30 * radians); // cos(minimum angular distance)
function resample (project, delta2) {
return +delta2 ? resample$1(project, delta2) : resampleNone(project);
}
function resampleNone(project) {
- return transformer$3({
+ return transformer({
point: function (x, y) {
x = project(x, y);
this.stream.point(x[0], x[1]);
}
});
@@ -26066,13 +26121,13 @@
if (d2 > 4 * delta2 && depth--) {
var a = a0 + a1,
b = b0 + b1,
c = c0 + c1,
- m = sqrt$2(a * a + b * b + c * c),
+ m = sqrt$1(a * a + b * b + c * c),
phi2 = asin$1(c /= m),
- lambda2 = abs$1(abs$1(c) - 1) < epsilon$3 || abs$1(lambda0 - lambda1) < epsilon$3 ? (lambda0 + lambda1) / 2 : atan2$1(b, a),
+ lambda2 = abs$1(abs$1(c) - 1) < epsilon$2 || abs$1(lambda0 - lambda1) < epsilon$2 ? (lambda0 + lambda1) / 2 : atan2(b, a),
p = project(lambda2, phi2),
x2 = p[0],
y2 = p[1],
dx2 = x2 - x0,
dy2 = y2 - y0,
@@ -26149,18 +26204,18 @@
return resampleStream;
};
}
- var transformRadians = transformer$3({
+ var transformRadians = transformer({
point: function (x, y) {
- this.stream.point(x * radians$1, y * radians$1);
+ this.stream.point(x * radians, y * radians);
}
});
function transformRotate(rotate) {
- return transformer$3({
+ return transformer({
point: function (x, y) {
var r = rotate(x, y);
return this.stream.point(r[0], r[1]);
}
});
@@ -26202,11 +26257,11 @@
};
return transform;
}
- function projection(project) {
+ function projection$1(project) {
return projectionMutator(function () {
return project;
})();
}
function projectionMutator(projectAt) {
@@ -26235,27 +26290,27 @@
// pre-clip angle
x0 = null,
y0,
x1,
y1,
- postclip = identity$6,
+ postclip = identity,
// post-clip extent
delta2 = 0.5,
// precision
projectResample,
projectTransform,
projectRotateTransform,
cache,
cacheStream;
function projection(point) {
- return projectRotateTransform(point[0] * radians$1, point[1] * radians$1);
+ return projectRotateTransform(point[0] * radians, point[1] * radians);
}
function invert(point) {
point = projectRotateTransform.invert(point[0], point[1]);
- return point && [point[0] * degrees$2, point[1] * degrees$2];
+ return point && [point[0] * degrees, point[1] * degrees];
}
projection.stream = function (stream) {
return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
};
@@ -26267,15 +26322,15 @@
projection.postclip = function (_) {
return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
};
projection.clipAngle = function (_) {
- return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians$1) : (theta = null, clipAntimeridian), reset()) : theta * degrees$2;
+ return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees;
};
projection.clipExtent = function (_) {
- return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$6) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
+ return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
};
projection.scale = function (_) {
return arguments.length ? (k = +_, recenter()) : k;
};
@@ -26283,19 +26338,19 @@
projection.translate = function (_) {
return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y];
};
projection.center = function (_) {
- return arguments.length ? (lambda = _[0] % 360 * radians$1, phi = _[1] % 360 * radians$1, recenter()) : [lambda * degrees$2, phi * degrees$2];
+ return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
};
projection.rotate = function (_) {
- return arguments.length ? (deltaLambda = _[0] % 360 * radians$1, deltaPhi = _[1] % 360 * radians$1, deltaGamma = _.length > 2 ? _[2] % 360 * radians$1 : 0, recenter()) : [deltaLambda * degrees$2, deltaPhi * degrees$2, deltaGamma * degrees$2];
+ return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
};
projection.angle = function (_) {
- return arguments.length ? (alpha = _ % 360 * radians$1, recenter()) : alpha * degrees$2;
+ return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees;
};
projection.reflectX = function (_) {
return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0;
};
@@ -26303,11 +26358,11 @@
projection.reflectY = function (_) {
return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0;
};
projection.precision = function (_) {
- return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$2(delta2);
+ return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt$1(delta2);
};
projection.fitExtent = function (extent, object) {
return fitExtent(projection, extent, object);
};
@@ -26346,16 +26401,16 @@
};
}
function conicProjection(projectAt) {
var phi0 = 0,
- phi1 = pi$2 / 3,
+ phi1 = pi$1 / 3,
m = projectionMutator(projectAt),
p = m(phi0, phi1);
p.parallels = function (_) {
- return arguments.length ? m(phi0 = _[0] * radians$1, phi1 = _[1] * radians$1) : [phi0 * degrees$2, phi1 * degrees$2];
+ return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees];
};
return p;
}
@@ -26375,23 +26430,23 @@
function conicEqualAreaRaw(y0, y1) {
var sy0 = sin$1(y0),
n = (sy0 + sin$1(y1)) / 2; // Are the parallels symmetrical around the Equator?
- if (abs$1(n) < epsilon$3) return cylindricalEqualAreaRaw(y0);
+ if (abs$1(n) < epsilon$2) return cylindricalEqualAreaRaw(y0);
var c = 1 + sy0 * (2 * n - sy0),
- r0 = sqrt$2(c) / n;
+ r0 = sqrt$1(c) / n;
function project(x, y) {
- var r = sqrt$2(c - 2 * n * sin$1(y)) / n;
+ var r = sqrt$1(c - 2 * n * sin$1(y)) / n;
return [r * sin$1(x *= n), r0 - r * cos$1(x)];
}
project.invert = function (x, y) {
var r0y = r0 - y,
- l = atan2$1(x, abs$1(r0y)) * sign$1(r0y);
- if (r0y * n < 0) l -= pi$2 * sign$1(x) * sign$1(r0y);
+ l = atan2(x, abs$1(r0y)) * sign(r0y);
+ if (r0y * n < 0) l -= pi$1 * sign(x) * sign(r0y);
return [l / n, asin$1((c - (x * x + r0y * r0y) * n * n) / (2 * n))];
};
return project;
}
@@ -26498,12 +26553,12 @@
if (!arguments.length) return lower48.translate();
var k = lower48.scale(),
x = +_[0],
y = +_[1];
lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream);
- alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon$3, y + 0.120 * k + epsilon$3], [x - 0.214 * k - epsilon$3, y + 0.234 * k - epsilon$3]]).stream(pointStream);
- hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon$3, y + 0.166 * k + epsilon$3], [x - 0.115 * k - epsilon$3, y + 0.234 * k - epsilon$3]]).stream(pointStream);
+ alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon$2, y + 0.120 * k + epsilon$2], [x - 0.214 * k - epsilon$2, y + 0.234 * k - epsilon$2]]).stream(pointStream);
+ hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon$2, y + 0.166 * k + epsilon$2], [x - 0.115 * k - epsilon$2, y + 0.234 * k - epsilon$2]]).stream(pointStream);
return reset();
};
albersUsa.fitExtent = function (extent, object) {
return fitExtent(albersUsa, extent, object);
@@ -26538,51 +26593,51 @@
return [k * cy * sin$1(x), k * sin$1(y)];
};
}
function azimuthalInvert(angle) {
return function (x, y) {
- var z = sqrt$2(x * x + y * y),
+ var z = sqrt$1(x * x + y * y),
c = angle(z),
sc = sin$1(c),
cc = cos$1(c);
- return [atan2$1(x * sc, z * cc), asin$1(z && y * sc / z)];
+ return [atan2(x * sc, z * cc), asin$1(z && y * sc / z)];
};
}
var azimuthalEqualAreaRaw = azimuthalRaw(function (cxcy) {
- return sqrt$2(2 / (1 + cxcy));
+ return sqrt$1(2 / (1 + cxcy));
});
azimuthalEqualAreaRaw.invert = azimuthalInvert(function (z) {
return 2 * asin$1(z / 2);
});
function geoAzimuthalEqualArea () {
- return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3);
+ return projection$1(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3);
}
var azimuthalEquidistantRaw = azimuthalRaw(function (c) {
- return (c = acos$1(c)) && c / sin$1(c);
+ return (c = acos(c)) && c / sin$1(c);
});
azimuthalEquidistantRaw.invert = azimuthalInvert(function (z) {
return z;
});
function geoAzimuthalEquidistant () {
- return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3);
+ return projection$1(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3);
}
function mercatorRaw(lambda, phi) {
- return [lambda, log$4(tan((halfPi$1 + phi) / 2))];
+ return [lambda, log$1(tan((halfPi$1 + phi) / 2))];
}
mercatorRaw.invert = function (x, y) {
- return [x, 2 * atan(exp$2(y)) - halfPi$1];
+ return [x, 2 * atan(exp(y)) - halfPi$1];
};
function geoMercator () {
- return mercatorProjection(mercatorRaw).scale(961 / tau$2);
+ return mercatorProjection(mercatorRaw).scale(961 / tau$1);
}
function mercatorProjection(project) {
- var m = projection(project),
+ var m = projection$1(project),
center = m.center,
scale = m.scale,
translate = m.translate,
clipExtent = m.clipExtent,
x0 = null,
@@ -26605,11 +26660,11 @@
m.clipExtent = function (_) {
return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]];
};
function reclip() {
- var k = pi$2 * scale(),
+ var k = pi$1 * scale(),
t = m(rotation(m.rotate()).invert([0, 0]));
return clipExtent(x0 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]);
}
return reclip();
@@ -26619,31 +26674,31 @@
return tan((halfPi$1 + y) / 2);
}
function conicConformalRaw(y0, y1) {
var cy0 = cos$1(y0),
- n = y0 === y1 ? sin$1(y0) : log$4(cy0 / cos$1(y1)) / log$4(tany(y1) / tany(y0)),
- f = cy0 * pow$3(tany(y0), n) / n;
+ n = y0 === y1 ? sin$1(y0) : log$1(cy0 / cos$1(y1)) / log$1(tany(y1) / tany(y0)),
+ f = cy0 * pow$1(tany(y0), n) / n;
if (!n) return mercatorRaw;
function project(x, y) {
if (f > 0) {
- if (y < -halfPi$1 + epsilon$3) y = -halfPi$1 + epsilon$3;
+ if (y < -halfPi$1 + epsilon$2) y = -halfPi$1 + epsilon$2;
} else {
- if (y > halfPi$1 - epsilon$3) y = halfPi$1 - epsilon$3;
+ if (y > halfPi$1 - epsilon$2) y = halfPi$1 - epsilon$2;
}
- var r = f / pow$3(tany(y), n);
+ var r = f / pow$1(tany(y), n);
return [r * sin$1(n * x), f - r * cos$1(n * x)];
}
project.invert = function (x, y) {
var fy = f - y,
- r = sign$1(n) * sqrt$2(x * x + fy * fy),
- l = atan2$1(x, abs$1(fy)) * sign$1(fy);
- if (fy * n < 0) l -= pi$2 * sign$1(x) * sign$1(fy);
- return [l / n, 2 * atan(pow$3(f / r, 1 / n)) - halfPi$1];
+ r = sign(n) * sqrt$1(x * x + fy * fy),
+ l = atan2(x, abs$1(fy)) * sign(fy);
+ if (fy * n < 0) l -= pi$1 * sign(x) * sign(fy);
+ return [l / n, 2 * atan(pow$1(f / r, 1 / n)) - halfPi$1];
};
return project;
}
function geoConicConformal () {
@@ -26653,30 +26708,30 @@
function equirectangularRaw(lambda, phi) {
return [lambda, phi];
}
equirectangularRaw.invert = equirectangularRaw;
function geoEquirectangular () {
- return projection(equirectangularRaw).scale(152.63);
+ return projection$1(equirectangularRaw).scale(152.63);
}
function conicEquidistantRaw(y0, y1) {
var cy0 = cos$1(y0),
n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0),
g = cy0 / n + y0;
- if (abs$1(n) < epsilon$3) return equirectangularRaw;
+ if (abs$1(n) < epsilon$2) return equirectangularRaw;
function project(x, y) {
var gy = g - y,
nx = n * x;
return [gy * sin$1(nx), g - gy * cos$1(nx)];
}
project.invert = function (x, y) {
var gy = g - y,
- l = atan2$1(x, abs$1(gy)) * sign$1(gy);
- if (gy * n < 0) l -= pi$2 * sign$1(x) * sign$1(gy);
- return [l / n, g - sign$1(n) * sqrt$2(x * x + gy * gy)];
+ l = atan2(x, abs$1(gy)) * sign(gy);
+ if (gy * n < 0) l -= pi$1 * sign(x) * sign(gy);
+ return [l / n, g - sign(n) * sqrt$1(x * x + gy * gy)];
};
return project;
}
function geoConicEquidistant () {
@@ -26685,11 +26740,11 @@
var A1 = 1.340264,
A2 = -0.081106,
A3 = 0.000893,
A4 = 0.003796,
- M = sqrt$2(3) / 2,
+ M = sqrt$1(3) / 2,
iterations = 12;
function equalEarthRaw(lambda, phi) {
var l = asin$1(M * sin$1(phi)),
l2 = l * l,
l6 = l2 * l2 * l2;
@@ -26703,28 +26758,28 @@
for (var i = 0, delta, fy, fpy; i < iterations; ++i) {
fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y;
fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2);
l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2;
- if (abs$1(delta) < epsilon2$1) break;
+ if (abs$1(delta) < epsilon2) break;
}
return [M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), asin$1(sin$1(l) / M)];
};
function geoEqualEarth () {
- return projection(equalEarthRaw).scale(177.158);
+ return projection$1(equalEarthRaw).scale(177.158);
}
function gnomonicRaw(x, y) {
var cy = cos$1(y),
k = cos$1(x) * cy;
return [cy * sin$1(x) / k, sin$1(y) / k];
}
gnomonicRaw.invert = azimuthalInvert(atan);
function geoGnomonic () {
- return projection(gnomonicRaw).scale(144.049).clipAngle(60);
+ return projection$1(gnomonicRaw).scale(144.049).clipAngle(60);
}
function geoIdentity () {
var k = 1,
tx = 0,
@@ -26741,17 +26796,17 @@
x1,
y1,
// clip extent
kx = 1,
ky = 1,
- transform = transformer$3({
+ transform = transformer({
point: function (x, y) {
var p = projection([x, y]);
this.stream.point(p[0], p[1]);
}
}),
- postclip = identity$6,
+ postclip = identity,
cache,
cacheStream;
function reset() {
kx = k * sx;
@@ -26793,11 +26848,11 @@
projection.postclip = function (_) {
return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
};
projection.clipExtent = function (_) {
- return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity$6) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
+ return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]];
};
projection.scale = function (_) {
return arguments.length ? (k = +_, reset()) : k;
};
@@ -26805,11 +26860,11 @@
projection.translate = function (_) {
return arguments.length ? (tx = +_[0], ty = +_[1], reset()) : [tx, ty];
};
projection.angle = function (_) {
- return arguments.length ? (alpha = _ % 360 * radians$1, sa = sin$1(alpha), ca = cos$1(alpha), reset()) : alpha * degrees$2;
+ return arguments.length ? (alpha = _ % 360 * radians, sa = sin$1(alpha), ca = cos$1(alpha), reset()) : alpha * degrees;
};
projection.reflectX = function (_) {
return arguments.length ? (sx = _ ? -1 : 1, reset()) : sx < 0;
};
@@ -26850,25 +26905,25 @@
do {
var phi2 = phi * phi,
phi4 = phi2 * phi2;
phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4)));
- } while (abs$1(delta) > epsilon$3 && --i > 0);
+ } while (abs$1(delta) > epsilon$2 && --i > 0);
return [x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), phi];
};
function geoNaturalEarth1 () {
- return projection(naturalEarth1Raw).scale(175.295);
+ return projection$1(naturalEarth1Raw).scale(175.295);
}
function orthographicRaw(x, y) {
return [cos$1(y) * sin$1(x), sin$1(y)];
}
orthographicRaw.invert = azimuthalInvert(asin$1);
function geoOrthographic () {
- return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$3);
+ return projection$1(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$2);
}
function stereographicRaw(x, y) {
var cy = cos$1(y),
k = 1 + cos$1(x) * cy;
@@ -26876,19 +26931,19 @@
}
stereographicRaw.invert = azimuthalInvert(function (z) {
return 2 * atan(z);
});
function geoStereographic () {
- return projection(stereographicRaw).scale(250).clipAngle(142);
+ return projection$1(stereographicRaw).scale(250).clipAngle(142);
}
function transverseMercatorRaw(lambda, phi) {
- return [log$4(tan((halfPi$1 + phi) / 2)), -lambda];
+ return [log$1(tan((halfPi$1 + phi) / 2)), -lambda];
}
transverseMercatorRaw.invert = function (x, y) {
- return [-y, 2 * atan(exp$2(x)) - halfPi$1];
+ return [-y, 2 * atan(exp(x)) - halfPi$1];
};
function geoTransverseMercator () {
var m = mercatorProjection(transverseMercatorRaw),
center = m.center,
@@ -26903,47 +26958,47 @@
};
return rotate([0, 0, 90]).scale(159.155);
}
- var abs$2 = Math.abs;
- var cos$2 = Math.cos;
- var sin$2 = Math.sin;
- var epsilon$4 = 1e-6;
- var pi$3 = Math.PI;
- var halfPi$2 = pi$3 / 2;
- var sqrt2 = sqrt$3(2);
- function asin$2(x) {
- return x > 1 ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x);
+ var abs = Math.abs;
+ var cos = Math.cos;
+ var sin = Math.sin;
+ var epsilon$1 = 1e-6;
+ var pi = Math.PI;
+ var halfPi = pi / 2;
+ var sqrt2 = sqrt(2);
+ function asin(x) {
+ return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x);
}
- function sqrt$3(x) {
+ function sqrt(x) {
return x > 0 ? Math.sqrt(x) : 0;
}
function mollweideBromleyTheta(cp, phi) {
- var cpsinPhi = cp * sin$2(phi),
+ var cpsinPhi = cp * sin(phi),
i = 30,
delta;
- do phi -= delta = (phi + sin$2(phi) - cpsinPhi) / (1 + cos$2(phi)); while (abs$2(delta) > epsilon$4 && --i > 0);
+ do phi -= delta = (phi + sin(phi) - cpsinPhi) / (1 + cos(phi)); while (abs(delta) > epsilon$1 && --i > 0);
return phi / 2;
}
function mollweideBromleyRaw(cx, cy, cp) {
function forward(lambda, phi) {
- return [cx * lambda * cos$2(phi = mollweideBromleyTheta(cp, phi)), cy * sin$2(phi)];
+ return [cx * lambda * cos(phi = mollweideBromleyTheta(cp, phi)), cy * sin(phi)];
}
forward.invert = function (x, y) {
- return y = asin$2(y / cy), [x / (cx * cos$2(y)), asin$2((2 * y + sin$2(2 * y)) / cp)];
+ return y = asin(y / cy), [x / (cx * cos(y)), asin((2 * y + sin(2 * y)) / cp)];
};
return forward;
}
- var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi$2, sqrt2, pi$3);
+ var mollweideRaw = mollweideBromleyRaw(sqrt2 / halfPi, sqrt2, pi);
function geoMollweide () {
- return projection(mollweideRaw).scale(169.529);
+ return projection$1(mollweideRaw).scale(169.529);
}
const defaultPath = geoPath();
const projectionProperties = [// standard properties in d3-geo
'clipAngle', 'clipExtent', 'scale', 'translate', 'center', 'rotate', 'parallels', 'precision', 'reflectX', 'reflectY', // extended properties in d3-geo-projections
@@ -26969,11 +27024,11 @@
return p;
};
}
- function projection$1(type, proj) {
+ function projection(type, proj) {
if (!type || typeof type !== 'string') {
throw new Error('Projection type must be a name string.');
}
type = type.toLowerCase();
@@ -27010,14 +27065,14 @@
stereographic: geoStereographic,
transversemercator: geoTransverseMercator
};
for (const key in projections) {
- projection$1(key, projections[key]);
+ projection(key, projections[key]);
}
- function noop$3() {}
+ function noop$1() {}
const cases = [[], [[[1.0, 1.5], [0.5, 1.0]]], [[[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [0.5, 1.0]]], [[[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 1.5], [0.5, 1.0]], [[1.0, 0.5], [1.5, 1.0]]], [[[1.0, 0.5], [1.0, 1.5]]], [[[1.0, 0.5], [0.5, 1.0]]], [[[0.5, 1.0], [1.0, 0.5]]], [[[1.0, 1.5], [1.0, 0.5]]], [[[0.5, 1.0], [1.0, 0.5]], [[1.5, 1.0], [1.0, 1.5]]], [[[1.5, 1.0], [1.0, 0.5]]], [[[0.5, 1.0], [1.5, 1.0]]], [[[1.0, 1.5], [1.5, 1.0]]], [[[0.5, 1.0], [1.0, 1.5]]], []]; // Implementation adapted from d3/d3-contour. Thanks!
function contours() {
var dx = 1,
@@ -27033,11 +27088,11 @@
function contour(values, value) {
var polygons = [],
holes = [];
isorings(values, value, ring => {
smooth(ring, values, value);
- if (area$3(ring) > 0) polygons.push([ring]);else holes.push(ring);
+ if (area(ring) > 0) polygons.push([ring]);else holes.push(ring);
});
holes.forEach(hole => {
for (var i = 0, n = polygons.length, polygon; i < n; ++i) {
if (contains((polygon = polygons[i])[0], hole) !== -1) {
polygon.push(hole);
@@ -27196,17 +27251,17 @@
if (!(_0 >= 0 && _1 >= 0)) error('invalid size');
return dx = _0, dy = _1, contours;
};
contours.smooth = function (_) {
- return arguments.length ? (smooth = _ ? smoothLinear : noop$3, contours) : smooth === smoothLinear;
+ return arguments.length ? (smooth = _ ? smoothLinear : noop$1, contours) : smooth === smoothLinear;
};
return contours;
}
- function area$3(ring) {
+ function area(ring) {
var i = 0,
n = ring.length,
area = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1];
while (++i < n) area += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1];
@@ -27243,29 +27298,29 @@
return contains;
}
function segmentContains(a, b, c) {
var i;
- return collinear(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]);
+ return collinear$1(a, b, c) && within(a[i = +(a[0] === b[0])], c[i], b[i]);
}
- function collinear(a, b, c) {
+ function collinear$1(a, b, c) {
return (b[0] - a[0]) * (c[1] - a[1]) === (c[0] - a[0]) * (b[1] - a[1]);
}
function within(p, q, r) {
return p <= q && q <= r || r <= q && q <= p;
}
- function quantize$2(k, nice, zero) {
+ function quantize(k, nice, zero) {
return function (values) {
var ex = extent(values),
start = zero ? Math.min(ex[0], 0) : ex[0],
stop = ex[1],
span = stop - start,
step = nice ? tickStep(start, stop, k) : span / (k + 1);
- return range$1(start + step, stop, step);
+ return range$1$1(start + step, stop, step);
};
}
/**
* Generate isocontours (level sets) based on input raster grid data.
* @constructor
@@ -27354,11 +27409,11 @@
return pulse.StopPropagation;
}
var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
source = pulse.materialize(pulse.SOURCE).source,
- field = _.field || identity,
+ field = _.field || identity$6,
contour = contours().smooth(_.smooth !== false),
tz = _.thresholds || levels(source, field, _),
as = _.as === null ? null : _.as || 'contour',
values = [];
source.forEach(t => {
@@ -27367,11 +27422,11 @@
const paths = contour.size([grid.width, grid.height])(grid.values, isArray(tz) ? tz : tz(grid.values)); // adjust contour path coordinates as needed
transformPaths(paths, grid, t, _); // ingest; copy source data properties to output
paths.forEach(p => {
- values.push(rederive(t, ingest(as != null ? {
+ values.push(rederive(t, ingest$1(as != null ? {
[as]: p
} : p)));
});
});
if (this.value) out.rem = this.value;
@@ -27380,28 +27435,28 @@
}
});
function levels(values, f, _) {
- const q = quantize$2(_.levels || 10, _.nice, _.zero !== false);
- return _.resolve !== 'shared' ? q : q(values.map(t => max(f(t).values)));
+ const q = quantize(_.levels || 10, _.nice, _.zero !== false);
+ return _.resolve !== 'shared' ? q : q(values.map(t => max$2(f(t).values)));
}
function transformPaths(paths, grid, datum, _) {
let s = _.scale || grid.scale,
t = _.translate || grid.translate;
if (isFunction(s)) s = s(datum, _);
if (isFunction(t)) t = t(datum, _);
if ((s === 1 || s == null) && !t) return;
- const sx = (isNumber(s) ? s : s[0]) || 1,
- sy = (isNumber(s) ? s : s[1]) || 1,
+ const sx = (isNumber$1(s) ? s : s[0]) || 1,
+ sy = (isNumber$1(s) ? s : s[1]) || 1,
tx = t && t[0] || 0,
ty = t && t[1] || 0;
- paths.forEach(transform$2(grid, sx, sy, tx, ty));
+ paths.forEach(transform$1(grid, sx, sy, tx, ty));
}
- function transform$2(grid, sx, sy, tx, ty) {
+ function transform$1(grid, sx, sy, tx, ty) {
const x1 = grid.x1 || 0,
y1 = grid.y1 || 0,
flip = sx * sy < 0;
function transformPolygon(coordinates) {
@@ -27428,19 +27483,19 @@
function radius(bw, data, f) {
const v = bw >= 0 ? bw : estimateBandwidth(data, f);
return Math.round((Math.sqrt(4 * v * v + 1) - 1) / 2);
}
- function number$4(_) {
- return isFunction(_) ? _ : constant(+_);
+ function number$2(_) {
+ return isFunction(_) ? _ : constant$4(+_);
} // Implementation adapted from d3/d3-contour. Thanks!
function density2D() {
var x = d => d[0],
y = d => d[1],
- weight = one,
+ weight = one$2,
bandwidth = [-1, -1],
dx = 960,
dy = 500,
k = 2; // log2(cellSize)
@@ -27506,19 +27561,19 @@
y2: oy + (dy >> k)
};
}
density.x = function (_) {
- return arguments.length ? (x = number$4(_), density) : x;
+ return arguments.length ? (x = number$2(_), density) : x;
};
density.y = function (_) {
- return arguments.length ? (y = number$4(_), density) : y;
+ return arguments.length ? (y = number$2(_), density) : y;
};
density.weight = function (_) {
- return arguments.length ? (weight = number$4(_), density) : weight;
+ return arguments.length ? (weight = number$2(_), density) : weight;
};
density.size = function (_) {
if (!arguments.length) return [dx, dy];
@@ -27536,11 +27591,11 @@
return density;
};
density.bandwidth = function (_) {
if (!arguments.length) return bandwidth;
- _ = array(_);
+ _ = array$5(_);
if (_.length === 1) _ = [+_[0], +_[0]];
if (_.length !== 2) error('invalid bandwidth');
return bandwidth = _, density;
};
@@ -27673,11 +27728,11 @@
inherits(KDE2D, Transform, {
transform(_, pulse) {
if (this.value && !pulse.changed() && !_.modified()) return pulse.StopPropagation;
var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
source = pulse.materialize(pulse.SOURCE).source,
- groups = partition$3(source, _.groupby),
+ groups = partition$2(source, _.groupby),
names = (_.groupby || []).map(accessorName),
kde = params(density2D(), _),
as = _.as || 'grid',
values = [];
@@ -27686,21 +27741,21 @@
return t;
} // generate density raster grids
- values = groups.map(g => ingest(set({
+ values = groups.map(g => ingest$1(set({
[as]: kde(g, _.counts)
}, g.dims)));
if (this.value) out.rem = this.value;
this.value = out.source = out.add = values;
return out;
}
});
- function partition$3(data, groupby) {
+ function partition$2(data, groupby) {
var groups = [],
get = f => f(t),
map,
i,
n,
@@ -27816,28 +27871,28 @@
}
var out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS),
contour = contours().smooth(_.smooth !== false),
values = _.values,
- thresh = _.thresholds || quantize$2(_.count || 10, _.nice, !!values),
+ thresh = _.thresholds || quantize(_.count || 10, _.nice, !!values),
size = _.size,
grid,
post;
if (!values) {
values = pulse.materialize(pulse.SOURCE).source;
grid = params(density2D(), _)(values, true);
- post = transform$2(grid, grid.scale || 1, grid.scale || 1, 0, 0);
+ post = transform$1(grid, grid.scale || 1, grid.scale || 1, 0, 0);
size = [grid.width, grid.height];
values = grid.values;
}
thresh = isArray(thresh) ? thresh : thresh(values);
values = contour.size(size)(values, thresh);
if (post) values.forEach(post);
if (this.value) out.rem = this.value;
- this.value = out.source = out.add = (values || []).map(ingest);
+ this.value = out.source = out.add = (values || []).map(ingest$1);
return out;
}
});
const Feature = 'Feature';
@@ -27878,11 +27933,11 @@
var features = this._features,
points = this._points,
fields = _.fields,
lon = fields && fields[0],
lat = fields && fields[1],
- geojson = _.geojson || !fields && identity,
+ geojson = _.geojson || !fields && identity$6,
flag = pulse.ADD,
mod;
mod = _.modified() || pulse.changed(pulse.REM) || pulse.modified(accessorFields(geojson)) || lon && pulse.modified(accessorFields(lon)) || lat && pulse.modified(accessorFields(lat));
if (!this.value || mod) {
@@ -27959,20 +28014,20 @@
};
inherits(GeoPath, Transform, {
transform(_, pulse) {
var out = pulse.fork(pulse.ALL),
path = this.value,
- field = _.field || identity,
+ field = _.field || identity$6,
as = _.as || 'path',
flag = out.SOURCE;
if (!path || _.modified()) {
// parameters updated, reset and reflow
this.value = path = getProjectionPath(_.projection);
out.materialize().reflow();
} else {
- flag = field === identity || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD;
+ flag = field === identity$6 || pulse.modified(field.fields) ? out.ADD_MOD : out.ADD;
}
const prev = initPath(path, _.pointRadius);
out.visit(flag, t => t[as] = path(field(t)));
path.pointRadius(prev);
@@ -28111,11 +28166,11 @@
as = _.as || 'shape',
flag = out.ADD;
if (!shape || _.modified()) {
// parameters updated, reset and reflow
- this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || field('datum'), _.pointRadius);
+ this.value = shape = shapeGenerator(getProjectionPath(_.projection), _.field || field$1('datum'), _.pointRadius);
out.materialize().reflow();
flag = out.SOURCE;
}
out.visit(flag, t => t[as] = shape);
@@ -28224,13 +28279,13 @@
}
t = gen();
if (src.length) {
- pulse.mod.push(replace(src[0], t));
+ pulse.mod.push(replace$1(src[0], t));
} else {
- pulse.add.push(ingest(t));
+ pulse.add.push(ingest$1(t));
}
src[0] = t;
return pulse;
}
@@ -28293,45 +28348,45 @@
return pulse.StopPropagation;
}
var source = pulse.materialize(pulse.SOURCE).source,
shared = _.resolve === 'shared',
- field = _.field || identity,
+ field = _.field || identity$6,
opacity = opacity_(_.opacity, _),
color = color_(_.color, _),
as = _.as || 'image',
obj = {
$x: 0,
$y: 0,
$value: 0,
- $max: shared ? max(source.map(t => max(field(t).values))) : 0
+ $max: shared ? max$2(source.map(t => max$2(field(t).values))) : 0
};
source.forEach(t => {
const v = field(t); // build proxy data object
- const o = extend({}, t, obj); // set maximum value if not globally shared
+ const o = extend$1({}, t, obj); // set maximum value if not globally shared
- if (!shared) o.$max = max(v.values || []); // generate canvas image
+ if (!shared) o.$max = max$2(v.values || []); // generate canvas image
// optimize color/opacity if not pixel-dependent
- t[as] = toCanvas(v, o, color.dep ? color : constant(color(o)), opacity.dep ? opacity : constant(opacity(o)));
+ t[as] = toCanvas(v, o, color.dep ? color : constant$4(color(o)), opacity.dep ? opacity : constant$4(opacity(o)));
});
return pulse.reflow(true).modifies(as);
}
}); // get image color function
function color_(color, _) {
let f;
if (isFunction(color)) {
- f = obj => rgb(color(obj, _));
+ f = obj => rgb$1(color(obj, _));
f.dep = dependency(color);
} else {
// default to mid-grey
- f = constant(rgb(color || '#888'));
+ f = constant$4(rgb$1(color || '#888'));
}
return f;
} // get image opacity function
@@ -28342,11 +28397,11 @@
if (isFunction(opacity)) {
f = obj => opacity(obj, _);
f.dep = dependency(opacity);
} else if (opacity) {
- f = constant(opacity);
+ f = constant$4(opacity);
} else {
// default to [0, max] opacity gradient
f = obj => obj.$value / obj.$max || 0;
f.dep = true;
@@ -28369,11 +28424,11 @@
x1 = grid.x1 || 0,
y1 = grid.y1 || 0,
x2 = grid.x2 || n,
y2 = grid.y2 || m,
val = grid.values,
- value = val ? i => val[i] : zero,
+ value = val ? i => val[i] : zero$2,
can = domCanvas(x2 - x1, y2 - y1),
ctx = can.getContext('2d'),
img = ctx.getImageData(0, 0, x2 - x1, y2 - y1),
pix = img.data;
@@ -28399,62 +28454,62 @@
* @constructor
* @param {object} params - The parameters for this operator.
*/
- function Projection(params) {
+ function Projection$1(params) {
Transform.call(this, null, params);
this.modified(true); // always treat as modified
}
- inherits(Projection, Transform, {
+ inherits(Projection$1, Transform, {
transform(_, pulse) {
let proj = this.value;
if (!proj || _.modified('type')) {
- this.value = proj = create$2(_.type);
+ this.value = proj = create(_.type);
projectionProperties.forEach(prop => {
- if (_[prop] != null) set$2(proj, prop, _[prop]);
+ if (_[prop] != null) set$1(proj, prop, _[prop]);
});
} else {
projectionProperties.forEach(prop => {
- if (_.modified(prop)) set$2(proj, prop, _[prop]);
+ if (_.modified(prop)) set$1(proj, prop, _[prop]);
});
}
if (_.pointRadius != null) proj.path.pointRadius(_.pointRadius);
- if (_.fit) fit$1(proj, _);
+ if (_.fit) fit(proj, _);
return pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
}
});
- function fit$1(proj, _) {
+ function fit(proj, _) {
const data = collectGeoJSON(_.fit);
_.extent ? proj.fitExtent(_.extent, data) : _.size ? proj.fitSize(_.size, data) : 0;
}
- function create$2(type) {
- const constructor = projection$1((type || 'mercator').toLowerCase());
+ function create(type) {
+ const constructor = projection((type || 'mercator').toLowerCase());
if (!constructor) error('Unrecognized projection type: ' + type);
return constructor();
}
- function set$2(proj, key, value) {
+ function set$1(proj, key, value) {
if (isFunction(proj[key])) proj[key](value);
}
function collectGeoJSON(data) {
- data = array(data);
+ data = array$5(data);
return data.length === 1 ? data[0] : {
type: FeatureCollection,
features: data.reduce((a, f) => a.concat(featurize(f)), [])
};
}
function featurize(f) {
- return f.type === FeatureCollection ? f.features : array(f).filter(d => d != null).map(d => d.type === Feature ? d : {
+ return f.type === FeatureCollection ? f.features : array$5(f).filter(d => d != null).map(d => d.type === Feature ? d : {
type: Feature,
geometry: d
});
}
@@ -28467,11 +28522,11 @@
geoshape: GeoShape,
graticule: Graticule,
heatmap: Heatmap,
isocontour: Isocontour,
kde2d: KDE2D,
- projection: Projection
+ projection: Projection$1
});
function forceCenter (x, y) {
var nodes,
strength = 1;
@@ -28514,14 +28569,14 @@
}
function tree_add (d) {
const x = +this._x.call(null, d),
y = +this._y.call(null, d);
- return add$3(this.cover(x, y), x, y, d);
+ return add(this.cover(x, y), x, y, d);
}
- function add$3(tree, x, y, d) {
+ function add(tree, x, y, d) {
if (isNaN(x) || isNaN(y)) return tree; // ignore invalid points
var parent,
node = tree._root,
leaf = {
@@ -28589,11 +28644,11 @@
if (x0 > x1 || y0 > y1) return this; // Expand the tree to cover the new points.
this.cover(x0, y0).cover(x1, y1); // Add the new points.
for (i = 0; i < n; ++i) {
- add$3(this, xz[i], yz[i], data[i]);
+ add(this, xz[i], yz[i], data[i]);
}
return this;
}
@@ -28610,41 +28665,41 @@
if (isNaN(x0)) {
x1 = (x0 = Math.floor(x)) + 1;
y1 = (y0 = Math.floor(y)) + 1;
} // Otherwise, double repeatedly to cover.
else {
- var z = x1 - x0 || 1,
- node = this._root,
- parent,
- i;
+ var z = x1 - x0 || 1,
+ node = this._root,
+ parent,
+ i;
- while (x0 > x || x >= x1 || y0 > y || y >= y1) {
- i = (y < y0) << 1 | x < x0;
- parent = new Array(4), parent[i] = node, node = parent, z *= 2;
+ while (x0 > x || x >= x1 || y0 > y || y >= y1) {
+ i = (y < y0) << 1 | x < x0;
+ parent = new Array(4), parent[i] = node, node = parent, z *= 2;
- switch (i) {
- case 0:
- x1 = x0 + z, y1 = y0 + z;
- break;
+ switch (i) {
+ case 0:
+ x1 = x0 + z, y1 = y0 + z;
+ break;
- case 1:
- x0 = x1 - z, y1 = y0 + z;
- break;
+ case 1:
+ x0 = x1 - z, y1 = y0 + z;
+ break;
- case 2:
- x1 = x0 + z, y0 = y1 - z;
- break;
+ case 2:
+ x1 = x0 + z, y0 = y1 - z;
+ break;
- case 3:
- x0 = x1 - z, y0 = y1 - z;
- break;
- }
+ case 3:
+ x0 = x1 - z, y0 = y1 - z;
+ break;
}
-
- if (this._root && this._root.length) this._root = node;
}
+ if (this._root && this._root.length) this._root = node;
+ }
+
this._x0 = x0;
this._y0 = y0;
this._x1 = x1;
this._y1 = y1;
return this;
@@ -28705,21 +28760,21 @@
quads[quads.length - 1] = quads[quads.length - 1 - i];
quads[quads.length - 1 - i] = q;
}
} // Visit this point. (Visiting coincident points isn’t necessary!)
else {
- var dx = x - +this._x.call(null, node.data),
- dy = y - +this._y.call(null, node.data),
- d2 = dx * dx + dy * dy;
+ var dx = x - +this._x.call(null, node.data),
+ dy = y - +this._y.call(null, node.data),
+ d2 = dx * dx + dy * dy;
- if (d2 < radius) {
- var d = Math.sqrt(radius = d2);
- x0 = x - d, y0 = y - d;
- x3 = x + d, y3 = y + d;
- data = node.data;
- }
+ if (d2 < radius) {
+ var d = Math.sqrt(radius = d2);
+ x0 = x - d, y0 = y - d;
+ x3 = x + d, y3 = y + d;
+ data = node.data;
}
+ }
}
return data;
}
@@ -28930,35 +28985,35 @@
treeProto.visit = tree_visit;
treeProto.visitAfter = tree_visitAfter;
treeProto.x = tree_x;
treeProto.y = tree_y;
- function constant$3 (x) {
+ function constant$1 (x) {
return function () {
return x;
};
}
function jiggle (random) {
return (random() - 0.5) * 1e-6;
}
- function x$2(d) {
+ function x$1(d) {
return d.x + d.vx;
}
- function y$2(d) {
+ function y$1(d) {
return d.y + d.vy;
}
function forceCollide (radius) {
var nodes,
radii,
random,
strength = 1,
iterations = 1;
- if (typeof radius !== "function") radius = constant$3(radius == null ? 1 : +radius);
+ if (typeof radius !== "function") radius = constant$1(radius == null ? 1 : +radius);
function force() {
var i,
n = nodes.length,
tree,
@@ -28967,11 +29022,11 @@
yi,
ri,
ri2;
for (var k = 0; k < iterations; ++k) {
- tree = quadtree(nodes, x$2, y$2).visitAfter(prepare);
+ tree = quadtree(nodes, x$1, y$1).visitAfter(prepare);
for (i = 0; i < n; ++i) {
node = nodes[i];
ri = radii[node.index], ri2 = ri * ri;
xi = node.x + node.vx;
@@ -29042,31 +29097,31 @@
force.strength = function (_) {
return arguments.length ? (strength = +_, force) : strength;
};
force.radius = function (_) {
- return arguments.length ? (radius = typeof _ === "function" ? _ : constant$3(+_), initialize(), force) : radius;
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : radius;
};
return force;
}
- function index(d) {
+ function index$1(d) {
return d.index;
}
function find$1(nodeById, nodeId) {
var node = nodeById.get(nodeId);
if (!node) throw new Error("node not found: " + nodeId);
return node;
}
function forceLink (links) {
- var id = index,
+ var id = index$1,
strength = defaultStrength,
strengths,
- distance = constant$3(30),
+ distance = constant$1(30),
distances,
nodes,
count,
bias,
random,
@@ -29151,21 +29206,21 @@
force.iterations = function (_) {
return arguments.length ? (iterations = +_, force) : iterations;
};
force.strength = function (_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$3(+_), initializeStrength(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force) : strength;
};
force.distance = function (_) {
- return arguments.length ? (distance = typeof _ === "function" ? _ : constant$3(+_), initializeDistance(), force) : distance;
+ return arguments.length ? (distance = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force) : distance;
};
return force;
}
- var noop$4 = {
+ var noop = {
value: () => {}
};
function dispatch() {
for (var i = 0, n = arguments.length, _ = {}, t; i < n; ++i) {
@@ -29201,21 +29256,21 @@
t,
i = -1,
n = T.length; // If no callback was specified, return the callback of the given type and name.
if (arguments.length < 2) {
- while (++i < n) if ((t = (typename = T[i]).type) && (t = get$4(_[t], typename.name))) return t;
+ while (++i < n) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
return;
} // If a type was specified, set the callback for the given type and name.
// Otherwise, if a null callback was specified, remove callbacks of the given name.
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
while (++i < n) {
- if (t = (typename = T[i]).type) _[t] = set$3(_[t], typename.name, callback);else if (callback == null) for (t in _) _[t] = set$3(_[t], typename.name, null);
+ if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);else if (callback == null) for (t in _) _[t] = set(_[t], typename.name, null);
}
return this;
},
copy: function () {
@@ -29237,22 +29292,22 @@
for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
}
};
- function get$4(type, name) {
+ function get(type, name) {
for (var i = 0, n = type.length, c; i < n; ++i) {
if ((c = type[i]).name === name) {
return c.value;
}
}
}
- function set$3(type, name, callback) {
+ function set(type, name, callback) {
for (var i = 0, n = type.length; i < n; ++i) {
if (type[i].name === name) {
- type[i] = noop$4, type = type.slice(0, i).concat(type.slice(i + 1));
+ type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
break;
}
}
if (callback != null) type.push({
@@ -29264,11 +29319,11 @@
var frame = 0,
// is an animation frame pending?
timeout = 0,
// is a timeout pending?
- interval = 0,
+ interval$1 = 0,
// are any timers active?
pokeDelay = 1000,
// how frequently we check for clock skew
taskHead,
taskTail,
@@ -29285,15 +29340,15 @@
function clearNow() {
clockNow = 0;
}
- function Timer() {
+ function Timer$1() {
this._call = this._time = this._next = null;
}
- Timer.prototype = timer.prototype = {
- constructor: Timer,
+ Timer$1.prototype = timer$1.prototype = {
+ constructor: Timer$1,
restart: function (callback, delay, time) {
if (typeof callback !== "function") throw new TypeError("callback is not a function");
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
if (!this._next && taskTail !== this) {
@@ -29311,12 +29366,12 @@
this._time = Infinity;
sleep();
}
}
};
- function timer(callback, delay, time) {
- var t = new Timer();
+ function timer$1(callback, delay, time) {
+ var t = new Timer$1();
t.restart(callback, delay, time);
return t;
}
function timerFlush() {
now(); // Get the current time, if not already set.
@@ -29379,19 +29434,19 @@
if (timeout) timeout = clearTimeout(timeout);
var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
if (delay > 24) {
if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
- if (interval) interval = clearInterval(interval);
+ if (interval$1) interval$1 = clearInterval(interval$1);
} else {
- if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
+ if (!interval$1) clockLast = clock.now(), interval$1 = setInterval(poke, pokeDelay);
frame = 1, setFrame(wake);
}
}
- function interval$1 (callback, delay, time) {
- var t = new Timer(),
+ function interval (callback, delay, time) {
+ var t = new Timer$1(),
total = delay;
if (delay == null) return t.restart(callback, delay, time), t;
t._restart = t.restart;
t.restart = function (callback, delay, time) {
@@ -29413,19 +29468,19 @@
// https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
const a = 1664525;
const c = 1013904223;
const m = 4294967296; // 2^32
- function lcg$1 () {
+ function lcg () {
let s = 1;
return () => (s = (a * s + c) % m) / m;
}
- function x$3(d) {
+ function x(d) {
return d.x;
}
- function y$3(d) {
+ function y(d) {
return d.y;
}
var initialRadius = 10,
initialAngle = Math.PI * (3 - Math.sqrt(5));
function forceSimulation (nodes) {
@@ -29434,13 +29489,13 @@
alphaMin = 0.001,
alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
alphaTarget = 0,
velocityDecay = 0.6,
forces = new Map(),
- stepper = timer(step),
+ stepper = timer$1(step),
event = dispatch("tick", "end"),
- random = lcg$1();
+ random = lcg();
if (nodes == null) nodes = [];
function step() {
tick();
event.call("tick", simulation);
@@ -29559,20 +29614,20 @@
function forceManyBody () {
var nodes,
node,
random,
alpha,
- strength = constant$3(-30),
+ strength = constant$1(-30),
strengths,
distanceMin2 = 1,
distanceMax2 = Infinity,
theta2 = 0.81;
function force(_) {
var i,
n = nodes.length,
- tree = quadtree(nodes, x$3, y$3).visitAfter(accumulate);
+ tree = quadtree(nodes, x, y).visitAfter(accumulate);
for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
}
function initialize() {
@@ -29603,16 +29658,16 @@
quad.x = x / weight;
quad.y = y / weight;
} // For leaf nodes, accumulate forces from coincident quadrants.
else {
- q = quad;
- q.x = q.data.x;
- q.y = q.data.y;
+ q = quad;
+ q.x = q.data.x;
+ q.y = q.data.y;
- do strength += strengths[q.data.index]; while (q = q.next);
- }
+ do strength += strengths[q.data.index]; while (q = q.next);
+ }
quad.value = strength;
}
function apply(quad, x1, _, x2) {
@@ -29655,11 +29710,11 @@
random = _random;
initialize();
};
force.strength = function (_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$3(+_), initialize(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
};
force.distanceMin = function (_) {
return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
};
@@ -29674,15 +29729,15 @@
return force;
}
function forceX (x) {
- var strength = constant$3(0.1),
+ var strength = constant$1(0.1),
nodes,
strengths,
xz;
- if (typeof x !== "function") x = constant$3(x == null ? 0 : +x);
+ if (typeof x !== "function") x = constant$1(x == null ? 0 : +x);
function force(alpha) {
for (var i = 0, n = nodes.length, node; i < n; ++i) {
node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
}
@@ -29704,26 +29759,26 @@
nodes = _;
initialize();
};
force.strength = function (_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$3(+_), initialize(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
};
force.x = function (_) {
- return arguments.length ? (x = typeof _ === "function" ? _ : constant$3(+_), initialize(), force) : x;
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : x;
};
return force;
}
function forceY (y) {
- var strength = constant$3(0.1),
+ var strength = constant$1(0.1),
nodes,
strengths,
yz;
- if (typeof y !== "function") y = constant$3(y == null ? 0 : +y);
+ if (typeof y !== "function") y = constant$1(y == null ? 0 : +y);
function force(alpha) {
for (var i = 0, n = nodes.length, node; i < n; ++i) {
node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
}
@@ -29745,15 +29800,15 @@
nodes = _;
initialize();
};
force.strength = function (_) {
- return arguments.length ? (strength = typeof _ === "function" ? _ : constant$3(+_), initialize(), force) : strength;
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
};
force.y = function (_) {
- return arguments.length ? (y = typeof _ === "function" ? _ : constant$3(+_), initialize(), force) : y;
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : y;
};
return force;
}
@@ -30010,11 +30065,11 @@
return setup(sim, _, true).on('end', () => stopped = true);
}
function setup(sim, _, init, pulse) {
- var f = array(_.forces),
+ var f = array$5(_.forces),
i,
n,
p,
name;
@@ -30048,11 +30103,11 @@
}
function getForce(_) {
var f, p;
- if (!has(ForceMap, _.force)) {
+ if (!has$1(ForceMap, _.force)) {
error('Unrecognized force: ' + _.force);
}
f = ForceMap[_.force]();
@@ -30070,11 +30125,11 @@
var force = /*#__PURE__*/Object.freeze({
__proto__: null,
force: Force
});
- function defaultSeparation(a, b) {
+ function defaultSeparation$2(a, b) {
return a.parent === b.parent ? 1 : 2;
}
function meanX(children) {
return children.reduce(meanXReduce, 0) / children.length;
@@ -30107,11 +30162,11 @@
return node;
}
function cluster () {
- var separation = defaultSeparation,
+ var separation = defaultSeparation$2,
dx = 1,
dy = 1,
nodeSize = false;
function cluster(root) {
@@ -30363,11 +30418,11 @@
if (children === undefined) children = mapChildren;
} else if (children === undefined) {
children = objectChildren;
}
- var root = new Node(data),
+ var root = new Node$1(data),
node,
nodes = [root],
child,
childs,
i,
@@ -30376,11 +30431,11 @@
while (node = nodes.pop()) {
if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {
node.children = childs;
for (i = n - 1; i >= 0; --i) {
- nodes.push(child = childs[i] = new Node(childs[i]));
+ nodes.push(child = childs[i] = new Node$1(childs[i]));
child.parent = node;
child.depth = node.depth + 1;
}
}
}
@@ -30408,17 +30463,17 @@
function computeHeight(node) {
var height = 0;
do node.height = height; while ((node = node.parent) && node.height < ++height);
}
- function Node(data) {
+ function Node$1(data) {
this.data = data;
this.depth = this.height = 0;
this.parent = null;
}
- Node.prototype = hierarchy.prototype = {
- constructor: Node,
+ Node$1.prototype = hierarchy.prototype = {
+ constructor: Node$1,
count: node_count,
each: node_each,
eachAfter: node_eachAfter,
eachBefore: node_eachBefore,
find: node_find,
@@ -30431,11 +30486,11 @@
links: node_links,
copy: node_copy,
[Symbol.iterator]: node_iterator
};
- function array$3 (x) {
+ function array$2 (x) {
return typeof x === "object" && "length" in x ? x // Array, TypedArray, NodeList, array-like
: Array.from(x); // Map, Set, iterable, string, or anything else
}
function shuffle(array) {
var m = array.length,
@@ -30632,35 +30687,35 @@
dx = (a.x * b.r + b.x * a.r) / ab,
dy = (a.y * b.r + b.y * a.r) / ab;
return dx * dx + dy * dy;
}
- function Node$1(circle) {
+ function Node(circle) {
this._ = circle;
this.next = null;
this.previous = null;
}
function packEnclose(circles) {
- if (!(n = (circles = array$3(circles)).length)) return 0;
+ if (!(n = (circles = array$2(circles)).length)) return 0;
var a, b, c, n, aa, ca, i, j, k, sj, sk; // Place the first circle.
a = circles[0], a.x = 0, a.y = 0;
if (!(n > 1)) return a.r; // Place the second circle.
b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;
if (!(n > 2)) return a.r + b.r; // Place the third circle.
place(b, a, c = circles[2]); // Initialize the front-chain using the first three circles a, b and c.
- a = new Node$1(a), b = new Node$1(b), c = new Node$1(c);
+ a = new Node(a), b = new Node(b), c = new Node(c);
a.next = c.previous = b;
b.next = a.previous = c;
c.next = b.previous = a; // Attempt to place each remaining circle…
pack: for (i = 3; i < n; ++i) {
- place(a._, b._, c = circles[i]), c = new Node$1(c); // Find the closest intersecting circle on the front-chain, if any.
+ place(a._, b._, c = circles[i]), c = new Node(c); // Find the closest intersecting circle on the front-chain, if any.
// “Closeness” is determined by linear distance along the front-chain.
// “Ahead” or “behind” is likewise determined by linear distance.
j = b.next, k = a.previous, sj = b._.r, sk = a._.r;
@@ -30717,11 +30772,11 @@
}
function constantZero() {
return 0;
}
- function constant$4 (x) {
+ function constant (x) {
return function () {
return x;
};
}
@@ -30754,11 +30809,11 @@
pack.size = function (x) {
return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];
};
pack.padding = function (x) {
- return arguments.length ? (padding = typeof x === "function" ? x : constant$4(+x), pack) : padding;
+ return arguments.length ? (padding = typeof x === "function" ? x : constant(+x), pack) : padding;
};
return pack;
}
@@ -30816,11 +30871,11 @@
node = nodes[i], node.y0 = y0, node.y1 = y1;
node.x0 = x0, node.x1 = x0 += node.value * k;
}
}
- function partition$4 () {
+ function partition$1 () {
var dx = 1,
dy = 1,
padding = 0,
round = false;
@@ -30896,11 +30951,11 @@
nodeId,
nodeKey,
nodeByKey = new Map();
for (i = 0; i < n; ++i) {
- d = nodes[i], node = nodes[i] = new Node(d);
+ d = nodes[i], node = nodes[i] = new Node$1(d);
if ((nodeId = id(d, i, data)) != null && (nodeId += "")) {
nodeKey = node.id = nodeId;
nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);
}
@@ -31023,11 +31078,11 @@
this.t = null; // thread
this.i = i; // number
}
- TreeNode.prototype = Object.create(Node.prototype);
+ TreeNode.prototype = Object.create(Node$1.prototype);
function treeRoot(root) {
var tree = new TreeNode(root, 0),
node,
nodes = [tree],
@@ -31050,11 +31105,11 @@
(tree.parent = new TreeNode(null, 0)).children = [tree];
return tree;
} // Node-link tree diagram using the Reingold-Tilford "tidy" algorithm
- function tree () {
+ function tree$1 () {
var separation = defaultSeparation$1,
dx = 1,
dy = 1,
nodeSize = null;
@@ -31065,27 +31120,27 @@
t.eachBefore(secondWalk); // If a fixed node size is specified, scale x and y.
if (nodeSize) root.eachBefore(sizeNode); // If a fixed tree size is specified, scale x and y based on the extent.
// Compute the left-most, right-most, and depth-most nodes for extents.
else {
- var left = root,
- right = root,
- bottom = root;
- root.eachBefore(function (node) {
- if (node.x < left.x) left = node;
- if (node.x > right.x) right = node;
- if (node.depth > bottom.depth) bottom = node;
- });
- var s = left === right ? 1 : separation(left, right) / 2,
- tx = s - left.x,
- kx = dx / (right.x + s + tx),
- ky = dy / (bottom.depth || 1);
- root.eachBefore(function (node) {
- node.x = (node.x + tx) * kx;
- node.y = node.depth * ky;
- });
- }
+ var left = root,
+ right = root,
+ bottom = root;
+ root.eachBefore(function (node) {
+ if (node.x < left.x) left = node;
+ if (node.x > right.x) right = node;
+ if (node.depth > bottom.depth) bottom = node;
+ });
+ var s = left === right ? 1 : separation(left, right) / 2,
+ tx = s - left.x,
+ kx = dx / (right.x + s + tx),
+ ky = dy / (bottom.depth || 1);
+ root.eachBefore(function (node) {
+ node.x = (node.x + tx) * kx;
+ node.y = node.depth * ky;
+ });
+ }
return root;
} // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is
// applied recursively to the children of v, as well as the function
// APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the
// node v is placed to the midpoint of its outermost children.
@@ -31339,31 +31394,31 @@
treemap.padding = function (x) {
return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
};
treemap.paddingInner = function (x) {
- return arguments.length ? (paddingInner = typeof x === "function" ? x : constant$4(+x), treemap) : paddingInner;
+ return arguments.length ? (paddingInner = typeof x === "function" ? x : constant(+x), treemap) : paddingInner;
};
treemap.paddingOuter = function (x) {
return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
};
treemap.paddingTop = function (x) {
- return arguments.length ? (paddingTop = typeof x === "function" ? x : constant$4(+x), treemap) : paddingTop;
+ return arguments.length ? (paddingTop = typeof x === "function" ? x : constant(+x), treemap) : paddingTop;
};
treemap.paddingRight = function (x) {
- return arguments.length ? (paddingRight = typeof x === "function" ? x : constant$4(+x), treemap) : paddingRight;
+ return arguments.length ? (paddingRight = typeof x === "function" ? x : constant(+x), treemap) : paddingRight;
};
treemap.paddingBottom = function (x) {
- return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant$4(+x), treemap) : paddingBottom;
+ return arguments.length ? (paddingBottom = typeof x === "function" ? x : constant(+x), treemap) : paddingBottom;
};
treemap.paddingLeft = function (x) {
- return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant$4(+x), treemap) : paddingLeft;
+ return arguments.length ? (paddingLeft = typeof x === "function" ? x : constant(+x), treemap) : paddingLeft;
};
return treemap;
}
@@ -31490,11 +31545,11 @@
'name': 'generate',
'type': 'boolean'
}]
};
- const children = n => n.values;
+ const children$1 = n => n.values;
inherits(Nest, Transform, {
transform(_, pulse) {
if (!pulse.source) {
error('Nest transform requires an upstream data source.');
@@ -31515,20 +31570,20 @@
});
} // generate new tree structure
this.value = tree = hierarchy({
- values: array(_.keys).reduce((n, k) => {
+ values: array$5(_.keys).reduce((n, k) => {
n.key(k);
return n;
}, nest()).entries(out.source)
- }, children); // collect nodes to add
+ }, children$1); // collect nodes to add
if (gen) {
tree.each(node => {
if (node.children) {
- node = ingest(node.data);
+ node = ingest$1(node.data);
out.add.push(node);
out.source.push(node);
}
});
} // build lookup table
@@ -31606,11 +31661,11 @@
function HierarchyLayout(params) {
Transform.call(this, null, params);
}
- const defaultSeparation$2 = (a, b) => a.parent === b.parent ? 1 : 2;
+ const defaultSeparation = (a, b) => a.parent === b.parent ? 1 : 2;
inherits(HierarchyLayout, Transform, {
transform(_, pulse) {
if (!pulse.source || !pulse.source.root) {
error(this.constructor.name + ' transform requires a backing tree data source.');
@@ -31623,11 +31678,11 @@
if (_.field) root.sum(_.field);else root.count();
if (_.sort) root.sort(stableCompare(_.sort, d => d.data));
setParams(layout, this.params, _);
if (layout.separation) {
- layout.separation(_.separation !== false ? defaultSeparation$2 : one);
+ layout.separation(_.separation !== false ? defaultSeparation : one$2);
}
try {
this.value = layout(root);
} catch (err) {
@@ -31656,11 +31711,11 @@
}
t[as[n]] = node.children ? node.children.length : 0;
}
- const Output$1 = ['x', 'y', 'r', 'depth', 'children'];
+ const Output$3 = ['x', 'y', 'r', 'depth', 'children'];
/**
* Packed circle tree layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to size nodes.
@@ -31697,20 +31752,20 @@
'length': 2
}, {
'name': 'as',
'type': 'string',
'array': true,
- 'length': Output$1.length,
- 'default': Output$1
+ 'length': Output$3.length,
+ 'default': Output$3
}]
};
inherits(Pack, HierarchyLayout, {
layout: pack,
params: ['radius', 'size', 'padding'],
- fields: Output$1
+ fields: Output$3
});
- const Output$1$1 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];
+ const Output$2 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];
/**
* Partition tree layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to size nodes.
@@ -31747,18 +31802,18 @@
'length': 2
}, {
'name': 'as',
'type': 'string',
'array': true,
- 'length': Output$1$1.length,
- 'default': Output$1$1
+ 'length': Output$2.length,
+ 'default': Output$2
}]
};
inherits(Partition, HierarchyLayout, {
- layout: partition$4,
+ layout: partition$1,
params: ['size', 'round', 'padding'],
- fields: Output$1$1
+ fields: Output$2
});
/**
* Stratify a collection of tuples into a tree structure based on
* id and parent id fields.
* @constructor
@@ -31809,14 +31864,14 @@
return out;
}
});
const Layouts = {
- tidy: tree,
+ tidy: tree$1,
cluster: cluster
};
- const Output$2 = ['x', 'y', 'depth', 'children'];
+ const Output$1$1 = ['x', 'y', 'depth', 'children'];
/**
* Tree layout. Depending on the method parameter, performs either
* Reingold-Tilford 'tidy' layout or dendrogram 'cluster' layout.
* @constructor
* @param {object} params - The parameters for this operator.
@@ -31859,25 +31914,25 @@
'default': true
}, {
'name': 'as',
'type': 'string',
'array': true,
- 'length': Output$2.length,
- 'default': Output$2
+ 'length': Output$1$1.length,
+ 'default': Output$1$1
}]
};
inherits(Tree, HierarchyLayout, {
/**
* Tree layout generator. Supports both 'tidy' and 'cluster' layouts.
*/
layout(method) {
const m = method || 'tidy';
- if (has(Layouts, m)) return Layouts[m]();else error('Unrecognized Tree layout method: ' + m);
+ if (has$1(Layouts, m)) return Layouts[m]();else error('Unrecognized Tree layout method: ' + m);
},
params: ['size', 'nodeSize'],
- fields: Output$2
+ fields: Output$1$1
});
/**
* Generate tuples representing links between tree nodes.
* The resulting tuples will contain 'source' and 'target' fields,
* which point to parent and child node tuples, respectively.
@@ -31915,11 +31970,11 @@
tree.each(node => {
const t = node.data,
p = node.parent && node.parent.data;
if (p && lut[tupleid(t)] && lut[tupleid(p)]) {
- out.add.push(ingest({
+ out.add.push(ingest$1({
source: p,
target: t
}));
}
});
@@ -31945,11 +32000,11 @@
slice: treemapSlice,
slicedice: treemapSliceDice,
squarify: treemapSquarify,
resquarify: treemapResquarify
};
- const Output$3 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];
+ const Output$4 = ['x0', 'y0', 'x1', 'y1', 'depth', 'children'];
/**
* Treemap layout.
* @constructor
* @param {object} params - The parameters for this operator.
* @param {function(object): *} params.field - The value field to size nodes.
@@ -32019,12 +32074,12 @@
'length': 2
}, {
'name': 'as',
'type': 'string',
'array': true,
- 'length': Output$3.length,
- 'default': Output$3
+ 'length': Output$4.length,
+ 'default': Output$4
}]
};
inherits(Treemap, HierarchyLayout, {
/**
* Treemap layout generator. Adds 'method' and 'ratio' parameters
@@ -32037,21 +32092,21 @@
const t = x.tile();
if (t.ratio) x.tile(t.ratio(_));
};
x.method = _ => {
- if (has(Tiles, _)) x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: ' + _);
+ if (has$1(Tiles, _)) x.tile(Tiles[_]);else error('Unrecognized Treemap layout method: ' + _);
};
return x;
},
params: ['method', 'ratio', 'size', 'round', 'padding', 'paddingInner', 'paddingOuter', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft'],
- fields: Output$3
+ fields: Output$4
});
- var tree$1 = /*#__PURE__*/Object.freeze({
+ var tree = /*#__PURE__*/Object.freeze({
__proto__: null,
nest: Nest,
pack: Pack,
partition: Partition,
stratify: Stratify,
@@ -32077,11 +32132,11 @@
const width = $.width,
height = $.height,
border = labelInside || isGroupArea,
context = domCanvas(width, height).getContext('2d'); // render all marks to be avoided into canvas
- avoidMarks.forEach(items => draw$5(context, items, border)); // get canvas buffer, create bitmaps
+ avoidMarks.forEach(items => draw(context, items, border)); // get canvas buffer, create bitmaps
const buffer = new Uint32Array(context.getImageData(0, 0, width, height).data.buffer),
layer1 = $.bitmap(),
layer2 = border && $.bitmap(); // populate bitmap layers
@@ -32102,17 +32157,17 @@
}
return [layer1, layer2];
}
- function draw$5(context, items, interior) {
+ function draw(context, items, interior) {
if (!items.length) return;
const type = items[0].mark.marktype;
if (type === 'group') {
items.forEach(group => {
- group.items.forEach(mark => draw$5(context, mark.items, interior));
+ group.items.forEach(mark => draw(context, mark.items, interior));
});
} else {
Marks[type].draw(context, {
items: interior ? items.map(prepare) : items
});
@@ -32142,11 +32197,11 @@
return item;
}
const DIV = 5,
// bit shift from x, y index to bit vector array index
- MOD$1 = 31,
+ MOD = 31,
// bit mask for index lookup within a bit vector
SIZE = 32,
// individual bit vector size
RIGHT0 = new Uint32Array(SIZE + 1),
// left-anchored bit vectors, full -> 0
@@ -32173,21 +32228,21 @@
return {
array: array,
get: (x, y) => {
const index = y * w + x;
- return array[index >>> DIV] & 1 << (index & MOD$1);
+ return array[index >>> DIV] & 1 << (index & MOD);
},
set: (x, y) => {
const index = y * w + x;
- _set(index >>> DIV, 1 << (index & MOD$1));
+ _set(index >>> DIV, 1 << (index & MOD));
},
clear: (x, y) => {
const index = y * w + x;
- _clear(index >>> DIV, ~(1 << (index & MOD$1)));
+ _clear(index >>> DIV, ~(1 << (index & MOD)));
},
getRange: (x, y, x2, y2) => {
let r = y2,
start,
end,
@@ -32199,16 +32254,16 @@
end = r * w + x2;
indexStart = start >>> DIV;
indexEnd = end >>> DIV;
if (indexStart === indexEnd) {
- if (array[indexStart] & RIGHT0[start & MOD$1] & RIGHT1[(end & MOD$1) + 1]) {
+ if (array[indexStart] & RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]) {
return true;
}
} else {
- if (array[indexStart] & RIGHT0[start & MOD$1]) return true;
- if (array[indexEnd] & RIGHT1[(end & MOD$1) + 1]) return true;
+ if (array[indexStart] & RIGHT0[start & MOD]) return true;
+ if (array[indexEnd] & RIGHT1[(end & MOD) + 1]) return true;
for (let i = indexStart + 1; i < indexEnd; ++i) {
if (array[i]) return true;
}
}
@@ -32224,15 +32279,15 @@
end = y * w + x2;
indexStart = start >>> DIV;
indexEnd = end >>> DIV;
if (indexStart === indexEnd) {
- _set(indexStart, RIGHT0[start & MOD$1] & RIGHT1[(end & MOD$1) + 1]);
+ _set(indexStart, RIGHT0[start & MOD] & RIGHT1[(end & MOD) + 1]);
} else {
- _set(indexStart, RIGHT0[start & MOD$1]);
+ _set(indexStart, RIGHT0[start & MOD]);
- _set(indexEnd, RIGHT1[(end & MOD$1) + 1]);
+ _set(indexEnd, RIGHT1[(end & MOD) + 1]);
for (i = indexStart + 1; i < indexEnd; ++i) _set(i, 0xffffffff);
}
}
},
@@ -32244,15 +32299,15 @@
end = y * w + x2;
indexStart = start >>> DIV;
indexEnd = end >>> DIV;
if (indexStart === indexEnd) {
- _clear(indexStart, RIGHT1[start & MOD$1] | RIGHT0[(end & MOD$1) + 1]);
+ _clear(indexStart, RIGHT1[start & MOD] | RIGHT0[(end & MOD) + 1]);
} else {
- _clear(indexStart, RIGHT1[start & MOD$1]);
+ _clear(indexStart, RIGHT1[start & MOD]);
- _clear(indexEnd, RIGHT0[(end & MOD$1) + 1]);
+ _clear(indexEnd, RIGHT0[(end & MOD) + 1]);
for (i = indexStart + 1; i < indexEnd; ++i) _clear(i, 0);
}
}
},
@@ -32344,22 +32399,44 @@
function outOfBounds(x, y, textWidth, textHeight, width, height) {
let r = textWidth / 2;
return x - r < 0 || x + r > width || y - (r = textHeight / 2) < 0 || y + r > height;
}
+ function _outOfBounds() {
+ return false;
+ }
+
function collision($, x, y, textHeight, textWidth, h, bm0, bm1) {
const w = textWidth * h / (textHeight * 2),
x1 = $(x - w),
x2 = $(x + w),
y1 = $(y - (h = h / 2)),
y2 = $(y + h);
return bm0.outOfBounds(x1, y1, x2, y2) || bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2);
}
- function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex) {
+ function _collision($, x, y, textHeight, textWidth, h, bm0, bm1) {
+ const w = textWidth * h / (textHeight * 2);
+ let x1 = $(x - w),
+ x2 = $(x + w),
+ y1 = $(y - (h = h / 2)),
+ y2 = $(y + h);
+ x1 = x1 > 0 ? x1 : 0;
+ y1 = y1 > 0 ? y1 : 0;
+ x2 = x2 < $.width ? x2 : $.width - 1;
+ y2 = y2 < $.height ? y2 : $.height - 1;
+ return bm0.getRange(x1, y1, x2, y2) || bm1 && bm1.getRange(x1, y1, x2, y2);
+ }
+
+ function getTests(infPadding) {
+ return infPadding ? [_collision, _outOfBounds] : [collision, outOfBounds];
+ }
+
+ function placeAreaLabelReducedSearch($, bitmaps, avoidBaseMark, markIndex, infPadding) {
const width = $.width,
height = $.height,
+ [collision, outOfBounds] = getTests(infPadding),
bm0 = bitmaps[0],
// where labels have been placed
bm1 = bitmaps[1]; // area outlines
function tryLabel(_x, _y, maxSize, textWidth, textHeight) {
@@ -32500,13 +32577,14 @@
}
const X_DIR = [-1, -1, 1, 1];
const Y_DIR = [-1, 1, -1, 1];
- function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex) {
+ function placeAreaLabelFloodFill($, bitmaps, avoidBaseMark, markIndex, infPadding) {
const width = $.width,
height = $.height,
+ [collision, outOfBounds] = getTests(infPadding),
bm0 = bitmaps[0],
// where labels have been placed
bm1 = bitmaps[1],
// area outlines
bm2 = $.bitmap(); // flood-fill visitations
@@ -32624,21 +32702,21 @@
}
const Aligns = ['right', 'center', 'left'],
Baselines = ['bottom', 'middle', 'top'];
- function placeMarkLabel($, bitmaps, anchors, offsets) {
+ function placeMarkLabel($, bitmaps, anchors, offsets, infPadding) {
const width = $.width,
height = $.height,
bm0 = bitmaps[0],
bm1 = bitmaps[1],
n = offsets.length;
return function (d) {
const boundary = d.boundary,
textHeight = d.datum.fontSize; // can not be placed if the mark is not visible in the graph bound
- if (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height) {
+ if (!infPadding && (boundary[2] < 0 || boundary[5] < 0 || boundary[0] > width || boundary[3] > height)) {
return false;
}
let textWidth = 0,
dx,
@@ -32670,10 +32748,16 @@
y2 = yc + textHeight / 2;
_x1 = $(x1);
_y1 = $(y1);
_y2 = $(y2);
+ if (infPadding) {
+ _x1 = _x1 < 0 ? 0 : _x1;
+ _y1 = _y1 < 0 ? 0 : _y1;
+ _y2 = _y2 >= $.height ? $.height - 1 : _y2;
+ }
+
if (!textWidth) {
// to avoid finding width of text label,
if (!test(_x1, _x1, _y1, _y2, bm0, bm1, x1, x1, y1, y2, boundary, isInside)) {
// skip this anchor/offset option if we fail to place a label with 1px width
continue;
@@ -32687,10 +32771,15 @@
x1 = xc - textWidth / 2;
x2 = xc + textWidth / 2;
_x1 = $(x1);
_x2 = $(x2);
+ if (infPadding) {
+ _x1 = _x1 < 0 ? 0 : _x1;
+ _x2 = _x2 >= $.width ? $.width - 1 : _x2;
+ }
+
if (test(_x1, _x2, _y1, _y2, bm0, bm1, x1, x2, y1, y2, boundary, isInside)) {
// place label if the position is placeable
d.x = !dx ? xc : dx * insideFactor < 0 ? x2 : x1;
d.y = !dy ? yc : dy * insideFactor < 0 ? y2 : y1;
d.align = Aligns[dx * insideFactor + 1];
@@ -32745,11 +32834,12 @@
anchors = getAnchors(anchor, positions),
marktype = markType(texts[0].datum),
grouptype = marktype === 'group' && texts[0].datum.items[markIndex].marktype,
isGroupArea = grouptype === 'area',
boundary = markBoundary(marktype, grouptype, lineAnchor, markIndex),
- $ = scaler(size[0], size[1], padding),
+ infPadding = padding === null || padding === Infinity,
+ $ = scaler(size[0], size[1], infPadding ? 0 : padding),
isNaiveGroupArea = isGroupArea && method === 'naive'; // prepare text mark data for placing
const data = texts.map(d => ({
datum: d,
opacity: 0,
@@ -32785,11 +32875,11 @@
bitmaps = avoidMarks.length ? markBitmaps($, avoidMarks, labelInside, isGroupArea) : baseBitmaps($, avoidBaseMark && data);
} // generate label placement function
- const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex) : placeMarkLabel($, bitmaps, anchors, offsets); // place all labels
+ const place = isGroupArea ? placeAreaLabel[method]($, bitmaps, avoidBaseMark, markIndex, infPadding) : placeMarkLabel($, bitmaps, anchors, offsets, infPadding); // place all labels
data.forEach(d => d.opacity = +place(d));
return data;
}
@@ -32848,11 +32938,11 @@
return [b.x1, (b.x1 + b.x2) / 2, b.x2, b.y1, (b.y1 + b.y2) / 2, b.y2];
};
}
}
- const Output$4 = ['x', 'y', 'opacity', 'align', 'baseline'];
+ const Output$1 = ['x', 'y', 'opacity', 'align', 'baseline'];
const Anchors = ['top-left', 'left', 'bottom-left', 'top', 'bottom', 'top-right', 'right', 'bottom-right'];
/**
* Compute text label layout to annotate marks.
* @constructor
* @param {object} params - The parameters for this operator.
@@ -32861,12 +32951,13 @@
* comparator function for sorting label data in priority order.
* @param {Array<string>} [params.anchor] - Label anchor points relative to the base mark bounding box.
* The available options are 'top-left', 'left', 'bottom-left', 'top',
* 'bottom', 'top-right', 'right', 'bottom-right', 'middle'.
* @param {Array<number>} [params.offset] - Label offsets (in pixels) from the base mark bounding box.
- * This parameter is parallel to the list of anchor points.
- * @param {number} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size.
+ * This parameter is parallel to the list of anchor points.
+ * @param {number | null} [params.padding=0] - The amount (in pixels) that a label may exceed the layout size.
+ * If this parameter is null, a label may exceed the layout size without any boundary.
* @param {string} [params.lineAnchor='end'] - For group line mark labels only, indicates the anchor
* position for labels. One of 'start' or 'end'.
* @param {string} [params.markIndex=0] - For group mark labels only, an index indicating
* which mark within the group should be labeled.
* @param {Array<number>} [params.avoidMarks] - A list of additional mark names for which the label
@@ -32877,15 +32968,15 @@
* place labels. One of 'naive', 'reduced-search', or 'floodfill'.
* @param {Array<string>} [params.as] - The output fields written by the transform.
* The default is ['x', 'y', 'opacity', 'align', 'baseline'].
*/
- function Label(params) {
+ function Label$1(params) {
Transform.call(this, null, params);
}
- Label.Definition = {
+ Label$1.Definition = {
type: 'Label',
metadata: {
modifies: true
},
params: [{
@@ -32908,11 +32999,12 @@
array: true,
default: [1]
}, {
name: 'padding',
type: 'number',
- default: 0
+ default: 0,
+ null: true
}, {
name: 'lineAnchor',
type: 'string',
values: ['start', 'end'],
default: 'end'
@@ -32934,15 +33026,15 @@
default: 'naive'
}, {
name: 'as',
type: 'string',
array: true,
- length: Output$4.length,
- default: Output$4
+ length: Output$1.length,
+ default: Output$1
}]
};
- inherits(Label, Transform, {
+ inherits(Label$1, Transform, {
transform(_, pulse) {
function modp(param) {
const p = _[param];
return isFunction(p) && pulse.modified(p.fields);
}
@@ -32953,13 +33045,13 @@
if (!_.size || _.size.length !== 2) {
error('Size parameter should be specified as a [width, height] array.');
}
- const as = _.as || Output$4; // run label layout
+ const as = _.as || Output$1; // run label layout
- labelLayout(pulse.materialize(pulse.SOURCE).source, _.size, _.sort, array(_.offset || 1), array(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark === false ? false : true, _.lineAnchor || 'end', _.markIndex || 0, _.padding || 0, _.method || 'naive').forEach(l => {
+ labelLayout(pulse.materialize(pulse.SOURCE).source || [], _.size, _.sort, array$5(_.offset == null ? 1 : _.offset), array$5(_.anchor || Anchors), _.avoidMarks || [], _.avoidBaseMark !== false, _.lineAnchor || 'end', _.markIndex || 0, _.padding === undefined ? 0 : _.padding, _.method || 'naive').forEach(l => {
// write layout results to data stream
const t = l.datum;
t[as[0]] = l.x;
t[as[1]] = l.y;
t[as[2]] = l.opacity;
@@ -32971,14 +33063,14 @@
});
var label = /*#__PURE__*/Object.freeze({
__proto__: null,
- label: Label
+ label: Label$1
});
- function partition$5(data, groupby) {
+ function partition(data, groupby) {
var groups = [],
get = function (f) {
return f(t);
},
map,
@@ -33055,11 +33147,11 @@
transform(_, pulse) {
const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
if (!this.value || pulse.changed() || _.modified()) {
const source = pulse.materialize(pulse.SOURCE).source,
- groups = partition$5(source, _.groupby),
+ groups = partition(source, _.groupby),
names = (_.groupby || []).map(accessorName),
m = names.length,
as = _.as || [accessorName(_.x), accessorName(_.y)],
values = [];
groups.forEach(g => {
@@ -33070,26 +33162,26 @@
t[names[i]] = g.dims[i];
}
t[as[0]] = p[0];
t[as[1]] = p[1];
- values.push(ingest(t));
+ values.push(ingest$1(t));
});
});
if (this.value) out.rem = this.value;
this.value = out.add = out.source = values;
}
return out;
}
});
- const Methods$1 = {
- linear: linear,
- log: log$2,
+ const Methods = {
+ linear: linear$2,
+ log: log$3,
exp: exp$1,
- pow: pow$1,
+ pow: pow$3,
quad: quad,
poly: poly
};
const degreesOfFreedom = (method, order) => method === 'poly' ? order : method === 'quad' ? 2 : 1;
@@ -33129,11 +33221,11 @@
'array': true
}, {
'name': 'method',
'type': 'string',
'default': 'linear',
- 'values': Object.keys(Methods$1)
+ 'values': Object.keys(Methods)
}, {
'name': 'order',
'type': 'number',
'default': 3
}, {
@@ -33155,21 +33247,21 @@
transform(_, pulse) {
const out = pulse.fork(pulse.NO_SOURCE | pulse.NO_FIELDS);
if (!this.value || pulse.changed() || _.modified()) {
const source = pulse.materialize(pulse.SOURCE).source,
- groups = partition$5(source, _.groupby),
+ groups = partition(source, _.groupby),
names = (_.groupby || []).map(accessorName),
method = _.method || 'linear',
order = _.order || 3,
dof = degreesOfFreedom(method, order),
as = _.as || [accessorName(_.x), accessorName(_.y)],
- fit = Methods$1[method],
+ fit = Methods[method],
values = [];
let domain = _.extent;
- if (!has(Methods$1, method)) {
+ if (!has$1(Methods, method)) {
error('Invalid regression method: ' + method);
}
if (domain != null) {
if (method === 'log' && domain[0] <= 0) {
@@ -33188,11 +33280,11 @@
const model = fit(g, _.x, _.y, order);
if (_.params) {
// if parameter vectors requested return those
- values.push(ingest({
+ values.push(ingest$1({
keys: g.dims,
coef: model.coef,
rSquared: model.rSquared
}));
return;
@@ -33206,11 +33298,11 @@
t[names[i]] = g.dims[i];
}
t[as[0]] = p[0];
t[as[1]] = p[1];
- values.push(ingest(t));
+ values.push(ingest$1(t));
};
if (method === 'linear') {
// for linear regression we only need the end points
dom.forEach(x => add([x, model.predict(x)]));
@@ -33232,11 +33324,11 @@
__proto__: null,
loess: Loess,
regression: Regression
});
- const EPSILON$2 = Math.pow(2, -52);
+ const EPSILON = Math.pow(2, -52);
const EDGE_STACK = new Uint32Array(512);
class Delaunator {
static from(points, getX = defaultGetX, getY = defaultGetY) {
const n = points.length;
const coords = new Float64Array(n * 2);
@@ -33413,11 +33505,11 @@
for (let k = 0, xp, yp; k < this._ids.length; k++) {
const i = this._ids[k];
const x = coords[2 * i];
const y = coords[2 * i + 1]; // skip near-duplicate points
- if (k > 0 && Math.abs(x - xp) <= EPSILON$2 && Math.abs(y - yp) <= EPSILON$2) continue;
+ if (k > 0 && Math.abs(x - xp) <= EPSILON && Math.abs(y - yp) <= EPSILON) continue;
xp = x;
yp = y; // skip seed triangle points
if (i === i0 || i === i1 || i === i2) continue; // find a visible edge on the convex hull using edge hash
@@ -33690,24 +33782,24 @@
}
} else {
const median = left + right >> 1;
let i = left + 1;
let j = right;
- swap$1(ids, median, i);
- if (dists[ids[left]] > dists[ids[right]]) swap$1(ids, left, right);
- if (dists[ids[i]] > dists[ids[right]]) swap$1(ids, i, right);
- if (dists[ids[left]] > dists[ids[i]]) swap$1(ids, left, i);
+ swap(ids, median, i);
+ if (dists[ids[left]] > dists[ids[right]]) swap(ids, left, right);
+ if (dists[ids[i]] > dists[ids[right]]) swap(ids, i, right);
+ if (dists[ids[left]] > dists[ids[i]]) swap(ids, left, i);
const temp = ids[i];
const tempDist = dists[temp];
while (true) {
do i++; while (dists[ids[i]] < tempDist);
do j--; while (dists[ids[j]] > tempDist);
if (j < i) break;
- swap$1(ids, i, j);
+ swap(ids, i, j);
}
ids[left + 1] = ids[j];
ids[j] = temp;
@@ -33719,11 +33811,11 @@
quicksort(ids, dists, i, right);
}
}
}
- function swap$1(arr, i, j) {
+ function swap(arr, i, j) {
const tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}
@@ -33733,46 +33825,46 @@
function defaultGetY(p) {
return p[1];
}
- const epsilon$5 = 1e-6;
- class Path$1 {
+ const epsilon = 1e-6;
+ class Path {
constructor() {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null; // end of current subpath
this._ = "";
}
moveTo(x, y) {
- this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y);
+ this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
}
closePath() {
if (this._x1 !== null) {
this._x1 = this._x0, this._y1 = this._y0;
this._ += "Z";
}
}
lineTo(x, y) {
- this._ += "L".concat(this._x1 = +x, ",").concat(this._y1 = +y);
+ this._ += `L${this._x1 = +x},${this._y1 = +y}`;
}
arc(x, y, r) {
x = +x, y = +y, r = +r;
const x0 = x + r;
const y0 = y;
if (r < 0) throw new Error("negative radius");
- if (this._x1 === null) this._ += "M".concat(x0, ",").concat(y0);else if (Math.abs(this._x1 - x0) > epsilon$5 || Math.abs(this._y1 - y0) > epsilon$5) this._ += "L" + x0 + "," + y0;
+ if (this._x1 === null) this._ += `M${x0},${y0}`;else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) this._ += "L" + x0 + "," + y0;
if (!r) return;
- this._ += "A".concat(r, ",").concat(r, ",0,1,1,").concat(x - r, ",").concat(y, "A").concat(r, ",").concat(r, ",0,1,1,").concat(this._x1 = x0, ",").concat(this._y1 = y0);
+ this._ += `A${r},${r},0,1,1,${x - r},${y}A${r},${r},0,1,1,${this._x1 = x0},${this._y1 = y0}`;
}
rect(x, y, w, h) {
- this._ += "M".concat(this._x0 = this._x1 = +x, ",").concat(this._y0 = this._y1 = +y, "h").concat(+w, "v").concat(+h, "h").concat(-w, "Z");
+ this._ += `M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${+w}v${+h}h${-w}Z`;
}
value() {
return this._ || null;
}
@@ -33800,11 +33892,11 @@
return this._.length ? this._ : null;
}
}
- class Voronoi {
+ class Voronoi$1 {
constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) {
if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds");
this.delaunay = delaunay;
this._circumcenters = new Float64Array(delaunay.points.length * 2);
this.vectors = new Float64Array(delaunay.points.length * 2);
@@ -33888,11 +33980,11 @@
vectors[p0 + 3] = vectors[p1 + 1] = x1 - x0;
}
}
render(context) {
- const buffer = context == null ? context = new Path$1() : undefined;
+ const buffer = context == null ? context = new Path() : undefined;
const {
delaunay: {
halfedges,
inedges,
hull
@@ -33932,17 +34024,17 @@
return buffer && buffer.value();
}
renderBounds(context) {
- const buffer = context == null ? context = new Path$1() : undefined;
+ const buffer = context == null ? context = new Path() : undefined;
context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin);
return buffer && buffer.value();
}
renderCell(i, context) {
- const buffer = context == null ? context = new Path$1() : undefined;
+ const buffer = context == null ? context = new Path() : undefined;
const points = this._clip(i);
if (points === null || !points.length) return;
context.moveTo(points[0], points[1]);
@@ -34238,23 +34330,23 @@
return (x < this.xmin ? 0b0001 : x > this.xmax ? 0b0010 : 0b0000) | (y < this.ymin ? 0b0100 : y > this.ymax ? 0b1000 : 0b0000);
}
}
- const tau$3 = 2 * Math.PI,
- pow$4 = Math.pow;
+ const tau = 2 * Math.PI,
+ pow = Math.pow;
function pointX(p) {
return p[0];
}
function pointY(p) {
return p[1];
} // A triangulation is collinear if all its triangles have a non-null area
- function collinear$1(d) {
+ function collinear(d) {
const {
triangles,
coords
} = d;
@@ -34297,11 +34389,11 @@
_init() {
const d = this._delaunator,
points = this.points; // check for collinear
- if (d.hull && d.hull.length > 2 && collinear$1(d)) {
+ if (d.hull && d.hull.length > 2 && collinear(d)) {
this.collinear = Int32Array.from({
length: points.length / 2
}, (_, i) => i).sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); // for exact neighbors
const e = this.collinear[0],
@@ -34350,11 +34442,11 @@
if (hull.length === 2) inedges[hull[1]] = 0;
}
}
voronoi(bounds) {
- return new Voronoi(this, bounds);
+ return new Voronoi$1(this, bounds);
}
*neighbors(i) {
const {
inedges,
@@ -34412,39 +34504,39 @@
triangles,
points
} = this;
if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1);
let c = i;
- let dc = pow$4(x - points[i * 2], 2) + pow$4(y - points[i * 2 + 1], 2);
+ let dc = pow(x - points[i * 2], 2) + pow(y - points[i * 2 + 1], 2);
const e0 = inedges[i];
let e = e0;
do {
let t = triangles[e];
- const dt = pow$4(x - points[t * 2], 2) + pow$4(y - points[t * 2 + 1], 2);
+ const dt = pow(x - points[t * 2], 2) + pow(y - points[t * 2 + 1], 2);
if (dt < dc) dc = dt, c = t;
e = e % 3 === 2 ? e - 2 : e + 1;
if (triangles[e] !== i) break; // bad triangulation
e = halfedges[e];
if (e === -1) {
e = hull[(_hullIndex[i] + 1) % hull.length];
if (e !== t) {
- if (pow$4(x - points[e * 2], 2) + pow$4(y - points[e * 2 + 1], 2) < dc) return e;
+ if (pow(x - points[e * 2], 2) + pow(y - points[e * 2 + 1], 2) < dc) return e;
}
break;
}
} while (e !== e0);
return c;
}
render(context) {
- const buffer = context == null ? context = new Path$1() : undefined;
+ const buffer = context == null ? context = new Path() : undefined;
const {
points,
halfedges,
triangles
} = this;
@@ -34461,27 +34553,27 @@
this.renderHull(context);
return buffer && buffer.value();
}
renderPoints(context, r = 2) {
- const buffer = context == null ? context = new Path$1() : undefined;
+ const buffer = context == null ? context = new Path() : undefined;
const {
points
} = this;
for (let i = 0, n = points.length; i < n; i += 2) {
const x = points[i],
y = points[i + 1];
context.moveTo(x + r, y);
- context.arc(x, y, r, 0, tau$3);
+ context.arc(x, y, r, 0, tau);
}
return buffer && buffer.value();
}
renderHull(context) {
- const buffer = context == null ? context = new Path$1() : undefined;
+ const buffer = context == null ? context = new Path() : undefined;
const {
hull,
points
} = this;
const h = hull[0] * 2,
@@ -34502,11 +34594,11 @@
this.renderHull(polygon);
return polygon.value();
}
renderTriangle(i, context) {
- const buffer = context == null ? context = new Path$1() : undefined;
+ const buffer = context == null ? context = new Path() : undefined;
const {
points,
triangles
} = this;
const t0 = triangles[i *= 3] * 2;
@@ -34558,15 +34650,15 @@
yield fy.call(that, p, i, points);
++i;
}
}
- function Voronoi$1(params) {
+ function Voronoi(params) {
Transform.call(this, null, params);
}
- Voronoi$1.Definition = {
+ Voronoi.Definition = {
'type': 'Voronoi',
'metadata': {
'modifies': true
},
'params': [{
@@ -34598,11 +34690,11 @@
'type': 'string',
'default': 'path'
}]
};
const defaultExtent = [-1e5, -1e5, 1e5, 1e5];
- inherits(Voronoi$1, Transform, {
+ inherits(Voronoi, Transform, {
transform(_, pulse) {
const as = _.as || 'path',
data = pulse.source; // nothing to do if no data
if (!data || !data.length) return pulse; // configure and construct voronoi diagram
@@ -34631,11 +34723,11 @@
return 'M' + p.slice(0, n + 1).join('L') + 'Z';
}
var voronoi = /*#__PURE__*/Object.freeze({
__proto__: null,
- voronoi: Voronoi$1
+ voronoi: Voronoi
});
/*
Copyright (c) 2013, Jason Davies.
All rights reserved.
@@ -35102,11 +35194,11 @@
var spirals = {
archimedean: archimedeanSpiral,
rectangular: rectangularSpiral
};
- const Output$5 = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle'];
+ const Output = ['x', 'y', 'font', 'fontSize', 'fontStyle', 'fontWeight', 'angle'];
const Params$1 = ['text', 'font', 'rotate', 'fontSize', 'fontStyle', 'fontWeight'];
function Wordcloud(params) {
Transform.call(this, cloud(), params);
}
@@ -35165,11 +35257,11 @@
}, {
'name': 'as',
'type': 'string',
'array': true,
'length': 7,
- 'default': Output$5
+ 'default': Output
}]
};
inherits(Wordcloud, Transform, {
transform(_, pulse) {
if (_.size && !(_.size[0] && _.size[1])) {
@@ -35184,18 +35276,18 @@
const mod = _.modified();
if (!(mod || pulse.changed(pulse.ADD_REM) || Params$1.some(modp))) return;
const data = pulse.materialize(pulse.SOURCE).source,
layout = this.value,
- as = _.as || Output$5;
+ as = _.as || Output;
let fontSize = _.fontSize || 14,
range;
- isFunction(fontSize) ? range = _.fontSizeRange : fontSize = constant(fontSize); // create font size scaling function as needed
+ isFunction(fontSize) ? range = _.fontSizeRange : fontSize = constant$4(fontSize); // create font size scaling function as needed
if (range) {
const fsize = fontSize,
- sizeScale = scale('sqrt')().domain(extent(data, fsize)).range(range);
+ sizeScale = scale$4('sqrt')().domain(extent(data, fsize)).range(range);
fontSize = x => sizeScale(fsize(x));
}
data.forEach(t => {
@@ -35244,12 +35336,12 @@
function Bitmaps() {
let width = 8,
data = [],
seen = array32(0),
- curr = array$4(0, width),
- prev = array$4(0, width);
+ curr = array$1(0, width),
+ prev = array$1(0, width);
return {
data: () => data,
seen: () => seen = lengthen(seen, data.length),
add(array) {
@@ -35311,12 +35403,12 @@
resize(n, m) {
const k = curr.length;
if (n > k || m > width) {
width = Math.max(m, width);
- curr = array$4(n, width, curr);
- prev = array$4(n, width);
+ curr = array$1(n, width, curr);
+ prev = array$1(n, width);
}
}
};
}
@@ -35326,11 +35418,11 @@
copy = copy || new array.constructor(length);
copy.set(array);
return copy;
}
- function array$4(n, m, array) {
+ function array$1(n, m, array) {
const copy = (m < 0x101 ? array8 : m < 0x10001 ? array16 : array32)(n);
if (array) copy.set(array);
return copy;
}
@@ -35392,11 +35484,11 @@
if (n0) {
oldv = value;
oldi = index;
value = Array(n0 + n1);
index = array32(n0 + n1);
- merge$2(base, oldv, oldi, n0, addv, addi, n1, value, index);
+ merge$1(base, oldv, oldi, n0, addv, addi, n1, value, index);
} else {
if (base > 0) for (i = 0; i < n1; ++i) {
addi[i] += base;
}
value = addv;
@@ -35443,11 +35535,11 @@
} else {
array = value;
n = size;
}
- return [bisectLeft(array, range[0], 0, n), bisectRight(array, range[1], 0, n)];
+ return [bisectLeft$1(array, range[0], 0, n), bisectRight$1(array, range[1], 0, n)];
}
return {
insert: insert,
remove: remove,
@@ -35465,11 +35557,11 @@
return x < y ? -1 : x > y ? 1 : 0;
});
return permute(values, index);
}
- function merge$2(base, value0, index0, n0, value1, index1, n1, value, index) {
+ function merge$1(base, value0, index0, n0, value1, index1, n1, value, index) {
let i0 = 0,
i1 = 0,
i;
for (i = 0; i0 < n0 && i1 < n1; ++i) {
@@ -35977,11 +36069,11 @@
});
const RawCode = 'RawCode';
const Literal = 'Literal';
const Property = 'Property';
- const Identifier$1 = 'Identifier';
+ const Identifier = 'Identifier';
const ArrayExpression = 'ArrayExpression';
const BinaryExpression = 'BinaryExpression';
const CallExpression = 'CallExpression';
const ConditionalExpression = 'ConditionalExpression';
const LogicalExpression = 'LogicalExpression';
@@ -35995,16 +36087,16 @@
ASTNode.prototype.visit = function (visitor) {
let c, i, n;
if (visitor(this)) return 1;
- for (c = children$1(this), i = 0, n = c.length; i < n; ++i) {
+ for (c = children(this), i = 0, n = c.length; i < n; ++i) {
if (c[i].visit(visitor)) return 1;
}
};
- function children$1(node) {
+ function children(node) {
switch (node.type) {
case ArrayExpression:
return node.elements;
case BinaryExpression:
@@ -36027,11 +36119,11 @@
return [node.key, node.value];
case UnaryExpression:
return [node.argument];
- case Identifier$1:
+ case Identifier:
case Literal:
case RawCode:
default:
return [];
}
@@ -36071,11 +36163,11 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
- var TokenName, source$1, index$1, length, lookahead;
+ var TokenName, source, index, length, lookahead;
var TokenBooleanLiteral = 1,
TokenEOF = 2,
TokenIdentifier = 3,
TokenKeyword = 4,
TokenNullLiteral = 5,
@@ -36113,11 +36205,11 @@
MessageUnexpectedEOS = 'Unexpected end of input',
MessageInvalidRegExp = 'Invalid regular expression',
MessageUnterminatedRegExp = 'Invalid regular expression: missing /',
MessageStrictOctalLiteral = 'Octal literals are not allowed in strict mode.',
MessageStrictDuplicateProperty = 'Duplicate data property in object literal not allowed in strict mode';
- var ILLEGAL = 'ILLEGAL',
+ var ILLEGAL$1 = 'ILLEGAL',
DISABLED = 'Disabled.'; // See also tools/generate-unicode-regex.py.
var RegexNonAsciiIdentifierStart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'),
// eslint-disable-next-line no-misleading-character-class
RegexNonAsciiIdentifierPart = new RegExp('[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]'); // Ensure the condition is true, otherwise throw an error.
@@ -36154,28 +36246,19 @@
return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
} // 7.6 Identifier Names and Identifiers
function isIdentifierStart(ch) {
- return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch >= 0x61 && ch <= 0x7A || // a..z
- ch === 0x5C || // \ (backslash)
- ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
+ return ch === 0x24 || ch === 0x5F || ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A || ch === 0x5C || ch >= 0x80 && RegexNonAsciiIdentifierStart.test(String.fromCharCode(ch));
}
function isIdentifierPart(ch) {
- return ch === 0x24 || ch === 0x5F || // $ (dollar) and _ (underscore)
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x30 && ch <= 0x39 || // 0..9
- ch === 0x5C || // \ (backslash)
- ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
+ return ch === 0x24 || ch === 0x5F || ch >= 0x41 && ch <= 0x5A || ch >= 0x61 && ch <= 0x7A || ch >= 0x30 && ch <= 0x39 || ch === 0x5C || ch >= 0x80 && RegexNonAsciiIdentifierPart.test(String.fromCharCode(ch));
} // 7.6.1.1 Keywords
- const keywords$1 = {
+ const keywords = {
'if': 1,
'in': 1,
'do': 1,
'var': 1,
'for': 1,
@@ -36217,15 +36300,15 @@
'instanceof': 1,
'implements': 1
};
function skipComment() {
- while (index$1 < length) {
- const ch = source$1.charCodeAt(index$1);
+ while (index < length) {
+ const ch = source.charCodeAt(index);
if (isWhiteSpace(ch) || isLineTerminator(ch)) {
- ++index$1;
+ ++index;
} else {
break;
}
}
}
@@ -36236,42 +36319,42 @@
ch,
code = 0;
len = prefix === 'u' ? 4 : 2;
for (i = 0; i < len; ++i) {
- if (index$1 < length && isHexDigit(source$1[index$1])) {
- ch = source$1[index$1++];
+ if (index < length && isHexDigit(source[index])) {
+ ch = source[index++];
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
} else {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
}
return String.fromCharCode(code);
}
function scanUnicodeCodePointEscape() {
var ch, code, cu1, cu2;
- ch = source$1[index$1];
+ ch = source[index];
code = 0; // At least, one hex digit is required.
if (ch === '}') {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
- while (index$1 < length) {
- ch = source$1[index$1++];
+ while (index < length) {
+ ch = source[index++];
if (!isHexDigit(ch)) {
break;
}
code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());
}
if (code > 0x10FFFF || ch !== '}') {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
} // UTF-16 Encoding
if (code <= 0xFFFF) {
return String.fromCharCode(code);
@@ -36282,50 +36365,50 @@
return String.fromCharCode(cu1, cu2);
}
function getEscapedIdentifier() {
var ch, id;
- ch = source$1.charCodeAt(index$1++);
+ ch = source.charCodeAt(index++);
id = String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.
if (ch === 0x5C) {
- if (source$1.charCodeAt(index$1) !== 0x75) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ if (source.charCodeAt(index) !== 0x75) {
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
- ++index$1;
+ ++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierStart(ch.charCodeAt(0))) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
id = ch;
}
- while (index$1 < length) {
- ch = source$1.charCodeAt(index$1);
+ while (index < length) {
+ ch = source.charCodeAt(index);
if (!isIdentifierPart(ch)) {
break;
}
- ++index$1;
+ ++index;
id += String.fromCharCode(ch); // '\u' (U+005C, U+0075) denotes an escaped character.
if (ch === 0x5C) {
id = id.substr(0, id.length - 1);
- if (source$1.charCodeAt(index$1) !== 0x75) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ if (source.charCodeAt(index) !== 0x75) {
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
- ++index$1;
+ ++index;
ch = scanHexEscape('u');
if (!ch || ch === '\\' || !isIdentifierPart(ch.charCodeAt(0))) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
id += ch;
}
}
@@ -36333,41 +36416,41 @@
return id;
}
function getIdentifier() {
var start, ch;
- start = index$1++;
+ start = index++;
- while (index$1 < length) {
- ch = source$1.charCodeAt(index$1);
+ while (index < length) {
+ ch = source.charCodeAt(index);
if (ch === 0x5C) {
// Blackslash (U+005C) marks Unicode escape sequence.
- index$1 = start;
+ index = start;
return getEscapedIdentifier();
}
if (isIdentifierPart(ch)) {
- ++index$1;
+ ++index;
} else {
break;
}
}
- return source$1.slice(start, index$1);
+ return source.slice(start, index);
}
function scanIdentifier() {
var start, id, type;
- start = index$1; // Backslash (U+005C) starts an escaped character.
+ start = index; // Backslash (U+005C) starts an escaped character.
- id = source$1.charCodeAt(index$1) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character.
+ id = source.charCodeAt(index) === 0x5C ? getEscapedIdentifier() : getIdentifier(); // There is no keyword or literal with only one character.
// Thus, it must be an identifier.
if (id.length === 1) {
type = TokenIdentifier;
- } else if (keywords$1.hasOwnProperty(id)) {
+ } else if (keywords.hasOwnProperty(id)) {
// eslint-disable-line no-prototype-builtins
type = TokenKeyword;
} else if (id === 'null') {
type = TokenNullLiteral;
} else if (id === 'true' || id === 'false') {
@@ -36378,20 +36461,20 @@
return {
type: type,
value: id,
start: start,
- end: index$1
+ end: index
};
} // 7.7 Punctuators
function scanPunctuator() {
- var start = index$1,
- code = source$1.charCodeAt(index$1),
+ var start = index,
+ code = source.charCodeAt(index),
code2,
- ch1 = source$1[index$1],
+ ch1 = source[index],
ch2,
ch3,
ch4;
switch (code) {
@@ -36418,20 +36501,20 @@
case 0x3F: // ?
case 0x7E:
// ~
- ++index$1;
+ ++index;
return {
type: TokenPunctuator,
value: String.fromCharCode(code),
start: start,
- end: index$1
+ end: index
};
default:
- code2 = source$1.charCodeAt(index$1 + 1); // '=' (U+003D) marks an assignment or comparison operator.
+ code2 = source.charCodeAt(index + 1); // '=' (U+003D) marks an assignment or comparison operator.
if (code2 === 0x3D) {
switch (code) {
case 0x2B: // +
@@ -36451,219 +36534,219 @@
case 0x26: // &
case 0x2A:
// *
- index$1 += 2;
+ index += 2;
return {
type: TokenPunctuator,
value: String.fromCharCode(code) + String.fromCharCode(code2),
start: start,
- end: index$1
+ end: index
};
case 0x21: // !
case 0x3D:
// =
- index$1 += 2; // !== and ===
+ index += 2; // !== and ===
- if (source$1.charCodeAt(index$1) === 0x3D) {
- ++index$1;
+ if (source.charCodeAt(index) === 0x3D) {
+ ++index;
}
return {
type: TokenPunctuator,
- value: source$1.slice(start, index$1),
+ value: source.slice(start, index),
start: start,
- end: index$1
+ end: index
};
}
}
} // 4-character punctuator: >>>=
- ch4 = source$1.substr(index$1, 4);
+ ch4 = source.substr(index, 4);
if (ch4 === '>>>=') {
- index$1 += 4;
+ index += 4;
return {
type: TokenPunctuator,
value: ch4,
start: start,
- end: index$1
+ end: index
};
} // 3-character punctuators: === !== >>> <<= >>=
ch3 = ch4.substr(0, 3);
if (ch3 === '>>>' || ch3 === '<<=' || ch3 === '>>=') {
- index$1 += 3;
+ index += 3;
return {
type: TokenPunctuator,
value: ch3,
start: start,
- end: index$1
+ end: index
};
} // Other 2-character punctuators: ++ -- << >> && ||
ch2 = ch3.substr(0, 2);
if (ch1 === ch2[1] && '+-<>&|'.indexOf(ch1) >= 0 || ch2 === '=>') {
- index$1 += 2;
+ index += 2;
return {
type: TokenPunctuator,
value: ch2,
start: start,
- end: index$1
+ end: index
};
}
if (ch2 === '//') {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
} // 1-character punctuators: < > = ! + - * % & | ^ /
if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
- ++index$1;
+ ++index;
return {
type: TokenPunctuator,
value: ch1,
start: start,
- end: index$1
+ end: index
};
}
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
} // 7.8.3 Numeric Literals
function scanHexLiteral(start) {
let number = '';
- while (index$1 < length) {
- if (!isHexDigit(source$1[index$1])) {
+ while (index < length) {
+ if (!isHexDigit(source[index])) {
break;
}
- number += source$1[index$1++];
+ number += source[index++];
}
if (number.length === 0) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
- if (isIdentifierStart(source$1.charCodeAt(index$1))) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ if (isIdentifierStart(source.charCodeAt(index))) {
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
return {
type: TokenNumericLiteral,
value: parseInt('0x' + number, 16),
start: start,
- end: index$1
+ end: index
};
}
function scanOctalLiteral(start) {
- let number = '0' + source$1[index$1++];
+ let number = '0' + source[index++];
- while (index$1 < length) {
- if (!isOctalDigit(source$1[index$1])) {
+ while (index < length) {
+ if (!isOctalDigit(source[index])) {
break;
}
- number += source$1[index$1++];
+ number += source[index++];
}
- if (isIdentifierStart(source$1.charCodeAt(index$1)) || isDecimalDigit(source$1.charCodeAt(index$1))) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ if (isIdentifierStart(source.charCodeAt(index)) || isDecimalDigit(source.charCodeAt(index))) {
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
return {
type: TokenNumericLiteral,
value: parseInt(number, 8),
octal: true,
start: start,
- end: index$1
+ end: index
};
}
function scanNumericLiteral() {
var number, start, ch;
- ch = source$1[index$1];
+ ch = source[index];
assert(isDecimalDigit(ch.charCodeAt(0)) || ch === '.', 'Numeric literal must start with a decimal digit or a decimal point');
- start = index$1;
+ start = index;
number = '';
if (ch !== '.') {
- number = source$1[index$1++];
- ch = source$1[index$1]; // Hex number starts with '0x'.
+ number = source[index++];
+ ch = source[index]; // Hex number starts with '0x'.
// Octal number starts with '0'.
if (number === '0') {
if (ch === 'x' || ch === 'X') {
- ++index$1;
+ ++index;
return scanHexLiteral(start);
}
if (isOctalDigit(ch)) {
return scanOctalLiteral(start);
} // decimal number starts with '0' such as '09' is illegal.
if (ch && isDecimalDigit(ch.charCodeAt(0))) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
}
- while (isDecimalDigit(source$1.charCodeAt(index$1))) {
- number += source$1[index$1++];
+ while (isDecimalDigit(source.charCodeAt(index))) {
+ number += source[index++];
}
- ch = source$1[index$1];
+ ch = source[index];
}
if (ch === '.') {
- number += source$1[index$1++];
+ number += source[index++];
- while (isDecimalDigit(source$1.charCodeAt(index$1))) {
- number += source$1[index$1++];
+ while (isDecimalDigit(source.charCodeAt(index))) {
+ number += source[index++];
}
- ch = source$1[index$1];
+ ch = source[index];
}
if (ch === 'e' || ch === 'E') {
- number += source$1[index$1++];
- ch = source$1[index$1];
+ number += source[index++];
+ ch = source[index];
if (ch === '+' || ch === '-') {
- number += source$1[index$1++];
+ number += source[index++];
}
- if (isDecimalDigit(source$1.charCodeAt(index$1))) {
- while (isDecimalDigit(source$1.charCodeAt(index$1))) {
- number += source$1[index$1++];
+ if (isDecimalDigit(source.charCodeAt(index))) {
+ while (isDecimalDigit(source.charCodeAt(index))) {
+ number += source[index++];
}
} else {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
}
- if (isIdentifierStart(source$1.charCodeAt(index$1))) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ if (isIdentifierStart(source.charCodeAt(index))) {
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
return {
type: TokenNumericLiteral,
value: parseFloat(number),
start: start,
- end: index$1
+ end: index
};
} // 7.8.4 String Literals
function scanStringLiteral() {
@@ -36671,30 +36754,30 @@
quote,
start,
ch,
code,
octal = false;
- quote = source$1[index$1];
+ quote = source[index];
assert(quote === '\'' || quote === '"', 'String literal must starts with a quote');
- start = index$1;
- ++index$1;
+ start = index;
+ ++index;
- while (index$1 < length) {
- ch = source$1[index$1++];
+ while (index < length) {
+ ch = source[index++];
if (ch === quote) {
quote = '';
break;
} else if (ch === '\\') {
- ch = source$1[index$1++];
+ ch = source[index++];
if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'u':
case 'x':
- if (source$1[index$1] === '{') {
- ++index$1;
+ if (source[index] === '{') {
+ ++index;
str += scanUnicodeCodePointEscape();
} else {
str += scanHexEscape(ch);
}
@@ -36730,17 +36813,17 @@
if (code !== 0) {
octal = true;
}
- if (index$1 < length && isOctalDigit(source$1[index$1])) {
+ if (index < length && isOctalDigit(source[index])) {
octal = true;
- code = code * 8 + '01234567'.indexOf(source$1[index$1++]); // 3 digits are only allowed when string starts
+ code = code * 8 + '01234567'.indexOf(source[index++]); // 3 digits are only allowed when string starts
// with 0, 1, 2, 3
- if ('0123'.indexOf(ch) >= 0 && index$1 < length && isOctalDigit(source$1[index$1])) {
- code = code * 8 + '01234567'.indexOf(source$1[index$1++]);
+ if ('0123'.indexOf(ch) >= 0 && index < length && isOctalDigit(source[index])) {
+ code = code * 8 + '01234567'.indexOf(source[index++]);
}
}
str += String.fromCharCode(code);
} else {
@@ -36748,31 +36831,31 @@
}
break;
}
} else {
- if (ch === '\r' && source$1[index$1] === '\n') {
- ++index$1;
+ if (ch === '\r' && source[index] === '\n') {
+ ++index;
}
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
break;
} else {
str += ch;
}
}
if (quote !== '') {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
}
return {
type: TokenStringLiteral,
value: str,
octal: octal,
start: start,
- end: index$1
+ end: index
};
}
function testRegExp(pattern, flags) {
let tmp = pattern;
@@ -36812,22 +36895,22 @@
}
}
function scanRegExpBody() {
var ch, str, classMarker, terminated, body;
- ch = source$1[index$1];
+ ch = source[index];
assert(ch === '/', 'Regular expression literal must start with a slash');
- str = source$1[index$1++];
+ str = source[index++];
classMarker = false;
terminated = false;
- while (index$1 < length) {
- ch = source$1[index$1++];
+ while (index < length) {
+ ch = source[index++];
str += ch;
if (ch === '\\') {
- ch = source$1[index$1++]; // ECMA-262 7.8.5
+ ch = source[index++]; // ECMA-262 7.8.5
if (isLineTerminator(ch.charCodeAt(0))) {
throwError({}, MessageUnterminatedRegExp);
}
@@ -36863,21 +36946,21 @@
function scanRegExpFlags() {
var ch, str, flags;
str = '';
flags = '';
- while (index$1 < length) {
- ch = source$1[index$1];
+ while (index < length) {
+ ch = source[index];
if (!isIdentifierPart(ch.charCodeAt(0))) {
break;
}
- ++index$1;
+ ++index;
- if (ch === '\\' && index$1 < length) {
- throwError({}, MessageUnexpectedToken, ILLEGAL);
+ if (ch === '\\' && index < length) {
+ throwError({}, MessageUnexpectedToken, ILLEGAL$1);
} else {
flags += ch;
str += ch;
}
}
@@ -36894,11 +36977,11 @@
function scanRegExp() {
var start, body, flags, value;
lookahead = null;
skipComment();
- start = index$1;
+ start = index;
body = scanRegExpBody();
flags = scanRegExpFlags();
value = testRegExp(body.value, flags.value);
return {
literal: body.literal + flags.literal,
@@ -36906,30 +36989,30 @@
regex: {
pattern: body.value,
flags: flags.value
},
start: start,
- end: index$1
+ end: index
};
}
function isIdentifierName(token) {
return token.type === TokenIdentifier || token.type === TokenKeyword || token.type === TokenBooleanLiteral || token.type === TokenNullLiteral;
}
function advance() {
skipComment();
- if (index$1 >= length) {
+ if (index >= length) {
return {
type: TokenEOF,
- start: index$1,
- end: index$1
+ start: index,
+ end: index
};
}
- const ch = source$1.charCodeAt(index$1);
+ const ch = source.charCodeAt(index);
if (isIdentifierStart(ch)) {
return scanIdentifier();
} // Very common: ( and ) and ;
@@ -36944,11 +37027,11 @@
} // Dot (.) U+002E can also start a floating-point number, hence the need
// to check the next character.
if (ch === 0x2E) {
- if (isDecimalDigit(source$1.charCodeAt(index$1 + 1))) {
+ if (isDecimalDigit(source.charCodeAt(index + 1))) {
return scanNumericLiteral();
}
return scanPunctuator();
}
@@ -36960,20 +37043,20 @@
return scanPunctuator();
}
function lex() {
const token = lookahead;
- index$1 = token.end;
+ index = token.end;
lookahead = advance();
- index$1 = token.end;
+ index = token.end;
return token;
}
- function peek$1() {
- const pos = index$1;
+ function peek() {
+ const pos = index;
lookahead = advance();
- index$1 = pos;
+ index = pos;
}
function finishArrayExpression(elements) {
const node = new ASTNode(SyntaxArrayExpression);
node.elements = elements;
@@ -37010,11 +37093,11 @@
}
function finishLiteral(token) {
const node = new ASTNode(SyntaxLiteral);
node.value = token.value;
- node.raw = source$1.slice(token.start, token.end);
+ node.raw = source.slice(token.start, token.end);
if (token.regex) {
if (node.raw === '//') {
node.raw = '/(?:)/';
}
@@ -37063,11 +37146,11 @@
msg = messageFormat.replace(/%(\d)/g, (whole, index) => {
assert(index < args.length, 'Message reference must be in range');
return args[index];
});
error = new Error(msg);
- error.index = index$1;
+ error.index = index;
error.description = msg;
throw error;
} // Throw an exception because of the token.
@@ -37117,11 +37200,11 @@
} // 11.1.4 Array Initialiser
function parseArrayInitialiser() {
const elements = [];
- index$1 = lookahead.start;
+ index = lookahead.start;
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
@@ -37139,11 +37222,11 @@
return finishArrayExpression(elements);
} // 11.1.5 Object Initialiser
function parseObjectPropertyKey() {
- index$1 = lookahead.start;
+ index = lookahead.start;
const token = lex(); // Note: This function is called only from parseObjectProperty(), where
// EOF and Punctuator tokens are already filtered out.
if (token.type === TokenStringLiteral || token.type === TokenNumericLiteral) {
if (token.octal) {
@@ -37156,11 +37239,11 @@
return finishIdentifier(token.value);
}
function parseObjectProperty() {
var token, key, id, value;
- index$1 = lookahead.start;
+ index = lookahead.start;
token = lookahead;
if (token.type === TokenIdentifier) {
id = parseObjectPropertyKey();
expect(':');
@@ -37183,11 +37266,11 @@
property,
name,
key,
map = {},
toString = String;
- index$1 = lookahead.start;
+ index = lookahead.start;
expect('{');
while (!match('}')) {
property = parseObjectProperty();
@@ -37243,11 +37326,11 @@
if (match('{')) {
return parseObjectInitialiser();
}
type = lookahead.type;
- index$1 = lookahead.start;
+ index = lookahead.start;
if (type === TokenIdentifier || legalKeywords[lookahead.value]) {
expr = finishIdentifier(lex().value);
} else if (type === TokenStringLiteral || type === TokenNumericLiteral) {
if (lookahead.octal) {
@@ -37265,11 +37348,11 @@
token = lex();
token.value = null;
expr = finishLiteral(token);
} else if (match('/') || match('/=')) {
expr = finishLiteral(scanRegExp());
- peek$1();
+ peek();
} else {
throwUnexpected(lex());
}
return expr;
@@ -37279,11 +37362,11 @@
function parseArguments() {
const args = [];
expect('(');
if (!match(')')) {
- while (index$1 < length) {
+ while (index < length) {
args.push(parseConditionalExpression());
if (match(')')) {
break;
}
@@ -37295,11 +37378,11 @@
expect(')');
return args;
}
function parseNonComputedProperty() {
- index$1 = lookahead.start;
+ index = lookahead.start;
const token = lex();
if (!isIdentifierName(token)) {
throwUnexpected(token);
}
@@ -37523,16 +37606,16 @@
}
return expr;
}
- function parser(code) {
- source$1 = code;
- index$1 = 0;
- length = source$1.length;
+ function parser$1(code) {
+ source = code;
+ index = 0;
+ length = source.length;
lookahead = null;
- peek$1();
+ peek();
const expr = parseExpression();
if (lookahead.type !== TokenEOF) {
throw new Error('Unexpect token after expression.');
}
@@ -37657,11 +37740,11 @@
forbidden = opt.forbidden ? toSet(opt.forbidden) : {},
constants = opt.constants || Constants,
functions = (opt.functions || Functions)(visit),
globalvar = opt.globalvar,
fieldvar = opt.fieldvar,
- outputGlobal = isFunction(globalvar) ? globalvar : id => "".concat(globalvar, "[\"").concat(id, "\"]");
+ outputGlobal = isFunction(globalvar) ? globalvar : id => `${globalvar}["${id}"]`;
let globals = {},
fields = {},
memberDepth = 0;
function visit(ast) {
@@ -37676,15 +37759,15 @@
Identifier: n => {
const id = n.name;
if (memberDepth > 0) {
return id;
- } else if (has(forbidden, id)) {
+ } else if (has$1(forbidden, id)) {
return error('Illegal identifier: ' + id);
- } else if (has(constants, id)) {
+ } else if (has$1(constants, id)) {
return constants[id];
- } else if (has(allowed, id)) {
+ } else if (has$1(allowed, id)) {
return id;
} else {
globals[id] = 1;
return outputGlobal(id);
}
@@ -37708,11 +37791,11 @@
error('Illegal callee type: ' + n.callee.type);
}
const callee = n.callee.name,
args = n.arguments,
- fn = has(functions, callee) && functions[callee];
+ fn = has$1(functions, callee) && functions[callee];
if (!fn) error('Unrecognized function: ' + callee);
return isFunction(fn) ? fn(args) : fn + '(' + args.map(visit).join(',') + ')';
},
ArrayExpression: n => '[' + n.elements.map(visit).join(',') + ']',
BinaryExpression: n => '(' + visit(n.left) + ' ' + n.operator + ' ' + visit(n.right) + ')',
@@ -37742,22 +37825,22 @@
codegen.functions = functions;
codegen.constants = constants;
return codegen;
}
- function ascending$3(a, b) {
+ function ascending(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
- function bisector$1(f) {
+ function bisector(f) {
let delta = f;
let compare = f;
if (f.length === 1) {
delta = (d, x) => f(d) - x;
- compare = ascendingComparator$1(f);
+ compare = ascendingComparator(f);
}
function left(a, x, lo, hi) {
if (lo == null) lo = 0;
if (hi == null) hi = a.length;
@@ -37794,12 +37877,12 @@
center,
right
};
}
- function ascendingComparator$1(f) {
- return (d, x) => ascending$3(f(d), x);
+ function ascendingComparator(f) {
+ return (d, x) => ascending(f(d), x);
}
const Intersect = 'intersect';
const Union = 'union';
const VlMulti = 'vlMulti';
@@ -37822,15 +37905,15 @@
dval,
f;
for (; i < n; ++i) {
f = fields[i];
- f.getter = field.getter || field(f.field);
+ f.getter = field$1.getter || field$1(f.field);
dval = f.getter(datum);
- if (isDate(dval)) dval = toNumber(dval);
- if (isDate(values[i])) values[i] = toNumber(values[i]);
- if (isDate(values[i][0])) values[i] = values[i].map(toNumber);
+ if (isDate$1(dval)) dval = toNumber(dval);
+ if (isDate$1(values[i])) values[i] = toNumber(values[i]);
+ if (isDate$1(values[i][0])) values[i] = values[i].map(toNumber);
if (f.type === TYPE_ENUM) {
// Enumerated fields can either specify individual values (single/multi selections)
// or an array of values (interval selections).
if (isArray(values[i]) ? values[i].indexOf(dval) < 0 : dval !== values[i]) {
@@ -37909,28 +37992,28 @@
return n && intersect;
}
- const selectionId = field(SELECTION_ID),
- bisect = bisector$1(selectionId),
- bisectLeft$1 = bisect.left,
- bisectRight$1 = bisect.right;
+ const selectionId = field$1(SELECTION_ID),
+ bisect = bisector(selectionId),
+ bisectLeft = bisect.left,
+ bisectRight = bisect.right;
function selectionIdTest(name, datum, op) {
const data = this.context.data[name],
entries = data ? data.values.value : [],
unitIdx = data ? data[UNIT_INDEX] && data[UNIT_INDEX].value : undefined,
intersect = op === Intersect,
value = selectionId(datum),
- index = bisectLeft$1(entries, value);
+ index = bisectLeft(entries, value);
if (index === entries.length) return false;
if (selectionId(entries[index]) !== value) return false;
if (unitIdx && intersect) {
if (unitIdx.size === 1) return true;
- if (bisectRight$1(entries, value) - index < unitIdx.size) return false;
+ if (bisectRight(entries, value) - index < unitIdx.size) return false;
}
return true;
}
/**
@@ -37941,12 +38024,12 @@
* @returns {array} An array of selection entries for the given unit.
*/
function selectionTuples(array, base) {
- return array.map(x => extend({
- values: base.fields.map(f => (f.getter || (f.getter = field(f.field)))(x.datum))
+ return array.map(x => extend$1({
+ values: base.fields.map(f => (f.getter || (f.getter = field$1(f.field)))(x.datum))
}, base));
}
/**
* Resolves selection for use as a scale domain or reads via the API.
* @param {string} name - The name of the dataset representing the selection
@@ -37992,22 +38075,22 @@
field = fields[j];
res = resolved[field.field] || (resolved[field.field] = {});
resUnit = res[unit] || (res[unit] = []);
types[field.field] = type = field.type.charAt(0);
union = ops[type + '_union'];
- res[unit] = union(resUnit, array(values[j]));
+ res[unit] = union(resUnit, array$5(values[j]));
} // If the same multi-selection is repeated over views and projected over
// an encoding, it may operate over different fields making it especially
// tricky to reliably resolve it. At best, we can de-dupe identical entries
// but doing so may be more computationally expensive than it is worth.
// Instead, for now, we simply transform our store representation into
// a more human-friendly one.
if (isMulti) {
resUnit = multiRes[unit] || (multiRes[unit] = []);
- resUnit.push(array(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {}));
+ resUnit.push(array$5(values).reduce((obj, curr, j) => (obj[fields[j].field] = curr, obj), {}));
}
} // Then resolve fields across units as per the op.
op = op || Union;
@@ -38076,32 +38159,32 @@
}
return base;
}
};
- const DataPrefix = ':',
- IndexPrefix = '@';
+ const DataPrefix$1 = ':',
+ IndexPrefix$1 = '@';
function selectionVisitor(name, args, scope, params) {
if (args[0].type !== Literal) error('First argument to selection functions must be a string literal.');
const data = args[0].value,
- op = args.length >= 2 && peek(args).value,
+ op = args.length >= 2 && peek$1(args).value,
field = 'unit',
- indexName = IndexPrefix + field,
- dataName = DataPrefix + data; // eslint-disable-next-line no-prototype-builtins
+ indexName = IndexPrefix$1 + field,
+ dataName = DataPrefix$1 + data; // eslint-disable-next-line no-prototype-builtins
- if (op === Intersect && !has(params, indexName)) {
+ if (op === Intersect && !has$1(params, indexName)) {
params[indexName] = scope.getData(data).indataRef(scope, field);
} // eslint-disable-next-line no-prototype-builtins
- if (!has(params, dataName)) {
+ if (!has$1(params, dataName)) {
params[dataName] = scope.getData(data).tuplesRef();
}
}
- function data(name) {
+ function data$1(name) {
const data = this.context.data[name];
return data ? data.values.value : [];
}
function indata(name, field, value) {
@@ -38116,11 +38199,11 @@
input = data.input;
df.pulse(input, df.changeset().remove(truthy).insert(tuples));
return 1;
}
- function encode$1(item, name, retval) {
+ function encode(item, name, retval) {
if (item) {
const df = this.context.dataflow,
target = item.mark.source;
df.pulse(target, df.changeset().encode(item, name));
}
@@ -38131,55 +38214,55 @@
const wrap = method => function (value, spec) {
const locale = this.context.dataflow.locale();
return locale[method](spec)(value);
};
- const format$3 = wrap('format');
- const timeFormat$1 = wrap('timeFormat');
- const utcFormat$1 = wrap('utcFormat');
- const timeParse$1 = wrap('timeParse');
- const utcParse$1 = wrap('utcParse');
+ const format = wrap('format');
+ const timeFormat = wrap('timeFormat');
+ const utcFormat = wrap('utcFormat');
+ const timeParse = wrap('timeParse');
+ const utcParse = wrap('utcParse');
const dateObj = new Date(2000, 0, 1);
- function time$1(month, day, specifier) {
+ function time(month, day, specifier) {
if (!Number.isInteger(month) || !Number.isInteger(day)) return '';
dateObj.setYear(2000);
dateObj.setMonth(month);
dateObj.setDate(day);
- return timeFormat$1.call(this, dateObj, specifier);
+ return timeFormat.call(this, dateObj, specifier);
}
function monthFormat(month) {
- return time$1.call(this, month, 1, '%B');
+ return time.call(this, month, 1, '%B');
}
function monthAbbrevFormat(month) {
- return time$1.call(this, month, 1, '%b');
+ return time.call(this, month, 1, '%b');
}
function dayFormat(day) {
- return time$1.call(this, 0, 2 + day, '%A');
+ return time.call(this, 0, 2 + day, '%A');
}
function dayAbbrevFormat(day) {
- return time$1.call(this, 0, 2 + day, '%a');
+ return time.call(this, 0, 2 + day, '%a');
}
- const DataPrefix$1 = ':';
- const IndexPrefix$1 = '@';
+ const DataPrefix = ':';
+ const IndexPrefix = '@';
const ScalePrefix = '%';
const SignalPrefix = '$';
function dataVisitor(name, args, scope, params) {
if (args[0].type !== Literal) {
error('First argument to data functions must be a string literal.');
}
const data = args[0].value,
- dataName = DataPrefix$1 + data;
+ dataName = DataPrefix + data;
- if (!has(dataName, params)) {
+ if (!has$1(dataName, params)) {
try {
params[dataName] = scope.getData(data).tuplesRef();
} catch (err) {// if data set does not exist, there's nothing to track
}
}
@@ -38188,13 +38271,13 @@
function indataVisitor(name, args, scope, params) {
if (args[0].type !== Literal) error('First argument to indata must be a string literal.');
if (args[1].type !== Literal) error('Second argument to indata must be a string literal.');
const data = args[0].value,
field = args[1].value,
- indexName = IndexPrefix$1 + field;
+ indexName = IndexPrefix + field;
- if (!has(indexName, params)) {
+ if (!has$1(indexName, params)) {
params[indexName] = scope.getData(data).indataRef(scope, field);
}
}
function scaleVisitor(name, args, scope, params) {
@@ -38210,11 +38293,11 @@
}
function addScaleDependency(scope, params, name) {
const scaleName = ScalePrefix + name;
- if (!has(params, scaleName)) {
+ if (!has$1(params, scaleName)) {
try {
params[scaleName] = scope.scaleRef(name);
} catch (err) {// TODO: error handling? warning?
}
}
@@ -38237,13 +38320,13 @@
const ref = arg => '_[' + (arg.type === Literal ? $(ScalePrefix + arg.value) : $(ScalePrefix) + '+' + codegen(arg)) + ']'; // define and return internal scale function code generators
// these internal functions are called by mark encoders
return {
- _bandwidth: args => "this.__bandwidth(".concat(ref(args[0]), ")"),
- _range: args => "".concat(ref(args[0]), ".range()"),
- _scale: args => "".concat(ref(args[0]), "(").concat(codegen(args[1]), ")")
+ _bandwidth: args => `this.__bandwidth(${ref(args[0])})`,
+ _range: args => `${ref(args[0])}.range()`,
+ _scale: args => `${ref(args[0])}(${codegen(args[1])})`
};
}
function geoMethod(methodName, globalMethod) {
return function (projection, geojson, group) {
@@ -38274,30 +38357,30 @@
item = item.mark.group;
}
return value;
}
- function log$5(df, method, args) {
+ function log(df, method, args) {
try {
df[method].apply(df, ['EXPRESSION'].concat([].slice.call(args)));
} catch (err) {
df.warn(err);
}
return args[args.length - 1];
}
function warn() {
- return log$5(this.context.dataflow, 'warn', arguments);
+ return log(this.context.dataflow, 'warn', arguments);
}
function info() {
- return log$5(this.context.dataflow, 'info', arguments);
+ return log(this.context.dataflow, 'info', arguments);
}
function debug() {
- return log$5(this.context.dataflow, 'debug', arguments);
+ return log(this.context.dataflow, 'debug', arguments);
}
function channel_luminance_value(channelValue) {
const val = channelValue / 255;
@@ -38307,11 +38390,11 @@
return Math.pow((val + 0.055) / 1.055, 2.4);
}
function luminance(color) {
- const c = rgb(color),
+ const c = rgb$1(color),
r = channel_luminance_value(c.r),
g = channel_luminance_value(c.g),
b = channel_luminance_value(c.b);
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
} // https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
@@ -38323,14 +38406,14 @@
lumL = Math.max(lum1, lum2),
lumD = Math.min(lum1, lum2);
return (lumL + 0.05) / (lumD + 0.05);
}
- function merge$3() {
+ function merge() {
const args = [].slice.call(arguments);
args.unshift({});
- return extend(...args);
+ return extend$1(...args);
}
function equal(a, b) {
return a === b || a !== a && b !== b ? true : isArray(a) ? isArray(b) && a.length === b.length ? equalArray(a, b) : false : isObject(a) && isObject(b) ? equalObject(a, b) : false;
}
@@ -38419,45 +38502,45 @@
}
const accessors = {};
function pluck(data, name) {
- const accessor = accessors[name] || (accessors[name] = field(name));
+ const accessor = accessors[name] || (accessors[name] = field$1(name));
return isArray(data) ? data.map(accessor) : accessor(data);
}
- function array$5(seq) {
+ function array(seq) {
return isArray(seq) || ArrayBuffer.isView(seq) ? seq : null;
}
- function sequence$1(seq) {
- return array$5(seq) || (isString(seq) ? seq : null);
+ function sequence(seq) {
+ return array(seq) || (isString(seq) ? seq : null);
}
- function join$1(seq, ...args) {
- return array$5(seq).join(...args);
+ function join(seq, ...args) {
+ return array(seq).join(...args);
}
function indexof(seq, ...args) {
- return sequence$1(seq).indexOf(...args);
+ return sequence(seq).indexOf(...args);
}
function lastindexof(seq, ...args) {
- return sequence$1(seq).lastIndexOf(...args);
+ return sequence(seq).lastIndexOf(...args);
}
- function slice$1(seq, ...args) {
- return sequence$1(seq).slice(...args);
+ function slice(seq, ...args) {
+ return sequence(seq).slice(...args);
}
- function replace$1(str, pattern, repl) {
+ function replace(str, pattern, repl) {
if (isFunction(repl)) error('Function argument passed to replace.');
return String(str).replace(pattern, repl);
}
- function reverse$1(seq) {
- return array$5(seq).slice().reverse();
+ function reverse(seq) {
+ return array(seq).slice().reverse();
}
function bandspace(count, paddingInner, paddingOuter) {
return bandSpace(count || 0, paddingInner || 0, paddingOuter || 0);
}
@@ -38465,11 +38548,11 @@
function bandwidth(name, group) {
const s = getScale(name, (group || this).context);
return s && s.bandwidth ? s.bandwidth() : 0;
}
- function copy$2(name, group) {
+ function copy(name, group) {
const s = getScale(name, (group || this).context);
return s ? s.copy() : undefined;
}
function domain(name, group) {
@@ -38480,42 +38563,42 @@
function invert(name, range, group) {
const s = getScale(name, (group || this).context);
return !s ? undefined : isArray(range) ? (s.invertRange || s.invert)(range) : (s.invert || s.invertExtent)(range);
}
- function range$2(name, group) {
+ function range$1(name, group) {
const s = getScale(name, (group || this).context);
return s && s.range ? s.range() : [];
}
function scale$2(name, value, group) {
const s = getScale(name, (group || this).context);
return s ? s(value) : undefined;
}
- function scaleGradient(scale$1, p0, p1, count, group) {
- scale$1 = getScale(scale$1, (group || this).context);
- const gradient = Gradient(p0, p1);
- let stops = scale$1.domain(),
+ function scaleGradient(scale, p0, p1, count, group) {
+ scale = getScale(scale, (group || this).context);
+ const gradient = Gradient$1(p0, p1);
+ let stops = scale.domain(),
min = stops[0],
- max = peek(stops),
- fraction = identity;
+ max = peek$1(stops),
+ fraction = identity$6;
if (!(max - min)) {
// expand scale if domain has zero span, fix #1479
- scale$1 = (scale$1.interpolator ? scale('sequential')().interpolator(scale$1.interpolator()) : scale('linear')().interpolate(scale$1.interpolate()).range(scale$1.range())).domain([min = 0, max = 1]);
+ scale = (scale.interpolator ? scale$4('sequential')().interpolator(scale.interpolator()) : scale$4('linear')().interpolate(scale.interpolate()).range(scale.range())).domain([min = 0, max = 1]);
} else {
- fraction = scaleFraction(scale$1, min, max);
+ fraction = scaleFraction(scale, min, max);
}
- if (scale$1.ticks) {
- stops = scale$1.ticks(+count || 15);
+ if (scale.ticks) {
+ stops = scale.ticks(+count || 15);
if (min !== stops[0]) stops.unshift(min);
- if (max !== peek(stops)) stops.push(max);
+ if (max !== peek$1(stops)) stops.push(max);
}
- stops.forEach(_ => gradient.stop(fraction(_), scale$1(_)));
+ stops.forEach(_ => gradient.stop(fraction(_), scale(_)));
return gradient;
}
function geoShape(projection, geojson, group) {
const p = getScale(projection, (group || this).context);
@@ -38532,11 +38615,11 @@
}
const datum = d => d.data;
function treeNodes(name, context) {
- const tree = data.call(context, name);
+ const tree = data$1.call(context, name);
return tree.root && tree.root.lookup || {};
}
function treePath(name, source, target) {
const nodes = treeNodes(name, this),
@@ -38568,24 +38651,24 @@
const view = this.context.dataflow,
el = view.container && view.container();
return el ? [el.clientWidth, el.clientHeight] : [undefined, undefined];
}
- function intersect$3(b, opt, group) {
+ function intersect(b, opt, group) {
if (!b) return [];
const [u, v] = b,
box = new Bounds().set(u[0], u[1], v[0], v[1]),
scene = group || this.context.dataflow.scenegraph().root;
- return intersect$1(scene, box, filter$1(opt));
+ return intersect$2(scene, box, filter(opt));
}
- function filter$1(opt) {
+ function filter(opt) {
let p = null;
if (opt) {
- const types = array(opt.marktype),
- names = array(opt.markname);
+ const types = array$5(opt.marktype),
+ names = array$5(opt.markname);
p = _ => (!types.length || types.some(t => _.marktype === t)) && (!names.length || names.some(s => _.name === s));
}
return p;
@@ -38608,18 +38691,18 @@
quantileUniform,
sampleNormal,
sampleLogNormal,
sampleUniform,
isArray,
- isBoolean,
- isDate,
+ isBoolean: isBoolean$1,
+ isDate: isDate$1,
isDefined(_) {
return _ !== undefined;
},
- isNumber,
+ isNumber: isNumber$1,
isObject,
isRegExp,
isString,
isTuple,
@@ -38630,38 +38713,38 @@
toBoolean,
toDate,
toNumber,
toString,
indexof,
- join: join$1,
+ join,
lastindexof,
- replace: replace$1,
- reverse: reverse$1,
- slice: slice$1,
+ replace,
+ reverse,
+ slice,
flush,
lerp,
- merge: merge$3,
- pad,
- peek,
+ merge,
+ pad: pad$2,
+ peek: peek$1,
pluck,
span,
inrange,
- truncate,
- rgb,
- lab,
- hcl,
- hsl,
+ truncate: truncate$1,
+ rgb: rgb$1,
+ lab: lab$1,
+ hcl: hcl$2,
+ hsl: hsl$2,
luminance,
contrast,
- sequence: range$1,
- format: format$3,
- utcFormat: utcFormat$1,
- utcParse: utcParse$1,
+ sequence: range$1$1,
+ format,
+ utcFormat,
+ utcParse,
utcOffset,
utcSequence,
- timeFormat: timeFormat$1,
- timeParse: timeParse$1,
+ timeFormat,
+ timeParse,
timeOffset,
timeSequence,
timeUnitSpecifier,
monthFormat,
monthAbbrevFormat,
@@ -38676,11 +38759,11 @@
warn,
info,
debug,
extent,
inScope,
- intersect: intersect$3,
+ intersect,
clampRange,
pinchDistance,
pinchAngle,
screen,
containerSize,
@@ -38694,11 +38777,11 @@
panSymlog,
zoomLinear,
zoomLog,
zoomPow,
zoomSymlog,
- encode: encode$1,
+ encode,
modify
};
const eventFunctions = ['view', 'item', 'group', 'xy', 'x', 'y'],
// event functions
eventPrefix = 'event.vega.',
@@ -38710,11 +38793,11 @@
const codegenParams = {
forbidden: ['_'],
allowed: ['datum', 'event', 'item'],
fieldvar: 'datum',
- globalvar: id => "_[".concat($(SignalPrefix + id), "]"),
+ globalvar: id => `_[${$(SignalPrefix + id)}]`,
functions: buildFunctions,
constants: Constants,
visitors: astVisitors
}; // export code generator
@@ -38726,11 +38809,11 @@
for (const name in functionContext) {
fn[name] = thisPrefix + name;
}
- extend(fn, internalScaleFunctions(codegen, functionContext, astVisitors));
+ extend$1(fn, internalScaleFunctions(codegen, functionContext, astVisitors));
return fn;
} // Register an expression function
function expressionFunction(name, fn, visitor) {
@@ -38748,38 +38831,38 @@
return this;
} // register expression functions with ast visitors
expressionFunction('bandwidth', bandwidth, scaleVisitor);
- expressionFunction('copy', copy$2, scaleVisitor);
+ expressionFunction('copy', copy, scaleVisitor);
expressionFunction('domain', domain, scaleVisitor);
- expressionFunction('range', range$2, scaleVisitor);
+ expressionFunction('range', range$1, scaleVisitor);
expressionFunction('invert', invert, scaleVisitor);
expressionFunction('scale', scale$2, scaleVisitor);
expressionFunction('gradient', scaleGradient, scaleVisitor);
expressionFunction('geoArea', geoArea, scaleVisitor);
expressionFunction('geoBounds', geoBounds, scaleVisitor);
expressionFunction('geoCentroid', geoCentroid, scaleVisitor);
expressionFunction('geoShape', geoShape, scaleVisitor);
expressionFunction('indata', indata, indataVisitor);
- expressionFunction('data', data, dataVisitor);
+ expressionFunction('data', data$1, dataVisitor);
expressionFunction('treePath', treePath, dataVisitor);
expressionFunction('treeAncestors', treeAncestors, dataVisitor); // register Vega-Lite selection functions
expressionFunction('vlSelectionTest', selectionTest, selectionVisitor);
expressionFunction('vlSelectionIdTest', selectionIdTest, selectionVisitor);
expressionFunction('vlSelectionResolve', selectionResolve, selectionVisitor);
expressionFunction('vlSelectionTuples', selectionTuples);
- function parser$1(expr, scope) {
+ function parser(expr, scope) {
const params = {}; // parse the expression to an abstract syntax tree (ast)
let ast;
try {
expr = isString(expr) ? expr : $(expr) + '';
- ast = parser(expr);
+ ast = parser$1(expr);
} catch (err) {
error('Expression parse error: ' + expr);
} // analyze ast function calls for dependencies
@@ -38793,17 +38876,17 @@
const gen = codeGenerator(ast); // collect signal dependencies
gen.globals.forEach(name => {
const signalName = SignalPrefix + name;
- if (!has(params, signalName) && scope.getSignal(name)) {
+ if (!has$1(params, signalName) && scope.getSignal(name)) {
params[signalName] = scope.signalRef(name);
}
}); // return generated expression code and dependencies
return {
- $expr: extend({
+ $expr: extend$1({
code: gen.code
}, scope.options.ast ? {
ast
} : null),
$fields: gen.fields,
@@ -38813,11 +38896,11 @@
/**
* Parse a serialized dataflow specification.
*/
- function parse$3(spec) {
+ function parse$2(spec) {
const ctx = this,
operators = spec.operators || []; // parse background
if (spec.background) {
ctx.background = spec.background;
@@ -38842,16 +38925,16 @@
(spec.updates || []).forEach(entry => ctx.parseUpdate(entry));
return ctx.resolve();
}
- const Skip = toSet(['rule']),
+ const Skip$2 = toSet(['rule']),
Swap = toSet(['group', 'image', 'rect']);
function adjustSpatial(encode, marktype) {
let code = '';
- if (Skip[marktype]) return code;
+ if (Skip$2[marktype]) return code;
if (encode.x2) {
if (encode.x) {
if (Swap[marktype]) {
code += 'if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;';
@@ -38898,21 +38981,24 @@
return canonicalType(type) === 'collect';
}
function expression(ctx, args, code) {
// wrap code in return statement if expression does not terminate
- if (code[code.length - 1] !== ';') {
+ if (!code.endsWith(';')) {
code = 'return(' + code + ');';
}
const fn = Function(...args.concat(code));
return ctx && ctx.functions ? fn.bind(ctx.functions) : fn;
} // generate code for comparing a single field
function _compare(u, v, lt, gt) {
- return "((u = ".concat(u, ") < (v = ").concat(v, ") || u == null) && v != null ? ").concat(lt, "\n : (u > v || v == null) && u != null ? ").concat(gt, "\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(lt, "\n : v !== v && u === u ? ").concat(gt, " : ");
+ return `((u = ${u}) < (v = ${v}) || u == null) && v != null ? ${lt}
+ : (u > v || v == null) && u != null ? ${gt}
+ : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${lt}
+ : v !== v && u === u ? ${gt} : `;
}
var expressionCodegen = {
/**
* Parse an expression used to update an operator value.
@@ -38931,11 +39017,11 @@
/**
* Parse an expression used to handle an event-driven operator update.
*/
handler: (ctx, expr) => {
- const code = "var datum=event.item&&event.item.datum;return ".concat(expr.code, ";");
+ const code = `var datum=event.item&&event.item.datum;return ${expr.code};`;
return expression(ctx, ['_', 'event'], code);
},
/**
* Parse an expression that performs visual encoding.
@@ -38947,11 +39033,11 @@
} = encode;
let code = 'var o=item,datum=o.datum,m=0,$;';
for (const name in channels) {
const o = 'o[' + $(name) + ']';
- code += "$=".concat(channels[name].code, ";if(").concat(o, "!==$)").concat(o, "=$,m=1;");
+ code += `$=${channels[name].code};if(${o}!==$)${o}=$,m=1;`;
}
code += adjustSpatial(channels, marktype);
code += 'return m;';
return expression(ctx, ['item', '_'], code);
@@ -38960,12 +39046,12 @@
/**
* Optimized code generators for access and comparison.
*/
codegen: {
get(path) {
- const ref = "[".concat(path.map($).join(']['), "]");
- const get = Function('_', "return _".concat(ref, ";"));
+ const ref = `[${path.map($).join('][')}]`;
+ const get = Function('_', `return _${ref};`);
get.path = ref;
return get;
},
comparator(fields, orders) {
@@ -38974,16 +39060,16 @@
const map = (f, i) => {
const o = orders[i];
let u, v;
if (f.path) {
- u = "a".concat(f.path);
- v = "b".concat(f.path);
+ u = `a${f.path}`;
+ v = `b${f.path}`;
} else {
(t = t || {})['f' + i] = f;
- u = "this.f".concat(i, "(a)");
- v = "this.f".concat(i, "(b)");
+ u = `this.f${i}(a)`;
+ v = `this.f${i}(b)`;
}
return _compare(u, v, -o, o);
};
@@ -39023,33 +39109,33 @@
/**
* Parse a set of operator parameters.
*/
- function parseParameters(spec, params) {
+ function parseParameters$1(spec, params) {
params = params || {};
const ctx = this;
for (const key in spec) {
const value = spec[key];
- params[key] = isArray(value) ? value.map(v => parseParameter(v, ctx, params)) : parseParameter(value, ctx, params);
+ params[key] = isArray(value) ? value.map(v => parseParameter$2(v, ctx, params)) : parseParameter$2(value, ctx, params);
}
return params;
}
/**
* Parse a single parameter.
*/
- function parseParameter(spec, ctx, params) {
+ function parseParameter$2(spec, ctx, params) {
if (!spec || !isObject(spec)) return spec;
for (let i = 0, n = PARSERS.length, p; i < n; ++i) {
p = PARSERS[i];
- if (has(spec, p.key)) {
+ if (has$1(spec, p.key)) {
return p.parse(spec, ctx, params);
}
}
return spec;
@@ -39066,11 +39152,11 @@
}, {
key: '$expr',
parse: getExpression
}, {
key: '$field',
- parse: getField$1
+ parse: getField
}, {
key: '$encode',
parse: getEncode
}, {
key: '$compare',
@@ -39101,12 +39187,12 @@
if (_.$params) {
// parse expression parameters
ctx.parseParameters(_.$params, params);
}
- const k = 'e:' + _.$expr.code + '_' + _.$name;
- return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields, _.$name));
+ const k = 'e:' + _.$expr.code;
+ return ctx.fn[k] || (ctx.fn[k] = accessor(ctx.parameterExpression(_.$expr), _.$fields));
}
/**
* Resolve a key accessor reference.
*/
@@ -39118,26 +39204,26 @@
/**
* Resolve a field accessor reference.
*/
- function getField$1(_, ctx) {
+ function getField(_, ctx) {
if (!_.$field) return null;
const k = 'f:' + _.$field + '_' + _.$name;
- return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name, ctx.expr.codegen));
+ return ctx.fn[k] || (ctx.fn[k] = field$1(_.$field, _.$name, ctx.expr.codegen));
}
/**
* Resolve a comparator function reference.
*/
function getCompare(_, ctx) {
// As of Vega 5.5.3, $tupleid sort is no longer used.
// Keep here for now for backwards compatibility.
const k = 'c:' + _.$compare + '_' + _.$order,
- c = array(_.$compare).map(_ => _ && _.$tupleid ? tupleid : _);
- return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order, ctx.expr.codegen));
+ c = array$5(_.$compare).map(_ => _ && _.$tupleid ? tupleid : _);
+ return ctx.fn[k] || (ctx.fn[k] = compare$1(c, _.$order, ctx.expr.codegen));
}
/**
* Resolve an encode operator reference.
*/
@@ -39191,11 +39277,11 @@
/**
* Parse an event stream specification.
*/
- function parseStream(spec) {
+ function parseStream$2(spec) {
var ctx = this,
filter = spec.filter != null ? ctx.eventExpression(spec.filter) : undefined,
stream = spec.stream != null ? ctx.get(spec.stream) : undefined,
args;
@@ -39233,11 +39319,11 @@
/**
* Parse an event-driven operator update.
*/
- function parseUpdate(spec) {
+ function parseUpdate$1(spec) {
var ctx = this,
srcid = isObject(srcid = spec.source) ? srcid.$ref : srcid,
source = ctx.get(srcid),
target = null,
update = spec.update,
@@ -39254,15 +39340,15 @@
}
ctx.update(spec, source, target, update, params);
}
- const SKIP$3 = {
+ const SKIP = {
skip: true
};
- function getState(options) {
+ function getState$1(options) {
var ctx = this,
state = {};
if (options.signals) {
var signals = state.signals = {};
@@ -39291,17 +39377,17 @@
}
return state;
}
- function setState(state) {
+ function setState$1(state) {
var ctx = this,
df = ctx.dataflow,
data = state.data,
signals = state.signals;
Object.keys(signals || {}).forEach(key => {
- df.update(ctx.signals[key], signals[key], SKIP$3);
+ df.update(ctx.signals[key], signals[key], SKIP);
});
Object.keys(data || {}).forEach(key => {
df.pulse(ctx.data[key].input, df.changeset().remove(truthy).insert(data[key]));
});
(state.subcontext || []).forEach((substate, i) => {
@@ -39314,11 +39400,11 @@
* Enables lookup of parsed operators, event streams, accessors, etc.
* Provides a 'fork' method for creating child contexts for subflows.
*/
- function context$2(df, transforms, functions, expr) {
+ function context(df, transforms, functions, expr) {
return new Context(df, transforms, functions, expr);
}
function Context(df, transforms, functions, expr) {
this.dataflow = df;
@@ -39474,19 +39560,19 @@
encodeExpression(encode) {
return this.expr.encode(this, encode);
},
// parse methods
- parse: parse$3,
+ parse: parse$2,
parseOperator,
parseOperatorParameters,
- parseParameters,
- parseStream,
- parseUpdate,
+ parseParameters: parseParameters$1,
+ parseStream: parseStream$2,
+ parseUpdate: parseUpdate$1,
// state methods
- getState,
- setState
+ getState: getState$1,
+ setState: setState$1
};
function initializeAria(view) {
const el = view.container();
@@ -39500,11 +39586,11 @@
function ariaLabel(el, desc) {
if (el) desc == null ? el.removeAttribute('aria-label') : el.setAttribute('aria-label', desc);
}
- function background$1(view) {
+ function background(view) {
// respond to background signal
view.add(null, _ => {
view._background = _.bg;
view._resize = 1;
return _.bg;
@@ -39557,18 +39643,18 @@
}
function dataref(view, name) {
var data = view._runtime.data;
- if (!has(data, name)) {
+ if (!has$1(data, name)) {
error('Unrecognized data set: ' + name);
}
return data[name];
}
- function data$1(name, values) {
+ function data(name, values) {
return arguments.length < 2 ? dataref(this, name).values.value : change.call(this, name, changeset().remove(truthy).insert(values));
}
function change(name, changes) {
if (!isChangeSet(changes)) {
@@ -39596,18 +39682,18 @@
function height(view) {
var padding = view.padding();
return Math.max(0, view._viewHeight + padding.top + padding.bottom);
}
- function offset$2(view) {
+ function offset(view) {
var padding = view.padding(),
origin = view._origin;
return [padding.left + origin[0], padding.top + origin[1]];
}
function resizeRenderer(view) {
- var origin = offset$2(view),
+ var origin = offset(view),
w = width(view),
h = height(view);
view._renderer.background(view.background());
@@ -39657,13 +39743,13 @@
p,
e,
translate;
if (el) {
- translate = offset$2(view);
+ translate = offset(view);
e = event.changedTouches ? event.changedTouches[0] : event;
- p = point$5(e, el);
+ p = point(e, el);
p[0] -= translate[0];
p[1] -= translate[1];
}
event.dataflow = view;
@@ -39700,20 +39786,20 @@
return p;
}
return {
- view: constant(view),
- item: constant(item || {}),
+ view: constant$4(view),
+ item: constant$4(item || {}),
group: group,
xy: xy,
x: item => xy(item)[0],
y: item => xy(item)[1]
};
}
- const VIEW = 'view',
+ const VIEW$1 = 'view',
TIMER = 'timer',
WINDOW = 'window',
NO_TRAP = {
trap: false
};
@@ -39722,11 +39808,11 @@
* @param {object} config - The configuration settings.
* @return {object}
*/
function initializeEventConfig(config) {
- const events = extend({
+ const events = extend$1({
defaults: {}
}, config);
const unpack = (obj, keys) => {
keys.forEach(k => {
@@ -39737,10 +39823,18 @@
unpack(events.defaults, ['prevent', 'allow']);
unpack(events, ['view', 'window', 'selector']);
return events;
}
+ function trackEventListener(view, sources, type, handler) {
+ view._eventListeners.push({
+ type: type,
+ sources: array$5(sources),
+ handler: handler
+ });
+ }
+
function prevent(view, type) {
var def = view._eventConfig.defaults,
prevent = def.prevent,
allow = def.allow;
return prevent === false || allow === true ? false : prevent === true || allow === false ? true : prevent ? prevent[type] : allow ? !allow[type] : view.preventDefault();
@@ -39748,11 +39842,11 @@
function permit(view, key, type) {
const rule = view._eventConfig && view._eventConfig[key];
if (rule === false || isObject(rule) && !rule[type]) {
- view.warn("Blocked ".concat(key, " ").concat(type, " event listener."));
+ view.warn(`Blocked ${key} ${type} event listener.`);
return false;
}
return true;
}
@@ -39763,16 +39857,16 @@
* @param {function(object): boolean} [filter] - Event filter function.
* @return {EventStream}
*/
- function events$1(source, type, filter) {
+ function events(source, type, filter) {
var view = this,
s = new EventStream(filter),
send = function (e, item) {
view.runAsync(null, () => {
- if (source === VIEW && prevent(view, type)) {
+ if (source === VIEW$1 && prevent(view, type)) {
e.preventDefault();
}
s.receive(eventExtend(view, e, item));
});
@@ -39781,11 +39875,11 @@
if (source === TIMER) {
if (permit(view, 'timer', type)) {
view.timer(send, type);
}
- } else if (source === VIEW) {
+ } else if (source === VIEW$1) {
if (permit(view, 'view', type)) {
// send traps errors, so use {trap: false} option
view.addEventListener(type, send, NO_TRAP);
}
} else {
@@ -39804,15 +39898,11 @@
} else {
for (var i = 0, n = sources.length; i < n; ++i) {
sources[i].addEventListener(type, send);
}
- view._eventListeners.push({
- type: type,
- sources: sources,
- handler: send
- });
+ trackEventListener(view, sources, type, send);
}
}
return s;
}
@@ -39878,11 +39968,11 @@
}
return this;
}
- function element$1(tag, attr, text) {
+ function element(tag, attr, text) {
const el = document.createElement(tag);
for (const key in attr) el.setAttribute(key, attr[key]);
if (text != null) el.textContent = text;
@@ -39904,22 +39994,22 @@
* @param {object} param - The binding parameters which specify the signal
* to bind to, the input element type, and type-specific configuration.
* @return {View} - This view instance.
*/
- function bind$1(view, el, binding) {
+ function bind(view, el, binding) {
if (!el) return;
const param = binding.param;
let bind = binding.state;
if (!bind) {
bind = binding.state = {
elements: null,
active: false,
set: null,
update: value => {
- if (value !== view.signal(param.signal)) {
+ if (value != view.signal(param.signal)) {
view.runAsync(null, () => {
bind.source = true;
view.signal(param.signal, value);
});
}
@@ -39929,11 +40019,12 @@
if (param.debounce) {
bind.update = debounce(param.debounce, bind.update);
}
}
- generate(bind, el, param, view.signal(param.signal));
+ const create = param.input == null && param.element ? target : generate;
+ create(bind, el, param, view);
if (!bind.active) {
view.on(view._signals[param.signal], null, () => {
bind.source ? bind.source = false : bind.set(view.signal(param.signal));
});
@@ -39941,20 +40032,49 @@
}
return bind;
}
/**
+ * Bind the signal to an external EventTarget.
+ */
+
+
+ function target(bind, node, param, view) {
+ const type = param.event || 'input';
+
+ const handler = () => bind.update(node.value); // initialize signal value to external input value
+
+
+ view.signal(param.signal, node.value); // listen for changes on the element
+
+ node.addEventListener(type, handler); // register with view, so we can remove it upon finalization
+
+ trackEventListener(view, node, type, handler); // propagate change to element
+
+ bind.set = value => {
+ node.value = value;
+ node.dispatchEvent(event(type));
+ };
+ }
+
+ function event(type) {
+ return typeof Event !== 'undefined' ? new Event(type) : {
+ type
+ };
+ }
+ /**
* Generate an HTML input form element and bind it to a signal.
*/
- function generate(bind, el, param, value) {
- const div = element$1('div', {
+ function generate(bind, el, param, view) {
+ const value = view.signal(param.signal);
+ const div = element('div', {
'class': BindClass
});
- const wrapper = param.input === 'radio' ? div : div.appendChild(element$1('label'));
- wrapper.appendChild(element$1('span', {
+ const wrapper = param.input === 'radio' ? div : div.appendChild(element('label'));
+ wrapper.appendChild(element('span', {
'class': NameClass
}, param.name || param.signal));
el.appendChild(div);
let input = form;
@@ -39970,11 +40090,11 @@
case 'radio':
input = radio;
break;
case 'range':
- input = range$3;
+ input = range;
break;
}
input(bind, wrapper, param, value);
}
@@ -39983,11 +40103,11 @@
* The input type is controlled via user-provided parameters.
*/
function form(bind, el, param, value) {
- const node = element$1('input');
+ const node = element('input');
for (const key in param) {
if (key !== 'signal' && key !== 'element') {
node.setAttribute(key === 'input' ? 'type' : key, param[key]);
}
@@ -40010,11 +40130,11 @@
const attr = {
type: 'checkbox',
name: param.signal
};
if (value) attr.checked = true;
- const node = element$1('input', attr);
+ const node = element('input', attr);
el.appendChild(node);
node.addEventListener('change', () => bind.update(node.checked));
bind.elements = [node];
bind.set = value => node.checked = !!value || null;
@@ -40023,20 +40143,20 @@
* Generates a selection list input element.
*/
function select(bind, el, param, value) {
- const node = element$1('select', {
+ const node = element('select', {
name: param.signal
}),
labels = param.labels || [];
param.options.forEach((option, i) => {
const attr = {
value: option
};
if (valuesEqual(option, value)) attr.selected = true;
- node.appendChild(element$1('option', attr, (labels[i] || option) + ''));
+ node.appendChild(element('option', attr, (labels[i] || option) + ''));
});
el.appendChild(node);
node.addEventListener('change', () => {
bind.update(param.options[node.selectedIndex]);
});
@@ -40055,11 +40175,11 @@
* Generates a radio button group.
*/
function radio(bind, el, param, value) {
- const group = element$1('span', {
+ const group = element('span', {
'class': RadioClass
}),
labels = param.labels || [];
el.appendChild(group);
bind.elements = param.options.map((option, i) => {
@@ -40067,13 +40187,13 @@
type: 'radio',
name: param.signal,
value: option
};
if (valuesEqual(option, value)) attr.checked = true;
- const input = element$1('input', attr);
+ const input = element('input', attr);
input.addEventListener('change', () => bind.update(option));
- const label = element$1('label', {}, (labels[i] || option) + '');
+ const label = element('label', {}, (labels[i] || option) + '');
label.prepend(input);
group.appendChild(label);
return input;
});
@@ -40089,24 +40209,24 @@
/**
* Generates a slider input element.
*/
- function range$3(bind, el, param, value) {
+ function range(bind, el, param, value) {
value = value !== undefined ? value : (+param.max + +param.min) / 2;
const max = param.max != null ? param.max : Math.max(100, +value) || 100,
min = param.min || Math.min(0, max, +value) || 0,
step = param.step || tickStep(min, max, 100);
- const node = element$1('input', {
+ const node = element('input', {
type: 'range',
name: param.signal,
min: min,
max: max,
step: step
});
node.value = value;
- const span = element$1('span', {}, +value);
+ const span = element('span', {}, +value);
el.appendChild(node);
el.appendChild(span);
const update = () => {
span.textContent = node.value;
@@ -40128,11 +40248,11 @@
return a === b || a + '' === b + '';
}
function initializeRenderer(view, r, el, constructor, scaleFactor, opt) {
r = r || new constructor(view.loader());
- return r.initialize(el, width(view), height(view), offset$2(view), scaleFactor, opt).background(view.background());
+ return r.initialize(el, width(view), height(view), offset(view), scaleFactor, opt).background(view.background());
}
function trap(view, fn) {
return !fn ? null : function () {
try {
@@ -40143,28 +40263,28 @@
};
}
function initializeHandler(view, prevHandler, el, constructor) {
// instantiate scenegraph handler
- const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset$2(view), view); // transfer event handlers
+ const handler = new constructor(view.loader(), trap(view, view.tooltip())).scene(view.scenegraph().root).initialize(el, offset(view), view); // transfer event handlers
if (prevHandler) {
prevHandler.handlers().forEach(h => {
handler.on(h.type, h.handler);
});
}
return handler;
}
- function initialize$1(el, elBind) {
+ function initialize(el, elBind) {
const view = this,
type = view._renderType,
config = view._eventConfig.bind,
module = renderModule(type); // containing dom element
- el = view._el = el ? lookup$3(view, el) : null; // initialize aria attributes
+ el = view._el = el ? lookup$1(view, el, true) : null; // initialize aria attributes
initializeAria(view); // select appropriate renderer & handler
if (!module) view.error('Unrecognized renderer type: ' + type);
const Handler = module.handler || CanvasHandler,
@@ -40173,29 +40293,29 @@
view._renderer = !Renderer ? null : initializeRenderer(view, view._renderer, el, Renderer);
view._handler = initializeHandler(view, view._handler, el, Handler);
view._redraw = true; // initialize signal bindings
if (el && config !== 'none') {
- elBind = elBind ? view._elBind = lookup$3(view, elBind) : el.appendChild(element$1('form', {
+ elBind = elBind ? view._elBind = lookup$1(view, elBind, true) : el.appendChild(element('form', {
'class': 'vega-bindings'
}));
view._bind.forEach(_ => {
if (_.param.element && config !== 'container') {
- _.element = lookup$3(view, _.param.element);
+ _.element = lookup$1(view, _.param.element, !!_.param.input);
}
});
view._bind.forEach(_ => {
- bind$1(view, _.element || elBind, _);
+ bind(view, _.element || elBind, _);
});
}
return view;
}
- function lookup$3(view, el) {
+ function lookup$1(view, el, clear) {
if (typeof el === 'string') {
if (typeof document !== 'undefined') {
el = document.querySelector(el);
if (!el) {
@@ -40206,11 +40326,11 @@
view.error('DOM document instance not found.');
return null;
}
}
- if (el) {
+ if (el && clear) {
try {
el.innerHTML = '';
} catch (e) {
el = null;
view.error(e);
@@ -40218,26 +40338,26 @@
}
return el;
}
- const number$5 = _ => +_ || 0;
+ const number$1 = _ => +_ || 0;
- const paddingObject = _ => ({
+ const paddingObject$1 = _ => ({
top: _,
bottom: _,
left: _,
right: _
});
function padding(_) {
return isObject(_) ? {
- top: number$5(_.top),
- bottom: number$5(_.bottom),
- left: number$5(_.left),
- right: number$5(_.right)
- } : paddingObject(number$5(_));
+ top: number$1(_.top),
+ bottom: number$1(_.bottom),
+ left: number$1(_.left),
+ right: number$1(_.right)
+ } : paddingObject$1(number$1(_));
}
/**
* Render the current scene in a headless fashion.
* This method is asynchronous, returning a Promise instance.
* @return {Promise} - A Promise that resolves to a renderer.
@@ -40299,47 +40419,47 @@
const r = await renderHeadless(this, RenderType.SVG, scaleFactor);
return r.svg();
}
function runtime(view, spec, expr) {
- return context$2(view, transforms, functionContext, expr).parse(spec);
+ return context(view, transforms, functionContext, expr).parse(spec);
}
- function scale$3(name) {
+ function scale$1(name) {
var scales = this._runtime.scales;
- if (!has(scales, name)) {
+ if (!has$1(scales, name)) {
error('Unrecognized scale or projection: ' + name);
}
return scales[name].value;
}
var Width = 'width',
Height = 'height',
- Padding$1 = 'padding',
+ Padding = 'padding',
Skip$1 = {
skip: true
};
function viewWidth(view, width) {
var a = view.autosize(),
p = view.padding();
- return width - (a && a.contains === Padding$1 ? p.left + p.right : 0);
+ return width - (a && a.contains === Padding ? p.left + p.right : 0);
}
function viewHeight(view, height) {
var a = view.autosize(),
p = view.padding();
- return height - (a && a.contains === Padding$1 ? p.top + p.bottom : 0);
+ return height - (a && a.contains === Padding ? p.top + p.bottom : 0);
}
function initializeResize(view) {
var s = view._signals,
w = s[Width],
h = s[Height],
- p = s[Padding$1];
+ p = s[Padding];
function resetSize() {
view._autosize = view._resize = 1;
} // respond to width signal
@@ -40431,11 +40551,11 @@
* state should recursively include state from group mark sub-contexts.
* @return {object} - An object containing the exported state values.
*/
- function getState$1(options) {
+ function getState(options) {
return this._runtime.getState(options || {
data: dataTest,
signals: signalTest,
recurse: true
});
@@ -40454,54 +40574,54 @@
* data set values, following the format used by the getState method.
* @return {View} - This view instance.
*/
- function setState$1(state) {
+ function setState(state) {
this.runAsync(null, v => {
v._trigger = false;
v._runtime.setState(state);
}, v => {
v._trigger = true;
});
return this;
}
- function timer$1(callback, delay) {
+ function timer(callback, delay) {
function tick(elapsed) {
callback({
timestamp: Date.now(),
elapsed: elapsed
});
}
- this._timers.push(interval$1(tick, delay));
+ this._timers.push(interval(tick, delay));
}
- function defaultTooltip$1(handler, event, item, value) {
+ function defaultTooltip(handler, event, item, value) {
const el = handler.element();
if (el) el.setAttribute('title', formatTooltip(value));
}
function formatTooltip(value) {
- return value == null ? '' : isArray(value) ? formatArray(value) : isObject(value) && !isDate(value) ? formatObject(value) : value + '';
+ return value == null ? '' : isArray(value) ? formatArray(value) : isObject(value) && !isDate$1(value) ? formatObject(value) : value + '';
}
function formatObject(obj) {
return Object.keys(obj).map(key => {
const v = obj[key];
- return key + ': ' + (isArray(v) ? formatArray(v) : formatValue$1(v));
+ return key + ': ' + (isArray(v) ? formatArray(v) : formatValue(v));
}).join('\n');
}
function formatArray(value) {
- return '[' + value.map(formatValue$1).join(', ') + ']';
+ return '[' + value.map(formatValue).join(', ') + ']';
}
- function formatValue$1(value) {
- return isArray(value) ? '[\u2026]' : isObject(value) && !isDate(value) ? '{\u2026}' : value;
+ function formatValue(value) {
+ return isArray(value) ? '[\u2026]' : isObject(value) && !isDate$1(value) ? '{\u2026}' : value;
}
/**
* Create a new View instance from a Vega dataflow runtime specification.
* The generated View will not immediately be ready for display. Callers
* should also invoke the initialize method (e.g., to set the parent
@@ -40511,31 +40631,31 @@
* @constructor
* @param {object} spec - The Vega dataflow runtime specification.
*/
- function View(spec, options) {
+ function View$1(spec, options) {
const view = this;
options = options || {};
Dataflow.call(view);
if (options.loader) view.loader(options.loader);
if (options.logger) view.logger(options.logger);
if (options.logLevel != null) view.logLevel(options.logLevel);
if (options.locale || spec.locale) {
- const loc = extend({}, spec.locale, options.locale);
- view.locale(locale$2(loc.number, loc.time));
+ const loc = extend$1({}, spec.locale, options.locale);
+ view.locale(locale(loc.number, loc.time));
}
view._el = null;
view._elBind = null;
view._renderType = options.renderer || RenderType.Canvas;
view._scenegraph = new Scenegraph();
const root = view._scenegraph.root; // initialize renderer, handler and event management
view._renderer = null;
- view._tooltip = options.tooltip || defaultTooltip$1, view._redraw = true;
+ view._tooltip = options.tooltip || defaultTooltip, view._redraw = true;
view._handler = new CanvasHandler().scene(root);
view._globalCursor = false;
view._preventDefault = false;
view._timers = [];
view._eventListeners = [];
@@ -40547,11 +40667,11 @@
const ctx = runtime(view, spec, options.expr);
view._runtime = ctx;
view._signals = ctx.signals;
view._bind = (spec.bindings || []).map(_ => ({
state: null,
- param: extend({}, _)
+ param: extend$1({}, _)
})); // initialize scenegraph
if (ctx.root) ctx.root.set(root);
root.source = ctx.data.root.input;
view.pulse(ctx.data.root.input, view.changeset().insert(root.items)); // initialize view size
@@ -40563,11 +40683,11 @@
view._origin = [0, 0];
view._resize = 0;
view._autosize = 1;
initializeResize(view); // initialize background color
- background$1(view); // initialize cursor
+ background(view); // initialize cursor
cursor(view); // initialize view description
view.description(spec.description); // initialize hover proessing, if requested
@@ -40575,11 +40695,11 @@
if (options.container) view.initialize(options.container, options.bind);
}
function lookupSignal(view, name) {
- return has(view._signals, name) ? view._signals[name] : error('Unrecognized signal name: ' + $(name));
+ return has$1(view._signals, name) ? view._signals[name] : error('Unrecognized signal name: ' + $(name));
}
function findOperatorHandler(op, handler) {
const h = (op._targets || []).filter(op => op._update && op._update.handler === handler);
return h.length ? h[0] : null;
@@ -40601,11 +40721,11 @@
const h = findOperatorHandler(op, handler);
if (h) op._targets.remove(h);
return view;
}
- inherits(View, Dataflow, {
+ inherits(View$1, Dataflow, {
// -- DATAFLOW / RENDERING ----
async evaluate(encode, prerun, postrun) {
// evaluate dataflow and prerun
await Dataflow.prototype.evaluate.call(this, encode, prerun); // render as needed
@@ -40836,42 +40956,42 @@
} else {
return this._preventDefault;
}
},
- timer: timer$1,
- events: events$1,
+ timer,
+ events,
finalize,
hover,
// -- DATA ----
- data: data$1,
+ data,
change,
insert,
remove,
// -- SCALES --
- scale: scale$3,
+ scale: scale$1,
// -- INITIALIZATION ----
- initialize: initialize$1,
+ initialize,
// -- HEADLESS RENDERING ----
toImageURL: renderToImageURL,
toCanvas: renderToCanvas,
toSVG: renderToSVG,
// -- SAVE / RESTORE STATE ----
- getState: getState$1,
- setState: setState$1
+ getState,
+ setState
});
- const VIEW$1 = 'view',
+ const VIEW = 'view',
LBRACK = '[',
RBRACK = ']',
LBRACE = '{',
RBRACE = '}',
COLON = ':',
COMMA = ',',
NAME = '@',
GT = '>',
- ILLEGAL$1 = /[[\]{}]/,
+ ILLEGAL = /[[\]{}]/,
DEFAULT_MARKS = {
'*': 1,
arc: 1,
area: 1,
group: 1,
@@ -40890,20 +41010,20 @@
* Parse an event selector string.
* Returns an array of event stream definitions.
*/
function eventSelector(selector, source, marks) {
- DEFAULT_SOURCE = source || VIEW$1;
+ DEFAULT_SOURCE = source || VIEW;
MARKS = marks || DEFAULT_MARKS;
return parseMerge(selector.trim()).map(parseSelector);
}
function isMarkType(type) {
return MARKS[type];
}
- function find$2(s, i, endChar, pushChar, popChar) {
+ function find(s, i, endChar, pushChar, popChar) {
const n = s.length;
let count = 0,
c;
for (; i < n; ++i) {
@@ -40919,11 +41039,11 @@
n = s.length;
let start = 0,
i = 0;
while (i < n) {
- i = find$2(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);
+ i = find(s, i, COMMA, LBRACK + LBRACE, RBRACK + RBRACE);
output.push(s.substring(start, i).trim());
start = ++i;
}
if (output.length === 0) {
@@ -40939,11 +41059,11 @@
function parseBetween(s) {
const n = s.length;
let i = 1,
b;
- i = find$2(s, i, RBRACK, LBRACK, RBRACK);
+ i = find(s, i, RBRACK, LBRACK, RBRACK);
if (i === n) {
throw 'Empty between selector: ' + s;
}
@@ -41006,19 +41126,19 @@
if (!n) throw s; // set name flag based on first char
if (s[0] === NAME) markname = ++i; // extract first part of multi-part stream selector
- j = find$2(s, i, COLON);
+ j = find(s, i, COLON);
if (j < n) {
source.push(s.substring(start, j).trim());
start = i = ++j;
} // extract remaining part of stream selector
- i = find$2(s, i, LBRACK);
+ i = find(s, i, LBRACK);
if (i === n) {
source.push(s.substring(start, n).trim());
} else {
source.push(s.substring(start, i).trim());
@@ -41027,19 +41147,19 @@
if (start === n) throw 'Unmatched left bracket: ' + s;
} // extract filters
while (i < n) {
- i = find$2(s, i, RBRACK);
+ i = find(s, i, RBRACK);
if (i === n) throw 'Unmatched left bracket: ' + s;
filter.push(s.substring(start, i).trim());
if (i < n - 1 && s[++i] !== LBRACK) throw 'Expected left bracket: ' + s;
start = ++i;
} // marshall event stream specification
- if (!(n = source.length) || ILLEGAL$1.test(source[n - 1])) {
+ if (!(n = source.length) || ILLEGAL.test(source[n - 1])) {
throw 'Invalid event selector: ' + s;
}
if (n > 1) {
stream.type = source[1];
@@ -41080,29 +41200,29 @@
return isObject(spec) ? spec : {
type: spec || 'pad'
};
}
- const number$6 = _ => +_ || 0;
+ const number = _ => +_ || 0;
- const paddingObject$1 = _ => ({
+ const paddingObject = _ => ({
top: _,
bottom: _,
left: _,
right: _
});
function parsePadding(spec) {
- return !isObject(spec) ? paddingObject$1(number$6(spec)) : spec.signal ? spec : {
- top: number$6(spec.top),
- bottom: number$6(spec.bottom),
- left: number$6(spec.left),
- right: number$6(spec.right)
+ return !isObject(spec) ? paddingObject(number(spec)) : spec.signal ? spec : {
+ top: number(spec.top),
+ bottom: number(spec.bottom),
+ left: number(spec.left),
+ right: number(spec.right)
};
}
- const encoder = _ => isObject(_) && !isArray(_) ? extend({}, _) : {
+ const encoder = _ => isObject(_) && !isArray(_) ? extend$1({}, _) : {
value: _
};
function addEncode(object, name, value, set) {
if (value != null) {
@@ -41132,77 +41252,77 @@
}
}
function extendEncode(encode, extra, skip) {
for (const name in extra) {
- if (skip && has(skip, name)) continue;
- encode[name] = extend(encode[name] || {}, extra[name]);
+ if (skip && has$1(skip, name)) continue;
+ encode[name] = extend$1(encode[name] || {}, extra[name]);
}
return encode;
}
- function has$1(key, encode) {
+ function has(key, encode) {
return encode && (encode.enter && encode.enter[key] || encode.update && encode.update[key]);
}
const MarkRole = 'mark';
- const FrameRole$1 = 'frame';
- const ScopeRole$1 = 'scope';
- const AxisRole$1 = 'axis';
+ const FrameRole = 'frame';
+ const ScopeRole = 'scope';
+ const AxisRole = 'axis';
const AxisDomainRole = 'axis-domain';
const AxisGridRole = 'axis-grid';
const AxisLabelRole = 'axis-label';
const AxisTickRole = 'axis-tick';
const AxisTitleRole = 'axis-title';
- const LegendRole$1 = 'legend';
+ const LegendRole = 'legend';
const LegendBandRole = 'legend-band';
const LegendEntryRole = 'legend-entry';
const LegendGradientRole = 'legend-gradient';
const LegendLabelRole = 'legend-label';
const LegendSymbolRole = 'legend-symbol';
const LegendTitleRole = 'legend-title';
- const TitleRole$1 = 'title';
+ const TitleRole = 'title';
const TitleTextRole = 'title-text';
const TitleSubtitleRole = 'title-subtitle';
function applyDefaults(encode, type, role, style, config) {
const defaults = {},
enter = {};
let update, key, skip, props; // if text mark, apply global lineBreak settings (#2370)
key = 'lineBreak';
- if (type === 'text' && config[key] != null && !has$1(key, encode)) {
+ if (type === 'text' && config[key] != null && !has(key, encode)) {
applyDefault(defaults, key, config[key]);
} // ignore legend and axis roles
if (role == 'legend' || String(role).startsWith('axis')) {
role = null;
} // resolve mark config
- props = role === FrameRole$1 ? config.group : role === MarkRole ? extend({}, config.mark, config[type]) : null;
+ props = role === FrameRole ? config.group : role === MarkRole ? extend$1({}, config.mark, config[type]) : null;
for (key in props) {
// do not apply defaults if relevant fields are defined
- skip = has$1(key, encode) || (key === 'fill' || key === 'stroke') && (has$1('fill', encode) || has$1('stroke', encode));
+ skip = has(key, encode) || (key === 'fill' || key === 'stroke') && (has('fill', encode) || has('stroke', encode));
if (!skip) applyDefault(defaults, key, props[key]);
} // resolve styles, apply with increasing precedence
- array(style).forEach(name => {
+ array$5(style).forEach(name => {
const props = config.style && config.style[name];
for (const key in props) {
- if (!has$1(key, encode)) {
+ if (!has(key, encode)) {
applyDefault(defaults, key, props[key]);
}
}
});
- encode = extend({}, encode); // defensive copy
+ encode = extend$1({}, encode); // defensive copy
for (key in defaults) {
props = defaults[key];
if (props.signal) {
@@ -41210,12 +41330,12 @@
} else {
enter[key] = props;
}
}
- encode.enter = extend(enter, encode.enter);
- if (update) encode.update = extend(update, encode.update);
+ encode.enter = extend$1(enter, encode.enter);
+ if (update) encode.update = extend$1(update, encode.update);
return encode;
}
function applyDefault(defaults, key, value) {
defaults[key] = value && value.signal ? {
@@ -41223,67 +41343,67 @@
} : {
value: value
};
}
- const scaleRef = scale => isString(scale) ? $(scale) : scale.signal ? "(".concat(scale.signal, ")") : field$1(scale);
+ const scaleRef = scale => isString(scale) ? $(scale) : scale.signal ? `(${scale.signal})` : field(scale);
- function entry(enc) {
+ function entry$1(enc) {
if (enc.gradient != null) {
- return gradient$1(enc);
+ return gradient(enc);
}
- let value = enc.signal ? "(".concat(enc.signal, ")") : enc.color ? color$2(enc.color) : enc.field != null ? field$1(enc.field) : enc.value !== undefined ? $(enc.value) : undefined;
+ let value = enc.signal ? `(${enc.signal})` : enc.color ? color(enc.color) : enc.field != null ? field(enc.field) : enc.value !== undefined ? $(enc.value) : undefined;
if (enc.scale != null) {
- value = scale$4(enc, value);
+ value = scale(enc, value);
}
if (value === undefined) {
value = null;
}
if (enc.exponent != null) {
- value = "pow(".concat(value, ",").concat(property(enc.exponent), ")");
+ value = `pow(${value},${property(enc.exponent)})`;
}
if (enc.mult != null) {
- value += "*".concat(property(enc.mult));
+ value += `*${property(enc.mult)}`;
}
if (enc.offset != null) {
- value += "+".concat(property(enc.offset));
+ value += `+${property(enc.offset)}`;
}
if (enc.round) {
- value = "round(".concat(value, ")");
+ value = `round(${value})`;
}
return value;
}
- const _color = (type, x, y, z) => "(".concat(type, "(").concat([x, y, z].map(entry).join(','), ")+'')");
+ const _color = (type, x, y, z) => `(${type}(${[x, y, z].map(entry$1).join(',')})+'')`;
- function color$2(enc) {
+ function color(enc) {
return enc.c ? _color('hcl', enc.h, enc.c, enc.l) : enc.h || enc.s ? _color('hsl', enc.h, enc.s, enc.l) : enc.l || enc.a ? _color('lab', enc.l, enc.a, enc.b) : enc.r || enc.g || enc.b ? _color('rgb', enc.r, enc.g, enc.b) : null;
}
- function gradient$1(enc) {
+ function gradient(enc) {
// map undefined to null; expression lang does not allow undefined
const args = [enc.start, enc.stop, enc.count].map(_ => _ == null ? null : $(_)); // trim null inputs from the end
- while (args.length && peek(args) == null) args.pop();
+ while (args.length && peek$1(args) == null) args.pop();
args.unshift(scaleRef(enc.gradient));
- return "gradient(".concat(args.join(','), ")");
+ return `gradient(${args.join(',')})`;
}
function property(property) {
- return isObject(property) ? '(' + entry(property) + ')' : property;
+ return isObject(property) ? '(' + entry$1(property) + ')' : property;
}
- function field$1(ref) {
+ function field(ref) {
return resolveField(isObject(ref) ? ref : {
datum: ref
});
}
@@ -41319,43 +41439,43 @@
}
return object + '[' + field + ']';
}
- function scale$4(enc, value) {
+ function scale(enc, value) {
const scale = scaleRef(enc.scale);
if (enc.range != null) {
// pull value from scale range
- value = "lerp(_range(".concat(scale, "), ").concat(+enc.range, ")");
+ value = `lerp(_range(${scale}), ${+enc.range})`;
} else {
// run value through scale and/or pull scale bandwidth
- if (value !== undefined) value = "_scale(".concat(scale, ", ").concat(value, ")");
+ if (value !== undefined) value = `_scale(${scale}, ${value})`;
if (enc.band) {
- value = (value ? value + '+' : '') + "_bandwidth(".concat(scale, ")") + (+enc.band === 1 ? '' : '*' + property(enc.band));
+ value = (value ? value + '+' : '') + `_bandwidth(${scale})` + (+enc.band === 1 ? '' : '*' + property(enc.band));
if (enc.extra) {
// include logic to handle extraneous elements
- value = "(datum.extra ? _scale(".concat(scale, ", datum.extra.value) : ").concat(value, ")");
+ value = `(datum.extra ? _scale(${scale}, datum.extra.value) : ${value})`;
}
}
if (value == null) value = '0';
}
return value;
}
- function rule$1(enc) {
+ function rule(enc) {
let code = '';
enc.forEach(rule => {
- const value = entry(rule);
- code += rule.test ? "(".concat(rule.test, ")?").concat(value, ":") : value;
+ const value = entry$1(rule);
+ code += rule.test ? `(${rule.test})?${value}:` : value;
}); // if no else clause, terminate with null (#1366)
- if (peek(code) === ':') {
+ if (peek$1(code) === ':') {
code += 'null';
}
return code;
}
@@ -41380,11 +41500,11 @@
fields = {};
for (const name in block) {
if (block[name] != null) {
// skip any null entries
- channels[name] = parse$4(expr(block[name]), scope, params, fields);
+ channels[name] = parse$1(expr(block[name]), scope, params, fields);
}
}
return {
$expr: {
@@ -41395,17 +41515,17 @@
$output: Object.keys(block)
};
}
function expr(enc) {
- return isArray(enc) ? rule$1(enc) : entry(enc);
+ return isArray(enc) ? rule(enc) : entry$1(enc);
}
- function parse$4(code, scope, params, fields) {
- const expr = parser$1(code, scope);
+ function parse$1(code, scope, params, fields) {
+ const expr = parser(code, scope);
expr.$fields.forEach(name => fields[name] = 1);
- extend(params, expr.$params);
+ extend$1(params, expr.$params);
return expr.$expr;
}
const OUTER = 'outer',
OUTER_INVALID = ['value', 'update', 'init', 'react', 'bind'];
@@ -41438,16 +41558,16 @@
this.value = value;
this.params = params;
if (parent) this.parent = parent;
}
- function entry$1(type, value, params, parent) {
+ function entry(type, value, params, parent) {
return new Entry(type, value, params, parent);
}
function operator(value, params) {
- return entry$1('operator', value, params);
+ return entry('operator', value, params);
} // -----
function ref(op) {
const ref = {
@@ -41456,20 +41576,20 @@
if (op.id < 0) (op.refs = op.refs || []).push(ref);
return ref;
}
- function fieldRef(field, name) {
+ function fieldRef$1(field, name) {
return name ? {
$field: field,
$name: name
} : {
$field: field
};
}
- const keyFieldRef = fieldRef('key');
+ const keyFieldRef = fieldRef$1('key');
function compareRef(fields, orders) {
return {
$compare: fields,
$order: orders
@@ -41495,18 +41615,18 @@
function aggrField(op, field) {
return (op && op.signal ? '$' + op.signal : op || '') + (op && field ? '_' : '') + (field && field.signal ? '$' + field.signal : field || '');
} // -----
- const Scope = 'scope';
- const View$1 = 'view';
+ const Scope$1 = 'scope';
+ const View = 'view';
function isSignal(_) {
return _ && _.signal;
}
- function isExpr(_) {
+ function isExpr$1(_) {
return _ && _.expr;
}
function hasSignal(_) {
if (isSignal(_)) return true;
@@ -41514,50 +41634,50 @@
if (hasSignal(_[key])) return true;
}
return false;
}
- function value$2(specValue, defaultValue) {
+ function value(specValue, defaultValue) {
return specValue != null ? specValue : defaultValue;
}
function deref(v) {
return v && v.signal || v;
}
- const Timer$1 = 'timer';
+ const Timer = 'timer';
- function parseStream$2(stream, scope) {
+ function parseStream(stream, scope) {
const method = stream.merge ? mergeStream : stream.stream ? nestedStream : stream.type ? eventStream : error('Invalid stream specification: ' + $(stream));
return method(stream, scope);
}
function eventSource(source) {
- return source === Scope ? View$1 : source || View$1;
+ return source === Scope$1 ? View : source || View;
}
function mergeStream(stream, scope) {
- const list = stream.merge.map(s => parseStream$2(s, scope)),
+ const list = stream.merge.map(s => parseStream(s, scope)),
entry = streamParameters({
merge: list
}, stream, scope);
return scope.addStream(entry).id;
}
function nestedStream(stream, scope) {
- const id = parseStream$2(stream.stream, scope),
+ const id = parseStream(stream.stream, scope),
entry = streamParameters({
stream: id
}, stream, scope);
return scope.addStream(entry).id;
}
function eventStream(stream, scope) {
let id;
- if (stream.type === Timer$1) {
- id = scope.event(Timer$1, stream.throttle);
+ if (stream.type === Timer) {
+ id = scope.event(Timer, stream.throttle);
stream = {
between: stream.between,
filter: stream.filter
};
} else {
@@ -41576,27 +41696,27 @@
if (param) {
if (param.length !== 2) {
error('Stream "between" parameter must have 2 entries: ' + $(stream));
}
- entry.between = [parseStream$2(param[0], scope), parseStream$2(param[1], scope)];
+ entry.between = [parseStream(param[0], scope), parseStream(param[1], scope)];
}
param = stream.filter ? [].concat(stream.filter) : [];
if (stream.marktype || stream.markname || stream.markrole) {
// add filter for mark type, name and/or role
param.push(filterMark(stream.marktype, stream.markname, stream.markrole));
}
- if (stream.source === Scope) {
+ if (stream.source === Scope$1) {
// add filter to limit events from sub-scope only
param.push('inScope(event.item)');
}
if (param.length) {
- entry.filter = parser$1('(' + param.join(')&&(') + ')', scope).$expr;
+ entry.filter = parser('(' + param.join(')&&(') + ')', scope).$expr;
}
if ((param = stream.throttle) != null) {
entry.throttle = +param;
}
@@ -41623,11 +41743,11 @@
type: 'Identifier',
value: 'value'
}
};
- function parseUpdate$1(spec, scope, target) {
+ function parseUpdate(spec, scope, target) {
const encode = spec.encode,
entry = {
target: target
};
let events = spec.events,
@@ -41638,15 +41758,15 @@
error('Signal update missing events specification.');
} // interpret as an event selector string
if (isString(events)) {
- events = eventSelector(events, scope.isSubscope() ? Scope : View$1);
+ events = eventSelector(events, scope.isSubscope() ? Scope$1 : View);
} // separate event streams from signal updates
- events = array(events).filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1); // merge internal operator listeners
+ events = array$5(events).filter(s => s.signal || s.scale ? (sources.push(s), 0) : 1); // merge internal operator listeners
if (sources.length > 1) {
sources = [mergeSources(sources)];
} // merge event streams, include as source
@@ -41661,11 +41781,11 @@
if (update) error('Signal encode and update are mutually exclusive.');
update = 'encode(item(),' + $(encode) + ')';
} // resolve update value
- entry.update = isString(update) ? parser$1(update, scope) : update.expr != null ? parser$1(update.expr, scope) : update.value != null ? update.value : update.signal != null ? {
+ entry.update = isString(update) ? parser(update, scope) : update.expr != null ? parser(update.expr, scope) : update.value != null ? update.value : update.signal != null ? {
$expr: OP_VALUE_EXPR,
$params: {
$value: scope.signalRef(update.signal)
}
} : error('Invalid signal update specification.');
@@ -41674,16 +41794,16 @@
entry.options = {
force: true
};
}
- sources.forEach(source => scope.addUpdate(extend(streamSource(source, scope), entry)));
+ sources.forEach(source => scope.addUpdate(extend$1(streamSource(source, scope), entry)));
}
function streamSource(stream, scope) {
return {
- source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream$2(stream, scope)
+ source: stream.signal ? scope.signalRef(stream.signal) : stream.scale ? scope.scaleRef(stream.scale) : parseStream(stream, scope)
};
}
function mergeSources(sources) {
return {
@@ -41703,50 +41823,50 @@
op.initonly = true;
}
}
if (expr) {
- expr = parser$1(expr, scope);
+ expr = parser(expr, scope);
op.update = expr.$expr;
op.params = expr.$params;
}
if (signal.on) {
- signal.on.forEach(_ => parseUpdate$1(_, scope, op.id));
+ signal.on.forEach(_ => parseUpdate(_, scope, op.id));
}
}
- const transform$3 = name => (params, value, parent) => entry$1(name, value, params || undefined, parent);
+ const transform = name => (params, value, parent) => entry(name, value, params || undefined, parent);
- const Aggregate$1 = transform$3('aggregate');
- const AxisTicks$1 = transform$3('axisticks');
- const Bound$1 = transform$3('bound');
- const Collect$1 = transform$3('collect');
- const Compare$1 = transform$3('compare');
- const DataJoin$1 = transform$3('datajoin');
- const Encode$1 = transform$3('encode');
- const Expression$1 = transform$3('expression');
- const Facet$1 = transform$3('facet');
- const Field$1 = transform$3('field');
- const Key$1 = transform$3('key');
- const LegendEntries$1 = transform$3('legendentries');
- const Load$1 = transform$3('load');
- const Mark$1 = transform$3('mark');
- const MultiExtent$1 = transform$3('multiextent');
- const MultiValues$1 = transform$3('multivalues');
- const Overlap$1 = transform$3('overlap');
- const Params$2 = transform$3('params');
- const PreFacet$1 = transform$3('prefacet');
- const Projection$1 = transform$3('projection');
- const Proxy$1 = transform$3('proxy');
- const Relay$1 = transform$3('relay');
- const Render$1 = transform$3('render');
- const Scale$1 = transform$3('scale');
- const Sieve$1 = transform$3('sieve');
- const SortItems$1 = transform$3('sortitems');
- const ViewLayout$1 = transform$3('viewlayout');
- const Values$1 = transform$3('values');
+ const Aggregate = transform('aggregate');
+ const AxisTicks = transform('axisticks');
+ const Bound = transform('bound');
+ const Collect = transform('collect');
+ const Compare = transform('compare');
+ const DataJoin = transform('datajoin');
+ const Encode = transform('encode');
+ const Expression = transform('expression');
+ const Facet = transform('facet');
+ const Field = transform('field');
+ const Key = transform('key');
+ const LegendEntries = transform('legendentries');
+ const Load = transform('load');
+ const Mark = transform('mark');
+ const MultiExtent = transform('multiextent');
+ const MultiValues = transform('multivalues');
+ const Overlap = transform('overlap');
+ const Params = transform('params');
+ const PreFacet = transform('prefacet');
+ const Projection = transform('projection');
+ const Proxy = transform('proxy');
+ const Relay = transform('relay');
+ const Render = transform('render');
+ const Scale = transform('scale');
+ const Sieve = transform('sieve');
+ const SortItems = transform('sortitems');
+ const ViewLayout = transform('viewlayout');
+ const Values = transform('values');
let FIELD_REF_ID = 0;
const MULTIDOMAIN_SORT_OPS = {
min: 'min',
max: 'max',
count: 'sum'
@@ -41785,11 +41905,11 @@
if (spec.bins != null) {
params.bins = parseScaleBins(spec.bins, scope);
}
for (key in spec) {
- if (has(params, key) || key === 'name') continue;
+ if (has$1(params, key) || key === 'name') continue;
params[key] = parseLiteral(spec[key], scope);
}
}
function parseLiteral(v, scope) {
@@ -41831,31 +41951,31 @@
const data = domain.data,
fields = domain.fields.reduce((dom, d) => {
d = isString(d) ? {
data: data,
field: d
- } : isArray(d) || d.signal ? fieldRef$1(d, scope) : d;
+ } : isArray(d) || d.signal ? fieldRef(d, scope) : d;
dom.push(d);
return dom;
}, []);
return (isDiscrete(spec.type) ? ordinalMultipleDomain : isQuantile(spec.type) ? quantileMultipleDomain : numericMultipleDomain)(domain, scope, fields);
}
- function fieldRef$1(data, scope) {
+ function fieldRef(data, scope) {
const name = '_:vega:_' + FIELD_REF_ID++,
- coll = Collect$1({});
+ coll = Collect({});
if (isArray(data)) {
coll.value = {
$ingest: data
};
} else if (data.signal) {
const code = 'setdata(' + $(name) + ',' + data.signal + ')';
coll.params.input = scope.signalRef(code);
}
- scope.addDataPipeline(name, [coll, Sieve$1({})]);
+ scope.addDataPipeline(name, [coll, Sieve({})]);
return {
data: name,
field: 'data'
};
}
@@ -41881,17 +42001,17 @@
p.ops = [MULTIDOMAIN_SORT_OPS[a]];
p.fields = [scope.fieldRef(v)];
p.as = [v];
}
- a = scope.add(Aggregate$1(p)); // collect aggregate output
+ a = scope.add(Aggregate(p)); // collect aggregate output
- const c = scope.add(Collect$1({
+ const c = scope.add(Collect({
pulse: ref(a)
})); // extract values for combined domain
- v = scope.add(Values$1({
+ v = scope.add(Values({
field: keyFieldRef,
sort: scope.sortRef(sort),
pulse: ref(c)
}));
return ref(v);
@@ -41921,11 +42041,11 @@
const data = scope.getData(f.data);
if (!data) dataLookupError(f.data);
return data.domainRef(scope, f.field);
}); // combine value arrays
- return ref(scope.add(MultiValues$1({
+ return ref(scope.add(MultiValues({
values: values
})));
}
function numericMultipleDomain(domain, scope, fields) {
@@ -41934,11 +42054,11 @@
const data = scope.getData(f.data);
if (!data) dataLookupError(f.data);
return data.extentRef(scope, f.field);
}); // combine extents
- return ref(scope.add(MultiExtent$1({
+ return ref(scope.add(MultiExtent({
extents: extents
})));
} // -- SCALE BINS -----
@@ -41969,12 +42089,12 @@
let range = spec.range;
if (range.signal) {
return scope.signalRef(range.signal);
} else if (isString(range)) {
- if (config && has(config, range)) {
- spec = extend({}, spec, {
+ if (config && has$1(config, range)) {
+ spec = extend$1({}, spec, {
range: config[range]
});
return parseScaleRange(spec, scope, params);
} else if (range === 'width') {
range = [0, {
@@ -42027,51 +42147,51 @@
function parseParameter$1(_, name, scope) {
return isArray(_) ? _.map(_ => parseParameter$1(_, name, scope)) : !isObject(_) ? _ : _.signal ? scope.signalRef(_.signal) : name === 'fit' ? _ : error('Unsupported parameter object: ' + $(_));
}
- const Top$1 = 'top';
- const Left$1 = 'left';
- const Right$1 = 'right';
- const Bottom$1 = 'bottom';
- const Center$1 = 'center';
+ const Top = 'top';
+ const Left = 'left';
+ const Right = 'right';
+ const Bottom = 'bottom';
+ const Center = 'center';
const Vertical = 'vertical';
- const Start$1 = 'start';
- const Middle$1 = 'middle';
- const End$1 = 'end';
+ const Start = 'start';
+ const Middle = 'middle';
+ const End = 'end';
const Index = 'index';
- const Label$1 = 'label';
+ const Label = 'label';
const Offset = 'offset';
const Perc = 'perc';
const Perc2 = 'perc2';
const Value = 'value';
const GuideLabelStyle = 'guide-label';
const GuideTitleStyle = 'guide-title';
const GroupTitleStyle = 'group-title';
const GroupSubtitleStyle = 'group-subtitle';
- const Symbols$1 = 'symbol';
- const Gradient$1 = 'gradient';
- const Discrete$1 = 'discrete';
+ const Symbols = 'symbol';
+ const Gradient = 'gradient';
+ const Discrete = 'discrete';
const Size = 'size';
const Shape = 'shape';
const Fill = 'fill';
const Stroke = 'stroke';
const StrokeWidth = 'strokeWidth';
const StrokeDash = 'strokeDash';
const Opacity = 'opacity'; // Encoding channels supported by legends
// In priority order of 'canonical' scale
const LegendScales = [Size, Shape, Fill, Stroke, StrokeWidth, StrokeDash, Opacity];
- const Skip$2 = {
+ const Skip = {
name: 1,
style: 1,
interactive: 1
};
- const zero$2 = {
+ const zero = {
value: 0
};
- const one$2 = {
+ const one = {
value: 1
};
const GroupMark = 'group';
const RectMark = 'rect';
const RuleMark = 'rule';
@@ -42082,20 +42202,20 @@
mark.type = GroupMark;
mark.interactive = mark.interactive || false;
return mark;
}
- function lookup$4(spec, config) {
- const _ = (name, dflt) => value$2(spec[name], value$2(config[name], dflt));
+ function lookup(spec, config) {
+ const _ = (name, dflt) => value(spec[name], value(config[name], dflt));
- _.isVertical = s => Vertical === value$2(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection));
+ _.isVertical = s => Vertical === value(spec.direction, config.direction || (s ? config.symbolDirection : config.gradientDirection));
- _.gradientLength = () => value$2(spec.gradientLength, config.gradientLength || config.gradientWidth);
+ _.gradientLength = () => value(spec.gradientLength, config.gradientLength || config.gradientWidth);
- _.gradientThickness = () => value$2(spec.gradientThickness, config.gradientThickness || config.gradientHeight);
+ _.gradientThickness = () => value(spec.gradientThickness, config.gradientThickness || config.gradientHeight);
- _.entryColumns = () => value$2(spec.columns, value$2(config.columns, +_.isVertical(true)));
+ _.entryColumns = () => value(spec.columns, value(config.columns, +_.isVertical(true)));
return _;
}
function getEncoding(name, encode) {
@@ -42107,14 +42227,14 @@
const s = scope.config.style[style];
return s && s[name];
}
function anchorExpr(s, e, m) {
- return "item.anchor === '".concat(Start$1, "' ? ").concat(s, " : item.anchor === '").concat(End$1, "' ? ").concat(e, " : ").concat(m);
+ return `item.anchor === '${Start}' ? ${s} : item.anchor === '${End}' ? ${e} : ${m}`;
}
- const alignExpr = anchorExpr($(Left$1), $(Right$1), $(Center$1));
+ const alignExpr$1 = anchorExpr($(Left), $(Right), $(Center));
function tickBand(_) {
const v = _('tickBand');
let offset = _('tickOffset'),
@@ -42126,19 +42246,19 @@
band = _('bandPosition');
extra = _('tickExtra');
} else if (v.signal) {
// if signal, augment code to interpret values
band = {
- signal: "(".concat(v.signal, ") === 'extent' ? 1 : 0.5")
+ signal: `(${v.signal}) === 'extent' ? 1 : 0.5`
};
extra = {
- signal: "(".concat(v.signal, ") === 'extent'")
+ signal: `(${v.signal}) === 'extent'`
};
if (!isObject(offset)) {
offset = {
- signal: "(".concat(v.signal, ") === 'extent' ? 0 : ").concat(offset)
+ signal: `(${v.signal}) === 'extent' ? 0 : ${offset}`
};
}
} else if (v === 'extent') {
// if constant, simply set values
band = 1;
@@ -42168,20 +42288,20 @@
function guideMark(mark, extras) {
if (extras) {
mark.name = extras.name;
mark.style = extras.style || mark.style;
mark.interactive = !!extras.interactive;
- mark.encode = extendEncode(mark.encode, extras, Skip$2);
+ mark.encode = extendEncode(mark.encode, extras, Skip);
} else {
mark.interactive = false;
}
return mark;
}
function legendGradient(spec, scale, config, userEncode) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
vertical = _.isVertical(),
thickness = _.gradientThickness(),
length = _.gradientLength();
let enter, start, stop, width, height;
@@ -42198,26 +42318,26 @@
height = thickness;
}
const encode = {
enter: enter = {
- opacity: zero$2,
- x: zero$2,
- y: zero$2,
+ opacity: zero,
+ x: zero,
+ y: zero,
width: encoder(width),
height: encoder(height)
},
- update: extend({}, enter, {
- opacity: one$2,
+ update: extend$1({}, enter, {
+ opacity: one,
fill: {
gradient: scale,
start: start,
stop: stop
}
}),
exit: {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
stroke: _('gradientStrokeColor'),
strokeWidth: _('gradientStrokeWidth')
@@ -42231,11 +42351,11 @@
encode
}, userEncode);
}
function legendGradientDiscrete(spec, scale, config, userEncode, dataRef) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
vertical = _.isVertical(),
thickness = _.gradientThickness(),
length = _.gradientLength();
let u,
@@ -42243,33 +42363,33 @@
uu,
vv,
adjust = '';
vertical ? (u = 'y', uu = 'y2', v = 'x', vv = 'width', adjust = '1-') : (u = 'x', uu = 'x2', v = 'y', vv = 'height');
const enter = {
- opacity: zero$2,
+ opacity: zero,
fill: {
scale: scale,
field: Value
}
};
enter[u] = {
signal: adjust + 'datum.' + Perc,
mult: length
};
- enter[v] = zero$2;
+ enter[v] = zero;
enter[uu] = {
signal: adjust + 'datum.' + Perc2,
mult: length
};
enter[vv] = encoder(thickness);
const encode = {
enter: enter,
- update: extend({}, enter, {
- opacity: one$2
+ update: extend$1({}, enter, {
+ opacity: one
}),
exit: {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
stroke: _('gradientStrokeColor'),
strokeWidth: _('gradientStrokeWidth')
@@ -42284,15 +42404,15 @@
from: dataRef,
encode
}, userEncode);
}
- const alignExpr$1 = "datum.".concat(Perc, "<=0?\"").concat(Left$1, "\":datum.").concat(Perc, ">=1?\"").concat(Right$1, "\":\"").concat(Center$1, "\""),
- baselineExpr = "datum.".concat(Perc, "<=0?\"").concat(Bottom$1, "\":datum.").concat(Perc, ">=1?\"").concat(Top$1, "\":\"").concat(Middle$1, "\"");
+ const alignExpr = `datum.${Perc}<=0?"${Left}":datum.${Perc}>=1?"${Right}":"${Center}"`,
+ baselineExpr = `datum.${Perc}<=0?"${Bottom}":datum.${Perc}>=1?"${Top}":"${Middle}"`;
function legendGradientLabels(spec, config, userEncode, dataRef) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
vertical = _.isVertical(),
thickness = encoder(_.gradientThickness()),
length = _.gradientLength();
let overlap = _('labelOverlap'),
@@ -42302,30 +42422,30 @@
v,
adjust = '';
const encode = {
enter: enter = {
- opacity: zero$2
+ opacity: zero
},
update: update = {
- opacity: one$2,
+ opacity: one,
text: {
- field: Label$1
+ field: Label
}
},
exit: {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
fill: _('labelColor'),
fillOpacity: _('labelOpacity'),
font: _('labelFont'),
fontSize: _('labelFontSize'),
fontStyle: _('labelFontStyle'),
fontWeight: _('labelFontWeight'),
- limit: value$2(spec.labelLimit, config.gradientLabelLimit)
+ limit: value(spec.labelLimit, config.gradientLabelLimit)
});
if (vertical) {
enter.align = {
value: 'left'
@@ -42336,11 +42456,11 @@
u = 'y';
v = 'x';
adjust = '1-';
} else {
enter.align = update.align = {
- signal: alignExpr$1
+ signal: alignExpr
};
enter.baseline = {
value: 'top'
};
u = 'x';
@@ -42350,11 +42470,11 @@
enter[u] = update[u] = {
signal: adjust + 'datum.' + Perc,
mult: length
};
enter[v] = update[v] = thickness;
- thickness.offset = value$2(spec.labelOffset, config.gradientLabelOffset) || 0;
+ thickness.offset = value(spec.labelOffset, config.gradientLabelOffset) || 0;
overlap = overlap ? {
separation: _('labelSeparation'),
method: overlap,
order: 'datum.' + Index
} : undefined; // type, role, style, key, dataRef, encode, extras
@@ -42369,46 +42489,46 @@
overlap
}, userEncode);
}
function legendSymbolGroups(spec, config, userEncode, dataRef, columns) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
entries = userEncode.entries,
interactive = !!(entries && entries.interactive),
name = entries ? entries.name : undefined,
height = _('clipHeight'),
symbolOffset = _('symbolOffset'),
valueRef = {
data: 'value'
},
- xSignal = "(".concat(columns, ") ? datum.").concat(Offset, " : datum.").concat(Size),
+ xSignal = `(${columns}) ? datum.${Offset} : datum.${Size}`,
yEncode = height ? encoder(height) : {
field: Size
},
- index = "datum.".concat(Index),
- ncols = "max(1, ".concat(columns, ")");
+ index = `datum.${Index}`,
+ ncols = `max(1, ${columns})`;
let encode, enter, update, nrows, sort;
yEncode.mult = 0.5; // -- LEGEND SYMBOLS --
encode = {
enter: enter = {
- opacity: zero$2,
+ opacity: zero,
x: {
signal: xSignal,
mult: 0.5,
offset: symbolOffset
},
y: yEncode
},
update: update = {
- opacity: one$2,
+ opacity: one,
x: enter.x,
y: enter.y
},
exit: {
- opacity: zero$2
+ opacity: zero
}
};
let baseFill = null,
baseStroke = null;
@@ -42448,27 +42568,27 @@
const labelOffset = encoder(symbolOffset);
labelOffset.offset = _('labelOffset');
encode = {
enter: enter = {
- opacity: zero$2,
+ opacity: zero,
x: {
signal: xSignal,
offset: labelOffset
},
y: yEncode
},
update: update = {
- opacity: one$2,
+ opacity: one,
text: {
- field: Label$1
+ field: Label
},
x: enter.x,
y: enter.y
},
exit: {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
align: _('labelAlign'),
baseline: _('labelBaseline'),
@@ -42493,66 +42613,66 @@
enter: {
noBound: {
value: !height
},
// ignore width/height in bounds calc
- width: zero$2,
- height: height ? encoder(height) : zero$2,
- opacity: zero$2
+ width: zero,
+ height: height ? encoder(height) : zero,
+ opacity: zero
},
exit: {
- opacity: zero$2
+ opacity: zero
},
update: update = {
- opacity: one$2,
+ opacity: one,
row: {
signal: null
},
column: {
signal: null
}
}
}; // annotate and sort groups to ensure correct ordering
if (_.isVertical(true)) {
- nrows = "ceil(item.mark.items.length / ".concat(ncols, ")");
- update.row.signal = "".concat(index, "%").concat(nrows);
- update.column.signal = "floor(".concat(index, " / ").concat(nrows, ")");
+ nrows = `ceil(item.mark.items.length / ${ncols})`;
+ update.row.signal = `${index}%${nrows}`;
+ update.column.signal = `floor(${index} / ${nrows})`;
sort = {
field: ['row', index]
};
} else {
- update.row.signal = "floor(".concat(index, " / ").concat(ncols, ")");
- update.column.signal = "".concat(index, " % ").concat(ncols);
+ update.row.signal = `floor(${index} / ${ncols})`;
+ update.column.signal = `${index} % ${ncols}`;
sort = {
field: index
};
} // handle zero column case (implies infinite columns)
- update.column.signal = "(".concat(columns, ")?").concat(update.column.signal, ":").concat(index); // facet legend entries into sub-groups
+ update.column.signal = `(${columns})?${update.column.signal}:${index}`; // facet legend entries into sub-groups
dataRef = {
facet: {
data: dataRef,
name: 'value',
groupby: Index
}
};
return guideGroup({
- role: ScopeRole$1,
+ role: ScopeRole,
from: dataRef,
- encode: extendEncode(encode, entries, Skip$2),
+ encode: extendEncode(encode, entries, Skip),
marks: [symbols, labels],
name,
interactive,
sort
});
}
function legendSymbolLayout(spec, config) {
- const _ = lookup$4(spec, config); // layout parameters for legend entries
+ const _ = lookup(spec, config); // layout parameters for legend entries
return {
align: _('gridAlign'),
columns: _.entryColumns(),
@@ -42567,28 +42687,28 @@
};
}
const isL = 'item.orient === "left"',
isR = 'item.orient === "right"',
- isLR = "(".concat(isL, " || ").concat(isR, ")"),
- isVG = "datum.vgrad && ".concat(isLR),
+ isLR = `(${isL} || ${isR})`,
+ isVG = `datum.vgrad && ${isLR}`,
baseline = anchorExpr('"top"', '"bottom"', '"middle"'),
alignFlip = anchorExpr('"right"', '"left"', '"center"'),
- exprAlign = "datum.vgrad && ".concat(isR, " ? (").concat(alignFlip, ") : (").concat(isLR, " && !(datum.vgrad && ").concat(isL, ")) ? \"left\" : ").concat(alignExpr),
- exprAnchor = "item._anchor || (".concat(isLR, " ? \"middle\" : \"start\")"),
- exprAngle = "".concat(isVG, " ? (").concat(isL, " ? -90 : 90) : 0"),
- exprBaseline = "".concat(isLR, " ? (datum.vgrad ? (").concat(isR, " ? \"bottom\" : \"top\") : ").concat(baseline, ") : \"top\"");
+ exprAlign = `datum.vgrad && ${isR} ? (${alignFlip}) : (${isLR} && !(datum.vgrad && ${isL})) ? "left" : ${alignExpr$1}`,
+ exprAnchor = `item._anchor || (${isLR} ? "middle" : "start")`,
+ exprAngle = `${isVG} ? (${isL} ? -90 : 90) : 0`,
+ exprBaseline = `${isLR} ? (datum.vgrad ? (${isR} ? "bottom" : "top") : ${baseline}) : "top"`;
function legendTitle(spec, config, userEncode, dataRef) {
- const _ = lookup$4(spec, config);
+ const _ = lookup(spec, config);
const encode = {
enter: {
- opacity: zero$2
+ opacity: zero
},
update: {
- opacity: one$2,
+ opacity: one,
x: {
field: {
group: 'padding'
}
},
@@ -42597,11 +42717,11 @@
group: 'padding'
}
}
},
exit: {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
orient: _('titleOrient'),
_anchor: _('titleAnchor'),
@@ -42638,11 +42758,11 @@
from: dataRef,
encode
}, userEncode);
}
- function clip$3(clip, scope) {
+ function clip(clip, scope) {
let expr;
if (isObject(clip)) {
if (clip.signal) {
expr = clip.signal;
@@ -42660,14 +42780,14 @@
return isObject(value) && value.signal ? value.signal : $(value);
}
function getRole(spec) {
const role = spec.role || '';
- return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? ScopeRole$1 : role || MarkRole;
+ return !role.indexOf('axis') || !role.indexOf('legend') || !role.indexOf('title') ? role : spec.type === GroupMark ? ScopeRole : role || MarkRole;
}
- function definition$1(spec) {
+ function definition(spec) {
return {
marktype: spec.type,
name: spec.name || undefined,
role: spec.role || getRole(spec),
zindex: +spec.zindex || undefined,
@@ -42683,39 +42803,39 @@
* Parse a data transform specification.
*/
function parseTransform(spec, scope) {
- const def = definition(spec.type);
+ const def = definition$1(spec.type);
if (!def) error('Unrecognized transform type: ' + $(spec.type));
- const t = entry$1(def.type.toLowerCase(), null, parseParameters$1(def, spec, scope));
+ const t = entry(def.type.toLowerCase(), null, parseParameters(def, spec, scope));
if (spec.signal) scope.addSignal(spec.signal, scope.proxy(t));
t.metadata = def.metadata || {};
return t;
}
/**
* Parse all parameters of a data transform.
*/
- function parseParameters$1(def, spec, scope) {
+ function parseParameters(def, spec, scope) {
const params = {},
n = def.params.length;
for (let i = 0; i < n; ++i) {
const pdef = def.params[i];
- params[pdef.name] = parseParameter$1$1(pdef, spec, scope);
+ params[pdef.name] = parseParameter(pdef, spec, scope);
}
return params;
}
/**
* Parse a data transform parameter.
*/
- function parseParameter$1$1(def, spec, scope) {
+ function parseParameter(def, spec, scope) {
const type = def.type,
value = spec[def.name];
if (type === 'index') {
return parseIndexParameter(def, spec, scope);
@@ -42740,14 +42860,14 @@
function parameterValue(def, value, scope) {
const type = def.type;
if (isSignal(value)) {
- return isExpr$1(type) ? error('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal);
+ return isExpr(type) ? error('Expression references can not be signals.') : isField(type) ? scope.fieldRef(value) : isCompare(type) ? scope.compareRef(value) : scope.signalRef(value.signal);
} else {
const expr = def.expr || isField(type);
- return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef(value.field, value.as) : isExpr$1(type) ? parser$1(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef(value) : isCompare(type) ? scope.compareRef(value) : value;
+ return expr && outerExpr(value) ? scope.exprRef(value.expr, value.as) : expr && outerField(value) ? fieldRef$1(value.field, value.as) : isExpr(type) ? parser(value, scope) : isData(type) ? ref(scope.getData(value).values) : isField(type) ? fieldRef$1(value) : isCompare(type) ? scope.compareRef(value) : value;
}
}
/**
* Parse parameter for accessing an index of another data set.
*/
@@ -42802,57 +42922,57 @@
} // raise error if matching key not found
if (!pdef) error('Unsupported parameter: ' + $(value)); // parse params, create Params transform, return ref
- const params = extend(parseParameters$1(pdef, value, scope), pdef.key);
- return ref(scope.add(Params$2(params)));
+ const params = extend$1(parseParameters(pdef, value, scope), pdef.key);
+ return ref(scope.add(Params(params)));
} // -- Utilities -----
const outerExpr = _ => _ && _.expr;
const outerField = _ => _ && _.field;
const isData = _ => _ === 'data';
- const isExpr$1 = _ => _ === 'expr';
+ const isExpr = _ => _ === 'expr';
const isField = _ => _ === 'field';
const isCompare = _ => _ === 'compare';
- function parseData(from, group, scope) {
+ function parseData$1(from, group, scope) {
let facet, key, op, dataRef, parent; // if no source data, generate singleton datum
if (!from) {
- dataRef = ref(scope.add(Collect$1(null, [{}])));
+ dataRef = ref(scope.add(Collect(null, [{}])));
} // if faceted, process facet specification
else if (facet = from.facet) {
- if (!group) error('Only group marks can be faceted.'); // use pre-faceted source data, if available
+ if (!group) error('Only group marks can be faceted.'); // use pre-faceted source data, if available
- if (facet.field != null) {
- dataRef = parent = getDataRef(facet, scope);
+ if (facet.field != null) {
+ dataRef = parent = getDataRef(facet, scope);
+ } else {
+ // generate facet aggregates if no direct data specification
+ if (!from.data) {
+ op = parseTransform(extend$1({
+ type: 'aggregate',
+ groupby: array$5(facet.groupby)
+ }, facet.aggregate), scope);
+ op.params.key = scope.keyRef(facet.groupby);
+ op.params.pulse = getDataRef(facet, scope);
+ dataRef = parent = ref(scope.add(op));
} else {
- // generate facet aggregates if no direct data specification
- if (!from.data) {
- op = parseTransform(extend({
- type: 'aggregate',
- groupby: array(facet.groupby)
- }, facet.aggregate), scope);
- op.params.key = scope.keyRef(facet.groupby);
- op.params.pulse = getDataRef(facet, scope);
- dataRef = parent = ref(scope.add(op));
- } else {
- parent = ref(scope.getData(from.data).aggregate);
- }
-
- key = scope.keyRef(facet.groupby, true);
+ parent = ref(scope.getData(from.data).aggregate);
}
- } // if not yet defined, get source data reference
+ key = scope.keyRef(facet.groupby, true);
+ }
+ } // if not yet defined, get source data reference
+
if (!dataRef) {
dataRef = getDataRef(from, scope);
}
return {
@@ -42950,11 +43070,11 @@
} : {
field: scope.fieldRef(field),
pulse: ref(ds.output)
};
if (sort) params.sort = scope.sortRef(counts);
- op = scope.add(entry$1(optype, undefined, params));
+ op = scope.add(entry(optype, undefined, params));
if (index) ds.index[field] = op;
v = ref(op);
if (k != null) cache[k] = v;
}
@@ -42977,12 +43097,12 @@
p = {
groupby: scope.fieldRef(field, 'key'),
pulse: ref(ds.output)
};
if (sort && sort.field) addSortField(scope, p, sort);
- a = scope.add(Aggregate$1(p));
- v = scope.add(Collect$1({
+ a = scope.add(Aggregate(p));
+ v = scope.add(Collect({
pulse: ref(a)
}));
v = {
agg: a,
ref: ref(v)
@@ -43034,28 +43154,28 @@
if (!facet.data) {
error('Facet must reference a data set: ' + $(facet));
}
if (facet.field) {
- op = scope.add(PreFacet$1({
+ op = scope.add(PreFacet({
field: scope.fieldRef(facet.field),
pulse: data
}));
} else if (facet.groupby) {
- op = scope.add(Facet$1({
+ op = scope.add(Facet({
key: scope.keyRef(facet.groupby),
group: ref(scope.proxy(group.parent)),
pulse: data
}));
} else {
error('Facet must specify groupby or field: ' + $(facet));
} // initialize facet subscope
const subscope = scope.fork(),
- source = subscope.add(Collect$1()),
- values = subscope.add(Sieve$1({
+ source = subscope.add(Collect()),
+ values = subscope.add(Sieve({
pulse: ref(source)
}));
subscope.addData(name, new DataScope(subscope, source, source, values));
subscope.addSignal('parent', null); // parse faceted subflow
@@ -43063,15 +43183,15 @@
$subflow: subscope.parse(spec).toRuntime()
};
}
function parseSubflow(spec, scope, input) {
- const op = scope.add(PreFacet$1({
+ const op = scope.add(PreFacet({
pulse: input.pulse
})),
subscope = scope.fork();
- subscope.add(Sieve$1());
+ subscope.add(Sieve());
subscope.addSignal('parent', null); // parse group mark subflow
op.params.subflow = {
$subflow: subscope.parse(spec).toRuntime()
};
@@ -43083,58 +43203,58 @@
toggle = spec.toggle,
modify = spec.modify,
values = spec.values,
op = scope.add(operator());
const update = 'if(' + spec.trigger + ',modify("' + name + '",' + [insert, remove, toggle, modify, values].map(_ => _ == null ? 'null' : _).join(',') + '),0)';
- const expr = parser$1(update, scope);
+ const expr = parser(update, scope);
op.update = expr.$expr;
op.params = expr.$params;
}
function parseMark(spec, scope) {
const role = getRole(spec),
group = spec.type === GroupMark,
facet = spec.from && spec.from.facet,
overlap = spec.overlap;
- let layout = spec.layout || role === ScopeRole$1 || role === FrameRole$1,
+ let layout = spec.layout || role === ScopeRole || role === FrameRole,
ops,
op,
store,
enc,
name,
layoutRef,
boundRef;
const nested = role === MarkRole || layout || facet; // resolve input data
- const input = parseData(spec.from, group, scope); // data join to map tuples to visual items
+ const input = parseData$1(spec.from, group, scope); // data join to map tuples to visual items
- op = scope.add(DataJoin$1({
- key: input.key || (spec.key ? fieldRef(spec.key) : undefined),
+ op = scope.add(DataJoin({
+ key: input.key || (spec.key ? fieldRef$1(spec.key) : undefined),
pulse: input.pulse,
clean: !group
}));
const joinRef = ref(op); // collect visual items
- op = store = scope.add(Collect$1({
+ op = store = scope.add(Collect({
pulse: joinRef
})); // connect visual items to scenegraph
- op = scope.add(Mark$1({
- markdef: definition$1(spec),
+ op = scope.add(Mark({
+ markdef: definition(spec),
interactive: interactive(spec.interactive, scope),
- clip: clip$3(spec.clip, scope),
+ clip: clip(spec.clip, scope),
context: {
$context: true
},
groups: scope.lookup(),
parent: scope.signals.parent ? scope.signalRef('parent') : null,
index: scope.markpath(),
pulse: ref(op)
}));
const markRef = ref(op); // add visual encoders
- op = enc = scope.add(Encode$1(parseEncode(spec.encode, spec.type, role, spec.style, scope, {
+ op = enc = scope.add(Encode(parseEncode(spec.encode, spec.type, role, spec.style, scope, {
mod: false,
pulse: markRef
}))); // monitor parent marks to propagate changes
op.params.parent = scope.encode(); // add post-encoding transforms, if defined
@@ -43155,30 +43275,30 @@
});
} // if item sort specified, perform post-encoding
if (spec.sort) {
- op = scope.add(SortItems$1({
+ op = scope.add(SortItems({
sort: scope.compareRef(spec.sort),
pulse: ref(op)
}));
}
const encodeRef = ref(op); // add view layout operator if needed
if (facet || layout) {
- layout = scope.add(ViewLayout$1({
+ layout = scope.add(ViewLayout({
layout: scope.objectProperty(spec.layout),
legends: scope.legends,
mark: markRef,
pulse: encodeRef
}));
layoutRef = ref(layout);
} // compute bounding boxes
- const bound = scope.add(Bound$1({
+ const bound = scope.add(Bound({
mark: markRef,
pulse: layoutRef || encodeRef
}));
boundRef = ref(bound); // if group mark, recurse to parse nested content
@@ -43207,14 +43327,14 @@
if (overlap) {
boundRef = parseOverlap(overlap, boundRef, scope);
} // render / sieve items
- const render = scope.add(Render$1({
+ const render = scope.add(Render({
pulse: boundRef
})),
- sieve = scope.add(Sieve$1({
+ sieve = scope.add(Sieve({
pulse: ref(render)
}, undefined, scope.parent())); // if mark is named, make accessible as reactive geometry
// add trigger updates if defined
if (spec.name != null) {
@@ -43251,17 +43371,17 @@
params.boundTolerance = isSignal(tol) ? scope.signalRef(tol.signal) : +tol;
params.boundScale = scope.scaleRef(bound.scale);
params.boundOrient = bound.orient;
}
- return ref(scope.add(Overlap$1(params)));
+ return ref(scope.add(Overlap(params)));
}
function parseLegend(spec, scope) {
const config = scope.config.legend,
encode = spec.encode || {},
- _ = lookup$4(spec, config),
+ _ = lookup(spec, config),
legendEncode = encode.legend || {},
name = legendEncode.name || undefined,
interactive = legendEncode.interactive,
style = legendEncode.style,
scales = {};
@@ -43280,11 +43400,11 @@
title: spec.title != null,
scales: scales,
type: type,
vgrad: type !== 'symbol' && _.isVertical()
};
- const dataRef = ref(scope.add(Collect$1(null, [datum]))); // encoding properties for legend entry sub-group
+ const dataRef = ref(scope.add(Collect(null, [datum]))); // encoding properties for legend entry sub-group
const entryEncode = {
enter: {
x: {
value: 0
@@ -43293,36 +43413,36 @@
value: 0
}
}
}; // data source for legend values
- const entryRef = ref(scope.add(LegendEntries$1(params = {
+ const entryRef = ref(scope.add(LegendEntries(params = {
type: type,
scale: scope.scaleRef(scale),
count: scope.objectProperty(_('tickCount')),
limit: scope.property(_('symbolLimit')),
values: scope.objectProperty(spec.values),
minstep: scope.property(spec.tickMinStep),
formatType: scope.property(spec.formatType),
formatSpecifier: scope.property(spec.format)
}))); // continuous gradient legend
- if (type === Gradient$1) {
+ if (type === Gradient) {
children = [legendGradient(spec, scale, config, encode.gradient), legendGradientLabels(spec, config, encode.labels, entryRef)]; // adjust default tick count based on the gradient length
- params.count = params.count || scope.signalRef("max(2,2*floor((".concat(deref(_.gradientLength()), ")/100))"));
+ params.count = params.count || scope.signalRef(`max(2,2*floor((${deref(_.gradientLength())})/100))`);
} // discrete gradient legend
- else if (type === Discrete$1) {
- children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)];
- } // symbol legend
- else {
- // determine legend symbol group layout
- entryLayout = legendSymbolLayout(spec, config);
- children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))]; // pass symbol size information to legend entry generator
+ else if (type === Discrete) {
+ children = [legendGradientDiscrete(spec, scale, config, encode.gradient, entryRef), legendGradientLabels(spec, config, encode.labels, entryRef)];
+ } // symbol legend
+ else {
+ // determine legend symbol group layout
+ entryLayout = legendSymbolLayout(spec, config);
+ children = [legendSymbolGroups(spec, config, encode, entryRef, deref(entryLayout.columns))]; // pass symbol size information to legend entry generator
- params.size = sizeExpression(spec, scope, children[0].marks);
- } // generate legend marks
+ params.size = sizeExpression(spec, scope, children[0].marks);
+ } // generate legend marks
children = [guideGroup({
role: LegendEntryRole,
from: dataRef,
@@ -43336,13 +43456,13 @@
children.push(legendTitle(spec, config, encode.title, dataRef));
} // parse legend specification
return parseMark(guideGroup({
- role: LegendRole$1,
+ role: LegendRole,
from: dataRef,
- encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip$2),
+ encode: extendEncode(buildLegendEncode(_, spec, config), legendEncode, Skip),
marks: children,
aria: _('aria'),
description: _('description'),
zindex: _('zindex'),
name,
@@ -43350,17 +43470,17 @@
style
}), scope);
}
function legendType(spec, scaleType) {
- let type = spec.type || Symbols$1;
+ let type = spec.type || Symbols;
if (!spec.type && scaleCount(spec) === 1 && (spec.fill || spec.stroke)) {
- type = isContinuous(scaleType) ? Gradient$1 : isDiscretizing(scaleType) ? Discrete$1 : Symbols$1;
+ type = isContinuous(scaleType) ? Gradient : isDiscretizing(scaleType) ? Discrete : Symbols;
}
- return type !== Gradient$1 ? type : isDiscretizing(scaleType) ? Discrete$1 : Gradient$1;
+ return type !== Gradient ? type : isDiscretizing(scaleType) ? Discrete : Gradient;
}
function scaleCount(spec) {
return LegendScales.reduce((count, type) => count + (spec[type] ? 1 : 0), 0);
}
@@ -43391,49 +43511,49 @@
function sizeExpression(spec, scope, marks) {
const size = deref(getChannel('size', spec, marks)),
strokeWidth = deref(getChannel('strokeWidth', spec, marks)),
fontSize = deref(getFontSize(marks[1].encode, scope, GuideLabelStyle));
- return parser$1("max(ceil(sqrt(".concat(size, ")+").concat(strokeWidth, "),").concat(fontSize, ")"), scope);
+ return parser(`max(ceil(sqrt(${size})+${strokeWidth}),${fontSize})`, scope);
}
function getChannel(name, spec, marks) {
- return spec[name] ? "scale(\"".concat(spec[name], "\",datum)") : getEncoding(name, marks[0].encode);
+ return spec[name] ? `scale("${spec[name]}",datum)` : getEncoding(name, marks[0].encode);
}
function getFontSize(encode, scope, style) {
return getEncoding('fontSize', encode) || getStyle('fontSize', scope, style);
}
- const angleExpr = "item.orient===\"".concat(Left$1, "\"?-90:item.orient===\"").concat(Right$1, "\"?90:0");
+ const angleExpr = `item.orient==="${Left}"?-90:item.orient==="${Right}"?90:0`;
function parseTitle(spec, scope) {
spec = isString(spec) ? {
text: spec
} : spec;
- const _ = lookup$4(spec, scope.config.title),
+ const _ = lookup(spec, scope.config.title),
encode = spec.encode || {},
userEncode = encode.group || {},
name = userEncode.name || undefined,
interactive = userEncode.interactive,
style = userEncode.style,
children = []; // single-element data source for group title
const datum = {},
- dataRef = ref(scope.add(Collect$1(null, [datum]))); // include title text
+ dataRef = ref(scope.add(Collect(null, [datum]))); // include title text
children.push(buildTitle(spec, _, titleEncode(spec), dataRef)); // include subtitle text
if (spec.subtitle) {
children.push(buildSubTitle(spec, _, encode.subtitle, dataRef));
} // parse title specification
return parseMark(guideGroup({
- role: TitleRole$1,
+ role: TitleRole,
from: dataRef,
encode: groupEncode(_, userEncode),
marks: children,
aria: _('aria'),
description: _('description'),
@@ -43446,11 +43566,11 @@
// the top-level encode block has been *deprecated*.
function titleEncode(spec) {
const encode = spec.encode;
- return encode && encode.title || extend({
+ return encode && encode.title || extend$1({
name: spec.name,
interactive: spec.interactive,
style: spec.style
}, encode);
}
@@ -43462,21 +43582,21 @@
};
addEncoders(encode, {
orient: _('orient'),
anchor: _('anchor'),
align: {
- signal: alignExpr
+ signal: alignExpr$1
},
angle: {
signal: angleExpr
},
limit: _('limit'),
frame: _('frame'),
offset: _('offset') || 0,
padding: _('subtitlePadding')
});
- return extendEncode(encode, userEncode, Skip$2);
+ return extendEncode(encode, userEncode, Skip);
}
function buildTitle(spec, _, userEncode, dataRef) {
const zero = {
value: 0
@@ -43581,11 +43701,11 @@
from: dataRef,
encode
}, userEncode);
}
- function parseData$1(data, scope) {
+ function parseData(data, scope) {
const transforms = [];
if (data.transform) {
data.transform.forEach(tx => {
transforms.push(parseTransform(tx, scope));
@@ -43618,11 +43738,11 @@
if (data.values) {
// hard-wired input data set
if (isSignal(data.values) || hasSignal(data.format)) {
// if either values is signal or format has signal, use dynamic loader
- output.push(load$1(scope, data));
+ output.push(load(scope, data));
output.push(source = collect());
} else {
// otherwise, ingest upon dataflow init
output.push(source = collect({
$ingest: data.values,
@@ -43631,22 +43751,22 @@
}
} else if (data.url) {
// load data from external source
if (hasSignal(data.url) || hasSignal(data.format)) {
// if either url or format has signal, use dynamic loader
- output.push(load$1(scope, data));
+ output.push(load(scope, data));
output.push(source = collect());
} else {
// otherwise, request load upon dataflow init
output.push(source = collect({
$request: data.url,
$format: data.format
}));
}
} else if (data.source) {
// derives from one or more other data sets
- source = upstream = array(data.source).map(d => ref(scope.getData(d).output));
+ source = upstream = array$5(data.source).map(d => ref(scope.getData(d).output));
output.push(null); // populate later
} // scan data transforms, add collectors as needed
for (i = 0, n = ops.length; i < n; ++i) {
@@ -43663,11 +43783,11 @@
if (m.source) source = t;else if (m.changes) source = null;
}
if (upstream) {
n = upstream.length - 1;
- output[0] = Relay$1({
+ output[0] = Relay({
derive: modify,
pulse: n ? upstream : upstream[0]
});
if (modify || n) {
@@ -43675,63 +43795,63 @@
output.splice(1, 0, collect());
}
}
if (!source) output.push(collect());
- output.push(Sieve$1({}));
+ output.push(Sieve({}));
return output;
}
function collect(values) {
- const s = Collect$1({}, values);
+ const s = Collect({}, values);
s.metadata = {
source: true
};
return s;
}
- function load$1(scope, data) {
- return Load$1({
+ function load(scope, data) {
+ return Load({
url: data.url ? scope.property(data.url) : undefined,
async: data.async ? scope.property(data.async) : undefined,
values: data.values ? scope.property(data.values) : undefined,
format: scope.objectProperty(data.format)
});
}
- const isX = orient => orient === Bottom$1 || orient === Top$1; // get sign coefficient based on axis orient
+ const isX = orient => orient === Bottom || orient === Top; // get sign coefficient based on axis orient
- const getSign = (orient, a, b) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left$1 || orient === Top$1 ? a : b; // condition on axis x-direction
+ const getSign = (orient, a, b) => isSignal(orient) ? ifLeftTopExpr(orient.signal, a, b) : orient === Left || orient === Top ? a : b; // condition on axis x-direction
const ifX = (orient, a, b) => isSignal(orient) ? ifXEnc(orient.signal, a, b) : isX(orient) ? a : b; // condition on axis y-direction
const ifY = (orient, a, b) => isSignal(orient) ? ifYEnc(orient.signal, a, b) : isX(orient) ? b : a;
- const ifTop = (orient, a, b) => isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top$1 ? {
+ const ifTop = (orient, a, b) => isSignal(orient) ? ifTopExpr(orient.signal, a, b) : orient === Top ? {
value: a
} : {
value: b
};
- const ifRight = (orient, a, b) => isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right$1 ? {
+ const ifRight = (orient, a, b) => isSignal(orient) ? ifRightExpr(orient.signal, a, b) : orient === Right ? {
value: a
} : {
value: b
};
- const ifXEnc = ($orient, a, b) => ifEnc("".concat($orient, " === '").concat(Top$1, "' || ").concat($orient, " === '").concat(Bottom$1, "'"), a, b);
+ const ifXEnc = ($orient, a, b) => ifEnc(`${$orient} === '${Top}' || ${$orient} === '${Bottom}'`, a, b);
- const ifYEnc = ($orient, a, b) => ifEnc("".concat($orient, " !== '").concat(Top$1, "' && ").concat($orient, " !== '").concat(Bottom$1, "'"), a, b);
+ const ifYEnc = ($orient, a, b) => ifEnc(`${$orient} !== '${Top}' && ${$orient} !== '${Bottom}'`, a, b);
- const ifLeftTopExpr = ($orient, a, b) => ifExpr("".concat($orient, " === '").concat(Left$1, "' || ").concat($orient, " === '").concat(Top$1, "'"), a, b);
+ const ifLeftTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Left}' || ${$orient} === '${Top}'`, a, b);
- const ifTopExpr = ($orient, a, b) => ifExpr("".concat($orient, " === '").concat(Top$1, "'"), a, b);
+ const ifTopExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Top}'`, a, b);
- const ifRightExpr = ($orient, a, b) => ifExpr("".concat($orient, " === '").concat(Right$1, "'"), a, b);
+ const ifRightExpr = ($orient, a, b) => ifExpr(`${$orient} === '${Right}'`, a, b);
const ifEnc = (test, a, b) => {
// ensure inputs are encoder objects (or null)
a = a != null ? encoder(a) : a;
b = b != null ? encoder(b) : b;
@@ -43739,34 +43859,34 @@
if (isSimple(a) && isSimple(b)) {
// if possible generate simple signal expression
a = a ? a.signal || $(a.value) : null;
b = b ? b.signal || $(b.value) : null;
return {
- signal: "".concat(test, " ? (").concat(a, ") : (").concat(b, ")")
+ signal: `${test} ? (${a}) : (${b})`
};
} else {
// otherwise generate rule set
- return [extend({
+ return [extend$1({
test
}, a)].concat(b || []);
}
};
const isSimple = enc => enc == null || Object.keys(enc).length === 1;
const ifExpr = (test, a, b) => ({
- signal: "".concat(test, " ? (").concat(toExpr(a), ") : (").concat(toExpr(b), ")")
+ signal: `${test} ? (${toExpr(a)}) : (${toExpr(b)})`
});
const ifOrient = ($orient, t, b, l, r) => ({
- signal: (l != null ? "".concat($orient, " === '").concat(Left$1, "' ? (").concat(toExpr(l), ") : ") : '') + (b != null ? "".concat($orient, " === '").concat(Bottom$1, "' ? (").concat(toExpr(b), ") : ") : '') + (r != null ? "".concat($orient, " === '").concat(Right$1, "' ? (").concat(toExpr(r), ") : ") : '') + (t != null ? "".concat($orient, " === '").concat(Top$1, "' ? (").concat(toExpr(t), ") : ") : '') + '(null)'
+ signal: (l != null ? `${$orient} === '${Left}' ? (${toExpr(l)}) : ` : '') + (b != null ? `${$orient} === '${Bottom}' ? (${toExpr(b)}) : ` : '') + (r != null ? `${$orient} === '${Right}' ? (${toExpr(r)}) : ` : '') + (t != null ? `${$orient} === '${Top}' ? (${toExpr(t)}) : ` : '') + '(null)'
});
const toExpr = v => isSignal(v) ? v.signal : v == null ? null : $(v);
const mult = (sign, value) => value === 0 ? 0 : isSignal(sign) ? {
- signal: "(".concat(sign.signal, ") * ").concat(value)
+ signal: `(${sign.signal}) * ${value}`
} : {
value: sign * value
};
const patch = (value, base) => {
@@ -43777,13 +43897,13 @@
};
function fallback(prop, config, axisConfig, style) {
let styleProp;
- if (config && has(config, prop)) {
+ if (config && has$1(config, prop)) {
return config[prop];
- } else if (has(axisConfig, prop)) {
+ } else if (has$1(axisConfig, prop)) {
return axisConfig[prop];
} else if (prop.startsWith('title')) {
switch (prop) {
case 'titleColor':
styleProp = 'fill';
@@ -43811,11 +43931,11 @@
}
return null;
}
- function keys$1(objects) {
+ function keys(objects) {
const map = {};
for (const obj of objects) {
if (!obj) continue;
@@ -43834,12 +43954,12 @@
xy,
or,
key;
if (isSignal(orient)) {
- const xyKeys = keys$1([config.axisX, config.axisY]),
- orientKeys = keys$1([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]);
+ const xyKeys = keys([config.axisX, config.axisY]),
+ orientKeys = keys([config.axisTop, config.axisBottom, config.axisLeft, config.axisRight]);
xy = {};
for (key of xyKeys) {
xy[key] = ifX(orient, fallback(key, config.axisX, axis, style), fallback(key, config.axisY, axis, style));
}
@@ -43848,32 +43968,32 @@
for (key of orientKeys) {
or[key] = ifOrient(orient.signal, fallback(key, config.axisTop, axis, style), fallback(key, config.axisBottom, axis, style), fallback(key, config.axisLeft, axis, style), fallback(key, config.axisRight, axis, style));
}
} else {
- xy = orient === Top$1 || orient === Bottom$1 ? config.axisX : config.axisY;
+ xy = orient === Top || orient === Bottom ? config.axisX : config.axisY;
or = config['axis' + orient[0].toUpperCase() + orient.slice(1)];
}
- const result = xy || or || band ? extend({}, axis, xy, or, band) : axis;
+ const result = xy || or || band ? extend$1({}, axis, xy, or, band) : axis;
return result;
}
function axisDomain(spec, config, userEncode, dataRef) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
orient = spec.orient;
let enter, update;
const encode = {
enter: enter = {
- opacity: zero$2
+ opacity: zero
},
update: update = {
- opacity: one$2
+ opacity: one
},
exit: {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
stroke: _('domainColor'),
strokeCap: _('domainCap'),
@@ -43882,13 +44002,13 @@
strokeWidth: _('domainWidth'),
strokeOpacity: _('domainOpacity')
});
const pos0 = position(spec, 0);
const pos1 = position(spec, 1);
- enter.x = update.x = ifX(orient, pos0, zero$2);
+ enter.x = update.x = ifX(orient, pos0, zero);
enter.x2 = update.x2 = ifX(orient, pos1);
- enter.y = update.y = ifY(orient, pos0, zero$2);
+ enter.y = update.y = ifY(orient, pos0, zero);
enter.y2 = update.y2 = ifY(orient, pos1);
return guideMark({
type: RuleMark,
role: AxisDomainRole,
from: dataRef,
@@ -43902,26 +44022,26 @@
range: pos
};
}
function axisGrid(spec, config, userEncode, dataRef, band) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
orient = spec.orient,
vscale = spec.gridScale,
sign = getSign(orient, 1, -1),
- offset = offsetValue$1(spec.offset, sign);
+ offset = offsetValue(spec.offset, sign);
let enter, exit, update;
const encode = {
enter: enter = {
- opacity: zero$2
+ opacity: zero
},
update: update = {
- opacity: one$2
+ opacity: one
},
exit: exit = {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
stroke: _('gridColor'),
strokeCap: _('gridCap'),
@@ -43955,11 +44075,11 @@
const gridEnd = vscale ? {
scale: vscale,
range: 1,
mult: sign,
offset: offset
- } : extend(sz, {
+ } : extend$1(sz, {
mult: sign,
offset: offset
});
enter.x = update.x = ifX(orient, tickPos, gridStart);
enter.y = update.y = ifY(orient, tickPos, gridStart);
@@ -43974,50 +44094,50 @@
from: dataRef,
encode
}, userEncode);
}
- function offsetValue$1(offset, sign) {
+ function offsetValue(offset, sign) {
if (sign === 1) ;else if (!isObject(offset)) {
offset = isSignal(sign) ? {
- signal: "(".concat(sign.signal, ") * (").concat(offset || 0, ")")
+ signal: `(${sign.signal}) * (${offset || 0})`
} : sign * (offset || 0);
} else {
- let entry = offset = extend({}, offset);
+ let entry = offset = extend$1({}, offset);
while (entry.mult != null) {
if (!isObject(entry.mult)) {
entry.mult = isSignal(sign) // no offset if sign === 1
? {
- signal: "(".concat(entry.mult, ") * (").concat(sign.signal, ")")
+ signal: `(${entry.mult}) * (${sign.signal})`
} : entry.mult * sign;
return offset;
} else {
- entry = entry.mult = extend({}, entry.mult);
+ entry = entry.mult = extend$1({}, entry.mult);
}
}
entry.mult = sign;
}
return offset;
}
function axisTicks(spec, config, userEncode, dataRef, size, band) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
orient = spec.orient,
sign = getSign(orient, -1, 1);
let enter, exit, update;
const encode = {
enter: enter = {
- opacity: zero$2
+ opacity: zero
},
update: update = {
- opacity: one$2
+ opacity: one
},
exit: exit = {
- opacity: zero$2
+ opacity: zero
}
};
addEncoders(encode, {
stroke: _('tickColor'),
strokeCap: _('tickCap'),
@@ -44034,14 +44154,14 @@
band: band.band,
extra: band.extra,
offset: band.offset,
round: _('tickRound')
};
- update.y = enter.y = ifX(orient, zero$2, tickPos);
+ update.y = enter.y = ifX(orient, zero, tickPos);
update.y2 = enter.y2 = ifX(orient, tickSize);
exit.x = ifX(orient, tickPos);
- update.x = enter.x = ifY(orient, zero$2, tickPos);
+ update.x = enter.x = ifY(orient, zero, tickPos);
update.x2 = enter.x2 = ifY(orient, tickSize);
exit.y = ifY(orient, tickPos);
return guideMark({
type: RuleMark,
role: AxisTickRole,
@@ -44056,11 +44176,11 @@
signal: 'flush(range("' + scale + '"), ' + 'scale("' + scale + '", datum.value), ' + threshold + ',' + a + ',' + b + ',' + c + ')'
};
}
function axisLabels(spec, config, userEncode, dataRef, size, band) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
orient = spec.orient,
scale = spec.scale,
sign = getSign(orient, -1, 1),
flush = deref(_('labelFlush')),
flushOffset = deref(_('labelFlushOffset')),
@@ -44083,31 +44203,31 @@
value: 'center'
}, ifRight(orient, 'left', 'right'));
const baseline = ifX(orient, ifTop(orient, 'bottom', 'top'), flushOn ? flushExpr(scale, flush, '"top"', '"bottom"', '"middle"') : {
value: 'middle'
});
- const offsetExpr = flushExpr(scale, flush, "-(".concat(flushOffset, ")"), flushOffset, 0);
+ const offsetExpr = flushExpr(scale, flush, `-(${flushOffset})`, flushOffset, 0);
flushOn = flushOn && flushOffset;
const enter = {
- opacity: zero$2,
+ opacity: zero,
x: ifX(orient, tickPos, tickSize),
y: ifY(orient, tickPos, tickSize)
};
const encode = {
enter: enter,
update: update = {
- opacity: one$2,
+ opacity: one,
text: {
- field: Label$1
+ field: Label
},
x: enter.x,
y: enter.y,
align,
baseline
},
exit: {
- opacity: zero$2,
+ opacity: zero,
x: enter.x,
y: enter.y
}
};
addEncoders(encode, {
@@ -44163,39 +44283,39 @@
overlap
}, userEncode);
}
function axisTitle(spec, config, userEncode, dataRef) {
- const _ = lookup$4(spec, config),
+ const _ = lookup(spec, config),
orient = spec.orient,
sign = getSign(orient, -1, 1);
let enter, update;
const encode = {
enter: enter = {
- opacity: zero$2,
+ opacity: zero,
anchor: encoder(_('titleAnchor', null)),
align: {
- signal: alignExpr
+ signal: alignExpr$1
}
},
- update: update = extend({}, enter, {
- opacity: one$2,
+ update: update = extend$1({}, enter, {
+ opacity: one,
text: encoder(spec.title)
}),
exit: {
- opacity: zero$2
+ opacity: zero
}
};
const titlePos = {
- signal: "lerp(range(\"".concat(spec.scale, "\"), ").concat(anchorExpr(0, 1, 0.5), ")")
+ signal: `lerp(range("${spec.scale}"), ${anchorExpr(0, 1, 0.5)})`
};
update.x = ifX(orient, titlePos);
update.y = ifY(orient, titlePos);
- enter.angle = ifX(orient, zero$2, mult(sign, 90));
- enter.baseline = ifX(orient, ifTop(orient, Bottom$1, Top$1), {
- value: Bottom$1
+ enter.angle = ifX(orient, zero, mult(sign, 90));
+ enter.baseline = ifX(orient, ifTop(orient, Bottom, Top), {
+ value: Bottom
});
update.angle = enter.angle;
update.baseline = enter.baseline;
addEncoders(encode, {
fill: _('titleColor'),
@@ -44224,11 +44344,11 @@
encode
}, userEncode);
}
function autoLayout(_, orient, encode, userEncode) {
- const auto = (value, dim) => value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has$1(dim, userEncode) ? true : false;
+ const auto = (value, dim) => value != null ? (encode.update[dim] = patch(encoder(value), encode.update[dim]), false) : !has(dim, userEncode) ? true : false;
const autoY = auto(_('titleX'), 'x'),
autoX = auto(_('titleY'), 'y');
encode.enter.auto = autoX === autoY ? encoder(autoX) : ifX(orient, encoder(autoX), encoder(autoY));
}
@@ -44238,11 +44358,11 @@
encode = spec.encode || {},
axisEncode = encode.axis || {},
name = axisEncode.name || undefined,
interactive = axisEncode.interactive,
style = axisEncode.style,
- _ = lookup$4(spec, config),
+ _ = lookup(spec, config),
band = tickBand(_); // single-element data source for axis group
const datum = {
scale: spec.scale,
@@ -44250,13 +44370,13 @@
labels: !!_('labels'),
grid: !!_('grid'),
domain: !!_('domain'),
title: spec.title != null
};
- const dataRef = ref(scope.add(Collect$1({}, [datum]))); // data source for axis ticks
+ const dataRef = ref(scope.add(Collect({}, [datum]))); // data source for axis ticks
- const ticksRef = ref(scope.add(AxisTicks$1({
+ const ticksRef = ref(scope.add(AxisTicks({
scale: scope.scaleRef(spec.scale),
extra: scope.property(band.extra),
count: scope.objectProperty(spec.tickCount),
values: scope.objectProperty(spec.values),
minstep: scope.property(spec.tickMinStep),
@@ -44293,13 +44413,13 @@
children.push(axisTitle(spec, config, encode.title, dataRef));
} // parse axis specification
return parseMark(guideGroup({
- role: AxisRole$1,
+ role: AxisRole,
from: dataRef,
- encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip$2),
+ encode: extendEncode(buildAxisEncode(_, spec), axisEncode, Skip),
marks: children,
aria: _('aria'),
description: _('description'),
zindex: _('zindex'),
name,
@@ -44314,46 +44434,46 @@
update: {}
};
addEncoders(encode, {
orient: _('orient'),
offset: _('offset') || 0,
- position: value$2(spec.position, 0),
+ position: value(spec.position, 0),
titlePadding: _('titlePadding'),
minExtent: _('minExtent'),
maxExtent: _('maxExtent'),
range: {
- signal: "abs(span(range(\"".concat(spec.scale, "\")))")
+ signal: `abs(span(range("${spec.scale}")))`
},
translate: _('translate'),
// accessibility support
format: spec.format,
formatType: spec.formatType
});
return encode;
}
function parseScope(spec, scope, preprocessed) {
- const signals = array(spec.signals),
- scales = array(spec.scales); // parse signal definitions, if not already preprocessed
+ const signals = array$5(spec.signals),
+ scales = array$5(spec.scales); // parse signal definitions, if not already preprocessed
if (!preprocessed) signals.forEach(_ => parseSignal(_, scope)); // parse cartographic projection definitions
- array(spec.projections).forEach(_ => parseProjection(_, scope)); // initialize scale references
+ array$5(spec.projections).forEach(_ => parseProjection(_, scope)); // initialize scale references
scales.forEach(_ => initScale(_, scope)); // parse data sources
- array(spec.data).forEach(_ => parseData$1(_, scope)); // parse scale definitions
+ array$5(spec.data).forEach(_ => parseData(_, scope)); // parse scale definitions
scales.forEach(_ => parseScale(_, scope)); // parse signal updates
(preprocessed || signals).forEach(_ => parseSignalUpdates(_, scope)); // parse axis definitions
- array(spec.axes).forEach(_ => parseAxis(_, scope)); // parse mark definitions
+ array$5(spec.axes).forEach(_ => parseAxis(_, scope)); // parse mark definitions
- array(spec.marks).forEach(_ => parseMark(_, scope)); // parse legend definitions
+ array$5(spec.marks).forEach(_ => parseMark(_, scope)); // parse legend definitions
- array(spec.legends).forEach(_ => parseLegend(_, scope)); // parse title, if defined
+ array$5(spec.legends).forEach(_ => parseLegend(_, scope)); // parse title, if defined
if (spec.title) parseTitle(spec.title, scope); // parse collected lambda (anonymous) expressions
scope.parseLambdas();
return scope;
@@ -44389,17 +44509,17 @@
scope.description = spec.description || config.description;
scope.eventConfig = config.events;
scope.legends = scope.objectProperty(config.legend && config.legend.layout);
scope.locale = config.locale; // store root group item
- const input = scope.add(Collect$1()); // encode root group item
+ const input = scope.add(Collect()); // encode root group item
- const encode = scope.add(Encode$1(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole$1, spec.style, scope, {
+ const encode = scope.add(Encode(parseEncode(rootEncode(spec.encode), GroupMark, FrameRole, spec.style, scope, {
pulse: ref(input)
}))); // perform view layout
- const parent = scope.add(ViewLayout$1({
+ const parent = scope.add(ViewLayout({
layout: scope.objectProperty(spec.layout),
legends: scope.legends,
autosize: scope.signalRef('autosize'),
mark: root,
pulse: ref(encode)
@@ -44408,18 +44528,18 @@
scope.pushState(ref(encode), ref(parent), null);
parseScope(spec, scope, signals);
scope.operators.push(parent); // bound / render / sieve root item
- let op = scope.add(Bound$1({
+ let op = scope.add(Bound({
mark: root,
pulse: ref(parent)
}));
- op = scope.add(Render$1({
+ op = scope.add(Render({
pulse: ref(op)
}));
- op = scope.add(Sieve$1({
+ op = scope.add(Sieve({
pulse: ref(op)
})); // track metadata for root item
scope.addData('root', new DataScope(scope, input, input, op));
return scope;
@@ -44449,38 +44569,38 @@
* overwriting existing 'value' or 'update' properties.
*/
function collectSignals(spec, config) {
- const _ = name => value$2(spec[name], config[name]),
+ const _ = name => value(spec[name], config[name]),
signals = [signalObject('background', _('background')), signalObject('autosize', parseAutosize(_('autosize'))), signalObject('padding', parsePadding(_('padding'))), signalObject('width', _('width') || 0), signalObject('height', _('height') || 0)],
pre = signals.reduce((p, s) => (p[s.name] = s, p), {}),
map = {}; // add spec signal array
- array(spec.signals).forEach(s => {
- if (has(pre, s.name)) {
+ array$5(spec.signals).forEach(s => {
+ if (has$1(pre, s.name)) {
// merge if built-in signal
- s = extend(pre[s.name], s);
+ s = extend$1(pre[s.name], s);
} else {
// otherwise add to signal list
signals.push(s);
}
map[s.name] = s;
}); // add config signal array
- array(config.signals).forEach(s => {
- if (!has(map, s.name) && !has(pre, s.name)) {
+ array$5(config.signals).forEach(s => {
+ if (!has$1(map, s.name) && !has$1(pre, s.name)) {
// add to signal list if not already defined
signals.push(s);
}
});
return signals;
}
- function Scope$1(config, options) {
+ function Scope(config, options) {
this.config = config || {};
this.options = options || {};
this.bindings = [];
this.field = {};
this.signals = {};
@@ -44522,11 +44642,11 @@
this._encode = scope._encode.slice();
this._lookup = scope._lookup.slice();
this._markpath = scope._markpath;
}
- Scope$1.prototype = Subscope.prototype = {
+ Scope.prototype = Subscope.prototype = {
parse(spec) {
return parseScope(spec, this);
},
fork() {
@@ -44568,11 +44688,11 @@
return op;
},
proxy(op) {
const vref = op instanceof Entry ? ref(op) : op;
- return this.add(Proxy$1({
+ return this.add(Proxy({
value: vref
}));
},
addStream(stream) {
@@ -44626,11 +44746,11 @@
return this;
},
// ----
pushState(encode, parent, lookup) {
- this._encode.push(ref(this.add(Sieve$1({
+ this._encode.push(ref(this.add(Sieve({
pulse: encode
}))));
this._parent.push(parent);
@@ -44648,29 +44768,29 @@
this._markpath.pop();
},
parent() {
- return peek(this._parent);
+ return peek$1(this._parent);
},
encode() {
- return peek(this._encode);
+ return peek$1(this._encode);
},
lookup() {
- return peek(this._lookup);
+ return peek$1(this._lookup);
},
markpath() {
const p = this._markpath;
return ++p[p.length - 1];
},
// ----
fieldRef(field, name) {
- if (isString(field)) return fieldRef(field, name);
+ if (isString(field)) return fieldRef$1(field, name);
if (!field.signal) {
error('Unsupported field reference: ' + $(field));
}
@@ -44680,24 +44800,24 @@
if (!f) {
const params = {
name: this.signalRef(s)
};
if (name) params.as = name;
- this.field[s] = f = ref(this.add(Field$1(params)));
+ this.field[s] = f = ref(this.add(Field(params)));
}
return f;
},
compareRef(cmp) {
let signal = false;
- const check = _ => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr(_) ? (signal = true, this.exprRef(_.expr)) : _;
+ const check = _ => isSignal(_) ? (signal = true, this.signalRef(_.signal)) : isExpr$1(_) ? (signal = true, this.exprRef(_.expr)) : _;
- const fields = array(cmp.field).map(check),
- orders = array(cmp.order).map(check);
- return signal ? ref(this.add(Compare$1({
+ const fields = array$5(cmp.field).map(check),
+ orders = array$5(cmp.order).map(check);
+ return signal ? ref(this.add(Compare({
fields: fields,
orders: orders
}))) : compareRef(fields, orders);
},
@@ -44705,23 +44825,23 @@
let signal = false;
const check = _ => isSignal(_) ? (signal = true, ref(sig[_.signal])) : _;
const sig = this.signals;
- fields = array(fields).map(check);
- return signal ? ref(this.add(Key$1({
+ fields = array$5(fields).map(check);
+ return signal ? ref(this.add(Key({
fields: fields,
flat: flat
}))) : keyRef(fields, flat);
},
sortRef(sort) {
if (!sort) return sort; // including id ensures stable sorting
const a = aggrField(sort.op, sort.field),
o = sort.order || Ascending;
- return o.signal ? ref(this.add(Compare$1({
+ return o.signal ? ref(this.add(Compare({
fields: a,
orders: this.signalRef(o.signal)
}))) : compareRef(a, o);
},
@@ -44742,11 +44862,11 @@
return this.events[key];
},
// ----
hasOwnSignal(name) {
- return has(this.signals, name);
+ return has$1(this.signals, name);
},
addSignal(name, value) {
if (this.hasOwnSignal(name)) {
error('Duplicate signal name: ' + $(name));
@@ -44765,11 +44885,11 @@
},
signalRef(s) {
if (this.signals[s]) {
return ref(this.signals[s]);
- } else if (!has(this.lambdas, s)) {
+ } else if (!has$1(this.lambdas, s)) {
this.lambdas[s] = this.add(operator(null));
}
return ref(this.lambdas[s]);
},
@@ -44777,11 +44897,11 @@
parseLambdas() {
const code = Object.keys(this.lambdas);
for (let i = 0, n = code.length; i < n; ++i) {
const s = code[i],
- e = parser$1(s, this),
+ e = parser(s, this),
op = this.lambdas[s];
op.params = e.$params;
op.update = e.$expr;
}
},
@@ -44794,41 +44914,41 @@
return !spec || !isObject(spec) ? spec : this.signalRef(spec.signal || propertyLambda(spec));
},
exprRef(code, name) {
const params = {
- expr: parser$1(code, this)
+ expr: parser(code, this)
};
if (name) params.expr.$name = name;
- return ref(this.add(Expression$1(params)));
+ return ref(this.add(Expression(params)));
},
addBinding(name, bind) {
if (!this.bindings) {
error('Nested signals do not support binding: ' + $(name));
}
- this.bindings.push(extend({
+ this.bindings.push(extend$1({
signal: name
}, bind));
},
// ----
addScaleProj(name, transform) {
- if (has(this.scales, name)) {
+ if (has$1(this.scales, name)) {
error('Duplicate scale or projection name: ' + $(name));
}
this.scales[name] = this.add(transform);
},
addScale(name, params) {
- this.addScaleProj(name, Scale$1(params));
+ this.addScaleProj(name, Scale(params));
},
addProjection(name, params) {
- this.addScaleProj(name, Projection$1(params));
+ this.addScaleProj(name, Projection(params));
},
getScale(name) {
if (!this.scales[name]) {
error('Unrecognized scale name: ' + $(name));
@@ -44853,11 +44973,11 @@
return this.scaleType(name);
},
// ----
addData(name, dataScope) {
- if (has(this.data, name)) {
+ if (has$1(this.data, name)) {
error('Duplicate data set name: ' + $(name));
}
return this.data[name] = dataScope;
},
@@ -44869,11 +44989,11 @@
return this.data[name];
},
addDataPipeline(name, entries) {
- if (has(this.data, name)) {
+ if (has$1(this.data, name)) {
error('Duplicate data set name: ' + $(name));
}
return this.addData(name, DataScope.fromEntries(this, entries));
}
@@ -45134,23 +45254,23 @@
symbol: ['circle', 'square', 'triangle-up', 'cross', 'diamond', 'triangle-right', 'triangle-down', 'triangle-left']
}
};
}
- function parse$1$1(spec, config, options) {
+ function parse(spec, config, options) {
if (!isObject(spec)) {
error('Input Vega specification must be an object.');
}
config = mergeConfig(defaults(), config, spec.config);
- return parseView(spec, new Scope$1(config, options)).toRuntime();
+ return parseView(spec, new Scope(config, options)).toRuntime();
}
// -- Transforms -----
- extend(transforms, tx, vtx, encode, geo, force, label, tree$1, reg, voronoi, wordcloud, xf); // -- Exports -----
+ extend$1(transforms, tx, vtx, encode$1, geo, force, label, tree, reg, voronoi, wordcloud, xf); // -- Exports -----
- const version$1 = pkg.version;
+ const version = pkg.version;
exports.Bounds = Bounds;
exports.CanvasHandler = CanvasHandler;
exports.CanvasRenderer = CanvasRenderer;
exports.DATE = DATE;
@@ -45158,22 +45278,22 @@
exports.DAYOFYEAR = DAYOFYEAR;
exports.Dataflow = Dataflow;
exports.Debug = Debug;
exports.Error = Error$1;
exports.EventStream = EventStream;
- exports.Gradient = Gradient;
+ exports.Gradient = Gradient$1;
exports.GroupItem = GroupItem;
exports.HOURS = HOURS;
exports.Handler = Handler;
exports.Info = Info;
exports.Item = Item;
exports.MILLISECONDS = MILLISECONDS;
exports.MINUTES = MINUTES;
exports.MONTH = MONTH;
exports.Marks = Marks;
exports.MultiPulse = MultiPulse;
- exports.None = None;
+ exports.None = None$2;
exports.Operator = Operator;
exports.Parameters = Parameters;
exports.Pulse = Pulse;
exports.QUARTER = QUARTER;
exports.RenderType = RenderType;
@@ -45184,149 +45304,152 @@
exports.SVGRenderer = SVGRenderer;
exports.SVGStringRenderer = SVGStringRenderer;
exports.Scenegraph = Scenegraph;
exports.TIME_UNITS = TIME_UNITS;
exports.Transform = Transform;
- exports.View = View;
+ exports.View = View$1;
exports.WEEK = WEEK;
exports.Warn = Warn;
exports.YEAR = YEAR;
exports.accessor = accessor;
exports.accessorFields = accessorFields;
exports.accessorName = accessorName;
- exports.array = array;
- exports.ascending = ascending;
+ exports.array = array$5;
+ exports.ascending = ascending$3;
exports.bandwidthNRD = estimateBandwidth;
- exports.bin = bin$1;
+ exports.bin = bin;
exports.bootstrapCI = bootstrapCI;
exports.boundClip = boundClip;
exports.boundContext = boundContext;
- exports.boundItem = boundItem;
+ exports.boundItem = boundItem$1;
exports.boundMark = boundMark;
exports.boundStroke = boundStroke;
exports.changeset = changeset;
exports.clampRange = clampRange;
- exports.compare = compare;
- exports.constant = constant;
+ exports.codegenExpression = codegen;
+ exports.compare = compare$1;
+ exports.constant = constant$4;
exports.cumulativeLogNormal = cumulativeLogNormal;
exports.cumulativeNormal = cumulativeNormal;
exports.cumulativeUniform = cumulativeUniform;
exports.dayofyear = dayofyear;
exports.debounce = debounce;
- exports.defaultLocale = defaultLocale$2;
- exports.definition = definition;
+ exports.defaultLocale = defaultLocale;
+ exports.definition = definition$1;
exports.densityLogNormal = densityLogNormal;
exports.densityNormal = densityNormal;
exports.densityUniform = densityUniform;
exports.domChild = domChild;
exports.domClear = domClear;
exports.domCreate = domCreate;
exports.domFind = domFind;
exports.dotbin = dotbin;
exports.error = error;
exports.expressionFunction = expressionFunction;
- exports.extend = extend;
+ exports.extend = extend$1;
exports.extent = extent;
exports.extentIndex = extentIndex;
exports.falsy = falsy;
exports.fastmap = fastmap;
- exports.field = field;
+ exports.field = field$1;
exports.flush = flush;
exports.font = font;
exports.fontFamily = fontFamily;
exports.fontSize = fontSize;
- exports.format = format;
+ exports.format = format$2;
exports.formatLocale = numberFormatDefaultLocale;
- exports.formats = formats;
- exports.hasOwnProperty = has;
+ exports.formats = formats$1;
+ exports.hasOwnProperty = has$1;
exports.id = id;
- exports.identity = identity;
+ exports.identity = identity$6;
exports.inferType = inferType;
exports.inferTypes = inferTypes;
- exports.ingest = ingest;
+ exports.ingest = ingest$1;
exports.inherits = inherits;
exports.inrange = inrange;
exports.interpolate = interpolate;
exports.interpolateColors = interpolateColors;
exports.interpolateRange = interpolateRange;
- exports.intersect = intersect$1;
+ exports.intersect = intersect$2;
exports.intersectBoxLine = intersectBoxLine;
exports.intersectPath = intersectPath;
exports.intersectPoint = intersectPoint;
exports.intersectRule = intersectRule;
exports.isArray = isArray;
- exports.isBoolean = isBoolean;
- exports.isDate = isDate;
+ exports.isBoolean = isBoolean$1;
+ exports.isDate = isDate$1;
exports.isFunction = isFunction;
exports.isIterable = isIterable;
- exports.isNumber = isNumber;
+ exports.isNumber = isNumber$1;
exports.isObject = isObject;
exports.isRegExp = isRegExp;
exports.isString = isString;
exports.isTuple = isTuple;
exports.key = key;
exports.lerp = lerp;
exports.lineHeight = lineHeight;
exports.loader = loader;
- exports.locale = locale$2;
+ exports.locale = locale;
exports.logger = logger;
exports.lruCache = lruCache;
exports.markup = markup;
- exports.merge = merge;
+ exports.merge = merge$3;
exports.mergeConfig = mergeConfig;
exports.multiLineOffset = multiLineOffset;
- exports.one = one;
- exports.pad = pad;
+ exports.one = one$2;
+ exports.pad = pad$2;
exports.panLinear = panLinear;
exports.panLog = panLog;
exports.panPow = panPow;
exports.panSymlog = panSymlog;
- exports.parse = parse$1$1;
+ exports.parse = parse;
+ exports.parseExpression = parser$1;
+ exports.parseSelector = eventSelector;
exports.pathCurves = curves;
exports.pathEqual = pathEqual;
exports.pathParse = pathParse;
exports.pathRectangle = vg_rect;
exports.pathRender = pathRender;
- exports.pathSymbols = symbols$1;
+ exports.pathSymbols = symbols;
exports.pathTrail = vg_trail;
- exports.peek = peek;
- exports.point = point$5;
- exports.projection = projection$1;
+ exports.peek = peek$1;
+ exports.point = point;
+ exports.projection = projection;
exports.quantileLogNormal = quantileLogNormal;
exports.quantileNormal = quantileNormal;
exports.quantileUniform = quantileUniform;
exports.quantiles = quantiles;
exports.quantizeInterpolator = quantizeInterpolator;
exports.quarter = quarter;
exports.quartiles = quartiles;
exports.randomInteger = integer;
exports.randomKDE = kde;
- exports.randomLCG = lcg;
+ exports.randomLCG = lcg$1;
exports.randomLogNormal = lognormal;
- exports.randomMixture = mixture;
+ exports.randomMixture = mixture$1;
exports.randomNormal = gaussian;
exports.randomUniform = uniform;
exports.read = read;
exports.regressionExp = exp$1;
- exports.regressionLinear = linear;
+ exports.regressionLinear = linear$2;
exports.regressionLoess = loess;
- exports.regressionLog = log$2;
+ exports.regressionLog = log$3;
exports.regressionPoly = poly;
- exports.regressionPow = pow$1;
+ exports.regressionPow = pow$3;
exports.regressionQuad = quad;
exports.renderModule = renderModule;
exports.repeat = repeat;
exports.resetDefaultLocale = resetDefaultLocale;
exports.resetSVGClipId = resetSVGClipId;
exports.resetSVGDefIds = resetSVGDefIds;
exports.responseType = responseType;
- exports.runtimeContext = context$2;
+ exports.runtimeContext = context;
exports.sampleCurve = sampleCurve;
exports.sampleLogNormal = sampleLogNormal;
exports.sampleNormal = sampleNormal;
exports.sampleUniform = sampleUniform;
- exports.scale = scale;
+ exports.scale = scale$4;
exports.sceneEqual = sceneEqual;
exports.sceneFromJSON = sceneFromJSON;
exports.scenePickVisit = pickVisit;
exports.sceneToJSON = sceneToJSON;
exports.sceneVisit = visit;
@@ -45336,11 +45459,11 @@
exports.setRandom = setRandom;
exports.span = span;
exports.splitAccessPath = splitAccessPath;
exports.stringValue = $;
exports.textMetrics = textMetrics;
- exports.timeBin = bin;
+ exports.timeBin = bin$1;
exports.timeFloor = timeFloor;
exports.timeFormatLocale = timeFormatDefaultLocale;
exports.timeInterval = timeInterval;
exports.timeOffset = timeOffset;
exports.timeSequence = timeSequence;
@@ -45349,27 +45472,27 @@
exports.toBoolean = toBoolean;
exports.toDate = toDate;
exports.toNumber = toNumber;
exports.toSet = toSet;
exports.toString = toString;
- exports.transform = transform$1;
+ exports.transform = transform$2;
exports.transforms = transforms;
- exports.truncate = truncate;
+ exports.truncate = truncate$1;
exports.truthy = truthy;
exports.tupleid = tupleid;
exports.typeParsers = typeParsers;
exports.utcFloor = utcFloor;
exports.utcInterval = utcInterval;
exports.utcOffset = utcOffset;
exports.utcSequence = utcSequence;
exports.utcdayofyear = utcdayofyear;
exports.utcquarter = utcquarter;
exports.utcweek = utcweek;
- exports.version = version$1;
+ exports.version = version;
exports.visitArray = visitArray;
exports.week = week;
exports.writeConfig = writeConfig;
- exports.zero = zero;
+ exports.zero = zero$2;
exports.zoomLinear = zoomLinear;
exports.zoomLog = zoomLog;
exports.zoomPow = zoomPow;
exports.zoomSymlog = zoomSymlog;