ranui
Version:
A framework-agnostic Web Components UI library built on native custom elements, with TypeScript types, light/dark theming, SSR and PWA support.
1,378 lines (1,377 loc) • 42.2 kB
JavaScript
import { n as _ } from "./chunk-Y2CYZVJY-0JxdZxki.js";
import { m as g, p as Rt } from "./src-DtRLxcYO.js";
import { R as Lt, h as S, p as Dt, r as nt, s as R } from "./chunk-WYO6CB5R-DDHkKowO.js";
import { t as Ft } from "./dist-C0Fwsvsq.js";
function st(t) {
this._context = t;
}
st.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(t, i) : this._context.moveTo(t, i);
break;
case 1:
this._point = 2;
default:
this._context.lineTo(t, i);
break;
}
}
};
function Wt(t) {
return new st(t);
}
var rt = class {
constructor(t, i) {
this._context = t, this._x = i;
}
areaStart() {
this._line = 0;
}
areaEnd() {
this._line = NaN;
}
lineStart() {
this._point = 0;
}
lineEnd() {
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
}
point(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(t, i) : this._context.moveTo(t, i);
break;
case 1:
this._point = 2;
default:
this._x ? this._context.bezierCurveTo(this._x0 = (this._x0 + t) / 2, this._y0, this._x0, i, t, i) : this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + i) / 2, t, this._y0, t, i);
break;
}
this._x0 = t, this._y0 = i;
}
};
function zt(t) {
return new rt(t, !0);
}
function Tt(t) {
return new rt(t, !1);
}
function d() {
}
function N(t, i, n) {
t._context.bezierCurveTo((2 * t._x0 + t._x1) / 3, (2 * t._y0 + t._y1) / 3, (t._x0 + 2 * t._x1) / 3, (t._y0 + 2 * t._y1) / 3, (t._x0 + 4 * t._x1 + i) / 6, (t._y0 + 4 * t._y1 + n) / 6);
}
function M(t) {
this._context = t;
}
M.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 3:
N(this, this._x1, this._y1);
case 2:
this._context.lineTo(this._x1, this._y1);
break;
}
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(t, i) : this._context.moveTo(t, i);
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
default:
N(this, t, i);
break;
}
this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = i;
}
};
function jt(t) {
return new M(t);
}
function at(t) {
this._context = t;
}
at.prototype = {
areaStart: d,
areaEnd: d,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN, this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 1:
this._context.moveTo(this._x2, this._y2), this._context.closePath();
break;
case 2:
this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3), this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3), this._context.closePath();
break;
case 3:
this.point(this._x2, this._y2), this.point(this._x3, this._y3), this.point(this._x4, this._y4);
break;
}
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1, this._x2 = t, this._y2 = i;
break;
case 1:
this._point = 2, this._x3 = t, this._y3 = i;
break;
case 2:
this._point = 3, this._x4 = t, this._y4 = i, this._context.moveTo((this._x0 + 4 * this._x1 + t) / 6, (this._y0 + 4 * this._y1 + i) / 6);
break;
default:
N(this, t, i);
break;
}
this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = i;
}
};
function Ht(t) {
return new at(t);
}
function ht(t) {
this._context = t;
}
ht.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
},
lineEnd: function() {
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1;
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3;
var n = (this._x0 + 4 * this._x1 + t) / 6, e = (this._y0 + 4 * this._y1 + i) / 6;
this._line ? this._context.lineTo(n, e) : this._context.moveTo(n, e);
break;
case 3:
this._point = 4;
default:
N(this, t, i);
break;
}
this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = i;
}
};
function Ut(t) {
return new ht(t);
}
function ot(t, i) {
this._basis = new M(t), this._beta = i;
}
ot.prototype = {
lineStart: function() {
this._x = [], this._y = [], this._basis.lineStart();
},
lineEnd: function() {
var t = this._x, i = this._y, n = t.length - 1;
if (n > 0)
for (var e = t[0], r = i[0], a = t[n] - e, s = i[n] - r, h = -1, o; ++h <= n; )
o = h / n, this._basis.point(this._beta * t[h] + (1 - this._beta) * (e + o * a), this._beta * i[h] + (1 - this._beta) * (r + o * s));
this._x = this._y = null, this._basis.lineEnd();
},
point: function(t, i) {
this._x.push(+t), this._y.push(+i);
}
};
var Xt = (function t(i) {
function n(e) {
return i === 1 ? new M(e) : new ot(e, i);
}
return n.beta = function(e) {
return t(+e);
}, n;
})(0.85);
function A(t, i, n) {
t._context.bezierCurveTo(t._x1 + t._k * (t._x2 - t._x0), t._y1 + t._k * (t._y2 - t._y0), t._x2 + t._k * (t._x1 - i), t._y2 + t._k * (t._y1 - n), t._x2, t._y2);
}
function L(t, i) {
this._context = t, this._k = (1 - i) / 6;
}
L.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 2:
this._context.lineTo(this._x2, this._y2);
break;
case 3:
A(this, this._x1, this._y1);
break;
}
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(t, i) : this._context.moveTo(t, i);
break;
case 1:
this._point = 2, this._x1 = t, this._y1 = i;
break;
case 2:
this._point = 3;
default:
A(this, t, i);
break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = i;
}
};
var Yt = (function t(i) {
function n(e) {
return new L(e, i);
}
return n.tension = function(e) {
return t(+e);
}, n;
})(0);
function D(t, i) {
this._context = t, this._k = (1 - i) / 6;
}
D.prototype = {
areaStart: d,
areaEnd: d,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 1:
this._context.moveTo(this._x3, this._y3), this._context.closePath();
break;
case 2:
this._context.lineTo(this._x3, this._y3), this._context.closePath();
break;
case 3:
this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
break;
}
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1, this._x3 = t, this._y3 = i;
break;
case 1:
this._point = 2, this._context.moveTo(this._x4 = t, this._y4 = i);
break;
case 2:
this._point = 3, this._x5 = t, this._y5 = i;
break;
default:
A(this, t, i);
break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = i;
}
};
var qt = (function t(i) {
function n(e) {
return new D(e, i);
}
return n.tension = function(e) {
return t(+e);
}, n;
})(0);
function F(t, i) {
this._context = t, this._k = (1 - i) / 6;
}
F.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
},
lineEnd: function() {
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1;
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
break;
case 3:
this._point = 4;
default:
A(this, t, i);
break;
}
this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = i;
}
};
var Kt = (function t(i) {
function n(e) {
return new F(e, i);
}
return n.tension = function(e) {
return t(+e);
}, n;
})(0);
function W(t, i, n) {
var e = t._x1, r = t._y1, a = t._x2, s = t._y2;
if (t._l01_a > 1e-12) {
var h = 2 * t._l01_2a + 3 * t._l01_a * t._l12_a + t._l12_2a, o = 3 * t._l01_a * (t._l01_a + t._l12_a);
e = (e * h - t._x0 * t._l12_2a + t._x2 * t._l01_2a) / o, r = (r * h - t._y0 * t._l12_2a + t._y2 * t._l01_2a) / o;
}
if (t._l23_a > 1e-12) {
var c = 2 * t._l23_2a + 3 * t._l23_a * t._l12_a + t._l12_2a, f = 3 * t._l23_a * (t._l23_a + t._l12_a);
a = (a * c + t._x1 * t._l23_2a - i * t._l12_2a) / f, s = (s * c + t._y1 * t._l23_2a - n * t._l12_2a) / f;
}
t._context.bezierCurveTo(e, r, a, s, t._x2, t._y2);
}
function _t(t, i) {
this._context = t, this._alpha = i;
}
_t.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 2:
this._context.lineTo(this._x2, this._y2);
break;
case 3:
this.point(this._x2, this._y2);
break;
}
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
if (t = +t, i = +i, this._point) {
var n = this._x2 - t, e = this._y2 - i;
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
}
switch (this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(t, i) : this._context.moveTo(t, i);
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3;
default:
W(this, t, i);
break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = i;
}
};
var Gt = (function t(i) {
function n(e) {
return i ? new _t(e, i) : new L(e, 0);
}
return n.alpha = function(e) {
return t(+e);
}, n;
})(0.5);
function ct(t, i) {
this._context = t, this._alpha = i;
}
ct.prototype = {
areaStart: d,
areaEnd: d,
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 1:
this._context.moveTo(this._x3, this._y3), this._context.closePath();
break;
case 2:
this._context.lineTo(this._x3, this._y3), this._context.closePath();
break;
case 3:
this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
break;
}
},
point: function(t, i) {
if (t = +t, i = +i, this._point) {
var n = this._x2 - t, e = this._y2 - i;
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
}
switch (this._point) {
case 0:
this._point = 1, this._x3 = t, this._y3 = i;
break;
case 1:
this._point = 2, this._context.moveTo(this._x4 = t, this._y4 = i);
break;
case 2:
this._point = 3, this._x5 = t, this._y5 = i;
break;
default:
W(this, t, i);
break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = i;
}
};
var Jt = (function t(i) {
function n(e) {
return i ? new ct(e, i) : new D(e, 0);
}
return n.alpha = function(e) {
return t(+e);
}, n;
})(0.5);
function ft(t, i) {
this._context = t, this._alpha = i;
}
ft.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
},
lineEnd: function() {
(this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
if (t = +t, i = +i, this._point) {
var n = this._x2 - t, e = this._y2 - i;
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + e * e, this._alpha));
}
switch (this._point) {
case 0:
this._point = 1;
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
break;
case 3:
this._point = 4;
default:
W(this, t, i);
break;
}
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = i;
}
};
var Zt = (function t(i) {
function n(e) {
return i ? new ft(e, i) : new F(e, 0);
}
return n.alpha = function(e) {
return t(+e);
}, n;
})(0.5);
function lt(t) {
this._context = t;
}
lt.prototype = {
areaStart: d,
areaEnd: d,
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
this._point && this._context.closePath();
},
point: function(t, i) {
t = +t, i = +i, this._point ? this._context.lineTo(t, i) : (this._point = 1, this._context.moveTo(t, i));
}
};
function Qt(t) {
return new lt(t);
}
function G(t) {
return t < 0 ? -1 : 1;
}
function J(t, i, n) {
var e = t._x1 - t._x0, r = i - t._x1, a = (t._y1 - t._y0) / (e || r < 0 && -0), s = (n - t._y1) / (r || e < 0 && -0), h = (a * r + s * e) / (e + r);
return (G(a) + G(s)) * Math.min(Math.abs(a), Math.abs(s), 0.5 * Math.abs(h)) || 0;
}
function Z(t, i) {
var n = t._x1 - t._x0;
return n ? (3 * (t._y1 - t._y0) / n - i) / 2 : i;
}
function k(t, i, n) {
var e = t._x0, r = t._y0, a = t._x1, s = t._y1, h = (a - e) / 3;
t._context.bezierCurveTo(e + h, r + h * i, a - h, s - h * n, a, s);
}
function E(t) {
this._context = t;
}
E.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
},
lineEnd: function() {
switch (this._point) {
case 2:
this._context.lineTo(this._x1, this._y1);
break;
case 3:
k(this, this._t0, Z(this, this._t0));
break;
}
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
},
point: function(t, i) {
var n = NaN;
if (t = +t, i = +i, !(t === this._x1 && i === this._y1)) {
switch (this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(t, i) : this._context.moveTo(t, i);
break;
case 1:
this._point = 2;
break;
case 2:
this._point = 3, k(this, Z(this, n = J(this, t, i)), n);
break;
default:
k(this, this._t0, n = J(this, t, i));
break;
}
this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = i, this._t0 = n;
}
}
};
function ut(t) {
this._context = new pt(t);
}
(ut.prototype = Object.create(E.prototype)).point = function(t, i) {
E.prototype.point.call(this, i, t);
};
function pt(t) {
this._context = t;
}
pt.prototype = {
moveTo: function(t, i) {
this._context.moveTo(i, t);
},
closePath: function() {
this._context.closePath();
},
lineTo: function(t, i) {
this._context.lineTo(i, t);
},
bezierCurveTo: function(t, i, n, e, r, a) {
this._context.bezierCurveTo(i, t, e, n, a, r);
}
};
function Vt(t) {
return new E(t);
}
function Ct(t) {
return new ut(t);
}
function yt(t) {
this._context = t;
}
yt.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x = [], this._y = [];
},
lineEnd: function() {
var t = this._x, i = this._y, n = t.length;
if (n)
if (this._line ? this._context.lineTo(t[0], i[0]) : this._context.moveTo(t[0], i[0]), n === 2) this._context.lineTo(t[1], i[1]);
else
for (var e = Q(t), r = Q(i), a = 0, s = 1; s < n; ++a, ++s) this._context.bezierCurveTo(e[0][a], r[0][a], e[1][a], r[1][a], t[s], i[s]);
(this._line || this._line !== 0 && n === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
},
point: function(t, i) {
this._x.push(+t), this._y.push(+i);
}
};
function Q(t) {
var i, n = t.length - 1, e, r = new Array(n), a = new Array(n), s = new Array(n);
for (r[0] = 0, a[0] = 2, s[0] = t[0] + 2 * t[1], i = 1; i < n - 1; ++i) r[i] = 1, a[i] = 4, s[i] = 4 * t[i] + 2 * t[i + 1];
for (r[n - 1] = 2, a[n - 1] = 7, s[n - 1] = 8 * t[n - 1] + t[n], i = 1; i < n; ++i) e = r[i] / a[i - 1], a[i] -= e, s[i] -= e * s[i - 1];
for (r[n - 1] = s[n - 1] / a[n - 1], i = n - 2; i >= 0; --i) r[i] = (s[i] - r[i + 1]) / a[i];
for (a[n - 1] = (t[n] + r[n - 1]) / 2, i = 0; i < n - 1; ++i) a[i] = 2 * t[i + 1] - r[i + 1];
return [r, a];
}
function ti(t) {
return new yt(t);
}
function P(t, i) {
this._context = t, this._t = i;
}
P.prototype = {
areaStart: function() {
this._line = 0;
},
areaEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._x = this._y = NaN, this._point = 0;
},
lineEnd: function() {
0 < this._t && this._t < 1 && this._point === 2 && this._context.lineTo(this._x, this._y), (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
},
point: function(t, i) {
switch (t = +t, i = +i, this._point) {
case 0:
this._point = 1, this._line ? this._context.lineTo(t, i) : this._context.moveTo(t, i);
break;
case 1:
this._point = 2;
default:
if (this._t <= 0)
this._context.lineTo(this._x, i), this._context.lineTo(t, i);
else {
var n = this._x * (1 - this._t) + t * this._t;
this._context.lineTo(n, this._y), this._context.lineTo(n, i);
}
break;
}
this._x = t, this._y = i;
}
};
function ii(t) {
return new P(t, 0.5);
}
function ei(t) {
return new P(t, 0);
}
function ni(t) {
return new P(t, 1);
}
function $(t) {
if (typeof t != "object" || t == null) return !1;
if (Object.getPrototypeOf(t) === null) return !0;
if (Object.prototype.toString.call(t) !== "[object Object]") {
const n = t[Symbol.toStringTag];
return n == null || !Object.getOwnPropertyDescriptor(t, Symbol.toStringTag)?.writable ? !1 : t.toString() === `[object ${n}]`;
}
let i = t;
for (; Object.getPrototypeOf(i) !== null; ) i = Object.getPrototypeOf(i);
return Object.getPrototypeOf(t) === i;
}
function si() {
}
function dt(t) {
return Object.getOwnPropertySymbols(t).filter((i) => Object.prototype.propertyIsEnumerable.call(t, i));
}
function z(t) {
return t == null ? t === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(t);
}
var ri = "[object RegExp]", xt = "[object String]", gt = "[object Number]", mt = "[object Boolean]", bt = "[object Arguments]", ai = "[object Symbol]", hi = "[object Date]", oi = "[object Map]", _i = "[object Set]", ci = "[object Array]", fi = "[object ArrayBuffer]", li = "[object Object]", ui = "[object DataView]", pi = "[object Uint8Array]", yi = "[object Uint8ClampedArray]", di = "[object Uint16Array]", xi = "[object Uint32Array]", gi = "[object Int8Array]", mi = "[object Int16Array]", bi = "[object Int32Array]", wi = "[object Float32Array]", vi = "[object Float64Array]", V = typeof globalThis == "object" && globalThis || typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || /* @__PURE__ */ (function() {
return this;
})();
function wt(t) {
return typeof V.Buffer < "u" && V.Buffer.isBuffer(t);
}
function Si(t) {
return Number.isSafeInteger(t) && t >= 0;
}
function Oi(t) {
return t != null && typeof t != "function" && Si(t.length);
}
function Ni(t) {
return t === "__proto__";
}
function T(t) {
return t == null || typeof t != "object" && typeof t != "function";
}
function j(t) {
return ArrayBuffer.isView(t) && !(t instanceof DataView);
}
function Ai(t, i) {
return x(t, void 0, t, /* @__PURE__ */ new Map(), i);
}
function x(t, i, n, e = /* @__PURE__ */ new Map(), r = void 0) {
const a = r?.(t, i, n, e);
if (a !== void 0) return a;
if (T(t)) return t;
if (e.has(t)) return e.get(t);
if (Array.isArray(t)) {
const s = new Array(t.length);
e.set(t, s);
for (let h = 0; h < t.length; h++) s[h] = x(t[h], h, n, e, r);
return Object.hasOwn(t, "index") && (s.index = t.index), Object.hasOwn(t, "input") && (s.input = t.input), s;
}
if (t instanceof Date) return new Date(t.getTime());
if (t instanceof RegExp) {
const s = new RegExp(t.source, t.flags);
return s.lastIndex = t.lastIndex, s;
}
if (t instanceof Map) {
const s = /* @__PURE__ */ new Map();
e.set(t, s);
for (const [h, o] of t) s.set(h, x(o, h, n, e, r));
return s;
}
if (t instanceof Set) {
const s = /* @__PURE__ */ new Set();
e.set(t, s);
for (const h of t) s.add(x(h, void 0, n, e, r));
return s;
}
if (wt(t)) return t.subarray();
if (j(t)) {
const s = new (Object.getPrototypeOf(t)).constructor(t.length);
e.set(t, s);
for (let h = 0; h < t.length; h++) s[h] = x(t[h], h, n, e, r);
return s;
}
if (t instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && t instanceof SharedArrayBuffer) return t.slice(0);
if (t instanceof DataView) {
const s = new DataView(t.buffer.slice(0), t.byteOffset, t.byteLength);
return e.set(t, s), u(s, t, n, e, r), s;
}
if (typeof File < "u" && t instanceof File) {
const s = new File([t], t.name, { type: t.type });
return e.set(t, s), u(s, t, n, e, r), s;
}
if (typeof Blob < "u" && t instanceof Blob) {
const s = new Blob([t], { type: t.type });
return e.set(t, s), u(s, t, n, e, r), s;
}
if (t instanceof Error) {
const s = structuredClone(t);
return e.set(t, s), s.message = t.message, s.name = t.name, s.stack = t.stack, s.cause = t.cause, s.constructor = t.constructor, u(s, t, n, e, r), s;
}
if (t instanceof Boolean) {
const s = new Boolean(t.valueOf());
return e.set(t, s), u(s, t, n, e, r), s;
}
if (t instanceof Number) {
const s = new Number(t.valueOf());
return e.set(t, s), u(s, t, n, e, r), s;
}
if (t instanceof String) {
const s = new String(t.valueOf());
return e.set(t, s), u(s, t, n, e, r), s;
}
if (typeof t == "object" && Ei(t)) {
const s = Object.create(Object.getPrototypeOf(t));
return e.set(t, s), u(s, t, n, e, r), s;
}
return t;
}
function u(t, i, n = t, e, r) {
const a = [...Object.keys(i), ...dt(i)];
for (let s = 0; s < a.length; s++) {
const h = a[s], o = Object.getOwnPropertyDescriptor(t, h);
(o == null || o.writable) && (t[h] = x(i[h], h, n, e, r));
}
}
function Ei(t) {
switch (z(t)) {
case bt:
case ci:
case fi:
case ui:
case mt:
case hi:
case wi:
case vi:
case gi:
case mi:
case bi:
case oi:
case gt:
case li:
case ri:
case _i:
case xt:
case ai:
case pi:
case yi:
case di:
case xi:
return !0;
default:
return !1;
}
}
function Mi(t, i) {
return Ai(t, (n, e, r, a) => {
const s = i?.(n, e, r, a);
if (s !== void 0) return s;
if (typeof t == "object") {
if (z(t) === "[object Object]" && typeof t.constructor != "function") {
const h = {};
return a.set(t, h), u(h, t, r, a), h;
}
switch (Object.prototype.toString.call(t)) {
case gt:
case xt:
case mt: {
const h = new t.constructor(t?.valueOf());
return u(h, t), h;
}
case bt: {
const h = {};
return u(h, t), h.length = t.length, h[Symbol.iterator] = t[Symbol.iterator], h;
}
default:
return;
}
}
});
}
function C(t) {
return Mi(t);
}
function tt(t) {
return t !== null && typeof t == "object" && z(t) === "[object Arguments]";
}
function I(t) {
return typeof t == "object" && t !== null;
}
function Pi(t) {
return I(t) && Oi(t);
}
function b(t, i) {
if (typeof t != "function" || i != null && typeof i != "function") throw new TypeError("Expected a function");
const n = function(...e) {
const r = i ? i.apply(this, e) : e[0], a = n.cache;
if (a.has(r)) return a.get(r);
const s = t.apply(this, e);
return n.cache = a.set(r, s) || a, s;
};
return n.cache = new (b.Cache || Map)(), n;
}
b.Cache = Map;
function B(t) {
return j(t);
}
function ki(t) {
if (T(t)) return t;
if (Array.isArray(t) || j(t) || t instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && t instanceof SharedArrayBuffer) return t.slice(0);
const i = Object.getPrototypeOf(t);
if (i == null) return Object.assign(Object.create(i), t);
const n = i.constructor;
if (t instanceof Date || t instanceof Map || t instanceof Set) return new n(t);
if (t instanceof RegExp) {
const e = new n(t);
return e.lastIndex = t.lastIndex, e;
}
if (t instanceof DataView) return new n(t.buffer.slice(0));
if (t instanceof Error) {
let e;
return t instanceof AggregateError ? e = new n(t.errors, t.message, { cause: t.cause }) : e = new n(t.message, { cause: t.cause }), e.stack = t.stack, Object.assign(e, t), e;
}
return typeof File < "u" && t instanceof File ? new n([t], t.name, {
type: t.type,
lastModified: t.lastModified
}) : typeof t == "object" ? Object.assign(Object.create(i), t) : t;
}
function $i(t, ...i) {
const n = i.slice(0, -1), e = i[i.length - 1];
let r = t;
for (let a = 0; a < n.length; a++) {
const s = n[a];
r = O(r, s, e, /* @__PURE__ */ new Map());
}
return r;
}
function O(t, i, n, e) {
if (T(t) && (t = Object(t)), i == null || typeof i != "object") return t;
if (e.has(i)) return ki(e.get(i));
if (e.set(i, t), Array.isArray(i)) {
i = i.slice();
for (let a = 0; a < i.length; a++) i[a] = i[a] ?? void 0;
}
const r = [...Object.keys(i), ...dt(i)];
for (let a = 0; a < r.length; a++) {
const s = r[a];
if (Ni(s)) continue;
let h = i[s], o = t[s];
if (tt(h) && (h = { ...h }), tt(o) && (o = { ...o }), wt(h) && (h = C(h)), Array.isArray(h)) if (Array.isArray(o)) {
const f = [], l = Reflect.ownKeys(o);
for (let p = 0; p < l.length; p++) {
const y = l[p];
f[y] = o[y];
}
o = f;
} else if (Pi(o)) {
const f = [];
for (let l = 0; l < o.length; l++) f[l] = o[l];
o = f;
} else o = [];
const c = n(o, h, s, t, i, e);
c !== void 0 ? t[s] = c : Array.isArray(h) || I(o) && I(h) && ($(o) || $(h) || B(o) || B(h)) ? t[s] = O(o, h, n, e) : o == null && $(h) ? t[s] = O({}, h, n, e) : o == null && B(h) ? t[s] = C(h) : (o === void 0 || h !== void 0) && (t[s] = h);
}
return t;
}
function Bi(t, ...i) {
return $i(t, ...i, si);
}
var Ii = Ft();
var Ri = {
curveBasis: jt,
curveBasisClosed: Ht,
curveBasisOpen: Ut,
curveBumpX: zt,
curveBumpY: Tt,
curveBundle: Xt,
curveCardinalClosed: qt,
curveCardinalOpen: Kt,
curveCardinal: Yt,
curveCatmullRomClosed: Jt,
curveCatmullRomOpen: Zt,
curveCatmullRom: Gt,
curveLinear: Wt,
curveLinearClosed: Qt,
curveMonotoneX: Vt,
curveMonotoneY: Ct,
curveNatural: ti,
curveStep: ii,
curveStepAfter: ni,
curveStepBefore: ei
}, Li = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi, Di = /* @__PURE__ */ _(function(t, i) {
const n = vt(t, /(?:init\b)|(?:initialize\b)/);
let e = {};
if (Array.isArray(n)) {
const s = n.map((h) => h.args);
Lt(s), e = nt(e, [...s]);
} else e = n.args;
if (!e) return;
let r = Dt(t, i);
const a = "config";
return e[a] !== void 0 && (r === "flowchart-v2" && (r = "flowchart"), e[r] = e[a], delete e[a]), e;
}, "detectInit"), vt = /* @__PURE__ */ _(function(t, i = null) {
try {
const n = new RegExp(`[%]{2}(?![{]${Li.source})(?=[}][%]{2}).*
`, "ig");
t = t.trim().replace(n, "").replace(/'/gm, '"'), g.debug(`Detecting diagram directive${i !== null ? " type:" + i : ""} based on the text:${t}`);
let e;
const r = [];
for (; (e = S.exec(t)) !== null; )
if (e.index === S.lastIndex && S.lastIndex++, e && !i || i && e[1]?.match(i) || i && e[2]?.match(i)) {
const a = e[1] ? e[1] : e[2], s = e[3] ? e[3].trim() : e[4] ? JSON.parse(e[4].trim()) : null;
r.push({
type: a,
args: s
});
}
return r.length === 0 ? {
type: t,
args: null
} : r.length === 1 ? r[0] : r;
} catch (n) {
return g.error(`ERROR: ${n.message} - Unable to parse directive type: '${i}' based on the text: '${t}'`), {
type: void 0,
args: null
};
}
}, "detectDirective"), ee = /* @__PURE__ */ _(function(t) {
return t.replace(S, "");
}, "removeDirectives"), Fi = /* @__PURE__ */ _(function(t, i) {
for (const [n, e] of i.entries()) if (e.match(t)) return n;
return -1;
}, "isSubstringInArray");
function St(t, i) {
return t ? Ri[`curve${t.charAt(0).toUpperCase() + t.slice(1)}`] ?? i : i;
}
_(St, "interpolateToCurve");
function Ot(t, i) {
const n = t.trim();
if (n)
return i.securityLevel !== "loose" ? (0, Ii.sanitizeUrl)(n) : n;
}
_(Ot, "formatUrl");
var Wi = /* @__PURE__ */ _((t, ...i) => {
const n = t.split("."), e = n.length - 1, r = n[e];
let a = window;
for (let s = 0; s < e; s++)
if (a = a[n[s]], !a) {
g.error(`Function name: ${t} not found in window`);
return;
}
a[r](...i);
}, "runFunc");
function H(t, i) {
return !t || !i ? 0 : Math.sqrt(Math.pow(i.x - t.x, 2) + Math.pow(i.y - t.y, 2));
}
_(H, "distance");
function Nt(t) {
let i, n = 0;
return t.forEach((e) => {
n += H(e, i), i = e;
}), U(t, n / 2);
}
_(Nt, "traverseEdge");
function At(t) {
return t.length === 1 ? t[0] : Nt(t);
}
_(At, "calcLabelPosition");
var it = /* @__PURE__ */ _((t, i = 2) => {
const n = Math.pow(10, i);
return Math.round(t * n) / n;
}, "roundNumber"), U = /* @__PURE__ */ _((t, i) => {
let n, e = i;
for (const r of t) {
if (n) {
const a = H(r, n);
if (a === 0) return n;
if (a < e) e -= a;
else {
const s = e / a;
if (s <= 0) return n;
if (s >= 1) return {
x: r.x,
y: r.y
};
if (s > 0 && s < 1) return {
x: it((1 - s) * n.x + s * r.x, 5),
y: it((1 - s) * n.y + s * r.y, 5)
};
}
}
n = r;
}
throw new Error("Could not find a suitable point for the given distance");
}, "calculatePoint"), zi = /* @__PURE__ */ _((t, i, n) => {
g.info(`our points ${JSON.stringify(i)}`), i[0] !== n && (i = i.reverse());
const e = U(i, 25), r = t ? 10 : 5, a = Math.atan2(i[0].y - e.y, i[0].x - e.x), s = {
x: 0,
y: 0
};
return s.x = Math.sin(a) * r + (i[0].x + e.x) / 2, s.y = -Math.cos(a) * r + (i[0].y + e.y) / 2, s;
}, "calcCardinalityPosition");
function Et(t, i, n) {
const e = structuredClone(n);
g.info("our points", e), i !== "start_left" && i !== "start_right" && e.reverse();
const r = U(e, 25 + t), a = 10 + t * 0.5, s = Math.atan2(e[0].y - r.y, e[0].x - r.x), h = {
x: 0,
y: 0
};
return i === "start_left" ? (h.x = Math.sin(s + Math.PI) * a + (e[0].x + r.x) / 2, h.y = -Math.cos(s + Math.PI) * a + (e[0].y + r.y) / 2) : i === "end_right" ? (h.x = Math.sin(s - Math.PI) * a + (e[0].x + r.x) / 2 - 5, h.y = -Math.cos(s - Math.PI) * a + (e[0].y + r.y) / 2 - 5) : i === "end_left" ? (h.x = Math.sin(s) * a + (e[0].x + r.x) / 2 - 5, h.y = -Math.cos(s) * a + (e[0].y + r.y) / 2 - 5) : (h.x = Math.sin(s) * a + (e[0].x + r.x) / 2, h.y = -Math.cos(s) * a + (e[0].y + r.y) / 2), h;
}
_(Et, "calcTerminalLabelPosition");
function Mt(t) {
let i = "", n = "";
for (const e of t) e !== void 0 && (e.startsWith("color:") || e.startsWith("text-align:") ? n = n + e + ";" : i = i + e + ";");
return {
style: i,
labelStyle: n
};
}
_(Mt, "getStylesFromArray");
var et = 0, Ti = /* @__PURE__ */ _(() => (et++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + et), "generateId");
function Pt(t) {
let i = "";
const n = "0123456789abcdef";
for (let r = 0; r < t; r++) i += n.charAt(Math.floor(Math.random() * 16));
return i;
}
_(Pt, "makeRandomHex");
var ji = /* @__PURE__ */ _((t) => Pt(t.length), "random"), Hi = /* @__PURE__ */ _(function() {
return {
x: 0,
y: 0,
fill: void 0,
anchor: "start",
style: "#666",
width: 100,
height: 100,
textMargin: 0,
rx: 0,
ry: 0,
valign: void 0,
text: ""
};
}, "getTextObj"), Ui = /* @__PURE__ */ _(function(t, i) {
const n = i.text.replace(R.lineBreakRegex, " "), [, e] = Y(i.fontSize), r = t.append("text");
r.attr("x", i.x), r.attr("y", i.y), r.style("text-anchor", i.anchor), r.style("font-family", i.fontFamily), r.style("font-size", e), r.style("font-weight", i.fontWeight), r.attr("fill", i.fill), i.class !== void 0 && r.attr("class", i.class);
const a = r.append("tspan");
return a.attr("x", i.x + i.textMargin * 2), a.attr("fill", i.fill), a.text(n), r;
}, "drawSimpleText"), Xi = b((t, i, n) => {
if (!t || (n = Object.assign({
fontSize: 12,
fontWeight: 400,
fontFamily: "Arial",
joinWith: "<br/>"
}, n), R.lineBreakRegex.test(t))) return t;
const e = t.split(" ").filter(Boolean), r = [];
let a = "";
return e.forEach((s, h) => {
const o = m(`${s} `, n), c = m(a, n);
if (o > i) {
const { hyphenatedStrings: f, remainingWord: l } = Yi(s, i, "-", n);
r.push(a, ...f), a = l;
} else c + o >= i ? (r.push(a), a = s) : a = [a, s].filter(Boolean).join(" ");
h + 1 === e.length && r.push(a);
}), r.filter((s) => s !== "").join(n.joinWith);
}, (t, i, n) => `${t}${i}${n.fontSize}${n.fontWeight}${n.fontFamily}${n.joinWith}`), Yi = b((t, i, n = "-", e) => {
e = Object.assign({
fontSize: 12,
fontWeight: 400,
fontFamily: "Arial",
margin: 0
}, e);
const r = [...t], a = [];
let s = "";
return r.forEach((h, o) => {
const c = `${s}${h}`;
if (m(c, e) >= i) {
const f = o + 1, l = r.length === f, p = `${c}${n}`;
a.push(l ? c : p), s = "";
} else s = c;
}), {
hyphenatedStrings: a,
remainingWord: s
};
}, (t, i, n = "-", e) => `${t}${i}${n}${e.fontSize}${e.fontWeight}${e.fontFamily}`);
function kt(t, i) {
return X(t, i).height;
}
_(kt, "calculateTextHeight");
function m(t, i) {
return X(t, i).width;
}
_(m, "calculateTextWidth");
var X = b((t, i) => {
const { fontSize: n = 12, fontFamily: e = "Arial", fontWeight: r = 400 } = i;
if (!t) return {
width: 0,
height: 0
};
const [, a] = Y(n), s = ["sans-serif", e], h = t.split(R.lineBreakRegex), o = [], c = Rt("body");
if (!c.remove) return {
width: 0,
height: 0,
lineHeight: 0
};
const f = c.append("svg");
for (const l of s) {
let p = 0;
const y = {
width: 0,
height: 0,
lineHeight: 0
};
for (const It of h) {
const q = Hi();
q.text = It || "";
const K = Ui(f, q).style("font-size", a).style("font-weight", r).style("font-family", l), w = (K._groups || K)[0][0].getBBox();
if (w.width === 0 && w.height === 0) throw new Error("svg element not in render tree");
y.width = Math.round(Math.max(y.width, w.width)), p = Math.round(w.height), y.height += p, y.lineHeight = Math.round(Math.max(y.lineHeight, p));
}
o.push(y);
}
return f.remove(), o[isNaN(o[1].height) || isNaN(o[1].width) || isNaN(o[1].lineHeight) || o[0].height > o[1].height && o[0].width > o[1].width && o[0].lineHeight > o[1].lineHeight ? 0 : 1];
}, (t, i) => `${t}${i.fontSize}${i.fontWeight}${i.fontFamily}`), qi = class {
constructor(t = !1, i) {
this.count = 0, this.count = i ? i.length : 0, this.next = t ? () => this.count++ : () => Date.now();
}
static {
_(this, "InitIDGenerator");
}
}, v, Ki = /* @__PURE__ */ _(function(t) {
return v = v || document.createElement("div"), t = escape(t).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";"), v.innerHTML = t, unescape(v.textContent);
}, "entityDecode");
function Gi(t) {
return "str" in t;
}
_(Gi, "isDetailedError");
var Ji = /* @__PURE__ */ _((t, i, n, e) => {
if (!e) return;
const r = t.node()?.getBBox();
r && t.append("text").text(e).attr("text-anchor", "middle").attr("x", r.x + r.width / 2).attr("y", -n).attr("class", i);
}, "insertTitle"), Y = /* @__PURE__ */ _((t) => {
if (typeof t == "number") return [t, t + "px"];
const i = parseInt(t ?? "", 10);
return Number.isNaN(i) ? [void 0, void 0] : t === String(i) ? [i, t + "px"] : [i, t];
}, "parseFontSize");
function $t(t, i) {
return Bi({}, t, i);
}
_($t, "cleanAndMerge");
var ne = {
assignWithDepth: nt,
wrapLabel: Xi,
calculateTextHeight: kt,
calculateTextWidth: m,
calculateTextDimensions: X,
cleanAndMerge: $t,
detectInit: Di,
detectDirective: vt,
isSubstringInArray: Fi,
interpolateToCurve: St,
calcLabelPosition: At,
calcCardinalityPosition: zi,
calcTerminalLabelPosition: Et,
formatUrl: Ot,
getStylesFromArray: Mt,
generateId: Ti,
random: ji,
runFunc: Wi,
entityDecode: Ki,
insertTitle: Ji,
isLabelCoordinateInPath: Bt,
parseFontSize: Y,
InitIDGenerator: qi
}, se = /* @__PURE__ */ _(function(t) {
let i = t;
return i = i.replace(/style.*:\S*#.*;/g, function(n) {
return n.substring(0, n.length - 1);
}), i = i.replace(/classDef.*:\S*#.*;/g, function(n) {
return n.substring(0, n.length - 1);
}), i = i.replace(/#\w+;/g, function(n) {
const e = n.substring(1, n.length - 1);
return /^\+?\d+$/.test(e) ? "fl°°" + e + "¶ß" : "fl°" + e + "¶ß";
}), i;
}, "encodeEntities"), re = /* @__PURE__ */ _(function(t) {
return t.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";");
}, "decodeEntities"), ae = /* @__PURE__ */ _((t, i, { counter: n = 0, prefix: e, suffix: r }, a) => a || `${e ? `${e}_` : ""}${t}_${i}_${n}${r ? `_${r}` : ""}`, "getEdgeId");
function Zi(t) {
return t ?? null;
}
_(Zi, "handleUndefinedAttr");
function Bt(t, i) {
const n = Math.round(t.x), e = Math.round(t.y), r = i.replace(/(\d+\.\d+)/g, (a) => Math.round(parseFloat(a)).toString());
return r.includes(n.toString()) || r.includes(e.toString());
}
_(Bt, "isLabelCoordinateInPath");
export {
Yt as $,
vi as A,
ai as B,
bt as C,
ui as D,
mt as E,
gt as F,
z as G,
xi as H,
li as I,
ii as J,
ni as K,
ri as L,
bi as M,
gi as N,
hi as O,
oi as P,
Gt as Q,
_i as R,
wt as S,
ci as T,
pi as U,
di as V,
yi as W,
Vt as X,
ti as Y,
Ct as Z,
Xi as _,
re as a,
T as b,
ae as c,
St as d,
jt as et,
Gi as f,
ne as g,
ee as h,
$t as i,
mi as j,
wi as k,
Mt as l,
ji as m,
kt as n,
Tt as nt,
se as o,
Y as p,
ei as q,
m as r,
Wt as rt,
Ti as s,
X as t,
zt as tt,
Zi as u,
B as v,
fi as w,
Oi as x,
tt as y,
xt as z
};