@explorable-viz/fluid
Version:
A functional programming language which integrates a bidirectional dynamic analysis, connecting outputs to data sources in a fine-grained way. Fluid is implemented in PureScript and runs in the browser.
1,509 lines (1,449 loc) • 1.87 MB
JavaScript
// output-es/runtime.js
function binding(init5) {
let state = 0;
let value;
return () => {
if (state === 2) {
return value;
}
if (state === 1) {
throw new Error("Binding demanded before initialized");
}
state = 1;
value = init5();
state = 2;
return value;
};
}
function fail() {
throw new Error("Failed pattern match");
}
function intDiv(x2, y2) {
if (y2 > 0) return Math.floor(x2 / y2);
if (y2 < 0) return -Math.floor(x2 / -y2);
return 0;
}
// node_modules/d3-array/src/ascending.js
function ascending(a, b) {
return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
// node_modules/d3-array/src/descending.js
function descending(a, b) {
return a == null || b == null ? NaN : b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
}
// node_modules/d3-array/src/bisector.js
function bisector(f) {
let compare1, compare2, delta;
if (f.length !== 2) {
compare1 = ascending;
compare2 = (d, x2) => ascending(f(d), x2);
delta = (d, x2) => f(d) - x2;
} else {
compare1 = f === ascending || f === descending ? f : zero;
compare2 = f;
delta = f;
}
function left2(a, x2, lo = 0, hi = a.length) {
if (lo < hi) {
if (compare1(x2, x2) !== 0) return hi;
do {
const mid = lo + hi >>> 1;
if (compare2(a[mid], x2) < 0) lo = mid + 1;
else hi = mid;
} while (lo < hi);
}
return lo;
}
function right2(a, x2, lo = 0, hi = a.length) {
if (lo < hi) {
if (compare1(x2, x2) !== 0) return hi;
do {
const mid = lo + hi >>> 1;
if (compare2(a[mid], x2) <= 0) lo = mid + 1;
else hi = mid;
} while (lo < hi);
}
return lo;
}
function center2(a, x2, lo = 0, hi = a.length) {
const i = left2(a, x2, lo, hi - 1);
return i > lo && delta(a[i - 1], x2) > -delta(a[i], x2) ? i - 1 : i;
}
return { left: left2, center: center2, right: right2 };
}
function zero() {
return 0;
}
// node_modules/d3-array/src/number.js
function number(x2) {
return x2 === null ? NaN : +x2;
}
// node_modules/d3-array/src/bisect.js
var ascendingBisect = bisector(ascending);
var bisectRight = ascendingBisect.right;
var bisectLeft = ascendingBisect.left;
var bisectCenter = bisector(number).center;
var bisect_default = bisectRight;
// node_modules/internmap/src/index.js
var InternMap = class extends Map {
constructor(entries, key = keyof) {
super();
Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
if (entries != null) for (const [key2, value] of entries) this.set(key2, value);
}
get(key) {
return super.get(intern_get(this, key));
}
has(key) {
return super.has(intern_get(this, key));
}
set(key, value) {
return super.set(intern_set(this, key), value);
}
delete(key) {
return super.delete(intern_delete(this, key));
}
};
function intern_get({ _intern, _key }, value) {
const key = _key(value);
return _intern.has(key) ? _intern.get(key) : value;
}
function intern_set({ _intern, _key }, value) {
const key = _key(value);
if (_intern.has(key)) return _intern.get(key);
_intern.set(key, value);
return value;
}
function intern_delete({ _intern, _key }, value) {
const key = _key(value);
if (_intern.has(key)) {
value = _intern.get(key);
_intern.delete(key);
}
return value;
}
function keyof(value) {
return value !== null && typeof value === "object" ? value.valueOf() : value;
}
// node_modules/d3-array/src/ticks.js
var e10 = Math.sqrt(50);
var e5 = Math.sqrt(10);
var e2 = Math.sqrt(2);
function tickSpec(start2, stop, count) {
const step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log10(step)), error3 = step / Math.pow(10, power), factor = error3 >= e10 ? 10 : error3 >= e5 ? 5 : error3 >= e2 ? 2 : 1;
let i1, i2, inc;
if (power < 0) {
inc = Math.pow(10, -power) / factor;
i1 = Math.round(start2 * inc);
i2 = Math.round(stop * inc);
if (i1 / inc < start2) ++i1;
if (i2 / inc > stop) --i2;
inc = -inc;
} else {
inc = Math.pow(10, power) * factor;
i1 = Math.round(start2 / inc);
i2 = Math.round(stop / inc);
if (i1 * inc < start2) ++i1;
if (i2 * inc > stop) --i2;
}
if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start2, stop, count * 2);
return [i1, i2, inc];
}
function ticks(start2, stop, count) {
stop = +stop, start2 = +start2, count = +count;
if (!(count > 0)) return [];
if (start2 === stop) return [start2];
const reverse3 = stop < start2, [i1, i2, inc] = reverse3 ? tickSpec(stop, start2, count) : tickSpec(start2, stop, count);
if (!(i2 >= i1)) return [];
const n = i2 - i1 + 1, ticks2 = new Array(n);
if (reverse3) {
if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) / -inc;
else for (let i = 0; i < n; ++i) ticks2[i] = (i2 - i) * inc;
} else {
if (inc < 0) for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) / -inc;
else for (let i = 0; i < n; ++i) ticks2[i] = (i1 + i) * inc;
}
return ticks2;
}
function tickIncrement(start2, stop, count) {
stop = +stop, start2 = +start2, count = +count;
return tickSpec(start2, stop, count)[2];
}
function tickStep(start2, stop, count) {
stop = +stop, start2 = +start2, count = +count;
const reverse3 = stop < start2, inc = reverse3 ? tickIncrement(stop, start2, count) : tickIncrement(start2, stop, count);
return (reverse3 ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
}
// node_modules/d3-array/src/range.js
function range(start2, stop, step) {
start2 = +start2, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n < 3 ? 1 : +step;
var i = -1, n = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n);
while (++i < n) {
range3[i] = start2 + i * step;
}
return range3;
}
// node_modules/d3-axis/src/identity.js
function identity_default(x2) {
return x2;
}
// node_modules/d3-axis/src/axis.js
var top = 1;
var right = 2;
var bottom = 3;
var left = 4;
var epsilon = 1e-6;
function translateX(x2) {
return "translate(" + x2 + ",0)";
}
function translateY(y2) {
return "translate(0," + y2 + ")";
}
function number2(scale) {
return (d) => +scale(d);
}
function center(scale, offset) {
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
if (scale.round()) offset = Math.round(offset);
return (d) => +scale(d) + offset;
}
function entering() {
return !this.__axis;
}
function axis(orient, scale) {
var tickArguments = [], tickValues = null, tickFormat2 = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === top || orient === left ? -1 : 1, x2 = orient === left || orient === right ? "x" : "y", transform2 = orient === top || orient === bottom ? translateX : translateY;
function axis2(context2) {
var values2 = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format3 = tickFormat2 == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity_default : tickFormat2, spacing = Math.max(tickSizeInner, 0) + tickPadding, range3 = scale.range(), range0 = +range3[0] + offset, range1 = +range3[range3.length - 1] + offset, position2 = (scale.bandwidth ? center : number2)(scale.copy(), offset), selection3 = context2.selection ? context2.selection() : context2, path2 = selection3.selectAll(".domain").data([null]), tick = selection3.selectAll(".tick").data(values2, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line2 = tick.select("line"), text = tick.select("text");
path2 = path2.merge(path2.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor"));
tick = tick.merge(tickEnter);
line2 = line2.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x2 + "2", k * tickSizeInner));
text = text.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x2, k * spacing).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
if (context2 !== selection3) {
path2 = path2.transition(context2);
tick = tick.transition(context2);
line2 = line2.transition(context2);
text = text.transition(context2);
tickExit = tickExit.transition(context2).attr("opacity", epsilon).attr("transform", function(d) {
return isFinite(d = position2(d)) ? transform2(d + offset) : this.getAttribute("transform");
});
tickEnter.attr("opacity", epsilon).attr("transform", function(d) {
var p = this.parentNode.__axis;
return transform2((p && isFinite(p = p(d)) ? p : position2(d)) + offset);
});
}
tickExit.remove();
path2.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1);
tick.attr("opacity", 1).attr("transform", function(d) {
return transform2(position2(d) + offset);
});
line2.attr(x2 + "2", k * tickSizeInner);
text.attr(x2, k * spacing).text(format3);
selection3.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
selection3.each(function() {
this.__axis = position2;
});
}
axis2.scale = function(_) {
return arguments.length ? (scale = _, axis2) : scale;
};
axis2.ticks = function() {
return tickArguments = Array.from(arguments), axis2;
};
axis2.tickArguments = function(_) {
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis2) : tickArguments.slice();
};
axis2.tickValues = function(_) {
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis2) : tickValues && tickValues.slice();
};
axis2.tickFormat = function(_) {
return arguments.length ? (tickFormat2 = _, axis2) : tickFormat2;
};
axis2.tickSize = function(_) {
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis2) : tickSizeInner;
};
axis2.tickSizeInner = function(_) {
return arguments.length ? (tickSizeInner = +_, axis2) : tickSizeInner;
};
axis2.tickSizeOuter = function(_) {
return arguments.length ? (tickSizeOuter = +_, axis2) : tickSizeOuter;
};
axis2.tickPadding = function(_) {
return arguments.length ? (tickPadding = +_, axis2) : tickPadding;
};
axis2.offset = function(_) {
return arguments.length ? (offset = +_, axis2) : offset;
};
return axis2;
}
function axisBottom(scale) {
return axis(bottom, scale);
}
function axisLeft(scale) {
return axis(left, scale);
}
// node_modules/d3-dispatch/src/dispatch.js
var noop = { value: () => {
} };
function dispatch() {
for (var i = 0, n = arguments.length, _ = {}, t2; i < n; ++i) {
if (!(t2 = arguments[i] + "") || t2 in _ || /[\s.]/.test(t2)) throw new Error("illegal type: " + t2);
_[t2] = [];
}
return new Dispatch(_);
}
function Dispatch(_) {
this._ = _;
}
function parseTypenames(typenames, types2) {
return typenames.trim().split(/^|\s+/).map(function(t2) {
var name3 = "", i = t2.indexOf(".");
if (i >= 0) name3 = t2.slice(i + 1), t2 = t2.slice(0, i);
if (t2 && !types2.hasOwnProperty(t2)) throw new Error("unknown type: " + t2);
return { type: t2, name: name3 };
});
}
Dispatch.prototype = dispatch.prototype = {
constructor: Dispatch,
on: function(typename, callback) {
var _ = this._, T = parseTypenames(typename + "", _), t2, i = -1, n = T.length;
if (arguments.length < 2) {
while (++i < n) if ((t2 = (typename = T[i]).type) && (t2 = get(_[t2], typename.name))) return t2;
return;
}
if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
while (++i < n) {
if (t2 = (typename = T[i]).type) _[t2] = set(_[t2], typename.name, callback);
else if (callback == null) for (t2 in _) _[t2] = set(_[t2], typename.name, null);
}
return this;
},
copy: function() {
var copy2 = {}, _ = this._;
for (var t2 in _) copy2[t2] = _[t2].slice();
return new Dispatch(copy2);
},
call: function(type2, that) {
if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t2; i < n; ++i) args[i] = arguments[i + 2];
if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
for (t2 = this._[type2], i = 0, n = t2.length; i < n; ++i) t2[i].value.apply(that, args);
},
apply: function(type2, that, args) {
if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
for (var t2 = this._[type2], i = 0, n = t2.length; i < n; ++i) t2[i].value.apply(that, args);
}
};
function get(type2, name3) {
for (var i = 0, n = type2.length, c; i < n; ++i) {
if ((c = type2[i]).name === name3) {
return c.value;
}
}
}
function set(type2, name3, callback) {
for (var i = 0, n = type2.length; i < n; ++i) {
if (type2[i].name === name3) {
type2[i] = noop, type2 = type2.slice(0, i).concat(type2.slice(i + 1));
break;
}
}
if (callback != null) type2.push({ name: name3, value: callback });
return type2;
}
var dispatch_default = dispatch;
// node_modules/d3-selection/src/namespaces.js
var xhtml = "http://www.w3.org/1999/xhtml";
var namespaces_default = {
svg: "http://www.w3.org/2000/svg",
xhtml,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
// node_modules/d3-selection/src/namespace.js
function namespace_default(name3) {
var prefix = name3 += "", i = prefix.indexOf(":");
if (i >= 0 && (prefix = name3.slice(0, i)) !== "xmlns") name3 = name3.slice(i + 1);
return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name3 } : name3;
}
// node_modules/d3-selection/src/creator.js
function creatorInherit(name3) {
return function() {
var document2 = this.ownerDocument, uri = this.namespaceURI;
return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name3) : document2.createElementNS(uri, name3);
};
}
function creatorFixed(fullname) {
return function() {
return this.ownerDocument.createElementNS(fullname.space, fullname.local);
};
}
function creator_default(name3) {
var fullname = namespace_default(name3);
return (fullname.local ? creatorFixed : creatorInherit)(fullname);
}
// node_modules/d3-selection/src/selector.js
function none() {
}
function selector_default(selector2) {
return selector2 == null ? none : function() {
return this.querySelector(selector2);
};
}
// node_modules/d3-selection/src/selection/select.js
function select_default(select2) {
if (typeof select2 !== "function") select2 = selector_default(select2);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group3 = groups[j], n = group3.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {
if ((node = group3[i]) && (subnode = select2.call(node, node.__data__, i, group3))) {
if ("__data__" in node) subnode.__data__ = node.__data__;
subgroup[i] = subnode;
}
}
}
return new Selection(subgroups, this._parents);
}
// node_modules/d3-selection/src/array.js
function array(x2) {
return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
}
// node_modules/d3-selection/src/selectorAll.js
function empty() {
return [];
}
function selectorAll_default(selector2) {
return selector2 == null ? empty : function() {
return this.querySelectorAll(selector2);
};
}
// node_modules/d3-selection/src/selection/selectAll.js
function arrayAll(select2) {
return function() {
return array(select2.apply(this, arguments));
};
}
function selectAll_default(select2) {
if (typeof select2 === "function") select2 = arrayAll(select2);
else select2 = selectorAll_default(select2);
for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
for (var group3 = groups[j], n = group3.length, node, i = 0; i < n; ++i) {
if (node = group3[i]) {
subgroups.push(select2.call(node, node.__data__, i, group3));
parents.push(node);
}
}
}
return new Selection(subgroups, parents);
}
// node_modules/d3-selection/src/matcher.js
function matcher_default(selector2) {
return function() {
return this.matches(selector2);
};
}
function childMatcher(selector2) {
return function(node) {
return node.matches(selector2);
};
}
// node_modules/d3-selection/src/selection/selectChild.js
var find = Array.prototype.find;
function childFind(match3) {
return function() {
return find.call(this.children, match3);
};
}
function childFirst() {
return this.firstElementChild;
}
function selectChild_default(match3) {
return this.select(match3 == null ? childFirst : childFind(typeof match3 === "function" ? match3 : childMatcher(match3)));
}
// node_modules/d3-selection/src/selection/selectChildren.js
var filter = Array.prototype.filter;
function children() {
return Array.from(this.children);
}
function childrenFilter(match3) {
return function() {
return filter.call(this.children, match3);
};
}
function selectChildren_default(match3) {
return this.selectAll(match3 == null ? children : childrenFilter(typeof match3 === "function" ? match3 : childMatcher(match3)));
}
// node_modules/d3-selection/src/selection/filter.js
function filter_default(match3) {
if (typeof match3 !== "function") match3 = matcher_default(match3);
for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {
for (var group3 = groups[j], n = group3.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {
if ((node = group3[i]) && match3.call(node, node.__data__, i, group3)) {
subgroup.push(node);
}
}
}
return new Selection(subgroups, this._parents);
}
// node_modules/d3-selection/src/selection/sparse.js
function sparse_default(update3) {
return new Array(update3.length);
}
// node_modules/d3-selection/src/selection/enter.js
function enter_default() {
return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
}
function EnterNode(parent, datum3) {
this.ownerDocument = parent.ownerDocument;
this.namespaceURI = parent.namespaceURI;
this._next = null;
this._parent = parent;
this.__data__ = datum3;
}
EnterNode.prototype = {
constructor: EnterNode,
appendChild: function(child) {
return this._parent.insertBefore(child, this._next);
},
insertBefore: function(child, next) {
return this._parent.insertBefore(child, next);
},
querySelector: function(selector2) {
return this._parent.querySelector(selector2);
},
querySelectorAll: function(selector2) {
return this._parent.querySelectorAll(selector2);
}
};
// node_modules/d3-selection/src/constant.js
function constant_default(x2) {
return function() {
return x2;
};
}
// node_modules/d3-selection/src/selection/data.js
function bindIndex(parent, group3, enter, update3, exit, data) {
var i = 0, node, groupLength = group3.length, dataLength = data.length;
for (; i < dataLength; ++i) {
if (node = group3[i]) {
node.__data__ = data[i];
update3[i] = node;
} else {
enter[i] = new EnterNode(parent, data[i]);
}
}
for (; i < groupLength; ++i) {
if (node = group3[i]) {
exit[i] = node;
}
}
}
function bindKey(parent, group3, enter, update3, exit, data, key) {
var i, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group3.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
for (i = 0; i < groupLength; ++i) {
if (node = group3[i]) {
keyValues[i] = keyValue = key.call(node, node.__data__, i, group3) + "";
if (nodeByKeyValue.has(keyValue)) {
exit[i] = node;
} else {
nodeByKeyValue.set(keyValue, node);
}
}
}
for (i = 0; i < dataLength; ++i) {
keyValue = key.call(parent, data[i], i, data) + "";
if (node = nodeByKeyValue.get(keyValue)) {
update3[i] = node;
node.__data__ = data[i];
nodeByKeyValue.delete(keyValue);
} else {
enter[i] = new EnterNode(parent, data[i]);
}
}
for (i = 0; i < groupLength; ++i) {
if ((node = group3[i]) && nodeByKeyValue.get(keyValues[i]) === node) {
exit[i] = node;
}
}
}
function datum(node) {
return node.__data__;
}
function data_default(value, key) {
if (!arguments.length) return Array.from(this, datum);
var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
if (typeof value !== "function") value = constant_default(value);
for (var m = groups.length, update3 = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
var parent = parents[j], group3 = groups[j], groupLength = group3.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update3[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength);
bind(parent, group3, enterGroup, updateGroup, exitGroup, data, key);
for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
if (previous = enterGroup[i0]) {
if (i0 >= i1) i1 = i0 + 1;
while (!(next = updateGroup[i1]) && ++i1 < dataLength) ;
previous._next = next || null;
}
}
}
update3 = new Selection(update3, parents);
update3._enter = enter;
update3._exit = exit;
return update3;
}
function arraylike(data) {
return typeof data === "object" && "length" in data ? data : Array.from(data);
}
// node_modules/d3-selection/src/selection/exit.js
function exit_default() {
return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
}
// node_modules/d3-selection/src/selection/join.js
function join_default(onenter, onupdate, onexit) {
var enter = this.enter(), update3 = this, exit = this.exit();
if (typeof onenter === "function") {
enter = onenter(enter);
if (enter) enter = enter.selection();
} else {
enter = enter.append(onenter + "");
}
if (onupdate != null) {
update3 = onupdate(update3);
if (update3) update3 = update3.selection();
}
if (onexit == null) exit.remove();
else onexit(exit);
return enter && update3 ? enter.merge(update3).order() : update3;
}
// node_modules/d3-selection/src/selection/merge.js
function merge_default(context2) {
var selection3 = context2.selection ? context2.selection() : context2;
for (var groups0 = this._groups, groups1 = selection3._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {
for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group0[i] || group1[i]) {
merge[i] = node;
}
}
}
for (; j < m0; ++j) {
merges[j] = groups0[j];
}
return new Selection(merges, this._parents);
}
// node_modules/d3-selection/src/selection/order.js
function order_default() {
for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) {
for (var group3 = groups[j], i = group3.length - 1, next = group3[i], node; --i >= 0; ) {
if (node = group3[i]) {
if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
next = node;
}
}
}
return this;
}
// node_modules/d3-selection/src/selection/sort.js
function sort_default(compare2) {
if (!compare2) compare2 = ascending2;
function compareNode(a, b) {
return a && b ? compare2(a.__data__, b.__data__) : !a - !b;
}
for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
for (var group3 = groups[j], n = group3.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {
if (node = group3[i]) {
sortgroup[i] = node;
}
}
sortgroup.sort(compareNode);
}
return new Selection(sortgroups, this._parents).order();
}
function ascending2(a, b) {
return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}
// node_modules/d3-selection/src/selection/call.js
function call_default() {
var callback = arguments[0];
arguments[0] = this;
callback.apply(null, arguments);
return this;
}
// node_modules/d3-selection/src/selection/nodes.js
function nodes_default() {
return Array.from(this);
}
// node_modules/d3-selection/src/selection/node.js
function node_default() {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group3 = groups[j], i = 0, n = group3.length; i < n; ++i) {
var node = group3[i];
if (node) return node;
}
}
return null;
}
// node_modules/d3-selection/src/selection/size.js
function size_default() {
let size3 = 0;
for (const node of this) ++size3;
return size3;
}
// node_modules/d3-selection/src/selection/empty.js
function empty_default() {
return !this.node();
}
// node_modules/d3-selection/src/selection/each.js
function each_default(callback) {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group3 = groups[j], i = 0, n = group3.length, node; i < n; ++i) {
if (node = group3[i]) callback.call(node, node.__data__, i, group3);
}
}
return this;
}
// node_modules/d3-selection/src/selection/attr.js
function attrRemove(name3) {
return function() {
this.removeAttribute(name3);
};
}
function attrRemoveNS(fullname) {
return function() {
this.removeAttributeNS(fullname.space, fullname.local);
};
}
function attrConstant(name3, value) {
return function() {
this.setAttribute(name3, value);
};
}
function attrConstantNS(fullname, value) {
return function() {
this.setAttributeNS(fullname.space, fullname.local, value);
};
}
function attrFunction(name3, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null) this.removeAttribute(name3);
else this.setAttribute(name3, v);
};
}
function attrFunctionNS(fullname, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null) this.removeAttributeNS(fullname.space, fullname.local);
else this.setAttributeNS(fullname.space, fullname.local, v);
};
}
function attr_default(name3, value) {
var fullname = namespace_default(name3);
if (arguments.length < 2) {
var node = this.node();
return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
}
return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
}
// node_modules/d3-selection/src/window.js
function window_default(node) {
return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
}
// node_modules/d3-selection/src/selection/style.js
function styleRemove(name3) {
return function() {
this.style.removeProperty(name3);
};
}
function styleConstant(name3, value, priority) {
return function() {
this.style.setProperty(name3, value, priority);
};
}
function styleFunction(name3, value, priority) {
return function() {
var v = value.apply(this, arguments);
if (v == null) this.style.removeProperty(name3);
else this.style.setProperty(name3, v, priority);
};
}
function style_default(name3, value, priority) {
return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name3, value, priority == null ? "" : priority)) : styleValue(this.node(), name3);
}
function styleValue(node, name3) {
return node.style.getPropertyValue(name3) || window_default(node).getComputedStyle(node, null).getPropertyValue(name3);
}
// node_modules/d3-selection/src/selection/property.js
function propertyRemove(name3) {
return function() {
delete this[name3];
};
}
function propertyConstant(name3, value) {
return function() {
this[name3] = value;
};
}
function propertyFunction(name3, value) {
return function() {
var v = value.apply(this, arguments);
if (v == null) delete this[name3];
else this[name3] = v;
};
}
function property_default(name3, value) {
return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name3, value)) : this.node()[name3];
}
// node_modules/d3-selection/src/selection/classed.js
function classArray(string4) {
return string4.trim().split(/^|\s+/);
}
function classList(node) {
return node.classList || new ClassList(node);
}
function ClassList(node) {
this._node = node;
this._names = classArray(node.getAttribute("class") || "");
}
ClassList.prototype = {
add: function(name3) {
var i = this._names.indexOf(name3);
if (i < 0) {
this._names.push(name3);
this._node.setAttribute("class", this._names.join(" "));
}
},
remove: function(name3) {
var i = this._names.indexOf(name3);
if (i >= 0) {
this._names.splice(i, 1);
this._node.setAttribute("class", this._names.join(" "));
}
},
contains: function(name3) {
return this._names.indexOf(name3) >= 0;
}
};
function classedAdd(node, names) {
var list = classList(node), i = -1, n = names.length;
while (++i < n) list.add(names[i]);
}
function classedRemove(node, names) {
var list = classList(node), i = -1, n = names.length;
while (++i < n) list.remove(names[i]);
}
function classedTrue(names) {
return function() {
classedAdd(this, names);
};
}
function classedFalse(names) {
return function() {
classedRemove(this, names);
};
}
function classedFunction(names, value) {
return function() {
(value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
};
}
function classed_default(name3, value) {
var names = classArray(name3 + "");
if (arguments.length < 2) {
var list = classList(this.node()), i = -1, n = names.length;
while (++i < n) if (!list.contains(names[i])) return false;
return true;
}
return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
}
// node_modules/d3-selection/src/selection/text.js
function textRemove() {
this.textContent = "";
}
function textConstant(value) {
return function() {
this.textContent = value;
};
}
function textFunction(value) {
return function() {
var v = value.apply(this, arguments);
this.textContent = v == null ? "" : v;
};
}
function text_default(value) {
return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
}
// node_modules/d3-selection/src/selection/html.js
function htmlRemove() {
this.innerHTML = "";
}
function htmlConstant(value) {
return function() {
this.innerHTML = value;
};
}
function htmlFunction(value) {
return function() {
var v = value.apply(this, arguments);
this.innerHTML = v == null ? "" : v;
};
}
function html_default(value) {
return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
}
// node_modules/d3-selection/src/selection/raise.js
function raise() {
if (this.nextSibling) this.parentNode.appendChild(this);
}
function raise_default() {
return this.each(raise);
}
// node_modules/d3-selection/src/selection/lower.js
function lower() {
if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function lower_default() {
return this.each(lower);
}
// node_modules/d3-selection/src/selection/append.js
function append_default(name3) {
var create2 = typeof name3 === "function" ? name3 : creator_default(name3);
return this.select(function() {
return this.appendChild(create2.apply(this, arguments));
});
}
// node_modules/d3-selection/src/selection/insert.js
function constantNull() {
return null;
}
function insert_default(name3, before) {
var create2 = typeof name3 === "function" ? name3 : creator_default(name3), select2 = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
return this.select(function() {
return this.insertBefore(create2.apply(this, arguments), select2.apply(this, arguments) || null);
});
}
// node_modules/d3-selection/src/selection/remove.js
function remove() {
var parent = this.parentNode;
if (parent) parent.removeChild(this);
}
function remove_default() {
return this.each(remove);
}
// node_modules/d3-selection/src/selection/clone.js
function selection_cloneShallow() {
var clone = this.cloneNode(false), parent = this.parentNode;
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
}
function selection_cloneDeep() {
var clone = this.cloneNode(true), parent = this.parentNode;
return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
}
function clone_default(deep) {
return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
}
// node_modules/d3-selection/src/selection/datum.js
function datum_default(value) {
return arguments.length ? this.property("__data__", value) : this.node().__data__;
}
// node_modules/d3-selection/src/selection/on.js
function contextListener(listener) {
return function(event) {
listener.call(this, event, this.__data__);
};
}
function parseTypenames2(typenames) {
return typenames.trim().split(/^|\s+/).map(function(t2) {
var name3 = "", i = t2.indexOf(".");
if (i >= 0) name3 = t2.slice(i + 1), t2 = t2.slice(0, i);
return { type: t2, name: name3 };
});
}
function onRemove(typename) {
return function() {
var on2 = this.__on;
if (!on2) return;
for (var j = 0, i = -1, m = on2.length, o; j < m; ++j) {
if (o = on2[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.options);
} else {
on2[++i] = o;
}
}
if (++i) on2.length = i;
else delete this.__on;
};
}
function onAdd(typename, value, options) {
return function() {
var on2 = this.__on, o, listener = contextListener(value);
if (on2) for (var j = 0, m = on2.length; j < m; ++j) {
if ((o = on2[j]).type === typename.type && o.name === typename.name) {
this.removeEventListener(o.type, o.listener, o.options);
this.addEventListener(o.type, o.listener = listener, o.options = options);
o.value = value;
return;
}
}
this.addEventListener(typename.type, listener, options);
o = { type: typename.type, name: typename.name, value, listener, options };
if (!on2) this.__on = [o];
else on2.push(o);
};
}
function on_default(typename, value, options) {
var typenames = parseTypenames2(typename + ""), i, n = typenames.length, t2;
if (arguments.length < 2) {
var on2 = this.node().__on;
if (on2) for (var j = 0, m = on2.length, o; j < m; ++j) {
for (i = 0, o = on2[j]; i < n; ++i) {
if ((t2 = typenames[i]).type === o.type && t2.name === o.name) {
return o.value;
}
}
}
return;
}
on2 = value ? onAdd : onRemove;
for (i = 0; i < n; ++i) this.each(on2(typenames[i], value, options));
return this;
}
// node_modules/d3-selection/src/selection/dispatch.js
function dispatchEvent(node, type2, params) {
var window2 = window_default(node), event = window2.CustomEvent;
if (typeof event === "function") {
event = new event(type2, params);
} else {
event = window2.document.createEvent("Event");
if (params) event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
else event.initEvent(type2, false, false);
}
node.dispatchEvent(event);
}
function dispatchConstant(type2, params) {
return function() {
return dispatchEvent(this, type2, params);
};
}
function dispatchFunction(type2, params) {
return function() {
return dispatchEvent(this, type2, params.apply(this, arguments));
};
}
function dispatch_default2(type2, params) {
return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
}
// node_modules/d3-selection/src/selection/iterator.js
function* iterator_default() {
for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {
for (var group3 = groups[j], i = 0, n = group3.length, node; i < n; ++i) {
if (node = group3[i]) yield node;
}
}
}
// node_modules/d3-selection/src/selection/index.js
var root = [null];
function Selection(groups, parents) {
this._groups = groups;
this._parents = parents;
}
function selection() {
return new Selection([[document.documentElement]], root);
}
function selection_selection() {
return this;
}
Selection.prototype = selection.prototype = {
constructor: Selection,
select: select_default,
selectAll: selectAll_default,
selectChild: selectChild_default,
selectChildren: selectChildren_default,
filter: filter_default,
data: data_default,
enter: enter_default,
exit: exit_default,
join: join_default,
merge: merge_default,
selection: selection_selection,
order: order_default,
sort: sort_default,
call: call_default,
nodes: nodes_default,
node: node_default,
size: size_default,
empty: empty_default,
each: each_default,
attr: attr_default,
style: style_default,
property: property_default,
classed: classed_default,
text: text_default,
html: html_default,
raise: raise_default,
lower: lower_default,
append: append_default,
insert: insert_default,
remove: remove_default,
clone: clone_default,
datum: datum_default,
on: on_default,
dispatch: dispatch_default2,
[Symbol.iterator]: iterator_default
};
var selection_default = selection;
// node_modules/d3-selection/src/select.js
function select_default2(selector2) {
return typeof selector2 === "string" ? new Selection([[document.querySelector(selector2)]], [document.documentElement]) : new Selection([[selector2]], root);
}
// node_modules/d3-color/src/define.js
function define_default(constructor2, factory, prototype) {
constructor2.prototype = factory.prototype = prototype;
prototype.constructor = constructor2;
}
function extend(parent, definition) {
var prototype = Object.create(parent.prototype);
for (var key in definition) prototype[key] = definition[key];
return prototype;
}
// node_modules/d3-color/src/color.js
function Color() {
}
var darker = 0.7;
var brighter = 1 / darker;
var reI = "\\s*([+-]?\\d+)\\s*";
var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
var reHex = /^#([0-9a-f]{3,8})$/;
var reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`);
var reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`);
var reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`);
var reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`);
var reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`);
var reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
var named = {
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
};
define_default(Color, color, {
copy(channels) {
return Object.assign(new this.constructor(), this, channels);
},
displayable() {
return this.rgb().displayable();
},
hex: color_formatHex,
// Deprecated! Use color.formatHex.
formatHex: color_formatHex,
formatHex8: color_formatHex8,
formatHsl: color_formatHsl,
formatRgb: color_formatRgb,
toString: color_formatRgb
});
function color_formatHex() {
return this.rgb().formatHex();
}
function color_formatHex8() {
return this.rgb().formatHex8();
}
function color_formatHsl() {
return hslConvert(this).formatHsl();
}
function color_formatRgb() {
return this.rgb().formatRgb();
}
function color(format3) {
var m, l;
format3 = (format3 + "").trim().toLowerCase();
return (m = reHex.exec(format3)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format3)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format3)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format3)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format3)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format3)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format3)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format3) ? rgbn(named[format3]) : format3 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
}
function rgbn(n) {
return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 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(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_default(Rgb, rgb, extend(Color, {
brighter(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
darker(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
},
rgb() {
return this;
},
clamp() {
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
},
displayable() {
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,
formatHex8: rgb_formatHex8,
formatRgb: rgb_formatRgb,
toString: rgb_formatRgb
}));
function rgb_formatHex() {
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
}
function rgb_formatHex8() {
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function rgb_formatRgb() {
const a = clampa(this.opacity);
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
}
function clampa(opacity) {
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
}
function clampi(value) {
return Math.max(0, Math.min(255, Math.round(value) || 0));
}
function hex(value) {
value = clampi(value);
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, min3 = Math.min(r, g, b), max6 = Math.max(r, g, b), h = NaN, s = max6 - min3, l = (max6 + min3) / 2;
if (s) {
if (r === max6) h = (g - b) / s + (g < b) * 6;
else if (g === max6) h = (b - r) / s + 2;
else h = (r - g) / s + 4;
s /= l < 0.5 ? max6 + min3 : 2 - max6 - min3;
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_default(Hsl, hsl, extend(Color, {
brighter(k) {
k = k == null ? brighter : Math.pow(brighter, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
darker(k) {
k = k == null ? darker : Math.pow(darker, k);
return new Hsl(this.h, this.s, this.l * k, this.opacity);
},
rgb() {
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
);
},
clamp() {
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
},
displayable() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
},
formatHsl() {
const a = clampa(this.opacity);
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
}
}));
function clamph(value) {
value = (value || 0) % 360;
return value < 0 ? value + 360 : value;
}
function clampt(value) {
return Math.max(0, Math.min(1, value || 0));
}
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;
}
// node_modules/d3-interpolate/src/basis.js
function basis(t1, v0, v1, v2, v3) {
var t2 = t1 * t1, t3 = t2 * t1;
return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
}
function basis_default(values2) {
var n = values2.length - 1;
return function(t2) {
var i = t2 <= 0 ? t2 = 0 : t2 >= 1 ? (t2 = 1, n - 1) : Math.floor(t2 * n), v1 = values2[i], v2 = val