vega-encode
Advanced tools
Comparing version 4.8.3 to 4.9.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-scale'), require('vega-util'), require('d3-array'), require('d3-interpolate')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-scale', 'vega-util', 'd3-array', 'd3-interpolate'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.vega, global.vega, global.d3, global.d3)); | ||
}(this, (function (exports, vegaDataflow, vegaScale, vegaUtil, d3Array, d3Interpolate) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-dataflow'), require('vega-scale'), require('vega-util')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vega-dataflow', 'vega-scale', 'vega-util'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.vega, global.vega)); | ||
})(this, (function (exports, vegaDataflow, vegaScale, vegaUtil) { 'use strict'; | ||
@@ -520,2 +520,37 @@ /** | ||
function range(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); | ||
while (++i < n) { | ||
range[i] = start + i * step; | ||
} | ||
return range; | ||
} | ||
function sum(values, valueof) { | ||
let sum = 0; | ||
if (valueof === undefined) { | ||
for (let value of values) { | ||
if (value = +value) { | ||
sum += value; | ||
} | ||
} | ||
} else { | ||
let index = -1; | ||
for (let value of values) { | ||
if (value = +valueof(value, ++index, values)) { | ||
sum += value; | ||
} | ||
} | ||
} | ||
return sum; | ||
} | ||
/** | ||
@@ -574,4 +609,4 @@ * Pie and donut chart layout. | ||
a = start, | ||
k = (stop - start) / d3Array.sum(values), | ||
index = d3Array.range(n), | ||
k = (stop - start) / sum(values), | ||
index = range(n), | ||
i, | ||
@@ -598,2 +633,553 @@ t, | ||
function define (constructor, factory, prototype) { | ||
constructor.prototype = factory.prototype = prototype; | ||
prototype.constructor = constructor; | ||
} | ||
function extend(parent, definition) { | ||
var prototype = Object.create(parent.prototype); | ||
for (var key in definition) prototype[key] = definition[key]; | ||
return prototype; | ||
} | ||
function Color() {} | ||
var darker = 0.7; | ||
var brighter = 1 / darker; | ||
var reI = "\\s*([+-]?\\d+)\\s*", | ||
reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", | ||
reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", | ||
reHex = /^#([0-9a-f]{3,8})$/, | ||
reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), | ||
reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), | ||
reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), | ||
reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), | ||
reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), | ||
reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); | ||
var named = { | ||
aliceblue: 0xf0f8ff, | ||
antiquewhite: 0xfaebd7, | ||
aqua: 0x00ffff, | ||
aquamarine: 0x7fffd4, | ||
azure: 0xf0ffff, | ||
beige: 0xf5f5dc, | ||
bisque: 0xffe4c4, | ||
black: 0x000000, | ||
blanchedalmond: 0xffebcd, | ||
blue: 0x0000ff, | ||
blueviolet: 0x8a2be2, | ||
brown: 0xa52a2a, | ||
burlywood: 0xdeb887, | ||
cadetblue: 0x5f9ea0, | ||
chartreuse: 0x7fff00, | ||
chocolate: 0xd2691e, | ||
coral: 0xff7f50, | ||
cornflowerblue: 0x6495ed, | ||
cornsilk: 0xfff8dc, | ||
crimson: 0xdc143c, | ||
cyan: 0x00ffff, | ||
darkblue: 0x00008b, | ||
darkcyan: 0x008b8b, | ||
darkgoldenrod: 0xb8860b, | ||
darkgray: 0xa9a9a9, | ||
darkgreen: 0x006400, | ||
darkgrey: 0xa9a9a9, | ||
darkkhaki: 0xbdb76b, | ||
darkmagenta: 0x8b008b, | ||
darkolivegreen: 0x556b2f, | ||
darkorange: 0xff8c00, | ||
darkorchid: 0x9932cc, | ||
darkred: 0x8b0000, | ||
darksalmon: 0xe9967a, | ||
darkseagreen: 0x8fbc8f, | ||
darkslateblue: 0x483d8b, | ||
darkslategray: 0x2f4f4f, | ||
darkslategrey: 0x2f4f4f, | ||
darkturquoise: 0x00ced1, | ||
darkviolet: 0x9400d3, | ||
deeppink: 0xff1493, | ||
deepskyblue: 0x00bfff, | ||
dimgray: 0x696969, | ||
dimgrey: 0x696969, | ||
dodgerblue: 0x1e90ff, | ||
firebrick: 0xb22222, | ||
floralwhite: 0xfffaf0, | ||
forestgreen: 0x228b22, | ||
fuchsia: 0xff00ff, | ||
gainsboro: 0xdcdcdc, | ||
ghostwhite: 0xf8f8ff, | ||
gold: 0xffd700, | ||
goldenrod: 0xdaa520, | ||
gray: 0x808080, | ||
green: 0x008000, | ||
greenyellow: 0xadff2f, | ||
grey: 0x808080, | ||
honeydew: 0xf0fff0, | ||
hotpink: 0xff69b4, | ||
indianred: 0xcd5c5c, | ||
indigo: 0x4b0082, | ||
ivory: 0xfffff0, | ||
khaki: 0xf0e68c, | ||
lavender: 0xe6e6fa, | ||
lavenderblush: 0xfff0f5, | ||
lawngreen: 0x7cfc00, | ||
lemonchiffon: 0xfffacd, | ||
lightblue: 0xadd8e6, | ||
lightcoral: 0xf08080, | ||
lightcyan: 0xe0ffff, | ||
lightgoldenrodyellow: 0xfafad2, | ||
lightgray: 0xd3d3d3, | ||
lightgreen: 0x90ee90, | ||
lightgrey: 0xd3d3d3, | ||
lightpink: 0xffb6c1, | ||
lightsalmon: 0xffa07a, | ||
lightseagreen: 0x20b2aa, | ||
lightskyblue: 0x87cefa, | ||
lightslategray: 0x778899, | ||
lightslategrey: 0x778899, | ||
lightsteelblue: 0xb0c4de, | ||
lightyellow: 0xffffe0, | ||
lime: 0x00ff00, | ||
limegreen: 0x32cd32, | ||
linen: 0xfaf0e6, | ||
magenta: 0xff00ff, | ||
maroon: 0x800000, | ||
mediumaquamarine: 0x66cdaa, | ||
mediumblue: 0x0000cd, | ||
mediumorchid: 0xba55d3, | ||
mediumpurple: 0x9370db, | ||
mediumseagreen: 0x3cb371, | ||
mediumslateblue: 0x7b68ee, | ||
mediumspringgreen: 0x00fa9a, | ||
mediumturquoise: 0x48d1cc, | ||
mediumvioletred: 0xc71585, | ||
midnightblue: 0x191970, | ||
mintcream: 0xf5fffa, | ||
mistyrose: 0xffe4e1, | ||
moccasin: 0xffe4b5, | ||
navajowhite: 0xffdead, | ||
navy: 0x000080, | ||
oldlace: 0xfdf5e6, | ||
olive: 0x808000, | ||
olivedrab: 0x6b8e23, | ||
orange: 0xffa500, | ||
orangered: 0xff4500, | ||
orchid: 0xda70d6, | ||
palegoldenrod: 0xeee8aa, | ||
palegreen: 0x98fb98, | ||
paleturquoise: 0xafeeee, | ||
palevioletred: 0xdb7093, | ||
papayawhip: 0xffefd5, | ||
peachpuff: 0xffdab9, | ||
peru: 0xcd853f, | ||
pink: 0xffc0cb, | ||
plum: 0xdda0dd, | ||
powderblue: 0xb0e0e6, | ||
purple: 0x800080, | ||
rebeccapurple: 0x663399, | ||
red: 0xff0000, | ||
rosybrown: 0xbc8f8f, | ||
royalblue: 0x4169e1, | ||
saddlebrown: 0x8b4513, | ||
salmon: 0xfa8072, | ||
sandybrown: 0xf4a460, | ||
seagreen: 0x2e8b57, | ||
seashell: 0xfff5ee, | ||
sienna: 0xa0522d, | ||
silver: 0xc0c0c0, | ||
skyblue: 0x87ceeb, | ||
slateblue: 0x6a5acd, | ||
slategray: 0x708090, | ||
slategrey: 0x708090, | ||
snow: 0xfffafa, | ||
springgreen: 0x00ff7f, | ||
steelblue: 0x4682b4, | ||
tan: 0xd2b48c, | ||
teal: 0x008080, | ||
thistle: 0xd8bfd8, | ||
tomato: 0xff6347, | ||
turquoise: 0x40e0d0, | ||
violet: 0xee82ee, | ||
wheat: 0xf5deb3, | ||
white: 0xffffff, | ||
whitesmoke: 0xf5f5f5, | ||
yellow: 0xffff00, | ||
yellowgreen: 0x9acd32 | ||
}; | ||
define(Color, color, { | ||
copy: function (channels) { | ||
return Object.assign(new this.constructor(), this, channels); | ||
}, | ||
displayable: function () { | ||
return this.rgb().displayable(); | ||
}, | ||
hex: color_formatHex, | ||
// Deprecated! Use color.formatHex. | ||
formatHex: color_formatHex, | ||
formatHsl: color_formatHsl, | ||
formatRgb: color_formatRgb, | ||
toString: color_formatRgb | ||
}); | ||
function color_formatHex() { | ||
return this.rgb().formatHex(); | ||
} | ||
function color_formatHsl() { | ||
return hslConvert(this).formatHsl(); | ||
} | ||
function color_formatRgb() { | ||
return this.rgb().formatRgb(); | ||
} | ||
function color(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 | ||
: l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 | ||
: null // invalid hex | ||
) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) | ||
: (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) | ||
: (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) | ||
: (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) | ||
: (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) | ||
: (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) | ||
: named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins | ||
: format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; | ||
} | ||
function rgbn(n) { | ||
return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); | ||
} | ||
function rgba(r, g, b, a) { | ||
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) return new Rgb(); | ||
o = o.rgb(); | ||
return new Rgb(o.r, o.g, o.b, o.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$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) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); | ||
}, | ||
rgb: function () { | ||
return this; | ||
}, | ||
displayable: function () { | ||
return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; | ||
}, | ||
hex: rgb_formatHex, | ||
// Deprecated! Use color.formatHex. | ||
formatHex: rgb_formatHex, | ||
formatRgb: rgb_formatRgb, | ||
toString: rgb_formatRgb | ||
})); | ||
function rgb_formatHex() { | ||
return "#" + hex(this.r) + hex(this.g) + hex(this.b); | ||
} | ||
function rgb_formatRgb() { | ||
var a = this.opacity; | ||
a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); | ||
return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")"); | ||
} | ||
function hex(value) { | ||
value = Math.max(0, Math.min(255, Math.round(value) || 0)); | ||
return (value < 16 ? "0" : "") + value.toString(16); | ||
} | ||
function hsla(h, s, l, a) { | ||
if (a <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = NaN; | ||
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) return new Hsl(); | ||
if (o instanceof Hsl) return o; | ||
o = o.rgb(); | ||
var r = o.r / 255, | ||
g = o.g / 255, | ||
b = o.b / 255, | ||
min = Math.min(r, g, b), | ||
max = Math.max(r, g, b), | ||
h = NaN, | ||
s = max - min, | ||
l = (max + min) / 2; | ||
if (s) { | ||
if (r === max) h = (g - b) / s + (g < b) * 6;else if (g === max) h = (b - r) / s + 2;else h = (r - g) / s + 4; | ||
s /= l < 0.5 ? max + min : 2 - max - min; | ||
h *= 60; | ||
} else { | ||
s = l > 0 && l < 1 ? 0 : h; | ||
} | ||
return new Hsl(h, s, l, o.opacity); | ||
} | ||
function hsl(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(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) { | ||
k = k == null ? darker : Math.pow(darker, k); | ||
return new Hsl(this.h, this.s, this.l * k, this.opacity); | ||
}, | ||
rgb: function () { | ||
var h = this.h % 360 + (this.h < 0) * 360, | ||
s = isNaN(h) || isNaN(this.s) ? 0 : this.s, | ||
l = this.l, | ||
m2 = l + (l < 0.5 ? l : 1 - l) * s, | ||
m1 = 2 * l - m2; | ||
return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); | ||
}, | ||
displayable: function () { | ||
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; | ||
}, | ||
formatHsl: function () { | ||
var a = this.opacity; | ||
a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); | ||
return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")"); | ||
} | ||
})); | ||
/* From FvD 13.37, CSS Color Module Level 3 */ | ||
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; | ||
} | ||
var constant = (x => () => x); | ||
function linear(a, d) { | ||
return function (t) { | ||
return a + t * d; | ||
}; | ||
} | ||
function exponential(a, b, y) { | ||
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 gamma(y) { | ||
return (y = +y) === 1 ? nogamma : function (a, b) { | ||
return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); | ||
}; | ||
} | ||
function nogamma(a, b) { | ||
var d = b - a; | ||
return d ? linear(a, d) : constant(isNaN(a) ? b : a); | ||
} | ||
var rgb = (function rgbGamma(y) { | ||
var color = gamma(y); | ||
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); | ||
start.g = g(t); | ||
start.b = b(t); | ||
start.opacity = opacity(t); | ||
return start + ""; | ||
}; | ||
} | ||
rgb.gamma = rgbGamma; | ||
return rgb; | ||
})(1); | ||
function numberArray (a, b) { | ||
if (!b) b = []; | ||
var n = a ? Math.min(b.length, a.length) : 0, | ||
c = b.slice(), | ||
i; | ||
return function (t) { | ||
for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; | ||
return c; | ||
}; | ||
} | ||
function isNumberArray(x) { | ||
return ArrayBuffer.isView(x) && !(x instanceof DataView); | ||
} | ||
function genericArray(a, b) { | ||
var nb = b ? b.length : 0, | ||
na = a ? Math.min(nb, a.length) : 0, | ||
x = new Array(na), | ||
c = new Array(nb), | ||
i; | ||
for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]); | ||
for (; i < nb; ++i) c[i] = b[i]; | ||
return function (t) { | ||
for (i = 0; i < na; ++i) c[i] = x[i](t); | ||
return c; | ||
}; | ||
} | ||
function date (a, b) { | ||
var d = new Date(); | ||
return a = +a, b = +b, function (t) { | ||
return d.setTime(a * (1 - t) + b * t), d; | ||
}; | ||
} | ||
function number (a, b) { | ||
return a = +a, b = +b, function (t) { | ||
return a * (1 - t) + b * t; | ||
}; | ||
} | ||
function object (a, b) { | ||
var i = {}, | ||
c = {}, | ||
k; | ||
if (a === null || typeof a !== "object") a = {}; | ||
if (b === null || typeof b !== "object") b = {}; | ||
for (k in b) { | ||
if (k in a) { | ||
i[k] = interpolate(a[k], b[k]); | ||
} else { | ||
c[k] = b[k]; | ||
} | ||
} | ||
return function (t) { | ||
for (k in i) c[k] = i[k](t); | ||
return c; | ||
}; | ||
} | ||
var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, | ||
reB = new RegExp(reA.source, "g"); | ||
function zero(b) { | ||
return function () { | ||
return b; | ||
}; | ||
} | ||
function one(b) { | ||
return function (t) { | ||
return b(t) + ""; | ||
}; | ||
} | ||
function string (a, b) { | ||
var bi = reA.lastIndex = reB.lastIndex = 0, | ||
// scan index for next number in b | ||
am, | ||
// current match in a | ||
bm, | ||
// current match in b | ||
bs, | ||
// string preceding current number in b, if any | ||
i = -1, | ||
// index in s | ||
s = [], | ||
// string constants and placeholders | ||
q = []; // number interpolators | ||
// Coerce inputs to strings. | ||
a = a + "", b = b + ""; // Interpolate pairs of numbers in a & b. | ||
while ((am = reA.exec(a)) && (bm = reB.exec(b))) { | ||
if ((bs = bm.index) > bi) { | ||
// a string precedes the next number in b | ||
bs = b.slice(bi, bs); | ||
if (s[i]) s[i] += bs; // coalesce with previous string | ||
else s[++i] = bs; | ||
} | ||
if ((am = am[0]) === (bm = bm[0])) { | ||
// numbers in a & b match | ||
if (s[i]) s[i] += bm; // coalesce with previous string | ||
else s[++i] = bm; | ||
} else { | ||
// interpolate non-matching numbers | ||
s[++i] = null; | ||
q.push({ | ||
i: i, | ||
x: number(am, bm) | ||
}); | ||
} | ||
bi = reB.lastIndex; | ||
} // Add remains of b. | ||
if (bi < b.length) { | ||
bs = b.slice(bi); | ||
if (s[i]) s[i] += bs; // coalesce with previous string | ||
else s[++i] = bs; | ||
} // Special optimization for only a single match. | ||
// Otherwise, interpolate each of the numbers and rejoin the string. | ||
return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function (t) { | ||
for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); | ||
return s.join(""); | ||
}); | ||
} | ||
function interpolate (a, b) { | ||
var t = typeof b, | ||
c; | ||
return b == null || t === "boolean" ? constant(b) : (t === "number" ? number : t === "string" ? (c = color(b)) ? (b = c, rgb) : string : b instanceof color ? rgb : b instanceof Date ? date : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object : number)(a, b); | ||
} | ||
function interpolateRound (a, b) { | ||
return a = +a, b = +b, function (t) { | ||
return Math.round(a * (1 - t) + b * t); | ||
}; | ||
} | ||
const DEFAULT_COUNT = 5; | ||
@@ -763,3 +1349,3 @@ | ||
if (stop > hi) stop = step * Math.floor(hi / step); | ||
bins = d3Array.range(start, stop + step / 2, step); | ||
bins = range(start, stop + step / 2, step); | ||
} | ||
@@ -800,12 +1386,12 @@ | ||
else if (_.scheme) { | ||
range = configureScheme(type, _, count); | ||
range = configureScheme(type, _, count); | ||
if (vegaUtil.isFunction(range)) { | ||
if (scale.interpolator) { | ||
return scale.interpolator(range); | ||
} else { | ||
vegaUtil.error(`Scale type ${type} does not support interpolating color schemes.`); | ||
} | ||
if (vegaUtil.isFunction(range)) { | ||
if (scale.interpolator) { | ||
return scale.interpolator(range); | ||
} else { | ||
vegaUtil.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 | ||
@@ -823,3 +1409,3 @@ | ||
} else if (vegaUtil.isFunction(scale.rangeRound)) { | ||
scale.interpolate(round ? d3Interpolate.interpolateRound : d3Interpolate.interpolate); | ||
scale.interpolate(round ? interpolateRound : interpolate); | ||
} | ||
@@ -1068,2 +1654,2 @@ | ||
}))); | ||
})); |
@@ -1,2 +0,2 @@ | ||
var vega=function(e,t,n,r){"use strict";function a(e){t.Transform.call(this,null,e)}function i(e){t.Transform.call(this,null,e)}function o(){return t.ingest({})}function l(e){t.Transform.call(this,null,e)}function s(e){t.Transform.call(this,[],e)}r.inherits(a,t.Transform,{transform(e,r){if(this.value&&!e.modified())return r.StopPropagation;var a=r.dataflow.locale(),i=r.fork(r.NO_SOURCE|r.NO_FIELDS),o=this.value,l=e.scale,s=null==e.count?e.values?e.values.length:10:e.count,u=n.tickCount(l,s,e.minstep),c=e.format||n.tickFormat(a,l,u,e.formatSpecifier,e.formatType,!!e.values),d=e.values?n.validTicks(l,e.values,u):n.tickValues(l,u);return o&&(i.rem=o),o=d.map((e,n)=>t.ingest({index:n/(d.length-1||1),value:e,label:c(e)})),e.extra&&o.length&&o.push(t.ingest({index:-1,extra:{value:o[0].value},label:""})),i.source=o,i.add=o,this.value=o,i}}),r.inherits(i,t.Transform,{transform(e,n){var a=n.dataflow,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),l=e.item||o,s=e.key||t.tupleid,u=this.value;return r.isArray(i.encode)&&(i.encode=null),u&&(e.modified("key")||n.modified(s))&&r.error("DataJoin does not support modified key function or fields."),u||(n=n.addAll(),this.value=u=function(e){const t=r.fastmap().test(e=>e.exit);return t.lookup=n=>t.get(e(n)),t}(s)),n.visit(n.ADD,e=>{const t=s(e);let n=u.get(t);n?n.exit?(u.empty--,i.add.push(n)):i.mod.push(n):(n=l(e),u.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1}),n.visit(n.MOD,e=>{const t=s(e),n=u.get(t);n&&(n.datum=e,i.mod.push(n))}),n.visit(n.REM,e=>{const t=s(e),n=u.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++u.empty)}),n.changed(n.ADD_MOD)&&i.modifies("datum"),(n.clean()||e.clean&&u.empty>a.cleanThreshold)&&a.runAfter(u.clean),i}}),r.inherits(l,t.Transform,{transform(e,t){var n=t.fork(t.ADD_REM),a=e.mod||!1,i=e.encoders,o=t.encode;if(r.isArray(o)){if(!n.changed()&&!o.every(e=>i[e]))return t.StopPropagation;o=o[0],n.encode=null}var l="enter"===o,s=i.update||r.falsy,u=i.enter||r.falsy,c=i.exit||r.falsy,d=(o&&!l?i[o]:s)||r.falsy;if(t.changed(t.ADD)&&(t.visit(t.ADD,t=>{u(t,e),s(t,e)}),n.modifies(u.output),n.modifies(s.output),d!==r.falsy&&d!==s&&(t.visit(t.ADD,t=>{d(t,e)}),n.modifies(d.output))),t.changed(t.REM)&&c!==r.falsy&&(t.visit(t.REM,t=>{c(t,e)}),n.modifies(c.output)),l||d!==r.falsy){const r=t.MOD|(e.modified()?t.REFLOW:0);l?(t.visit(r,t=>{const r=u(t,e)||a;(d(t,e)||r)&&n.mod.push(t)}),n.mod.length&&n.modifies(u.output)):t.visit(r,t=>{(d(t,e)||a)&&n.mod.push(t)}),n.mod.length&&n.modifies(d.output)}return n.changed()?n:t.StopPropagation}}),r.inherits(s,t.Transform,{transform(e,a){if(null!=this.value&&!e.modified())return a.StopPropagation;var i,o,l,s,u,c=a.dataflow.locale(),d=a.fork(a.NO_SOURCE|a.NO_FIELDS),h=this.value,f=e.type||n.SymbolLegend,m=e.scale,g=+e.limit,p=n.tickCount(m,null==e.count?5:e.count,e.minstep),y=!!e.values||f===n.SymbolLegend,v=e.format||n.labelFormat(c,m,p,f,e.formatSpecifier,e.formatType,y),b=e.values||n.labelValues(m,p);return h&&(d.rem=h),f===n.SymbolLegend?(g&&b.length>g?(a.dataflow.warn("Symbol legend count exceeds limit, filtering items."),h=b.slice(0,g-1),u=!0):h=b,r.isFunction(l=e.size)?(e.values||0!==m(h[0])||(h=h.slice(1)),s=h.reduce((t,n)=>Math.max(t,l(n,e)),0)):l=r.constant(s=l||8),h=h.map((n,r)=>t.ingest({index:r,label:v(n,r,h),value:n,offset:s,size:l(n,e)})),u&&(u=b[h.length],h.push(t.ingest({index:h.length,label:"…".concat(b.length-h.length," entries"),value:u,offset:s,size:l(u,e)})))):f===n.GradientLegend?(i=m.domain(),o=n.scaleFraction(m,i[0],r.peek(i)),b.length<3&&!e.values&&i[0]!==r.peek(i)&&(b=[i[0],r.peek(i)]),h=b.map((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:o(e)}))):(l=b.length-1,o=n.labelFraction(m),h=b.map((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:n?o(e):0,perc2:n===l?1:o(b[n+1])}))),d.source=h,d.add=h,this.value=h,d}});const u=e=>e.source.x,c=e=>e.source.y,d=e=>e.target.x,h=e=>e.target.y;function f(e){t.Transform.call(this,{},e)}f.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},r.inherits(f,t.Transform,{transform(e,t){var n=e.sourceX||u,a=e.sourceY||c,i=e.targetX||d,o=e.targetY||h,l=e.as||"path",s=e.orient||"vertical",f=e.shape||"line",m=y.get(f+"-"+s)||y.get(f);return m||r.error("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,e=>{e[l]=m(n(e),a(e),i(e),o(e))}),t.reflow(e.modified()).modifies(l)}});const m=(e,t,n,r)=>"M"+e+","+t+"L"+n+","+r,g=(e,t,n,r)=>{var a=n-e,i=r-t,o=Math.sqrt(a*a+i*i)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(i,a)/Math.PI+" 0 1 "+n+","+r},p=(e,t,n,r)=>{const a=n-e,i=r-t,o=.2*(a+i),l=.2*(i-a);return"M"+e+","+t+"C"+(e+o)+","+(t+l)+" "+(n+l)+","+(r-o)+" "+n+","+r},y=r.fastmap({line:m,"line-radial":(e,t,n,r)=>m(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),arc:g,"arc-radial":(e,t,n,r)=>g(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),curve:p,"curve-radial":(e,t,n,r)=>p(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(e,t,n,r)=>"M"+e+","+t+"V"+r+"H"+n,"orthogonal-vertical":(e,t,n,r)=>"M"+e+","+t+"H"+n+"V"+r,"orthogonal-radial":(e,t,n,r)=>{const a=Math.cos(e),i=Math.sin(e),o=Math.cos(n),l=Math.sin(n);return"M"+t*a+","+t*i+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*l+"L"+r*o+","+r*l},"diagonal-horizontal":(e,t,n,r)=>{const a=(e+n)/2;return"M"+e+","+t+"C"+a+","+t+" "+a+","+r+" "+n+","+r},"diagonal-vertical":(e,t,n,r)=>{const a=(t+r)/2;return"M"+e+","+t+"C"+e+","+a+" "+n+","+a+" "+n+","+r},"diagonal-radial":(e,t,n,r)=>{const a=Math.cos(e),i=Math.sin(e),o=Math.cos(n),l=Math.sin(n),s=(t+r)/2;return"M"+t*a+","+t*i+"C"+s*a+","+s*i+" "+s*o+","+s*l+" "+r*o+","+r*l}});function v(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((t-e)/n)),i=new Array(a);++r<a;)i[r]=e+r*n;return i}function b(e){t.Transform.call(this,null,e)}function M(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function w(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function x(){}b.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},r.inherits(b,t.Transform,{transform(e,t){var n,a,i,o=e.as||["startAngle","endAngle"],l=o[0],s=o[1],u=e.field||r.one,c=e.startAngle||0,d=null!=e.endAngle?e.endAngle:2*Math.PI,h=t.source,f=h.map(u),m=f.length,g=c,p=(d-c)/function(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let a of e)(a=+t(a,++r,e))&&(n+=a)}return n}(f),y=v(m);for(e.sort&&y.sort((e,t)=>f[e]-f[t]),n=0;n<m;++n)i=f[y[n]],(a=h[y[n]])[l]=g,a[s]=g+=i*p;return this.value=f,t.reflow(e.modified()).modifies(o)}});var k=.7,S=1/k,N="\\s*([+-]?\\d+)\\s*",D="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",A="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",O=/^#([0-9a-f]{3,8})$/,E=new RegExp("^rgb\\("+[N,N,N]+"\\)$"),T=new RegExp("^rgb\\("+[A,A,A]+"\\)$"),R=new RegExp("^rgba\\("+[N,N,N,D]+"\\)$"),C=new RegExp("^rgba\\("+[A,A,A,D]+"\\)$"),L=new RegExp("^hsl\\("+[D,A,A]+"\\)$"),z=new RegExp("^hsla\\("+[D,A,A,D]+"\\)$"),I={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function q(){return this.rgb().formatHex()}function P(){return this.rgb().formatRgb()}function F(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=O.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?_(t):3===n?new V(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?H(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?H(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=E.exec(e))?new V(t[1],t[2],t[3],1):(t=T.exec(e))?new V(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=R.exec(e))?H(t[1],t[2],t[3],t[4]):(t=C.exec(e))?H(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=L.exec(e))?X(t[1],t[2]/100,t[3]/100,1):(t=z.exec(e))?X(t[1],t[2]/100,t[3]/100,t[4]):I.hasOwnProperty(e)?_(I[e]):"transparent"===e?new V(NaN,NaN,NaN,0):null}function _(e){return new V(e>>16&255,e>>8&255,255&e,1)}function H(e,t,n,r){return r<=0&&(e=t=n=NaN),new V(e,t,n,r)}function U(e){return e instanceof x||(e=F(e)),e?new V((e=e.rgb()).r,e.g,e.b,e.opacity):new V}function j(e,t,n,r){return 1===arguments.length?U(e):new V(e,t,n,null==r?1:r)}function V(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function $(){return"#"+B(this.r)+B(this.g)+B(this.b)}function G(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function B(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function X(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Q(e,t,n,r)}function Y(e){if(e instanceof Q)return new Q(e.h,e.s,e.l,e.opacity);if(e instanceof x||(e=F(e)),!e)return new Q;if(e instanceof Q)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-a,s=(i+a)/2;return l?(o=t===i?(n-r)/l+6*(n<r):n===i?(r-t)/l+2:(t-n)/l+4,l/=s<.5?i+a:2-i-a,o*=60):l=s>0&&s<1?0:o,new Q(o,l,s,e.opacity)}function Q(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function J(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}M(x,F,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:q,formatHex:q,formatHsl:function(){return Y(this).formatHsl()},formatRgb:P,toString:P}),M(V,j,w(x,{brighter:function(e){return e=null==e?S:Math.pow(S,e),new V(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?k:Math.pow(k,e),new V(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:$,formatHex:$,formatRgb:G,toString:G})),M(Q,(function(e,t,n,r){return 1===arguments.length?Y(e):new Q(e,t,n,null==r?1:r)}),w(x,{brighter:function(e){return e=null==e?S:Math.pow(S,e),new Q(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?k:Math.pow(k,e),new Q(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new V(J(e>=240?e-240:e+120,a,r),J(e,a,r),J(e<120?e+240:e-120,a,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var W=e=>()=>e;function K(e){return 1==(e=+e)?Z:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):W(isNaN(t)?n:t)}}function Z(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):W(isNaN(e)?t:e)}var ee=function e(t){var n=K(t);function r(e,t){var r=n((e=j(e)).r,(t=j(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),o=Z(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=i(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function te(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,a=t.slice();return function(i){for(n=0;n<r;++n)a[n]=e[n]*(1-i)+t[n]*i;return a}}function ne(e,t){var n,r=t?t.length:0,a=e?Math.min(r,e.length):0,i=new Array(a),o=new Array(r);for(n=0;n<a;++n)i[n]=ue(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<a;++n)o[n]=i[n](e);return o}}function re(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ae(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ie(e,t){var n,r={},a={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=ue(e[n],t[n]):a[n]=t[n];return function(e){for(n in r)a[n]=r[n](e);return a}}var oe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,le=new RegExp(oe.source,"g");function se(e,t){var n,r,a,i=oe.lastIndex=le.lastIndex=0,o=-1,l=[],s=[];for(e+="",t+="";(n=oe.exec(e))&&(r=le.exec(t));)(a=r.index)>i&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(n=n[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,s.push({i:o,x:ae(n,r)})),i=le.lastIndex;return i<t.length&&(a=t.slice(i),l[o]?l[o]+=a:l[++o]=a),l.length<2?s[0]?function(e){return function(t){return e(t)+""}}(s[0].x):function(e){return function(){return e}}(t):(t=s.length,function(e){for(var n,r=0;r<t;++r)l[(n=s[r]).i]=n.x(e);return l.join("")})}function ue(e,t){var n,r,a=typeof t;return null==t||"boolean"===a?W(t):("number"===a?ae:"string"===a?(n=F(t))?(t=n,ee):se:t instanceof F?ee:t instanceof Date?re:(r=t,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(t)?ne:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?ie:ae:te))(e,t)}function ce(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function de(e){return n.isContinuous(e)&&e!==n.Sequential}const he=r.toSet(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function fe(e){t.Transform.call(this,null,e),this.modified(!0)}function me(e,t,a){n.isLogarithmic(e)&&(Math.abs(t.reduce((e,t)=>e+(t<0?-1:t>0?1:0),0))!==t.length&&a.warn("Log scale domain includes zero: "+r.stringValue(t)));return t}function ge(e,t,a){return r.isFunction(e)&&(t||a)?n.interpolateRange(e,pe(t||[0,1],a)):e}function pe(e,t){return t?e.slice().reverse():e}function ye(e){t.Transform.call(this,null,e)}r.inherits(fe,t.Transform,{transform(e,t){var a=t.dataflow,i=this.value,o=function(e){var t,a=e.type,i="";if(a===n.Sequential)return n.Sequential+"-"+n.Linear;(function(e){const t=e.type;return n.isContinuous(t)&&t!==n.Time&&t!==n.UTC&&(e.scheme||e.range&&e.range.length&&e.range.every(r.isString))})(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?n.Sequential+"-":3===t?n.Diverging+"-":"");return(i+a||n.Linear).toLowerCase()}(e);for(o in i&&o===i.type||(this.value=i=n.scale(o)()),e)if(!he[o]){if("padding"===o&&de(i.type))continue;r.isFunction(i[o])?i[o](e[o]):a.warn("Unsupported scale property: "+o)}return function(e,t,a){var i=e.type,o=t.round||!1,l=t.range;if(null!=t.rangeStep)l=function(e,t,a){e!==n.Band&&e!==n.Point&&r.error("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,o=e===n.Point?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*n.bandSpace(a,o,i)]}(i,t,a);else if(t.scheme&&(l=function(e,t,a){var i,o,l=t.schemeExtent;r.isArray(t.scheme)?o=n.interpolateColors(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),(o=n.scheme(i))||r.error("Unrecognized scheme name: ".concat(t.scheme)));return a=e===n.Threshold?a+1:e===n.BinOrdinal?a-1:e===n.Quantile||e===n.Quantize?+t.schemeCount||5:a,n.isInterpolating(e)?ge(o,l,t.reverse):r.isFunction(o)?n.quantizeInterpolator(ge(o,l),a):e===n.Ordinal?o:o.slice(0,a)}(i,t,a),r.isFunction(l))){if(e.interpolator)return e.interpolator(l);r.error("Scale type ".concat(i," does not support interpolating color schemes."))}if(l&&n.isInterpolating(i))return e.interpolator(n.interpolateColors(pe(l,t.reverse),t.interpolate,t.interpolateGamma));l&&t.interpolate&&e.interpolate?e.interpolate(n.interpolate(t.interpolate,t.interpolateGamma)):r.isFunction(e.round)?e.round(o):r.isFunction(e.rangeRound)&&e.interpolate(o?ce:ue);l&&e.range(pe(l,t.reverse))}(i,e,function(e,t,a){let i=t.bins;if(i&&!r.isArray(i)){const t=e.domain(),n=t[0],a=r.peek(t),o=i.step;let l=null==i.start?n:i.start,s=null==i.stop?a:i.stop;o||r.error("Scale bins parameter missing step property."),l<n&&(l=o*Math.ceil(n/o)),s>a&&(s=o*Math.floor(a/o)),i=v(l,s+o/2,o)}i?e.bins=i:e.bins&&delete e.bins;e.type===n.BinOrdinal&&(i?t.domain||t.domainRaw||(e.domain(i),a=i.length):e.bins=e.domain());return a}(i,e,function(e,t,a){const i=function(e,t,n){return t?(e.domain(me(e.type,t,n)),t.length):-1}(e,t.domainRaw,a);if(i>-1)return i;var o,l,s=t.domain,u=e.type,c=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===n.Linear||t===n.Pow||t===n.Sqrt)}(e);if(!s)return 0;de(u)&&t.padding&&s[0]!==r.peek(s)&&(s=function(e,t,a,i,o,l){var s=Math.abs(r.peek(a)-a[0]),u=s/(s-2*i),c=e===n.Log?r.zoomLog(t,null,u):e===n.Sqrt?r.zoomPow(t,null,u,.5):e===n.Pow?r.zoomPow(t,null,u,o||1):e===n.Symlog?r.zoomSymlog(t,null,u,l||1):r.zoomLinear(t,null,u);return(t=t.slice())[0]=c[0],t[t.length-1]=c[1],t}(u,s,t.range,t.padding,t.exponent,t.constant));if((c||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(o=(s=s.slice()).length-1||1,c&&(s[0]>0&&(s[0]=0),s[o]<0&&(s[o]=0)),null!=t.domainMin&&(s[0]=t.domainMin),null!=t.domainMax&&(s[o]=t.domainMax),null!=t.domainMid)){const e=(l=t.domainMid)>s[o]?o+1:l<s[0]?0:o;e!==o&&a.warn("Scale domainMid exceeds domain min or max.",l),s.splice(e,0,l)}e.domain(me(u,s,a)),u===n.Ordinal&&e.unknown(t.domainImplicit?n.scaleImplicit:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&n.tickCount(e,t.nice)||null);return s.length}(i,e,a))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),r.inherits(ye,t.Transform,{transform(e,n){const r=e.modified("sort")||n.changed(n.ADD)||n.modified(e.sort.fields)||n.modified("datum");return r&&n.source.sort(t.stableCompare(e.sort)),this.modified(r),n}});const ve="zero",be="center",Me="normalize",we=["y0","y1"];function xe(e){t.Transform.call(this,null,e)}function ke(e,t,n,r,a){for(var i,o=(t-e.sum)/2,l=e.length,s=0;s<l;++s)(i=e[s])[r]=o,i[a]=o+=Math.abs(n(i))}function Se(e,t,n,r,a){for(var i,o=1/e.sum,l=0,s=e.length,u=0,c=0;u<s;++u)(i=e[u])[r]=l,i[a]=l=o*(c+=Math.abs(n(i)))}function Ne(e,t,n,r,a){for(var i,o,l=0,s=0,u=e.length,c=0;c<u;++c)(i=+n(o=e[c]))<0?(o[r]=s,o[a]=s+=i):(o[r]=l,o[a]=l+=i)}return xe.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:ve,values:[ve,be,Me]},{name:"as",type:"string",array:!0,length:2,default:we}]},r.inherits(xe,t.Transform,{transform(e,n){var a,i,o,l,s=e.as||we,u=s[0],c=s[1],d=t.stableCompare(e.sort),h=e.field||r.one,f=e.offset===be?ke:e.offset===Me?Se:Ne;for(a=function(e,t,n,r){var a,i,o,l,s,u,c,d,h,f=[],m=e=>e(s);if(null==t)f.push(e.slice());else for(a={},i=0,o=e.length;i<o;++i)s=e[i],(c=a[u=t.map(m)])||(a[u]=c=[],f.push(c)),c.push(s);for(u=0,h=0,l=f.length;u<l;++u){for(i=0,d=0,o=(c=f[u]).length;i<o;++i)d+=Math.abs(r(c[i]));c.sum=d,d>h&&(h=d),n&&c.sort(n)}return f.max=h,f}(n.source,e.groupby,d,h),i=0,o=a.length,l=a.max;i<o;++i)f(a[i],l,h,u,c);return n.reflow(e.modified()).modifies(s)}}),e.axisticks=a,e.datajoin=i,e.encode=l,e.legendentries=s,e.linkpath=f,e.pie=b,e.scale=fe,e.sortitems=ye,e.stack=xe,e}({},vega,vega,vega); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-dataflow"),require("vega-scale"),require("vega-util")):"function"==typeof define&&define.amd?define(["exports","vega-dataflow","vega-scale","vega-util"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega,e.vega)}(this,(function(e,t,n,r){"use strict";function a(e){t.Transform.call(this,null,e)}function i(e){t.Transform.call(this,null,e)}function o(){return t.ingest({})}function l(e){t.Transform.call(this,null,e)}function s(e){t.Transform.call(this,[],e)}r.inherits(a,t.Transform,{transform(e,r){if(this.value&&!e.modified())return r.StopPropagation;var a=r.dataflow.locale(),i=r.fork(r.NO_SOURCE|r.NO_FIELDS),o=this.value,l=e.scale,s=null==e.count?e.values?e.values.length:10:e.count,u=n.tickCount(l,s,e.minstep),c=e.format||n.tickFormat(a,l,u,e.formatSpecifier,e.formatType,!!e.values),d=e.values?n.validTicks(l,e.values,u):n.tickValues(l,u);return o&&(i.rem=o),o=d.map(((e,n)=>t.ingest({index:n/(d.length-1||1),value:e,label:c(e)}))),e.extra&&o.length&&o.push(t.ingest({index:-1,extra:{value:o[0].value},label:""})),i.source=o,i.add=o,this.value=o,i}}),r.inherits(i,t.Transform,{transform(e,n){var a=n.dataflow,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),l=e.item||o,s=e.key||t.tupleid,u=this.value;return r.isArray(i.encode)&&(i.encode=null),u&&(e.modified("key")||n.modified(s))&&r.error("DataJoin does not support modified key function or fields."),u||(n=n.addAll(),this.value=u=function(e){const t=r.fastmap().test((e=>e.exit));return t.lookup=n=>t.get(e(n)),t}(s)),n.visit(n.ADD,(e=>{const t=s(e);let n=u.get(t);n?n.exit?(u.empty--,i.add.push(n)):i.mod.push(n):(n=l(e),u.set(t,n),i.add.push(n)),n.datum=e,n.exit=!1})),n.visit(n.MOD,(e=>{const t=s(e),n=u.get(t);n&&(n.datum=e,i.mod.push(n))})),n.visit(n.REM,(e=>{const t=s(e),n=u.get(t);e!==n.datum||n.exit||(i.rem.push(n),n.exit=!0,++u.empty)})),n.changed(n.ADD_MOD)&&i.modifies("datum"),(n.clean()||e.clean&&u.empty>a.cleanThreshold)&&a.runAfter(u.clean),i}}),r.inherits(l,t.Transform,{transform(e,t){var n=t.fork(t.ADD_REM),a=e.mod||!1,i=e.encoders,o=t.encode;if(r.isArray(o)){if(!n.changed()&&!o.every((e=>i[e])))return t.StopPropagation;o=o[0],n.encode=null}var l="enter"===o,s=i.update||r.falsy,u=i.enter||r.falsy,c=i.exit||r.falsy,d=(o&&!l?i[o]:s)||r.falsy;if(t.changed(t.ADD)&&(t.visit(t.ADD,(t=>{u(t,e),s(t,e)})),n.modifies(u.output),n.modifies(s.output),d!==r.falsy&&d!==s&&(t.visit(t.ADD,(t=>{d(t,e)})),n.modifies(d.output))),t.changed(t.REM)&&c!==r.falsy&&(t.visit(t.REM,(t=>{c(t,e)})),n.modifies(c.output)),l||d!==r.falsy){const r=t.MOD|(e.modified()?t.REFLOW:0);l?(t.visit(r,(t=>{const r=u(t,e)||a;(d(t,e)||r)&&n.mod.push(t)})),n.mod.length&&n.modifies(u.output)):t.visit(r,(t=>{(d(t,e)||a)&&n.mod.push(t)})),n.mod.length&&n.modifies(d.output)}return n.changed()?n:t.StopPropagation}}),r.inherits(s,t.Transform,{transform(e,a){if(null!=this.value&&!e.modified())return a.StopPropagation;var i,o,l,s,u,c=a.dataflow.locale(),d=a.fork(a.NO_SOURCE|a.NO_FIELDS),f=this.value,h=e.type||n.SymbolLegend,m=e.scale,g=+e.limit,p=n.tickCount(m,null==e.count?5:e.count,e.minstep),y=!!e.values||h===n.SymbolLegend,v=e.format||n.labelFormat(c,m,p,h,e.formatSpecifier,e.formatType,y),b=e.values||n.labelValues(m,p);return f&&(d.rem=f),h===n.SymbolLegend?(g&&b.length>g?(a.dataflow.warn("Symbol legend count exceeds limit, filtering items."),f=b.slice(0,g-1),u=!0):f=b,r.isFunction(l=e.size)?(e.values||0!==m(f[0])||(f=f.slice(1)),s=f.reduce(((t,n)=>Math.max(t,l(n,e))),0)):l=r.constant(s=l||8),f=f.map(((n,r)=>t.ingest({index:r,label:v(n,r,f),value:n,offset:s,size:l(n,e)}))),u&&(u=b[f.length],f.push(t.ingest({index:f.length,label:"…".concat(b.length-f.length," entries"),value:u,offset:s,size:l(u,e)})))):h===n.GradientLegend?(i=m.domain(),o=n.scaleFraction(m,i[0],r.peek(i)),b.length<3&&!e.values&&i[0]!==r.peek(i)&&(b=[i[0],r.peek(i)]),f=b.map(((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:o(e)})))):(l=b.length-1,o=n.labelFraction(m),f=b.map(((e,n)=>t.ingest({index:n,label:v(e,n,b),value:e,perc:n?o(e):0,perc2:n===l?1:o(b[n+1])})))),d.source=f,d.add=f,this.value=f,d}});const u=e=>e.source.x,c=e=>e.source.y,d=e=>e.target.x,f=e=>e.target.y;function h(e){t.Transform.call(this,{},e)}h.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},r.inherits(h,t.Transform,{transform(e,t){var n=e.sourceX||u,a=e.sourceY||c,i=e.targetX||d,o=e.targetY||f,l=e.as||"path",s=e.orient||"vertical",h=e.shape||"line",m=y.get(h+"-"+s)||y.get(h);return m||r.error("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,(e=>{e[l]=m(n(e),a(e),i(e),o(e))})),t.reflow(e.modified()).modifies(l)}});const m=(e,t,n,r)=>"M"+e+","+t+"L"+n+","+r,g=(e,t,n,r)=>{var a=n-e,i=r-t,o=Math.sqrt(a*a+i*i)/2;return"M"+e+","+t+"A"+o+","+o+" "+180*Math.atan2(i,a)/Math.PI+" 0 1 "+n+","+r},p=(e,t,n,r)=>{const a=n-e,i=r-t,o=.2*(a+i),l=.2*(i-a);return"M"+e+","+t+"C"+(e+o)+","+(t+l)+" "+(n+l)+","+(r-o)+" "+n+","+r},y=r.fastmap({line:m,"line-radial":(e,t,n,r)=>m(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),arc:g,"arc-radial":(e,t,n,r)=>g(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),curve:p,"curve-radial":(e,t,n,r)=>p(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(e,t,n,r)=>"M"+e+","+t+"V"+r+"H"+n,"orthogonal-vertical":(e,t,n,r)=>"M"+e+","+t+"H"+n+"V"+r,"orthogonal-radial":(e,t,n,r)=>{const a=Math.cos(e),i=Math.sin(e),o=Math.cos(n),l=Math.sin(n);return"M"+t*a+","+t*i+"A"+t+","+t+" 0 0,"+((Math.abs(n-e)>Math.PI?n<=e:n>e)?1:0)+" "+t*o+","+t*l+"L"+r*o+","+r*l},"diagonal-horizontal":(e,t,n,r)=>{const a=(e+n)/2;return"M"+e+","+t+"C"+a+","+t+" "+a+","+r+" "+n+","+r},"diagonal-vertical":(e,t,n,r)=>{const a=(t+r)/2;return"M"+e+","+t+"C"+e+","+a+" "+n+","+a+" "+n+","+r},"diagonal-radial":(e,t,n,r)=>{const a=Math.cos(e),i=Math.sin(e),o=Math.cos(n),l=Math.sin(n),s=(t+r)/2;return"M"+t*a+","+t*i+"C"+s*a+","+s*i+" "+s*o+","+s*l+" "+r*o+","+r*l}});function v(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((t-e)/n)),i=new Array(a);++r<a;)i[r]=e+r*n;return i}function b(e){t.Transform.call(this,null,e)}function M(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function w(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function x(){}b.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},r.inherits(b,t.Transform,{transform(e,t){var n,a,i,o=e.as||["startAngle","endAngle"],l=o[0],s=o[1],u=e.field||r.one,c=e.startAngle||0,d=null!=e.endAngle?e.endAngle:2*Math.PI,f=t.source,h=f.map(u),m=h.length,g=c,p=(d-c)/function(e,t){let n=0;if(void 0===t)for(let t of e)(t=+t)&&(n+=t);else{let r=-1;for(let a of e)(a=+t(a,++r,e))&&(n+=a)}return n}(h),y=v(m);for(e.sort&&y.sort(((e,t)=>h[e]-h[t])),n=0;n<m;++n)i=h[y[n]],(a=f[y[n]])[l]=g,a[s]=g+=i*p;return this.value=h,t.reflow(e.modified()).modifies(o)}});var k=.7,S=1/k,N="\\s*([+-]?\\d+)\\s*",D="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",A="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",O=/^#([0-9a-f]{3,8})$/,T=new RegExp("^rgb\\("+[N,N,N]+"\\)$"),E=new RegExp("^rgb\\("+[A,A,A]+"\\)$"),R=new RegExp("^rgba\\("+[N,N,N,D]+"\\)$"),C=new RegExp("^rgba\\("+[A,A,A,D]+"\\)$"),L=new RegExp("^hsl\\("+[D,A,A]+"\\)$"),q=new RegExp("^hsla\\("+[D,A,A,D]+"\\)$"),z={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function I(){return this.rgb().formatHex()}function P(){return this.rgb().formatRgb()}function F(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=O.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?_(t):3===n?new V(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?j(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?j(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=T.exec(e))?new V(t[1],t[2],t[3],1):(t=E.exec(e))?new V(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=R.exec(e))?j(t[1],t[2],t[3],t[4]):(t=C.exec(e))?j(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=L.exec(e))?X(t[1],t[2]/100,t[3]/100,1):(t=q.exec(e))?X(t[1],t[2]/100,t[3]/100,t[4]):z.hasOwnProperty(e)?_(z[e]):"transparent"===e?new V(NaN,NaN,NaN,0):null}function _(e){return new V(e>>16&255,e>>8&255,255&e,1)}function j(e,t,n,r){return r<=0&&(e=t=n=NaN),new V(e,t,n,r)}function H(e){return e instanceof x||(e=F(e)),e?new V((e=e.rgb()).r,e.g,e.b,e.opacity):new V}function U(e,t,n,r){return 1===arguments.length?H(e):new V(e,t,n,null==r?1:r)}function V(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function $(){return"#"+B(this.r)+B(this.g)+B(this.b)}function G(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function B(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function X(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Q(e,t,n,r)}function Y(e){if(e instanceof Q)return new Q(e.h,e.s,e.l,e.opacity);if(e instanceof x||(e=F(e)),!e)return new Q;if(e instanceof Q)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-a,s=(i+a)/2;return l?(o=t===i?(n-r)/l+6*(n<r):n===i?(r-t)/l+2:(t-n)/l+4,l/=s<.5?i+a:2-i-a,o*=60):l=s>0&&s<1?0:o,new Q(o,l,s,e.opacity)}function Q(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function J(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}M(x,F,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:I,formatHex:I,formatHsl:function(){return Y(this).formatHsl()},formatRgb:P,toString:P}),M(V,U,w(x,{brighter:function(e){return e=null==e?S:Math.pow(S,e),new V(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?k:Math.pow(k,e),new V(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:$,formatHex:$,formatRgb:G,toString:G})),M(Q,(function(e,t,n,r){return 1===arguments.length?Y(e):new Q(e,t,n,null==r?1:r)}),w(x,{brighter:function(e){return e=null==e?S:Math.pow(S,e),new Q(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?k:Math.pow(k,e),new Q(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new V(J(e>=240?e-240:e+120,a,r),J(e,a,r),J(e<120?e+240:e-120,a,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var W=e=>()=>e;function K(e){return 1==(e=+e)?Z:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):W(isNaN(t)?n:t)}}function Z(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):W(isNaN(e)?t:e)}var ee=function e(t){var n=K(t);function r(e,t){var r=n((e=U(e)).r,(t=U(t)).r),a=n(e.g,t.g),i=n(e.b,t.b),o=Z(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=a(t),e.b=i(t),e.opacity=o(t),e+""}}return r.gamma=e,r}(1);function te(e,t){t||(t=[]);var n,r=e?Math.min(t.length,e.length):0,a=t.slice();return function(i){for(n=0;n<r;++n)a[n]=e[n]*(1-i)+t[n]*i;return a}}function ne(e,t){var n,r=t?t.length:0,a=e?Math.min(r,e.length):0,i=new Array(a),o=new Array(r);for(n=0;n<a;++n)i[n]=ue(e[n],t[n]);for(;n<r;++n)o[n]=t[n];return function(e){for(n=0;n<a;++n)o[n]=i[n](e);return o}}function re(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ae(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ie(e,t){var n,r={},a={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?r[n]=ue(e[n],t[n]):a[n]=t[n];return function(e){for(n in r)a[n]=r[n](e);return a}}var oe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,le=new RegExp(oe.source,"g");function se(e,t){var n,r,a,i=oe.lastIndex=le.lastIndex=0,o=-1,l=[],s=[];for(e+="",t+="";(n=oe.exec(e))&&(r=le.exec(t));)(a=r.index)>i&&(a=t.slice(i,a),l[o]?l[o]+=a:l[++o]=a),(n=n[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,s.push({i:o,x:ae(n,r)})),i=le.lastIndex;return i<t.length&&(a=t.slice(i),l[o]?l[o]+=a:l[++o]=a),l.length<2?s[0]?function(e){return function(t){return e(t)+""}}(s[0].x):function(e){return function(){return e}}(t):(t=s.length,function(e){for(var n,r=0;r<t;++r)l[(n=s[r]).i]=n.x(e);return l.join("")})}function ue(e,t){var n,r,a=typeof t;return null==t||"boolean"===a?W(t):("number"===a?ae:"string"===a?(n=F(t))?(t=n,ee):se:t instanceof F?ee:t instanceof Date?re:(r=t,!ArrayBuffer.isView(r)||r instanceof DataView?Array.isArray(t)?ne:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?ie:ae:te))(e,t)}function ce(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function de(e){return n.isContinuous(e)&&e!==n.Sequential}const fe=r.toSet(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function he(e){t.Transform.call(this,null,e),this.modified(!0)}function me(e,t,a){n.isLogarithmic(e)&&(Math.abs(t.reduce(((e,t)=>e+(t<0?-1:t>0?1:0)),0))!==t.length&&a.warn("Log scale domain includes zero: "+r.stringValue(t)));return t}function ge(e,t,a){return r.isFunction(e)&&(t||a)?n.interpolateRange(e,pe(t||[0,1],a)):e}function pe(e,t){return t?e.slice().reverse():e}function ye(e){t.Transform.call(this,null,e)}r.inherits(he,t.Transform,{transform(e,t){var a=t.dataflow,i=this.value,o=function(e){var t,a=e.type,i="";if(a===n.Sequential)return n.Sequential+"-"+n.Linear;(function(e){const t=e.type;return n.isContinuous(t)&&t!==n.Time&&t!==n.UTC&&(e.scheme||e.range&&e.range.length&&e.range.every(r.isString))})(e)&&(i=2===(t=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(null!=e.domainMid):0)?n.Sequential+"-":3===t?n.Diverging+"-":"");return(i+a||n.Linear).toLowerCase()}(e);for(o in i&&o===i.type||(this.value=i=n.scale(o)()),e)if(!fe[o]){if("padding"===o&&de(i.type))continue;r.isFunction(i[o])?i[o](e[o]):a.warn("Unsupported scale property: "+o)}return function(e,t,a){var i=e.type,o=t.round||!1,l=t.range;if(null!=t.rangeStep)l=function(e,t,a){e!==n.Band&&e!==n.Point&&r.error("Only band and point scales support rangeStep.");var i=(null!=t.paddingOuter?t.paddingOuter:t.padding)||0,o=e===n.Point?1:(null!=t.paddingInner?t.paddingInner:t.padding)||0;return[0,t.rangeStep*n.bandSpace(a,o,i)]}(i,t,a);else if(t.scheme&&(l=function(e,t,a){var i,o,l=t.schemeExtent;r.isArray(t.scheme)?o=n.interpolateColors(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),(o=n.scheme(i))||r.error("Unrecognized scheme name: ".concat(t.scheme)));return a=e===n.Threshold?a+1:e===n.BinOrdinal?a-1:e===n.Quantile||e===n.Quantize?+t.schemeCount||5:a,n.isInterpolating(e)?ge(o,l,t.reverse):r.isFunction(o)?n.quantizeInterpolator(ge(o,l),a):e===n.Ordinal?o:o.slice(0,a)}(i,t,a),r.isFunction(l))){if(e.interpolator)return e.interpolator(l);r.error("Scale type ".concat(i," does not support interpolating color schemes."))}if(l&&n.isInterpolating(i))return e.interpolator(n.interpolateColors(pe(l,t.reverse),t.interpolate,t.interpolateGamma));l&&t.interpolate&&e.interpolate?e.interpolate(n.interpolate(t.interpolate,t.interpolateGamma)):r.isFunction(e.round)?e.round(o):r.isFunction(e.rangeRound)&&e.interpolate(o?ce:ue);l&&e.range(pe(l,t.reverse))}(i,e,function(e,t,a){let i=t.bins;if(i&&!r.isArray(i)){const t=e.domain(),n=t[0],a=r.peek(t),o=i.step;let l=null==i.start?n:i.start,s=null==i.stop?a:i.stop;o||r.error("Scale bins parameter missing step property."),l<n&&(l=o*Math.ceil(n/o)),s>a&&(s=o*Math.floor(a/o)),i=v(l,s+o/2,o)}i?e.bins=i:e.bins&&delete e.bins;e.type===n.BinOrdinal&&(i?t.domain||t.domainRaw||(e.domain(i),a=i.length):e.bins=e.domain());return a}(i,e,function(e,t,a){const i=function(e,t,n){return t?(e.domain(me(e.type,t,n)),t.length):-1}(e,t.domainRaw,a);if(i>-1)return i;var o,l,s=t.domain,u=e.type,c=t.zero||void 0===t.zero&&function(e){const t=e.type;return!e.bins&&(t===n.Linear||t===n.Pow||t===n.Sqrt)}(e);if(!s)return 0;de(u)&&t.padding&&s[0]!==r.peek(s)&&(s=function(e,t,a,i,o,l){var s=Math.abs(r.peek(a)-a[0]),u=s/(s-2*i),c=e===n.Log?r.zoomLog(t,null,u):e===n.Sqrt?r.zoomPow(t,null,u,.5):e===n.Pow?r.zoomPow(t,null,u,o||1):e===n.Symlog?r.zoomSymlog(t,null,u,l||1):r.zoomLinear(t,null,u);return(t=t.slice())[0]=c[0],t[t.length-1]=c[1],t}(u,s,t.range,t.padding,t.exponent,t.constant));if((c||null!=t.domainMin||null!=t.domainMax||null!=t.domainMid)&&(o=(s=s.slice()).length-1||1,c&&(s[0]>0&&(s[0]=0),s[o]<0&&(s[o]=0)),null!=t.domainMin&&(s[0]=t.domainMin),null!=t.domainMax&&(s[o]=t.domainMax),null!=t.domainMid)){const e=(l=t.domainMid)>s[o]?o+1:l<s[0]?0:o;e!==o&&a.warn("Scale domainMid exceeds domain min or max.",l),s.splice(e,0,l)}e.domain(me(u,s,a)),u===n.Ordinal&&e.unknown(t.domainImplicit?n.scaleImplicit:void 0);t.nice&&e.nice&&e.nice(!0!==t.nice&&n.tickCount(e,t.nice)||null);return s.length}(i,e,a))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}}),r.inherits(ye,t.Transform,{transform(e,n){const r=e.modified("sort")||n.changed(n.ADD)||n.modified(e.sort.fields)||n.modified("datum");return r&&n.source.sort(t.stableCompare(e.sort)),this.modified(r),n}});const ve="zero",be="center",Me="normalize",we=["y0","y1"];function xe(e){t.Transform.call(this,null,e)}function ke(e,t,n,r,a){for(var i,o=(t-e.sum)/2,l=e.length,s=0;s<l;++s)(i=e[s])[r]=o,i[a]=o+=Math.abs(n(i))}function Se(e,t,n,r,a){for(var i,o=1/e.sum,l=0,s=e.length,u=0,c=0;u<s;++u)(i=e[u])[r]=l,i[a]=l=o*(c+=Math.abs(n(i)))}function Ne(e,t,n,r,a){for(var i,o,l=0,s=0,u=e.length,c=0;c<u;++c)(i=+n(o=e[c]))<0?(o[r]=s,o[a]=s+=i):(o[r]=l,o[a]=l+=i)}xe.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:ve,values:[ve,be,Me]},{name:"as",type:"string",array:!0,length:2,default:we}]},r.inherits(xe,t.Transform,{transform(e,n){var a,i,o,l,s=e.as||we,u=s[0],c=s[1],d=t.stableCompare(e.sort),f=e.field||r.one,h=e.offset===be?ke:e.offset===Me?Se:Ne;for(a=function(e,t,n,r){var a,i,o,l,s,u,c,d,f,h=[],m=e=>e(s);if(null==t)h.push(e.slice());else for(a={},i=0,o=e.length;i<o;++i)s=e[i],(c=a[u=t.map(m)])||(a[u]=c=[],h.push(c)),c.push(s);for(u=0,f=0,l=h.length;u<l;++u){for(i=0,d=0,o=(c=h[u]).length;i<o;++i)d+=Math.abs(r(c[i]));c.sum=d,d>f&&(f=d),n&&c.sort(n)}return h.max=f,h}(n.source,e.groupby,d,f),i=0,o=a.length,l=a.max;i<o;++i)h(a[i],l,f,u,c);return n.reflow(e.modified()).modifies(s)}}),e.axisticks=a,e.datajoin=i,e.encode=l,e.legendentries=s,e.linkpath=h,e.pie=b,e.scale=he,e.sortitems=ye,e.stack=xe,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=vega-encode.min.js.map |
@@ -796,12 +796,12 @@ import { Transform, ingest, tupleid, stableCompare } from 'vega-dataflow'; | ||
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 ".concat(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 | ||
@@ -808,0 +808,0 @@ |
{ | ||
"name": "vega-encode", | ||
"version": "4.8.3", | ||
"version": "4.9.0", | ||
"description": "Visual encoding transforms for Vega dataflows.", | ||
@@ -25,4 +25,4 @@ "keywords": [ | ||
"dependencies": { | ||
"d3-array": "^2.7.1", | ||
"d3-interpolate": "^2.0.1", | ||
"d3-array": "^3.1.1", | ||
"d3-interpolate": "^3.0.1", | ||
"vega-dataflow": "^5.7.3", | ||
@@ -35,3 +35,3 @@ "vega-scale": "^7.0.3", | ||
}, | ||
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0" | ||
"gitHead": "9a3faca4395cade9ecdfde90af98f1c53e9916b2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
229860
3364
2
+ Addedd3-color@3.1.0(transitive)
+ Addedinternmap@2.0.3(transitive)
- Removedd3-array@2.12.1(transitive)
- Removedd3-color@2.0.0(transitive)
- Removedd3-interpolate@2.0.1(transitive)
- Removedinternmap@1.0.1(transitive)
Updatedd3-array@^3.1.1
Updatedd3-interpolate@^3.0.1