@equinor/esv-intersection
Version:
Intersection component package with testing and automatic documentation.
1,419 lines (1,417 loc) • 318 kB
JavaScript
import { autoDetectRenderer as cs, Container as qi, Graphics as qt, Point as dt, Matrix as hs, Texture as K, SCALE_MODES as ls, groupD8 as Ln, Rectangle as jt, CanvasSource as ji, MeshGeometry as kn, Mesh as En, MeshRope as Kn, Assets as us } from "pixi.js";
function fs(e) {
return e;
}
var Ye = 1, le = 2, sn = 3, ie = 4, Qn = 1e-6;
function ds(e) {
return "translate(" + e + ",0)";
}
function ps(e) {
return "translate(0," + e + ")";
}
function gs(e) {
return (t) => +e(t);
}
function ms(e, t) {
return t = Math.max(0, e.bandwidth() - t * 2) / 2, e.round() && (t = Math.round(t)), (n) => +e(n) + t;
}
function ys() {
return !this.__axis;
}
function Zi(e, t) {
var n = [], i = null, r = null, s = 6, o = 6, a = 3, c = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, h = e === Ye || e === ie ? -1 : 1, l = e === ie || e === le ? "x" : "y", u = e === Ye || e === sn ? ds : ps;
function f(d) {
var p = i ?? (t.ticks ? t.ticks.apply(t, n) : t.domain()), g = r ?? (t.tickFormat ? t.tickFormat.apply(t, n) : fs), y = Math.max(s, 0) + a, m = t.range(), _ = +m[0] + c, v = +m[m.length - 1] + c, M = (t.bandwidth ? ms : gs)(t.copy(), c), b = d.selection ? d.selection() : d, S = b.selectAll(".domain").data([null]), T = b.selectAll(".tick").data(p, t).order(), C = T.exit(), k = T.enter().append("g").attr("class", "tick"), R = T.select("line"), P = T.select("text");
S = S.merge(S.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), T = T.merge(k), R = R.merge(k.append("line").attr("stroke", "currentColor").attr(l + "2", h * s)), P = P.merge(k.append("text").attr("fill", "currentColor").attr(l, h * y).attr("dy", e === Ye ? "0em" : e === sn ? "0.71em" : "0.32em")), d !== b && (S = S.transition(d), T = T.transition(d), R = R.transition(d), P = P.transition(d), C = C.transition(d).attr("opacity", Qn).attr("transform", function(I) {
return isFinite(I = M(I)) ? u(I + c) : this.getAttribute("transform");
}), k.attr("opacity", Qn).attr("transform", function(I) {
var N = this.parentNode.__axis;
return u((N && isFinite(N = N(I)) ? N : M(I)) + c);
})), C.remove(), S.attr("d", e === ie || e === le ? o ? "M" + h * o + "," + _ + "H" + c + "V" + v + "H" + h * o : "M" + c + "," + _ + "V" + v : o ? "M" + _ + "," + h * o + "V" + c + "H" + v + "V" + h * o : "M" + _ + "," + c + "H" + v), T.attr("opacity", 1).attr("transform", function(I) {
return u(M(I) + c);
}), R.attr(l + "2", h * s), P.attr(l, h * y).text(g), b.filter(ys).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", e === le ? "start" : e === ie ? "end" : "middle"), b.each(function() {
this.__axis = M;
});
}
return f.scale = function(d) {
return arguments.length ? (t = d, f) : t;
}, f.ticks = function() {
return n = Array.from(arguments), f;
}, f.tickArguments = function(d) {
return arguments.length ? (n = d == null ? [] : Array.from(d), f) : n.slice();
}, f.tickValues = function(d) {
return arguments.length ? (i = d == null ? null : Array.from(d), f) : i && i.slice();
}, f.tickFormat = function(d) {
return arguments.length ? (r = d, f) : r;
}, f.tickSize = function(d) {
return arguments.length ? (s = o = +d, f) : s;
}, f.tickSizeInner = function(d) {
return arguments.length ? (s = +d, f) : s;
}, f.tickSizeOuter = function(d) {
return arguments.length ? (o = +d, f) : o;
}, f.tickPadding = function(d) {
return arguments.length ? (a = +d, f) : a;
}, f.offset = function(d) {
return arguments.length ? (c = +d, f) : c;
}, f;
}
function _s(e) {
return Zi(le, e);
}
function xs(e) {
return Zi(sn, e);
}
function ue(e, t) {
return e == null || t == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function vs(e, t) {
return e == null || t == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function Ki(e) {
let t, n, i;
e.length !== 2 ? (t = ue, n = (a, c) => ue(e(a), c), i = (a, c) => e(a) - c) : (t = e === ue || e === vs ? e : ws, n = e, i = e);
function r(a, c, h = 0, l = a.length) {
if (h < l) {
if (t(c, c) !== 0) return l;
do {
const u = h + l >>> 1;
n(a[u], c) < 0 ? h = u + 1 : l = u;
} while (h < l);
}
return h;
}
function s(a, c, h = 0, l = a.length) {
if (h < l) {
if (t(c, c) !== 0) return l;
do {
const u = h + l >>> 1;
n(a[u], c) <= 0 ? h = u + 1 : l = u;
} while (h < l);
}
return h;
}
function o(a, c, h = 0, l = a.length) {
const u = r(a, c, h, l - 1);
return u > h && i(a[u - 1], c) > -i(a[u], c) ? u - 1 : u;
}
return { left: r, center: o, right: s };
}
function ws() {
return 0;
}
function bs(e) {
return e === null ? NaN : +e;
}
const Ts = Ki(ue), Ss = Ts.right;
Ki(bs).center;
class Jn extends Map {
constructor(t, n = Ps) {
if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), t != null) for (const [i, r] of t) this.set(i, r);
}
get(t) {
return super.get(ti(this, t));
}
has(t) {
return super.has(ti(this, t));
}
set(t, n) {
return super.set(Ms(this, t), n);
}
delete(t) {
return super.delete(As(this, t));
}
}
function ti({ _intern: e, _key: t }, n) {
const i = t(n);
return e.has(i) ? e.get(i) : n;
}
function Ms({ _intern: e, _key: t }, n) {
const i = t(n);
return e.has(i) ? e.get(i) : (e.set(i, n), n);
}
function As({ _intern: e, _key: t }, n) {
const i = t(n);
return e.has(i) && (n = e.get(n), e.delete(i)), n;
}
function Ps(e) {
return e !== null && typeof e == "object" ? e.valueOf() : e;
}
const Cs = Math.sqrt(50), Ls = Math.sqrt(10), ks = Math.sqrt(2);
function _e(e, t, n) {
const i = (t - e) / Math.max(0, n), r = Math.floor(Math.log10(i)), s = i / Math.pow(10, r), o = s >= Cs ? 10 : s >= Ls ? 5 : s >= ks ? 2 : 1;
let a, c, h;
return r < 0 ? (h = Math.pow(10, -r) / o, a = Math.round(e * h), c = Math.round(t * h), a / h < e && ++a, c / h > t && --c, h = -h) : (h = Math.pow(10, r) * o, a = Math.round(e / h), c = Math.round(t / h), a * h < e && ++a, c * h > t && --c), c < a && 0.5 <= n && n < 2 ? _e(e, t, n * 2) : [a, c, h];
}
function Es(e, t, n) {
if (t = +t, e = +e, n = +n, !(n > 0)) return [];
if (e === t) return [e];
const i = t < e, [r, s, o] = i ? _e(t, e, n) : _e(e, t, n);
if (!(s >= r)) return [];
const a = s - r + 1, c = new Array(a);
if (i)
if (o < 0) for (let h = 0; h < a; ++h) c[h] = (s - h) / -o;
else for (let h = 0; h < a; ++h) c[h] = (s - h) * o;
else if (o < 0) for (let h = 0; h < a; ++h) c[h] = (r + h) / -o;
else for (let h = 0; h < a; ++h) c[h] = (r + h) * o;
return c;
}
function on(e, t, n) {
return t = +t, e = +e, n = +n, _e(e, t, n)[2];
}
function Fs(e, t, n) {
t = +t, e = +e, n = +n;
const i = t < e, r = i ? on(t, e, n) : on(e, t, n);
return (i ? -1 : 1) * (r < 0 ? 1 / -r : r);
}
function an(e, t) {
let n;
if (t === void 0)
for (const i of e)
i != null && (n < i || n === void 0 && i >= i) && (n = i);
else {
let i = -1;
for (let r of e)
(r = t(r, ++i, e)) != null && (n < r || n === void 0 && r >= r) && (n = r);
}
return n;
}
function We(e, t) {
let n = 0;
if (t === void 0)
for (let i of e)
(i = +i) && (n += i);
else {
let i = -1;
for (let r of e)
(r = +t(r, ++i, e)) && (n += r);
}
return n;
}
function Qi(e, t) {
switch (arguments.length) {
case 0:
break;
case 1:
this.range(e);
break;
default:
this.range(t).domain(e);
break;
}
return this;
}
const ei = Symbol("implicit");
function Ji() {
var e = new Jn(), t = [], n = [], i = ei;
function r(s) {
let o = e.get(s);
if (o === void 0) {
if (i !== ei) return i;
e.set(s, o = t.push(s) - 1);
}
return n[o % n.length];
}
return r.domain = function(s) {
if (!arguments.length) return t.slice();
t = [], e = new Jn();
for (const o of s)
e.has(o) || e.set(o, t.push(o) - 1);
return r;
}, r.range = function(s) {
return arguments.length ? (n = Array.from(s), r) : n.slice();
}, r.unknown = function(s) {
return arguments.length ? (i = s, r) : i;
}, r.copy = function() {
return Ji(t, n).unknown(i);
}, Qi.apply(r, arguments), r;
}
function Fn(e, t, n) {
e.prototype = t.prototype = n, n.constructor = e;
}
function tr(e, t) {
var n = Object.create(e.prototype);
for (var i in t) n[i] = t[i];
return n;
}
function ee() {
}
var Zt = 0.7, xe = 1 / Zt, Dt = "\\s*([+-]?\\d+)\\s*", Kt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", ct = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Rs = /^#([0-9a-f]{3,8})$/, Is = new RegExp(`^rgb\\(${Dt},${Dt},${Dt}\\)$`), zs = new RegExp(`^rgb\\(${ct},${ct},${ct}\\)$`), Ds = new RegExp(`^rgba\\(${Dt},${Dt},${Dt},${Kt}\\)$`), Os = new RegExp(`^rgba\\(${ct},${ct},${ct},${Kt}\\)$`), Ns = new RegExp(`^hsl\\(${Kt},${ct},${ct}\\)$`), $s = new RegExp(`^hsla\\(${Kt},${ct},${ct},${Kt}\\)$`), ni = {
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
};
Fn(ee, mt, {
copy(e) {
return Object.assign(new this.constructor(), this, e);
},
displayable() {
return this.rgb().displayable();
},
hex: ii,
// Deprecated! Use color.formatHex.
formatHex: ii,
formatHex8: Bs,
formatHsl: Hs,
formatRgb: ri,
toString: ri
});
function ii() {
return this.rgb().formatHex();
}
function Bs() {
return this.rgb().formatHex8();
}
function Hs() {
return er(this).formatHsl();
}
function ri() {
return this.rgb().formatRgb();
}
function mt(e) {
var t, n;
return e = (e + "").trim().toLowerCase(), (t = Rs.exec(e)) ? (n = t[1].length, t = parseInt(t[1], 16), n === 6 ? si(t) : n === 3 ? new G(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : n === 8 ? re(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : n === 4 ? re(t >> 12 & 15 | t >> 8 & 240, t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, ((t & 15) << 4 | t & 15) / 255) : null) : (t = Is.exec(e)) ? new G(t[1], t[2], t[3], 1) : (t = zs.exec(e)) ? new G(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = Ds.exec(e)) ? re(t[1], t[2], t[3], t[4]) : (t = Os.exec(e)) ? re(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = Ns.exec(e)) ? ci(t[1], t[2] / 100, t[3] / 100, 1) : (t = $s.exec(e)) ? ci(t[1], t[2] / 100, t[3] / 100, t[4]) : ni.hasOwnProperty(e) ? si(ni[e]) : e === "transparent" ? new G(NaN, NaN, NaN, 0) : null;
}
function si(e) {
return new G(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
}
function re(e, t, n, i) {
return i <= 0 && (e = t = n = NaN), new G(e, t, n, i);
}
function Xs(e) {
return e instanceof ee || (e = mt(e)), e ? (e = e.rgb(), new G(e.r, e.g, e.b, e.opacity)) : new G();
}
function cn(e, t, n, i) {
return arguments.length === 1 ? Xs(e) : new G(e, t, n, i ?? 1);
}
function G(e, t, n, i) {
this.r = +e, this.g = +t, this.b = +n, this.opacity = +i;
}
Fn(G, cn, tr(ee, {
brighter(e) {
return e = e == null ? xe : Math.pow(xe, e), new G(this.r * e, this.g * e, this.b * e, this.opacity);
},
darker(e) {
return e = e == null ? Zt : Math.pow(Zt, e), new G(this.r * e, this.g * e, this.b * e, this.opacity);
},
rgb() {
return this;
},
clamp() {
return new G(Ct(this.r), Ct(this.g), Ct(this.b), ve(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: oi,
// Deprecated! Use color.formatHex.
formatHex: oi,
formatHex8: Us,
formatRgb: ai,
toString: ai
}));
function oi() {
return `#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}`;
}
function Us() {
return `#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}${Pt((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function ai() {
const e = ve(this.opacity);
return `${e === 1 ? "rgb(" : "rgba("}${Ct(this.r)}, ${Ct(this.g)}, ${Ct(this.b)}${e === 1 ? ")" : `, ${e})`}`;
}
function ve(e) {
return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
}
function Ct(e) {
return Math.max(0, Math.min(255, Math.round(e) || 0));
}
function Pt(e) {
return e = Ct(e), (e < 16 ? "0" : "") + e.toString(16);
}
function ci(e, t, n, i) {
return i <= 0 ? e = t = n = NaN : n <= 0 || n >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new rt(e, t, n, i);
}
function er(e) {
if (e instanceof rt) return new rt(e.h, e.s, e.l, e.opacity);
if (e instanceof ee || (e = mt(e)), !e) return new rt();
if (e instanceof rt) return e;
e = e.rgb();
var t = e.r / 255, n = e.g / 255, i = e.b / 255, r = Math.min(t, n, i), s = Math.max(t, n, i), o = NaN, a = s - r, c = (s + r) / 2;
return a ? (t === s ? o = (n - i) / a + (n < i) * 6 : n === s ? o = (i - t) / a + 2 : o = (t - n) / a + 4, a /= c < 0.5 ? s + r : 2 - s - r, o *= 60) : a = c > 0 && c < 1 ? 0 : o, new rt(o, a, c, e.opacity);
}
function Vs(e, t, n, i) {
return arguments.length === 1 ? er(e) : new rt(e, t, n, i ?? 1);
}
function rt(e, t, n, i) {
this.h = +e, this.s = +t, this.l = +n, this.opacity = +i;
}
Fn(rt, Vs, tr(ee, {
brighter(e) {
return e = e == null ? xe : Math.pow(xe, e), new rt(this.h, this.s, this.l * e, this.opacity);
},
darker(e) {
return e = e == null ? Zt : Math.pow(Zt, e), new rt(this.h, this.s, this.l * e, this.opacity);
},
rgb() {
var e = this.h % 360 + (this.h < 0) * 360, t = isNaN(e) || isNaN(this.s) ? 0 : this.s, n = this.l, i = n + (n < 0.5 ? n : 1 - n) * t, r = 2 * n - i;
return new G(
Ge(e >= 240 ? e - 240 : e + 120, r, i),
Ge(e, r, i),
Ge(e < 120 ? e + 240 : e - 120, r, i),
this.opacity
);
},
clamp() {
return new rt(hi(this.h), se(this.s), se(this.l), ve(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 e = ve(this.opacity);
return `${e === 1 ? "hsl(" : "hsla("}${hi(this.h)}, ${se(this.s) * 100}%, ${se(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
}
}));
function hi(e) {
return e = (e || 0) % 360, e < 0 ? e + 360 : e;
}
function se(e) {
return Math.max(0, Math.min(1, e || 0));
}
function Ge(e, t, n) {
return (e < 60 ? t + (n - t) * e / 60 : e < 180 ? n : e < 240 ? t + (n - t) * (240 - e) / 60 : t) * 255;
}
const Rn = (e) => () => e;
function Ys(e, t) {
return function(n) {
return e + n * t;
};
}
function Ws(e, t, n) {
return e = Math.pow(e, n), t = Math.pow(t, n) - e, n = 1 / n, function(i) {
return Math.pow(e + i * t, n);
};
}
function Gs(e) {
return (e = +e) == 1 ? nr : function(t, n) {
return n - t ? Ws(t, n, e) : Rn(isNaN(t) ? n : t);
};
}
function nr(e, t) {
var n = t - e;
return n ? Ys(e, n) : Rn(isNaN(e) ? t : e);
}
const Qt = (function e(t) {
var n = Gs(t);
function i(r, s) {
var o = n((r = cn(r)).r, (s = cn(s)).r), a = n(r.g, s.g), c = n(r.b, s.b), h = nr(r.opacity, s.opacity);
return function(l) {
return r.r = o(l), r.g = a(l), r.b = c(l), r.opacity = h(l), r + "";
};
}
return i.gamma = e, i;
})(1);
function qs(e, t) {
t || (t = []);
var n = e ? Math.min(t.length, e.length) : 0, i = t.slice(), r;
return function(s) {
for (r = 0; r < n; ++r) i[r] = e[r] * (1 - s) + t[r] * s;
return i;
};
}
function js(e) {
return ArrayBuffer.isView(e) && !(e instanceof DataView);
}
function Zs(e, t) {
var n = t ? t.length : 0, i = e ? Math.min(n, e.length) : 0, r = new Array(i), s = new Array(n), o;
for (o = 0; o < i; ++o) r[o] = In(e[o], t[o]);
for (; o < n; ++o) s[o] = t[o];
return function(a) {
for (o = 0; o < i; ++o) s[o] = r[o](a);
return s;
};
}
function Ks(e, t) {
var n = /* @__PURE__ */ new Date();
return e = +e, t = +t, function(i) {
return n.setTime(e * (1 - i) + t * i), n;
};
}
function it(e, t) {
return e = +e, t = +t, function(n) {
return e * (1 - n) + t * n;
};
}
function Qs(e, t) {
var n = {}, i = {}, r;
(e === null || typeof e != "object") && (e = {}), (t === null || typeof t != "object") && (t = {});
for (r in t)
r in e ? n[r] = In(e[r], t[r]) : i[r] = t[r];
return function(s) {
for (r in n) i[r] = n[r](s);
return i;
};
}
var hn = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, qe = new RegExp(hn.source, "g");
function Js(e) {
return function() {
return e;
};
}
function to(e) {
return function(t) {
return e(t) + "";
};
}
function ir(e, t) {
var n = hn.lastIndex = qe.lastIndex = 0, i, r, s, o = -1, a = [], c = [];
for (e = e + "", t = t + ""; (i = hn.exec(e)) && (r = qe.exec(t)); )
(s = r.index) > n && (s = t.slice(n, s), a[o] ? a[o] += s : a[++o] = s), (i = i[0]) === (r = r[0]) ? a[o] ? a[o] += r : a[++o] = r : (a[++o] = null, c.push({ i: o, x: it(i, r) })), n = qe.lastIndex;
return n < t.length && (s = t.slice(n), a[o] ? a[o] += s : a[++o] = s), a.length < 2 ? c[0] ? to(c[0].x) : Js(t) : (t = c.length, function(h) {
for (var l = 0, u; l < t; ++l) a[(u = c[l]).i] = u.x(h);
return a.join("");
});
}
function In(e, t) {
var n = typeof t, i;
return t == null || n === "boolean" ? Rn(t) : (n === "number" ? it : n === "string" ? (i = mt(t)) ? (t = i, Qt) : ir : t instanceof mt ? Qt : t instanceof Date ? Ks : js(t) ? qs : Array.isArray(t) ? Zs : typeof t.valueOf != "function" && typeof t.toString != "function" || isNaN(t) ? Qs : it)(e, t);
}
function eo(e, t) {
return e = +e, t = +t, function(n) {
return Math.round(e * (1 - n) + t * n);
};
}
var li = 180 / Math.PI, ln = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function rr(e, t, n, i, r, s) {
var o, a, c;
return (o = Math.sqrt(e * e + t * t)) && (e /= o, t /= o), (c = e * n + t * i) && (n -= e * c, i -= t * c), (a = Math.sqrt(n * n + i * i)) && (n /= a, i /= a, c /= a), e * i < t * n && (e = -e, t = -t, c = -c, o = -o), {
translateX: r,
translateY: s,
rotate: Math.atan2(t, e) * li,
skewX: Math.atan(c) * li,
scaleX: o,
scaleY: a
};
}
var oe;
function no(e) {
const t = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(e + "");
return t.isIdentity ? ln : rr(t.a, t.b, t.c, t.d, t.e, t.f);
}
function io(e) {
return e == null || (oe || (oe = document.createElementNS("http://www.w3.org/2000/svg", "g")), oe.setAttribute("transform", e), !(e = oe.transform.baseVal.consolidate())) ? ln : (e = e.matrix, rr(e.a, e.b, e.c, e.d, e.e, e.f));
}
function sr(e, t, n, i) {
function r(h) {
return h.length ? h.pop() + " " : "";
}
function s(h, l, u, f, d, p) {
if (h !== u || l !== f) {
var g = d.push("translate(", null, t, null, n);
p.push({ i: g - 4, x: it(h, u) }, { i: g - 2, x: it(l, f) });
} else (u || f) && d.push("translate(" + u + t + f + n);
}
function o(h, l, u, f) {
h !== l ? (h - l > 180 ? l += 360 : l - h > 180 && (h += 360), f.push({ i: u.push(r(u) + "rotate(", null, i) - 2, x: it(h, l) })) : l && u.push(r(u) + "rotate(" + l + i);
}
function a(h, l, u, f) {
h !== l ? f.push({ i: u.push(r(u) + "skewX(", null, i) - 2, x: it(h, l) }) : l && u.push(r(u) + "skewX(" + l + i);
}
function c(h, l, u, f, d, p) {
if (h !== u || l !== f) {
var g = d.push(r(d) + "scale(", null, ",", null, ")");
p.push({ i: g - 4, x: it(h, u) }, { i: g - 2, x: it(l, f) });
} else (u !== 1 || f !== 1) && d.push(r(d) + "scale(" + u + "," + f + ")");
}
return function(h, l) {
var u = [], f = [];
return h = e(h), l = e(l), s(h.translateX, h.translateY, l.translateX, l.translateY, u, f), o(h.rotate, l.rotate, u, f), a(h.skewX, l.skewX, u, f), c(h.scaleX, h.scaleY, l.scaleX, l.scaleY, u, f), h = l = null, function(d) {
for (var p = -1, g = f.length, y; ++p < g; ) u[(y = f[p]).i] = y.x(d);
return u.join("");
};
};
}
var ro = sr(no, "px, ", "px)", "deg)"), so = sr(io, ", ", ")", ")"), oo = 1e-12;
function ui(e) {
return ((e = Math.exp(e)) + 1 / e) / 2;
}
function ao(e) {
return ((e = Math.exp(e)) - 1 / e) / 2;
}
function co(e) {
return ((e = Math.exp(2 * e)) - 1) / (e + 1);
}
const ho = (function e(t, n, i) {
function r(s, o) {
var a = s[0], c = s[1], h = s[2], l = o[0], u = o[1], f = o[2], d = l - a, p = u - c, g = d * d + p * p, y, m;
if (g < oo)
m = Math.log(f / h) / t, y = function(T) {
return [
a + T * d,
c + T * p,
h * Math.exp(t * T * m)
];
};
else {
var _ = Math.sqrt(g), v = (f * f - h * h + i * g) / (2 * h * n * _), M = (f * f - h * h - i * g) / (2 * f * n * _), b = Math.log(Math.sqrt(v * v + 1) - v), S = Math.log(Math.sqrt(M * M + 1) - M);
m = (S - b) / t, y = function(T) {
var C = T * m, k = ui(b), R = h / (n * _) * (k * co(t * C + b) - ao(b));
return [
a + R * d,
c + R * p,
h * k / ui(t * C + b)
];
};
}
return y.duration = m * 1e3 * t / Math.SQRT2, y;
}
return r.rho = function(s) {
var o = Math.max(1e-3, +s), a = o * o, c = a * a;
return e(o, a, c);
}, r;
})(Math.SQRT2, 2, 4);
function lo(e, t) {
for (var n = new Array(t), i = 0; i < t; ++i) n[i] = e(i / (t - 1));
return n;
}
function uo(e) {
return function() {
return e;
};
}
function fo(e) {
return +e;
}
var fi = [0, 1];
function Rt(e) {
return e;
}
function un(e, t) {
return (t -= e = +e) ? function(n) {
return (n - e) / t;
} : uo(isNaN(t) ? NaN : 0.5);
}
function po(e, t) {
var n;
return e > t && (n = e, e = t, t = n), function(i) {
return Math.max(e, Math.min(t, i));
};
}
function go(e, t, n) {
var i = e[0], r = e[1], s = t[0], o = t[1];
return r < i ? (i = un(r, i), s = n(o, s)) : (i = un(i, r), s = n(s, o)), function(a) {
return s(i(a));
};
}
function mo(e, t, n) {
var i = Math.min(e.length, t.length) - 1, r = new Array(i), s = new Array(i), o = -1;
for (e[i] < e[0] && (e = e.slice().reverse(), t = t.slice().reverse()); ++o < i; )
r[o] = un(e[o], e[o + 1]), s[o] = n(t[o], t[o + 1]);
return function(a) {
var c = Ss(e, a, 1, i) - 1;
return s[c](r[c](a));
};
}
function yo(e, t) {
return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown());
}
function _o() {
var e = fi, t = fi, n = In, i, r, s, o = Rt, a, c, h;
function l() {
var f = Math.min(e.length, t.length);
return o !== Rt && (o = po(e[0], e[f - 1])), a = f > 2 ? mo : go, c = h = null, u;
}
function u(f) {
return f == null || isNaN(f = +f) ? s : (c || (c = a(e.map(i), t, n)))(i(o(f)));
}
return u.invert = function(f) {
return o(r((h || (h = a(t, e.map(i), it)))(f)));
}, u.domain = function(f) {
return arguments.length ? (e = Array.from(f, fo), l()) : e.slice();
}, u.range = function(f) {
return arguments.length ? (t = Array.from(f), l()) : t.slice();
}, u.rangeRound = function(f) {
return t = Array.from(f), n = eo, l();
}, u.clamp = function(f) {
return arguments.length ? (o = f ? !0 : Rt, l()) : o !== Rt;
}, u.interpolate = function(f) {
return arguments.length ? (n = f, l()) : n;
}, u.unknown = function(f) {
return arguments.length ? (s = f, u) : s;
}, function(f, d) {
return i = f, r = d, l();
};
}
function xo() {
return _o()(Rt, Rt);
}
function vo(e) {
return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
}
function we(e, t) {
if ((n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e")) < 0) return null;
var n, i = e.slice(0, n);
return [
i.length > 1 ? i[0] + i.slice(2) : i,
+e.slice(n + 1)
];
}
function Ot(e) {
return e = we(Math.abs(e)), e ? e[1] : NaN;
}
function wo(e, t) {
return function(n, i) {
for (var r = n.length, s = [], o = 0, a = e[0], c = 0; r > 0 && a > 0 && (c + a + 1 > i && (a = Math.max(1, i - c)), s.push(n.substring(r -= a, r + a)), !((c += a + 1) > i)); )
a = e[o = (o + 1) % e.length];
return s.reverse().join(t);
};
}
function bo(e) {
return function(t) {
return t.replace(/[0-9]/g, function(n) {
return e[+n];
});
};
}
var To = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function be(e) {
if (!(t = To.exec(e))) throw new Error("invalid format: " + e);
var t;
return new zn({
fill: t[1],
align: t[2],
sign: t[3],
symbol: t[4],
zero: t[5],
width: t[6],
comma: t[7],
precision: t[8] && t[8].slice(1),
trim: t[9],
type: t[10]
});
}
be.prototype = zn.prototype;
function zn(e) {
this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
}
zn.prototype.toString = function() {
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
function So(e) {
t: for (var t = e.length, n = 1, i = -1, r; n < t; ++n)
switch (e[n]) {
case ".":
i = r = n;
break;
case "0":
i === 0 && (i = n), r = n;
break;
default:
if (!+e[n]) break t;
i > 0 && (i = 0);
break;
}
return i > 0 ? e.slice(0, i) + e.slice(r + 1) : e;
}
var or;
function Mo(e, t) {
var n = we(e, t);
if (!n) return e + "";
var i = n[0], r = n[1], s = r - (or = Math.max(-8, Math.min(8, Math.floor(r / 3))) * 3) + 1, o = i.length;
return s === o ? i : s > o ? i + new Array(s - o + 1).join("0") : s > 0 ? i.slice(0, s) + "." + i.slice(s) : "0." + new Array(1 - s).join("0") + we(e, Math.max(0, t + s - 1))[0];
}
function di(e, t) {
var n = we(e, t);
if (!n) return e + "";
var i = n[0], r = n[1];
return r < 0 ? "0." + new Array(-r).join("0") + i : i.length > r + 1 ? i.slice(0, r + 1) + "." + i.slice(r + 1) : i + new Array(r - i.length + 2).join("0");
}
const pi = {
"%": (e, t) => (e * 100).toFixed(t),
b: (e) => Math.round(e).toString(2),
c: (e) => e + "",
d: vo,
e: (e, t) => e.toExponential(t),
f: (e, t) => e.toFixed(t),
g: (e, t) => e.toPrecision(t),
o: (e) => Math.round(e).toString(8),
p: (e, t) => di(e * 100, t),
r: di,
s: Mo,
X: (e) => Math.round(e).toString(16).toUpperCase(),
x: (e) => Math.round(e).toString(16)
};
function gi(e) {
return e;
}
var mi = Array.prototype.map, yi = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function Ao(e) {
var t = e.grouping === void 0 || e.thousands === void 0 ? gi : wo(mi.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", i = e.currency === void 0 ? "" : e.currency[1] + "", r = e.decimal === void 0 ? "." : e.decimal + "", s = e.numerals === void 0 ? gi : bo(mi.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", a = e.minus === void 0 ? "−" : e.minus + "", c = e.nan === void 0 ? "NaN" : e.nan + "";
function h(u) {
u = be(u);
var f = u.fill, d = u.align, p = u.sign, g = u.symbol, y = u.zero, m = u.width, _ = u.comma, v = u.precision, M = u.trim, b = u.type;
b === "n" ? (_ = !0, b = "g") : pi[b] || (v === void 0 && (v = 12), M = !0, b = "g"), (y || f === "0" && d === "=") && (y = !0, f = "0", d = "=");
var S = g === "$" ? n : g === "#" && /[boxX]/.test(b) ? "0" + b.toLowerCase() : "", T = g === "$" ? i : /[%p]/.test(b) ? o : "", C = pi[b], k = /[defgprs%]/.test(b);
v = v === void 0 ? 6 : /[gprs]/.test(b) ? Math.max(1, Math.min(21, v)) : Math.max(0, Math.min(20, v));
function R(P) {
var I = S, N = T, x, A, w;
if (b === "c")
N = C(P) + N, P = "";
else {
P = +P;
var L = P < 0 || 1 / P < 0;
if (P = isNaN(P) ? c : C(Math.abs(P), v), M && (P = So(P)), L && +P == 0 && p !== "+" && (L = !1), I = (L ? p === "(" ? p : a : p === "-" || p === "(" ? "" : p) + I, N = (b === "s" ? yi[8 + or / 3] : "") + N + (L && p === "(" ? ")" : ""), k) {
for (x = -1, A = P.length; ++x < A; )
if (w = P.charCodeAt(x), 48 > w || w > 57) {
N = (w === 46 ? r + P.slice(x + 1) : P.slice(x)) + N, P = P.slice(0, x);
break;
}
}
}
_ && !y && (P = t(P, 1 / 0));
var E = I.length + P.length + N.length, F = E < m ? new Array(m - E + 1).join(f) : "";
switch (_ && y && (P = t(F + P, F.length ? m - N.length : 1 / 0), F = ""), d) {
case "<":
P = I + P + N + F;
break;
case "=":
P = I + F + P + N;
break;
case "^":
P = F.slice(0, E = F.length >> 1) + I + P + N + F.slice(E);
break;
default:
P = F + I + P + N;
break;
}
return s(P);
}
return R.toString = function() {
return u + "";
}, R;
}
function l(u, f) {
var d = h((u = be(u), u.type = "f", u)), p = Math.max(-8, Math.min(8, Math.floor(Ot(f) / 3))) * 3, g = Math.pow(10, -p), y = yi[8 + p / 3];
return function(m) {
return d(g * m) + y;
};
}
return {
format: h,
formatPrefix: l
};
}
var ae, ar, cr;
Po({
thousands: ",",
grouping: [3],
currency: ["$", ""]
});
function Po(e) {
return ae = Ao(e), ar = ae.format, cr = ae.formatPrefix, ae;
}
function Co(e) {
return Math.max(0, -Ot(Math.abs(e)));
}
function Lo(e, t) {
return Math.max(0, Math.max(-8, Math.min(8, Math.floor(Ot(t) / 3))) * 3 - Ot(Math.abs(e)));
}
function ko(e, t) {
return e = Math.abs(e), t = Math.abs(t) - e, Math.max(0, Ot(t) - Ot(e)) + 1;
}
function Eo(e, t, n, i) {
var r = Fs(e, t, n), s;
switch (i = be(i ?? ",f"), i.type) {
case "s": {
var o = Math.max(Math.abs(e), Math.abs(t));
return i.precision == null && !isNaN(s = Lo(r, o)) && (i.precision = s), cr(i, o);
}
case "":
case "e":
case "g":
case "p":
case "r": {
i.precision == null && !isNaN(s = ko(r, Math.max(Math.abs(e), Math.abs(t)))) && (i.precision = s - (i.type === "e"));
break;
}
case "f":
case "%": {
i.precision == null && !isNaN(s = Co(r)) && (i.precision = s - (i.type === "%") * 2);
break;
}
}
return ar(i);
}
function Fo(e) {
var t = e.domain;
return e.ticks = function(n) {
var i = t();
return Es(i[0], i[i.length - 1], n ?? 10);
}, e.tickFormat = function(n, i) {
var r = t();
return Eo(r[0], r[r.length - 1], n ?? 10, i);
}, e.nice = function(n) {
n == null && (n = 10);
var i = t(), r = 0, s = i.length - 1, o = i[r], a = i[s], c, h, l = 10;
for (a < o && (h = o, o = a, a = h, h = r, r = s, s = h); l-- > 0; ) {
if (h = on(o, a, n), h === c)
return i[r] = o, i[s] = a, t(i);
if (h > 0)
o = Math.floor(o / h) * h, a = Math.ceil(a / h) * h;
else if (h < 0)
o = Math.ceil(o * h) / h, a = Math.floor(a * h) / h;
else
break;
c = h;
}
return e;
}, e;
}
function Lt() {
var e = xo();
return e.copy = function() {
return yo(e, Lt());
}, Qi.apply(e, arguments), Fo(e);
}
class Ro {
constructor(t, n = !0, i, r, s, o) {
this._showLabels = !0, this._offsetX = 0, this._offsetY = 0, this._flipX = !1, this._flipY = !1, this.visible = !0, this.createOrGet = (a) => {
const { mainGroup: c } = this;
let h = c.select(`g.${a}`);
return h.empty() && (h = c.append("g").attr("class", a)), h;
}, this.mainGroup = t, this._showLabels = n, this._labelXDesc = i, this._labelYDesc = r, this._unitOfMeasure = s, o && o.offsetX && (this._offsetX = o.offsetX), o && o.offsetX && (this._offsetY = o.offsetY), o && o.visible && (this.visible = o.visible), this.mainGroup.style("pointer-events", "none"), this._scaleX = Lt().domain([0, 1]).range([0, 1]), this._scaleY = Lt().domain([0, 1]).range([0, 1]);
}
renderLabelx() {
const {
_labelXDesc: t,
_unitOfMeasure: n,
_showLabels: i,
_scaleX: r
} = this, [, s] = r.range(), o = this.renderGx();
let a = o.select("text.axis-labelx");
return i ? a.empty() && (a = o.append("text").attr("class", "axis-labelx").attr("fill", "rgba(0,0,0,0.3)").style("text-anchor", "middle").style("font-weight", "800").style("font-size", "10px").text(`${t} (${n})`)) : a.remove(), a.attr("transform", `translate(${s / 2},-4)`), a;
}
renderLabely() {
const {
_labelYDesc: t,
_unitOfMeasure: n,
_showLabels: i,
_scaleY: r
} = this, [, s] = r.range(), o = this.renderGy();
let a = o.select("text.axis-labely");
return i ? (a.empty() && (a = o.append("text").attr("class", "axis-labely").attr("fill", "rgba(0,0,0,0.3)").style("text-anchor", "middle").style("font-weight", "800").style("font-size", "10px").text(`${t} (${n})`)), a.attr("transform", `translate(-10,${s / 2})rotate(90)`)) : a.remove(), a;
}
renderGy() {
const { _scaleX: t, _scaleY: n } = this, i = _s(n), [, r] = t.range(), s = this.createOrGet("y-axis");
return s.call(i), s.attr("transform", `translate(${r},0)`), s;
}
renderGx() {
const { _scaleX: t, _scaleY: n } = this, i = xs(t), [, r] = n.range(), s = this.createOrGet("x-axis");
return s.attr("transform", `translate(0 ${r})`), s.call(i), s;
}
render() {
this.renderLabelx(), this.renderLabely();
}
onResize(t) {
this.mainGroup.attr("height", `${t.height}px`).attr("width", `${t.width}px`);
}
onRescale(t) {
const { _scaleX: n, _scaleY: i, offsetX: r, offsetY: s } = this, { xScale: o, yScale: a } = t, c = o.domain(), h = a.domain(), l = o.range(), u = a.range();
n.domain([c[0] - r, c[1] - r]).range(l), i.domain([h[0] - s, h[1] - s]).range(u), this.flipX(this._flipX), this.flipY(this._flipY), this.visible && this.render();
}
show() {
return this.visible = !0, this.mainGroup.attr("visibility", "visible"), this.render(), this;
}
hide() {
return this.visible = !1, this.mainGroup.attr("visibility", "hidden"), this;
}
flipX(t) {
this._flipX = t;
const n = this._scaleX.domain(), i = t ? -1 : 1;
return this._scaleX.domain([i * n[0], i * n[1]]), this;
}
flipY(t) {
this._flipY = t;
const n = this._scaleY.domain(), i = t ? -1 : 1;
return this._scaleY.domain([i * n[0], i * n[1]]), this;
}
showLabels() {
return this._showLabels = !0, this.render(), this;
}
hideLabels() {
return this._showLabels = !1, this.render(), this;
}
setLabelX(t) {
return this._labelXDesc = t, this;
}
setLabelY(t) {
return this._labelYDesc = t, this;
}
setUnitOfMeasure(t) {
return this._unitOfMeasure = t, this;
}
setLabels(t, n, i) {
return this._labelXDesc = t, this._labelYDesc = n, this._unitOfMeasure = i, this;
}
get offsetX() {
return this._offsetX;
}
set offsetX(t) {
this._offsetX = t;
}
get offsetY() {
return this._offsetY;
}
set offsetY(t) {
this._offsetY = t;
}
get scaleX() {
return this._scaleX.copy();
}
get scaleY() {
return this._scaleY.copy();
}
}
const Io = Math.PI / 180;
function xt(e, t = 0, n = 1) {
return e < t ? t : e > n ? n : e;
}
function zo(e) {
return e * Io;
}
function _i(e) {
const t = new Array(e), n = 1 / (e - 1);
t[0] = 0;
for (let i = 1; i < e - 1; i++) t[i] = i * n;
return t[e - 1] = 1, t;
}
function Bt(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++) n[i] = e[i] + t[i];
return n;
}
function Ht(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++) n[i] = e[i] - t[i];
return n;
}
function St(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++) n[i] = e[i] * t;
return n;
}
function Do(e) {
for (var t = 0, n = 0; n < e.length; n++) t += Math.pow(e[n], 2);
return t;
}
function Yt(e) {
var t = Do(e);
return t === 0 ? t : Math.sqrt(t);
}
function xi(e, t) {
t === void 0 && (t = e);
var n = Yt(e);
return n === 0 ? Oo(0, t) : St(e, 1 / n, t);
}
function Oo(e, t) {
for (var n = 0; n < t.length; n++) t[n] = e;
return t;
}
function No(e, t) {
for (var n = 0, i = 0; i < e.length; i++) n += Math.pow(t[i] - e[i], 2);
return n === 0 ? n : Math.sqrt(n);
}
function $o(e, t) {
for (var n = 0, i = 0; i < e.length; i++) n += e[i] * t[i];
return n;
}
function Bo(e, t, n, i) {
i === void 0 && (i = e);
for (var r = xt(n, 0, 1), s = 1 - r, o = 0; o < e.length; o++) i[o] = e[o] * s + t[o] * r;
return i;
}
function Ho(e, t, n) {
n === void 0 && (n = e);
for (var i = 0; i < e.length; i++) n[i] = t(e[i], i);
return n;
}
function vi(e, t) {
t === void 0 && (t = 0), t === void 0 && (t = 0);
for (var n = 0; n < e.length; n++) if (Math.abs(e[n]) > t) return !1;
return !0;
}
var je = 180 / Math.PI, Xo = Math.PI / 180;
function Ze(e, t, n) {
var i = Math.cos(t), r = Math.sin(t), s = e[0];
return n[0] = i * s - r * e[1], n[1] = r * s + i * e[1], n;
}
function wi(e) {
return Math.atan2(e[1], e[0]);
}
function Xt(e, t) {
var n = Math.atan2(t[1], t[0]) - Math.atan2(e[1], e[0]);
return n > Math.PI ? n -= 2 * Math.PI : n <= -Math.PI && (n += 2 * Math.PI), n;
}
var D = (function() {
function e(t) {
for (var n = [], i = 1; i < arguments.length; i++) n[i - 1] = arguments[i];
this.isMutating = !1, this.length = 2, typeof t == "number" ? typeof n[0] == "number" ? (this[0] = t, this[1] = n[0]) : (this[0] = t, this[1] = t) : "x" in t && "y" in t ? (this[0] = t.x, this[1] = t.y) : (this[0] = t[0], this[1] = t[1]);
}
return Object.defineProperty(e.prototype, "x", { get: function() {
return this[0];
}, set: function(t) {
this[0] = t;
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "y", { get: function() {
return this[1];
}, set: function(t) {
this[1] = t;
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "magnitude", { get: function() {
return Yt(this);
}, set: function(t) {
var n = Yt(this);
St(this, t / n, this);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "mutable", { get: function() {
return this.isMutating = !0, this;
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e.prototype, "immutable", { get: function() {
return this.isMutating = !1, this;
}, enumerable: !1, configurable: !0 }), e.prototype.set = function(t, n) {
return typeof t == "number" ? typeof n == "number" ? (this[0] = t, this[1] = n) : (this[0] = t, this[1] = t) : (this[0] = t[0], this[1] = t[1]), this;
}, e.prototype.add = function(t, n) {
return n === void 0 && (n = 0), typeof t == "number" ? this.isMutating ? Bt(this, [t, n]) : Bt(this.clone(), [t, n]) : this.isMutating ? Bt(this, t) : Bt(this.clone(), t);
}, e.add = function(t, n) {
var i = new e(t);
return Bt(i, n);
}, e.prototype.sub = function(t, n) {
return n === void 0 && (n = 0), typeof t == "number" ? this.isMutating ? Ht(this, [t, n]) : Ht(this.clone(), [t, n]) : this.isMutating ? Ht(this, t) : Ht(this.clone(), t);
}, e.sub = function(t, n) {
var i = new e(t);
return Ht(i, n);
}, e.prototype.subFrom = function(t, n) {
return n === void 0 && (n = 0), typeof t == "number" ? this.isMutating ? (this[0] = t - this[0], this[1] = n - this[1], this) : new e(t - this[0], n - this[1]) : this.isMutating ? (this[0] = t[0] - this[0], this[1] = t[1] - this[1], this) : new e(t[0] - this[0], t[1] - this[1]);
}, e.divide = function(t, n) {
var i = new e(t);
return St(i, 1 / n);
}, e.multiply = function(t, n) {
var i = new e(t);
return St(i, n);
}, e.prototype.scale = function(t) {
return St(this, t, this.isMutating ? this : e.zero);
}, e.prototype.rescale = function(t) {
var n = Yt(this);
return n <= 0 ? this.isMutating ? this : e.zero : St(this, t / n, this.isMutating ? this : e.zero);
}, e.prototype.clampMagnitude = function(t) {
var n = Yt(this);
return n > t ? St(this, t / n, this.isMutating ? this : e.zero) : this.isMutating ? this : this.clone();
}, e.prototype.rotate = function(t) {
return Ze(this, t, this.isMutating ? this : e.zero);
}, e.prototype.rotateDeg = function(t) {
return Ze(this, t * Xo, this.isMutating ? this : e.zero);
}, e.prototype.rotate90 = function() {
return t = this, n = this.isMutating ? this : e.zero, i = t[0], n[0] = -t[1], n[1] = i, n;
var t, n, i;
}, e.prototype.rotate180 = function() {
return t = this, (n = this.isMutating ? this : e.zero)[0] = -t[0], n[1] = -t[1], n;
var t, n;
}, e.prototype.rotate270 = function() {
return t = this, n = this.isMutating ? this : e.zero, i = t[0], n[0] = t[1], n[1] = -i, n;
var t, n, i;
}, e.prototype.normalize = function() {
return xi(this);
}, e.prototype.normalized = function() {
return xi(this, e.zero);
}, e.distance = function(t, n) {
return No(t, n);
}, e.dot = function(t, n) {
return $o(t, n);
}, e.cross = function(t, n) {
return (function(i, r) {
return i[0] * r[1] - i[1] * r[0];
})(t, n);
}, e.angleRight = function(t) {
return wi(t);
}, e.angleRightDeg = function(t) {
return wi(t) * je;
}, e.angle = function(t, n) {
return Math.abs(Xt(t, n));
}, e.angleDeg = function(t, n) {
return Math.abs(Xt(t, n)) * je;
}, e.signedAngle = function(t, n) {
return Xt(t, n);
}, e.signedAngleDeg = function(t, n) {
return Xt(t, n) * je;
}, e.lerp = function(t, n, i) {
var r = new e(t);
return Bo(r, n, i);
}, e.lerpRot = function(t, n, i) {
return (function(r, s, o, a) {
return a === void 0 && (a = r), Ze(r, o * Xt(r, s), a);
})(t, n, i, e.zero);
}, e.prototype.clone = function() {
return new e(this[0], this[1]);
}, e.equals = function(t, n, i) {
return i === void 0 && (i = 0), !(Math.abs(t[0] - n[0]) > i) && !(Math.abs(t[1] - n[1]) > i);
}, e.prototype.equals = function(t, n) {
return n === void 0 && (n = 0), e.equals(this, t, n);
}, e.isZeroVector = function(t, n) {
return n === void 0 && (n = 0), vi(t, n);
}, e.prototype.isZeroVector = function(t) {
return t === void 0 && (t = 0), vi(this, t);
}, e.prototype.toArray = function() {
return [this[0], this[1]];
}, e.prototype.modify = function(t) {
return Ho(this, t);
}, e.prototype[Symbol.iterator] = function() {
var t = this, n = 0;
return { next: function() {
switch (n++) {
case 0:
return { value: t[0], done: !1 };
case 1:
return { value: t[1], done: !1 };
default:
return { value: -1, done: !0 };
}
} };
}, Object.defineProperty(e, "zero", { get: function() {
return new e(0, 0);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "one", { get: function() {
return new e(1, 1);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "positiveInfinity", { get: function() {
return new e(1 / 0, 1 / 0);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "negativeInfinity", { get: function() {
return new e(-1 / 0, -1 / 0);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "up", { get: function() {
return new e(0, 1);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "right", { get: function() {
return new e(1, 0);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "down", { get: function() {
return new e(0, -1);
}, enumerable: !1, configurable: !0 }), Object.defineProperty(e, "left", { get: function() {
return new e(-1, 0);
}, enumerable: !1, configurable: !0 }), e;
})();
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var fn = function(e, t) {
return fn = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
n.__proto__ = i;
} || function(n, i) {
for (var r in i) i.hasOwnProperty(r) && (n[r] = i[r]);
}, fn(e, t);
};
function hr(e, t) {
function n() {
this.constructor = e;
}
fn(e, t), e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
}
var Te = function() {
return Te = Object.assign || function(e) {
for (var t, n = 1, i = arguments.length; n < i; n++) for (var r in t = arguments[n]) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
return e;
}, Te.apply(this, arguments);
};
function bi(e, t) {
for (var n = new Array(e.length), i = 0; i < e.length; i++) n[i] = 2 * e[i] - t[i];
return n;
}
function dn(e, t, n) {
var i, r, s, o, a = t.length - 1;
if (n) i = t[e - 1 < 0 ? a : e - 1], r = t[e % t.length], s = t[(e + 1) % t.length], o = t[(e + 2) % t.length];
else {
if (e === a) throw Error("There is no spline segment at this index for a closed curve!");
r = t[e], s = t[e + 1], i = e > 0 ? t[e - 1] : bi(r, s), o = e < a - 1 ? t[e + 2] : bi(s, r);
}
return [i, r, s, o];
}
function Uo(e, t, n) {
n === void 0 && (n = !1);
var i = n ? t.length : t.length - 1;
if (e === 1) return { index: i - 1, weight: 1 };
var r = i * e, s = Math.floor(r);
return { index: s, weight: r - s };
}
function Vo(e, t) {
for (var n = 0; n < e.length; n++) e[n] = t;
return e;
}
function Yo(e, t) {
for (var n = 0; n < e.length; n++) e[n] = t(e[n], n);
return e;
}
function Wo(e, t, n) {
n === void 0 && (n = 0);
for (var i = 0; i < e.length; i++) n = t(n, e[i], i);
return n;
}
function fe(e, t) {
t = t || new Array(e.length);
for (var n = 0; n < e.length; n++) t[n] = e[n];
return t;
}
function W(e, t, n) {
return t === void 0 && (t = 0), n === void 0 && (n = 1), e < t ? t : e > n ? n : e;
}
function